diff options
Diffstat (limited to 'src')
2124 files changed, 55422 insertions, 34609 deletions
diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp index ae5dbf82643..e09671f8f16 100644 --- a/src/devices/bus/a2bus/a2bus.cpp +++ b/src/devices/bus/a2bus/a2bus.cpp @@ -205,8 +205,6 @@ uint8_t a2bus_device::get_a2bus_nmi_mask() void a2bus_device::set_irq_line(int state, int slot) { - m_out_irq_cb(state); - if (state == CLEAR_LINE) { m_slot_irq_mask &= ~(1<<slot); @@ -215,6 +213,8 @@ void a2bus_device::set_irq_line(int state, int slot) { m_slot_irq_mask |= (1<<slot); } + + m_out_irq_cb(state); } void a2bus_device::set_nmi_line(int state, int slot) diff --git a/src/devices/bus/a2bus/a2hsscsi.cpp b/src/devices/bus/a2bus/a2hsscsi.cpp index 98c612dae78..20342e6fd14 100644 --- a/src/devices/bus/a2bus/a2hsscsi.cpp +++ b/src/devices/bus/a2bus/a2hsscsi.cpp @@ -2,7 +2,7 @@ // copyright-holders:R. Belmont /********************************************************************* - a2hsscsi.c + a2hsscsi.cpp Implementation of the Apple II High Speed SCSI Card @@ -101,7 +101,8 @@ a2bus_hsscsi_device::a2bus_hsscsi_device(const machine_config &mconfig, device_t device_t(mconfig, type, tag, owner, clock), device_a2bus_card_interface(mconfig, *this), m_ncr5380(*this, SCSI_5380_TAG), - m_scsibus(*this, SCSI_BUS_TAG), m_rom(nullptr), m_rambank(0), m_rombank(0), m_drq(0), m_bank(0), m_816block(false), m_c0ne(0), m_c0nf(0) + m_scsibus(*this, SCSI_BUS_TAG), m_rom(*this, SCSI_ROM_REGION), m_rambank(0), m_rombank(0), m_drq(0), m_bank(0), m_c0ne(0), m_c0nf(0), + m_dma_addr(0), m_dma_size(0) { } @@ -116,8 +117,6 @@ a2bus_hsscsi_device::a2bus_hsscsi_device(const machine_config &mconfig, const ch void a2bus_hsscsi_device::device_start() { - m_rom = machine().root_device().memregion(this->subtag(SCSI_ROM_REGION).c_str())->base(); - memset(m_ram, 0, 8192); save_item(NAME(m_ram)); @@ -125,15 +124,16 @@ void a2bus_hsscsi_device::device_start() save_item(NAME(m_rombank)); save_item(NAME(m_bank)); save_item(NAME(m_drq)); - save_item(NAME(m_816block)); + save_item(NAME(m_dma_addr)); + save_item(NAME(m_dma_size)); } void a2bus_hsscsi_device::device_reset() { m_rambank = 0; m_rombank = 0; + m_dma_addr = m_dma_size = 0; m_c0ne = m_c0nf = 0; - m_816block = false; } @@ -151,13 +151,35 @@ uint8_t a2bus_hsscsi_device::read_c0nx(uint8_t offset) case 3: case 4: case 5: - case 6: case 7: // logerror("Read 5380 @ %x\n", offset); return m_ncr5380->read(offset); - case 0xc: - return 0x00; // indicate watchdog? + case 6: + if (m_dma_control & 1) // pseudo-DMA? + { + return m_ncr5380->dma_r(); + } + else + { + //printf("Read 5380 PIO data (%s)\n", machine().describe_context().c_str()); + return m_ncr5380->read(offset); + } + + case 8: // DMA address low + return m_dma_addr & 0xff; + + case 9: // DMA address high + return (m_dma_addr >> 8) & 0xff; + + case 0xa: // DMA size low + return m_dma_size & 0xff; + + case 0xb: // DMA size high + return (m_dma_size >> 8) & 0xff; + + case 0xc: // DMA control + return m_dma_control; case 0xe: // code at cf32 wants to RMW this without killing the ROM bank return m_c0ne; @@ -166,7 +188,7 @@ uint8_t a2bus_hsscsi_device::read_c0nx(uint8_t offset) return m_c0nf; default: - logerror("Read c0n%x (%s)\n", offset, machine().describe_context()); + logerror("Read c0n%x (%s)\n", offset, machine().describe_context().c_str()); break; } @@ -182,7 +204,17 @@ void a2bus_hsscsi_device::write_c0nx(uint8_t offset, uint8_t data) { switch (offset) { - case 0: + case 0: // data out register; in PDMA mode, it's assumed this goes to DMA as reads do + if (m_dma_control & 1) + { + m_ncr5380->dma_w(data); + } + else + { + m_ncr5380->write(offset, data); + } + break; + case 1: case 2: case 3: @@ -193,25 +225,39 @@ void a2bus_hsscsi_device::write_c0nx(uint8_t offset, uint8_t data) // logerror("%02x to 5380 reg %x\n", data, offset); m_ncr5380->write(offset, data); break; -#if 0 + case 8: // DMA address low + //printf("%02x to DMA adr low\n", data); + m_dma_addr &= 0xff00; + m_dma_addr |= data; break; case 9: // DMA address high + //printf("%02x to DMA adr high\n", data); + m_dma_addr &= 0x00ff; + m_dma_addr |= (data << 8); break; case 0xa: // DMA count low + //printf("%02x to DMA count low\n", data); + m_dma_size &= 0xff00; + m_dma_size |= data; break; case 0xb: // DMA count high + //printf("%02x to DMA count high\n", data); + m_dma_size &= 0x00ff; + m_dma_size |= (data << 8); break; case 0xc: // DMA control + //printf("%02x to DMA control\n", data); + m_dma_control &= ~0x2b; // clear the read/write bits + m_dma_control |= (data & 0x2b); break; -#endif case 0xd: // DMA enable / reset - logerror("%02x to DMA enable/reset\n", data); + //printf("%02x to DMA enable/reset\n", data); if (data & 0x2) { // logerror("Resetting SCSI: %02x at %s\n", data, machine().describe_context()); @@ -222,17 +268,17 @@ void a2bus_hsscsi_device::write_c0nx(uint8_t offset, uint8_t data) case 0xe: m_c0ne = data; m_rombank = (data & 0x1f) * 0x400; - logerror("c0ne to %x (ROM bank %x)\n", data & 0x1f, m_rombank); + //logerror("c0ne to %x (ROM bank %x)\n", data & 0x1f, m_rombank); break; case 0xf: m_c0nf = data; m_rambank = (data & 0x7) * 0x400; - logerror("c0nf to %x (RAM bank %x)\n", data & 0x7, m_rambank); + //logerror("c0nf to %x (RAM bank %x)\n", data & 0x7, m_rambank); break; default: - logerror("Write %02x to c0n%x (%s)\n", data, offset, machine().describe_context()); + logerror("Write %02x to c0n%x (%s)\n", data, offset, machine().describe_context().c_str()); break; } } @@ -263,11 +309,6 @@ uint8_t a2bus_hsscsi_device::read_c800(uint16_t offset) if (offset < 0x400) { // logerror("Read RAM at %x = %02x\n", offset+m_rambank, m_ram[offset + m_rambank]); - if (m_816block) - { - return m_ncr5380->dma_r(); - } - return m_ram[offset + m_rambank]; } else @@ -284,18 +325,12 @@ void a2bus_hsscsi_device::write_c800(uint16_t offset, uint8_t data) if (offset < 0x400) { // logerror("%02x to RAM at %x\n", data, offset+m_rambank); - if (m_816block) - { - m_ncr5380->dma_w(data); - } - else - { - m_ram[offset + m_rambank] = data; - } + m_ram[offset + m_rambank] = data; } } WRITE_LINE_MEMBER( a2bus_hsscsi_device::drq_w ) { m_drq = (state ? 0x80 : 0x00); +// printf("DRQ to %d\n", state); } diff --git a/src/devices/bus/a2bus/a2hsscsi.h b/src/devices/bus/a2bus/a2hsscsi.h index 905de8b620d..36a5a9df15b 100644 --- a/src/devices/bus/a2bus/a2hsscsi.h +++ b/src/devices/bus/a2bus/a2hsscsi.h @@ -50,15 +50,16 @@ protected: required_device<ncr53c80_device> m_ncr5380; required_device<nscsi_bus_device> m_scsibus; + required_region_ptr<u8> m_rom; private: - uint8_t *m_rom; uint8_t m_ram[8192]; // 8 banks of 1024 bytes int m_rambank, m_rombank; uint8_t m_drq; uint8_t m_bank; - bool m_816block; + uint8_t m_dma_control; uint8_t m_c0ne, m_c0nf; + uint16_t m_dma_addr, m_dma_size; }; // device type definition diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp index f9de57897f8..1ef164aff41 100644 --- a/src/devices/bus/a2bus/a2mcms.cpp +++ b/src/devices/bus/a2bus/a2mcms.cpp @@ -206,7 +206,7 @@ mcms_device::mcms_device(const machine_config &mconfig, const char *tag, device_ void mcms_device::device_start() { m_write_irq.resolve(); - m_stream = stream_alloc_legacy(0, 2, 31250); + m_stream = stream_alloc(0, 2, 31250); m_timer = timer_alloc(0, nullptr); m_clrtimer = timer_alloc(1, nullptr); m_enabled = false; @@ -252,20 +252,19 @@ void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param, } } -void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; int i, v; uint16_t wptr; int8_t sample; int32_t mixL, mixR; - outL = outputs[1]; - outR = outputs[0]; + auto &outL = outputs[1]; + auto &outR = outputs[0]; if (m_enabled) { - for (i = 0; i < samples; i++) + for (i = 0; i < outL.samples(); i++) { mixL = mixR = 0; @@ -286,16 +285,14 @@ void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample } } - outL[i] = (mixL * m_mastervol)>>9; - outR[i] = (mixR * m_mastervol)>>9; + outL.put_int(i, mixL * m_mastervol, 32768 << 9); + outR.put_int(i, mixR * m_mastervol, 32768 << 9); } } else { - for (i = 0; i < samples; i++) - { - outL[i] = outR[i] = 0; - } + outL.fill(0); + outR.fill(0); } } diff --git a/src/devices/bus/a2bus/a2mcms.h b/src/devices/bus/a2bus/a2mcms.h index 11e8b332ee0..487c6ddb7a7 100644 --- a/src/devices/bus/a2bus/a2mcms.h +++ b/src/devices/bus/a2bus/a2mcms.h @@ -42,7 +42,7 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/devices/bus/a2bus/a2mockingboard.cpp b/src/devices/bus/a2bus/a2mockingboard.cpp index 167c7dc2f6f..c7f5fda534d 100644 --- a/src/devices/bus/a2bus/a2mockingboard.cpp +++ b/src/devices/bus/a2bus/a2mockingboard.cpp @@ -53,7 +53,7 @@ void a2bus_ayboard_device::add_common_devices(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); AY8913(config, m_ay1, 1022727); - m_ay1->add_route(ALL_OUTPUTS, "lspeaker", 1.0); + m_ay1->add_route(ALL_OUTPUTS, "lspeaker", 0.5); } void a2bus_ayboard_device::device_add_mconfig(machine_config &config) @@ -61,7 +61,7 @@ void a2bus_ayboard_device::device_add_mconfig(machine_config &config) add_common_devices(config); AY8913(config, m_ay2, 1022727); - m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 1.0); + m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 0.5); } void a2bus_mockingboard_device::device_add_mconfig(machine_config &config) @@ -72,7 +72,7 @@ void a2bus_mockingboard_device::device_add_mconfig(machine_config &config) m_via1->cb2_handler().set(FUNC(a2bus_mockingboard_device::write_via1_cb2)); AY8913(config, m_ay2, 1022727); - m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 1.0); + m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 0.5); VOTRAX_SC01(config, m_sc01, 1022727); m_sc01->ar_callback().set(m_via1, FUNC(via6522_device::write_cb1)); @@ -92,9 +92,9 @@ void a2bus_phasor_device::device_add_mconfig(machine_config &config) AY8913(config, m_ay2, 1022727); AY8913(config, m_ay3, 1022727); AY8913(config, m_ay4, 1022727); - m_ay2->add_route(ALL_OUTPUTS, "lspeaker2", 1.0); - m_ay3->add_route(ALL_OUTPUTS, "rspeaker", 1.0); - m_ay4->add_route(ALL_OUTPUTS, "rspeaker2", 1.0); + m_ay2->add_route(ALL_OUTPUTS, "lspeaker2", 0.5); + m_ay3->add_route(ALL_OUTPUTS, "rspeaker", 0.5); + m_ay4->add_route(ALL_OUTPUTS, "rspeaker2", 0.5); } void a2bus_echoplus_device::device_add_mconfig(machine_config &config) @@ -102,7 +102,7 @@ void a2bus_echoplus_device::device_add_mconfig(machine_config &config) add_common_devices(config); AY8913(config, m_ay2, 1022727); - m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 1.0); + m_ay2->add_route(ALL_OUTPUTS, "rspeaker", 0.5); SPEAKER(config, "echosp").front_center(); TMS5220(config, m_tms, 640000); @@ -414,16 +414,35 @@ void a2bus_phasor_device::via2_out_b(uint8_t data) } } +void a2bus_phasor_device::set_clocks() +{ + if (m_native) + { + m_ay1->set_clock(1022727*2); + m_ay2->set_clock(1022727*2); + m_ay3->set_clock(1022727*2); + m_ay4->set_clock(1022727*2); + } + else + { + m_ay1->set_clock(1022727); + m_ay2->set_clock(1022727); + m_ay3->set_clock(1022727); + m_ay4->set_clock(1022727); + } +} uint8_t a2bus_phasor_device::read_c0nx(uint8_t offset) { m_native = BIT(offset, 0); + set_clocks(); return 0xff; } void a2bus_phasor_device::write_c0nx(uint8_t offset, uint8_t data) { m_native = BIT(offset, 0); + set_clocks(); } uint8_t a2bus_echoplus_device::read_c0nx(uint8_t offset) diff --git a/src/devices/bus/a2bus/a2mockingboard.h b/src/devices/bus/a2bus/a2mockingboard.h index 6d4aa8e73af..44acff10006 100644 --- a/src/devices/bus/a2bus/a2mockingboard.h +++ b/src/devices/bus/a2bus/a2mockingboard.h @@ -97,6 +97,8 @@ protected: required_device<ay8913_device> m_ay4; private: + void set_clocks(); + bool m_native; }; diff --git a/src/devices/bus/a2bus/a2ultraterm.cpp b/src/devices/bus/a2bus/a2ultraterm.cpp index 7b6caa40624..e8d5972e4ec 100644 --- a/src/devices/bus/a2bus/a2ultraterm.cpp +++ b/src/devices/bus/a2bus/a2ultraterm.cpp @@ -304,11 +304,10 @@ void a2bus_videx160_device::write_c800(uint16_t offset, uint8_t data) MC6845_UPDATE_ROW( a2bus_videx160_device::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); uint8_t chr = m_ram[ offset ]; diff --git a/src/devices/bus/a2bus/a2videoterm.cpp b/src/devices/bus/a2bus/a2videoterm.cpp index b0fda659783..839fa19e74a 100644 --- a/src/devices/bus/a2bus/a2videoterm.cpp +++ b/src/devices/bus/a2bus/a2videoterm.cpp @@ -347,7 +347,7 @@ void a2bus_videx80_device::write_c800(uint16_t offset, uint8_t data) MC6845_UPDATE_ROW( a2bus_videx80_device::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; //( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; for (int i = 0; i < x_count; i++) diff --git a/src/devices/bus/a2bus/computereyes2.cpp b/src/devices/bus/a2bus/computereyes2.cpp index b8a80819023..b8dcab00373 100644 --- a/src/devices/bus/a2bus/computereyes2.cpp +++ b/src/devices/bus/a2bus/computereyes2.cpp @@ -196,22 +196,22 @@ void a2bus_computereyes2_device::write_c0nx(uint8_t offset, uint8_t data) m_x = m_y = 0; std::fill_n(m_a2_bitmap, 280*193, 0); - m_bitmap = &m_picture->get_bitmap(); - if (m_bitmap) + const bitmap_argb32 &bitmap = m_picture->get_bitmap(); + if (bitmap.valid()) { // convert arbitrary sized ARGB32 image to a 188x193 image with 256 levels of grayscale - double stepx = (double)m_bitmap->width() / 188.0; - double stepy = (double)m_bitmap->height() / 193.0; + double stepx = (double)bitmap.width() / 188.0; + double stepy = (double)bitmap.height() / 193.0; for (int y = 0; y < 193; y++) { for (int x = 0; x < 280; x++) { - u32 pixel = m_bitmap->pix((int)((double)y * stepy), (int)((double)x * stepx)); - double mono = ((0.2126 * (double)(((pixel>>16) & 0xff) / 255.0)) + - (0.7152 * (double)(((pixel>>8) & 0xff) / 255.0)) + - (0.0722 * (double)((pixel& 0xff) / 255.0))); - m_a2_bitmap[(y*280)+x] = (u8)(mono * 255.0); + u32 pixel = bitmap.pix(int((double)y * stepy), int((double)x * stepx)); + double mono = ((0.2126 * double(((pixel>>16) & 0xff) / 255.0)) + + (0.7152 * double(((pixel>>8) & 0xff) / 255.0)) + + (0.0722 * double((pixel& 0xff) / 255.0))); + m_a2_bitmap[(y*280)+x] = u8(mono * 255.0); } } } diff --git a/src/devices/bus/a2bus/computereyes2.h b/src/devices/bus/a2bus/computereyes2.h index 31856f08813..a69600b6de2 100644 --- a/src/devices/bus/a2bus/computereyes2.h +++ b/src/devices/bus/a2bus/computereyes2.h @@ -46,7 +46,6 @@ private: u8 m_a2_bitmap[280*193]; u8 m_threshold; bool m_bActive; - bitmap_argb32 *m_bitmap; }; // device type definition diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp index 03b219cf72e..e5c2e7fcf84 100644 --- a/src/devices/bus/a2bus/mouse.cpp +++ b/src/devices/bus/a2bus/mouse.cpp @@ -299,17 +299,15 @@ void a2bus_mouse_device::mcu_port_c_w(uint8_t data) template <unsigned AXIS, u8 DIR, u8 CLK> void a2bus_mouse_device::update_axis() { - // read the axis + // read the axis and check for changes const int new_m = m_mousexy[AXIS]->read(); - - // did it change? int diff = new_m - m_last[AXIS]; // check for wrap if (diff > 0x80) - diff = 0x100 - diff; - if (diff < -0x80) - diff = -0x100 - diff; + diff -= 0x100; + else if (diff < -0x80) + diff += 0x100; m_count[AXIS] += diff; m_last[AXIS] = new_m; diff --git a/src/devices/bus/a2bus/sider.cpp b/src/devices/bus/a2bus/sider.cpp new file mode 100644 index 00000000000..d2722c8bb77 --- /dev/null +++ b/src/devices/bus/a2bus/sider.cpp @@ -0,0 +1,296 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + sider.cpp + + Implementation of the First Class Peripherals / Advanced Tech Services / Xebec Sider cards + + Sider 1: based on Xebec SASI hardware, with Xebec firmware. Requires HDD with 256 byte sectors + and special formatting - not compatible with standard .po/.hdv type images. + + Sider 2: Same hardware, new firmware that's fully ProDOS compliant including 512 byte sectors. + Sectors are interleaved: the first byte is the byte that would be at 0, the second byte is the byte that would be at $100, + the third is the byte at $1, the fourth at $101, and so on. So this is also not compatible with standard images. + + This command-line program will convert a standard image to work with Sider 2. First parameter is the input filename, + second parameter is the output filename. No error checking is done, if the input file doesn't exist it'll probably crash. + + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + + static char block[512]; + static char blockout[512]; + + int main(int argc, char *argv[]) + { + FILE *in, *out; + + in = fopen(argv[1], "rb"); + out = fopen(argv[2], "wb"); + + int len = 0; + fseek(in, 0, SEEK_END); + len = ftell(in); + fseek(in, 0, SEEK_SET); + + for (int bnum = 0; bnum < (len / 512); bnum++) + { + fread(block, 512, 1, in); + for (int byte = 0; byte < 256; byte++) + { + blockout[byte*2] = block[byte]; + blockout[(byte*2)+1] = block[byte+256]; + } + fwrite(blockout, 512, 1, out); + printf("block %d\n", bnum); + } + + fclose(out); + fclose(in); + return 0; + } + + -------------------------------------- + + $C0(n+8)X space: + $0: read state / write latch + $1: read data / write control + + State: + b3: /Busy + b4: /Message + b5: I/O + b6: C/D + b7: REQ + + Control: + b4: drive contents of output latch onto the SASI bus (reverse logic; latch is driven when this bit is clear) + b5: reset bus + b6: /BSY + b7: /SEL + +*********************************************************************/ + +#include "emu.h" +#include "sider.h" +#include "bus/scsi/scsihd.h" +#include "bus/scsi/s1410.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(A2BUS_SIDER2, a2bus_sider2card_device, "a2sider2", "First Class Peripherals Sider 2 SASI Card") +DEFINE_DEVICE_TYPE(A2BUS_SIDER1, a2bus_sider1card_device, "a2sider1", "First Class Peripherals Sider 1 SASI Card") + +#define SASI_ROM_REGION "sasi_rom" + +ROM_START( sider2 ) + ROM_REGION(0x800, SASI_ROM_REGION, 0) + ROM_LOAD( "atsv22_a02a9baad2262a8a49ecea843f602124.bin", 0x000000, 0x000800, CRC(97773a0b) SHA1(8d0a5d6ce3b9a236771126033c4aba6c0cc5e704) ) +ROM_END + +ROM_START( sider1 ) + ROM_REGION(0x800, SASI_ROM_REGION, 0) + ROM_LOAD( "xebec-103684c-1986.bin", 0x000000, 0x000800, CRC(9e62e15f) SHA1(7f50b5e00cac4960204f50448a6e2d623b1a41e2) ) +ROM_END + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void a2bus_sider_device::device_add_mconfig(machine_config &config) +{ + NSCSI_BUS(config, m_sasibus); + NSCSI_CONNECTOR(config, "sasibus:0", default_scsi_devices, "s1410", false); + NSCSI_CONNECTOR(config, "sasibus:1", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "sasibus:2", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "sasibus:3", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "sasibus:4", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "sasibus:5", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "sasibus:6", default_scsi_devices, nullptr, false); + NSCSI_CONNECTOR(config, "sasibus:7", default_scsi_devices, "scsicb", true).option_add_internal("scsicb", NSCSI_CB); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *a2bus_sider2card_device::device_rom_region() const +{ + return ROM_NAME( sider2 ); +} + +const tiny_rom_entry *a2bus_sider1card_device::device_rom_region() const +{ + return ROM_NAME( sider1 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_sider_device::a2bus_sider_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + device_a2bus_card_interface(mconfig, *this), + m_sasibus(*this, "sasibus"), + m_sasi(*this, "sasibus:7:scsicb"), + m_rom(*this, SASI_ROM_REGION), + m_latch(0xff), + m_control(0) +{ +} + +a2bus_sider2card_device::a2bus_sider2card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_sider_device(mconfig, A2BUS_SIDER2, tag, owner, clock) +{ +} + +a2bus_sider1card_device::a2bus_sider1card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_sider_device(mconfig, A2BUS_SIDER1, tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_sider_device::device_start() +{ + save_item(NAME(m_latch)); + save_item(NAME(m_control)); +} + +void a2bus_sider_device::device_reset() +{ + m_latch = 0xff; + m_control = 0; +} + +/*------------------------------------------------- + read_c0nx - called for reads from this card's c0nx space +-------------------------------------------------*/ + +uint8_t a2bus_sider_device::read_c0nx(uint8_t offset) +{ + u8 rv = 0; + + switch (offset) + { + case 0: + // b3: /Busy + // b4: /Message + // b5: I/O + // b6: C/D + // b7: REQ + rv |= m_sasi->req_r() ? 0x80 : 0; + rv |= m_sasi->cd_r() ? 0x40 : 0; + rv |= m_sasi->io_r() ? 0x20 : 0; + rv |= m_sasi->msg_r() ? 0x10 : 0; + rv |= m_sasi->bsy_r() ? 0x08 : 0; + return rv; + + case 1: + rv = m_sasi->read(); + if ((m_sasi->req_r()) && (m_sasi->io_r())) + { + m_sasi->ack_w(1); + m_sasi->ack_w(0); + } + return rv; + + default: + logerror("Read c0n%x (%s)\n", offset, machine().describe_context().c_str()); + break; + } + + return 0xff; +} + + +/*------------------------------------------------- + write_c0nx - called for writes to this card's c0nx space +-------------------------------------------------*/ + +void a2bus_sider_device::write_c0nx(uint8_t offset, uint8_t data) +{ + switch (offset) + { + case 0: + m_latch = data; + if (!(m_control & 0x10)) + { + m_sasi->write(m_latch); + + if (m_sasi->req_r()) + { + m_sasi->ack_w(1); + m_sasi->write(0); // stop driving the data lines + m_sasi->ack_w(0); + } + } + break; + + case 1: +// b4: drive contents of output latch onto the SASI bus +// b5: reset bus +// b6: /BSY +// b7: /SEL (error in note on A2DP's schematic; BSY and SEL are the same polarity from the 6502's POV) + m_control = data; + m_sasi->sel_w((data & 0x80) ? 1 : 0); + m_sasi->bsy_w((data & 0x40) ? 1 : 0); + if (data & 0x20) + { + m_sasibus->reset(); + } + else if (!(data & 0x10)) + { + m_sasi->write(m_latch); + } + break; + + default: + logerror("Write %02x to c0n%x (%s)\n", data, offset, machine().describe_context().c_str()); + break; + } +} + +/*------------------------------------------------- + read_cnxx - called for reads from this card's cnxx space +-------------------------------------------------*/ + +uint8_t a2bus_sider_device::read_cnxx(uint8_t offset) +{ + // slot images at $700 + return m_rom[offset + 0x700]; +} + +void a2bus_sider_device::write_cnxx(uint8_t offset, uint8_t data) +{ +} + +/*------------------------------------------------- + read_c800 - called for reads from this card's c800 space +-------------------------------------------------*/ + +uint8_t a2bus_sider_device::read_c800(uint16_t offset) +{ + return m_rom[offset]; +} + +/*------------------------------------------------- + write_c800 - called for writes to this card's c800 space +-------------------------------------------------*/ +void a2bus_sider_device::write_c800(uint16_t offset, uint8_t data) +{ +} diff --git a/src/devices/bus/a2bus/sider.h b/src/devices/bus/a2bus/sider.h new file mode 100644 index 00000000000..6bb5ed3c036 --- /dev/null +++ b/src/devices/bus/a2bus/sider.h @@ -0,0 +1,71 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + sider.h + + Implementation of the First Class Peripherals / Advanced Tech Services / Xebec Sider SASI Card + +*********************************************************************/ + +#ifndef MAME_BUS_A2BUS_SIDER_H +#define MAME_BUS_A2BUS_SIDER_H + +#pragma once + +#include "a2bus.h" +#include "bus/nscsi/devices.h" +#include "machine/nscsi_bus.h" +#include "machine/nscsi_cb.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_sider_device: + public device_t, + public device_a2bus_card_interface +{ +protected: + a2bus_sider_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) override; + + // overrides of standard a2bus slot functions + virtual uint8_t read_c0nx(uint8_t offset) override; + virtual void write_c0nx(uint8_t offset, uint8_t data) override; + virtual uint8_t read_cnxx(uint8_t offset) override; + virtual void write_cnxx(uint8_t offset, uint8_t data) override; + virtual uint8_t read_c800(uint16_t offset) override; + virtual void write_c800(uint16_t offset, uint8_t data) override; + + required_device<nscsi_bus_device> m_sasibus; + required_device<nscsi_callback_device> m_sasi; + required_region_ptr<u8> m_rom; + +private: + u8 m_latch; + u8 m_control; +}; + +class a2bus_sider2card_device: public a2bus_sider_device +{ +public: + a2bus_sider2card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + virtual const tiny_rom_entry *device_rom_region() const override; +}; + +class a2bus_sider1card_device: public a2bus_sider_device +{ +public: + a2bus_sider1card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + virtual const tiny_rom_entry *device_rom_region() const override; +}; + +// device type definition +DECLARE_DEVICE_TYPE(A2BUS_SIDER2, a2bus_sider2card_device) +DECLARE_DEVICE_TYPE(A2BUS_SIDER1, a2bus_sider1card_device) + +#endif // MAME_BUS_A2BUS_SIDER_H diff --git a/src/devices/bus/a2gameio/computereyes.cpp b/src/devices/bus/a2gameio/computereyes.cpp index 1c587f54254..af597361c8e 100644 --- a/src/devices/bus/a2gameio/computereyes.cpp +++ b/src/devices/bus/a2gameio/computereyes.cpp @@ -82,23 +82,22 @@ WRITE_LINE_MEMBER(apple2_compeyes_device::an0_w) std::fill_n(m_a2_bitmap, 280*192, 0); - m_bitmap = &m_picture->get_bitmap(); - if (m_bitmap) + const bitmap_argb32 &bitmap = m_picture->get_bitmap(); + if (bitmap.valid()) { // convert arbitrary sized ARGB32 image to a 280x192 image with 256 levels of grayscale - double stepx = (double)m_bitmap->width() / 280.0; - double stepy = (double)m_bitmap->height() / 192.0; - + double stepx = (double)bitmap.width() / 280.0; + double stepy = (double)bitmap.height() / 192.0; for (int y = 0; y < 192; y++) { for (int x = 0; x < 280; x++) { - u32 pixel = m_bitmap->pix((int)((double)y * stepy), (int)((double)x * stepx)); - double mono = ((0.2126 * (double)(((pixel>>16) & 0xff) / 255.0)) + - (0.7152 * (double)(((pixel>>8) & 0xff) / 255.0)) + - (0.0722 * (double)((pixel& 0xff) / 255.0))); - m_a2_bitmap[(y*280)+x] = (u8)(mono * 255.0); + u32 pixel = bitmap.pix(int((double)y * stepy), int((double)x * stepx)); + double mono = ((0.2126 * double(((pixel>>16) & 0xff) / 255.0)) + + (0.7152 * double(((pixel>>8) & 0xff) / 255.0)) + + (0.0722 * double((pixel& 0xff) / 255.0))); + m_a2_bitmap[(y*280)+x] = u8(mono * 255.0); } } } diff --git a/src/devices/bus/a2gameio/computereyes.h b/src/devices/bus/a2gameio/computereyes.h index 6aef78796a6..9445ce4df25 100644 --- a/src/devices/bus/a2gameio/computereyes.h +++ b/src/devices/bus/a2gameio/computereyes.h @@ -41,7 +41,6 @@ private: required_device<picture_image_device> m_picture; int m_x, m_y, m_an1, m_an2, m_an3, m_level; u8 m_a2_bitmap[280*192]; - bitmap_argb32 *m_bitmap; }; // device type declaration diff --git a/src/devices/bus/acorn/system/vdu40.cpp b/src/devices/bus/acorn/system/vdu40.cpp index dcee8cd9b53..7bc8629ac35 100644 --- a/src/devices/bus/acorn/system/vdu40.cpp +++ b/src/devices/bus/acorn/system/vdu40.cpp @@ -93,7 +93,7 @@ void acorn_vdu40_device::device_reset() MC6845_UPDATE_ROW(acorn_vdu40_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); diff --git a/src/devices/bus/acorn/system/vdu80.cpp b/src/devices/bus/acorn/system/vdu80.cpp index 5cf995d8d3c..77bad0bf32c 100644 --- a/src/devices/bus/acorn/system/vdu80.cpp +++ b/src/devices/bus/acorn/system/vdu80.cpp @@ -172,7 +172,7 @@ void acorn_vdu80_device::device_reset() MC6845_UPDATE_ROW(acorn_vdu80_device::crtc_update_row) { uint8_t invert = BIT(m_links->read(), 1); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int column = 0; column < x_count; column++) { diff --git a/src/devices/bus/adamnet/adamnet.cpp b/src/devices/bus/adamnet/adamnet.cpp index 69b25ce30e7..18b91c4fb8c 100644 --- a/src/devices/bus/adamnet/adamnet.cpp +++ b/src/devices/bus/adamnet/adamnet.cpp @@ -113,7 +113,7 @@ void adamnet_device::device_stop() void adamnet_device::add_device(device_t *target) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_bus = this; diff --git a/src/devices/bus/adamnet/ddp.cpp b/src/devices/bus/adamnet/ddp.cpp index 6e05689cb29..b4a17e909cd 100644 --- a/src/devices/bus/adamnet/ddp.cpp +++ b/src/devices/bus/adamnet/ddp.cpp @@ -58,7 +58,7 @@ void adam_digital_data_pack_device::adam_ddp_mem(address_map &map) map(0xf800, 0xffff).rom().region(M6801_TAG, 0); } -static const struct CassetteOptions adam_cassette_options = +static const cassette_image::Options adam_cassette_options = { 2, /* channels */ 16, /* bits per sample */ diff --git a/src/devices/bus/adamnet/kb.cpp b/src/devices/bus/adamnet/kb.cpp index a401dbfb335..046ceba61f4 100644 --- a/src/devices/bus/adamnet/kb.cpp +++ b/src/devices/bus/adamnet/kb.cpp @@ -134,7 +134,7 @@ static INPUT_PORTS_START( adam_kb ) PORT_START("Y5") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('`') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('=') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp index 1246cb1902c..6fa98419abc 100644 --- a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp +++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp @@ -117,7 +117,7 @@ void bbc_1mhzbus_slot_device::jim_w(offs_t offset, uint8_t data) #include "ide.h" #include "ieee488.h" #include "m2000.h" -//#include "m5000.h" +#include "m5000.h" #include "sasi.h" #include "scsi.h" #include "multiform.h" @@ -137,7 +137,7 @@ void bbc_1mhzbus_devices(device_slot_interface &device) { //device.option_add("teletext", BBC_TELETEXT); /* Acorn ANE01 Teletext Adapter */ device.option_add("ieee488", BBC_IEEE488); /* Acorn ANK01 IEEE488 Interface */ - //device.option_add("m500", BBC_M500); /* Acorn ANV02 Music 500 */ + device.option_add("m500", BBC_M500); /* Acorn ANV02 Music 500 */ device.option_add("awhd", BBC_AWHD); /* Acorn Winchester Disc */ device.option_add("autoprom", BBC_AUTOPROM); /* ATPL AutoPrommer */ device.option_add("beebide", BBC_BEEBIDE); /* Sprow BeebIDE 16-bit */ @@ -147,6 +147,10 @@ void bbc_1mhzbus_devices(device_slot_interface &device) //device.option_add("videodig", BBC_VIDEODIG); /* Video Digitiser (RH Electronics) */ device.option_add("emrmidi", BBC_EMRMIDI); /* EMR Midi Interface */ //device.option_add("procyon", BBC_PROCYON); /* CST Procyon IEEE Interface */ + device.option_add("m2000", BBC_M2000); /* Hybrid Music 2000 Interface */ + device.option_add("m3000", BBC_M3000); /* Hybrid Music 3000 Expander */ + device.option_add("m5000", BBC_M5000); /* Hybrid Music 5000 Synthesiser */ + device.option_add("m87", BBC_M87); /* Peartree Music 87 Synthesiser */ device.option_add("multiform", BBC_MULTIFORM); /* PEDL Multiform Z80 */ device.option_add("opus3", BBC_OPUS3); /* Opus Challenger 3 */ device.option_add("pdram", BBC_PDRAM); /* Micro User Pull Down RAM */ @@ -160,13 +164,13 @@ void bbc_1mhzbus_devices(device_slot_interface &device) device.option_add("cc500", BBC_CC500); /* CTS Colour Card 500 */ //device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */ device.option_add("sprite", BBC_SPRITE); /* Logotron Sprite Board */ + device.option_add_internal("cfa3000opt", CFA3000_OPT);/* Henson CFA 3000 Option Board */ } void bbcm_1mhzbus_devices(device_slot_interface &device) { //device.option_add("teletext", BBC_TELETEXT); /* Acorn ANE01 Teletext Adapter */ device.option_add("ieee488", BBC_IEEE488); /* Acorn ANK01 IEEE488 Interface */ - //device.option_add("m500", BBC_M500); /* Acorn ANV02 Music 500 */ device.option_add("awhd", BBC_AWHD); /* Acorn Winchester Disc */ device.option_add("beebide", BBC_BEEBIDE); /* Sprow BeebIDE 16-bit */ device.option_add("ide8", BBC_IDE8); /* RetroClinic BBC 8-bit IDE */ @@ -175,9 +179,9 @@ void bbcm_1mhzbus_devices(device_slot_interface &device) device.option_add("emrmidi", BBC_EMRMIDI); /* EMR Midi Interface */ //device.option_add("procyon", BBC_PROCYON); /* CST Procyon IEEE Interface */ device.option_add("m2000", BBC_M2000); /* Hybrid Music 2000 Interface */ - //device.option_add("m3000", BBC_M3000); /* Hybrid Music 3000 Expander */ - //device.option_add("m5000", BBC_M5000); /* Hybrid Music 5000 Synthesiser */ - //device.option_add("m87", BBC_M87); /* Peartree Music 87 Synthesiser */ + device.option_add("m3000", BBC_M3000); /* Hybrid Music 3000 Expander */ + device.option_add("m5000", BBC_M5000); /* Hybrid Music 5000 Synthesiser */ + device.option_add("m87", BBC_M87); /* Peartree Music 87 Synthesiser */ device.option_add("multiform", BBC_MULTIFORM); /* PEDL Multiform Z80 */ device.option_add("opusa", BBC_OPUSA); /* Opus Challenger ADFS */ device.option_add("pdram", BBC_PDRAM); /* Micro User Pull Down RAM */ diff --git a/src/devices/bus/bbc/1mhzbus/m5000.cpp b/src/devices/bus/bbc/1mhzbus/m5000.cpp new file mode 100644 index 00000000000..1844de74a0d --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/m5000.cpp @@ -0,0 +1,435 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +// thanks-to:Darren Izzard +/********************************************************************** + + Acorn ANV02 Music 500 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANV02_Music500.html + + Hybrid Music 5000 Synthesiser + + https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-5000-Synthesiser/ + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Hybrid_Music5000.html + + Hybrid Music 3000 Expander + + https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-3000-Expander/ + + Peartree Music 87 Synthesiser + + http://www.computinghistory.org.uk/det/4535/Peartree-Computers-Music-87-Synthesizer-(M500)/ + + TODO: + - convert to use DAC76 device + - add suitably patched version of Ample ROM + - add ROMs for Music 87 + +**********************************************************************/ + + +#include "emu.h" +#include "m5000.h" +#include "speaker.h" +#include "softlist_dev.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(HTMUSIC, htmusic_device, "htmusic", "Hybrid Technology Music System") + +DEFINE_DEVICE_TYPE(BBC_M500, bbc_m500_device, "bbc_m500", "Acorn Music 500"); +DEFINE_DEVICE_TYPE(BBC_M5000, bbc_m5000_device, "bbc_m5000", "Hybrid Music 5000 Synthesiser"); +DEFINE_DEVICE_TYPE(BBC_M3000, bbc_m3000_device, "bbc_m3000", "Hybrid Music 3000 Expander"); +DEFINE_DEVICE_TYPE(BBC_M87, bbc_m87_device, "bbc_m87", "Peartree Music 87 Synthesiser"); + + +//------------------------------------------------- +// ROM( m5000 ) +//------------------------------------------------- + +//ROM_START( m5000 ) + //ROM_REGION(0x4000, "exp_rom", 0) + // Each AMPLE Nucleus ROM has a unique identification code (ID) + //ROM_LOAD("ample_patch.rom", 0x0000, 0x4000, CRC(15bbd499) SHA1(ac90f403b3bde0cdaae68546799b94962bc00fcb)) +//ROM_END + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bbc_m500_device::add_common_devices(machine_config &config) +{ + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + + HTMUSIC(config, m_hybrid, 12_MHz_XTAL / 2); + m_hybrid->add_route(0, "lspeaker", 1.0); + m_hybrid->add_route(1, "rspeaker", 1.0); + + BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 1), bbc_1mhzbus_devices, nullptr); + m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); + m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::nmi_w)); +} + +void bbc_m500_device::device_add_mconfig(machine_config &config) +{ + add_common_devices(config); + + SOFTWARE_LIST(config, "flop_ls_hybrid").set_original("bbc_flop_hybrid").set_filter("M500"); +} + +void bbc_m5000_device::device_add_mconfig(machine_config &config) +{ + add_common_devices(config); + + SOFTWARE_LIST(config, "flop_ls_hybrid").set_original("bbc_flop_hybrid").set_filter("M5000"); +} + +void bbc_m3000_device::device_add_mconfig(machine_config &config) +{ + add_common_devices(config); +} + +void bbc_m87_device::device_add_mconfig(machine_config &config) +{ + add_common_devices(config); + + SOFTWARE_LIST(config, "flop_ls_hybrid").set_original("bbc_flop_hybrid").set_filter("M87"); +} + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +//const tiny_rom_entry *bbc_m5000_device::device_rom_region() const +//{ + //return ROM_NAME( m5000 ); +//} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_hybrid_device - constructor +//------------------------------------------------- + +bbc_m500_device::bbc_m500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, type, tag, owner, clock) + , device_bbc_1mhzbus_interface(mconfig, *this) + , m_1mhzbus(*this, "1mhzbus") + , m_hybrid(*this, "hybrid") + , m_page(0) +{ +} + +bbc_m500_device::bbc_m500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_m500_device(mconfig, BBC_M500, tag, owner, clock) +{ +} + +bbc_m5000_device::bbc_m5000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_m500_device(mconfig, BBC_M5000, tag, owner, clock) +{ +} + +bbc_m3000_device::bbc_m3000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_m500_device(mconfig, BBC_M3000, tag, owner, clock) +{ +} + +bbc_m87_device::bbc_m87_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : bbc_m500_device(mconfig, BBC_M87, tag, owner, clock) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bbc_m500_device::device_start() +{ + // register for save states + save_item(NAME(m_page)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t bbc_m500_device::fred_r(offs_t offset) +{ + return m_1mhzbus->fred_r(offset); +} + +void bbc_m500_device::fred_w(offs_t offset, uint8_t data) +{ + if (offset == 0xff) + { + m_page = data; + } + + m_1mhzbus->fred_w(offset, data); +} + +uint8_t bbc_m500_device::jim_r(offs_t offset) +{ + return m_1mhzbus->jim_r(offset); +} + +void bbc_m500_device::jim_w(offs_t offset, uint8_t data) +{ + if ((m_page & 0xf0) == 0x30) + { + uint8_t page = (m_page >> 1) & 7; + + m_hybrid->ram_w((page << 8) | offset, data); + } + + m_1mhzbus->jim_w(offset, data); +} + + +void bbc_m3000_device::jim_w(offs_t offset, uint8_t data) +{ + if ((m_page & 0xf0) == 0x50) + { + uint8_t page = (m_page >> 1) & 7; + + m_hybrid->ram_w((page << 8) | offset, data); + } + + m_1mhzbus->jim_w(offset, data); +} + + +//************************************************************************** +// HYBRID MUSIC IMPLEMENTATION +//************************************************************************** + +//------------------------------------------------- +// htmusic_device - constructor +//------------------------------------------------- + +htmusic_device::htmusic_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, HTMUSIC, tag, owner, clock) + , device_sound_interface(mconfig, *this) + , m_counter(0) + , m_c4d(0) + , m_sign(0) + , m_sam(0) + , m_disable(false) + , m_modulate(false) + , m_dsp_timer(nullptr) + , m_stream(nullptr) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void htmusic_device::device_start() +{ + // 12-bit antilog as per Am6070 datasheet + for (int i = 0; i < 128; i++) + m_antilog[i] = (uint16_t)(2 * (pow(2.0, i >> 4) * ((i & 15) + 16.5) - 16.5)); + + // create the stream + m_stream = stream_alloc(0, 2, clock() / 128); + + // allocate timer + m_dsp_timer = timer_alloc(0); + + // register for save states + save_item(NAME(m_wave_ram)); + save_item(NAME(m_phase_ram)); + save_item(NAME(m_counter)); + save_item(NAME(m_c4d)); + save_item(NAME(m_sign)); + save_item(NAME(m_disable)); + save_item(NAME(m_modulate)); + save_item(NAME(m_sam)); + save_item(NAME(m_sam_l)); + save_item(NAME(m_sam_r)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void htmusic_device::device_reset() +{ + // clear ram + memset(m_wave_ram, 0, sizeof(m_wave_ram)); + memset(m_phase_ram, 0, sizeof(m_phase_ram)); + + memset(m_sam_l, 0, sizeof(m_sam_l)); + memset(m_sam_r, 0, sizeof(m_sam_r)); + + // reset counter + m_counter = 0; + m_disable = false; + m_modulate = false; + + // start timer + m_dsp_timer->adjust(attotime::zero, 0, attotime::from_hz(clock())); +} + + +//------------------------------------------------- +// digital signal processor +//------------------------------------------------- + +#define I_CHAN(c) ((((c) & 0x1e) >> 1) + (((c) & 0x01) << 7) + 0x700) +#define I_FREQ(c) (I_CHAN(c)) +#define I_WAVESEL(c) (I_CHAN(c) + 0x50) +#define I_AMP(c) (I_CHAN(c) + 0x60) +#define I_CTL(c) (I_CHAN(c) + 0x70) +#define FREQ(c) ((m_wave_ram[I_FREQ(c) + 0x20] << 16) | (m_wave_ram[I_FREQ(c) + 0x10] << 8) | (m_wave_ram[I_FREQ(c)] & 0x7e)) +#define DISABLE(c) (BIT(m_wave_ram[I_FREQ(c)], 0)) +#define AMP(c) (m_wave_ram[I_AMP(c)]) +#define WAVESEL(c) (m_wave_ram[I_WAVESEL(c)] >> 4) +#define CTL(c) (m_wave_ram[I_CTL(c)]) +#define MODULATE(c) (BIT(CTL(c), 5)) +#define INVERT(c) (BIT(CTL(c), 4)) +#define PAN(c) (CTL(c) & 0x0f) + +void htmusic_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + // 4-bit channel select + uint8_t channel = (m_counter >> 3) & 0x0f; + uint8_t c = (channel << 1) + (m_modulate ? 1 : 0); + + // 3-bit program counter + switch (m_counter & 0x07) + { + case 0: + m_stream->update(); + + m_disable = DISABLE(c); + break; + + case 1: + break; + + case 2: + // In the real hardware the disable bit works by forcing the + // phase accumulator to zero. + if (m_disable) + { + m_phase_ram[channel] = 0; + m_c4d = 0; + } + else + { + uint32_t sum = m_phase_ram[channel] + FREQ(c); + m_phase_ram[channel] = sum & 0xffffff; + // c4d is used for "Synchronization" e.g. the "Wha" instrument + m_c4d = sum >> 24; + } + break; + + case 3: + break; + + case 4: + break; + + case 5: + m_sam = m_wave_ram[(WAVESEL(c) << 7) + (m_phase_ram[channel] >> 17)]; + break; + + case 6: + // The amplitude operates in the log domain + // - m_sam holds the wave table output which is 1 bit sign and 7 bit magnitude + // - amp holds the amplitude which is 1 bit sign and 8 bit magnitude (0x00 being quite, 0x7f being loud) + // The real hardware combines these in a single 8 bit adder, as we do here. + // + // Consider a positive wav value (sign bit = 1) + // wav: (0x80 -> 0xFF) + amp: (0x00 -> 0x7F) => (0x80 -> 0x7E) + // values in the range 0x80...0xff are very small and clamped to zero + // + // Consider a negative wav value (sign bit = 0) + // wav: (0x00 -> 0x7F) + amp: (0x00 -> 0x7F) => (0x00 -> 0xFE) + // values in the range 0x00...0x7f are very small and clamped to zero + // + // In both cases: + // - zero clamping happens when the sign bit stays the same + // - the 7-bit result is in bits 0..6 + // + m_sign = m_sam & 0x80; + m_sam += AMP(c); + if ((m_sign ^ m_sam) & 0x80) + m_sam &= 0x7f; // sign bits being different is the normal case + else + m_sam = 0x00; // sign bits being the same indicates underflow so clamp to zero + break; + + case 7: + { + m_modulate = MODULATE(c) && (!!(m_sign) || !!(m_c4d)); + + // in the real hardware, inversion does not affect modulation + if (INVERT(c)) + m_sign ^= 0x80; + + // m_sam is an 8-bit log value + if (m_sign) + m_sam = m_antilog[m_sam]; // sign being 1 is positive + else + m_sam = -m_antilog[m_sam]; // sign being 0 is negative + + // m_sam is a 12-bit linear sample + uint8_t pan; + switch (PAN(c)) + { + case 8: case 9: case 10: pan = 6; break; + case 11: pan = 5; break; + case 12: pan = 4; break; + case 13: pan = 3; break; + case 14: pan = 2; break; + case 15: pan = 1; break; + default: pan = 0; break; + } + + // Apply panning. In the real hardware, a disabled channel is not actually + // forced to zero, but this seems harmless so leave in for now. + m_sam_l[channel] = m_disable ? 0 : ((m_sam * pan) / 6); + m_sam_r[channel] = m_disable ? 0 : ((m_sam * (6 - pan)) / 6); + break; + } + } + + m_counter++; +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void htmusic_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + // reset the output streams + outputs[0].fill(0); + outputs[1].fill(0); + + // iterate over channels and accumulate sample data + for (int channel = 0; channel < 16; channel++) + { + for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++) + { + outputs[0].add_int(sampindex, m_sam_l[channel], 8031 * 16); + outputs[1].add_int(sampindex, m_sam_r[channel], 8031 * 16); + } + } +} diff --git a/src/devices/bus/bbc/1mhzbus/m5000.h b/src/devices/bus/bbc/1mhzbus/m5000.h new file mode 100644 index 00000000000..d2507ab4abe --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/m5000.h @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn ANV02 Music 500 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANV02_Music500.html + + Hybrid Music 5000 Synthesiser + + https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-5000-Synthesiser/ + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Hybrid_Music5000.html + + Hybrid Music 3000 Expander + + https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-3000-Expander/ + + Peartree Music 87 Synthesiser + + http://www.computinghistory.org.uk/det/4535/Peartree-Computers-Music-87-Synthesizer-(M500)/ + +**********************************************************************/ + + +#ifndef MAME_BUS_BBC_1MHZBUS_M5000_H +#define MAME_BUS_BBC_1MHZBUS_M5000_H + +#include "1mhzbus.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> htmusic_device + +class htmusic_device : public device_t, public device_sound_interface +{ +public: + htmusic_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + void ram_w(offs_t offset, uint8_t data) { m_wave_ram[offset & 0x7ff] = data; } + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + +private: + uint16_t m_antilog[128]; + uint8_t m_wave_ram[0x800]; + uint32_t m_phase_ram[0x200]; + + uint8_t m_counter; + uint8_t m_c4d; + uint8_t m_sign; + int16_t m_sam; + bool m_disable; + bool m_modulate; + + int32_t m_sam_l[16]; + int32_t m_sam_r[16]; + + emu_timer *m_dsp_timer; + + sound_stream *m_stream; +}; + + +// ======================> bbc_m500_device + +class bbc_m500_device : public device_t, public device_bbc_1mhzbus_interface +{ +public: + // construction/destruction + bbc_m500_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + bbc_m500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + void add_common_devices(machine_config &config); + + virtual uint8_t fred_r(offs_t offset) override; + virtual void fred_w(offs_t offset, uint8_t data) override; + virtual uint8_t jim_r(offs_t offset) override; + virtual void jim_w(offs_t offset, uint8_t data) override; + + required_device<bbc_1mhzbus_slot_device> m_1mhzbus; + required_device<htmusic_device> m_hybrid; + + uint8_t m_page; +}; + + +// ======================> bbc_m5000_device + +class bbc_m5000_device : public bbc_m500_device +{ +public: + // construction/destruction + bbc_m5000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + //virtual const tiny_rom_entry *device_rom_region() const override; +}; + + +// ======================> bbc_m3000_device + +class bbc_m3000_device : public bbc_m500_device +{ +public: + // construction/destruction + bbc_m3000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual void jim_w(offs_t offset, uint8_t data) override; +}; + + +// ======================> bbc_m87_device + +class bbc_m87_device : public bbc_m500_device +{ +public: + // construction/destruction + bbc_m87_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_M500, bbc_m500_device); +DECLARE_DEVICE_TYPE(BBC_M5000, bbc_m5000_device); +DECLARE_DEVICE_TYPE(BBC_M3000, bbc_m3000_device); +DECLARE_DEVICE_TYPE(BBC_M87, bbc_m87_device); + + +#endif /* MAME_BUS_BBC_1MHZBUS_M5000_H */ diff --git a/src/devices/bus/bbc/joyport/joyport.cpp b/src/devices/bus/bbc/joyport/joyport.cpp index 79f285b0670..26abb9678ef 100644 --- a/src/devices/bus/bbc/joyport/joyport.cpp +++ b/src/devices/bus/bbc/joyport/joyport.cpp @@ -40,12 +40,12 @@ device_bbc_joyport_interface::device_bbc_joyport_interface(const machine_config // bbcmc_joyport_slot_device - constructor //------------------------------------------------- -bbc_joyport_slot_device::bbc_joyport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, BBC_JOYPORT_SLOT, tag, owner, clock), - device_single_card_slot_interface(mconfig, *this), - m_device(nullptr), - m_cb1_handler(*this), - m_cb2_handler(*this) +bbc_joyport_slot_device::bbc_joyport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_JOYPORT_SLOT, tag, owner, clock) + , device_single_card_slot_interface(mconfig, *this) + , m_device(nullptr) + , m_cb1_handler(*this) + , m_cb2_handler(*this) { } @@ -70,7 +70,6 @@ void bbc_joyport_slot_device::device_start() uint8_t bbc_joyport_slot_device::pb_r() { - // TODO: Joyport connected to PB0-PB4 only. PB5-PB7 are expansion port. if (m_device) return 0xe0 | m_device->pb_r(); else @@ -90,6 +89,28 @@ void bbc_joyport_slot_device::pb_w(uint8_t data) //------------------------------------------------- +// write_cb1 +//------------------------------------------------- + +void bbc_joyport_slot_device::write_cb1(int state) +{ + if (m_device) + m_device->write_cb1(state); +} + + +//------------------------------------------------- +// write_cb2 +//------------------------------------------------- + +void bbc_joyport_slot_device::write_cb2(int state) +{ + if (m_device) + m_device->write_cb2(state); +} + + +//------------------------------------------------- // SLOT_INTERFACE( bbc_joyport_devices ) //------------------------------------------------- diff --git a/src/devices/bus/bbc/joyport/joyport.h b/src/devices/bus/bbc/joyport/joyport.h index e2d44111995..15d81243d84 100644 --- a/src/devices/bus/bbc/joyport/joyport.h +++ b/src/devices/bus/bbc/joyport/joyport.h @@ -61,11 +61,15 @@ public: auto cb1_handler() { return m_cb1_handler.bind(); } auto cb2_handler() { return m_cb2_handler.bind(); } + // from slot DECLARE_WRITE_LINE_MEMBER(cb1_w) { m_cb1_handler(state); } DECLARE_WRITE_LINE_MEMBER(cb2_w) { m_cb2_handler(state); } + // from host uint8_t pb_r(); void pb_w(uint8_t data); + void write_cb1(int state); + void write_cb2(int state); protected: // device-level overrides @@ -86,6 +90,8 @@ class device_bbc_joyport_interface : public device_interface public: virtual uint8_t pb_r() { return 0xff; } virtual void pb_w(uint8_t data) { } + virtual void write_cb1(int state) { } + virtual void write_cb2(int state) { } protected: device_bbc_joyport_interface(const machine_config &mconfig, device_t &device); diff --git a/src/devices/bus/bbc/tube/tube_32016.cpp b/src/devices/bus/bbc/tube/tube_32016.cpp index 6a54665937d..f621cef4f07 100644 --- a/src/devices/bus/bbc/tube/tube_32016.cpp +++ b/src/devices/bus/bbc/tube/tube_32016.cpp @@ -38,10 +38,6 @@ DEFINE_DEVICE_TYPE(BBC_TUBE_32016L, bbc_tube_32016l_device, "bbc_tube_32016l", " void bbc_tube_32016_device::tube_32016_mem(address_map &map) { - map(0x000000, 0xffffff).rw(FUNC(bbc_tube_32016_device::read), FUNC(bbc_tube_32016_device::write)); - map(0xf00000, 0xf07fff).rom().region("rom", 0).mirror(0x0f8000); - map(0xf90000, 0xf90001).portr("CONFIG"); - map(0xfffff0, 0xffffff).rw("ula", FUNC(tube_device::parasite_r), FUNC(tube_device::parasite_w)).umask16(0x00ff); } //------------------------------------------------- @@ -76,36 +72,36 @@ ROM_END static INPUT_PORTS_START(tube_32016) PORT_START("CONFIG") - PORT_DIPNAME(0x80, 0x80, "H") PORT_DIPLOCATION("LKS:1") - PORT_DIPSETTING(0x80, "FPU") + PORT_DIPNAME(0x01, 0x01, "H") PORT_DIPLOCATION("LKS:1") + PORT_DIPSETTING(0x01, "FPU") PORT_DIPSETTING(0x00, "No FPU") - PORT_DIPNAME(0x40, 0x00, "G") PORT_DIPLOCATION("LKS:2") - PORT_DIPSETTING(0x40, "MMU") + PORT_DIPNAME(0x02, 0x00, "G") PORT_DIPLOCATION("LKS:2") + PORT_DIPSETTING(0x02, "MMU") PORT_DIPSETTING(0x00, "No MMU") - PORT_DIPNAME(0x20, 0x00, "F") PORT_DIPLOCATION("LKS:3") - PORT_DIPSETTING(0x20, "Reserved") + PORT_DIPNAME(0x04, 0x00, "F") PORT_DIPLOCATION("LKS:3") + PORT_DIPSETTING(0x04, "Reserved") PORT_DIPSETTING(0x00, "Reserved") - PORT_DIPNAME(0x10, 0x00, "E") PORT_DIPLOCATION("LKS:4") - PORT_DIPSETTING(0x10, "Reserved") + PORT_DIPNAME(0x08, 0x00, "E") PORT_DIPLOCATION("LKS:4") + PORT_DIPSETTING(0x08, "Reserved") PORT_DIPSETTING(0x00, "Reserved") - PORT_DIPNAME(0x08, 0x00, "D") PORT_DIPLOCATION("LKS:5") - PORT_DIPSETTING(0x08, "Reserved") + PORT_DIPNAME(0x10, 0x00, "D") PORT_DIPLOCATION("LKS:5") + PORT_DIPSETTING(0x10, "Reserved") PORT_DIPSETTING(0x00, "Reserved") - PORT_DIPNAME(0x04, 0x00, "C") PORT_DIPLOCATION("LKS:6") - PORT_DIPSETTING(0x04, "Reserved") + PORT_DIPNAME(0x20, 0x00, "C") PORT_DIPLOCATION("LKS:6") + PORT_DIPSETTING(0x20, "Reserved") PORT_DIPSETTING(0x00, "Reserved") - PORT_DIPNAME(0x02, 0x00, "B") PORT_DIPLOCATION("LKS:7") - PORT_DIPSETTING(0x02, "Reserved") + PORT_DIPNAME(0x40, 0x00, "B") PORT_DIPLOCATION("LKS:7") + PORT_DIPSETTING(0x40, "Reserved") PORT_DIPSETTING(0x00, "Reserved") - PORT_DIPNAME(0x01, 0x00, "A") PORT_DIPLOCATION("LKS:8") - PORT_DIPSETTING(0x01, "Reserved") + PORT_DIPNAME(0x80, 0x00, "A") PORT_DIPLOCATION("LKS:8") + PORT_DIPSETTING(0x80, "Reserved") PORT_DIPSETTING(0x00, "Reserved") INPUT_PORTS_END @@ -117,13 +113,16 @@ void bbc_tube_32016_device::device_add_mconfig(machine_config &config) { NS32016(config, m_maincpu, 12_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_32016_device::tube_32016_mem); + m_maincpu->set_fpu(m_ns32081); + + NS32081(config, m_ns32081, 12_MHz_XTAL / 2); TUBE(config, m_ula); m_ula->pnmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); m_ula->pirq_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0); /* internal ram */ - RAM(config, m_ram).set_default_size("1M").set_extra_options("256K"); + RAM(config, m_ram).set_default_size("1M").set_extra_options("256K").set_default_value(0); /* software lists */ SOFTWARE_LIST(config, "flop_ls_32016").set_original("bbc_flop_32016"); @@ -137,7 +136,7 @@ void bbc_tube_32016l_device::device_add_mconfig(machine_config &config) m_maincpu->set_clock(16_MHz_XTAL / 2); /* internal ram */ - m_ram->set_default_size("4M"); + m_ram->set_default_size("4M").set_extra_options("1M").set_default_value(0); } //------------------------------------------------- @@ -175,10 +174,10 @@ bbc_tube_32016_device::bbc_tube_32016_device(const machine_config &mconfig, devi : device_t(mconfig, type, tag, owner, clock) , device_bbc_tube_interface(mconfig, *this) , m_maincpu(*this, "maincpu") + , m_ns32081(*this, "ns32081") , m_ula(*this, "ula") , m_ram(*this, "ram") , m_rom(*this, "rom") - , m_rom_enabled(true) { } @@ -198,7 +197,6 @@ bbc_tube_32016l_device::bbc_tube_32016l_device(const machine_config &mconfig, co void bbc_tube_32016_device::device_start() { - save_item(NAME(m_rom_enabled)); } //------------------------------------------------- @@ -207,7 +205,23 @@ void bbc_tube_32016_device::device_start() void bbc_tube_32016_device::device_reset() { - m_rom_enabled = true; + address_space &program = m_maincpu->space(AS_PROGRAM); + + // address map during booting + program.install_rom(0x000000, 0x007fff, 0xff8000, m_rom->base()); + + m_rom_shadow_tap = program.install_write_tap(0x000000, 0xffffff, "rom_shadow_w",[this](offs_t offset, u16 &data, u16 mem_mask) + { + // delete this tap + m_rom_shadow_tap->remove(); + + // address map after booting + m_maincpu->space(AS_PROGRAM).nop_readwrite(0x000000, 0xffffff); + m_maincpu->space(AS_PROGRAM).install_ram(0x000000, m_ram->mask(), 0x7fffff ^ m_ram->mask(), m_ram->pointer()); + m_maincpu->space(AS_PROGRAM).install_rom(0xf00000, 0xf07fff, 0x038000, m_rom->base()); + m_maincpu->space(AS_PROGRAM).install_read_port(0xf90000, 0xf90001, 0x00fffe, "CONFIG"); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfffff0, 0xffffff, read8sm_delegate(*m_ula, FUNC(tube_device::parasite_r)), write8sm_delegate(*m_ula, FUNC(tube_device::parasite_w)), 0xff); + }); } @@ -224,24 +238,3 @@ void bbc_tube_32016_device::host_w(offs_t offset, uint8_t data) { m_ula->host_w(offset, data); } - - -uint8_t bbc_tube_32016_device::read(offs_t offset) -{ - uint16_t data; - - if (m_rom_enabled) - data = m_rom->base()[offset & 0x7fff]; - else - data = m_ram->pointer()[offset & m_ram->mask()]; - - return data; -} - -void bbc_tube_32016_device::write(offs_t offset, uint8_t data) -{ - /* clear ROM select on first write */ - m_rom_enabled = false; - - m_ram->pointer()[offset & m_ram->mask()] = data; -} diff --git a/src/devices/bus/bbc/tube/tube_32016.h b/src/devices/bus/bbc/tube/tube_32016.h index 7e7753ae5f6..aa772e1369c 100644 --- a/src/devices/bus/bbc/tube/tube_32016.h +++ b/src/devices/bus/bbc/tube/tube_32016.h @@ -18,6 +18,7 @@ #include "tube.h" #include "cpu/ns32000/ns32000.h" +#include "machine/ns32081.h" #include "machine/ram.h" #include "machine/tube.h" @@ -51,16 +52,14 @@ protected: virtual void host_w(offs_t offset, uint8_t data) override; required_device<ns32016_device> m_maincpu; + required_device<ns32081_device> m_ns32081; required_device<tube_device> m_ula; required_device<ram_device> m_ram; required_memory_region m_rom; - uint8_t read(offs_t offset); - void write(offs_t offset, uint8_t data); + memory_passthrough_handler *m_rom_shadow_tap; void tube_32016_mem(address_map &map); - - bool m_rom_enabled; }; diff --git a/src/devices/bus/bbc/userport/lcd.cpp b/src/devices/bus/bbc/userport/lcd.cpp index cdc70bc35fe..f5f92270ca9 100644 --- a/src/devices/bus/bbc/userport/lcd.cpp +++ b/src/devices/bus/bbc/userport/lcd.cpp @@ -87,7 +87,7 @@ HD44780_PIXEL_UPDATE(bbc_lcd_device::lcd_pixel_update) } if (line < 4) - bitmap.pix16(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2; + bitmap.pix(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2; } } diff --git a/src/devices/bus/bbc/userport/m4000.cpp b/src/devices/bus/bbc/userport/m4000.cpp new file mode 100644 index 00000000000..910f2f8b3f1 --- /dev/null +++ b/src/devices/bus/bbc/userport/m4000.cpp @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Hybrid Music 4000 Keyboard (also known as ATPL Symphony) + + https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-4000-Keyboard/ + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Hybrid_Music4000.html + +**********************************************************************/ + + +#include "emu.h" +#include "m4000.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BBC_M4000, bbc_m4000_device, "bbc_m4000", "Hybrid Music 4000 Keyboard") + + +//------------------------------------------------- +// INPUT_PORTS( m4000 ) +//------------------------------------------------- + +static INPUT_PORTS_START( m4000 ) + PORT_START("KBLOCK_1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C2#") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D2") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D2#") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E2") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F2") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F2#") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G2") + + PORT_START("KBLOCK_2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G2#") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A2") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A2#") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B2") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C3") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C3#") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D3") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D3#") + + PORT_START("KBLOCK_3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E3") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F3") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F3#") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G3") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G3#") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A3") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A3#") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B3") + + PORT_START("KBLOCK_4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C4") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C4#") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D4") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D4#") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E4") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F4") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F4#") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G4") + + PORT_START("KBLOCK_5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G4#") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A4") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A4#") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B4") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C5") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C5#") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D5") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D5#") + + PORT_START("KBLOCK_6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E5") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F5") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F5#") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G5") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G5#") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A5") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A5#") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B5") + + PORT_START("KBLOCK_7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C6") + PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("KBLOCK_8") + PORT_BIT(0x7f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Foot Switch") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor bbc_m4000_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( m4000 ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_m4000_device - constructor +//------------------------------------------------- + +bbc_m4000_device::bbc_m4000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_M4000, tag, owner, clock) + , device_bbc_userport_interface(mconfig, *this) + , m_kbd(*this, "KBLOCK_%u", 1) + , m_clk(0) + , m_dsb(0) + , m_out(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bbc_m4000_device::device_start() +{ + save_item(NAME(m_clk)); + save_item(NAME(m_dsb)); + save_item(NAME(m_out)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +void bbc_m4000_device::write_cb1(int state) +{ + // 74hc164 + if (!m_clk && state) + { + m_out = (m_out << 1) | m_dsb; + } + m_clk = state; +} + +void bbc_m4000_device::write_cb2(int state) +{ + // 74hc164 + m_dsb = state; +} + +uint8_t bbc_m4000_device::pb_r() +{ + uint8_t data = 0xff; + + for (int block = 0; block < 8; block++) + { + if (!BIT(m_out, block)) + data = m_kbd[block]->read(); + } + + return data; +} diff --git a/src/devices/bus/bbc/userport/m4000.h b/src/devices/bus/bbc/userport/m4000.h new file mode 100644 index 00000000000..df9c5e556cf --- /dev/null +++ b/src/devices/bus/bbc/userport/m4000.h @@ -0,0 +1,58 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Hybrid Music 4000 Keyboard + + https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-4000-Keyboard/ + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Hybrid_Music4000.html + +**********************************************************************/ + + +#ifndef MAME_BUS_BBC_USERPORT_M4000_H +#define MAME_BUS_BBC_USERPORT_M4000_H + +#pragma once + +#include "userport.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> bbc_m4000_device + +class bbc_m4000_device : + public device_t, + public device_bbc_userport_interface +{ +public: + // construction/destruction + bbc_m4000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + + virtual uint8_t pb_r() override; + virtual void write_cb1(int state) override; + virtual void write_cb2(int state) override; + +private: + required_ioport_array<8> m_kbd; + + int m_clk; + int m_dsb; + uint8_t m_out; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_M4000, bbc_m4000_device) + + +#endif // MAME_BUS_BBC_USERPORT_M4000_H diff --git a/src/devices/bus/bbc/userport/userport.cpp b/src/devices/bus/bbc/userport/userport.cpp index d312cc10d50..3091c04f816 100644 --- a/src/devices/bus/bbc/userport/userport.cpp +++ b/src/devices/bus/bbc/userport/userport.cpp @@ -51,12 +51,12 @@ device_bbc_userport_interface::~device_bbc_userport_interface() // bbc_userport_slot_device - constructor //------------------------------------------------- -bbc_userport_slot_device::bbc_userport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, BBC_USERPORT_SLOT, tag, owner, clock), - device_single_card_slot_interface<device_bbc_userport_interface>(mconfig, *this), - m_device(nullptr), - m_cb1_handler(*this), - m_cb2_handler(*this) +bbc_userport_slot_device::bbc_userport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_USERPORT_SLOT, tag, owner, clock) + , device_single_card_slot_interface<device_bbc_userport_interface>(mconfig, *this) + , m_device(nullptr) + , m_cb1_handler(*this) + , m_cb2_handler(*this) { } @@ -101,6 +101,28 @@ void bbc_userport_slot_device::pb_w(uint8_t data) //------------------------------------------------- +// write_cb1 +//------------------------------------------------- + +void bbc_userport_slot_device::write_cb1(int state) +{ + if (m_device) + m_device->write_cb1(state); +} + + +//------------------------------------------------- +// write_cb2 +//------------------------------------------------- + +void bbc_userport_slot_device::write_cb2(int state) +{ + if (m_device) + m_device->write_cb2(state); +} + + +//------------------------------------------------- // SLOT_INTERFACE( bbc_userport_devices ) //------------------------------------------------- @@ -110,6 +132,7 @@ void bbc_userport_slot_device::pb_w(uint8_t data) //#include "digitiser.h" //#include "ev1.h" #include "lcd.h" +#include "m4000.h" #include "palext.h" #include "pointer.h" #include "usersplit.h" @@ -129,11 +152,11 @@ void bbc_userport_devices(device_slot_interface &device) //device.option_add("ev1", BBC_EV1); /* Micro-Robotics EV1 */ //device.option_add("hobbit", BBC_HOBBIT); /* Hobbit Floppy Tape System (Ikon) */ device.option_add("lcd", BBC_LCD); /* Sprow LCD Display */ + device.option_add("m4000", BBC_M4000); /* Hybrid Music 4000 Keyboard */ device.option_add("m512mouse", BBC_M512MOUSE); /* Acorn Mouse (provided with Master 512) */ device.option_add("tracker", BBC_TRACKER); /* Marconi RB2 Tracker Ball / Acorn Tracker Ball */ device.option_add("usersplit", BBC_USERSPLIT); /*User Port Splitter (Watford Electronics) */ //device.option_add("vci", BBC_VCI); /* Video Camera Interface (Data Harvest) */ device.option_add("voicebox", BBC_VOICEBOX); /* Robin Voice Box */ - //device.option_add("music4000", BBC_MUSIC4000); /* Hybrid Music 4000 Keyboard */ device.option_add_internal("cfa3000kbd", CFA3000_KBD);/* Henson CFA 3000 Keyboard */ } diff --git a/src/devices/bus/bbc/userport/userport.h b/src/devices/bus/bbc/userport/userport.h index c0a0b560eac..29374eb9058 100644 --- a/src/devices/bus/bbc/userport/userport.h +++ b/src/devices/bus/bbc/userport/userport.h @@ -61,11 +61,15 @@ public: auto cb1_handler() { return m_cb1_handler.bind(); } auto cb2_handler() { return m_cb2_handler.bind(); } + // from slot DECLARE_WRITE_LINE_MEMBER(cb1_w) { m_cb1_handler(state); } DECLARE_WRITE_LINE_MEMBER(cb2_w) { m_cb2_handler(state); } + // from host uint8_t pb_r(); void pb_w(uint8_t data); + void write_cb1(int state); + void write_cb2(int state); protected: // device-level overrides @@ -89,6 +93,8 @@ public: virtual uint8_t pb_r() { return 0xff; } virtual void pb_w(uint8_t data) { } + virtual void write_cb1(int state) { } + virtual void write_cb2(int state) { } protected: device_bbc_userport_interface(const machine_config &mconfig, device_t &device); diff --git a/src/devices/bus/bbc/userport/usersplit.cpp b/src/devices/bus/bbc/userport/usersplit.cpp index abe6ec155bf..520abaebdb9 100644 --- a/src/devices/bus/bbc/userport/usersplit.cpp +++ b/src/devices/bus/bbc/userport/usersplit.cpp @@ -98,6 +98,17 @@ void bbc_usersplit_device::pb_w(uint8_t data) m_userport[m_selected]->pb_w(data); } +void bbc_usersplit_device::write_cb1(int state) +{ + m_userport[m_selected]->write_cb1(state); +} + +void bbc_usersplit_device::write_cb2(int state) +{ + m_userport[m_selected]->write_cb2(state); +} + + WRITE_LINE_MEMBER(bbc_usersplit_device::cb1a_w) { if (m_selected == 0x00) diff --git a/src/devices/bus/bbc/userport/usersplit.h b/src/devices/bus/bbc/userport/usersplit.h index d10a31a3eb2..27ce11a9fde 100644 --- a/src/devices/bus/bbc/userport/usersplit.h +++ b/src/devices/bus/bbc/userport/usersplit.h @@ -40,6 +40,8 @@ protected: virtual uint8_t pb_r() override; virtual void pb_w(uint8_t data) override; + virtual void write_cb1(int state) override; + virtual void write_cb2(int state) override; private: DECLARE_WRITE_LINE_MEMBER(cb1a_w); diff --git a/src/devices/bus/bw2/ramcard.cpp b/src/devices/bus/bw2/ramcard.cpp index 48de6cffdec..b1e0bfe5bcf 100644 --- a/src/devices/bus/bw2/ramcard.cpp +++ b/src/devices/bus/bw2/ramcard.cpp @@ -90,15 +90,17 @@ void bw2_ramcard_device::device_reset() uint8_t bw2_ramcard_device::bw2_cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) { - if (!ram2) + if (offset < 0x8000) { - data = m_rom->base()[offset & 0x3fff]; + if (!ram2) + { + data = m_rom->base()[offset & 0x3fff]; + } + else if (m_en && !ram5) + { + data = m_ram[(m_bank << 15) | offset]; + } } - else if (m_en && !ram5) - { - data = m_ram[(m_bank << 15) | offset]; - } - return data; } @@ -109,9 +111,12 @@ uint8_t bw2_ramcard_device::bw2_cd_r(offs_t offset, uint8_t data, int ram2, int void bw2_ramcard_device::bw2_cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6) { - if (m_en && !ram5) + if (offset < 0x8000) { - m_ram[(m_bank << 15) | offset] = data; + if (m_en && !ram5) + { + m_ram[(m_bank << 15) | offset] = data; + } } } diff --git a/src/devices/bus/c64/xl80.cpp b/src/devices/bus/c64/xl80.cpp index 8f0f35b523f..6bfa6e9d8cd 100644 --- a/src/devices/bus/c64/xl80.cpp +++ b/src/devices/bus/c64/xl80.cpp @@ -85,12 +85,12 @@ const tiny_rom_entry *c64_xl80_device::device_rom_region() const MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int column = 0; column < x_count; column++) { - uint8_t code = m_ram[((ma + column) & 0x7ff)]; - uint16_t addr = (code << 3) | (ra & 0x07); + uint8_t const code = m_ram[((ma + column) & 0x7ff)]; + uint16_t const addr = (code << 3) | (ra & 0x07); uint8_t data = m_char_rom->base()[addr & 0x7ff]; if (column == cursor_x) @@ -100,10 +100,10 @@ MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; + int const x = (column * 8) + bit; + int const color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/devices/bus/cbmiec/cbmiec.cpp b/src/devices/bus/cbmiec/cbmiec.cpp index 98535963034..4ee8f287200 100644 --- a/src/devices/bus/cbmiec/cbmiec.cpp +++ b/src/devices/bus/cbmiec/cbmiec.cpp @@ -338,7 +338,7 @@ void cbm_iec_device::device_stop() void cbm_iec_device::add_device(cbm_iec_slot_device *slot, device_t *target) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_slot = slot; entry->m_interface->m_bus = this; diff --git a/src/devices/bus/centronics/epson_lx810l.cpp b/src/devices/bus/centronics/epson_lx810l.cpp index 1d9c0ac8577..2744ea3e3ac 100644 --- a/src/devices/bus/centronics/epson_lx810l.cpp +++ b/src/devices/bus/centronics/epson_lx810l.cpp @@ -575,9 +575,9 @@ WRITE_LINE_MEMBER( epson_lx810l_device::co0_w ) */ if (m_real_cr_pos < m_bitmap.width()) { for (int i = 0; i < 9; i++) { - unsigned int y = bitmap_line(i); + unsigned int const y = bitmap_line(i); if ((m_printhead & (1<<(8-i))) != 0) - m_bitmap.pix32(y, m_real_cr_pos + CR_OFFSET) = 0x000000; + m_bitmap.pix(y, m_real_cr_pos + CR_OFFSET) = 0x000000; } } } diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp index 63f6e90fcc5..3677010648f 100644 --- a/src/devices/bus/coco/coco_ssc.cpp +++ b/src/devices/bus/coco/coco_ssc.cpp @@ -130,7 +130,7 @@ namespace virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream* m_stream; @@ -535,25 +535,25 @@ cocossc_sac_device::cocossc_sac_device(const machine_config &mconfig, const char void cocossc_sac_device::device_start() { - m_stream = stream_alloc_legacy(1, 1, machine().sample_rate()); + m_stream = stream_alloc(1, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void cocossc_sac_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cocossc_sac_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t const *src = inputs[0]; - stream_sample_t *dst = outputs[0]; + auto &src = inputs[0]; + auto &dst = outputs[0]; - double n = samples; + double n = dst.samples(); - while (samples--) + for (int sampindex = 0; sampindex < n; sampindex++) { - m_rms[m_index] += ( (double)*src * (double)*src ); - *dst++ = (*src++); + m_rms[m_index] += src.get(sampindex) * src.get(sampindex); + dst.put(sampindex, src.get(sampindex)); } m_rms[m_index] = m_rms[m_index] / n; @@ -576,7 +576,7 @@ bool cocossc_sac_device::sound_activity_circuit_output() average /= 16.0; - if( average > 10400.0 ) + if( average > 0.317 ) return true; return false; diff --git a/src/devices/bus/compis/hrg.cpp b/src/devices/bus/compis/hrg.cpp index 7aa8aa72f7e..1612729e706 100644 --- a/src/devices/bus/compis/hrg.cpp +++ b/src/devices/bus/compis/hrg.cpp @@ -51,11 +51,11 @@ void compis_uhrg_device::uhrg_map(address_map &map) UPD7220_DISPLAY_PIXELS_MEMBER( compis_hrg_device::display_pixels ) { - uint16_t i,gfx = m_video_ram[(address & 0x7fff) >> 1]; - const pen_t *pen = m_palette->pens(); + uint16_t const gfx = m_video_ram[(address & 0x7fff) >> 1]; + pen_t const *const pen = m_palette->pens(); - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; + for(uint16_t i=0; i<16; i++) + bitmap.pix(y, x + i) = pen[BIT(gfx, i)]; } @@ -65,11 +65,11 @@ UPD7220_DISPLAY_PIXELS_MEMBER( compis_hrg_device::display_pixels ) UPD7220_DISPLAY_PIXELS_MEMBER( compis_uhrg_device::display_pixels ) { - uint16_t i,gfx = m_video_ram[(address & 0x1ffff) >> 1]; - const pen_t *pen = m_palette->pens(); + uint16_t const gfx = m_video_ram[(address & 0x1ffff) >> 1]; + pen_t const *const pen = m_palette->pens(); - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; + for(uint16_t i=0; i<16; i++) + bitmap.pix(y, x + i) = pen[BIT(gfx, i)]; } diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp index ebf7e1f271e..192e5989a36 100644 --- a/src/devices/bus/comx35/clm.cpp +++ b/src/devices/bus/comx35/clm.cpp @@ -104,8 +104,8 @@ MC6845_UPDATE_ROW( comx_clm_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - uint8_t code = m_video_ram[((ma + column) & 0x7ff)]; - uint16_t addr = (code << 3) | (ra & 0x07); + uint8_t const code = m_video_ram[((ma + column) & 0x7ff)]; + uint16_t const addr = (code << 3) | (ra & 0x07); uint8_t data = m_char_rom->base()[addr & 0x7ff]; if (BIT(ra, 3) && column == cursor_x) @@ -115,9 +115,9 @@ MC6845_UPDATE_ROW( comx_clm_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de); data <<= 1; } diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp index 88e3d2fe23b..659bab524ad 100644 --- a/src/devices/bus/ecbbus/grip.cpp +++ b/src/devices/bus/ecbbus/grip.cpp @@ -179,35 +179,33 @@ MC6845_UPDATE_ROW( ecb_grip21_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - uint16_t address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); - uint8_t data = m_video_ram[address]; + uint16_t const address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); + uint8_t const data = m_video_ram[address]; for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = (m_flash ? 0 : BIT(data, bit)) && de; + int const x = (column * 8) + bit; + int const color = (m_flash ? 0 : BIT(data, bit)) && de; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(color); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(color); } } } /* MC6845_UPDATE_ROW( ecb_grip21_device::grip5_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int column, bit; - - for (column = 0; column < x_count; column++) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + for (int column = 0; column < x_count; column++) { - uint16_t address = (m_dpage << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); - uint8_t data = m_video_ram[address]; + uint16_t const address = (m_dpage << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); + uint8_t const data = m_video_ram[address]; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = m_flash ? 0 : BIT(data, bit); + int const x = (column * 8) + bit; + int const color = m_flash ? 0 : BIT(data, bit); - bitmap.pix32(y, x) = palette[color]; + bitmap.pix(y, x) = palette[color]; } } } @@ -217,7 +215,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED( ecb_grip21_device::grip5_addr_changed ) } */ -static const int16_t speaker_levels[] = { -32768, 0, 32767, 0 }; +static const double speaker_levels[] = { -1.0, 0.0, 1.0, 0.0 }; //------------------------------------------------- // I8255A interface diff --git a/src/devices/bus/econet/econet.cpp b/src/devices/bus/econet/econet.cpp index f87850fe133..e9afc9c0d49 100644 --- a/src/devices/bus/econet/econet.cpp +++ b/src/devices/bus/econet/econet.cpp @@ -223,7 +223,7 @@ void econet_device::device_stop() void econet_device::add_device(device_t *target, int address) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_econet = this; entry->m_interface->m_address = address; diff --git a/src/devices/bus/einstein/pipe/tk02.cpp b/src/devices/bus/einstein/pipe/tk02.cpp index b0cf5998131..74cd880e151 100644 --- a/src/devices/bus/einstein/pipe/tk02.cpp +++ b/src/devices/bus/einstein/pipe/tk02.cpp @@ -185,14 +185,14 @@ MC6845_UPDATE_ROW( tk02_device::crtc_update_row ) if (i == cursor_x) data ^= 0xff; - bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, i * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, i * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, i * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, i * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, i * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, i * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, i * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, i * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/devices/bus/electron/cart/ap5.cpp b/src/devices/bus/electron/cart/ap5.cpp index c65daf911d4..3deacaa655b 100644 --- a/src/devices/bus/electron/cart/ap5.cpp +++ b/src/devices/bus/electron/cart/ap5.cpp @@ -36,6 +36,8 @@ void electron_ap5_device::device_add_mconfig(machine_config &config) VIA6522(config, m_via, DERIVED_CLOCK(1, 16)); m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); + m_via->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); + m_via->cb2_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb2)); m_via->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); /* user port */ diff --git a/src/devices/bus/electron/mode7.cpp b/src/devices/bus/electron/mode7.cpp index 103c861c4ae..408b6a92300 100644 --- a/src/devices/bus/electron/mode7.cpp +++ b/src/devices/bus/electron/mode7.cpp @@ -195,7 +195,7 @@ void electron_mode7_device::expbus_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW(electron_mode7_device::crtc_update_row) { - uint32_t* p = &bitmap.pix32(y); + uint32_t* p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp index f0e28d73150..1e9d9d6591b 100644 --- a/src/devices/bus/electron/plus2.cpp +++ b/src/devices/bus/electron/plus2.cpp @@ -53,6 +53,8 @@ void electron_plus2_device::device_add_mconfig(machine_config &config) VIA6522(config, m_via, DERIVED_CLOCK(1, 16)); m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); + m_via->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); + m_via->cb2_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb2)); m_via->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<2>)); /* user port */ diff --git a/src/devices/bus/fmt_scsi/fmt121.cpp b/src/devices/bus/fmt_scsi/fmt121.cpp new file mode 100644 index 00000000000..34f784115a0 --- /dev/null +++ b/src/devices/bus/fmt_scsi/fmt121.cpp @@ -0,0 +1,150 @@ +// license:BSD-3-Clause +// copyright-holders:r09 +/**************************************************************************** + + Fujitsu FMT-121 SCSI Card + + An expansion card for the dedicated SCSI card slot on the FM Towns + Model 1 and 2 computers. It contains a Fujitsu MB673522U SCSI controller + and an external 50-pin Centronics connector. + + ||||||||||||||||||||| ++-------------------------| |-------------------------+ +| CN1 +-------------------+ | +| | +| 74LS04N | +| 74LS14N 74LS240N SN74LS06N | +| MB413 | +| MB463 | +| 74AS00N | +| +-----------+ | +| MB463 | | | +| | MB673522U | MB412 | +| +-----------+ | +| MB463 74LS240N | +| CN3 | +| .......................................... | +| . . | +| .......................................... | +| CN2 | +| +----------------------------------------+ | +| | | | ++--------------| |---------------+ + |||||||||||||||||||||||||||||||||||||||||| + + CN1: 30-pin MFC-30LFD DIP connector + CN2: 50-pin Centronics connector + CN3: solder pads for internal 50-pin connector (not present) + +****************************************************************************/ + +#include "emu.h" +#include "fmt121.h" + +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsihd.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +DEFINE_DEVICE_TYPE(FMT121, fmt121_device, "fmt121", "FMT-121 SCSI Card") + +//************************************************************************** +// DEVICE DEFINITION +//************************************************************************** + +//------------------------------------------------- +// fmt121_device - construction +//------------------------------------------------- + +fmt121_device::fmt121_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, FMT121, tag, owner, clock) + , fmt_scsi_card_interface(mconfig, *this) + , m_scsi_ctlr(*this, "fmscsi") +{ +} + + +//------------------------------------------------- +// device_add_mconfig - add device-specific +// machine configuration +//------------------------------------------------- + +void fmt121_device::device_add_mconfig(machine_config &config) +{ + scsi_port_device &scsi(SCSI_PORT(config, "scsi", 0)); + scsi.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_0)); + scsi.set_slot_device(2, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_1)); + scsi.set_slot_device(3, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_2)); + scsi.set_slot_device(4, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_3)); + scsi.set_slot_device(5, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_4)); + + FMSCSI(config, m_scsi_ctlr, 0); + m_scsi_ctlr->set_scsi_port("scsi"); + m_scsi_ctlr->irq_handler().set(FUNC(fmt121_device::irq_w)); + m_scsi_ctlr->drq_handler().set(FUNC(fmt121_device::drq_w)); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void fmt121_device::device_start() +{ +} + +//************************************************************************** +// FMT121 INTERFACE +//************************************************************************** + +//------------------------------------------------- +// fmt_scsi_read - I/O read access +//------------------------------------------------- + +u8 fmt121_device::fmt_scsi_read(offs_t offset) +{ + return m_scsi_ctlr->fmscsi_r(offset); +} + + +//------------------------------------------------- +// fmt_scsi_write - I/O write access +//------------------------------------------------- + +void fmt121_device::fmt_scsi_write(offs_t offset, u8 data) +{ + m_scsi_ctlr->fmscsi_w(offset, data); +} + +//------------------------------------------------- +// fmt_scsi_data_read - data read access +//------------------------------------------------- + +u8 fmt121_device::fmt_scsi_data_read() +{ + return m_scsi_ctlr->fmscsi_data_r(); +} + +//------------------------------------------------- +// fmt_scsi_data_write - data write access +//------------------------------------------------- + +void fmt121_device::fmt_scsi_data_write(u8 data) +{ + m_scsi_ctlr->fmscsi_data_w(data); +} + + +void fmt121_device::irq_w(int state) +{ + m_slot->irq_w(state); +} + + +void fmt121_device::drq_w(int state) +{ + m_slot->drq_w(state); +} diff --git a/src/devices/bus/fmt_scsi/fmt121.h b/src/devices/bus/fmt_scsi/fmt121.h new file mode 100644 index 00000000000..9b80b2c70f1 --- /dev/null +++ b/src/devices/bus/fmt_scsi/fmt121.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:r09 + +#ifndef MAME_BUS_FMT_SCSI_FMT121_H +#define MAME_BUS_FMT_SCSI_FMT121_H + +#pragma once + +#include "fmt_scsi.h" + +#include "machine/fm_scsi.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> fmt121_device + +class fmt121_device : public device_t, public fmt_scsi_card_interface +{ +public: + // device type constructor + fmt121_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + // device-level overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; + + // fmt_scsi_card_interface overrides + virtual u8 fmt_scsi_read(offs_t offset) override; + virtual void fmt_scsi_write(offs_t offset, u8 data) override; + + virtual u8 fmt_scsi_data_read(void) override; + virtual void fmt_scsi_data_write(u8 data) override; + +private: + + required_device<fmscsi_device> m_scsi_ctlr; + + void irq_w(int state); + void drq_w(int state); + +}; + +// device type declaration +DECLARE_DEVICE_TYPE(FMT121, fmt121_device) + +#endif // MAME_BUS_FMT_SCSI_FMT121_H diff --git a/src/devices/bus/fmt_scsi/fmt_scsi.cpp b/src/devices/bus/fmt_scsi/fmt_scsi.cpp new file mode 100644 index 00000000000..b5d62fb3577 --- /dev/null +++ b/src/devices/bus/fmt_scsi/fmt_scsi.cpp @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:r09 +/**************************************************************************** + + Fujitsu FM Towns SCSI card slot + + This is a dedicated 30-pin slot for the FMT-121 SCSI Card. It is only + present on the Model 1 and 2; all later models integrate the SCSI + controller directly on the motherboard. + +****************************************************************************/ + +#include "emu.h" +#include "fmt_scsi.h" + +#include "fmt121.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +DEFINE_DEVICE_TYPE(FMT_SCSI_SLOT, fmt_scsi_slot_device, "fmt_scsi_slot", "FM Towns SCSI card slot") + +//************************************************************************** +// FMT_SCSI SLOT DEVICE +//************************************************************************** + +//------------------------------------------------- +// fmt_scsi_slot_device - construction +//------------------------------------------------- + +fmt_scsi_slot_device::fmt_scsi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, FMT_SCSI_SLOT, tag, owner, clock) + , device_single_card_slot_interface<fmt_scsi_card_interface>(mconfig, *this) + , m_card(nullptr) + , m_irq_handler(*this) + , m_drq_handler(*this) +{ +} + + +//------------------------------------------------- +// device_resolve_objects - resolve objects that +// may be needed for other devices to set +// initial conditions at start time +//------------------------------------------------- + +void fmt_scsi_slot_device::device_resolve_objects() +{ + m_card = get_card_device(); + if (m_card != nullptr) + m_card->m_slot = this; +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void fmt_scsi_slot_device::device_start() +{ + m_irq_handler.resolve_safe(); + m_drq_handler.resolve_safe(); +} + + +//------------------------------------------------- +// read - I/O read access +//------------------------------------------------- + +u8 fmt_scsi_slot_device::read(address_space &space, offs_t offset) +{ + if (m_card) + return m_card->fmt_scsi_read(offset); + else + return space.unmap(); +} + + +//------------------------------------------------- +// write - I/O write access +//------------------------------------------------- + +void fmt_scsi_slot_device::write(offs_t offset, u8 data) +{ + if (m_card) + m_card->fmt_scsi_write(offset, data); +} + +//------------------------------------------------- +// data_read - data read access +//------------------------------------------------- + +u8 fmt_scsi_slot_device::data_read() +{ + if (m_card) + return m_card->fmt_scsi_data_read(); + else + return 0; +} + +//------------------------------------------------- +// data_write - data write access +//------------------------------------------------- + +void fmt_scsi_slot_device::data_write(u8 data) +{ + if (m_card) + m_card->fmt_scsi_data_write(data); +} + +void fmt_scsi_slot_device::irq_w(int state) +{ + m_irq_handler(state); +} + +void fmt_scsi_slot_device::drq_w(int state) +{ + m_drq_handler(state); +} + +//************************************************************************** +// FMT_SCSI CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// fmt_scsi_card_interface - construction +//------------------------------------------------- + +fmt_scsi_card_interface::fmt_scsi_card_interface(const machine_config &mconfig, device_t &device) + : device_interface(device, "fmtscsicard") + , m_slot(nullptr) +{ +} + + +//------------------------------------------------- +// interface_pre_start - called before the +// device's own start function +//------------------------------------------------- + +void fmt_scsi_card_interface::interface_pre_start() +{ + if (!m_slot) + throw device_missing_dependencies(); +} + + +//------------------------------------------------- +// fmt_scsi_default_devices - add standard options +// for main slots +//------------------------------------------------- + +void fmt_scsi_default_devices(device_slot_interface &device) +{ + device.option_add("fmt121", FMT121); +} diff --git a/src/devices/bus/fmt_scsi/fmt_scsi.h b/src/devices/bus/fmt_scsi/fmt_scsi.h new file mode 100644 index 00000000000..549b1047f4c --- /dev/null +++ b/src/devices/bus/fmt_scsi/fmt_scsi.h @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:r09 +/********************************************************************** + + Fujitsu FM Towns SCSI card slot + +**********************************************************************/ + +#ifndef MAME_BUS_FMT_SCSI_FMT_SCSI_H +#define MAME_BUS_FMT_SCSI_FMT_SCSI_H + +#pragma once + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// forward declarations +class fmt_scsi_card_interface; + +// ======================> fmt_scsi_slot_device + +class fmt_scsi_slot_device : public device_t, public device_single_card_slot_interface<fmt_scsi_card_interface> +{ + friend class fmt_scsi_card_interface; + +public: + // construction/destruction + template <typename T> + fmt_scsi_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : fmt_scsi_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + fmt_scsi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + + auto irq_handler() { return m_irq_handler.bind(); } + auto drq_handler() { return m_drq_handler.bind(); } + + u8 read(address_space &space, offs_t offset); + void write(offs_t offset, u8 data); + + uint8_t data_read(void); + void data_write(uint8_t data); + + void irq_w(int state); + void drq_w(int state); + +protected: + // device-specific overrides + virtual void device_resolve_objects() override; + virtual void device_start() override; + +private: + fmt_scsi_card_interface *m_card; + + devcb_write_line m_irq_handler; + devcb_write_line m_drq_handler; + +}; + + +// ======================> fmt_scsi_card_interface + +class fmt_scsi_card_interface : public device_interface +{ + friend class fmt_scsi_slot_device; + +protected: + // construction/destruction + fmt_scsi_card_interface(const machine_config &mconfig, device_t &device); + + // required overrides + virtual u8 fmt_scsi_read(offs_t offset) = 0; + virtual void fmt_scsi_write(offs_t offset, u8 data) = 0; + + virtual u8 fmt_scsi_data_read(void) = 0; + virtual void fmt_scsi_data_write(u8 data) = 0; + + fmt_scsi_slot_device *m_slot; + +private: + virtual void interface_pre_start() override; + +}; + + +// device type definition +DECLARE_DEVICE_TYPE(FMT_SCSI_SLOT, fmt_scsi_slot_device) + +void fmt_scsi_default_devices(device_slot_interface &device); + +#endif // MAME_BUS_FMT_SCSI_FMT_SCSI_H diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp index 1be643afddd..142947b4ae0 100644 --- a/src/devices/bus/gio64/newport.cpp +++ b/src/devices/bus/gio64/newport.cpp @@ -1302,7 +1302,7 @@ uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32 /* loop over rows and copy to the destination */ for (int y = cliprect.min_y, sy = y_start; y <= cliprect.max_y && sy < y_end; y++, sy++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); const uint32_t *src_rgbci = m_rb2->rgbci(y); const uint32_t *src_cidaux = m_rb2->cidaux(y); diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp index 0b8d7821cb6..53e8a40e7c0 100644 --- a/src/devices/bus/hexbus/hexbus.cpp +++ b/src/devices/bus/hexbus/hexbus.cpp @@ -224,18 +224,20 @@ uint8_t hexbus_device::read(int dir) hexbus_chained_device::hexbus_chained_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock): device_t(mconfig, type, tag, owner, clock), device_hexbus_interface(mconfig, *this), + m_hexbus_outbound(nullptr), m_enabled(false), m_myvalue(0xff) { m_hexbus_inbound = dynamic_cast<hexbus_device *>(owner); } -void hexbus_chained_device::device_start() +void hexbus_chained_device::device_resolve_objects() { - m_hexbus_outbound = static_cast<hexbus_device*>(subdevice("hexbus")); + m_hexbus_outbound = dynamic_cast<hexbus_device *>(subdevice("hexbus")); // Establish callback for inbound propagations - m_hexbus_outbound->set_chain_element(this); + if (m_hexbus_outbound != nullptr) + m_hexbus_outbound->set_chain_element(this); } /* diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h index 76092c0f16f..7f39400974b 100644 --- a/src/devices/bus/hexbus/hexbus.h +++ b/src/devices/bus/hexbus/hexbus.h @@ -60,7 +60,7 @@ protected: void set_outbound_hexbus(hexbus_device *outbound) { m_hexbus_outbound = outbound; } - virtual void device_start() override; + virtual void device_resolve_objects() override; // Link to the inbound Hexbus (if not null, see Oso chip) hexbus_device *m_hexbus_inbound; diff --git a/src/devices/bus/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp index f9d2341456e..65f59e0a18a 100644 --- a/src/devices/bus/hexbus/hx5102.cpp +++ b/src/devices/bus/hexbus/hx5102.cpp @@ -121,7 +121,9 @@ void hx5102_device::memmap(address_map &map) */ void hx5102_device::crumap(address_map &map) { - map(0x17e0, 0x17ff).rw(FUNC(hx5102_device::cruread), FUNC(hx5102_device::cruwrite)); + map(0x17e0, 0x17ff).r(FUNC(hx5102_device::cruread)); + map(0x17e0, 0x17ef).w(m_crulatch[0], FUNC(ls259_device::write_d0)); + map(0x17f0, 0x17ff).w(m_crulatch[1], FUNC(ls259_device::write_d0)); } hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock): @@ -140,6 +142,7 @@ hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, dev m_floppy_select_last(UNDEF), m_hexbus_ctrl(*this, IBC_TAG), m_floppy_ctrl(*this, FDC_TAG), + m_crulatch(*this, "crulatch%u", 0U), m_motormf(*this, MTRD_TAG), m_speedmf(*this, MTSPD_TAG), m_readyff(*this, READYFF_TAG), @@ -480,92 +483,81 @@ uint8_t hx5102_device::cruread(offs_t offset) /* CRU write access. */ -void hx5102_device::cruwrite(offs_t offset, uint8_t data) +WRITE_LINE_MEMBER(hx5102_device::nocomp_w) { - // LOG("Writing CRU address %04x: %x\n", 0x17e0 + (offset<<1), data); - switch (offset) - { - case 0: - // unused right now - LOGMASKED(LOG_CRU, "Set precompensation = %d\n", data); - break; - case 1: - if (data==1) - { - LOGMASKED(LOG_CRU, "Trigger motor monoflop\n"); - } - m_motormf->b_w(data); - break; - case 2: - LOGMASKED(LOG_CRU, "Set undefined CRU bit 2 to %d\n", data); - break; - case 3: - LOGMASKED(LOG_CRU, "Set step direction = %d\n", data); - if (m_current_floppy != nullptr) m_current_floppy->dir_w((data==0)? 1 : 0); - break; - case 4: - if (data==1) - { - LOGMASKED(LOG_CRU, "Assert DACK*\n"); - m_dacken = (data != 0); - } - break; - case 5: - if (data==1) - { - LOGMASKED(LOG_CRU, "Step pulse\n"); - } - if (m_current_floppy != nullptr) m_current_floppy->stp_w((data==0)? 1 : 0); - break; - case 6: - if (data==1) - { - LOGMASKED(LOG_CRU, "Start watchdog\n"); - } - m_speedmf->b_w(data); - break; - case 7: - if (data==0) - { - LOGMASKED(LOG_CRU, "Reset i8272A controller\n"); - m_floppy_ctrl->soft_reset(); - } - break; - case 8: - LOGMASKED(LOG_CRU, "Set drive select 0 to %d\n", data); - if (data == 1) m_floppy_select |= 1; - else m_floppy_select &= ~1; - break; - case 9: - LOGMASKED(LOG_CRU, "Set drive select 1 to %d\n", data); - if (data == 1) m_floppy_select |= 2; - else m_floppy_select &= ~2; - break; - case 10: - // External drive; not implemented - LOGMASKED(LOG_CRU, "Set drive select 2 to %d\n", data); - break; - case 11: - // External drive; not implemented - LOGMASKED(LOG_CRU, "Set drive select 3 to %d\n", data); - break; - case 12: - // External drive; not implemented - LOGMASKED(LOG_CRU, "Set auxiliary motor line to %d\n", data); - break; - case 13: - LOGMASKED(LOG_CRU, "Set CRU bit 13 to %d (unused)\n", data); - break; - case 14: - m_wait = (data!=0); - LOGMASKED(LOG_CRU, "READY circuit %s\n", m_wait? "active" : "inactive" ); - update_readyff_input(); - break; - case 15: - LOGMASKED(LOG_CRU, "Set CRU bit 15 to %d (unused)\n", data); - break; - } + // unused right now + LOGMASKED(LOG_CRU, "Set precompensation = %d\n", state); +} +WRITE_LINE_MEMBER(hx5102_device::diren_w) +{ + LOGMASKED(LOG_CRU, "Set step direction = %d\n", state); + if (m_current_floppy != nullptr) + m_current_floppy->dir_w((state==0)? 1 : 0); +} + +WRITE_LINE_MEMBER(hx5102_device::dacken_w) +{ + if (state==1) + LOGMASKED(LOG_CRU, "Assert DACK*\n"); + m_dacken = (state != 0); +} + +WRITE_LINE_MEMBER(hx5102_device::stepen_w) +{ + if (state==1) + LOGMASKED(LOG_CRU, "Step pulse\n"); + if (m_current_floppy != nullptr) + m_current_floppy->stp_w((state==0)? 1 : 0); +} + +WRITE_LINE_MEMBER(hx5102_device::ds1_w) +{ + LOGMASKED(LOG_CRU, "Set drive select 0 to %d\n", state); + if (state == 1) + m_floppy_select |= 1; + else + m_floppy_select &= ~1; + update_drive_select(); +} + +WRITE_LINE_MEMBER(hx5102_device::ds2_w) +{ + LOGMASKED(LOG_CRU, "Set drive select 1 to %d\n", state); + if (state == 1) + m_floppy_select |= 2; + else + m_floppy_select &= ~2; + update_drive_select(); +} + +WRITE_LINE_MEMBER(hx5102_device::ds3_w) +{ + // External drive; not implemented + LOGMASKED(LOG_CRU, "Set drive select 2 to %d\n", state); +} + +WRITE_LINE_MEMBER(hx5102_device::ds4_w) +{ + // External drive; not implemented + LOGMASKED(LOG_CRU, "Set drive select 3 to %d\n", state); +} + +WRITE_LINE_MEMBER(hx5102_device::aux_motor_w) +{ + // External drive; not implemented + LOGMASKED(LOG_CRU, "Set auxiliary motor line to %d\n", state); +} + +WRITE_LINE_MEMBER(hx5102_device::wait_w) +{ + m_wait = (state!=0); + LOGMASKED(LOG_CRU, "READY circuit %s\n", m_wait? "active" : "inactive" ); + update_readyff_input(); +} + +void hx5102_device::update_drive_select() +{ if (m_floppy_select != m_floppy_select_last) { if (m_floppy_select == 1) @@ -677,7 +669,7 @@ void hx5102_device::device_add_mconfig(machine_config& config) HEXBUS(config, "hexbus", 0, hexbus_options, nullptr); // TMS9995 CPU @ 12.0 MHz - TMS9995(config, m_flopcpu, XTAL(12'000'000)); + TMS9995(config, m_flopcpu, 12_MHz_XTAL); m_flopcpu->set_addrmap(AS_PROGRAM, &hx5102_device::memmap); m_flopcpu->set_addrmap(AS_IO, &hx5102_device::crumap); m_flopcpu->extop_cb().set(FUNC(hx5102_device::external_operation)); @@ -687,27 +679,41 @@ void hx5102_device::device_add_mconfig(machine_config& config) // Not connected: Select lines (DS0, DS1), Head load (HDL), VCO // Tied to 1: READY // Tied to 0: TC - I8272A(config, m_floppy_ctrl, 8'000'000, false); + I8272A(config, m_floppy_ctrl, 8_MHz_XTAL / 2, false); m_floppy_ctrl->intrq_wr_callback().set(FUNC(hx5102_device::fdc_irq_w)); m_floppy_ctrl->drq_wr_callback().set(FUNC(hx5102_device::fdc_drq_w)); FLOPPY_CONNECTOR(config, "d0", hx5102_drive, "525dd", hx5102_device::floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "d1", hx5102_drive, nullptr, hx5102_device::floppy_formats).enable_sound(true); + // Addressable latches + LS259(config, m_crulatch[0]); // U18 + m_crulatch[0]->q_out_cb<0>().set(FUNC(hx5102_device::nocomp_w)); + m_crulatch[0]->q_out_cb<1>().set(m_motormf, FUNC(ttl74123_device::b_w)); + m_crulatch[0]->q_out_cb<3>().set(FUNC(hx5102_device::diren_w)); + m_crulatch[0]->q_out_cb<4>().set(FUNC(hx5102_device::dacken_w)); + m_crulatch[0]->q_out_cb<5>().set(FUNC(hx5102_device::stepen_w)); + m_crulatch[0]->q_out_cb<6>().set(m_speedmf, FUNC(ttl74123_device::b_w)); + m_crulatch[0]->q_out_cb<7>().set(m_floppy_ctrl, FUNC(i8272a_device::reset_w)).invert(); + + LS259(config, m_crulatch[1]); // U10 + m_crulatch[1]->q_out_cb<0>().set(FUNC(hx5102_device::ds1_w)); + m_crulatch[1]->q_out_cb<1>().set(FUNC(hx5102_device::ds2_w)); + m_crulatch[1]->q_out_cb<2>().set(FUNC(hx5102_device::ds3_w)); + m_crulatch[1]->q_out_cb<3>().set(FUNC(hx5102_device::ds4_w)); + m_crulatch[1]->q_out_cb<4>().set(FUNC(hx5102_device::aux_motor_w)); + m_crulatch[1]->q_out_cb<6>().set(FUNC(hx5102_device::wait_w)); + // Monoflops - TTL74123(config, m_motormf, 0); + TTL74123(config, m_motormf, RES_K(200), CAP_U(47)); m_motormf->set_connection_type(TTL74123_GROUNDED); - m_motormf->set_resistor_value(RES_K(200)); - m_motormf->set_capacitor_value(CAP_U(47)); m_motormf->set_a_pin_value(0); m_motormf->set_b_pin_value(1); m_motormf->set_clear_pin_value(1); m_motormf->out_cb().set(FUNC(hx5102_device::motor_w)); - TTL74123(config, m_speedmf, 0); + TTL74123(config, m_speedmf, RES_K(200), CAP_U(10)); m_speedmf->set_connection_type(TTL74123_GROUNDED); - m_speedmf->set_resistor_value(RES_K(200)); - m_speedmf->set_capacitor_value(CAP_U(10)); m_speedmf->set_a_pin_value(0); m_speedmf->set_b_pin_value(1); m_speedmf->set_clear_pin_value(1); diff --git a/src/devices/bus/hexbus/hx5102.h b/src/devices/bus/hexbus/hx5102.h index 12f48dbe555..573c999ce3b 100644 --- a/src/devices/bus/hexbus/hx5102.h +++ b/src/devices/bus/hexbus/hx5102.h @@ -22,6 +22,7 @@ #include "machine/upd765.h" #include "machine/7474.h" #include "machine/74123.h" +#include "machine/74259.h" #include "machine/rescap.h" #include "machine/ram.h" #include "imagedev/floppy.h" @@ -71,7 +72,17 @@ private: DECLARE_WRITE_LINE_MEMBER(hsklatch_out); uint8_t cruread(offs_t offset); - void cruwrite(offs_t offset, uint8_t data); + DECLARE_WRITE_LINE_MEMBER(nocomp_w); + DECLARE_WRITE_LINE_MEMBER(diren_w); + DECLARE_WRITE_LINE_MEMBER(dacken_w); + DECLARE_WRITE_LINE_MEMBER(stepen_w); + DECLARE_WRITE_LINE_MEMBER(ds1_w); + DECLARE_WRITE_LINE_MEMBER(ds2_w); + DECLARE_WRITE_LINE_MEMBER(ds3_w); + DECLARE_WRITE_LINE_MEMBER(ds4_w); + DECLARE_WRITE_LINE_MEMBER(aux_motor_w); + DECLARE_WRITE_LINE_MEMBER(wait_w); + void update_drive_select(); // Operate the floppy motors bool m_motor_on; @@ -96,6 +107,7 @@ private: required_device<ibc_device> m_hexbus_ctrl; required_device<i8272a_device> m_floppy_ctrl; + required_device_array<ls259_device, 2> m_crulatch; required_device<ttl74123_device> m_motormf; required_device<ttl74123_device> m_speedmf; required_device<ttl7474_device> m_readyff; diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp index bd96c95852d..eb73c56c6f4 100644 --- a/src/devices/bus/hp_dio/hp98543.cpp +++ b/src/devices/bus/hp_dio/hp98543.cpp @@ -235,7 +235,7 @@ uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 & } for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { uint8_t tmp = m_vram[y * m_h_pix + x]; diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp index 842a7a78229..e5aced877d8 100644 --- a/src/devices/bus/hp_dio/hp98544.cpp +++ b/src/devices/bus/hp_dio/hp98544.cpp @@ -165,26 +165,20 @@ WRITE_LINE_MEMBER(dio16_98544_device::int_w) uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int startx, starty, endx, endy; - - if (!m_topcat->has_changed()) return UPDATE_HAS_NOT_CHANGED; for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { uint8_t tmp = m_vram[y * m_h_pix + x]; *scanline++ = tmp ? rgb_t(255,255,255) : rgb_t(0, 0, 0); } } + int startx, starty, endx, endy; m_topcat->get_cursor_pos(startx, starty, endx, endy); - - for (int y = starty; y <= endy; y++) { - uint32_t *scanline = &bitmap.pix32(y); - memset(scanline + startx, 0xff, (endx - startx) << 2); - } + bitmap.fill(rgb_t(255, 255, 255), rectangle(startx, endx, starty, endy)); return 0; } diff --git a/src/devices/bus/hp_dio/hp98550.cpp b/src/devices/bus/hp_dio/hp98550.cpp index 738926eae77..38f70d2d670 100644 --- a/src/devices/bus/hp_dio/hp98550.cpp +++ b/src/devices/bus/hp_dio/hp98550.cpp @@ -218,7 +218,7 @@ uint32_t dio32_98550_device::screen_update(screen_device &screen, bitmap_rgb32 & mask |= ce->plane_enabled(); for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { const int offset = y * m_fb_width +x; diff --git a/src/devices/bus/ieee488/ieee488.cpp b/src/devices/bus/ieee488/ieee488.cpp index bcbe20e0573..947aad2d1f7 100644 --- a/src/devices/bus/ieee488/ieee488.cpp +++ b/src/devices/bus/ieee488/ieee488.cpp @@ -164,7 +164,7 @@ void ieee488_device::device_stop() void ieee488_device::add_device(ieee488_slot_device *slot, device_t *target) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_bus = this; entry->m_interface->m_slot = slot; diff --git a/src/devices/bus/iq151/grafik.cpp b/src/devices/bus/iq151/grafik.cpp index 304bcf87b43..497012cf2cd 100644 --- a/src/devices/bus/iq151/grafik.cpp +++ b/src/devices/bus/iq151/grafik.cpp @@ -178,7 +178,7 @@ void iq151_grafik_device::video_update(bitmap_ind16 &bitmap, const rectangle &cl { for (int ra = 0; ra < 8; ra++) { - bitmap.pix16(y, x*8 + ra) |= BIT(m_videoram[(32*8 -1 - y)*64 + x], ra); + bitmap.pix(y, x*8 + ra) |= BIT(m_videoram[(32*8 -1 - y)*64 + x], ra); } } } diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp index d5bf2da1f8b..e0962048411 100644 --- a/src/devices/bus/iq151/minigraf.cpp +++ b/src/devices/bus/iq151/minigraf.cpp @@ -162,7 +162,7 @@ void iq151_minigraf_device::plotter_update(uint8_t control) // if pen is down draws a point if (m_pen) - m_paper->pix16(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; + m_paper->pix(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; m_control = control; } diff --git a/src/devices/bus/iq151/ms151a.cpp b/src/devices/bus/iq151/ms151a.cpp index 447c9f0d43a..651e82bfe6f 100644 --- a/src/devices/bus/iq151/ms151a.cpp +++ b/src/devices/bus/iq151/ms151a.cpp @@ -164,5 +164,5 @@ void iq151_ms151a_device::plotter_update(uint8_t offset, uint8_t data) // if pen is down draws a point if (m_pen) - m_paper->pix16(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; + m_paper->pix(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; } diff --git a/src/devices/bus/iq151/video32.cpp b/src/devices/bus/iq151/video32.cpp index fce21b963e9..2d3f75b66ed 100644 --- a/src/devices/bus/iq151/video32.cpp +++ b/src/devices/bus/iq151/video32.cpp @@ -126,7 +126,7 @@ void iq151_video32_device::video_update(bitmap_ind16 &bitmap, const rectangle &c { for (int ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (int x = ma; x < ma + 32; x++) { diff --git a/src/devices/bus/iq151/video64.cpp b/src/devices/bus/iq151/video64.cpp index a965abbd19e..487bf63ca33 100644 --- a/src/devices/bus/iq151/video64.cpp +++ b/src/devices/bus/iq151/video64.cpp @@ -140,7 +140,7 @@ void iq151_video64_device::video_update(bitmap_ind16 &bitmap, const rectangle &c { for (int ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (int x = ma; x < ma + 64; x++) { diff --git a/src/devices/bus/isa/aga.cpp b/src/devices/bus/isa/aga.cpp index 244fbc0bb66..81e6ba053fe 100644 --- a/src/devices/bus/isa/aga.cpp +++ b/src/devices/bus/isa/aga.cpp @@ -288,7 +288,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; if (y == 0) logerror("mda_text_inten_update_row\n"); @@ -345,7 +345,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; if (y == 0) logerror("mda_text_blink_update_row\n"); @@ -402,7 +402,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_inten_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -431,7 +431,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_inten_alt_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -459,7 +459,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { uint16_t const offset = ((ma + i) << 1) & 0x3fff; @@ -491,7 +491,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_blink_alt_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -526,7 +526,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_gfx_4bppl_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -551,7 +551,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_gfx_4bpph_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -584,7 +584,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); //if (y == 0) logerror("cga_gfx_2bpp_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -609,7 +609,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_1bpp_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint8_t const fg = m_cga_color_select & 0x0f; if (y == 0) logerror("cga_gfx_1bpp_update_row\n"); diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index ff30f3690ad..52a0407f065 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -469,47 +469,43 @@ isa8_cga_superimpose_device::isa8_cga_superimpose_device(const machine_config &m template<bool blink, bool si, bool comp, bool alt, int width> MC6845_UPDATE_ROW( isa8_cga_device::cga_text ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_text_8",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_text_8",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff; - uint8_t chr = videoram[ offset ]; - uint8_t attr = videoram[ offset +1 ]; - uint8_t data = m_chr_gen[ chr * width + ra ]; + uint16_t const offset = ((ma + i) << 1) & 0x3fff; + uint8_t const chr = videoram[offset]; + uint8_t const attr = videoram[offset +1]; + uint8_t data = m_chr_gen[chr * width + ra]; uint16_t fg, bg; - uint8_t xi; - if ( comp ) + if (comp) { - fg = 0x10 + ( attr & 0x0F ); - bg = alt ? 0 : ( 0x10 + ( ( attr >> 4 ) & 0x07 ) ); + fg = 0x10 + (attr & 0x0f); + bg = alt ? 0 : (0x10 + ((attr >> 4) & 0x07)); } else { fg = attr & 0x0F; - bg = alt ? 0 : ( ( attr >> 4 ) & ( blink ? 0x07 : 0x0f ) ); + bg = alt ? 0 : ((attr >> 4) & (blink ? 0x07 : 0x0f)); } - if ( ( i == cursor_x ) && ( m_framecnt & 0x08 ) ) - data = 0xFF; - else if ( blink && ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((i == cursor_x) && (m_framecnt & 0x08)) + data = 0xff; + else if (blink && (attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; - bg = ( attr >> 4 ) & 0x07; + bg = (attr >> 4) & 0x07; } - for(xi=0;xi<8;xi++) + for (int xi = 0; xi < 8; xi++) { - uint8_t pen_data, dot; - - dot = (data & (1 << (7-xi))); - pen_data = dot ? fg : bg; - if(!si || (pen_data || dot)) + uint8_t const dot = (data & (1 << (7 - xi))); + uint8_t const pen_data = dot ? fg : bg; + if (!si || (pen_data || dot)) *p = palette[pen_data]; p++; } @@ -521,28 +517,29 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_text ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bppl_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((y & 1) << 13); + uint8_t data; + + data = videoram[offset]; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; - data = videoram[ offset + 1 ]; + data = videoram[offset + 1]; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; } } @@ -580,37 +577,37 @@ static const uint8_t yc_lut[16][8] = MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bpph_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; - - if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((y & 1) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + + data = videoram[offset + 1]; + + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; } } @@ -623,28 +620,29 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bpph_update_row ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_2bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint8_t data; + + data = videoram[offset]; - *p = palette[m_palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ data & 0x03 ]]; p++; + *p++ = palette[m_palette_lut_2bpp[(data >> 6) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 4) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 2) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[ data & 0x03]]; - data = videoram[ offset+1 ]; + data = videoram[offset + 1]; - *p = palette[m_palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ data & 0x03 ]]; p++; + *p++ = palette[m_palette_lut_2bpp[(data >> 6) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 4) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 2) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[ data & 0x03]]; } } @@ -658,37 +656,38 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_2bpp_update_row ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_1bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0f; - if ( y == 0 ) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; + + data = videoram[offset + 1]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; } } @@ -961,205 +960,200 @@ void isa8_cga_device::io_write(offs_t offset, uint8_t data) // proc = cga_pgfx_4bpp; // -//static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, -// int x, int y, int offs) -//{ -// int color, values[2]; -// int i; -// -// if (cga.plantronics & 0x40) -// { -// values[0] = videoram[offs | 0x4000]; -// values[1] = videoram[offs]; -// } -// else -// { -// values[0] = videoram[offs]; -// values[1] = videoram[offs | 0x4000]; -// } -// for (i=3; i>=0; i--) -// { -// color = ((values[0] & 0x3) << 1) | -// ((values[1] & 2) >> 1) | -// ((values[1] & 1) << 3); -// bitmap.pix16(y, x+i) = Machine->pens[color]; -// values[0]>>=2; -// values[1]>>=2; -// } -//} -// -// -// +#if 0 +static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, int x, int y, int offs) +{ + int values[2]; + + if (cga.plantronics & 0x40) + { + values[0] = videoram[offs | 0x4000]; + values[1] = videoram[offs]; + } + else + { + values[0] = videoram[offs]; + values[1] = videoram[offs | 0x4000]; + } + for (int i = 3; i >= 0; i--) + { + int const color = + ((values[0] & 0x3) << 1) | + ((values[1] & 2) >> 1) | + ((values[1] & 1) << 3); + bitmap.pix(y, x + i) = Machine->pens[color]; + values[0] >>= 2; + values[1] >>= 2; + } +} +#endif + + ///*************************************************************************** // Draw graphics mode with 640x200 pixels (default) with 2 bits/pixel. // Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 // Second plane at CGA_base + 0x4000 / 0x6000 -//***************************************************************************/ -// -//static void cga_pgfx_4bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) -//{ -// int i, sx, sy, sh; -// int offs = mscrtc6845_get_start(crtc)*2; -// int lines = mscrtc6845_get_char_lines(crtc); -// int height = mscrtc6845_get_char_height(crtc); -// int columns = mscrtc6845_get_char_columns(crtc)*2; -// -// for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) -// { -// for (sh=0; sh<height; sh++, offs|=0x2000) -// { -// // char line 0 used as a12 line in graphic mode -// if (!(sh & 1)) -// { -// for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) -// { -// pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); -// } -// } -// else -// { -// for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) -// { -// pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); -// } -// } -// } -// } -//} -// -// -// -//static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, -// int x, int y, const uint16_t *palette, int offs) -//{ -// int i; -// uint8_t bmap[2], values[2]; -// uint16_t *dest; -// -// if (cga.plantronics & 0x40) -// { -// values[0] = videoram[offs]; -// values[1] = videoram[offs | 0x4000]; -// } -// else -// { -// values[0] = videoram[offs | 0x4000]; -// values[1] = videoram[offs]; -// } -// bmap[0] = bmap[1] = 0; -// for (i=3; i>=0; i--) -// { -// bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; -// bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; -// bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; -// bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; -// values[0] = values[0] << 1; -// values[1] = values[1] << 1; -// } -// -// dest = &bitmap.pix16(y, x); -// *(dest++) = palette[(bmap[0] >> 6) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 4) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 2) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 0) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 6) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 4) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 2) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 0) & 0x03]; -//} -// -// -// +//**************************************************************************** + +#if 0 +static void cga_pgfx_4bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) +{ + int offs = mscrtc6845_get_start(crtc) * 2; + int const lines = mscrtc6845_get_char_lines(crtc); + int const height = mscrtc6845_get_char_height(crtc); + int columns = mscrtc6845_get_char_columns(crtc) * 2; + + for (int sy = 0; sy < lines; sy++, offs = (offs + columns) & 0x1fff) + { + for (int sh = 0; sh < height; sh++, offs |= 0x2000) + { + // char line 0 used as a12 line in graphic mode + if (!(sh & 1)) + { + for (int i = offs, sx = 0; sx < columns; sx++, i = (i + 1) & 0x1fff) + { + pgfx_plot_unit_4bpp(bitmap, sx * 4, sy * height + sh, i); + } + } + else + { + for (int i = offs | 0x2000, sx = 0; sx < columns; sx++, i = ((i + 1) & 0x1fff) | 0x2000) + { + pgfx_plot_unit_4bpp(bitmap, sx * 4, sy * height + sh, i); + } + } + } + } +} +#endif + + +#if 0 +static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, int x, int y, const uint16_t *palette, int offs) +{ + uint8_t values[2]; + if (cga.plantronics & 0x40) + { + values[0] = videoram[offs]; + values[1] = videoram[offs | 0x4000]; + } + else + { + values[0] = videoram[offs | 0x4000]; + values[1] = videoram[offs]; + } + uint8_t bmap[2] = { 0, 0 }; + for (int i = 3; i >= 0; i--) + { + bmap[0] = (bmap[0] << 1) | BIT(values[0], 7); + bmap[0] = (bmap[0] << 1) | BIT(values[1], 7); + bmap[1] = (bmap[1] << 1) | BIT(values[0], 3); + bmap[1] = (bmap[1] << 1) | BIT(values[1], 3); + values[0] <<= 1; + values[1] <<= 1; + } + + uint16_t *dest = &bitmap.pix(y, x); + *dest++ = palette[(bmap[0] >> 6) & 0x03]; + *dest++ = palette[(bmap[0] >> 4) & 0x03]; + *dest++ = palette[(bmap[0] >> 2) & 0x03]; + *dest++ = palette[(bmap[0] >> 0) & 0x03]; + *dest++ = palette[(bmap[1] >> 6) & 0x03]; + *dest++ = palette[(bmap[1] >> 4) & 0x03]; + *dest++ = palette[(bmap[1] >> 2) & 0x03]; + *dest++ = palette[(bmap[1] >> 0) & 0x03]; +} +#endif + + ///*************************************************************************** // Draw graphics mode with 320x200 pixels (default) with 2 bits/pixel. // Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 // cga fetches 2 byte per mscrtc6845 access (not modeled here)! -//***************************************************************************/ -// -//static void cga_pgfx_2bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) -//{ -// int i, sx, sy, sh; -// int offs = mscrtc6845_get_start(crtc)*2; -// int lines = mscrtc6845_get_char_lines(crtc); -// int height = mscrtc6845_get_char_height(crtc); -// int columns = mscrtc6845_get_char_columns(crtc)*2; -// int colorset = cga.color_select & 0x3F; -// const uint16_t *palette; -// -// /* Most chipsets use bit 2 of the mode control register to -// * access a third palette. But not consistently. */ -// pc_cga_check_palette(); -// switch(CGA_CHIPSET) -// { -// /* The IBM Professional Graphics Controller behaves like -// * the PC1512, btw. */ -// case CGA_CHIPSET_PC1512: -// if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; -// break; -// -// case CGA_CHIPSET_IBM: -// case CGA_CHIPSET_PC200: -// case CGA_CHIPSET_ATI: -// case CGA_CHIPSET_PARADISE: -// if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; -// break; -// } -// -// -// /* The fact that our palette is located in cga_colortable is a vestigial -// * aspect from when we were doing that ugly trick where drawgfx() would -// * handle graphics drawing. Truthfully, we should probably be using -// * palette_set_color_rgb() here and not doing the palette lookup in the loop -// */ -// palette = &cga_colortable[256*2 + 16*2] + colorset * 4; -// -// for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) { -// -// for (sh=0; sh<height; sh++) -// { -// if (!(sh&1)) { // char line 0 used as a12 line in graphic mode -// for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) -// { -// pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); -// } -// } -// else -// { -// for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) -// { -// pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); -// } -// } -// } -// } -//} +//**************************************************************************** + +#if 0 +static void cga_pgfx_2bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) +{ + int offs = mscrtc6845_get_start(crtc) * 2; + int const lines = mscrtc6845_get_char_lines(crtc); + int const height = mscrtc6845_get_char_height(crtc); + int const columns = mscrtc6845_get_char_columns(crtc) * 2; + + /* Most chipsets use bit 2 of the mode control register to access a third palette. But not consistently. */ + int colorset = cga.color_select & 0x3f; + pc_cga_check_palette(); + switch (CGA_CHIPSET) + { + /* The IBM Professional Graphics Controller behaves like the PC1512, btw. */ + case CGA_CHIPSET_PC1512: + if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; + break; + + case CGA_CHIPSET_IBM: + case CGA_CHIPSET_PC200: + case CGA_CHIPSET_ATI: + case CGA_CHIPSET_PARADISE: + if (cga.mode_control & 4) colorset = (colorset & 0x1f) + 64; + break; + } + + /* The fact that our palette is located in cga_colortable is a vestigial + * aspect from when we were doing that ugly trick where drawgfx() would + * handle graphics drawing. Truthfully, we should probably be using + * palette_set_color_rgb() here and not doing the palette lookup in the loop + */ + uint16_t const *const palette = &cga_colortable[256*2 + 16*2] + colorset * 4; + + for (int sy = 0; sy < lines; sy++, offs = (offs + columns) & 0x1fff) + { + + for (int sh = 0; sh < height; sh++) + { + if (!(sh & 1)) // char line 0 used as a12 line in graphic mode + { + for (int i = offs, sx = 0; sx < columns; sx++, i = (i + 1) & 0x1fff) + { + pgfx_plot_unit_2bpp(bitmap, sx * 8, sy * height + sh, palette, i); + } + } + else + { + for (int i = offs | 0x2000, sx = 0; sx < columns; sx++, i= ((i + 1) & 0x1fff) | 0x2000) + { + pgfx_plot_unit_2bpp(bitmap, sx * 8, sy * height + sh, palette, i); + } + } + } + } +} +#endif MC6845_UPDATE_ROW( isa8_cga_pc1512_device::pc1512_gfx_4bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint16_t offset_base = ra << 13; - int j; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint16_t const offset_base = ra << 13; - if ( y == 0 ) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); - for ( j = 0; j < x_count; j++ ) + if (y == 0) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); + for (int j = 0; j < x_count; j++) { - uint16_t offset = offset_base | ( ( ma + j ) & 0x1FFF ); - uint16_t i = ( m_color_select & 8 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[3] | offset ] << 3 : 0; - uint16_t r = ( m_color_select & 4 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[2] | offset ] << 2 : 0; - uint16_t g = ( m_color_select & 2 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[1] | offset ] << 1 : 0; - uint16_t b = ( m_color_select & 1 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[0] | offset ] : 0; - - *p = palette[( ( i & 0x400 ) | ( r & 0x200 ) | ( g & 0x100 ) | ( b & 0x80 ) ) >> 7]; p++; - *p = palette[( ( i & 0x200 ) | ( r & 0x100 ) | ( g & 0x080 ) | ( b & 0x40 ) ) >> 6]; p++; - *p = palette[( ( i & 0x100 ) | ( r & 0x080 ) | ( g & 0x040 ) | ( b & 0x20 ) ) >> 5]; p++; - *p = palette[( ( i & 0x080 ) | ( r & 0x040 ) | ( g & 0x020 ) | ( b & 0x10 ) ) >> 4]; p++; - *p = palette[( ( i & 0x040 ) | ( r & 0x020 ) | ( g & 0x010 ) | ( b & 0x08 ) ) >> 3]; p++; - *p = palette[( ( i & 0x020 ) | ( r & 0x010 ) | ( g & 0x008 ) | ( b & 0x04 ) ) >> 2]; p++; - *p = palette[( ( i & 0x010 ) | ( r & 0x008 ) | ( g & 0x004 ) | ( b & 0x02 ) ) >> 1]; p++; - *p = palette[ ( i & 0x008 ) | ( r & 0x004 ) | ( g & 0x002 ) | ( b & 0x01 ) ]; p++; + uint16_t const offset = offset_base | ((ma + j) & 0x1fff); + uint16_t const i = (m_color_select & 8) ? videoram[isa8_cga_pc1512_device::vram_offset[3] | offset] << 3 : 0; + uint16_t const r = (m_color_select & 4) ? videoram[isa8_cga_pc1512_device::vram_offset[2] | offset] << 2 : 0; + uint16_t const g = (m_color_select & 2) ? videoram[isa8_cga_pc1512_device::vram_offset[1] | offset] << 1 : 0; + uint16_t const b = (m_color_select & 1) ? videoram[isa8_cga_pc1512_device::vram_offset[0] | offset] : 0; + + *p++ = palette[((i & 0x400) | (r & 0x200) | (g & 0x100) | (b & 0x80) ) >> 7]; + *p++ = palette[((i & 0x200) | (r & 0x100) | (g & 0x080) | (b & 0x40) ) >> 6]; + *p++ = palette[((i & 0x100) | (r & 0x080) | (g & 0x040) | (b & 0x20) ) >> 5]; + *p++ = palette[((i & 0x080) | (r & 0x040) | (g & 0x020) | (b & 0x10) ) >> 4]; + *p++ = palette[((i & 0x040) | (r & 0x020) | (g & 0x010) | (b & 0x08) ) >> 3]; + *p++ = palette[((i & 0x020) | (r & 0x010) | (g & 0x008) | (b & 0x04) ) >> 2]; + *p++ = palette[((i & 0x010) | (r & 0x008) | (g & 0x004) | (b & 0x02) ) >> 1]; + *p++ = palette[ (i & 0x008) | (r & 0x004) | (g & 0x002) | (b & 0x01) ]; } } @@ -1500,31 +1494,38 @@ void isa8_wyse700_device::device_reset() uint32_t isa8_wyse700_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - if (m_control & 0x08) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; + if (m_control & 0x08) + { + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0F; uint32_t addr = 0; - for (int y = 0; y < 800; y++) { - uint8_t *src = &m_vram[addr]; + for (int y = 0; y < 800; y++) + { + uint8_t const *src = &m_vram[addr]; - if (y & 1) { + if (y & 1) + { src += 0x10000; addr += 160; } - for (int x = 0; x < (1280 / 8); x++) { + for (int x = 0; x < (1280 / 8); x++) + { uint8_t val = src[x]; - for (int i = 0; i < 8; i++) { - bitmap.pix32(y,x*8+i) = (val & 0x80) ? palette[fg] : palette[0x00]; + for (int i = 0; i < 8; i++) + { + bitmap.pix(y, x * 8 + i) = (val & 0x80) ? palette[fg] : palette[0x00]; val <<= 1; } } } - } else { + return 0; + } + else + { return isa8_cga_device::screen_update(screen, bitmap, cliprect); } - return 0; } @@ -1837,7 +1838,7 @@ uint8_t isa8_cga_m24_device::io_read(offs_t offset) MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) { - if(m_mode2 & 1) + if (m_mode2 & 1) { m24_gfx_1bpp_m24_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); return; @@ -1847,7 +1848,7 @@ MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) return; y = m_y; - if(m_y >= bitmap.height()) + if (m_y >= bitmap.height()) return; switch (m_update_row_type) @@ -1885,37 +1886,38 @@ MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) MC6845_UPDATE_ROW( isa8_cga_m24_device::m24_gfx_1bpp_m24_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0f; - if ( y == 0 ) CGA_LOG(1,"m24_gfx_1bpp_m24_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"m24_gfx_1bpp_m24_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 3 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; + uint16_t const offset = (((ma + i) << 1 ) & 0x1fff) | ((ra & 3) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; + + data = videoram[offset + 1]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; } } diff --git a/src/devices/bus/isa/ega.cpp b/src/devices/bus/isa/ega.cpp index e3d75e4070a..45d169f3dff 100644 --- a/src/devices/bus/isa/ega.cpp +++ b/src/devices/bus/isa/ega.cpp @@ -783,7 +783,7 @@ WRITE_LINE_MEMBER( isa8_ega_device::vblank_changed ) CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_graphics ) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); LOG("%s: y = %d, x_count = %d, ma = %d, ra = %d\n", FUNCNAME, y, x_count, ma, ra ); @@ -844,12 +844,11 @@ CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_graphics ) CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_text ) { - uint16_t *p = &bitmap.pix16(y); - int i; + uint16_t *p = &bitmap.pix(y); LOG("%s: y = %d, x_count = %d, ma = %d, ra = %d\n", FUNCNAME, y, x_count, ma, ra ); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ma + i; uint8_t chr = m_plane[0][ offset ]; @@ -901,8 +900,6 @@ CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_text ) void isa8_ega_device::change_mode() { - int clock, pixels; - m_video_mode = 0; /* Check for graphics mode */ @@ -938,8 +935,8 @@ void isa8_ega_device::change_mode() } /* Check for changes to the crtc input clock and number of pixels per clock */ - clock = ( ( m_misc_output & 0x0c ) ? 16257000 : 14318181 ); - pixels = ( ( m_sequencer.data[0x01] & 0x01 ) ? 8 : 9 ); + int clock = ( ( m_misc_output & 0x0c ) ? 16257000 : 14318181 ); + int pixels = ( ( m_sequencer.data[0x01] & 0x01 ) ? 8 : 9 ); if ( m_sequencer.data[0x01] & 0x08 ) { diff --git a/src/devices/bus/isa/eis_hgb107x.cpp b/src/devices/bus/isa/eis_hgb107x.cpp index 32aeac02c3e..25b16a38fe3 100644 --- a/src/devices/bus/isa/eis_hgb107x.cpp +++ b/src/devices/bus/isa/eis_hgb107x.cpp @@ -420,10 +420,6 @@ inline int isa8_epc_mda_device::get_yres() MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; - // Get som debug data from a couple of rows now and then if ( y < (16 * 0 + 0x20) && (m_framecnt & 0xff) == 0 ) { @@ -436,7 +432,7 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { for (int i = 0; i < get_xres(); i++) { - bitmap.pix32(y, i) = rgb_t::black(); + bitmap.pix(y, i) = rgb_t::black(); } } @@ -449,14 +445,17 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) // Text modes using one of two 9x16 fonts in character rom else { + uint32_t *p = &bitmap.pix(y); + uint16_t chr_base = ra; + // Adjust row pointer if in monochrome text mode as we insert two scanlines per row of characters (see below) if (m_vmode & VM_MONO) { - p = &bitmap.pix32((y / 14) * 16 + y % 14); + p = &bitmap.pix((y / 14) * 16 + y % 14); } // Loop over each character in a row - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; uint8_t chr = m_videoram[ offset ]; @@ -555,14 +554,14 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { if (chr >= 0xb3 && chr <= 0xdf) // Handle the meta graphics characters { - bitmap.pix32(row + 1, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; - bitmap.pix32(row + 2, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; + bitmap.pix(row + 1, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; + bitmap.pix(row + 2, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; } else { // Handle underline - bitmap.pix32(row + 1, j + i * 9) =(*m_pal)[( attr & ATTR_FOREG ) == ATTR_ULINE ? fg : bg]; - bitmap.pix32(row + 2, j + i * 9) = (*m_pal)[bg]; + bitmap.pix(row + 1, j + i * 9) =(*m_pal)[( attr & ATTR_FOREG ) == ATTR_ULINE ? fg : bg]; + bitmap.pix(row + 2, j + i * 9) = (*m_pal)[bg]; } } } diff --git a/src/devices/bus/isa/ex1280.cpp b/src/devices/bus/isa/ex1280.cpp index 84c8bb8d269..2d9153616e9 100644 --- a/src/devices/bus/isa/ex1280.cpp +++ b/src/devices/bus/isa/ex1280.cpp @@ -144,15 +144,15 @@ void isa16_ex1280_device::vram_w(offs_t offset, uint16_t data, uint16_t mem_mask TMS340X0_SCANLINE_RGB32_CB_MEMBER(isa16_ex1280_device::scanline_update) { - uint16_t *src = &m_vram[params->rowaddr << 8]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_ramdac->pens(); + uint16_t const *const src = &m_vram[params->rowaddr << 8]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_ramdac->pens(); int coladdr = params->coladdr << 1; /* copy the non-blanked portions of this scanline */ for (int x = params->heblnk; x < params->hsblnk; x += 4) { - uint16_t pixels = src[coladdr++]; + uint16_t const pixels = src[coladdr++]; dest[x + 0] = pens[pixels & 0x0f]; dest[x + 1] = pens[(pixels >> 4) & 0x0f]; dest[x + 2] = pens[(pixels >> 8) & 0x0f]; diff --git a/src/devices/bus/isa/fdc.cpp b/src/devices/bus/isa/fdc.cpp index 0648a16a6e3..aab99b12ed5 100644 --- a/src/devices/bus/isa/fdc.cpp +++ b/src/devices/bus/isa/fdc.cpp @@ -45,10 +45,6 @@ isa8_fdc_device::isa8_fdc_device(const machine_config &mconfig, device_type type { } -void isa8_fdc_device::device_reset() -{ -} - WRITE_LINE_MEMBER( isa8_fdc_device::irq_w ) { m_isa->irq6_w(state ? ASSERT_LINE : CLEAR_LINE); @@ -80,7 +76,9 @@ void isa8_fdc_device::eop_w(int state) } -isa8_upd765_fdc_device::isa8_upd765_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, type, tag, owner, clock) +isa8_upd765_fdc_device::isa8_upd765_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : isa8_fdc_device(mconfig, type, tag, owner, clock) + , dor(0x00) { } @@ -94,7 +92,11 @@ void isa8_upd765_fdc_device::device_start() irq = drq = false; fdc_irq = fdc_drq = false; - dor = 0x00; +} + +void isa8_upd765_fdc_device::device_reset() +{ + dor_w(0x00); } // Bits 0-1 select one of the 4 drives, but only if the associated @@ -109,7 +111,6 @@ void isa8_upd765_fdc_device::device_start() void isa8_upd765_fdc_device::dor_w(uint8_t data) { LOG("dor = %02x\n", data); - uint8_t pdor = dor; dor = data; for(int i=0; i<4; i++) @@ -124,8 +125,7 @@ void isa8_upd765_fdc_device::dor_w(uint8_t data) check_irq(); check_drq(); - if((pdor^dor) & 4) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(dor, 2)); } uint8_t isa8_upd765_fdc_device::dor_r() diff --git a/src/devices/bus/isa/fdc.h b/src/devices/bus/isa/fdc.h index a0c872a28f0..d4321ca4210 100644 --- a/src/devices/bus/isa/fdc.h +++ b/src/devices/bus/isa/fdc.h @@ -34,9 +34,6 @@ protected: // construction/destruction isa8_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides - virtual void device_reset() override; - virtual uint8_t dack_r(int line) override; virtual void dack_w(int line, uint8_t data) override; virtual void dack_line_w(int line, int state) override; @@ -53,6 +50,7 @@ protected: // device-level overrides virtual void device_start() override; + virtual void device_reset() override; uint8_t dor_r(); void dor_w(uint8_t data); diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp index a1c3f39612e..237211047a2 100644 --- a/src/devices/bus/isa/gus.cpp +++ b/src/devices/bus/isa/gus.cpp @@ -243,29 +243,26 @@ void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param, v } } -void gf1_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gf1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int x,y; + int x; //uint32_t count; - stream_sample_t* outputl = outputs[0]; - stream_sample_t* outputr = outputs[1]; - memset( outputl, 0x00, samples * sizeof(*outputl) ); - memset( outputr, 0x00, samples * sizeof(*outputr) ); + auto &outputl = outputs[0]; + auto &outputr = outputs[1]; + + outputl.fill(0); + outputr.fill(0); for(x=0;x<32;x++) // for each voice { - stream_sample_t* left = outputl; - stream_sample_t* right = outputr; uint16_t vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]); - for(y=samples-1; y>=0; y--) + for (int sampindex = 0; sampindex < outputl.samples(); sampindex++) { uint32_t current = m_voice[x].current_addr >> 9; // TODO: implement proper panning - (*left) += ((m_voice[x].sample) * (vol/8192.0)); - (*right) += ((m_voice[x].sample) * (vol/8192.0)); - left++; - right++; + outputl.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192); + outputr.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192); if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01)) { if(m_voice[x].vol_ramp_ctrl & 0x04) @@ -403,7 +400,7 @@ void gf1_device::device_start() m_wave_ram.resize(1024*1024); memset(&m_wave_ram[0], 0, 1024*1024); - m_stream = stream_alloc_legacy(0,2,clock() / (14 * 16)); + m_stream = stream_alloc(0,2,clock() / (14 * 16)); // init timers m_timer1 = timer_alloc(ADLIB_TIMER1); diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h index 3f637bee84d..be8dbbdbe2d 100644 --- a/src/devices/bus/isa/gus.h +++ b/src/devices/bus/isa/gus.h @@ -123,7 +123,7 @@ public: // optional information overrides virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; protected: // voice-specific registers diff --git a/src/devices/bus/isa/isa_cards.cpp b/src/devices/bus/isa/isa_cards.cpp index 72681cc249e..8f1232dcd13 100644 --- a/src/devices/bus/isa/isa_cards.cpp +++ b/src/devices/bus/isa/isa_cards.cpp @@ -49,6 +49,7 @@ #include "ultra24f.h" #include "tekram_dc820.h" #include "asc88.h" +#include "omti8621.h" // sound #include "adlib.h" @@ -225,4 +226,5 @@ void pc_isa16_cards(device_slot_interface &device) device.option_add("dc320e", TEKRAM_DC320E); // actually an EISA card device.option_add("dc820", TEKRAM_DC820); // actually an EISA card device.option_add("dc820b", TEKRAM_DC820B); // actually an EISA card + device.option_add("omti8621", ISA16_OMTI8621); } diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index 602147aa060..e9f4ad8d197 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -180,11 +180,8 @@ uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma return 0; uint32_t src = (m_cursor_address & 0x000fffff) << 2; - uint32_t* dst; // destination pixel - uint8_t x,y,z; - uint32_t colour0; - uint32_t colour1; + uint32_t colour0, colour1; if(depth == 8) { colour0 = pen(m_cursor_colour0_b); @@ -197,18 +194,18 @@ uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma } // draw hardware pointer (64x64 max) - for(y=0;y<64;y++) + for(uint8_t y=0;y<64;y++) { - dst = &bitmap.pix32(m_cursor_vertical + y, m_cursor_horizontal); - for(x=0;x<64;x+=8) + uint32_t *dst = &bitmap.pix(m_cursor_vertical + y, m_cursor_horizontal); + for(uint8_t x=0;x<64;x+=8) { - uint16_t bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); + uint16_t const bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); - for(z=0;z<8;z++) + for(uint8_t z=0;z<8;z++) { if(((z + x) > (m_cursor_offset_horizontal-1)) && (y < (63 - m_cursor_offset_vertical))) { - uint8_t val = (bits >> (z*2)) & 0x03; + uint8_t const val = (bits >> (z*2)) & 0x03; switch(val) { case 0: // cursor colour 0 diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp index cf4a6aa3803..ae61e78e116 100644 --- a/src/devices/bus/isa/mda.cpp +++ b/src/devices/bus/isa/mda.cpp @@ -225,27 +225,26 @@ void isa8_mda_device::device_reset() ***************************************************************************/ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ chr_base + chr * 8 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[chr_base + chr * 8]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: bg = 2; @@ -255,36 +254,36 @@ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) bg = 2; fg = 1; break; - case 0xF0: + case 0xf0: bg = 3; fg = 0; break; - case 0xF8: + case 0xf8: bg = 3; fg = 1; break; } - if ( ( i == cursor_x && ( m_framecnt & 0x08 ) ) || ( attr & 0x07 ) == 0x01 ) + if ((i == cursor_x && (m_framecnt & 0x08)) || (attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - if ( ( chr & 0xE0 ) == 0xC0 ) + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; + if ((chr & 0xe0) == 0xc0) { - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x01) ? fg : bg]; } else { - *p = palette[bg]; p++; + *p++ = palette[bg]; } } } @@ -298,75 +297,74 @@ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) MC6845_UPDATE_ROW( isa8_mda_device::mda_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ chr_base + chr * 8 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[chr_base + chr * 8]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: - case 0xF0: + case 0xf0: bg = 2; fg = 0; break; case 0x78: - case 0xF8: + case 0xf8: bg = 2; fg = 1; break; } - if ( ( attr & 0x07 ) == 0x01 ) + if ((attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - if ( i == cursor_x ) + if (i == cursor_x) { - if ( m_framecnt & 0x08 ) + if (m_framecnt & 0x08) { - data = 0xFF; + data = 0xff; } } else { - if ( ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - if ( ( chr & 0xE0 ) == 0xC0 ) + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; + if ((chr & 0xe0) == 0xc0) { - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x01) ? fg : bg]; } else { - *p = palette[bg]; p++; + *p++ = palette[bg]; } } } @@ -631,34 +629,36 @@ void isa8_hercules_device::device_reset() MC6845_UPDATE_ROW( isa8_hercules_device::hercules_gfx_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t gfx_base = ( ( m_mode_control & 0x80 ) ? 0x8000 : 0x0000 ) | ( ( ra & 0x03 ) << 13 ); - int i; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const gfx_base = ((m_mode_control & 0x80) ? 0x8000 : 0x0000) | ((ra & 0x03) << 13); + + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint8_t data = m_videoram[ gfx_base + ( ( ma + i ) << 1 ) ]; - - *p = palette[( data & 0x80 ) ? 2 : 0]; p++; - *p = palette[( data & 0x40 ) ? 2 : 0]; p++; - *p = palette[( data & 0x20 ) ? 2 : 0]; p++; - *p = palette[( data & 0x10 ) ? 2 : 0]; p++; - *p = palette[( data & 0x08 ) ? 2 : 0]; p++; - *p = palette[( data & 0x04 ) ? 2 : 0]; p++; - *p = palette[( data & 0x02 ) ? 2 : 0]; p++; - *p = palette[( data & 0x01 ) ? 2 : 0]; p++; - - data = m_videoram[ gfx_base + ( ( ma + i ) << 1 ) + 1 ]; - - *p = palette[( data & 0x80 ) ? 2 : 0]; p++; - *p = palette[( data & 0x40 ) ? 2 : 0]; p++; - *p = palette[( data & 0x20 ) ? 2 : 0]; p++; - *p = palette[( data & 0x10 ) ? 2 : 0]; p++; - *p = palette[( data & 0x08 ) ? 2 : 0]; p++; - *p = palette[( data & 0x04 ) ? 2 : 0]; p++; - *p = palette[( data & 0x02 ) ? 2 : 0]; p++; - *p = palette[( data & 0x01 ) ? 2 : 0]; p++; + uint8_t data; + + data = m_videoram[gfx_base + ((ma + i) << 1)]; + + *p++ = palette[(data & 0x80) ? 2 : 0]; + *p++ = palette[(data & 0x40) ? 2 : 0]; + *p++ = palette[(data & 0x20) ? 2 : 0]; + *p++ = palette[(data & 0x10) ? 2 : 0]; + *p++ = palette[(data & 0x08) ? 2 : 0]; + *p++ = palette[(data & 0x04) ? 2 : 0]; + *p++ = palette[(data & 0x02) ? 2 : 0]; + *p++ = palette[(data & 0x01) ? 2 : 0]; + + data = m_videoram[gfx_base + ((ma + i) << 1) + 1]; + + *p++ = palette[(data & 0x80) ? 2 : 0]; + *p++ = palette[(data & 0x40) ? 2 : 0]; + *p++ = palette[(data & 0x20) ? 2 : 0]; + *p++ = palette[(data & 0x10) ? 2 : 0]; + *p++ = palette[(data & 0x08) ? 2 : 0]; + *p++ = palette[(data & 0x04) ? 2 : 0]; + *p++ = palette[(data & 0x02) ? 2 : 0]; + *p++ = palette[(data & 0x01) ? 2 : 0]; } } @@ -816,27 +816,26 @@ void isa8_ec1840_0002_device::device_reset() MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ (chr_base + chr * 16) << 1 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[(chr_base + chr * 16) << 1]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: bg = 2; @@ -846,29 +845,29 @@ MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) bg = 2; fg = 1; break; - case 0xF0: + case 0xf0: bg = 3; fg = 0; break; - case 0xF8: + case 0xf8: bg = 3; fg = 1; break; } - if ( ( i == cursor_x && ( m_framecnt & 0x08 ) ) || ( attr & 0x07 ) == 0x01 ) + if ((i == cursor_x && (m_framecnt & 0x08)) || (attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; } } @@ -880,68 +879,67 @@ MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ (chr_base + chr * 16) << 1 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[(chr_base + chr * 16) << 1]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: - case 0xF0: + case 0xf0: bg = 2; fg = 0; break; case 0x78: - case 0xF8: + case 0xf8: bg = 2; fg = 1; break; } - if ( ( attr & 0x07 ) == 0x01 ) + if ((attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - if ( i == cursor_x ) + if (i == cursor_x) { - if ( m_framecnt & 0x08 ) + if (m_framecnt & 0x08) { - data = 0xFF; + data = 0xff; } } else { - if ( ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; } } diff --git a/src/devices/bus/isa/num9rev.cpp b/src/devices/bus/isa/num9rev.cpp index 07a35ee073c..632eb8b544b 100644 --- a/src/devices/bus/isa/num9rev.cpp +++ b/src/devices/bus/isa/num9rev.cpp @@ -36,7 +36,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) color.set_r(pal->entry_color(m_ram[addr] | ((overlay & 0xf) << 8)).r()); color.set_g(pal->entry_color(m_ram[addr + 0x40000] | ((overlay & 0xf0) << 4)).g()); color.set_b(pal->entry_color(m_ram[addr + 0x80000] | (overlay & 0xf00)).b()); - bitmap.pix32(y, x + i) = color; + bitmap.pix(y, x + i) = color; } } else @@ -44,7 +44,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) if(((address << 3) + 16) > (1024*1024)) return; for(int i = 0; i < 16; i++) - bitmap.pix32(y, x + i) = pal->entry_color(m_ram[(address << 4) + i]); + bitmap.pix(y, x + i) = pal->entry_color(m_ram[(address << 4) + i]); } } diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp index 4c6225baa9f..e9c80e126d3 100644 --- a/src/devices/bus/isa/omti8621.cpp +++ b/src/devices/bus/isa/omti8621.cpp @@ -253,8 +253,15 @@ void omti8621_device::device_add_mconfig(machine_config &config) m_fdc->intrq_wr_callback().set(FUNC(omti8621_device::fdc_irq_w)); m_fdc->drq_wr_callback().set(FUNC(omti8621_device::fdc_drq_w)); FLOPPY_CONNECTOR(config, m_floppy[0], pc_hd_floppies, "525hd", omti8621_device::floppy_formats); -// Apollo workstations never have more then 1 floppy drive -// FLOPPY_CONNECTOR(config, m_floppy[1], pc_hd_floppies, nullptr, omti8621_device::floppy_formats); + FLOPPY_CONNECTOR(config, m_floppy[1], pc_hd_floppies, nullptr, omti8621_device::floppy_formats); +} + +void omti8621_apollo_device::device_add_mconfig(machine_config &config) +{ + omti8621_device::device_add_mconfig(config); + + // Apollo workstations never have more then 1 floppy drive + config.device_remove(OMTI_FDC_TAG":1"); } const tiny_rom_entry *omti8621_device::device_rom_region() const @@ -1326,8 +1333,7 @@ void omti8621_device::fd_moten_w(uint8_t data) m_moten = data; - if (!BIT(data, 2)) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(data, 2)); for (int i = 0; i < 2; i++) { @@ -1342,8 +1348,11 @@ void omti8621_device::fd_moten_w(uint8_t data) void omti8621_device::fd_rate_w(uint8_t data) { - // Bit 1 = FD_MINI (TODO) - // Bit 0 = FD_RATE (TODO) + // Bit 1 = FD_MINI (connects to pin 3 of FDC9239) + // Bit 0 = FD_RATE (inverted output connects to pin 4 of 74F163) + u32 fdc_clk = (48_MHz_XTAL / (BIT(data, 0) ? 5 : 3) / (BIT(data, 1) ? 4 : 2)).value(); + m_fdc->set_unscaled_clock(fdc_clk); + m_fdc->set_rate(fdc_clk / 16); } void omti8621_device::fd_extra_w(uint8_t data) diff --git a/src/devices/bus/isa/omti8621.h b/src/devices/bus/isa/omti8621.h index d637eb57611..0308b61eee6 100644 --- a/src/devices/bus/isa/omti8621.h +++ b/src/devices/bus/isa/omti8621.h @@ -163,7 +163,9 @@ public: // get sector diskaddr of logical unit lun into data_buffer uint32_t get_sector(int32_t diskaddr, uint8_t *data_buffer, uint32_t length, uint8_t lun); + protected: + virtual void device_add_mconfig(machine_config &config) override; virtual const tiny_rom_entry *device_rom_region() const override; }; diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp index 1366bc92dbc..f204333f9f2 100644 --- a/src/devices/bus/isa/pgc.cpp +++ b/src/devices/bus/isa/pgc.cpp @@ -401,14 +401,11 @@ uint8_t isa8_pgc_device::init_r() uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *p; - uint8_t *v; - for (int y = 0; y < PGC_DISP_VERT; y++) { // XXX address translation happens in hardware - v = &m_vram[y * 1024]; - p = &bitmap.pix16(y + PGC_VERT_START, PGC_HORZ_START); + uint8_t const *v = &m_vram[y * 1024]; + uint16_t *p = &bitmap.pix(y + PGC_VERT_START, PGC_HORZ_START); for (int x = 0; x < PGC_DISP_HORZ; x++) { diff --git a/src/devices/bus/isa/trident.cpp b/src/devices/bus/isa/trident.cpp index 0d64df5ba27..5fc2d2d6d19 100644 --- a/src/devices/bus/isa/trident.cpp +++ b/src/devices/bus/isa/trident.cpp @@ -212,29 +212,22 @@ void trident_vga_device::device_reset() uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t cur_mode; - svga_device::screen_update(screen,bitmap,cliprect); - cur_mode = pc_vga_choosevideomode(); + uint8_t const cur_mode = pc_vga_choosevideomode(); // draw hardware graphics cursor if(tri.cursor_ctrl & 0x80) // if cursor is enabled { - uint32_t src; - uint32_t* dst; - uint8_t val; - int x,y; - uint16_t cx = tri.cursor_x & 0x0fff; - uint16_t cy = tri.cursor_y & 0x0fff; - uint32_t bg_col; - uint32_t fg_col; - uint8_t cursor_size = (tri.cursor_ctrl & 0x01) ? 64 : 32; + uint16_t const cx = tri.cursor_x & 0x0fff; + uint16_t const cy = tri.cursor_y & 0x0fff; + uint8_t const cursor_size = (tri.cursor_ctrl & 0x01) ? 64 : 32; if(cur_mode == SCREEN_OFF || cur_mode == TEXT_MODE || cur_mode == MONO_MODE || cur_mode == CGA_MODE || cur_mode == EGA_MODE) return 0; // cursor only works in VGA or SVGA modes - src = tri.cursor_loc * 1024; // start address is in units of 1024 bytes + uint32_t src = tri.cursor_loc * 1024; // start address is in units of 1024 bytes + uint32_t bg_col, fg_col; if(cur_mode == RGB16_MODE) { bg_col = tri.cursor_bg; @@ -246,11 +239,11 @@ uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 & fg_col = pen(tri.cursor_fg & 0xff); } - for(y=0;y<cursor_size;y++) + for(int y=0;y<cursor_size;y++) { uint8_t bitcount = 31; - dst = &bitmap.pix32(cy + y, cx); - for(x=0;x<cursor_size;x++) + uint32_t *const dst = &bitmap.pix(cy + y, cx); + for(int x=0;x<cursor_size;x++) { uint32_t bitb = (vga.memory[(src+3) % vga.svga_intf.vram_size] | ((vga.memory[(src+2) % vga.svga_intf.vram_size]) << 8) @@ -260,7 +253,7 @@ uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 & | ((vga.memory[(src+6) % vga.svga_intf.vram_size]) << 8) | ((vga.memory[(src+5) % vga.svga_intf.vram_size]) << 16) | ((vga.memory[(src+4) % vga.svga_intf.vram_size]) << 24)); - val = (BIT(bita << 1,bitcount+1) << 1 | BIT(bitb,bitcount)); + uint8_t const val = (BIT(bita << 1,bitcount+1) << 1 | BIT(bitb,bitcount)); if(tri.cursor_ctrl & 0x40) { // X11 mode switch(val) diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp index 833d1d3820f..6d9dd93b4ed 100644 --- a/src/devices/bus/macpds/pds_tpdfpd.cpp +++ b/src/devices/bus/macpds/pds_tpdfpd.cpp @@ -154,27 +154,23 @@ void macpds_sedisplay_device::device_timer(emu_timer &timer, device_timer_id tid uint32_t macpds_sedisplay_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = m_vram.get(); - vram = m_vram.get(); - - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * (1024/8)) + (x^1)]; - - *scanline++ = m_palette[((pixels>>7)&0x1)^1]; - *scanline++ = m_palette[((pixels>>6)&0x1)^1]; - *scanline++ = m_palette[((pixels>>5)&0x1)^1]; - *scanline++ = m_palette[((pixels>>4)&0x1)^1]; - *scanline++ = m_palette[((pixels>>3)&0x1)^1]; - *scanline++ = m_palette[((pixels>>2)&0x1)^1]; - *scanline++ = m_palette[((pixels>>1)&0x1)^1]; - *scanline++ = m_palette[(pixels&1)^1]; + uint8_t const pixels = vram[(y * (1024/8)) + (x^1)]; + + *scanline++ = m_palette[BIT(~pixels, 7)]; + *scanline++ = m_palette[BIT(~pixels, 6)]; + *scanline++ = m_palette[BIT(~pixels, 5)]; + *scanline++ = m_palette[BIT(~pixels, 4)]; + *scanline++ = m_palette[BIT(~pixels, 3)]; + *scanline++ = m_palette[BIT(~pixels, 2)]; + *scanline++ = m_palette[BIT(~pixels, 1)]; + *scanline++ = m_palette[BIT(~pixels, 0)]; } } diff --git a/src/devices/bus/mtx/sdx.cpp b/src/devices/bus/mtx/sdx.cpp index e413e997f5b..09e7199ac53 100644 --- a/src/devices/bus/mtx/sdx.cpp +++ b/src/devices/bus/mtx/sdx.cpp @@ -417,7 +417,7 @@ MC6845_UPDATE_ROW(mtx_sdxcpm_device::crtc_update_row) int color = BIT(data, 7) ? fg : bg; - bitmap.pix32(y, x) = pen[de ? color : 0]; + bitmap.pix(y, x) = pen[de ? color : 0]; data <<= 1; } diff --git a/src/devices/bus/nasbus/avc.cpp b/src/devices/bus/nasbus/avc.cpp index f7bc8e95596..f4590b2ac3f 100644 --- a/src/devices/bus/nasbus/avc.cpp +++ b/src/devices/bus/nasbus/avc.cpp @@ -120,7 +120,7 @@ MC6845_UPDATE_ROW( nascom_avc_device::crtc_update_row ) } // plot the pixel - bitmap.pix32(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); + bitmap.pix(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); } } diff --git a/src/devices/bus/neogeo/prot_fatfury2.cpp b/src/devices/bus/neogeo/prot_fatfury2.cpp index c8e7151e6e8..b88d7b43ec1 100644 --- a/src/devices/bus/neogeo/prot_fatfury2.cpp +++ b/src/devices/bus/neogeo/prot_fatfury2.cpp @@ -41,7 +41,12 @@ uint16_t fatfury2_prot_device::protection_r(offs_t offset) m_pro_ct0->h_w(BIT(offset, 2)); u8 gad = m_pro_ct0->gad_r(); u8 gbd = m_pro_ct0->gbd_r(); - return (BIT(gbd, 0, 2) << 6) | (BIT(gbd, 2, 2) << 4) | (BIT(gad, 0, 2) << 6) | (BIT(gad, 2, 2) << 4); + /* + Data pin from PRO-CT0 + D0 D1 D2 D3 D4 D5 D6 D7 + GAD2 GAD3 GAD0 GAD1 GBD2 GBD3 GBD0 GBD1 + */ + return (BIT(gbd, 0, 2) << 6) | (BIT(gbd, 2, 2) << 4) | (BIT(gad, 0, 2) << 2) | (BIT(gad, 2, 2) << 0); } @@ -55,8 +60,13 @@ void fatfury2_prot_device::protection_w(offs_t offset, uint16_t data) m_pro_ct0->h_w(BIT(offset, 2)); // A3 // C16-31 = A4-A19, C0-C15 = D0-D15 - m_pro_ct0->c_w((u32(bitswap<16>(BIT(offset, 3, 16), 15, 13, 11, 9, 14, 12, 10, 8, 7, 5, 3, 1, 6, 4, 2, 0)) << 16) | - bitswap<16>(data, 15, 13, 11, 9, 14, 12, 10, 8, 7, 5, 3, 1, 6, 4, 2, 0)); + /* + Address/Data pin mapping into PRO-CT0 + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18 C19 C20 C21 C22 C23 C24 C25 C26 C27 C28 C29 C30 C31 LOAD EVEN H + D0 D4 D1 D5 D2 D6 D3 D7 D8 D12 D9 D13 D10 D14 D11 D15 A4 A8 A5 A9 A6 A10 A7 A11 A12 A16 A13 A17 A14 A18 A15 A19 A1 A2 A3 + */ + m_pro_ct0->c_w((u32(bitswap<16>(BIT(offset, 3, 16), 15, 11, 14, 10, 13, 9, 12, 8, 7, 3, 6, 2, 5, 1, 4, 0)) << 16) | + u32(bitswap<16>(data, 15, 11, 14, 10, 13, 9, 12, 8, 7, 3, 6, 2, 5, 1, 4, 0))); // release /PORTOEL m_pro_ct0->clk_w(false); diff --git a/src/devices/bus/nscsi/hd.cpp b/src/devices/bus/nscsi/hd.cpp index 6c6543b409c..f4c74962d20 100644 --- a/src/devices/bus/nscsi/hd.cpp +++ b/src/devices/bus/nscsi/hd.cpp @@ -119,8 +119,15 @@ void nscsi_harddisk_device::scsi_command() LOG("command READ start=%08x blocks=%04x\n", lba, blocks); - scsi_data_in(2, blocks*bytes_per_sector); - scsi_status_complete(SS_GOOD); + if(hard_disk_read(harddisk, lba, block)) { + scsi_data_in(2, blocks*bytes_per_sector); + scsi_status_complete(SS_GOOD); + } + else + { + scsi_status_complete(SS_CHECK_CONDITION); + sense(false, SK_ILLEGAL_REQUEST, SK_ASC_INVALID_FIELD_IN_CDB); + } break; case SC_WRITE_6: @@ -468,8 +475,15 @@ void nscsi_harddisk_device::scsi_command() LOG("command READ EXTENDED start=%08x blocks=%04x\n",lba, blocks); - scsi_data_in(2, blocks*bytes_per_sector); - scsi_status_complete(SS_GOOD); + if(hard_disk_read(harddisk, lba, block)) { + scsi_data_in(2, blocks*bytes_per_sector); + scsi_status_complete(SS_GOOD); + } + else + { + scsi_status_complete(SS_CHECK_CONDITION); + sense(false, SK_ILLEGAL_REQUEST, SK_ASC_INVALID_FIELD_IN_CDB); + } break; case SC_WRITE_10: diff --git a/src/devices/bus/nubus/laserview.cpp b/src/devices/bus/nubus/laserview.cpp index 2c58b6e8dc3..7e802b58988 100644 --- a/src/devices/bus/nubus/laserview.cpp +++ b/src/devices/bus/nubus/laserview.cpp @@ -117,30 +117,26 @@ void nubus_laserview_device::device_reset() uint32_t nubus_laserview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - if (!m_vbl_disable) { raise_slot_irq(); } - for (y = 0; y < 600; y++) + for (int y = 0; y < 600; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 832/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 832/8; x++) { - pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index 9105414f3e0..b9b831c6de2 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -12,6 +12,9 @@ #include "nubus_48gc.h" #include "screen.h" +#include <algorithm> + + #define VRAM_SIZE (0x200000) // 2 megs, maxed out #define GC48_SCREEN_NAME "48gc_screen" @@ -152,10 +155,7 @@ void jmfb_device::device_timer(emu_timer &timer, device_timer_id tid, int param, uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline, *base; - int x, y; - uint8_t *vram8 = &m_vram[0]; - uint8_t pixels; + uint8_t const *const vram8 = &m_vram[0xa00]; // first time? kick off the VBL timer if (!m_screen) @@ -164,37 +164,35 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, m_timer->adjust(m_screen->time_until_pos(479, 0), 0); } - vram8 += 0xa00; - switch (m_mode) { case 0: // 1bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < m_xres/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/8; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < m_xres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/4; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>6)&0x3]; *scanline++ = m_palette[(pixels>>4)&0x3]; @@ -205,13 +203,12 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, break; case 2: // 4 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < m_xres/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/2; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)&0xf]; *scanline++ = m_palette[pixels&0xf]; @@ -220,27 +217,22 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, break; case 3: // 8 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < m_xres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } break; case 4: // 24 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - base = (uint32_t *)&m_vram[y * m_stride]; - for (x = 0; x < m_xres; x++) - { - *scanline++ = *base++; - } + uint32_t const *base = (uint32_t *)&m_vram[y * m_stride]; + std::copy_n(base, m_xres, &bitmap.pix(y)); } break; } diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp index db964ec2055..db1fd821a11 100644 --- a/src/devices/bus/nubus/nubus_cb264.cpp +++ b/src/devices/bus/nubus/nubus_cb264.cpp @@ -17,6 +17,9 @@ #include "nubus_cb264.h" #include "screen.h" +#include <algorithm> + + #define CB264_SCREEN_NAME "cb264_screen" #define CB264_ROM_REGION "cb264_rom" @@ -122,10 +125,6 @@ void nubus_cb264_device::device_reset() uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline, *base; - int x, y; - uint8_t pixels; - if (!m_cb264_vbl_disable) { raise_slot_irq(); @@ -134,12 +133,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & switch (m_cb264_mode) { case 0: // 1 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0x80]; *scanline++ = m_palette[(pixels<<1)&0x80]; @@ -154,12 +153,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 1: // 2 bpp (3f/7f/bf/ff) - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xc0]; *scanline++ = m_palette[(pixels<<2)&0xc0]; @@ -170,13 +169,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xf0]; *scanline++ = m_palette[(pixels<<4)&0xf0]; @@ -185,13 +183,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -200,16 +197,11 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & case 4: // 24 bpp case 7: // ??? { - uint32_t *vram32 = (uint32_t *)&m_vram[0]; + uint32_t const *const vram32 = (uint32_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp index 851537685d2..e913c0cb0cb 100644 --- a/src/devices/bus/nubus/nubus_m2hires.cpp +++ b/src/devices/bus/nubus/nubus_m2hires.cpp @@ -137,41 +137,37 @@ void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x20]; + uint8_t const *const vram = &m_vram[0x20]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -182,13 +178,13 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640/2; x++) + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels&0xf0)>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -197,13 +193,13 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640; x++) + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp index f557d7631b0..60728d7dd15 100644 --- a/src/devices/bus/nubus/nubus_m2video.cpp +++ b/src/devices/bus/nubus/nubus_m2video.cpp @@ -139,21 +139,17 @@ void nubus_m2video_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x20]; + uint8_t const *const vram = &m_vram[0x20]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -168,12 +164,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -184,13 +180,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -199,13 +194,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp index f6d152be059..89518f0d223 100644 --- a/src/devices/bus/nubus/nubus_radiustpd.cpp +++ b/src/devices/bus/nubus/nubus_radiustpd.cpp @@ -139,27 +139,23 @@ void nubus_radiustpd_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_radiustpd_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = &m_vram[0x200]; - vram = &m_vram[0x200]; - - for (y = 0; y < 880; y++) + for (int y = 0; y < 880; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp index b7a29b6f537..6ca1f9f4489 100644 --- a/src/devices/bus/nubus/nubus_spec8.cpp +++ b/src/devices/bus/nubus/nubus_spec8.cpp @@ -144,21 +144,17 @@ void nubus_spec8s3_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x400]; + uint8_t const *const vram = &m_vram[0x400]; switch (m_mode) { case 0: // 1 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/8; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0x80]; *scanline++ = m_palette[(pixels<<1)&0x80]; @@ -173,12 +169,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/4; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xc0]; *scanline++ = m_palette[(pixels<<2)&0xc0]; @@ -189,13 +185,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1024/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xf0]; *scanline++ = m_palette[(pixels<<4)&0xf0]; @@ -204,13 +199,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1024; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp index 891defaa336..c00938c6102 100644 --- a/src/devices/bus/nubus/nubus_specpdq.cpp +++ b/src/devices/bus/nubus/nubus_specpdq.cpp @@ -157,22 +157,18 @@ void nubus_specpdq_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - // first time? kick off the VBL timer - vram = &m_vram[0x9000]; + uint8_t const *const vram = &m_vram[0x9000]; switch (m_mode) { case 0: // 1 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0x80)]; *scanline++ = m_palette_val[((pixels<<1)&0x80)]; @@ -187,12 +183,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/4; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0xc0)]; *scanline++ = m_palette_val[((pixels<<2)&0xc0)]; @@ -203,13 +199,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0xf0)]; *scanline++ = m_palette_val[((pixels<<4)&0xf0)]; @@ -218,13 +213,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x++) { - pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_vikbw.cpp b/src/devices/bus/nubus/nubus_vikbw.cpp index 1c25795cd45..18c94f9ba5b 100644 --- a/src/devices/bus/nubus/nubus_vikbw.cpp +++ b/src/devices/bus/nubus/nubus_vikbw.cpp @@ -117,30 +117,26 @@ void nubus_vikbw_device::device_reset() uint32_t nubus_vikbw_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - if (!m_vbl_disable) { raise_slot_irq(); } - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/8; x++) { - pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp index 2f56488bf48..9894e0d7906 100644 --- a/src/devices/bus/nubus/nubus_wsportrait.cpp +++ b/src/devices/bus/nubus/nubus_wsportrait.cpp @@ -137,42 +137,38 @@ void nubus_wsportrait_device::device_timer(emu_timer &timer, device_timer_id tid uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - // first time? kick off the VBL timer - vram = &m_vram[0x80]; + uint8_t const *const vram = &m_vram[0x80]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -183,13 +179,12 @@ uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rg break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels&0xf0)>>4)]; *scanline++ = m_palette[(pixels&0xf)]; diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp index 2fe4687fc44..dde2348abc6 100644 --- a/src/devices/bus/nubus/pds30_30hr.cpp +++ b/src/devices/bus/nubus/pds30_30hr.cpp @@ -139,41 +139,37 @@ void nubus_xceed30hr_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[1024]; + uint8_t const *const vram = &m_vram[1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -184,13 +180,12 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -199,13 +194,12 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp index aa0ca1df648..388aa5f54d5 100644 --- a/src/devices/bus/nubus/pds30_cb264.cpp +++ b/src/devices/bus/nubus/pds30_cb264.cpp @@ -10,6 +10,9 @@ #include "pds30_cb264.h" #include "screen.h" +#include <algorithm> + + #define CB264SE30_SCREEN_NAME "cb264_screen" #define CB264SE30_ROM_REGION "cb264_rom" @@ -133,21 +136,17 @@ void nubus_cb264se30_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[8*1024]; + uint8_t const *const vram = &m_vram[8*1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -162,12 +161,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -178,13 +177,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -193,13 +191,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -207,17 +204,11 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 24 bpp { - uint32_t *vram32 = (uint32_t *)&m_vram[0]; - uint32_t *base; + uint32_t const *const vram32 = (uint32_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp index 20969a5a6b7..87992723319 100644 --- a/src/devices/bus/nubus/pds30_mc30.cpp +++ b/src/devices/bus/nubus/pds30_mc30.cpp @@ -13,6 +13,9 @@ #include "pds30_mc30.h" #include "screen.h" +#include <algorithm> + + #define XCEEDMC30_SCREEN_NAME "x30hr_screen" #define XCEEDMC30_ROM_REGION "x30hr_rom" @@ -135,41 +138,37 @@ void nubus_xceedmc30_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[4*1024]; + uint8_t const *const vram = &m_vram[4*1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -180,13 +179,13 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640/2; x++) + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -195,13 +194,13 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640; x++) + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -209,17 +208,11 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 24 bpp { - uint32_t *vram32 = (uint32_t *)vram; - uint32_t *base; + uint32_t const *const vram32 = (uint32_t *)vram; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp index b251a57c33c..83fd8512704 100644 --- a/src/devices/bus/nubus/pds30_procolor816.cpp +++ b/src/devices/bus/nubus/pds30_procolor816.cpp @@ -139,21 +139,17 @@ void nubus_procolor816_device::device_timer(emu_timer &timer, device_timer_id ti uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[4]; + uint8_t const *const vram = &m_vram[4]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -168,12 +164,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -184,13 +180,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -199,13 +194,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -213,16 +207,15 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r case 4: // 15 bpp { - uint16_t *vram16 = (uint16_t *)&m_vram[0]; - uint16_t pixels; + uint16_t const *const vram16 = (uint16_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram16[(y * 640) + (x^1)]; - *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); + uint16_t const pixels = vram16[(y * 640) + BYTE_XOR_BE(x)]; + *scanline++ = rgb_t(pal5bit((pixels>>10) & 0x1f), pal5bit((pixels>>5) & 0x1f), pal5bit(pixels & 0x1f)); } } } diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp index c509b908064..e04e4b2e297 100644 --- a/src/devices/bus/nubus/pds30_sigmalview.cpp +++ b/src/devices/bus/nubus/pds30_sigmalview.cpp @@ -132,18 +132,14 @@ void nubus_lview_device::device_timer(emu_timer &timer, device_timer_id tid, int uint32_t nubus_lview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = &m_vram[0x20]; - vram = &m_vram[0x20]; - - for (y = 0; y < 600; y++) + for (int y = 0; y < 600; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 832/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 832/8; x++) { - pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; diff --git a/src/devices/bus/odyssey2/4in1.cpp b/src/devices/bus/odyssey2/4in1.cpp index f0eefac089b..dfadbf2c1ab 100644 --- a/src/devices/bus/odyssey2/4in1.cpp +++ b/src/devices/bus/odyssey2/4in1.cpp @@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_4IN1, o2_4in1_device, "o2_4in1", "Odyssey 2 Videopac 4 // o2_4in1_device - constructor //------------------------------------------------- -o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_4IN1, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/4in1.h b/src/devices/bus/odyssey2/4in1.h index 09cfa626b38..2840361bfe0 100644 --- a/src/devices/bus/odyssey2/4in1.h +++ b/src/devices/bus/odyssey2/4in1.h @@ -21,7 +21,7 @@ class o2_4in1_device : public device_t, { public: // construction/destruction - o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/chess.cpp b/src/devices/bus/odyssey2/chess.cpp index f954ca93340..6ff1ff76dd2 100644 --- a/src/devices/bus/odyssey2/chess.cpp +++ b/src/devices/bus/odyssey2/chess.cpp @@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_CHESS, o2_chess_device, "o2_chess", "Odyssey 2 Videopa // o2_chess_device - constructor //------------------------------------------------- -o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_CHESS, tag, owner, clock), device_o2_cart_interface(mconfig, *this), m_maincpu(*this, "maincpu"), diff --git a/src/devices/bus/odyssey2/chess.h b/src/devices/bus/odyssey2/chess.h index d4e861e2a64..0b37c50684c 100644 --- a/src/devices/bus/odyssey2/chess.h +++ b/src/devices/bus/odyssey2/chess.h @@ -24,7 +24,7 @@ class o2_chess_device : public device_t, { public: // construction/destruction - o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/homecomp.cpp b/src/devices/bus/odyssey2/homecomp.cpp index 352d0f2a452..23c6f6c31f7 100644 --- a/src/devices/bus/odyssey2/homecomp.cpp +++ b/src/devices/bus/odyssey2/homecomp.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_HOMECOMP, o2_homecomp_device, "o2_homecomp", "Odyssey // o2_homecomp_device - constructor //------------------------------------------------- -o2_homecomp_device::o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_homecomp_device::o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_HOMECOMP, tag, owner, clock), device_o2_cart_interface(mconfig, *this), m_maincpu(*this, "maincpu"), diff --git a/src/devices/bus/odyssey2/homecomp.h b/src/devices/bus/odyssey2/homecomp.h index f530cd36375..6ecc67f1184 100644 --- a/src/devices/bus/odyssey2/homecomp.h +++ b/src/devices/bus/odyssey2/homecomp.h @@ -25,7 +25,7 @@ class o2_homecomp_device : public device_t, { public: // construction/destruction - o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/ktaa.cpp b/src/devices/bus/odyssey2/ktaa.cpp index 24d62c81796..4f1fba25153 100644 --- a/src/devices/bus/odyssey2/ktaa.cpp +++ b/src/devices/bus/odyssey2/ktaa.cpp @@ -18,7 +18,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_KTAA, o2_ktaa_device, "o2_ktaa", "Odyssey 2 Homebrew K // o2_ktaa_device - constructor //------------------------------------------------- -o2_ktaa_device::o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_ktaa_device::o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_KTAA, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/ktaa.h b/src/devices/bus/odyssey2/ktaa.h index e1ac477e445..53ce2296941 100644 --- a/src/devices/bus/odyssey2/ktaa.h +++ b/src/devices/bus/odyssey2/ktaa.h @@ -21,7 +21,7 @@ class o2_ktaa_device : public device_t, { public: // construction/destruction - o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/rally.cpp b/src/devices/bus/odyssey2/rally.cpp index 7bdec3502b3..42dcdc0b26f 100644 --- a/src/devices/bus/odyssey2/rally.cpp +++ b/src/devices/bus/odyssey2/rally.cpp @@ -26,7 +26,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_RALLY, o2_rally_device, "o2_rally", "Odyssey 2 Videopa // o2_rally_device - constructor //------------------------------------------------- -o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_RALLY, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/rally.h b/src/devices/bus/odyssey2/rally.h index 81de2673ae6..8d359362dce 100644 --- a/src/devices/bus/odyssey2/rally.h +++ b/src/devices/bus/odyssey2/rally.h @@ -21,7 +21,7 @@ class o2_rally_device : public device_t, { public: // construction/destruction - o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/rom.cpp b/src/devices/bus/odyssey2/rom.cpp index f54398914e3..12f8fa9b128 100644 --- a/src/devices/bus/odyssey2/rom.cpp +++ b/src/devices/bus/odyssey2/rom.cpp @@ -16,7 +16,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_STD, o2_rom_device, "o2_rom", "Odyssey 2 Standard Cart // o2_rom_device - constructor //------------------------------------------------- -o2_rom_device::o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_rom_device::o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_STD, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/rom.h b/src/devices/bus/odyssey2/rom.h index 74e742a38d8..204d96030ce 100644 --- a/src/devices/bus/odyssey2/rom.h +++ b/src/devices/bus/odyssey2/rom.h @@ -21,7 +21,7 @@ class o2_rom_device : public device_t, { public: // construction/destruction - o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index 2e020342366..5f0f30e2f35 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -50,7 +50,7 @@ device_o2_cart_interface::~device_o2_cart_interface() //------------------------------------------------- // o2_cart_slot_device - constructor //------------------------------------------------- -o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_CART_SLOT, tag, owner, clock) , device_image_interface(mconfig, *this) , device_single_card_slot_interface<device_o2_cart_interface>(mconfig, *this) @@ -148,7 +148,7 @@ image_init_result o2_cart_slot_device::call_load() } else { - uint32_t size = length(); + u32 size = length(); fread(m_cart->m_rom, size); m_type = (size == 0x4000) ? O2_RALLY : O2_STD; @@ -174,7 +174,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft if (hook.image_file()) { const char *slot_string; - uint32_t size = hook.image_file()->size(); + u32 size = hook.image_file()->size(); int type = (size == 0x4000) ? O2_RALLY : O2_STD; slot_string = o2_get_slot(type); @@ -190,7 +190,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft read_rom** -------------------------------------------------*/ -uint8_t o2_cart_slot_device::read_rom04(offs_t offset) +u8 o2_cart_slot_device::read_rom04(offs_t offset) { if (m_cart) return m_cart->read_rom04(offset); @@ -198,7 +198,7 @@ uint8_t o2_cart_slot_device::read_rom04(offs_t offset) return 0xff; } -uint8_t o2_cart_slot_device::read_rom0c(offs_t offset) +u8 o2_cart_slot_device::read_rom0c(offs_t offset) { if (m_cart) return m_cart->read_rom0c(offset); @@ -210,13 +210,13 @@ uint8_t o2_cart_slot_device::read_rom0c(offs_t offset) io -------------------------------------------------*/ -void o2_cart_slot_device::io_write(offs_t offset, uint8_t data) +void o2_cart_slot_device::io_write(offs_t offset, u8 data) { if (m_cart) m_cart->io_write(offset, data); } -uint8_t o2_cart_slot_device::io_read(offs_t offset) +u8 o2_cart_slot_device::io_read(offs_t offset) { if (m_cart) return m_cart->io_read(offset); diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index 0717ce973f2..4c65fafe01e 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -37,30 +37,30 @@ public: virtual ~device_o2_cart_interface(); // reading and writing - virtual uint8_t read_rom04(offs_t offset) { return 0xff; } - virtual uint8_t read_rom0c(offs_t offset) { return 0xff; } - virtual void write_p1(uint8_t data) { } - virtual void write_p2(uint8_t data) { } + virtual u8 read_rom04(offs_t offset) { return 0xff; } + virtual u8 read_rom0c(offs_t offset) { return 0xff; } + virtual void write_p1(u8 data) { } + virtual void write_p2(u8 data) { } - virtual void io_write(offs_t offset, uint8_t data) { } - virtual uint8_t io_read(offs_t offset) { return 0xff; } + virtual void io_write(offs_t offset, u8 data) { } + virtual u8 io_read(offs_t offset) { return 0xff; } virtual DECLARE_READ_LINE_MEMBER(t0_read) { return 0; } virtual int b_read() { return -1; } virtual void cart_init() { } // called after loading ROM - uint8_t* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; } - uint32_t get_rom_size() { return m_rom ? m_rom.bytes() : 0; } + u8* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; } + u32 get_rom_size() { return m_rom ? m_rom.bytes() : 0; } - uint8_t* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; } - uint32_t get_voice_size() { return m_voice ? m_voice.bytes() : 0; } + u8* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; } + u32 get_voice_size() { return m_voice ? m_voice.bytes() : 0; } protected: device_o2_cart_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_rom; - optional_shared_ptr<uint8_t> m_exrom; - optional_shared_ptr<uint8_t> m_voice; + optional_shared_ptr<u8> m_rom; + optional_shared_ptr<u8> m_exrom; + optional_shared_ptr<u8> m_voice; }; @@ -82,7 +82,7 @@ public: set_fixed(false); } - o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); virtual ~o2_cart_slot_device(); // image-level overrides @@ -105,15 +105,15 @@ public: device_o2_cart_interface* cart() { return m_cart; } // reading and writing - uint8_t read_rom04(offs_t offset); - uint8_t read_rom0c(offs_t offset); - void io_write(offs_t offset, uint8_t data); - uint8_t io_read(offs_t offset); + u8 read_rom04(offs_t offset); + u8 read_rom0c(offs_t offset); + void io_write(offs_t offset, u8 data); + u8 io_read(offs_t offset); DECLARE_READ_LINE_MEMBER(t0_read) { if (m_cart) return m_cart->t0_read(); else return 0; } int b_read(); - void write_p1(uint8_t data) { if (m_cart) m_cart->write_p1(data); } - void write_p2(uint8_t data) { if (m_cart) m_cart->write_p2(data); } + void write_p1(u8 data) { if (m_cart) m_cart->write_p1(data); } + void write_p2(u8 data) { if (m_cart) m_cart->write_p2(data); } protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/voice.cpp b/src/devices/bus/odyssey2/voice.cpp index f741946dfa0..927b8fcc05e 100644 --- a/src/devices/bus/odyssey2/voice.cpp +++ b/src/devices/bus/odyssey2/voice.cpp @@ -24,7 +24,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_VOICE, o2_voice_device, "o2_voice", "Odyssey 2 The Voi // o2_voice_device - constructor //------------------------------------------------- -o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_VOICE, tag, owner, clock), device_o2_cart_interface(mconfig, *this), m_speech(*this, "speech"), diff --git a/src/devices/bus/odyssey2/voice.h b/src/devices/bus/odyssey2/voice.h index 829267fd439..b717334149a 100644 --- a/src/devices/bus/odyssey2/voice.h +++ b/src/devices/bus/odyssey2/voice.h @@ -22,7 +22,7 @@ class o2_voice_device : public device_t, { public: // construction/destruction - o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); virtual void cart_init() override; diff --git a/src/devices/bus/s100/dg640.cpp b/src/devices/bus/s100/dg640.cpp index 7f79983f17d..f6adb27cfa8 100644 --- a/src/devices/bus/s100/dg640.cpp +++ b/src/devices/bus/s100/dg640.cpp @@ -39,28 +39,26 @@ void dg640_device::device_start() uint32_t dg640_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // attributes bit 0 = flash, bit 1 = lores. Also bit 7 of the character = reverse-video (text only). - uint8_t y,ra,chr,gfx,attr,inv,gfxbit; - uint16_t sy=0,ma=0,x; - bool flash; + uint16_t sy=0,ma=0; m_framecnt++; - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - attr = m_p_attribram[x]; - chr = m_p_videoram[x]; - flash = BIT(m_framecnt, 4) & BIT(attr, 0); + uint8_t attr = m_p_attribram[x]; + uint8_t chr = m_p_videoram[x]; + bool flash = BIT(m_framecnt, 4) & BIT(attr, 0); if (BIT(attr, 1)) // lores gfx - can flash { if (flash) chr = 0; // blank part of flashing - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c) >> 1; /* Display one line of a lores character (8 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -74,11 +72,11 @@ uint32_t dg640_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else { - gfx = 0; + uint8_t gfx = 0; if (!flash) { - inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed + uint8_t inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed chr &= 0x7f; gfx = inv; diff --git a/src/devices/bus/s100/polyvti.cpp b/src/devices/bus/s100/polyvti.cpp index 973e89c0693..242d13a8fe2 100644 --- a/src/devices/bus/s100/polyvti.cpp +++ b/src/devices/bus/s100/polyvti.cpp @@ -119,22 +119,22 @@ u32 poly_vti_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { u8 r = b/5; if (l==0 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; if (l==0 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; if (l==1 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; if (l==1 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; if (l==2 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; if (l==2 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; } } } @@ -156,11 +156,11 @@ u32 poly_vti_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, } for (int b = 0; b < 7; b++) - bitmap.pix16(y*15+j, xpos+b ) = (l >> (6-b)) & 1; + bitmap.pix(y*15+j, xpos+b ) = (l >> (6-b)) & 1; - bitmap.pix16(y*15+j, xpos+7 ) = 0; - bitmap.pix16(y*15+j, xpos+8 ) = 0; - bitmap.pix16(y*15+j, xpos+9 ) = 0; + bitmap.pix(y*15+j, xpos+7 ) = 0; + bitmap.pix(y*15+j, xpos+8 ) = 0; + bitmap.pix(y*15+j, xpos+9 ) = 0; } } xpos += 10; diff --git a/src/devices/bus/sbus/bwtwo.cpp b/src/devices/bus/sbus/bwtwo.cpp index 55d9f92b7b6..c034d43e05f 100644 --- a/src/devices/bus/sbus/bwtwo.cpp +++ b/src/devices/bus/sbus/bwtwo.cpp @@ -10,6 +10,9 @@ #include "bwtwo.h" #include "screen.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SBUS_BWTWO, sbus_bwtwo_device, "bwtwo", "Sun bwtwo SBus Video") void sbus_bwtwo_device::mem_map(address_map &map) @@ -72,14 +75,14 @@ void sbus_bwtwo_device::install_device() uint32_t sbus_bwtwo_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *line = &m_vram[0]; + uint8_t const *line = &m_vram[0]; for (int y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 1152/8; x++) { - memcpy(scanline, m_mono_lut[*line], sizeof(uint32_t) * 8); + std::copy_n(m_mono_lut[*line], 8, scanline); line++; scanline += 8; } diff --git a/src/devices/bus/sbus/cgsix.cpp b/src/devices/bus/sbus/cgsix.cpp index 5d7bd715efd..65a24e1b505 100644 --- a/src/devices/bus/sbus/cgsix.cpp +++ b/src/devices/bus/sbus/cgsix.cpp @@ -171,12 +171,12 @@ void sbus_cgsix_device::device_reset() uint32_t sbus_cgsix_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_ramdac->pens(); - uint8_t *vram = (uint8_t *)&m_vram[0]; + pen_t const *const pens = m_ramdac->pens(); + uint8_t const *const vram = (uint8_t *)&m_vram[0]; for (int16_t y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); const bool cursor_row_hit = (y >= m_cursor_y && y < (m_cursor_y + 32)); for (int16_t x = 0; x < 1152; x++) { diff --git a/src/devices/bus/sbus/cgthree.cpp b/src/devices/bus/sbus/cgthree.cpp index 5ffe6a885c5..ad0ba5c1467 100644 --- a/src/devices/bus/sbus/cgthree.cpp +++ b/src/devices/bus/sbus/cgthree.cpp @@ -67,12 +67,12 @@ void sbus_cgthree_device::install_device() uint32_t sbus_cgthree_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_ramdac->pens(); - uint8_t *vram = (uint8_t *)&m_vram[0]; + pen_t const *const pens = m_ramdac->pens(); + uint8_t const *const vram = (uint8_t *)&m_vram[0]; for (int y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 1152; x++) { const uint8_t pixel = vram[y * 1152 + BYTE4_XOR_BE(x)]; diff --git a/src/devices/bus/scsi/omti5100.cpp b/src/devices/bus/scsi/omti5100.cpp index 519aa723a0b..f095dd2b191 100644 --- a/src/devices/bus/scsi/omti5100.cpp +++ b/src/devices/bus/scsi/omti5100.cpp @@ -15,7 +15,7 @@ DEFINE_DEVICE_TYPE(OMTI5100, omti5100_device, "omti5100", "OMTI 5100") #if 0 ROM_START( omti5100 ) ROM_REGION(0x1000, "mcu", 0) // Hitachi Z8 - ROM_LOAD("100240-N.7a", 0x0000, 0x1000, CRC(d227d6cb) SHA1(3d6140764d3d043428c941826370ebf1597c63bd)) + ROM_LOAD("100240-n.7a", 0x0000, 0x1000, CRC(d227d6cb) SHA1(3d6140764d3d043428c941826370ebf1597c63bd)) ROM_END const tiny_rom_entry *omti5100_device::device_rom_region() const diff --git a/src/devices/bus/svi3x8/slot/sv806.cpp b/src/devices/bus/svi3x8/slot/sv806.cpp index bc4dafbd415..5a7d858d38b 100644 --- a/src/devices/bus/svi3x8/slot/sv806.cpp +++ b/src/devices/bus/svi3x8/slot/sv806.cpp @@ -94,7 +94,7 @@ void sv806_device::device_start() MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -103,14 +103,14 @@ MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) if (i == cursor_x) data = 0xff; - bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, i * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, i * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, i * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, i * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, i * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, i * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, i * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, i * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/devices/bus/tanbus/mpvdu.cpp b/src/devices/bus/tanbus/mpvdu.cpp index e9f4fe766eb..28cd0b988f9 100644 --- a/src/devices/bus/tanbus/mpvdu.cpp +++ b/src/devices/bus/tanbus/mpvdu.cpp @@ -149,7 +149,7 @@ uint8_t tanbus_mpvdu_device::videoram_r(offs_t offset) MC6845_UPDATE_ROW(tanbus_mpvdu_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); @@ -165,11 +165,11 @@ MC6845_UPDATE_ROW(tanbus_mpvdu_device::crtc_update_row) m_trom->tr6_w(1); m_trom->tr6_w(0); - int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + int const col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; + int const r = BIT(col, 0) * 0xff; + int const g = BIT(col, 1) * 0xff; + int const b = BIT(col, 2) * 0xff; *p++ = rgb_t(r, g, b); } diff --git a/src/devices/bus/tanbus/ravdu.cpp b/src/devices/bus/tanbus/ravdu.cpp index 80664797081..b93b1a41c35 100644 --- a/src/devices/bus/tanbus/ravdu.cpp +++ b/src/devices/bus/tanbus/ravdu.cpp @@ -161,7 +161,7 @@ uint8_t tanbus_ravdu_device::videoram_r(offs_t offset) MC6845_UPDATE_ROW(tanbus_ravdu_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); @@ -178,11 +178,11 @@ MC6845_UPDATE_ROW(tanbus_ravdu_device::crtc_update_row) m_trom->tr6_w(1); m_trom->tr6_w(0); - int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + int const col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; + int const r = BIT(col, 0) * 0xff; + int const g = BIT(col, 1) * 0xff; + int const b = BIT(col, 2) * 0xff; *p++ = rgb_t(r, g, b); } diff --git a/src/devices/bus/tanbus/tanhrg.cpp b/src/devices/bus/tanbus/tanhrg.cpp index 1c8ffc87ab5..b857e84ac69 100644 --- a/src/devices/bus/tanbus/tanhrg.cpp +++ b/src/devices/bus/tanbus/tanhrg.cpp @@ -323,16 +323,13 @@ void tanbus_tanhrgc_device::set_inhibit_lines(offs_t offset, int &inhram, int &i uint32_t tanbus_tanhrg_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t offset; - uint32_t *p; - for (int y = 0; y < 256; y++) { - p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int x = 0; x < 256; x++) { - offset = (y * 32) + (x / 8); + uint16_t const offset = (y * 32) + (x / 8); *p++ = m_palette->pen_color(BIT(m_videoram[offset], x & 7)); } @@ -344,21 +341,17 @@ uint32_t tanbus_tanhrg_device::screen_update(screen_device &screen, bitmap_rgb32 uint32_t tanbus_tanhrgc_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t r, g, b; - uint16_t offset; - uint32_t *p; - for (int y = 0; y < 256; y++) { - p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int x = 0; x < 256; x++) { - offset = (y * 32) + (x / 8); + uint16_t const offset = (y * 32) + (x / 8); - r = m_videoram[0x0000 | offset]; - b = m_videoram[0x2000 | offset]; - g = m_videoram[0x4000 | offset]; + uint8_t const r = m_videoram[0x0000 | offset]; + uint8_t const b = m_videoram[0x2000 | offset]; + uint8_t const g = m_videoram[0x4000 | offset]; *p++ = m_palette->pen_color(BIT(b, x & 7) << 2 | BIT(g, x & 7) << 1 | BIT(r, x & 7)); } diff --git a/src/devices/bus/tanbus/tug8082.cpp b/src/devices/bus/tanbus/tug8082.cpp index 1e4ad1a4504..582ab726c8e 100644 --- a/src/devices/bus/tanbus/tug8082.cpp +++ b/src/devices/bus/tanbus/tug8082.cpp @@ -241,18 +241,14 @@ WRITE_LINE_MEMBER(tanbus_tug8082_device::vdu_irq_w) uint32_t tanbus_tug8082_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; + pen_t const *const pen = m_palette->pens(); - const pen_t *pen = m_palette->pens(); - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 64; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 64; x++) { - pixels = m_videoram[(y * 64) + x]; + uint8_t const pixels = m_videoram[(y * 64) + x]; for (int i = 0; i < 8; ++i) *scanline++ = pen[BIT(pixels, 7 - i)]; diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp index 6b2da977a2a..c703d331bf9 100644 --- a/src/devices/bus/ti99/gromport/cartridges.cpp +++ b/src/devices/bus/ti99/gromport/cartridges.cpp @@ -1558,13 +1558,13 @@ void ti99_cartridge_device::rpk::close() not a network socket) ***************************************************************/ -ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, uint8_t* contents, std::string &&pathname) - : m_id(id), m_length(length), m_contents(contents), m_pathname(std::move(pathname)) +ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, std::unique_ptr<uint8_t []> &&contents, std::string &&pathname) + : m_id(id), m_length(length), m_contents(std::move(contents)), m_pathname(std::move(pathname)) { } -ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, uint8_t* contents) - : rpk_socket(id, length, contents, "") +ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, std::unique_ptr<uint8_t []> &&contents) + : rpk_socket(id, length, std::move(contents), "") { } @@ -1609,7 +1609,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re util::archive_file::error ziperr; uint32_t crc; int length; - uint8_t* contents; + std::unique_ptr<uint8_t []> contents; int header; // find the file attribute (required) @@ -1635,11 +1635,11 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re length = zip.current_uncompressed_length(); // Allocate storage - contents = global_alloc_array_clear<uint8_t>(length); - if (contents==nullptr) throw rpk_exception(RPK_OUT_OF_MEMORY); + try { contents = make_unique_clear<uint8_t []>(length); } + catch (std::bad_alloc const &) { throw rpk_exception(RPK_OUT_OF_MEMORY); } // and unzip file from the zip file - ziperr = zip.decompress(contents, length); + ziperr = zip.decompress(contents.get(), length); if (ziperr != util::archive_file::error::NONE) { if (ziperr == util::archive_file::error::UNSUPPORTED) throw rpk_exception(RPK_ZIP_UNSUPPORTED); @@ -1651,7 +1651,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re if (sha1 != nullptr) { util::hash_collection actual_hashes; - actual_hashes.compute((const uint8_t *)contents, length, util::hash_collection::HASH_TYPES_CRC_SHA1); + actual_hashes.compute(contents.get(), length, util::hash_collection::HASH_TYPES_CRC_SHA1); util::hash_collection expected_hashes; expected_hashes.add_from_string(util::hash_collection::HASH_SHA1, sha1, strlen(sha1)); @@ -1660,7 +1660,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re } // Create a socket instance - return std::make_unique<rpk_socket>(socketname, length, contents); + return std::make_unique<rpk_socket>(socketname, length, std::move(contents)); } /* @@ -1673,7 +1673,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re const char* ram_filename; std::string ram_pname; unsigned int length; - uint8_t* contents; + std::unique_ptr<uint8_t []> contents; // find the length attribute length_string = ram_resource_node->get_attribute_string("length", nullptr); @@ -1701,8 +1701,8 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re } // Allocate memory for this resource - contents = global_alloc_array_clear<uint8_t>(length); - if (contents==nullptr) throw rpk_exception(RPK_OUT_OF_MEMORY); + try { contents = make_unique_clear<uint8_t []>(length); } + catch (std::bad_alloc const &) { throw rpk_exception(RPK_OUT_OF_MEMORY); } LOGMASKED(LOG_RPK, "[RPK handler] Allocating RAM buffer (%d bytes) for socket '%s'\n", length, socketname); @@ -1717,10 +1717,8 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re // Get the file name (required if persistent) ram_filename = ram_resource_node->get_attribute_string("file", nullptr); if (ram_filename==nullptr) - { - global_free_array(contents); throw rpk_exception(RPK_INVALID_RAM_SPEC, "<ram type='persistent'> must have a 'file' attribute"); - } + ram_pname = std::string(system_name).append(PATH_SEPARATOR).append(ram_filename); // load, and fill rest with 00 LOGMASKED(LOG_RPK, "[RPK handler] Loading NVRAM contents from '%s'\n", ram_pname.c_str()); @@ -1734,15 +1732,15 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re osd_file::error filerr = file.open(ram_pname); int bytes_read = 0; if (filerr == osd_file::error::NONE) - bytes_read = file.read(contents, length); + bytes_read = file.read(contents.get(), length); // fill remaining bytes (if necessary) - memset(((char *) contents) + bytes_read, 0x00, length - bytes_read); + std::fill_n(&contents[bytes_read], length - bytes_read, 0x00); } } // Create a socket instance - return std::make_unique<rpk_socket>(socketname, length, contents, std::move(ram_pname)); + return std::make_unique<rpk_socket>(socketname, length, std::move(contents), std::move(ram_pname)); } /*------------------------------------------------- diff --git a/src/devices/bus/ti99/gromport/cartridges.h b/src/devices/bus/ti99/gromport/cartridges.h index b494ad7e28d..f6e2e991d56 100644 --- a/src/devices/bus/ti99/gromport/cartridges.h +++ b/src/devices/bus/ti99/gromport/cartridges.h @@ -170,21 +170,21 @@ private: class rpk_socket { public: - rpk_socket(const char *id, int length, uint8_t *contents); - rpk_socket(const char *id, int length, uint8_t *contents, std::string &&pathname); + rpk_socket(const char *id, int length, std::unique_ptr<uint8_t []> &&contents); + rpk_socket(const char *id, int length, std::unique_ptr<uint8_t []> &&contents, std::string &&pathname); ~rpk_socket() {} const char* id() { return m_id; } int get_content_length() { return m_length; } - uint8_t* get_contents() { return m_contents; } + uint8_t* get_contents() { return m_contents.get(); } bool persistent_ram() { return !m_pathname.empty(); } const char* get_pathname() { return m_pathname.c_str(); } - void cleanup() { if (m_contents != nullptr) global_free_array(m_contents); } + void cleanup() { m_contents.reset(); } private: const char* m_id; uint32_t m_length; - uint8_t* m_contents; + std::unique_ptr<uint8_t []> m_contents; const std::string m_pathname; }; diff --git a/src/devices/bus/ti99/internal/992board.cpp b/src/devices/bus/ti99/internal/992board.cpp index 031f82d7fe5..2f01c025cb6 100644 --- a/src/devices/bus/ti99/internal/992board.cpp +++ b/src/devices/bus/ti99/internal/992board.cpp @@ -202,7 +202,7 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par } int vpos = raw_vpos * m_vertical_size / screen().height(); - uint32_t *p = &m_tmpbmp.pix32(vpos); + uint32_t *p = &m_tmpbmp.pix(vpos); bool endofline = false; int linelength = 0; diff --git a/src/devices/bus/ti99/peb/horizon.cpp b/src/devices/bus/ti99/peb/horizon.cpp index 6da8483a046..8d9aa8dd20a 100644 --- a/src/devices/bus/ti99/peb/horizon.cpp +++ b/src/devices/bus/ti99/peb/horizon.cpp @@ -121,24 +121,22 @@ void horizon_ramdisk_device::nvram_read(emu_file &file) int size = 2097152*(1 << ioport("HORIZONSIZE")->read()); // NVRAM plus ROS - uint8_t* buffer = global_alloc_array_clear<uint8_t>(MAXSIZE + ROSSIZE); + auto buffer = make_unique_clear<uint8_t []>(MAXSIZE + ROSSIZE); memset(m_nvram->pointer(), 0, size); memset(m_ros->pointer(), 0, ROSSIZE); // We assume the last 8K is ROS - int filesize = file.read(buffer, MAXSIZE+ROSSIZE); + int filesize = file.read(&buffer[0], MAXSIZE+ROSSIZE); int nvramsize = filesize - ROSSIZE; // If there is a reasonable size if (nvramsize >= 0) { // Copy from buffer to NVRAM and ROS - memcpy(m_nvram->pointer(), buffer, nvramsize); - memcpy(m_ros->pointer(), buffer + nvramsize, ROSSIZE); + memcpy(m_nvram->pointer(), &buffer[0], nvramsize); + memcpy(m_ros->pointer(), &buffer[nvramsize], ROSSIZE); } - - global_free_array(buffer); } //------------------------------------------------- @@ -150,11 +148,11 @@ void horizon_ramdisk_device::nvram_write(emu_file &file) { int nvramsize = 2097152*(1 << ioport("HORIZONSIZE")->read()); - uint8_t* buffer = global_alloc_array_clear<uint8_t>(nvramsize + ROSSIZE); - memcpy(buffer, m_nvram->pointer(), nvramsize); - memcpy(buffer + nvramsize, m_ros->pointer(), ROSSIZE); + auto buffer = make_unique_clear<uint8_t []>(nvramsize + ROSSIZE); + memcpy(&buffer[0], m_nvram->pointer(), nvramsize); + memcpy(&buffer[nvramsize], m_ros->pointer(), ROSSIZE); - file.write(buffer, nvramsize + ROSSIZE); + file.write(buffer.get(), nvramsize + ROSSIZE); } void horizon_ramdisk_device::readz(offs_t offset, uint8_t *value) diff --git a/src/devices/bus/vic20/videopak.cpp b/src/devices/bus/vic20/videopak.cpp index 187224721be..1f2b3c35431 100644 --- a/src/devices/bus/vic20/videopak.cpp +++ b/src/devices/bus/vic20/videopak.cpp @@ -77,7 +77,7 @@ MC6845_UPDATE_ROW( vic20_video_pak_device::crtc_update_row ) int x = (column * 8) + bit; int color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/devices/bus/vsmile/mat.cpp b/src/devices/bus/vsmile/mat.cpp new file mode 100644 index 00000000000..6dfeac5be98 --- /dev/null +++ b/src/devices/bus/vsmile/mat.cpp @@ -0,0 +1,198 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz, Vas Crabb + +#include "emu.h" +#include "mat.h" + +#include <algorithm> + +//#define VERBOSE 1 +#include "logmacro.h" + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(VSMILE_MAT, vsmile_mat_device, "vsmile_mat", "V.Smile Gym Mat") + + +//************************************************************************** +// V.Smile gym mat +//************************************************************************** + +vsmile_mat_device::vsmile_mat_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) + : vsmile_pad_device(mconfig, VSMILE_MAT, tag, owner, clock) + , m_io_joy(*this, "JOY") + , m_io_colors(*this, "COLORS") + , m_io_buttons(*this, "BUTTONS") +{ +} + +vsmile_mat_device::~vsmile_mat_device() +{ +} + +void vsmile_mat_device::tx_complete() +{ + // update "joystick"-mapped mat pads + if ((m_stale & STALE_JOY) != STALE_NONE) + { + m_sent_joy = m_io_joy->read(); + if ((m_stale & STALE_YELLOW_RIGHT) != STALE_NONE) + { + if (BIT(m_sent_joy, 0)) + uart_tx_fifo_push(0xcb); // yellow + else if (BIT(m_sent_joy, 1)) + uart_tx_fifo_push(0xcd); // right + else + uart_tx_fifo_push(0xc0); + } + if ((m_stale & STALE_RED_LEFT) != STALE_NONE) + { + if (BIT(m_sent_joy, 2)) + uart_tx_fifo_push(0x8b); // red + else if (BIT(m_sent_joy, 3)) + uart_tx_fifo_push(0x8d); // left + else + uart_tx_fifo_push(0x80); + } + } + + // update "color"-mapped mat pads + if ((m_stale & STALE_COLORS) != STALE_NONE) + { + m_sent_colors = m_io_colors->read(); + uart_tx_fifo_push(0x90 | m_sent_colors); + } + + // update "button"-mapped mat pads + if ((m_stale & STALE_BUTTONS) != STALE_NONE) + { + m_sent_buttons = m_io_buttons->read(); + if (((m_stale & STALE_OK) != STALE_NONE) && BIT(m_sent_buttons, 0)) + uart_tx_fifo_push(0xa1); + if (((m_stale & STALE_QUIT) != STALE_NONE) && BIT(m_sent_buttons, 1)) + uart_tx_fifo_push(0xa2); + if (((m_stale & STALE_HELP) != STALE_NONE) && BIT(m_sent_buttons, 2)) + uart_tx_fifo_push(0xa3); + if (((m_stale & STALE_BLUE) != STALE_NONE) && BIT(m_sent_buttons, 3)) + uart_tx_fifo_push(0xa4); + if (!m_sent_buttons) + uart_tx_fifo_push(0xa0); + } + + // if nothing happens in the next second we'll queue a keep-alive + if (!m_active) + LOG("entered active state\n"); + m_idle_timer->adjust(attotime::from_seconds(1)); + m_active = true; + m_stale = STALE_NONE; +} + +INPUT_CHANGED_MEMBER(vsmile_mat_device::mat_joy_changed) +{ + if (m_active) + { + if (!is_tx_empty()) + { + LOG("joy changed while transmission in progress, marking stale\n"); + m_stale |= stale_mat_inputs(param); + } + else + { + uint8_t const joy = m_io_joy->read(); + if ((joy ^ m_sent_joy) & 0x03) + { + if (BIT(joy, 0)) + uart_tx_fifo_push(0xcb); // yellow + else if (BIT(joy, 1)) + uart_tx_fifo_push(0xcd); // right + else + uart_tx_fifo_push(0xc0); + } + if ((joy ^ m_sent_joy) & 0x0c) + { + if (BIT(joy, 2)) + uart_tx_fifo_push(0x8b); // red + else if (BIT(joy, 3)) + uart_tx_fifo_push(0x8d); // left + else + uart_tx_fifo_push(0x80); + } + m_sent_joy = joy; + } + } +} + +INPUT_CHANGED_MEMBER(vsmile_mat_device::mat_color_changed) +{ + if (m_active) + { + if (!is_tx_empty()) + { + LOG("colors changed while transmission in progress, marking stale\n"); + m_stale |= STALE_COLORS; + } + else + { + m_sent_colors = m_io_colors->read(); + uart_tx_fifo_push(0x90 | m_sent_colors); + } + } +} + +INPUT_CHANGED_MEMBER(vsmile_mat_device::mat_button_changed) +{ + if (m_active) + { + if (!is_tx_empty()) + { + LOG("buttons changed while transmission in progress, marking stale\n"); + m_stale |= stale_mat_inputs(param); + } + else + { + uint8_t const buttons = m_io_buttons->read(); + if (BIT((m_sent_buttons ^ buttons) & buttons, 0)) + uart_tx_fifo_push(0xa1); + if (BIT((m_sent_buttons ^ buttons) & buttons, 1)) + uart_tx_fifo_push(0xa2); + if (BIT((m_sent_buttons ^ buttons) & buttons, 2)) + uart_tx_fifo_push(0xa3); + if (BIT((m_sent_buttons ^ buttons) & buttons, 3)) + uart_tx_fifo_push(0xa4); + if (!buttons) + uart_tx_fifo_push(0xa0); + m_sent_buttons = buttons; + } + } +} + +static INPUT_PORTS_START( vsmile_mat ) + PORT_START("JOY") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CODE(KEYCODE_9_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_joy_changed, vsmile_mat_device::STALE_YELLOW_RIGHT) PORT_NAME("Yellow") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_BUTTON2) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_joy_changed, vsmile_mat_device::STALE_YELLOW_RIGHT) PORT_NAME("Right") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(JOYCODE_BUTTON3) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_joy_changed, vsmile_mat_device::STALE_RED_LEFT) PORT_NAME("Red") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_BUTTON4) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_joy_changed, vsmile_mat_device::STALE_RED_LEFT) PORT_NAME("Left") + PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("COLORS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_5_PAD) PORT_CODE(JOYCODE_BUTTON5) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_color_changed, vsmile_mat_device::STALE_COLORS) PORT_NAME("Center") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(JOYCODE_BUTTON6) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_color_changed, vsmile_mat_device::STALE_COLORS) PORT_NAME("Up") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_BUTTON7) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_color_changed, vsmile_mat_device::STALE_COLORS) PORT_NAME("Down") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_CODE(KEYCODE_3_PAD) PORT_CODE(JOYCODE_BUTTON8) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_color_changed, vsmile_mat_device::STALE_COLORS) PORT_NAME("Green") + PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("BUTTONS") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CODE(JOYCODE_BUTTON9) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_button_changed, vsmile_mat_device::STALE_OK) PORT_NAME("OK") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON10) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_button_changed, vsmile_mat_device::STALE_QUIT) PORT_NAME("Quit") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CODE(JOYCODE_BUTTON11) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_button_changed, vsmile_mat_device::STALE_HELP) PORT_NAME("Help") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_CODE(KEYCODE_1_PAD) PORT_CODE(JOYCODE_BUTTON12) PORT_CHANGED_MEMBER(DEVICE_SELF, vsmile_mat_device, mat_button_changed, vsmile_mat_device::STALE_BLUE) PORT_NAME("Blue") + PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + +ioport_constructor vsmile_mat_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( vsmile_mat ); +} diff --git a/src/devices/bus/vsmile/mat.h b/src/devices/bus/vsmile/mat.h new file mode 100644 index 00000000000..e184b6b3d25 --- /dev/null +++ b/src/devices/bus/vsmile/mat.h @@ -0,0 +1,69 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz, Vas Crabb +#ifndef MAME_BUS_VSMILE_MAT_H +#define MAME_BUS_VSMILE_MAT_H + +#pragma once + +#include "pad.h" + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + +// ======================> vsmile_mat_device + +class vsmile_mat_device : public vsmile_pad_device +{ +public: + // construction/destruction + vsmile_mat_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); + virtual ~vsmile_mat_device(); + + // input handlers + DECLARE_INPUT_CHANGED_MEMBER(mat_joy_changed); + DECLARE_INPUT_CHANGED_MEMBER(mat_color_changed); + DECLARE_INPUT_CHANGED_MEMBER(mat_button_changed); + + enum stale_mat_inputs : uint16_t + { + STALE_NONE = 0U, + STALE_YELLOW_RIGHT = 1U << 0, + STALE_RED_LEFT = 1U << 1, + STALE_CENTER = 1U << 2, + STALE_UP = 1U << 3, + STALE_DOWN = 1U << 4, + STALE_GREEN = 1U << 5, + STALE_OK = 1U << 6, + STALE_QUIT = 1U << 7, + STALE_HELP = 1U << 8, + STALE_BLUE = 1U << 9, + + STALE_JOY = STALE_YELLOW_RIGHT | STALE_RED_LEFT, + STALE_COLORS = STALE_CENTER | STALE_UP | STALE_DOWN | STALE_GREEN, + STALE_BUTTONS = STALE_OK | STALE_QUIT | STALE_HELP | STALE_BLUE, + STALE_ALL = STALE_JOY | STALE_COLORS | STALE_BUTTONS + }; + +protected: + // device_t implementation + virtual ioport_constructor device_input_ports() const override; + + // vsmile_pad_device implementation + virtual void tx_complete() override; + virtual uint16_t stale_all() override { return STALE_ALL; } + +private: + required_ioport m_io_joy; + required_ioport m_io_colors; + required_ioport m_io_buttons; +}; + + +/*************************************************************************** + DEVICE TYPES + ***************************************************************************/ + +DECLARE_DEVICE_TYPE(VSMILE_MAT, vsmile_mat_device) + +#endif // MAME_BUS_VSMILE_MAT_H diff --git a/src/devices/bus/vsmile/pad.cpp b/src/devices/bus/vsmile/pad.cpp index 94c7decdaa9..5cf7940ab39 100644 --- a/src/devices/bus/vsmile/pad.cpp +++ b/src/devices/bus/vsmile/pad.cpp @@ -21,22 +21,24 @@ DEFINE_DEVICE_TYPE(VSMILE_PAD, vsmile_pad_device, "vsmile_pad", "V.Smile Joystic // V.Smile control pad //************************************************************************** -DECLARE_ENUM_BITWISE_OPERATORS(vsmile_pad_device::stale_inputs) -ALLOW_SAVE_TYPE(vsmile_pad_device::stale_inputs); - vsmile_pad_device::vsmile_pad_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) - : vsmile_ctrl_device_base(mconfig, VSMILE_PAD, tag, owner, clock) + : vsmile_pad_device(mconfig, VSMILE_PAD, tag, owner, clock) +{ +} + +vsmile_pad_device::vsmile_pad_device(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, uint32_t clock) + : vsmile_ctrl_device_base(mconfig, type, tag, owner, clock) , m_io_joy(*this, "JOY") , m_io_colors(*this, "COLORS") , m_io_buttons(*this, "BUTTONS") - , m_idle_timer(nullptr) - , m_sent_joy(0x00U) - , m_sent_colors(0x00U) - , m_sent_buttons(0x00U) - , m_stale(STALE_ALL) + , m_sent_joy(0x0000U) + , m_sent_colors(0x0000U) + , m_sent_buttons(0x0000U) , m_active(false) + , m_idle_timer(nullptr) { std::fill(std::begin(m_ctrl_probe_history), std::end(m_ctrl_probe_history), 0U); + m_stale = stale_all(); } vsmile_pad_device::~vsmile_pad_device() @@ -51,10 +53,10 @@ void vsmile_pad_device::device_start() timer_expired_delegate(FUNC(vsmile_pad_device::handle_idle), this)); m_idle_timer->adjust(attotime::from_seconds(1)); - m_sent_joy = 0x00U; - m_sent_colors = 0x00U; - m_sent_buttons = 0x00U; - m_stale = STALE_ALL; + m_sent_joy = 0x0000U; + m_sent_colors = 0x0000U; + m_sent_buttons = 0x0000U; + m_stale = stale_all(); m_active = false; save_item(NAME(m_sent_joy)); @@ -128,7 +130,7 @@ void vsmile_pad_device::tx_timeout() { m_idle_timer->reset(); m_active = false; - m_stale = STALE_ALL; + m_stale = stale_all(); std::fill(std::begin(m_ctrl_probe_history), std::end(m_ctrl_probe_history), 0U); LOG("left active state\n"); } @@ -174,7 +176,7 @@ INPUT_CHANGED_MEMBER(vsmile_pad_device::pad_joy_changed) if (!is_tx_empty()) { LOG("joy changed while transmission in progress, marking stale\n"); - m_stale |= stale_inputs(param); + m_stale |= stale_pad_inputs(param); } else { @@ -226,7 +228,7 @@ INPUT_CHANGED_MEMBER(vsmile_pad_device::pad_button_changed) if (!is_tx_empty()) { LOG("buttons changed while transmission in progress, marking stale\n"); - m_stale |= stale_inputs(param); + m_stale |= stale_pad_inputs(param); } else { diff --git a/src/devices/bus/vsmile/pad.h b/src/devices/bus/vsmile/pad.h index 5e2515c2b58..bdf896b7646 100644 --- a/src/devices/bus/vsmile/pad.h +++ b/src/devices/bus/vsmile/pad.h @@ -16,7 +16,16 @@ class vsmile_pad_device : public vsmile_ctrl_device_base { public: - enum stale_inputs : uint8_t + // construction/destruction + vsmile_pad_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); + virtual ~vsmile_pad_device(); + + // input handlers + DECLARE_INPUT_CHANGED_MEMBER(pad_joy_changed); + DECLARE_INPUT_CHANGED_MEMBER(pad_color_changed); + DECLARE_INPUT_CHANGED_MEMBER(pad_button_changed); + + enum stale_pad_inputs : uint16_t { STALE_NONE = 0U, STALE_LEFT_RIGHT = 1U << 0, @@ -32,16 +41,9 @@ public: STALE_ALL = STALE_JOY | STALE_COLORS | STALE_BUTTONS }; - // construction/destruction - vsmile_pad_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); - virtual ~vsmile_pad_device(); - - // input handlers - DECLARE_INPUT_CHANGED_MEMBER(pad_joy_changed); - DECLARE_INPUT_CHANGED_MEMBER(pad_color_changed); - DECLARE_INPUT_CHANGED_MEMBER(pad_button_changed); - protected: + vsmile_pad_device(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, uint32_t clock = 0U); + // device_t implementation virtual ioport_constructor device_input_ports() const override; virtual void device_start() override; @@ -50,21 +52,23 @@ protected: virtual void tx_complete() override; virtual void tx_timeout() override; virtual void rx_complete(uint8_t data, bool cts) override; + virtual uint16_t stale_all() { return STALE_ALL; } -private: void uart_tx_fifo_push(uint8_t data); - TIMER_CALLBACK_MEMBER(handle_idle); - required_ioport m_io_joy; required_ioport m_io_colors; required_ioport m_io_buttons; - emu_timer *m_idle_timer; + uint16_t m_sent_joy, m_sent_colors, m_sent_buttons; - uint8_t m_sent_joy, m_sent_colors, m_sent_buttons; - stale_inputs m_stale; + uint16_t m_stale; bool m_active; + emu_timer *m_idle_timer; + +private: + TIMER_CALLBACK_MEMBER(handle_idle); + uint8_t m_ctrl_probe_history[2]; }; diff --git a/src/devices/bus/vsmile/rom.cpp b/src/devices/bus/vsmile/rom.cpp index ca2780a2725..bc69099d698 100644 --- a/src/devices/bus/vsmile/rom.cpp +++ b/src/devices/bus/vsmile/rom.cpp @@ -52,7 +52,7 @@ void vsmile_rom_device::device_start() save_item(NAME(m_bank_offset)); } -void vsmile_rom_device::device_reset() +void vsmile_rom_device::device_resolve_objects() { m_bank_offset = 0; } diff --git a/src/devices/bus/vsmile/rom.h b/src/devices/bus/vsmile/rom.h index 617d1ad6ecd..b9ac8ef0b07 100644 --- a/src/devices/bus/vsmile/rom.h +++ b/src/devices/bus/vsmile/rom.h @@ -29,7 +29,7 @@ protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; + virtual void device_resolve_objects() override; uint32_t m_bank_offset; }; diff --git a/src/devices/bus/vsmile/vsmile_ctrl.cpp b/src/devices/bus/vsmile/vsmile_ctrl.cpp index e3ae106bd3a..4b9d629aaaf 100644 --- a/src/devices/bus/vsmile/vsmile_ctrl.cpp +++ b/src/devices/bus/vsmile/vsmile_ctrl.cpp @@ -277,8 +277,10 @@ TIMER_CALLBACK_MEMBER(vsmile_ctrl_device_base::rts_timer_expired) #include "pad.h" +#include "mat.h" void vsmile_controllers(device_slot_interface &device) { device.option_add("joy", VSMILE_PAD); + device.option_add("mat", VSMILE_MAT); } diff --git a/src/devices/bus/wangpc/lvc.cpp b/src/devices/bus/wangpc/lvc.cpp index 4d31a7b9367..1fd3c0610d4 100644 --- a/src/devices/bus/wangpc/lvc.cpp +++ b/src/devices/bus/wangpc/lvc.cpp @@ -62,17 +62,17 @@ MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - offs_t addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f)); + offs_t const addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f)); uint16_t data = m_video_ram[addr & 0x7fff]; for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; int color = (BIT(data, 15) << 1) | BIT(data, 7); if (column == cursor_x) color = 0x03; - bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); + bitmap.pix(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); data <<= 1; } @@ -89,12 +89,12 @@ MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; int color = (BIT(data, 31) << 3) | (BIT(data, 23) << 2) | (BIT(data, 15) << 1) | BIT(data, 7); if (column == cursor_x) color = 0x03; - bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); + bitmap.pix(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); data <<= 1; } diff --git a/src/devices/bus/wangpc/mvc.cpp b/src/devices/bus/wangpc/mvc.cpp index 562e277f982..cff515a05c1 100644 --- a/src/devices/bus/wangpc/mvc.cpp +++ b/src/devices/bus/wangpc/mvc.cpp @@ -73,15 +73,15 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) { for (int sx = 0; sx < 50; sx++) { - offs_t addr = (y * 50) + sx; + offs_t const addr = (y * 50) + sx; uint16_t data = m_bitmap_ram[addr]; for (int bit = 0; bit < 16; bit++) { - int x = (sx * 16) + bit; - int color = BIT(data, 15) && de; + int const x = (sx * 16) + bit; + int const color = BIT(data, 15) && de; - bitmap.pix32(vbp + y, hbp + x) = PALETTE_MVC[color]; + bitmap.pix(vbp + y, hbp + x) = PALETTE_MVC[color]; data <<= 1; } @@ -89,8 +89,8 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) for (int column = 0; column < x_count; column++) { - uint16_t code = m_video_ram[((ma + column) & 0x7ff)]; - uint8_t attr = code & 0xff; + uint16_t const code = m_video_ram[((ma + column) & 0x7ff)]; + uint8_t const attr = code & 0xff; uint8_t new_ra = ra + 1; @@ -103,7 +103,7 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) new_ra = ra; } - offs_t addr = ((code >> 8) << 4) | (new_ra & 0x0f); + offs_t const addr = ((code >> 8) << 4) | (new_ra & 0x0f); uint16_t data = m_char_ram[addr & 0xfff]; if ((column == cursor_x) || (!ra && ATTR_OVERSCORE) || ((ra == 9) && ATTR_UNDERSCORE)) @@ -113,11 +113,13 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) for (int bit = 0; bit < 10; bit++) { - int x = (column * 10) + bit; + int const x = (column * 10) + bit; int color = ((BIT(data, 9) & ~ATTR_BLANK) ^ ATTR_REVERSE); - if ((color | bitmap.pix32(vbp + y, hbp + x)) & ATTR_BOLD) color = 2; - if (color) bitmap.pix32(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black(); + if ((color | bitmap.pix(vbp + y, hbp + x)) & ATTR_BOLD) + color = 2; + if (color) + bitmap.pix(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black(); data <<= 1; } diff --git a/src/devices/cpu/bcp/dp8344.cpp b/src/devices/cpu/bcp/dp8344.cpp index fcc872855eb..b58599e3183 100644 --- a/src/devices/cpu/bcp/dp8344.cpp +++ b/src/devices/cpu/bcp/dp8344.cpp @@ -48,8 +48,8 @@ //************************************************************************** // device type definitions -DEFINE_DEVICE_TYPE(DP8344A, dp8344a_device, "dp8344a", "DP8344A BCP") -DEFINE_DEVICE_TYPE(DP8344B, dp8344b_device, "dp8344b", "DP8344B BCP") +DEFINE_DEVICE_TYPE(DP8344A, dp8344a_device, "dp8344a", "National Semiconductor DP8344A BCP") +DEFINE_DEVICE_TYPE(DP8344B, dp8344b_device, "dp8344b", "National Semiconductor DP8344B BCP") //************************************************************************** @@ -109,6 +109,7 @@ dp8344_device::dp8344_device(const machine_config &mconfig, device_type type, co , m_tfifo{0, 0, 0} , m_rfifo_head(0) , m_tfifo_head(0) + , m_receiver_interrupt(false) { } @@ -178,7 +179,7 @@ void dp8344_device::device_start() set_icountptr(m_icount); // debug state registration - state_add<u16>(BCP_PC, "PC", [this]() { return m_pc; }, [this](u16 data) { m_pc = m_ppc = data; prefetch_instruction(); }); + state_add(BCP_PC, "PC", m_pc, [this](u16 data) { m_pc = m_ppc = data; prefetch_instruction(); }); state_add(STATE_GENPC, "GENPC", m_pc).noshow(); state_add(STATE_GENPCBASE, "GENPCBASE", m_pc).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_ccr).formatstr("%09s").noshow(); @@ -257,6 +258,7 @@ void dp8344_device::device_start() save_item(NAME(m_tfifo)); // 3-frame Transmit FIFO save_item(NAME(m_rfifo_head)); save_item(NAME(m_tfifo_head)); + save_item(NAME(m_receiver_interrupt)); } @@ -338,7 +340,7 @@ std::unique_ptr<util::disasm_interface> dp8344_device::create_disassembler() void dp8344_device::set_receiver_interrupt(bool state) { - // TODO + m_receiver_interrupt = state; } @@ -545,8 +547,8 @@ void dp8344_device::set_device_control(u8 data) bool dp8344_device::interrupt_active() const { - // TODO: non-timer interrupts - return !BIT(m_icr, 4) && BIT(m_ccr, 7); + // TODO: non-receiver, non-timer interrupts + return (!BIT(m_icr, 0) && m_receiver_interrupt) || (!BIT(m_icr, 4) && BIT(m_ccr, 7)); } @@ -557,8 +559,11 @@ bool dp8344_device::interrupt_active() const u8 dp8344_device::get_interrupt_vector() const { - // TODO: non-timer interrupts - return 0x14; + // TODO: non-receiver, non-timer interrupts + if (!BIT(m_icr, 0) && m_receiver_interrupt) + return 0x04; + else + return 0x14; } @@ -592,8 +597,8 @@ bool dp8344_device::get_flag(unsigned f) const case 5: // Receiver Error return BIT(m_tsr, 5); - case 6: // Data Available - return BIT(m_tsr, 3); // FIXME: differs from numeric value! + case 6: // Data Available (differs from DAV bit in TSR) + return m_rfifo_head < 3; case 7: // Transmitter FIFO Full (or else Not Full) return BIT(m_tsr, 7); @@ -808,6 +813,19 @@ u8 dp8344_device::data_stack_pop() // TRANSCEIVER OPERATION //************************************************************************** +const char *const dp8344_device::s_protocol_names[8] = +{ + "IBM 3270", + "IBM 3299 Multiplexer", + "IBM 3299 Controller", + "IBM 3299 Repeater", + "IBM 5250", + "IBM 5250 Promiscuous", + "8-bit", + "8-bit Promiscuous" +}; + + //------------------------------------------------- // transceiver_reset - reset the receiver and // transmitter @@ -846,6 +864,30 @@ void dp8344_device::transceiver_reset() void dp8344_device::transmit_fifo_push(u8 data) { + // HACK: loopback data + if (BIT(m_tmr, 6)) + { + u16 frame = data | u16(m_tcr & 0x07) << 8; + if ((m_tmr & 0x07) == 0x00) + { + // Calculate odd parity on 3270 data frames + if (!BIT(m_tcr, 2)) + { + if ((population_count_32(data) & 1) == 0) + frame |= 0x100; + else + frame &= 0x2ff; + } + + // Calculate word parity + frame &= 0x3ff; + if ((population_count_32(frame) & 1) != BIT(m_tcr, 3)) + frame |= 0x400; + } + receive_fifo_push(frame); + return; + } + // Push OWP, TF10-8 and RTF7-0 onto transmit FIFO m_tfifo[0] = data | u16(m_tcr & 0x0f) << 8; @@ -926,14 +968,43 @@ void dp8344_device::receiver_active() //------------------------------------------------- -// receive_fifo_push - +// receive_fifo_push - push a data frame onto +// the receive FIFO //------------------------------------------------- -void dp8344_device::receive_fifo_push(u8 data) +void dp8344_device::receive_fifo_push(u16 data) { - // Overflow error if the receive FIFO is already full - if (BIT(m_ncf, 6)) + // Push word onto receive FIFO + m_rfifo[0] = data; + + if (m_rfifo_head != 0) + { + // Asynchronously propagate data through FIFO (actually takes 40 ns) + m_rfifo_head--; + for (int i = 0; i < m_rfifo_head; i++) + m_rfifo[i + 1] = m_rfifo[i]; + + // Set data available flag + m_tsr |= 0x08; + if ((m_icr & 0xc0) == 0x40) + set_receiver_interrupt(true); + + // Copy upper bits to TSR + m_tsr = (m_tsr & 0xf8) | (data & 0x700) >> 8; + + // Set flag when FIFO is full + if (m_rfifo_head == 0) + { + m_tsr |= 0x40; + if ((m_icr & 0xc0) == 0x00) + set_receiver_interrupt(true); + } + } + else + { + // Overflow error if the receive FIFO is already full set_receiver_error(0x10); + } } @@ -943,19 +1014,32 @@ void dp8344_device::receive_fifo_push(u8 data) u8 dp8344_device::receive_fifo_pop(bool test) { + u8 data = m_rfifo[m_rfifo_head < 3 ? m_rfifo_head : 2] & 0x0ff; + if (!test) { - // Clear Receive FIFO Full, DEME, Auto-Response and Poll/Acknowledge bits in NCF - m_ncf &= 0xb0; + if (m_rfifo_head < 3) + { + // Advance the FIFO + m_rfifo_head++; + + // Copy upper bits to TSR + if (m_rfifo_head < 3) + m_tsr = (m_tsr & 0xf8) | (m_rfifo[m_rfifo_head] & 0x700) >> 8; + } // Clear Data Available flag in TSR m_tsr &= 0xf7; - if ((m_icr & 0xc0) == 0xc0) + + // Clear Receive FIFO Full, DEME, Auto-Response and Poll/Acknowledge bits in NCF + m_ncf &= 0xb0; + + // Clear receiver interrupt unless error interrupt exists + if (BIT(m_icr, 7) || !BIT(m_tsr, 5)) set_receiver_interrupt(false); } - // TODO - return 0; + return data; } @@ -990,12 +1074,19 @@ u8 dp8344_device::get_error_code(bool test) { u8 code = m_ecr; + // Upper bits come from receive FIFO + code |= m_rfifo[m_rfifo_head < 3 ? m_rfifo_head : 2] & 0x0e0; + if (!test) { // Clear Error Code Register and Receiver Error flag in NCF m_ecr = 0x00; m_ncf &= 0xdf; + // Reassert DAV if FIFO is not empty + if (m_rfifo_head < 3) + m_tsr |= 0x08; + // Update interrupt status if RE interrupt selected switch (m_icr & 0xc0) { @@ -1049,40 +1140,8 @@ void dp8344_device::set_transceiver_mode(u8 data) if (!BIT(m_tmr, 6) && BIT(data, 6)) m_tx_act_cb(0); - switch (data & 0x07) - { - case 0: - logerror("%04X: Protocol Select: IBM 3270\n", m_ppc); - break; - - case 1: - logerror("%04X: Protocol Select: IBM 3299 Multiplexer\n", m_ppc); - break; - - case 2: - logerror("%04X: Protocol Select: IBM 3299 Controller\n", m_ppc); - break; - - case 3: - logerror("%04X: Protocol Select: IBM 3299 Repeater\n", m_ppc); - break; - - case 4: - logerror("%04X: Protocol Select: IBM 5250\n", m_ppc); - break; - - case 5: - logerror("%04X: Protocol Select: IBM 5250 Promiscuous\n", m_ppc); - break; - - case 6: - logerror("%04X: Protocol Select: 8-bit\n", m_ppc); - break; - - case 7: - logerror("%04X: Protocol Select: 8-bit Promiscuous\n", m_ppc); - break; - } + if ((m_tmr & 0x07) != (data & 0x07)) + logerror("%04X: Protocol Select: %s\n", m_ppc, s_protocol_names[data & 0x07]); m_tmr = data; } @@ -2064,6 +2123,10 @@ void dp8344_device::cmd_w(u8 data) BIT(data, 3) ? "latched" : BIT(data, 5) ? "fast buffered" : "slow buffered", BIT(data, 6) ? "single step" : BIT(data, 2) ? "start" : "stop"); + // Make sure not to restart in the middle of an instruction + if (!BIT(m_ric, 2) && BIT(data, 2)) + m_inst_state = T1_START; + m_ric = data; set_input_line(INPUT_LINE_HALT, BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE); } @@ -2125,7 +2188,6 @@ u8 dp8344_device::remote_read(offs_t offset) void dp8344_device::remote_write(offs_t offset, u8 data) { // TODO: stop CPU if not accessing DMEM or RIC - switch (m_ric & 0x03) { case 0x00: diff --git a/src/devices/cpu/bcp/dp8344.h b/src/devices/cpu/bcp/dp8344.h index 95e0a671a0b..f4e1e674da9 100644 --- a/src/devices/cpu/bcp/dp8344.h +++ b/src/devices/cpu/bcp/dp8344.h @@ -86,6 +86,8 @@ protected: virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; private: + static const char *const s_protocol_names[8]; + enum inst_state : u8 { T1_DECODE, T1_START, T1_SKIP, T1_LJMP, T1_LCALL, TX_READ, TX_WRITE, @@ -123,7 +125,7 @@ private: u16 transmit_fifo_pop(); void transmitter_idle(); void receiver_active(); - void receive_fifo_push(u8 data); + void receive_fifo_push(u16 data); u8 receive_fifo_pop(bool test); void set_receiver_error(u8 code); u8 get_error_code(bool test); @@ -214,6 +216,9 @@ private: u16 m_tfifo[3]; u8 m_rfifo_head; u8 m_tfifo_head; + + // misc. state + bool m_receiver_interrupt; }; // ======================> dp8344a_device diff --git a/src/devices/cpu/e0c6200/e0c6s46.cpp b/src/devices/cpu/e0c6200/e0c6s46.cpp index 9f80774a6e5..5094c36a5f7 100644 --- a/src/devices/cpu/e0c6200/e0c6s46.cpp +++ b/src/devices/cpu/e0c6200/e0c6s46.cpp @@ -589,7 +589,7 @@ u32 e0c6s46_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!m_pixel_update_cb.isnull()) m_pixel_update_cb(bitmap, cliprect, m_lcd_contrast, seg, com, pixel); else if (cliprect.contains(seg, com)) - bitmap.pix16(com, seg) = pixel; + bitmap.pix(com, seg) = pixel; } } } diff --git a/src/devices/cpu/f8/f8dasm.cpp b/src/devices/cpu/f8/f8dasm.cpp index 24ec47b5154..e35a7d42f70 100644 --- a/src/devices/cpu/f8/f8dasm.cpp +++ b/src/devices/cpu/f8/f8dasm.cpp @@ -17,33 +17,22 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ { offs_t base_pc = pc; uint8_t op = opcodes.r8(pc++); + offs_t flags = SUPPORTED; switch( op ) { /* opcode bitmask */ case 0x00: /* 0000 0000 */ - util::stream_format(stream, "LR A,KU"); - break; case 0x01: /* 0000 0001 */ - util::stream_format(stream, "LR A,KL"); - break; case 0x02: /* 0000 0010 */ - util::stream_format(stream, "LR A,QU"); - break; case 0x03: /* 0000 0011 */ - util::stream_format(stream, "LR A,QL"); + util::stream_format(stream, "LR A,%s", rname[op + 12]); break; case 0x04: /* 0000 0100 */ - util::stream_format(stream, "LR KU,A"); - break; case 0x05: /* 0000 0101 */ - util::stream_format(stream, "LR KL,A"); - break; case 0x06: /* 0000 0110 */ - util::stream_format(stream, "LR QU,A"); - break; case 0x07: /* 0000 0111 */ - util::stream_format(stream, "LR QL,A"); + util::stream_format(stream, "LR %s,A", rname[(op - 0x04) + 12]); break; case 0x08: /* 0000 1000 */ @@ -60,7 +49,8 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ break; case 0x0c: /* 0000 1100 */ - util::stream_format(stream, "PK") ; + util::stream_format(stream, "PK"); + flags |= STEP_OUT; break; case 0x0d: /* 0000 1101 */ util::stream_format(stream, "LR P0,Q"); @@ -109,6 +99,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ break; case 0x1c: /* 0001 1100 */ util::stream_format(stream, "POP"); + flags |= STEP_OUT; break; case 0x1d: /* 0001 1101 */ util::stream_format(stream, "LR W,J"); @@ -120,39 +111,40 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "INC"); break; case 0x20: /* 0010 0000 */ - util::stream_format(stream, "LI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "LI H'%02X'", opcodes.r8(pc++)); break; case 0x21: /* 0010 0001 */ - util::stream_format(stream, "NI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "NI H'%02X'", opcodes.r8(pc++)); break; case 0x22: /* 0010 0010 */ - util::stream_format(stream, "OI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "OI H'%02X'", opcodes.r8(pc++)); break; case 0x23: /* 0010 0011 */ - util::stream_format(stream, "XI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "XI H'%02X'", opcodes.r8(pc++)); break; case 0x24: /* 0010 0100 */ - util::stream_format(stream, "AI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "AI H'%02X'", opcodes.r8(pc++)); break; case 0x25: /* 0010 0101 */ - util::stream_format(stream, "CI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "CI H'%02X'", opcodes.r8(pc++)); break; case 0x26: /* 0010 0110 */ - util::stream_format(stream, "IN $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "IN H'%02X'", opcodes.r8(pc++)); break; case 0x27: /* 0010 0111 */ - util::stream_format(stream, "OUT $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "OUT H'%02X'", opcodes.r8(pc++)); break; case 0x28: /* 0010 1000 */ - util::stream_format(stream, "PI $%04X", opcodes.r16(pc)); + util::stream_format(stream, "PI H'%04X'", opcodes.r16(pc)); pc += 2; + flags |= STEP_OVER; break; case 0x29: /* 0010 1001 */ - util::stream_format(stream, "JMP $%04X", opcodes.r16(pc)); + util::stream_format(stream, "JMP H'%04X'", opcodes.r16(pc)); pc += 2; break; case 0x2a: /* 0010 1010 */ - util::stream_format(stream, "DCI $%04X", opcodes.r16(pc)); + util::stream_format(stream, "DCI H'%04X'", opcodes.r16(pc)); pc += 2; break; case 0x2b: /* 0010 1011 */ @@ -161,11 +153,9 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x2c: /* 0010 1100 */ util::stream_format(stream, "XDC"); break; - case 0x2d: /* 0010 1101 */ - case 0x2e: /* 0010 1110 */ - case 0x2f: /* 0010 1111 */ - util::stream_format(stream, "??? $%02X",op); - break; + /* case 0x2d: 0010 1101 */ + /* case 0x2e: 0010 1110 */ + /* case 0x2f: 0010 1111 */ case 0x30: /* 0011 0000 */ case 0x31: /* 0011 0001 */ @@ -179,20 +169,18 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x39: /* 0011 1001 */ case 0x3a: /* 0011 1010 */ case 0x3b: /* 0011 1011 */ - util::stream_format(stream, "DS %s",rname[op & 15]); + util::stream_format(stream, "DS %s", rname[op & 15]); break; case 0x3c: /* 0011 1100 */ - util::stream_format(stream, "DS (IS)"); + util::stream_format(stream, "DS S"); break; case 0x3d: /* 0011 1101 */ - util::stream_format(stream, "DS (IS++)"); + util::stream_format(stream, "DS I"); break; case 0x3e: /* 0011 1110 */ - util::stream_format(stream, "DS (IS--)"); - break; - case 0x3f: /* 0011 1111 */ - util::stream_format(stream, "??? $%02X",op); + util::stream_format(stream, "DS D"); break; + /* case 0x3f: 0011 1111 */ case 0x40: /* 0100 0000 */ case 0x41: /* 0100 0001 */ @@ -206,20 +194,18 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x49: /* 0100 1001 */ case 0x4a: /* 0100 1010 */ case 0x4b: /* 0100 1011 */ - util::stream_format(stream, "LR A,%s",rname[op & 15]); + util::stream_format(stream, "LR A,%s", rname[op & 15]); break; case 0x4c: /* 0100 1100 */ - util::stream_format(stream, "LR A,(IS)"); + util::stream_format(stream, "LR A,S"); break; case 0x4d: /* 0100 1101 */ - util::stream_format(stream, "LR A,(IS++)"); + util::stream_format(stream, "LR A,I"); break; case 0x4e: /* 0100 1110 */ - util::stream_format(stream, "LR A,(IS--)"); - break; - case 0x4f: /* 0100 1111 */ - util::stream_format(stream, "??? $%02X",op); + util::stream_format(stream, "LR A,D"); break; + /* case 0x4f: 0100 1111 */ case 0x50: /* 0101 0000 */ case 0x51: /* 0101 0001 */ @@ -233,20 +219,18 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x59: /* 0101 1001 */ case 0x5a: /* 0101 1010 */ case 0x5b: /* 0101 1011 */ - util::stream_format(stream, "LR %s,A",rname[op & 15]); + util::stream_format(stream, "LR %s,A", rname[op & 15]); break; case 0x5c: /* 0101 1100 */ - util::stream_format(stream, "LR (IS),A"); + util::stream_format(stream, "LR S,A"); break; case 0x5d: /* 0101 1101 */ - util::stream_format(stream, "LR (IS++),A"); + util::stream_format(stream, "LR I,A"); break; case 0x5e: /* 0101 1110 */ - util::stream_format(stream, "LR (IS--),A"); - break; - case 0x5f: /* 0101 1111 */ - util::stream_format(stream, "??? $%02X",op); + util::stream_format(stream, "LR D,A"); break; + /* case 0x5f: 0101 1111 */ case 0x60: /* 0110 0000 */ case 0x61: /* 0110 0001 */ @@ -256,7 +240,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x65: /* 0110 0101 */ case 0x66: /* 0110 0110 */ case 0x67: /* 0110 0111 */ - util::stream_format(stream, "LISU $%02X", op & 0x07); + util::stream_format(stream, "LISU %d", op & 0x07); break; case 0x68: /* 0110 1000 */ case 0x69: /* 0110 1001 */ @@ -266,7 +250,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x6d: /* 0110 1101 */ case 0x6e: /* 0110 1110 */ case 0x6f: /* 0110 1111 */ - util::stream_format(stream, "LISL $%02X", op & 0x07); + util::stream_format(stream, "LISL %d", op & 0x07); break; case 0x70: /* 0111 0000 */ @@ -285,27 +269,27 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x7d: /* 0111 1101 */ case 0x7e: /* 0111 1110 */ case 0x7f: /* 0111 1111 */ - util::stream_format(stream, "LIS $%02X", op & 0x0f); + util::stream_format(stream, "LIS H'%02X'", op & 0x0f); break; case 0x81: /* 1000 0001 */ case 0x85: /* 1000 0101 */ - util::stream_format(stream, "BP $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BP H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x82: /* 1000 0010 */ - util::stream_format(stream, "BC $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BC H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x84: /* 1000 0100 */ - util::stream_format(stream, "BZ $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BZ H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x80: /* 1000 0000 */ case 0x83: /* 1000 0011 */ case 0x86: /* 1000 0110 */ case 0x87: /* 1000 0111 */ - util::stream_format(stream, "BT $%02X,$%04X", op & 0x07, base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BT H'%02X',H'%04X'", op & 0x07, base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x88: /* 1000 1000 */ @@ -337,28 +321,28 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ break; case 0x8f: /* 1000 1111 */ - util::stream_format(stream, "BR7 $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BR7 H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x90: /* 1001 0000 */ - util::stream_format(stream, "BR $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BR H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x91: /* 1001 0001 */ case 0x95: /* 1001 0101 */ - util::stream_format(stream, "BM $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BM H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x92: /* 1001 0010 */ - util::stream_format(stream, "BNC $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BNC H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x94: /* 1001 0100 */ - util::stream_format(stream, "BNZ $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BNZ H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x98: /* 1001 1000 */ - util::stream_format(stream, "BNO $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BNO H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x93: /* 1001 0011 */ @@ -371,18 +355,16 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x9d: /* 1001 1101 */ case 0x9e: /* 1001 1110 */ case 0x9f: /* 1001 1111 */ - util::stream_format(stream, "BF $%02X,$%04X", op & 0x0f, base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BF H'%02X',H'%04X'", op & 0x0f, base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0xa0: /* 1010 0000 */ case 0xa1: /* 1010 0001 */ - util::stream_format(stream, "INS $%02X", (unsigned) (int8_t) (op & 0x0F)); + util::stream_format(stream, "INS %d", op & 0x0f); break; - case 0xa2: /* 1010 0010 */ - case 0xa3: /* 1010 0011 */ - util::stream_format(stream, "??? $%02X", op); - break; + /* case 0xa2: 1010 0010 */ + /* case 0xa3: 1010 0011 */ case 0xa4: /* 1010 0100 */ case 0xa5: /* 1010 0101 */ @@ -396,18 +378,16 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0xad: /* 1010 1101 */ case 0xae: /* 1010 1110 */ case 0xaf: /* 1010 1111 */ - util::stream_format(stream, "INS $%02X", (int8_t) op & 0x0f); + util::stream_format(stream, "INS H'%02X'", op & 0x0f); break; case 0xb0: /* 1011 0000 */ case 0xb1: /* 1011 0001 */ - util::stream_format(stream, "OUTS $%02X", (int8_t) op & 0x0f); + util::stream_format(stream, "OUTS %d", op & 0x0f); break; - case 0xb2: /* 1011 0010 */ - case 0xb3: /* 1011 0011 */ - util::stream_format(stream, "??? $%02X", op); - break; + /* case 0xb2: 1011 0010 */ + /* case 0xb3: 1011 0011 */ case 0xb4: /* 1011 0100 */ case 0xb5: /* 1011 0101 */ @@ -421,7 +401,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0xbd: /* 1011 1101 */ case 0xbe: /* 1011 1110 */ case 0xbf: /* 1011 1111 */ - util::stream_format(stream, "OUTS $%02X", (unsigned) (int8_t) op & 0x0f); + util::stream_format(stream, "OUTS H'%02X'", op & 0x0f); break; case 0xc0: /* 1100 0000 */ @@ -439,17 +419,15 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "AS %s", rname[op & 15]); break; case 0xcc: /* 1100 1100 */ - util::stream_format(stream, "AS (IS)"); + util::stream_format(stream, "AS S"); break; case 0xcd: /* 1100 1101 */ - util::stream_format(stream, "AS (IS++)"); + util::stream_format(stream, "AS I"); break; case 0xce: /* 1100 1110 */ - util::stream_format(stream, "AS (IS--)"); - break; - case 0xcf: /* 1100 1111 */ - util::stream_format(stream, "??? $%02X", op); + util::stream_format(stream, "AS D"); break; + /* case 0xcf: 1100 1111 */ case 0xd0: /* 1101 0000 */ case 0xd1: /* 1101 0001 */ @@ -466,17 +444,15 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "ASD %s", rname[op & 15]); break; case 0xdc: /* 1101 1100 */ - util::stream_format(stream, "ASD (IS)"); + util::stream_format(stream, "ASD S"); break; case 0xdd: /* 1101 1101 */ - util::stream_format(stream, "ASD (IS++)"); + util::stream_format(stream, "ASD I"); break; case 0xde: /* 1101 1110 */ - util::stream_format(stream, "ASD (IS--)"); - break; - case 0xdf: /* 1101 1111 */ - util::stream_format(stream, "??? $%02X", op); + util::stream_format(stream, "ASD D"); break; + /* case 0xdf: 1101 1111 */ case 0xe0: /* 1110 0000 */ case 0xe1: /* 1110 0001 */ @@ -493,17 +469,15 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "XS %s", rname[op & 15]); break; case 0xec: /* 1110 1100 */ - util::stream_format(stream, "XS (IS)"); + util::stream_format(stream, "XS S"); break; case 0xed: /* 1110 1101 */ - util::stream_format(stream, "XS (IS++)"); + util::stream_format(stream, "XS I"); break; case 0xee: /* 1110 1110 */ - util::stream_format(stream, "XS (IS--)"); - break; - case 0xef: /* 1110 1111 */ - util::stream_format(stream, "??? $%02X", op); + util::stream_format(stream, "XS D"); break; + /* case 0xef: 1110 1111 */ case 0xf0: /* 1111 0000 */ @@ -521,18 +495,21 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "NS %s", rname[op & 15]); break; case 0xfc: /* 1111 1100 */ - util::stream_format(stream, "NS (IS)"); + util::stream_format(stream, "NS S"); break; case 0xfd: /* 1111 1101 */ - util::stream_format(stream, "NS (IS++)"); + util::stream_format(stream, "NS I"); break; case 0xfe: /* 1111 1110 */ - util::stream_format(stream, "NS (IS--)"); + util::stream_format(stream, "NS D"); break; - case 0xff: /* 1111 1111 */ - util::stream_format(stream, "??? $%02X", op); + /* case 0xff: 1111 1111 */ + + + default: + util::stream_format(stream, "DC H'%02X' (?)", op); break; } - return pc - base_pc; + return (pc - base_pc) | flags; } diff --git a/src/devices/cpu/lc58/lc58d.cpp b/src/devices/cpu/lc58/lc58d.cpp new file mode 100644 index 00000000000..477ee00ffb0 --- /dev/null +++ b/src/devices/cpu/lc58/lc58d.cpp @@ -0,0 +1,160 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// LC58 generic disassembler + +#include "emu.h" +#include "lc58d.h" + +u32 lc58_disassembler::opcode_alignment() const +{ + return 1; +} + +#define P std::ostream &stream, const lc58_disassembler *d, u16 opcode +const lc58_disassembler::instruction lc58_disassembler::instructions[] { + { 0x5a00, 0xffff, [](P) -> u32 { util::stream_format(stream, "cla"); return 1; } }, + { 0xec01, 0xffff, [](P) -> u32 { util::stream_format(stream, "rcf"); return 1; } }, + { 0xe801, 0xffff, [](P) -> u32 { util::stream_format(stream, "scf"); return 1; } }, + { 0x6000, 0xfc00, [](P) -> u32 { util::stream_format(stream, "mrw wr%x, %02x", (opcode >> 7) & 7, opcode & 0x7f); return 1; } }, + { 0x6400, 0xfc00, [](P) -> u32 { util::stream_format(stream, "mwr %02x, wr%x", opcode & 0x7f, (opcode >> 7) & 7); return 1; } }, + { 0x6800, 0xff80, [](P) -> u32 { util::stream_format(stream, "sr0 %02x", opcode & 0x7f); return 1; } }, + { 0x6900, 0xff80, [](P) -> u32 { util::stream_format(stream, "sr1 %02x", opcode & 0x7f); return 1; } }, + { 0x6a00, 0xff80, [](P) -> u32 { util::stream_format(stream, "sl0 %02x", opcode & 0x7f); return 1; } }, + { 0x6b00, 0xff80, [](P) -> u32 { util::stream_format(stream, "sl1 %02x", opcode & 0x7f); return 1; } }, + { 0x6c00, 0xff80, [](P) -> u32 { util::stream_format(stream, "rar %02x", opcode & 0x7f); return 1; } }, + { 0x6e00, 0xff80, [](P) -> u32 { util::stream_format(stream, "ral %02x", opcode & 0x7f); return 1; } }, + { 0x7400, 0xff80, [](P) -> u32 { util::stream_format(stream, "maf %02x", opcode & 0x7f); return 1; } }, + { 0x0f80, 0xff80, [](P) -> u32 { util::stream_format(stream, "mra %02x", opcode & 0x7f); return 1; } }, + + { 0x4000, 0xff80, [](P) -> u32 { util::stream_format(stream, "adc %02x", opcode & 0x7f); return 1; } }, + { 0x4100, 0xff80, [](P) -> u32 { util::stream_format(stream, "adc* %02x", opcode & 0x7f); return 1; } }, + { 0x4200, 0xff80, [](P) -> u32 { util::stream_format(stream, "sbc %02x", opcode & 0x7f); return 1; } }, + { 0x4300, 0xff80, [](P) -> u32 { util::stream_format(stream, "sbc* %02x", opcode & 0x7f); return 1; } }, + { 0x4400, 0xff80, [](P) -> u32 { util::stream_format(stream, "add %02x", opcode & 0x7f); return 1; } }, + { 0x4500, 0xff80, [](P) -> u32 { util::stream_format(stream, "add* %02x", opcode & 0x7f); return 1; } }, + { 0x4600, 0xff80, [](P) -> u32 { util::stream_format(stream, "sub %02x", opcode & 0x7f); return 1; } }, + { 0x4700, 0xff80, [](P) -> u32 { util::stream_format(stream, "sub* %02x", opcode & 0x7f); return 1; } }, + { 0x4800, 0xff80, [](P) -> u32 { util::stream_format(stream, "adn %02x", opcode & 0x7f); return 1; } }, + { 0x4900, 0xff80, [](P) -> u32 { util::stream_format(stream, "adn* %02x", opcode & 0x7f); return 1; } }, + { 0x4a00, 0xff80, [](P) -> u32 { util::stream_format(stream, "and %02x", opcode & 0x7f); return 1; } }, + { 0x4b00, 0xff80, [](P) -> u32 { util::stream_format(stream, "and* %02x", opcode & 0x7f); return 1; } }, + { 0x4c00, 0xff80, [](P) -> u32 { util::stream_format(stream, "eor %02x", opcode & 0x7f); return 1; } }, + { 0x4d00, 0xff80, [](P) -> u32 { util::stream_format(stream, "eor* %02x", opcode & 0x7f); return 1; } }, + { 0x4e00, 0xff80, [](P) -> u32 { util::stream_format(stream, "or %02x", opcode & 0x7f); return 1; } }, + { 0x4f00, 0xff80, [](P) -> u32 { util::stream_format(stream, "or* %02x", opcode & 0x7f); return 1; } }, + { 0x5000, 0xff00, [](P) -> u32 { util::stream_format(stream, "adci #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5100, 0xff00, [](P) -> u32 { util::stream_format(stream, "adci* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5200, 0xff00, [](P) -> u32 { util::stream_format(stream, "sbci #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5300, 0xff00, [](P) -> u32 { util::stream_format(stream, "sbci* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5400, 0xff00, [](P) -> u32 { util::stream_format(stream, "addi #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5500, 0xff00, [](P) -> u32 { util::stream_format(stream, "addi* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5600, 0xff00, [](P) -> u32 { util::stream_format(stream, "subi #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5700, 0xff00, [](P) -> u32 { util::stream_format(stream, "subi* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5800, 0xff00, [](P) -> u32 { util::stream_format(stream, "adni #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5900, 0xff00, [](P) -> u32 { util::stream_format(stream, "adni* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5a00, 0xff00, [](P) -> u32 { util::stream_format(stream, "andi #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5b00, 0xff00, [](P) -> u32 { util::stream_format(stream, "andi* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5c00, 0xff00, [](P) -> u32 { util::stream_format(stream, "eori #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5d00, 0xff00, [](P) -> u32 { util::stream_format(stream, "eori* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5e00, 0xff00, [](P) -> u32 { util::stream_format(stream, "ori #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5f00, 0xff00, [](P) -> u32 { util::stream_format(stream, "ori* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + + { 0x7700, 0xff80, [](P) -> u32 { util::stream_format(stream, "mdpl %02x", opcode & 0x7f); return 1; } }, + { 0x7680, 0xff80, [](P) -> u32 { util::stream_format(stream, "mdph %02x", opcode & 0x7f); return 1; } }, + { 0x6b80, 0xff80, [](P) -> u32 { util::stream_format(stream, "mrdl %02x", opcode & 0x7f); return 1; } }, + { 0x6980, 0xff80, [](P) -> u32 { util::stream_format(stream, "mrdh %02x", opcode & 0x7f); return 1; } }, + { 0x6a80, 0xff80, [](P) -> u32 { util::stream_format(stream, "mrsp %02x", opcode & 0x7f); return 1; } }, + { 0xe800, 0xfc00, [](P) -> u32 { util::stream_format(stream, "sf1 %03x", opcode & 0x3ff); return 1; } }, + { 0xec00, 0xfc00, [](P) -> u32 { util::stream_format(stream, "rf1 %03x", opcode & 0x3ff); return 1; } }, + { 0xf000, 0xfc00, [](P) -> u32 { util::stream_format(stream, "sf2 %03x", opcode & 0x3ff); return 1; } }, + { 0xf400, 0xfc00, [](P) -> u32 { util::stream_format(stream, "rf2 %03x", opcode & 0x3ff); return 1; } }, + { 0xe880, 0xffff, [](P) -> u32 { util::stream_format(stream, "sdpf"); return 1; } }, + { 0xec80, 0xffff, [](P) -> u32 { util::stream_format(stream, "rdpf"); return 1; } }, + + { 0x7780, 0xff80, [](P) -> u32 { util::stream_format(stream, "sta %02x", opcode & 0x7f); return 1; } }, + { 0x7800, 0xf800, [](P) -> u32 { util::stream_format(stream, "lds %02x, #%x", opcode & 0x7f, (opcode >> 7) & 0xf); return 1; } }, + { 0x6880, 0xff80, [](P) -> u32 { util::stream_format(stream, "lda %02x", opcode & 0x7f); return 1; } }, + + { 0xff00, 0xffff, [](P) -> u32 { util::stream_format(stream, "halt"); return 1; } }, + { 0xe000, 0xffc0, [](P) -> u32 { util::stream_format(stream, "ssw %02x", opcode & 0x3f); return 1; } }, + { 0xfa00, 0xfe00, [](P) -> u32 { util::stream_format(stream, "sie %03x", opcode & 0x1ff); return 1 | STEP_OVER; } }, + { 0xfe00, 0xfff0, [](P) -> u32 { util::stream_format(stream, "sie* %x", opcode & 0xf); return 1 | STEP_OVER; } }, + { 0x7580, 0xff80, [](P) -> u32 { util::stream_format(stream, "msb %02x", opcode & 0x7f); return 1; } }, + { 0x7600, 0xff80, [](P) -> u32 { util::stream_format(stream, "msc %02x", opcode & 0x7f); return 1; } }, + { 0x0000, 0xffff, [](P) -> u32 { util::stream_format(stream, "nop"); return 1; } }, + { 0xf018, 0xffff, [](P) -> u32 { util::stream_format(stream, "lon"); return 1; } }, + { 0xf418, 0xffff, [](P) -> u32 { util::stream_format(stream, "loff"); return 1; } }, + { 0xf004, 0xffff, [](P) -> u32 { util::stream_format(stream, "sbak"); return 1; } }, + { 0xf404, 0xffff, [](P) -> u32 { util::stream_format(stream, "rbak"); return 1; } }, + + { 0x7480, 0xff80, [](P) -> u32 { util::stream_format(stream, "mcd %02x", opcode & 0x7f); return 1; } }, + { 0x7500, 0xff80, [](P) -> u32 { util::stream_format(stream, "mcf %02x", opcode & 0x7f); return 1; } }, + { 0xfc22, 0xffff, [](P) -> u32 { util::stream_format(stream, "ccc"); return 1; } }, + { 0xfc40, 0xffff, [](P) -> u32 { util::stream_format(stream, "rlp"); return 1; } }, + { 0xfc80, 0xffff, [](P) -> u32 { util::stream_format(stream, "csp"); return 1; } }, + { 0xfb00, 0xffff, [](P) -> u32 { util::stream_format(stream, "cst"); return 1; } }, + { 0xe802, 0xffff, [](P) -> u32 { util::stream_format(stream, "scex"); return 1; } }, + { 0xec02, 0xffff, [](P) -> u32 { util::stream_format(stream, "rcex"); return 1; } }, + { 0xf000, 0xfffc, [](P) -> u32 { util::stream_format(stream, "schf %x", opcode & 3); return 1; } }, + { 0xf400, 0xfffc, [](P) -> u32 { util::stream_format(stream, "rchf %x", opcode & 3); return 1; } }, + + { 0x7180, 0xff80, [](P) -> u32 { util::stream_format(stream, "ipp %02x", opcode & 0x7f); return 1; } }, + { 0x7000, 0xff80, [](P) -> u32 { util::stream_format(stream, "ips %02x", opcode & 0x7f); return 1; } }, + { 0x7080, 0xff80, [](P) -> u32 { util::stream_format(stream, "ipm %02x", opcode & 0x7f); return 1; } }, + { 0x7100, 0xff80, [](P) -> u32 { util::stream_format(stream, "ipk %02x", opcode & 0x7f); return 1; } }, + { 0x0080, 0xff80, [](P) -> u32 { util::stream_format(stream, "opp %02x", opcode & 0x7f); return 1; } }, + { 0x0f00, 0xff80, [](P) -> u32 { util::stream_format(stream, "opm %02x", opcode & 0x7f); return 1; } }, + { 0xe804, 0xffff, [](P) -> u32 { util::stream_format(stream, "sct1"); return 1; } }, + { 0xec04, 0xffff, [](P) -> u32 { util::stream_format(stream, "rct1"); return 1; } }, + { 0xf200, 0xffff, [](P) -> u32 { util::stream_format(stream, "sct2"); return 1; } }, + { 0xf600, 0xffff, [](P) -> u32 { util::stream_format(stream, "rct2"); return 1; } }, + { 0xf010, 0xffff, [](P) -> u32 { util::stream_format(stream, "slgt"); return 1; } }, + { 0xf410, 0xffff, [](P) -> u32 { util::stream_format(stream, "rlgt"); return 1; } }, + { 0xf800, 0xffff, [](P) -> u32 { util::stream_format(stream, "ras"); return 1; } }, + { 0xf800, 0xfe00, [](P) -> u32 { util::stream_format(stream, "sas %03x", opcode & 0x1ff); return 1; } }, + { 0xe800, 0xff9f, [](P) -> u32 { util::stream_format(stream, "comd %x", (opcode >> 5) & 3); return 1; } }, + { 0xec00, 0xff9f, [](P) -> u32 { util::stream_format(stream, "cimd %x", (opcode >> 5) & 3); return 1; } }, + { 0xf000, 0xfe1f, [](P) -> u32 { util::stream_format(stream, "spdf %x", (opcode >> 5) & 3); return 1; } }, + { 0xf400, 0xfe1f, [](P) -> u32 { util::stream_format(stream, "rpdf %x", (opcode >> 5) & 3); return 1; } }, + { 0xe808, 0xffff, [](P) -> u32 { util::stream_format(stream, "sfsp"); return 1; } }, + { 0xec08, 0xffff, [](P) -> u32 { util::stream_format(stream, "rfsp"); return 1; } }, + { 0x0000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrt %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + { 0x1000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrb %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + { 0x2000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrc %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + { 0x3000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrp %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + + { 0xc000, 0xf800, [](P) -> u32 { util::stream_format(stream, "jmp %03x", opcode & 0x7ff); return 1; } }, + { 0x8000, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab0 %03x", opcode & 0x7ff); return 1; } }, + { 0x8800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab1 %03x", opcode & 0x7ff); return 1; } }, + { 0x9000, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab2 %03x", opcode & 0x7ff); return 1; } }, + { 0x9800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab3 %03x", opcode & 0x7ff); return 1; } }, + { 0xa000, 0xf800, [](P) -> u32 { util::stream_format(stream, "banz %03x", opcode & 0x7ff); return 1; } }, + { 0xb000, 0xf800, [](P) -> u32 { util::stream_format(stream, "baz %03x", opcode & 0x7ff); return 1; } }, + { 0xa800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bcnh %03x", opcode & 0x7ff); return 1; } }, + { 0xb800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bch %03x", opcode & 0x7ff); return 1; } }, + + { 0xc800, 0xf800, [](P) -> u32 { util::stream_format(stream, "call %03x", opcode & 0x7ff); return 1 | STEP_OVER; } }, + { 0xd000, 0xffff, [](P) -> u32 { util::stream_format(stream, "rts"); return 1 | STEP_OUT; } }, + { 0xd800, 0xffff, [](P) -> u32 { util::stream_format(stream, "pop"); return 1; } }, + + { 0xe400, 0xfc00, [](P) -> u32 { util::stream_format(stream, "stm %03x", opcode & 0x7ff); return 1; } }, + { 0xfc04, 0xffff, [](P) -> u32 { util::stream_format(stream, "rtm"); return 1 | STEP_OUT; } }, + { 0xf810, 0xffff, [](P) -> u32 { util::stream_format(stream, "sfpd"); return 1 | STEP_OUT; } }, + { 0xfc10, 0xffff, [](P) -> u32 { util::stream_format(stream, "rfpd"); return 1 | STEP_OUT; } }, + { 0xfc00, 0xfe00, [](P) -> u32 { util::stream_format(stream, "plc %03x", opcode & 0x1ff); return 1 | STEP_OVER; } }, + + { 0x0000, 0x0000, [](P) -> u32 { util::stream_format(stream, "?%04x", opcode); return 1; } }, +}; + +#undef P + +offs_t lc58_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) +{ + u16 opcode = opcodes.r16(pc); + + for(u32 i=0;; i++) + if((opcode & instructions[i].mask) == instructions[i].value) + return instructions[i].cb(stream, this, opcode) | SUPPORTED; + return 0; +} diff --git a/src/devices/cpu/lc58/lc58d.h b/src/devices/cpu/lc58/lc58d.h new file mode 100644 index 00000000000..6a570c10f02 --- /dev/null +++ b/src/devices/cpu/lc58/lc58d.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// Sanyo LC58 generic disassembler + +#ifndef MAME_CPU_LC58_LC58D_H +#define MAME_CPU_LC58_LC58D_H + +#pragma once + +class lc58_disassembler : public util::disasm_interface +{ +public: + lc58_disassembler() = default; + virtual ~lc58_disassembler() = default; + + virtual u32 opcode_alignment() const override; + virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; + +private: + struct instruction { + u16 value; + u16 mask; + u32 (*cb)(std::ostream &, const lc58_disassembler *, u16); + }; + + static const instruction instructions[]; +}; + +#endif // MAME_CPU_LC58_LC58D_H diff --git a/src/devices/cpu/m6502/n2a03.cpp b/src/devices/cpu/m6502/n2a03.cpp index f303f1bf1b6..e1731b62e75 100644 --- a/src/devices/cpu/m6502/n2a03.cpp +++ b/src/devices/cpu/m6502/n2a03.cpp @@ -12,6 +12,7 @@ #include "n2a03.h" #include "n2a03d.h" +DEFINE_DEVICE_TYPE(N2A03_CORE, n2a03_core_device, "n2a03_core", "Ricoh N2A03 core") // needed for some VT systems with XOP instead of standard APU DEFINE_DEVICE_TYPE(N2A03, n2a03_device, "n2a03", "Ricoh N2A03") uint8_t n2a03_device::psg1_4014_r() @@ -51,15 +52,29 @@ void n2a03_device::n2a03_map(address_map &map) +n2a03_core_device::n2a03_core_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : m6502_device(mconfig, type, tag, owner, clock) +{ +} + +n2a03_core_device::n2a03_core_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : n2a03_core_device(mconfig, N2A03_CORE, tag, owner, clock) +{ +} + + + n2a03_device::n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m6502_device(mconfig, N2A03, tag, owner, clock) + : n2a03_core_device(mconfig, N2A03, tag, owner, clock) , device_mixer_interface(mconfig, *this, 1) , m_apu(*this, "nesapu") { program_config.m_internal_map = address_map_constructor(FUNC(n2a03_device::n2a03_map), this); } -std::unique_ptr<util::disasm_interface> n2a03_device::create_disassembler() + + +std::unique_ptr<util::disasm_interface> n2a03_core_device::create_disassembler() { return std::make_unique<n2a03_disassembler>(); } diff --git a/src/devices/cpu/m6502/n2a03.h b/src/devices/cpu/m6502/n2a03.h index 5a57bcbed2b..4232093c7a5 100644 --- a/src/devices/cpu/m6502/n2a03.h +++ b/src/devices/cpu/m6502/n2a03.h @@ -15,22 +15,18 @@ #include "m6502.h" #include "sound/nes_apu.h" -class n2a03_device : public m6502_device, public device_mixer_interface { +class n2a03_core_device : public m6502_device { public: - n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + n2a03_core_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; virtual void do_exec_full() override; virtual void do_exec_partial() override; - uint8_t psg1_4014_r(); - uint8_t psg1_4015_r(); - void psg1_4015_w(uint8_t data); - void psg1_4017_w(uint8_t data); - - void n2a03_map(address_map &map); protected: + n2a03_core_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + #define O(o) void o ## _full(); void o ## _partial() // n2a03 opcodes - same as 6502 with D disabled @@ -42,6 +38,21 @@ protected: #undef O +private: +}; + +class n2a03_device : public n2a03_core_device, public device_mixer_interface { +public: + n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint8_t psg1_4014_r(); + uint8_t psg1_4015_r(); + void psg1_4015_w(uint8_t data); + void psg1_4017_w(uint8_t data); + + void n2a03_map(address_map &map); +protected: + required_device<nesapu_device> m_apu; virtual void device_add_mconfig(machine_config &config) override; @@ -52,6 +63,7 @@ private: }; + /* These are the official XTAL values and clock rates used by Nintendo for manufacturing throughout the production of the 2A03. PALC_APU_CLOCK is the clock rate devised by UMC(?) for PAL Famicom clone hardware. */ @@ -69,6 +81,7 @@ enum { N2A03_SET_OVERFLOW = m6502_device::V_LINE }; +DECLARE_DEVICE_TYPE(N2A03_CORE, n2a03_core_device) DECLARE_DEVICE_TYPE(N2A03, n2a03_device) #endif // MAME_CPU_M6502_N2A03_H diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp index 58f3d31b150..7aabcc4348a 100644 --- a/src/devices/cpu/mcs48/mcs48.cpp +++ b/src/devices/cpu/mcs48/mcs48.cpp @@ -15,6 +15,7 @@ - add special 8022 opcodes (RAD, SEL AN0, SEL AN1, RETI) - according to the user manual, some opcodes(dis/enable timer/interrupt) don't increment the timer, does it affect the prescaler too? + - IRQ timing is hacked due to WY-100 needing to take JNI branch before servicing interrupt **************************************************************************** @@ -517,7 +518,7 @@ void mcs48_cpu_device::execute_call(uint16_t address) conditional jump instruction -------------------------------------------------*/ -void mcs48_cpu_device::execute_jcc(uint8_t result) +void mcs48_cpu_device::execute_jcc(bool result) { uint16_t pch = m_pc & 0xf00; uint8_t offset = argument_fetch(); @@ -747,8 +748,8 @@ OPHANDLER( jc ) { burn_cycles(2); execute_jcc((m_psw & C_FLAG) != 0) OPHANDLER( jf0 ) { burn_cycles(2); execute_jcc((m_psw & F_FLAG) != 0); } OPHANDLER( jf1 ) { burn_cycles(2); execute_jcc((m_sts & STS_F1) != 0); } OPHANDLER( jnc ) { burn_cycles(2); execute_jcc((m_psw & C_FLAG) == 0); } -OPHANDLER( jni ) { burn_cycles(2); execute_jcc(m_irq_state != 0); } -OPHANDLER( jnibf ) { burn_cycles(2); execute_jcc((m_sts & STS_IBF) == 0); } +OPHANDLER( jni ) { burn_cycles(2); m_irq_polled = (m_irq_state == 0); execute_jcc(m_irq_state != 0); } +OPHANDLER( jnibf ) { burn_cycles(2); m_irq_polled = (m_sts & STS_IBF) != 0; execute_jcc((m_sts & STS_IBF) == 0); } OPHANDLER( jnt_0 ) { burn_cycles(2); execute_jcc(test_r(0) == 0); } OPHANDLER( jnt_1 ) { burn_cycles(2); execute_jcc(test_r(1) == 0); } OPHANDLER( jnz ) { burn_cycles(2); execute_jcc(m_a != 0); } @@ -1175,6 +1176,7 @@ void mcs48_cpu_device::device_start() save_item(NAME(m_dbbo)); save_item(NAME(m_irq_state)); + save_item(NAME(m_irq_polled)); save_item(NAME(m_irq_in_progress)); save_item(NAME(m_timer_overflow)); save_item(NAME(m_timer_flag)); @@ -1216,6 +1218,8 @@ void mcs48_cpu_device::device_reset() /* confirmed from interrupt logic description */ m_irq_in_progress = false; m_timer_overflow = false; + + m_irq_polled = false; } @@ -1239,6 +1243,13 @@ void mcs48_cpu_device::check_irqs() burn_cycles(2); m_irq_in_progress = true; + // force JNI to be taken (hack) + if (m_irq_polled) + { + m_pc = ((m_prevpc + 1) & 0x7ff) | (m_prevpc & 0x800); + execute_jcc(true); + } + /* transfer to location 0x03 */ push_pc_psw(); m_pc = 0x03; @@ -1324,6 +1335,10 @@ void mcs48_cpu_device::execute_run() // iterate over remaining cycles, guaranteeing at least one instruction do { + // check interrupts + check_irqs(); + m_irq_polled = false; + m_prevpc = m_pc; debugger_instruction_hook(m_pc); @@ -1331,9 +1346,6 @@ void mcs48_cpu_device::execute_run() unsigned opcode = opcode_fetch(); (this->*m_opcode_table[opcode])(); - // check interrupts - check_irqs(); - } while (m_icount > 0); } diff --git a/src/devices/cpu/mcs48/mcs48.h b/src/devices/cpu/mcs48/mcs48.h index fb78f63cc14..024c084c7f4 100644 --- a/src/devices/cpu/mcs48/mcs48.h +++ b/src/devices/cpu/mcs48/mcs48.h @@ -199,6 +199,7 @@ protected: uint8_t m_dbbo; /* 8-bit output data buffer (UPI-41 only) */ bool m_irq_state; /* true if the IRQ line is active */ + bool m_irq_polled; /* true if last instruction was JNI (and not taken) */ bool m_irq_in_progress; /* true if an IRQ is in progress */ bool m_timer_overflow; /* true on a timer overflow; cleared by taking interrupt */ bool m_timer_flag; /* true on a timer overflow; cleared on JTF */ @@ -257,7 +258,7 @@ protected: void execute_addc(uint8_t dat); void execute_jmp(uint16_t address); void execute_call(uint16_t address); - void execute_jcc(uint8_t result); + void execute_jcc(bool result); uint8_t p2_mask(); void expander_operation(expander_op operation, uint8_t port); void check_irqs(); diff --git a/src/devices/cpu/ns32000/ns32000.cpp b/src/devices/cpu/ns32000/ns32000.cpp index 4b796f8f345..acfddfcdd29 100644 --- a/src/devices/cpu/ns32000/ns32000.cpp +++ b/src/devices/cpu/ns32000/ns32000.cpp @@ -14,14 +14,14 @@ DEFINE_DEVICE_TYPE(NS32032, ns32032_device, "ns32032", "National Semiconductor N /* * TODO: * - prefetch queue - * - fetch/ea/data/rmw cycles + * - fetch/ea/data/rmw bus cycles * - address translation/abort - * - floating point and other unimplemented instructions + * - unimplemented instructions * - format 6: subp,addp - * - format 7: cmpm * - format 8: movus/movsu + * - format 14: rdval,wrval,lmr,smr * - cascaded interrupts - * - instruction cycles + * - opcode/operand/memory clock cycles * - 32332, 32532 */ @@ -71,22 +71,15 @@ enum trap_type : unsigned UND = 10, // undefined opcode }; -enum size_code : unsigned -{ - SIZE_B = 0, - SIZE_W = 1, - SIZE_D = 3, - SIZE_Q = 7, -}; - static const u32 size_mask[] = { 0x000000ffU, 0x0000ffffU, 0x00000000U, 0xffffffffU }; #define SP ((m_psr & PSR_S) ? m_sp1 : m_sp0) -ns32000_device::ns32000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits) +template <int Width>ns32000_device<Width>::ns32000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits) : cpu_device(mconfig, type, tag, owner, clock) , m_program_config("program", ENDIANNESS_LITTLE, databits, addrbits, 0) , m_interrupt_config("interrupt", ENDIANNESS_LITTLE, databits, addrbits, 0) + , m_fpu(*this, finder_base::DUMMY_TAG) , m_icount(0) { } @@ -106,7 +99,7 @@ ns32032_device::ns32032_device(const machine_config &mconfig, const char *tag, d { } -void ns32000_device::device_start() +template <int Width> void ns32000_device<Width>::device_start() { set_icountptr(m_icount); @@ -132,27 +125,27 @@ void ns32000_device::device_start() state_add(STATE_GENFLAGS, "GENFLAGS", m_psr).mask(0xfe7).formatstr("%10s").noshow(); // dedicated registers - int const reg_base = 16; - state_add(reg_base + 0, "PC", m_pc); - state_add(reg_base + 1, "SB", m_sb); - state_add(reg_base + 2, "FP", m_fp); - state_add(reg_base + 3, "SP1", m_sp1); - state_add(reg_base + 4, "SP0", m_sp0); - state_add(reg_base + 5, "INTBASE", m_intbase); - state_add(reg_base + 6, "PSR", m_psr); - state_add(reg_base + 7, "MOD", m_mod); - state_add(reg_base + 8, "CFG", m_cfg); + int index = 0; + state_add(index++, "PC", m_pc); + state_add(index++, "SB", m_sb); + state_add(index++, "FP", m_fp); + state_add(index++, "SP1", m_sp1); + state_add(index++, "SP0", m_sp0); + state_add(index++, "INTBASE", m_intbase); + state_add(index++, "PSR", m_psr); + state_add(index++, "MOD", m_mod); + state_add(index++, "CFG", m_cfg); // general registers for (unsigned i = 0; i < 8; i++) - state_add(i, util::string_format("R%d", i).c_str(), m_r[i]); + state_add(index++, util::string_format("R%d", i).c_str(), m_r[i]); // floating point registers - //for (unsigned i = 0; i < 8; i++) - // state_add(8 + i, util::string_format("F%d", i).c_str(), m_f[i]); + if (m_fpu) + m_fpu->state_add(*this, index); } -void ns32000_device::device_reset() +template <int Width> void ns32000_device<Width>::device_reset() { for (std::pair<int, address_space_config const *> s : memory_space_config()) space(has_configured_map(s.first) ? s.first : 0).cache(m_bus[s.first]); @@ -166,7 +159,7 @@ void ns32000_device::device_reset() m_wait = false; } -void ns32000_device::state_string_export(device_state_entry const &entry, std::string &str) const +template <int Width> void ns32000_device<Width>::state_string_export(device_state_entry const &entry, std::string &str) const { switch (entry.index()) { @@ -186,7 +179,7 @@ void ns32000_device::state_string_export(device_state_entry const &entry, std::s } } -s32 ns32000_device::displacement(unsigned &bytes) +template <int Width> s32 ns32000_device<Width>::displacement(unsigned &bytes) { s32 disp = space(0).read_byte(m_pc + bytes); if (BIT(disp, 7)) @@ -214,7 +207,7 @@ s32 ns32000_device::displacement(unsigned &bytes) return disp; } -void ns32000_device::decode(addr_mode *mode, unsigned imm_size, unsigned &bytes) +template <int Width> void ns32000_device<Width>::decode(addr_mode *mode, unsigned &bytes) { bool scaled[] = { false, false }; @@ -277,12 +270,14 @@ void ns32000_device::decode(addr_mode *mode, unsigned imm_size, unsigned &bytes) break; case 0x14: // immediate - switch (imm_size) + switch (mode[i].size) { - case SIZE_B: mode[i].base = space(0).read_byte(m_pc + bytes); bytes += 1; break; - case SIZE_W: mode[i].base = swapendian_int16(space(0).read_word_unaligned(m_pc + bytes)); bytes += 2; break; - case SIZE_D: mode[i].base = swapendian_int32(space(0).read_dword_unaligned(m_pc + bytes)); bytes += 4; break; + case SIZE_B: mode[i].imm = space(0).read_byte(m_pc + bytes); break; + case SIZE_W: mode[i].imm = swapendian_int16(space(0).read_word_unaligned(m_pc + bytes)); break; + case SIZE_D: mode[i].imm = swapendian_int32(space(0).read_dword_unaligned(m_pc + bytes)); break; + case SIZE_Q: mode[i].imm = swapendian_int64(space(0).read_qword_unaligned(m_pc + bytes)); break; } + bytes += mode[i].size + 1; mode[i].type = IMM; break; case 0x15: @@ -325,7 +320,7 @@ void ns32000_device::decode(addr_mode *mode, unsigned imm_size, unsigned &bytes) } } -u32 ns32000_device::ea(addr_mode const mode) +template <int Width> u32 ns32000_device<Width>::ea(addr_mode const mode) { u32 base; @@ -352,38 +347,36 @@ u32 ns32000_device::ea(addr_mode const mode) return base + mode.disp; } -u64 ns32000_device::gen_read(addr_mode mode, unsigned size) +template <int Width> u64 ns32000_device<Width>::gen_read(addr_mode mode) { u64 data = 0; switch (mode.type) { case IMM: - data = mode.base; + data = mode.imm; break; case REG: - if (size == SIZE_Q) - data = (u64(m_r[mode.gen ^ 1]) << 32) | m_r[mode.gen ^ 0]; - else - data = m_r[mode.gen] & size_mask[size]; + data = m_r[mode.gen] & size_mask[mode.size]; break; case TOS: - if (size) - if (size == 3) - data = space(0).read_dword_unaligned(SP); - else - data = space(0).read_word_unaligned(SP); - else - data = space(0).read_byte(SP); + switch (mode.size) + { + case SIZE_B: data = space(0).read_byte(SP); break; + case SIZE_W: data = space(0).read_word_unaligned(SP); break; + case SIZE_D: data = space(0).read_dword_unaligned(SP); break; + case SIZE_Q: data = space(0).read_qword_unaligned(SP); break; + } // post-increment stack pointer - SP += size + 1; + if (mode.access == READ) + SP += mode.size + 1; break; default: - switch (size) + switch (mode.size) { case SIZE_B: data = space(0).read_byte(ea(mode)); break; case SIZE_W: data = space(0).read_word_unaligned(ea(mode)); break; @@ -396,11 +389,11 @@ u64 ns32000_device::gen_read(addr_mode mode, unsigned size) return data; } -s64 ns32000_device::gen_read_sx(addr_mode mode, unsigned size) +template <int Width> s64 ns32000_device<Width>::gen_read_sx(addr_mode mode) { - u64 data = gen_read(mode, size); + u64 data = gen_read(mode); - switch (size) + switch (mode.size) { case SIZE_B: data = s8(data); break; case SIZE_W: data = s16(data); break; @@ -411,35 +404,30 @@ s64 ns32000_device::gen_read_sx(addr_mode mode, unsigned size) return data; } -void ns32000_device::gen_write(addr_mode mode, unsigned size, u64 data) +template <int Width> void ns32000_device<Width>::gen_write(addr_mode mode, u64 data) { switch (mode.type) { case REG: - if (size == SIZE_Q) - { - m_r[mode.gen ^ 0] = u32(data); - m_r[mode.gen ^ 1] = data >> 32; - } - else - m_r[mode.gen] = (m_r[mode.gen] & ~size_mask[size]) | (data & size_mask[size]); + m_r[mode.gen] = (m_r[mode.gen] & ~size_mask[mode.size]) | (data & size_mask[mode.size]); break; case TOS: // pre-decrement stack pointer - SP -= size + 1; + if (mode.access == WRITE) + SP -= mode.size + 1; - if (size) - if (size == 3) - space(0).write_dword_unaligned(SP, data); - else - space(0).write_word_unaligned(SP, data); - else - space(0).write_byte(SP, data); + switch (mode.size) + { + case SIZE_B: space(0).write_byte(SP, data); break; + case SIZE_W: space(0).write_word_unaligned(SP, data); break; + case SIZE_D: space(0).write_dword_unaligned(SP, data); break; + case SIZE_Q: space(0).write_qword_unaligned(SP, data); break; + } break; default: - switch (size) + switch (mode.size) { case SIZE_B: space(0).write_byte(ea(mode), data); break; case SIZE_W: space(0).write_word_unaligned(ea(mode), data); break; @@ -450,7 +438,7 @@ void ns32000_device::gen_write(addr_mode mode, unsigned size, u64 data) } } -bool ns32000_device::condition(unsigned const cc) +template <int Width> bool ns32000_device<Width>::condition(unsigned const cc) { switch (cc & 15) { @@ -492,7 +480,7 @@ bool ns32000_device::condition(unsigned const cc) return false; } -void ns32000_device::flags(u32 const src1, u32 const src2, u32 const dest, unsigned const size, bool const subtraction) +template <int Width> void ns32000_device<Width>::flags(u32 const src1, u32 const src2, u32 const dest, unsigned const size, bool const subtraction) { unsigned const sign_bit = (size + 1) * 8 - 1; @@ -508,7 +496,7 @@ void ns32000_device::flags(u32 const src1, u32 const src2, u32 const dest, unsig m_psr |= PSR_F; } -void ns32000_device::interrupt(unsigned const vector, u32 const return_address, bool const trap) +template <int Width> void ns32000_device<Width>::interrupt(unsigned const vector, u32 const return_address, bool const trap) { // clear trace pending flag if (vector == TRC) @@ -541,9 +529,13 @@ void ns32000_device::interrupt(unsigned const vector, u32 const return_address, m_pc = space(0).read_dword_unaligned(m_mod + 8) + u16(descriptor >> 16); // TODO: flush queue + m_sequential = false; + + if (trap && (machine().debug_flags & DEBUG_FLAG_ENABLED)) + debug()->exception_hook(vector); } -void ns32000_device::execute_run() +template <int Width> void ns32000_device<Width>::execute_run() { while (m_icount > 0) { @@ -597,18 +589,24 @@ void ns32000_device::execute_run() u8 const opbyte = space(0).read_byte(m_pc); unsigned bytes = 1; + unsigned tcy = 1; + m_sequential = true; if ((opbyte & 15) == 10) { // format 0: cccc 1010 - // Bcond dest + // Bcond dst // disp - s32 const dest = displacement(bytes); + s32 const dst = displacement(bytes); if (condition(opbyte >> 4)) - m_pc += dest; + { + m_pc += dst; + m_sequential = false; + tcy = 6; + } else - m_pc += bytes; + tcy = 7; } else if ((opbyte & 15) == 2) { @@ -616,15 +614,17 @@ void ns32000_device::execute_run() switch (opbyte >> 4) { case 0x0: - // BSR dest + // BSR dst // disp { - s32 const dest = displacement(bytes); + s32 const dst = displacement(bytes); SP -= 4; space(0).write_dword_unaligned(SP, m_pc + bytes); - m_pc += dest; + m_pc += dst; + m_sequential = false; + tcy = 6; } break; case 0x1: @@ -637,6 +637,8 @@ void ns32000_device::execute_run() SP += 4 + constant; m_pc = addr; + m_sequential = false; + tcy = 2; } break; case 0x2: @@ -656,6 +658,8 @@ void ns32000_device::execute_run() m_mod = u16(descriptor); m_sb = space(0).read_dword_unaligned(m_mod + 0); m_pc = space(0).read_dword_unaligned(m_mod + 8) + u16(descriptor >> 16); + m_sequential = false; + tcy = 16; } break; case 0x3: @@ -671,6 +675,8 @@ void ns32000_device::execute_run() m_sb = space(0).read_dword_unaligned(m_mod + 0); SP += constant; + m_sequential = false; + tcy = 2; } break; case 0x4: @@ -691,6 +697,8 @@ void ns32000_device::execute_run() m_sb = space(0).read_dword_unaligned(m_mod); SP += constant; + m_sequential = false; + tcy = 35; } else interrupt(ILL, m_pc); @@ -711,6 +719,8 @@ void ns32000_device::execute_run() sp += 2; m_sb = space(0).read_dword_unaligned(m_mod); + m_sequential = false; + tcy = 39; } else interrupt(ILL, m_pc); @@ -721,16 +731,17 @@ void ns32000_device::execute_run() { u8 const reglist = space(0).read_byte(m_pc + bytes++); + tcy = 13; for (unsigned i = 0; i < 8; i++) { if (BIT(reglist, i)) { SP -= 4; space(0).write_dword_unaligned(SP, m_r[i]); + tcy += 4; } } } - m_pc += bytes; break; case 0x7: // RESTORE reglist @@ -738,16 +749,17 @@ void ns32000_device::execute_run() { u8 const reglist = space(0).read_byte(m_pc + bytes++); + tcy = 12; for (unsigned i = 0; i < 8; i++) { if (BIT(reglist, i)) { m_r[7 - i] = space(0).read_dword_unaligned(SP); SP += 4; + tcy += 5; } } } - m_pc += bytes; break; case 0x8: // ENTER reglist,constant @@ -761,16 +773,17 @@ void ns32000_device::execute_run() m_fp = SP; SP -= constant; + tcy = 18; for (unsigned i = 0; i < 8; i++) { if (BIT(reglist, i)) { SP -= 4; space(0).write_dword_unaligned(SP, m_r[i]); + tcy += 4; } } } - m_pc += bytes; break; case 0x9: // EXIT reglist @@ -778,47 +791,54 @@ void ns32000_device::execute_run() { u8 const reglist = space(0).read_byte(m_pc + bytes++); + tcy = 17; for (unsigned i = 0; i < 8; i++) { if (BIT(reglist, i)) { m_r[7 - i] = space(0).read_dword_unaligned(SP); SP += 4; + tcy += 5; } } SP = m_fp; m_fp = space(0).read_dword_unaligned(SP); SP += 4; } - m_pc += bytes; break; case 0xa: // NOP - m_pc += bytes; + tcy = 3; break; case 0xb: // WAIT m_wait = true; - m_pc += bytes; + tcy = 6; break; case 0xc: // DIA m_wait = true; + tcy = 3; break; case 0xd: // FLAG if (m_psr & PSR_F) + { interrupt(FLG, m_pc); + tcy = 44; + } else - m_pc += bytes; + tcy = 6; break; case 0xe: // SVC interrupt(SVC, m_pc); + tcy = 40; break; case 0xf: // BPT interrupt(BPT, m_pc); + tcy = 40; break; } } @@ -832,187 +852,201 @@ void ns32000_device::execute_run() addr_mode mode[] = { addr_mode((opword >> 11) & 31), addr_mode(0x13) }; unsigned const quick = (opword >> 7) & 15; - unsigned const size = opbyte & 3; - - decode(mode, size, bytes); + size_code const size = size_code(opbyte & 3); switch ((opbyte >> 4) & 7) { case 0: - // ADDQi src,dest + // ADDQi src,dst // quick,gen // rmw.i { - mode[0].rmw(); + mode[0].rmw_i(size); + decode(mode, bytes); u32 const src1 = s32(quick << 28) >> 28; - u32 const src2 = gen_read(mode[0], size); + u32 const src2 = gen_read(mode[0]); - u32 const dest = src1 + src2; - flags(src1, src2, dest, size, false); + u32 const dst = src1 + src2; + flags(src1, src2, dst, size, false); - gen_write(mode[0], size, dest); + gen_write(mode[0], dst); + + tcy = (mode[0].type == REG) ? 4 : 6; } - m_pc += bytes; break; case 1: // CMPQi src1,src2 // quick,gen // read.i { - u32 const src1 = s32(quick << 28) >> 28; - u32 const src2 = gen_read(mode[0], size); + mode[0].read_i(size); + decode(mode, bytes); + + u32 const src1 = (s32(quick << 28) >> 28) & size_mask[size]; + u32 const src2 = gen_read(mode[0]); m_psr &= ~(PSR_N | PSR_Z | PSR_L); if ((size == SIZE_D && s32(src1) > s32(src2)) - || ((size == SIZE_W && s16(src1) > s16(src2)) - || ((size == SIZE_B && s8(src1) > s8(src2))))) + || ((size == SIZE_W && s16(src1) > s16(src2)) + || ((size == SIZE_B && s8(src1) > s8(src2))))) m_psr |= PSR_N; if (src1 == src2) m_psr |= PSR_Z; if ((size == SIZE_D && u32(src1) > u32(src2)) - || ((size == SIZE_W && u16(src1) > u16(src2)) - || ((size == SIZE_B && u8(src1) > u8(src2))))) + || ((size == SIZE_W && u16(src1) > u16(src2)) + || ((size == SIZE_B && u8(src1) > u8(src2))))) m_psr |= PSR_L; + + tcy = 3; } - m_pc += bytes; break; case 2: - // SPRi procreg,dest + // SPRi procreg,dst // short,gen // write.i + mode[0].write_i(size); + decode(mode, bytes); + switch (quick) { case 0x0: // US // TODO: user stack pointer? - gen_write(mode[0], size, m_sp1); - m_pc += bytes; + gen_write(mode[0], m_sp1); break; case 0x8: // FP - gen_write(mode[0], size, m_fp); - m_pc += bytes; + gen_write(mode[0], m_fp); break; case 0x9: // SP - gen_write(mode[0], size, SP); - m_pc += bytes; + gen_write(mode[0], SP); break; case 0xa: // SB - gen_write(mode[0], size, m_sb); - m_pc += bytes; + gen_write(mode[0], m_sb); break; case 0xd: // PSR if (!(m_psr & PSR_U)) - { - gen_write(mode[0], size, m_psr); - m_pc += bytes; - } + gen_write(mode[0], m_psr); else interrupt(ILL, m_pc); break; case 0xe: // INTBASE if (!(m_psr & PSR_U)) - { - gen_write(mode[0], size, m_intbase); - m_pc += bytes; - } + gen_write(mode[0], m_intbase); else interrupt(ILL, m_pc); break; case 0xf: // MOD - gen_write(mode[0], size, m_mod); - m_pc += bytes; + gen_write(mode[0], m_mod); break; } + + // TODO: tcy 21-27 + tcy = 21; break; case 3: - // Scondi dest + // Scondi dst // gen // write.i - gen_write(mode[0], size, condition(quick)); - m_pc += bytes; + { + mode[0].write_i(size); + decode(mode, bytes); + + bool const dst = condition(quick); + gen_write(mode[0], dst); + + tcy = dst ? 10 : 9; + } break; case 4: - // ACBi inc,index,dest + // ACBi inc,index,dst // quick,gen,disp // rmw.i { - mode[0].rmw(); + mode[0].rmw_i(size); + decode(mode, bytes); s32 const inc = s32(quick << 28) >> 28; - u32 index = gen_read(mode[0], size); - s32 const dest = displacement(bytes); + u32 index = gen_read(mode[0]); + s32 const dst = displacement(bytes); index += inc; - gen_write(mode[0], size, index); + gen_write(mode[0], index); if (index & size_mask[size]) - m_pc += dest; + { + m_pc += dst; + m_sequential = false; + + tcy = (mode[0].type == REG) ? 17 : 15; + } else - m_pc += bytes; + tcy = (mode[0].type == REG) ? 18 : 16; } break; case 5: - // MOVQi src,dest + // MOVQi src,dst // quick,gen // write.i - gen_write(mode[0], size, s32(quick << 28) >> 28); - m_pc += bytes; + mode[0].write_i(size); + decode(mode, bytes); + + gen_write(mode[0], s32(quick << 28) >> 28); + + tcy = (mode[0].type == REG) ? 3 : 2; break; case 6: // LPRi procreg,src // short,gen // read.i + mode[0].read_i(size); + decode(mode, bytes); + switch (quick) { - case 0x0: // US - // TODO: user stack pointer? - m_sp1 = gen_read(mode[0], size); - m_pc += bytes; + case 0x0: // UPSR + m_psr = (m_psr & 0xff00) | u8(gen_read(mode[0])); break; case 0x8: // FP - m_fp = gen_read(mode[0], size); - m_pc += bytes; + m_fp = gen_read(mode[0]); break; case 0x9: // SP - SP = gen_read(mode[0], size); - m_pc += bytes; + SP = gen_read(mode[0]); break; case 0xa: // SB - m_sb = gen_read(mode[0], size); - m_pc += bytes; + m_sb = gen_read(mode[0]); break; case 0xd: // PSR if (!(m_psr & PSR_U)) { - u32 const src = gen_read(mode[0], size); + u32 const src = gen_read(mode[0]); - if (size == 0) + if (size == SIZE_B) m_psr = (m_psr & 0xff00) | u8(src); else m_psr = src; - - m_pc += bytes; } else interrupt(ILL, m_pc); break; case 0xe: // INTBASE if (!(m_psr & PSR_U)) - { - m_intbase = gen_read(mode[0], size); - m_pc += bytes; - } + m_intbase = gen_read(mode[0]); else interrupt(ILL, m_pc); break; case 0xf: // MOD - m_mod = gen_read(mode[0], size); - m_pc += bytes; + m_mod = gen_read(mode[0]); + break; + default: + interrupt(UND, m_pc); break; } + + // TODO: tcy 19-33 + tcy = 19; break; case 7: // format 3: gggg gooo o111 11ii @@ -1022,96 +1056,142 @@ void ns32000_device::execute_run() // CXPD desc // gen // addr + if (size == SIZE_D) { mode[0].addr(); + decode(mode, bytes); - u32 const desc = gen_read(mode[0], SIZE_D); + u32 const descriptor = gen_read(mode[0]); SP -= 4; space(0).write_dword_unaligned(SP, m_mod); SP -= 4; space(0).write_dword_unaligned(SP, m_pc + bytes); - m_mod = u16(desc); + m_mod = u16(descriptor); m_sb = space(0).read_dword_unaligned(m_mod + 0); - m_pc = u16(desc >> 16) + space(0).read_dword_unaligned(m_mod + 8); + m_pc = space(0).read_dword_unaligned(m_mod + 8) + u16(descriptor >> 16); + m_sequential = false; + + tcy = 13; } + else + interrupt(UND, m_pc); break; case 0x2: // BICPSRi src // gen // read.[BW] - if (size == 0 || !(m_psr & PSR_U)) + if (size == SIZE_B || size == SIZE_W) { - // FIXME: read.D? - u16 const src = gen_read(mode[0], size); + mode[0].read_i(size); + decode(mode, bytes); + + if (size == SIZE_B || !(m_psr & PSR_U)) + { + u16 const src = gen_read(mode[0]); + + m_psr &= ~src; - m_psr &= ~src; - m_pc += bytes; + tcy = (size == SIZE_B) ? 18 : 30; + } + else + interrupt(ILL, m_pc); } else - interrupt(ILL, m_pc); + interrupt(UND, m_pc); break; case 0x4: - // JUMP dest + // JUMP dst // gen // addr - mode[0].addr(); + if (size == SIZE_D) + { + mode[0].addr(); + decode(mode, bytes); - // FIXME: size != 3? - m_pc = ea(mode[0]); + m_pc = ea(mode[0]); + m_sequential = false; + + tcy = 2; + } + else + interrupt(UND, m_pc); break; case 0x6: // BISPSRi src // gen // read.[BW] - if (size == 0 || !(m_psr & PSR_U)) + if (size == SIZE_B || size == SIZE_W) { - // FIXME: read.D? + mode[0].read_i(size); + decode(mode, bytes); + + if (size == SIZE_B || !(m_psr & PSR_U)) + { + u16 const src = gen_read(mode[0]); - u16 const src = gen_read(mode[0], size); + m_psr |= src; - m_psr |= src; - m_pc += bytes; + tcy = (size == SIZE_B) ? 18 : 30; + } + else + interrupt(ILL, m_pc); } else - interrupt(ILL, m_pc); + interrupt(UND, m_pc); break; case 0xa: // ADJSPi src // gen // read.i { - s32 const src = gen_read_sx(mode[0], size); + mode[0].read_i(size); + decode(mode, bytes); + + s32 const src = gen_read_sx(mode[0]); SP -= src; + + tcy = 6; } - m_pc += bytes; break; case 0xc: - // JSR dest + // JSR dst // gen // addr + if (size == SIZE_D) { mode[0].addr(); + decode(mode, bytes); SP -= 4; space(0).write_dword_unaligned(SP, m_pc + bytes); m_pc = ea(mode[0]); + m_sequential = false; + + tcy = 5; } + else + interrupt(UND, m_pc); break; case 0xe: // CASEi src // gen // read.i { - s32 const src = gen_read_sx(mode[0], size); + mode[0].read_i(size); + decode(mode, bytes); + + s32 const src = gen_read_sx(mode[0]); m_pc += src; + m_sequential = false; + + tcy = 4; } break; - default: interrupt(UND, m_pc); break; @@ -1126,175 +1206,214 @@ void ns32000_device::execute_run() bytes = 2; addr_mode mode[2] = { addr_mode((opword >> 11) & 31), addr_mode((opword >> 6) & 31) }; - unsigned const size = opbyte & 3; - - decode(mode, size, bytes); + size_code const size = size_code(opbyte & 3); switch ((opbyte >> 2) & 15) { case 0x0: - // ADDi src,dest + // ADDi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); + + u32 const src1 = gen_read(mode[0]); + u32 const src2 = gen_read(mode[1]); - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + u32 const dst = src1 + src2; + flags(src1, src2, dst, size, false); - u32 const dest = src1 + src2; - flags(src1, src2, dest, size, false); + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0x1: // CMPi src1,src2 // gen,gen // read.i,read.i { - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + mode[0].read_i(size); + mode[1].read_i(size); + decode(mode, bytes); + + u32 const src1 = gen_read(mode[0]); + u32 const src2 = gen_read(mode[1]); m_psr &= ~(PSR_N | PSR_Z | PSR_L); if ((size == SIZE_D && s32(src1) > s32(src2)) - || ((size == SIZE_W && s16(src1) > s16(src2)) - || ((size == SIZE_B && s8(src1) > s8(src2))))) + || ((size == SIZE_W && s16(src1) > s16(src2)) + || ((size == SIZE_B && s8(src1) > s8(src2))))) m_psr |= PSR_N; if (src1 == src2) m_psr |= PSR_Z; if ((size == SIZE_D && u32(src1) > u32(src2)) - || ((size == SIZE_W && u16(src1) > u16(src2)) - || ((size == SIZE_B && u8(src1) > u8(src2))))) + || ((size == SIZE_W && u16(src1) > u16(src2)) + || ((size == SIZE_B && u8(src1) > u8(src2))))) m_psr |= PSR_L; + + tcy = 3; } - m_pc += bytes; break; case 0x2: - // BICi src,dest + // BICi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); + + u32 const src = gen_read(mode[0]); + u32 const dst = gen_read(mode[1]); - u32 const src = gen_read(mode[0], size); - u32 const dest = gen_read(mode[1], size); + gen_write(mode[1], dst & ~src); - gen_write(mode[1], size, dest & ~src); + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0x4: - // ADDCi src,dest + // ADDCi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); + + u32 const src1 = gen_read(mode[0]); + u32 const src2 = gen_read(mode[1]); - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + u32 const dst = src1 + src2 + (m_psr & PSR_C); + flags(src1, src2, dst, size, false); - u32 const dest = src1 + src2 + (m_psr & PSR_C); - flags(src1, src2, dest, size, false); + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0x5: - // MOVi src,dest + // MOVi src,dst // gen,gen // read.i,write.i { - u32 const src = gen_read(mode[0], size); + mode[0].read_i(size); + mode[1].write_i(size); + decode(mode, bytes); - gen_write(mode[1], size, src); + u32 const src = gen_read(mode[0]); + + gen_write(mode[1], src); + + tcy = (mode[1].type == REG) ? 3 : 1; } - m_pc += bytes; break; case 0x6: - // ORi src,dest + // ORi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); + + u32 const src = gen_read(mode[0]); + u32 const dst = gen_read(mode[1]); - u32 const src = gen_read(mode[0], size); - u32 const dest = gen_read(mode[1], size); + gen_write(mode[1], src | dst); - gen_write(mode[1], size, src | dest); + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0x8: - // SUBi src,dest + // SUBi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + u32 const src1 = gen_read(mode[0]); + u32 const src2 = gen_read(mode[1]); - u32 const dest = src2 - src1; - flags(src1, src2, dest, size, true); + u32 const dst = src2 - src1; + flags(src1, src2, dst, size, true); - gen_write(mode[1], size, dest); + gen_write(mode[1], dst); + + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0x9: - // ADDR src,dest + // ADDR src,dst // gen,gen // addr,write.D - mode[0].addr(); + if (size == SIZE_D) + { + mode[0].addr(); + mode[1].write_i(size); + decode(mode, bytes); + + gen_write(mode[1], ea(mode[0])); - gen_write(mode[1], SIZE_D, ea(mode[0])); - m_pc += bytes; + tcy = (mode[1].type == REG) ? 3 : 2; + } + else + interrupt(UND, m_pc); break; case 0xa: - // ANDi src,dest + // ANDi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); + + u32 const src = gen_read(mode[0]); + u32 const dst = gen_read(mode[1]); - u32 const src = gen_read(mode[0], size); - u32 const dest = gen_read(mode[1], size); + gen_write(mode[1], src & dst); - gen_write(mode[1], size, src & dest); + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0xc: - // SUBCi src,dest + // SUBCi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + u32 const src1 = gen_read(mode[0]); + u32 const src2 = gen_read(mode[1]); - u32 const dest = src2 - src1 - (m_psr & PSR_C); - flags(src1, src2, dest, size, true); + u32 const dst = src2 - src1 - (m_psr & PSR_C); + flags(src1, src2, dst, size, true); - gen_write(mode[1], size, dest); + gen_write(mode[1], dst); + + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; case 0xd: // TBITi offset,base // gen,gen // read.i,regaddr { + mode[0].read_i(size); mode[1].regaddr(); + decode(mode, bytes); - s32 const offset = gen_read_sx(mode[0], size); + s32 const offset = gen_read_sx(mode[0]); if (mode[1].type == REG) { @@ -1302,6 +1421,8 @@ void ns32000_device::execute_run() m_psr |= PSR_F; else m_psr &= ~PSR_F; + + tcy = 4; } else { @@ -1311,23 +1432,27 @@ void ns32000_device::execute_run() m_psr |= PSR_F; else m_psr &= ~PSR_F; + + tcy = 14; } } - m_pc += bytes; break; case 0xe: - // XORi src,dest + // XORi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - u32 const src = gen_read(mode[0], size); - u32 const dest = gen_read(mode[1], size); + u32 const src = gen_read(mode[0]); + u32 const dst = gen_read(mode[1]); - gen_write(mode[1], size, src ^ dest); + gen_write(mode[1], src ^ dst); + + tcy = (mode[1].type == REG) ? 4 : 3; } - m_pc += bytes; break; } } @@ -1339,7 +1464,7 @@ void ns32000_device::execute_run() u16 const opword = space(0).read_word_unaligned(m_pc + bytes); bytes += 2; - unsigned const size = opword & 3; + size_code const size = size_code(opword & 3); // string instruction options bool const translate = BIT(opword, 7); @@ -1350,6 +1475,8 @@ void ns32000_device::execute_run() { case 0: // MOVSi options + tcy = (translate || backward || uw) ? 54 : 18; + m_psr &= ~PSR_F; while (m_r[0]) { @@ -1361,6 +1488,8 @@ void ns32000_device::execute_run() if (translate) data = space(0).read_byte(m_r[3] + u8(data)); + tcy += translate ? 27 : (backward || uw) ? 24 : 13; + bool const match = !((m_r[4] ^ data) & size_mask[size]); if ((uw == 1 && !match) || (uw == 3 && match)) { @@ -1388,10 +1517,11 @@ void ns32000_device::execute_run() m_r[0]--; } - m_pc += bytes; break; case 1: // CMPSi options + tcy = 53; + m_psr |= PSR_Z; m_psr &= ~(PSR_N | PSR_F | PSR_L); while (m_r[0]) @@ -1408,6 +1538,8 @@ void ns32000_device::execute_run() if (translate) src1 = space(0).read_byte(m_r[3] + u8(src1)); + tcy += translate ? 38 : 35; + bool const match = !((m_r[4] ^ src1) & size_mask[size]); if ((uw == 1 && !match) || (uw == 3 && match)) { @@ -1420,13 +1552,13 @@ void ns32000_device::execute_run() m_psr &= ~PSR_Z; if ((size == SIZE_D && s32(src1) > s32(src2)) - || ((size == SIZE_W && s16(src1) > s16(src2)) - || ((size == SIZE_B && s8(src1) > s8(src2))))) + || ((size == SIZE_W && s16(src1) > s16(src2)) + || ((size == SIZE_B && s8(src1) > s8(src2))))) m_psr |= PSR_N; if ((size == SIZE_D && u32(src1) > u32(src2)) - || ((size == SIZE_W && u16(src1) > u16(src2)) - || ((size == SIZE_B && u8(src1) > u8(src2))))) + || ((size == SIZE_W && u16(src1) > u16(src2)) + || ((size == SIZE_B && u8(src1) > u8(src2))))) m_psr |= PSR_L; break; @@ -1445,7 +1577,6 @@ void ns32000_device::execute_run() m_r[0]--; } - m_pc += bytes; break; case 2: // SETCFG cfglist @@ -1453,13 +1584,16 @@ void ns32000_device::execute_run() if (!(m_psr & PSR_U)) { m_cfg = (opword >> 7) & 15; - m_pc += bytes; + + tcy = 15; } else interrupt(ILL, m_pc); break; case 3: // SKPSi options + tcy = 51; + m_psr &= ~PSR_F; while (m_r[0]) { @@ -1471,6 +1605,8 @@ void ns32000_device::execute_run() if (translate) data = space(0).read_byte(m_r[3] + u8(data)); + tcy += translate ? 30 : 27; + bool const match = !((m_r[4] ^ data) & size_mask[size]); if ((uw == 1 && !match) || (uw == 3 && match)) { @@ -1485,7 +1621,6 @@ void ns32000_device::execute_run() m_r[0]--; } - m_pc += bytes; break; default: interrupt(UND, m_pc); @@ -1500,45 +1635,48 @@ void ns32000_device::execute_run() bytes += 2; addr_mode mode[] = { addr_mode((opword >> 11) & 31), addr_mode((opword >> 6) & 31) }; - unsigned const size = opword & 3; - - // byte-size immediates for ROT, ASH and LSH - decode(mode, ((opword >> 2) & 10) ? size : SIZE_B, bytes); + size_code const size = size_code(opword & 3); switch ((opword >> 2) & 15) { case 0x0: - // ROTi count,dest + // ROTi count,dst // gen,gen // read.B,rmw.i { - mode[1].rmw(); + mode[0].read_i(SIZE_B); + mode[1].rmw_i(size); + decode(mode, bytes); - s32 const count = gen_read_sx(mode[0], SIZE_B); - u32 const src = gen_read(mode[1], size); + s32 const count = gen_read_sx(mode[0]); + u32 const src = gen_read(mode[1]); unsigned const limit = (size + 1) * 8 - 1; - u32 const dest = ((src << (count & limit)) & size_mask[size]) | ((src & size_mask[size]) >> (limit - (count & limit))); + u32 const dst = ((src << (count & limit)) & size_mask[size]) | ((src & size_mask[size]) >> (limit - (count & limit) + 1)); + + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); + tcy = 14 + (count & limit); } - m_pc += bytes; break; case 0x1: - // ASHi count,dest + // ASHi count,dst // gen,gen // read.B,rmw.i { - mode[1].rmw(); + mode[0].read_i(SIZE_B); + mode[1].rmw_i(size); + decode(mode, bytes); - s32 const count = gen_read_sx(mode[0], SIZE_B); - s32 const src = gen_read_sx(mode[1], size); + s32 const count = gen_read_sx(mode[0]); + s32 const src = gen_read_sx(mode[1]); - u32 const dest = (count < 0) ? (src >> -count) : (src << count); + u32 const dst = (count < 0) ? (src >> -count) : (src << count); - gen_write(mode[1], size, dest); + gen_write(mode[1], dst); + + tcy = 14 + std::abs(count); } - m_pc += bytes; break; case 0x2: // CBITi offset,base @@ -1549,9 +1687,11 @@ void ns32000_device::execute_run() // gen,gen // read.i,regaddr { + mode[0].read_i(size); mode[1].regaddr(); + decode(mode, bytes); - s32 const offset = gen_read_sx(mode[0], size); + s32 const offset = gen_read_sx(mode[0]); if (mode[1].type == REG) { @@ -1561,6 +1701,8 @@ void ns32000_device::execute_run() m_psr &= ~PSR_F; m_r[mode[1].gen] &= ~(1U << (offset & 31)); + + tcy = 7; } else { @@ -1573,28 +1715,32 @@ void ns32000_device::execute_run() m_psr &= ~PSR_F; space(0).write_byte(byte_ea, byte & ~(1U << (offset & 7))); + + tcy = 15; } } - m_pc += bytes; break; case 0x4: interrupt(UND, m_pc); break; case 0x5: - // LSHi count,dest + // LSHi count,dst // gen,gen // read.B,rmw.i { - mode[1].rmw(); + mode[0].read_i(SIZE_B); + mode[1].rmw_i(size); + decode(mode, bytes); + + s32 const count = gen_read_sx(mode[0]); + u32 const src = gen_read(mode[1]); - s32 const count = gen_read_sx(mode[0], SIZE_B); - u32 const src = gen_read(mode[1], size); + u32 const dst = (count < 0) ? (src >> -count) : (src << count); - u32 const dest = (count < 0) ? (src >> -count) : (src << count); + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); + tcy = 14 + std::abs(count); } - m_pc += bytes; break; case 0x6: // SBITi offset,base @@ -1605,9 +1751,11 @@ void ns32000_device::execute_run() // gen,gen // read.i,regaddr { + mode[0].read_i(size); mode[1].regaddr(); + decode(mode, bytes); - s32 const offset = gen_read_sx(mode[0], size); + s32 const offset = gen_read_sx(mode[0]); if (mode[1].type == REG) { @@ -1616,7 +1764,9 @@ void ns32000_device::execute_run() else m_psr &= ~PSR_F; - m_r[mode[1].gen] |= ~(1U << (offset & 31)); + m_r[mode[1].gen] |= (1U << (offset & 31)); + + tcy = 7; } else { @@ -1628,17 +1778,22 @@ void ns32000_device::execute_run() else m_psr &= ~PSR_F; - space(0).write_byte(byte_ea, byte | ~(1U << (offset & 7))); + space(0).write_byte(byte_ea, byte | (1U << (offset & 7))); + + tcy = 15; } } - m_pc += bytes; break; case 0x8: - // NEGi src,dest + // NEGi src,dst // gen,gen // read.i,write.i { - u32 const src = gen_read(mode[0], size); + mode[0].read_i(size); + mode[1].write_i(size); + decode(mode, bytes); + + u32 const src = gen_read(mode[0]); if (src) m_psr |= PSR_C; @@ -1648,75 +1803,93 @@ void ns32000_device::execute_run() if ((src ^ ~(size_mask[size] >> 1)) & size_mask[size]) { m_psr &= ~PSR_F; - gen_write(mode[1], size, -src); + gen_write(mode[1], -src); } else { m_psr |= PSR_F; - gen_write(mode[1], size, src); + gen_write(mode[1], src); } + + tcy = 5; } - m_pc += bytes; break; case 0x9: - // NOTi src,dest + // NOTi src,dst // gen,gen // read.i,write.i { - u32 const src = gen_read(mode[0], size); + mode[0].read_i(size); + mode[1].write_i(size); + decode(mode, bytes); - gen_write(mode[1], size, src ^ 1U); + u32 const src = gen_read(mode[0]); + + gen_write(mode[1], src ^ 1U); + + tcy = 5; } - m_pc += bytes; break; case 0xa: interrupt(UND, m_pc); break; case 0xb: - // SUBPi src,dest + // SUBPi src,dst // gen,gen // read.i,rmw.i fatalerror("unimplemented: subp (%s)\n", machine().describe_context()); + + // TODO: tcy 16/18 break; case 0xc: - // ABSi src,dest + // ABSi src,dst // gen,gen // read.i,write.i { - s32 const src = gen_read_sx(mode[0], size); + mode[0].read_i(size); + mode[1].write_i(size); + decode(mode, bytes); - s32 const dest = std::abs(src); + s32 const src = gen_read_sx(mode[0]); m_psr &= ~PSR_F; - if (BIT(dest, ((size + 1) * 8 - 1))) + if (src == s32(0x80000000) >> (32 - (size + 1) * 8)) { m_psr |= PSR_F; - gen_write(mode[1], size, src); + gen_write(mode[1], src); } else - gen_write(mode[1], size, dest); + gen_write(mode[1], std::abs(src)); + + tcy = (src < 0) ? 9 : 8; } - m_pc += bytes; break; case 0xd: - // COMi src,dest + // COMi src,dst // gen,gen // read.i,write.i { - u32 const src = gen_read(mode[0], size); + mode[0].read_i(size); + mode[1].write_i(size); + decode(mode, bytes); + + u32 const src = gen_read(mode[0]); + + gen_write(mode[1], ~src); - gen_write(mode[1], size, ~src); + tcy = 7; } - m_pc += bytes; break; case 0xe: // IBITi offset,base // gen,gen // read.i,regaddr { + mode[0].read_i(size); mode[1].regaddr(); + decode(mode, bytes); - s32 const offset = gen_read_sx(mode[0], size); + s32 const offset = gen_read_sx(mode[0]); if (mode[1].type == REG) { @@ -1726,6 +1899,8 @@ void ns32000_device::execute_run() m_psr &= ~PSR_F; m_r[mode[1].gen] ^= (1U << (offset & 31)); + + tcy = 9; } else { @@ -1738,15 +1913,18 @@ void ns32000_device::execute_run() m_psr &= ~PSR_F; space(0).write_byte(byte_ea, byte ^ (1U << (offset & 7))); + + tcy = 17; } } - m_pc += bytes; break; case 0xf: - // ADDPi src,dest + // ADDPi src,dst // gen,gen // read.i,rmw.i fatalerror("unimplemented: addp (%s)\n", machine().describe_context()); + + // TODO: tcy 16/18 break; } } @@ -1758,9 +1936,7 @@ void ns32000_device::execute_run() bytes += 2; addr_mode mode[2] = { addr_mode((opword >> 11) & 31), addr_mode((opword >> 6) & 31) }; - unsigned const size = opword & 3; - - decode(mode, size, bytes); + size_code const size = size_code(opword & 3); switch ((opword >> 2) & 15) { @@ -1771,164 +1947,280 @@ void ns32000_device::execute_run() { mode[0].addr(); mode[1].addr(); + decode(mode, bytes); u32 block1 = ea(mode[0]); u32 block2 = ea(mode[1]); - s32 length = displacement(bytes); + unsigned const num = displacement(bytes) / (size + 1) + 1; // TODO: aligned/unaligned transfers? - for (unsigned num = 0; num * (size + 1) < length; num++) + for (unsigned i = 0; i < num; i++) { switch (size) { case SIZE_B: space(0).write_byte(block2, space(0).read_byte(block1)); break; case SIZE_W: space(0).write_word_unaligned(block2, space(0).read_word_unaligned(block1)); break; case SIZE_D: space(0).write_dword_unaligned(block2, space(0).read_dword_unaligned(block1)); break; + default: + // can't happen + break; } block1 += (size + 1); block2 += (size + 1); } + + tcy = 20 + 3 * num; } - m_pc += bytes; break; case 0x1: // CMPMi block1,block2,length // gen,gen,disp // addr,addr - fatalerror("unimplemented: cmpm (%s)\n", machine().describe_context()); + { + mode[0].addr(); + mode[1].addr(); + decode(mode, bytes); + + u32 block1 = ea(mode[0]); + u32 block2 = ea(mode[1]); + unsigned const num = displacement(bytes) / (size + 1) + 1; + + tcy = 24; + + m_psr |= PSR_Z; + m_psr &= ~(PSR_N | PSR_L); + + // TODO: aligned/unaligned transfers? + for (unsigned i = 0; i < num; i++) + { + s32 int1 = 0; + s32 int2 = 0; + + switch (size) + { + case SIZE_B: + int1 = s8(space(0).read_byte(block1)); + int2 = s8(space(0).read_byte(block2)); + break; + case SIZE_W: + int1 = s16(space(0).read_word_unaligned(block1)); + int2 = s16(space(0).read_word_unaligned(block2)); + break; + case SIZE_D: + int1 = s32(space(0).read_dword_unaligned(block1)); + int2 = s32(space(0).read_dword_unaligned(block2)); + break; + default: + // can't happen + break; + } + + tcy += 9; + + if (int1 != int2) + { + m_psr &= ~PSR_Z; + if (int1 > int2) + m_psr |= PSR_N; + if (u32(int1) > u32(int2)) + m_psr |= PSR_L; + + break; + } + + block1 += (size + 1); + block2 += (size + 1); + } + } break; case 0x2: // INSSi src,base,offset,length // gen,gen,imm // read.i,regaddr { + mode[0].read_i(size); mode[1].regaddr(); + decode(mode, bytes); u8 const imm = space(0).read_byte(m_pc + bytes++); unsigned const offset = imm >> 5; u32 const mask = ((2ULL << (imm & 31)) - 1) << offset; - u32 const src = gen_read(mode[0], size); - u32 const base = gen_read(mode[1], SIZE_D); + u32 const src = gen_read(mode[0]); + u32 const base = gen_read(mode[1]); - gen_write(mode[1], SIZE_D, (base & ~mask) | ((src << offset) & mask)); + gen_write(mode[1], (base & ~mask) | ((src << offset) & mask)); + + // TODO: tcy 39-49 + tcy = 39; } - m_pc += bytes; break; case 0x3: - // EXTSi base,dest,offset,length + // EXTSi base,dst,offset,length // gen,gen,imm // regaddr,write.i { mode[0].regaddr(); + mode[1].write_i(size); + decode(mode, bytes); u8 const imm = space(0).read_byte(m_pc + bytes++); unsigned const offset = imm >> 5; u32 const mask = (2ULL << (imm & 31)) - 1; - u32 const base = gen_read(mode[0], SIZE_D); - u32 const dest = (base >> offset) & mask; + u32 const base = gen_read(mode[0]); + u32 const dst = (base >> offset) & mask; + + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); + // TODO: tcy 26-36 + tcy = 26; } - m_pc += bytes; break; case 0x4: - // MOVXBW src,dest + // MOVXBW src,dst // gen,gen // read.B,write.W + if (size == SIZE_B) { - u8 const src = gen_read(mode[0], size); - s16 const dest = s8(src); + mode[0].read_i(size); + mode[1].write_i(SIZE_W); + decode(mode, bytes); + + u8 const src = gen_read(mode[0]); + s16 const dst = s8(src); - gen_write(mode[1], SIZE_W, dest); + gen_write(mode[1], dst); + + tcy = 6; } - m_pc += bytes; + else + interrupt(UND, m_pc); break; case 0x5: - // MOVZBW src,dest + // MOVZBW src,dst // gen,gen // read.B,write.W + if (size == SIZE_B) { - u8 const src = gen_read(mode[0], size); - u16 const dest = src; + mode[0].read_i(size); + mode[1].write_i(SIZE_W); + decode(mode, bytes); + + u8 const src = gen_read(mode[0]); + u16 const dst = src; - gen_write(mode[1], SIZE_W, dest); + gen_write(mode[1], dst); + + tcy = 5; } - m_pc += bytes; + else + interrupt(UND, m_pc); break; case 0x6: - // MOVZiD src,dest + // MOVZiD src,dst // gen,gen // read.[BW],write.D + if (size == SIZE_B || size == SIZE_W) { - u32 const src = gen_read(mode[0], size); + mode[0].read_i(size); + mode[1].write_i(SIZE_D); + decode(mode, bytes); - gen_write(mode[1], SIZE_D, src); + u32 const src = gen_read(mode[0]); + + gen_write(mode[1], src); + + tcy = 5; } - m_pc += bytes; + else + interrupt(UND, m_pc); break; case 0x7: - // MOVXiD src,dest + // MOVXiD src,dst // gen,gen // read.[BW],write.D + if (size == SIZE_B || size == SIZE_W) { - u32 const src = gen_read(mode[0], size); - s32 const dest = (size == SIZE_W) ? s16(src) : s8(src); + mode[0].read_i(size); + mode[1].write_i(SIZE_D); + decode(mode, bytes); - gen_write(mode[1], SIZE_D, dest); + u32 const src = gen_read(mode[0]); + s32 const dst = (size == SIZE_W) ? s16(src) : s8(src); + + gen_write(mode[1], dst); + + tcy = 6; } - m_pc += bytes; + else + interrupt(UND, m_pc); break; case 0x8: - // MULi src,dest + // MULi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + u32 const src1 = gen_read(mode[0]); + u32 const src2 = gen_read(mode[1]); - u32 const dest = src1 * src2; + u32 const dst = src1 * src2; - gen_write(mode[1], size, dest); + gen_write(mode[1], dst); + + tcy = 15; } - m_pc += bytes; break; case 0x9: - // MEIi src,dest + // MEIi src,dst // gen,gen // read.i,rmw.2i { - mode[1].rmw(); - unsigned const size2 = size * 2 + 1; + mode[0].read_i(size); + mode[1].rmw_i(size_code(size * 2 + 1)); + decode(mode, bytes); - u32 const src1 = gen_read(mode[0], size); - u32 const src2 = gen_read(mode[1], size); + u32 const src1 = gen_read(mode[0]); + u32 const src2 = ((mode[1].type == REG) + ? m_r[mode[1].gen ^ 0] + : gen_read(mode[1])) & size_mask[size]; - u64 const dest = mulu_32x32(src1, src2); + u64 const dst = mulu_32x32(src1, src2); - gen_write(mode[1], size2, dest); + if (mode[1].type == REG) + { + m_r[mode[1].gen ^ 0] = (m_r[mode[1].gen ^ 0] & ~size_mask[size]) | ((dst >> 0) & size_mask[size]); + m_r[mode[1].gen ^ 1] = (m_r[mode[1].gen ^ 1] & ~size_mask[size]) | ((dst >> ((size + 1) * 8)) & size_mask[size]); + } + else + gen_write(mode[1], dst); + + tcy = 23; } - m_pc += bytes; break; case 0xa: interrupt(UND, m_pc); break; case 0xb: - // DEIi src,dest + // DEIi src,dst // gen,gen // read.i,rmw.2i { - mode[1].rmw(); - unsigned const size2 = size * 2 + 1; + mode[0].read_i(size); + mode[1].rmw_i(size_code(size * 2 + 1)); + decode(mode, bytes); - u32 const src1 = gen_read(mode[0], size); + u32 const src1 = gen_read(mode[0]); if (src1) { - u64 const src2 = gen_read(mode[1], size2); + u64 const src2 = (mode[1].type == REG) + ? (u64(m_r[mode[1].gen ^ 1] & size_mask[size]) << ((size + 1) * 8)) | (m_r[mode[1].gen ^ 0] & size_mask[size]) + : gen_read(mode[1]); u32 const quotient = src2 / src1; u32 const remainder = src2 % src1; @@ -1937,11 +2229,15 @@ void ns32000_device::execute_run() { m_r[mode[1].gen ^ 0] = (m_r[mode[1].gen ^ 0] & ~size_mask[size]) | (remainder & size_mask[size]); m_r[mode[1].gen ^ 1] = (m_r[mode[1].gen ^ 1] & ~size_mask[size]) | (quotient & size_mask[size]); + + tcy = 31; } else - gen_write(mode[1], size2, (u64(quotient) << ((size + 1) * 8)) | remainder); + { + gen_write(mode[1], (u64(quotient) << ((size + 1) * 8)) | remainder); - m_pc += bytes; + tcy = 38; + } } else { @@ -1954,21 +2250,25 @@ void ns32000_device::execute_run() } break; case 0xc: - // QUOi src,dest + // QUOi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - s32 const src1 = gen_read_sx(mode[0], size); + s32 const src1 = gen_read_sx(mode[0]); if (src1) { - s32 const src2 = gen_read_sx(mode[1], size); + s32 const src2 = gen_read_sx(mode[1]); + + s32 const dst = src2 / src1; - s32 const dest = src2 / src1; + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); - m_pc += bytes; + // TODO: tcy 49-55 + tcy = 49; } else { @@ -1981,21 +2281,25 @@ void ns32000_device::execute_run() } break; case 0xd: - // REMi src,dest + // REMi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - s32 const src1 = gen_read_sx(mode[0], size); + s32 const src1 = gen_read_sx(mode[0]); if (src1) { - s32 const src2 = gen_read_sx(mode[1], size); + s32 const src2 = gen_read_sx(mode[1]); + + s32 const dst = src2 % src1; - s32 const dest = src2 % src1; + gen_write(mode[1], dst); - gen_write(mode[1], size, dest); - m_pc += bytes; + // TODO: tcy 57-62 + tcy = 57; } else { @@ -2008,21 +2312,25 @@ void ns32000_device::execute_run() } break; case 0xe: - // MODi src,dest + // MODi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - u32 const src1 = gen_read_sx(mode[0], size); + s32 const src1 = gen_read_sx(mode[0]); if (src1) { - u32 const src2 = gen_read_sx(mode[1], size); + s32 const src2 = gen_read_sx(mode[1]); - s32 const dest = (src1 + (src2 % src1)) % src1; + s32 const dst = (src1 + (src2 % src1)) % src1; - gen_write(mode[1], size, dest); - m_pc += bytes; + gen_write(mode[1], dst); + + // TODO: tcy 54-73 + tcy = 54; } else { @@ -2035,26 +2343,29 @@ void ns32000_device::execute_run() } break; case 0xf: - // DIVi src,dest + // DIVi src,dst // gen,gen // read.i,rmw.i { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(size); + decode(mode, bytes); - s32 const src1 = gen_read_sx(mode[0], size); + s32 const src1 = gen_read_sx(mode[0]); if (src1) { - s32 const src2 = gen_read_sx(mode[1], size); + s32 const src2 = gen_read_sx(mode[1]); s32 const quotient = src2 / src1; s32 const remainder = src2 % src1; if ((quotient < 0) && remainder) - gen_write(mode[1], size, quotient - 1); + gen_write(mode[1], quotient - 1); else - gen_write(mode[1], size, quotient); + gen_write(mode[1], quotient); - m_pc += bytes; + // TODO: tcy 58-68 + tcy = 58; } else { @@ -2080,108 +2391,150 @@ void ns32000_device::execute_run() addr_mode mode[2] = { addr_mode((opword >> 11) & 31), addr_mode((opword >> 6) & 31) }; unsigned const reg = (opword >> 3) & 7; - unsigned const size = opword & 3; - - decode(mode, size, bytes); + size_code const size = size_code(opword & 3); switch ((opword & 4) | (opbyte >> 6)) { case 0: - // EXTi offset,base,dest,length + // EXTi offset,base,dst,length // reg,gen,gen,disp // regaddr,write.i { mode[0].regaddr(); + mode[1].write_i(size); + decode(mode, bytes); s32 const offset = m_r[reg]; s32 const length = displacement(bytes); u32 const mask = (1U << length) - 1; - u32 dest; + u32 dst; if (mode[0].type != REG) { u32 const base_ea = ea(mode[0]) + (offset >> 3); u32 const base = space(0).read_dword_unaligned(base_ea); - dest = (base >> (offset & 7)); + dst = (base >> (offset & 7)); + + // TODO: tcy 17-51 + tcy = 17; } else - dest = (m_r[mode[0].gen] >> (offset & 31)); + { + dst = (m_r[mode[0].gen] >> (offset & 31)); + + // TODO: tcy 19-29 + tcy = 19; + } - gen_write(mode[1], size, dest & mask); + gen_write(mode[1], dst & mask); } break; case 1: - // CVTP offset,base,dest + // CVTP offset,base,dst // reg,gen,gen // addr,write.D + if (size == SIZE_D) { - // TODO: size != SIZE_D? mode[0].addr(); + mode[1].write_i(size); + decode(mode, bytes); s32 const offset = s32(m_r[reg]); u32 const base = ea(mode[0]); - gen_write(mode[1], size, base * 8 + offset); + gen_write(mode[1], base * 8 + offset); + + tcy = 7; } + else + interrupt(UND, m_pc); break; case 2: // INSi offset,src,base,length // reg,gen,gen,disp // read.i,regaddr { + mode[0].read_i(size); mode[1].regaddr(); + decode(mode, bytes); s32 const offset = m_r[reg]; s32 const length = displacement(bytes); - u32 const src = gen_read(mode[0], size); + u32 const src = gen_read(mode[0]); - u32 dest; + u32 dst; if (mode[1].type == REG) { u32 const base = m_r[mode[1].gen]; u32 const mask = ((1U << length) - 1) << (offset & 31); - dest = (base & ~mask) | ((src << (offset & 31)) & mask); + dst = (base & ~mask) | ((src << (offset & 31)) & mask); + + // TODO: tcy 29-39 + tcy = 29; } else { - u32 const base_ea = ea(mode[0]) + (offset >> 3); + u32 const base_ea = ea(mode[1]) + (offset >> 3); u32 const base = space(0).read_dword_unaligned(base_ea); u32 const mask = ((1U << length) - 1) << (offset & 7); - dest = (base & ~mask) | ((src << (offset & 7)) & mask); + dst = (base & ~mask) | ((src << (offset & 7)) & mask); + + // TODO: tcy 28-96 + tcy = 28; } - gen_write(mode[1], SIZE_D, dest); + gen_write(mode[1], dst); } break; case 3: - // CHECKi dest,bounds,src + // CHECKi dst,bounds,src // reg,gen,gen // addr,read.i { mode[0].addr(); + mode[1].read_i(size); + decode(mode, bytes); u32 const bounds = ea(mode[0]); - s32 const src = gen_read_sx(mode[1], size); + s32 const src = gen_read_sx(mode[1]); s32 lower = 0; s32 upper = 0; switch (size) { - case SIZE_B: lower = s8(space(0).read_byte(bounds + 0)); upper = s8(space(0).read_byte(bounds + 1)); break; - case SIZE_W: lower = s16(space(0).read_word_unaligned(bounds + 0)); upper = s16(space(0).read_word_unaligned(bounds + 2)); break; - case SIZE_D: lower = s32(space(0).read_dword_unaligned(bounds + 0)); upper = s32(space(0).read_dword_unaligned(bounds + 4)); break; + case SIZE_B: + upper = s8(space(0).read_byte(bounds + 0)); + lower = s8(space(0).read_byte(bounds + 1)); + break; + case SIZE_W: + upper = s16(space(0).read_word_unaligned(bounds + 0)); + lower = s16(space(0).read_word_unaligned(bounds + 2)); + break; + case SIZE_D: + upper = s32(space(0).read_dword_unaligned(bounds + 0)); + lower = s32(space(0).read_dword_unaligned(bounds + 4)); + break; + default: + // can't happen + break; } if (src >= lower && src <= upper) { m_psr &= ~PSR_F; m_r[reg] = src - lower; + + tcy = 11; } else + { m_psr |= PSR_F; + + tcy = (src >= lower) ? 7 : 10; + } } break; case 4: @@ -2189,10 +2542,16 @@ void ns32000_device::execute_run() // reg,gen,gen // read.i,read.i { - u32 const length = gen_read(mode[0], size); - u32 const index = gen_read(mode[1], size); + mode[0].read_i(size); + mode[1].read_i(size); + decode(mode, bytes); + + u32 const length = gen_read(mode[0]); + u32 const index = gen_read(mode[1]); m_r[reg] = m_r[reg] * (length + 1) + index; + + tcy = 25; } break; case 5: @@ -2200,10 +2559,12 @@ void ns32000_device::execute_run() // gen,gen // read.i,rmw.B { - mode[1].rmw(); + mode[0].read_i(size); + mode[1].rmw_i(SIZE_B); + decode(mode, bytes); - u32 const base = gen_read(mode[0], size); - u32 offset = gen_read(mode[1], SIZE_B); + u32 const base = gen_read(mode[0]); + u32 offset = gen_read(mode[1]); unsigned const limit = (size + 1) * 8; m_psr |= PSR_F; @@ -2216,39 +2577,348 @@ void ns32000_device::execute_run() else offset++; - gen_write(mode[1], SIZE_B, offset & limit); + gen_write(mode[1], offset & (limit - 1)); + + // TODO: tcy 24-28 + tcy = 24; } break; case 6: - // MOVSU/MOVUS src,dest + // MOVSU/MOVUS src,dst // gen,gen // addr,addr { mode[0].addr(); mode[1].addr(); + decode(mode, bytes); fatalerror("unimplemented: movsu/movus (%s)\n", machine().describe_context()); + + tcy = 33; } break; } } - m_pc += bytes; break; - case 0x3e: // format 9 - // TODO: floating point + case 0x3e: + // format 9: xxxx xyyy yyoo ofii 0011 1110 + if (m_cfg & CFG_F) + { + if (!m_fpu) + fatalerror("floating point unit not configured (%s)\n", machine().describe_context()); + + u16 const opword = space(0).read_word_unaligned(m_pc + bytes); + bytes += 2; + + addr_mode mode[2] = { addr_mode((opword >> 11) & 31), addr_mode((opword >> 6) & 31) }; + size_code const size_f = BIT(opword, 0) ? SIZE_D : SIZE_Q; + size_code const size = size_code(opword & 3); + + m_fpu->write_id(opbyte); + m_fpu->write_op(swapendian_int16(opword)); + + switch ((opword >> 3) & 7) + { + case 0: + // MOVif src,dst + // gen,gen + // read.i,write.f + mode[0].read_i(size); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 1: + // LFSR src + // gen + // read.D + mode[0].read_i(size); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 2: + // MOVLF src,dst + // gen,gen + // read.L,write.F + mode[0].read_f(SIZE_Q); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 3: + // MOVFL src,dst + // gen,gen + // read.F,write.L + mode[0].read_f(SIZE_D); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 4: + // ROUNDfi src,dst + // gen,gen + // read.f,write.i + mode[0].read_f(size_f); + mode[1].write_i(size); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 5: + // TRUNCfi src,dst + // gen,gen + // read.f,write.i + mode[0].read_f(size_f); + mode[1].write_i(size); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 6: + // SFSR dst + // gen + // write.D + mode[0].write_i(size); + decode(mode, bytes); + + if (slave(mode[1], mode[0])) + interrupt(FPU, m_pc); + break; + case 7: + // FLOORfi src,dst + // gen,gen + // read.f,write.i + mode[0].read_f(size_f); + mode[1].write_i(size); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + } + } + else + interrupt(UND, m_pc); break; case 0x7e: // format 10 interrupt(UND, m_pc); break; - case 0xbe: // format 11 - // TODO: floating point + case 0xbe: + // format 11: xxxx xyyy yyoo oo0f 1011 1110 + if (m_cfg & CFG_F) + { + if (!m_fpu) + fatalerror("floating point unit not configured (%s)\n", machine().describe_context()); + + u16 const opword = space(0).read_word_unaligned(m_pc + bytes); + bytes += 2; + + addr_mode mode[2] = { addr_mode((opword >> 11) & 31), addr_mode((opword >> 6) & 31) }; + size_code const size_f = BIT(opword, 0) ? SIZE_D : SIZE_Q; + + m_fpu->write_id(opbyte); + m_fpu->write_op(swapendian_int16(opword)); + + switch ((opword >> 2) & 15) + { + case 0x0: + // ADDf src,dst + // gen,gen + // read.f,rmw.f + mode[0].read_f(size_f); + mode[1].rmw_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0x1: + // MOVf src,dst + // gen,gen + // read.f,write.f + mode[0].read_f(size_f); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0x2: + // CMPf src1,src2 + // gen,gen + // read.f,read.f + { + mode[0].read_f(size_f); + mode[1].read_f(size_f); + decode(mode, bytes); + + u16 const status = slave(mode[0], mode[1]); + if (!(status & ns32000_slave_interface::SLAVE_Q)) + { + m_psr &= ~(PSR_N | PSR_Z | PSR_L); + m_psr |= status & (ns32000_slave_interface::SLAVE_N | ns32000_slave_interface::SLAVE_Z | ns32000_slave_interface::SLAVE_L); + } + else + interrupt(FPU, m_pc); + } + break; + case 0x3: + // Trap(SLAVE) + // operands from ns32532 datasheet + mode[0].read_f(size_f); + mode[1].read_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0x4: + // SUBf src,dst + // gen,gen + // read.f,rmw.f + mode[0].read_f(size_f); + mode[1].rmw_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0x5: + // NEGf src,dst + // gen,gen + // read.f,write.f + mode[0].read_f(size_f); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0x8: + // DIVf src,dst + // gen,gen + // read.f,rmw.f + mode[0].read_f(size_f); + mode[1].rmw_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0x9: + // Trap(SLAVE) + // operands from ns32532 datasheet + mode[0].read_f(size_f); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0xc: + // MULf src,dst + // gen,gen + // read.f,rmw.f + mode[0].read_f(size_f); + mode[1].rmw_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + case 0xd: + // ABSf src,dst + // gen,gen + // read.f,write.f + mode[0].read_f(size_f); + mode[1].write_f(size_f); + decode(mode, bytes); + + if (slave(mode[0], mode[1])) + interrupt(FPU, m_pc); + break; + } + } + else + interrupt(UND, m_pc); break; case 0xfe: // format 12 case 0x9e: // format 13 interrupt(UND, m_pc); break; - case 0x1e: // format 14 - // TODO: mmu + case 0x1e: + // format 14: xxxx xsss s0oo ooii 0001 1110 + if (!(m_psr & PSR_U)) + { + if (m_cfg & CFG_M) + { + u16 const opword = space(0).read_word_unaligned(m_pc + bytes); + bytes += 2; + + addr_mode mode[] = { addr_mode((opword >> 11) & 31), addr_mode(0x13) }; + + //unsigned const quick = (opword >> 7) & 15; + size_code const size = size_code(opword & 3); + + // TODO: mmu instructions + switch ((opword >> 2) & 15) + { + case 0: + // RDVAL loc + // gen + // addr + mode[0].addr(); + decode(mode, bytes); + + tcy = 21; + break; + case 1: + // WRVAL loc + // gen + // addr + mode[0].addr(); + decode(mode, bytes); + + tcy = 21; + break; + case 2: + // LMR mmureg,src + // short,gen + // read.D + mode[0].read_i(size); + decode(mode, bytes); + + tcy = 30; + break; + case 3: + // SMR mmureg,dst + // short,gen + // write.D + mode[0].write_i(size); + decode(mode, bytes); + + tcy = 25; + break; + default: + interrupt(UND, m_pc); + break; + } + } + else + interrupt(UND, m_pc); + } + else + interrupt(ILL, m_pc); break; case 0x16: // format 15.0 case 0x36: // format 15.1 @@ -2271,15 +2941,18 @@ void ns32000_device::execute_run() break; } + if (m_sequential) + m_pc += bytes; + // trace trap if (m_psr & PSR_P) interrupt(TRC, m_pc); - m_icount--; + m_icount -= tcy; } } -void ns32000_device::execute_set_input(int inputnum, int state) +template <int Width> void ns32000_device<Width>::execute_set_input(int inputnum, int state) { if (state) m_wait = false; @@ -2298,7 +2971,7 @@ void ns32000_device::execute_set_input(int inputnum, int state) } } -device_memory_interface::space_config_vector ns32000_device::memory_space_config() const +template <int Width> device_memory_interface::space_config_vector ns32000_device<Width>::memory_space_config() const { return space_config_vector{ std::make_pair(AS_PROGRAM, &m_program_config), @@ -2312,12 +2985,102 @@ device_memory_interface::space_config_vector ns32000_device::memory_space_config }; } -bool ns32000_device::memory_translate(int spacenum, int intention, offs_t &address) +template <int Width> bool ns32000_device<Width>::memory_translate(int spacenum, int intention, offs_t &address) { return true; } -std::unique_ptr<util::disasm_interface> ns32000_device::create_disassembler() +template <int Width> std::unique_ptr<util::disasm_interface> ns32000_device<Width>::create_disassembler() { return std::make_unique<ns32000_disassembler>(); } + +template <int Width> u16 ns32000_device<Width>::slave(addr_mode op1, addr_mode op2) +{ + if ((op1.access == READ || op1.access == RMW) && !(op1.type == REG && op1.slave)) + { + u64 const data = gen_read(op1); + + switch (op1.size) + { + case SIZE_B: + m_fpu->write_op(u8(data)); + break; + case SIZE_W: + m_fpu->write_op(u16(data)); + break; + case SIZE_D: + m_fpu->write_op(u16(data >> 0)); + m_fpu->write_op(u16(data >> 16)); + break; + case SIZE_Q: + m_fpu->write_op(u16(data >> 0)); + m_fpu->write_op(u16(data >> 16)); + m_fpu->write_op(u16(data >> 32)); + m_fpu->write_op(u16(data >> 48)); + break; + } + } + + if ((op2.access == READ || op2.access == RMW) && !(op2.type == REG && op2.slave)) + { + u64 const data = gen_read(op2); + + switch (op2.size) + { + case SIZE_B: + m_fpu->write_op(u8(data)); + break; + case SIZE_W: + m_fpu->write_op(u16(data)); + break; + case SIZE_D: + m_fpu->write_op(u16(data >> 0)); + m_fpu->write_op(u16(data >> 16)); + break; + case SIZE_Q: + m_fpu->write_op(u16(data >> 0)); + m_fpu->write_op(u16(data >> 16)); + m_fpu->write_op(u16(data >> 32)); + m_fpu->write_op(u16(data >> 48)); + break; + } + } + + u16 const status = m_fpu->read_st(&m_icount); + + if (!(status & ns32000_slave_interface::SLAVE_Q)) + { + if ((op2.access == WRITE || op2.access == RMW) && !(op2.type == REG && op2.slave)) + { + u64 data = m_fpu->read_op(); + + switch (op2.size) + { + case SIZE_D: + data |= u64(m_fpu->read_op()) << 16; + break; + case SIZE_Q: + data |= u64(m_fpu->read_op()) << 16; + data |= u64(m_fpu->read_op()) << 32; + data |= u64(m_fpu->read_op()) << 48; + break; + default: + break; + } + + gen_write(op2, data); + } + } + else + { + // restore stack pointer + if (op1.type == TOS && op1.access == READ) + SP -= op1.size + 1; + + if (op2.type == TOS && op2.access == READ) + SP -= op2.size + 1; + } + + return status; +} diff --git a/src/devices/cpu/ns32000/ns32000.h b/src/devices/cpu/ns32000/ns32000.h index af5977fe52e..f5254fa068d 100644 --- a/src/devices/cpu/ns32000/ns32000.h +++ b/src/devices/cpu/ns32000/ns32000.h @@ -6,9 +6,14 @@ #pragma once +#include "slave.h" + +template <int Width> class ns32000_device : public cpu_device { public: + template <typename T> void set_fpu(T &&tag) { m_fpu.set_tag(std::forward<T>(tag)); } + // construction/destruction ns32000_device(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock); @@ -47,47 +52,79 @@ private: EXT, TOS, }; + enum access_class : unsigned + { + NONE, + READ, + WRITE, + RMW, + ADDR, + REGADDR, + }; + enum size_code : unsigned + { + SIZE_B = 0, + SIZE_W = 1, + SIZE_D = 3, + SIZE_Q = 7, + }; + struct addr_mode { addr_mode(unsigned gen) : gen(gen) + , access(NONE) + , slave(false) , base(0) , disp(0) + , imm(0) {}; - void rmw() { if (type == TOS) type = MEM; } - void addr() { if (type == TOS) type = MEM; } - void regaddr() { if (type == TOS) type = MEM; } + void read_i(size_code code) { access = READ; size = code; } + void read_f(size_code code) { access = READ; size = code; slave = true; } + void write_i(size_code code) { access = WRITE; size = code; } + void write_f(size_code code) { access = WRITE; size = code; slave = true; } + void rmw_i(size_code code) { access = RMW; size = code; } + void rmw_f(size_code code) { access = RMW; size = code; slave = true; } + void addr() { access = ADDR; size = SIZE_D; } + void regaddr() { access = REGADDR; size = SIZE_D; } unsigned gen; addr_mode_type type; + access_class access; + size_code size; + bool slave; u32 base; u32 disp; + u64 imm; }; // instruction decoding helpers s32 displacement(unsigned &bytes); - void decode(addr_mode *mode, unsigned imm_size, unsigned &bytes); + void decode(addr_mode *mode, unsigned &bytes); // operand read/write helpers u32 ea(addr_mode const mode); - u64 gen_read(addr_mode mode, unsigned size); - s64 gen_read_sx(addr_mode mode, unsigned size); - void gen_write(addr_mode mode, unsigned size, u64 data); + u64 gen_read(addr_mode mode); + s64 gen_read_sx(addr_mode mode); + void gen_write(addr_mode mode, u64 data); // other execution helpers bool condition(unsigned const cc); void flags(u32 const src1, u32 const src2, u32 const dest, unsigned const size, bool const subtraction); void interrupt(unsigned const vector, u32 const return_address, bool const trap = true); + u16 slave(addr_mode op1, addr_mode op2); // configuration address_space_config m_program_config; address_space_config m_interrupt_config; + optional_device<ns32000_slave_interface> m_fpu; + // emulation state int m_icount; - memory_access<24, 1, 0, ENDIANNESS_LITTLE>::cache m_bus[16]; + typename memory_access<24, Width, 0, ENDIANNESS_LITTLE>::cache m_bus[16]; u32 m_pc; // program counter u32 m_sb; // static base @@ -105,21 +142,22 @@ private: bool m_nmi_line; bool m_int_line; bool m_wait; + bool m_sequential; }; -class ns32008_device : public ns32000_device +class ns32008_device : public ns32000_device<0> { public: ns32008_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); }; -class ns32016_device : public ns32000_device +class ns32016_device : public ns32000_device<1> { public: ns32016_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); }; -class ns32032_device : public ns32000_device +class ns32032_device : public ns32000_device<2> { public: ns32032_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); diff --git a/src/devices/cpu/ns32000/ns32000dasm.cpp b/src/devices/cpu/ns32000/ns32000dasm.cpp index 600e5f2dfb2..3f8315ec394 100644 --- a/src/devices/cpu/ns32000/ns32000dasm.cpp +++ b/src/devices/cpu/ns32000/ns32000dasm.cpp @@ -354,6 +354,10 @@ const char *const ns32000_disassembler::PR[] = { "UPSR", "DCR", "BPC", "DSR", "CAR", "", "", "", "FP", "SP", "SB", "USP", "CFG", "PSR", "INTBASE", "MOD" }; +const char *const ns32000_disassembler::FP[] = +{ + "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7" +}; int8_t ns32000_disassembler::short2int(uint8_t val) { @@ -508,7 +512,7 @@ inline std::string ns32000_disassembler::get_reg_list(offs_t &pc, const data_buf return reg_list; } -void ns32000_disassembler::stream_gen(std::ostream &stream, u8 gen_addr, u8 op_len, operand_class op_class, offs_t &pc, const data_buffer &opcodes) +void ns32000_disassembler::stream_gen(std::ostream &stream, u8 gen_addr, u8 op_len, operand_class op_class, offs_t &pc, const data_buffer &opcodes, bool fpreg) { uint8_t index_byte; int32_t disp1, disp2; @@ -518,7 +522,7 @@ void ns32000_disassembler::stream_gen(std::ostream &stream, u8 gen_addr, u8 op_l case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: /* Register */ if (op_class != operand_class::ADDRESS) - util::stream_format(stream, "%s", R[gen_addr & 0x07]); + util::stream_format(stream, "%s", fpreg ? FP[gen_addr & 0x07] : R[gen_addr & 0x07]); else util::stream_format(stream, "(invalid)"); break; @@ -541,20 +545,25 @@ void ns32000_disassembler::stream_gen(std::ostream &stream, u8 gen_addr, u8 op_l /* Immediate */ if (op_class == operand_class::SOURCE || op_class == operand_class::BITPOS) { + int64_t imm; if (op_len == 0) - disp1 = int8_t(opcodes.r8(pc)); + imm = int8_t(opcodes.r8(pc)); else if (op_len == 1) - disp1 = int16_t(swapendian_int16(opcodes.r16(pc))); + imm = int16_t(swapendian_int16(opcodes.r16(pc))); + else if (op_len == 3) + imm = int32_t(swapendian_int32(opcodes.r32(pc))); else - disp1 = swapendian_int32(opcodes.r32(pc)); + imm = int64_t(swapendian_int64(opcodes.r64(pc))); if (op_class == operand_class::BITPOS) - util::stream_format(stream, "$%d", disp1); + util::stream_format(stream, "$%d", imm); else if (op_len == 0) - util::stream_format(stream, "$0x%02X", uint8_t(disp1)); + util::stream_format(stream, "$0x%02X", uint8_t(imm)); else if (op_len == 1) - util::stream_format(stream, "$0x%04X", uint16_t(disp1)); - else - util::stream_format(stream, "$0x%08X", disp1); + util::stream_format(stream, "$0x%04X", uint16_t(imm)); + else if (op_len == 3) + util::stream_format(stream, "$0x%08X", uint32_t(imm)); + else if (op_len == 7) + util::stream_format(stream, "$0x%016X", imm); pc += op_len + 1; } else @@ -850,10 +859,22 @@ offs_t ns32000_disassembler::disassemble(std::ostream &stream, offs_t pc, const mnemonic = mnemonic_index(Format9[Format9op(opcode)], iType[Format9i(opcode)], fType[Format9f(opcode)]); switch (Format9op(opcode)) { - case 0x00: case 0x02: case 0x03: case 0x04: case 0x05: case 0x07: + case 0x00: util::stream_format(stream, "%-8s ", mnemonic); stream_gen(stream, Format9gen1(opcode), Format9i(opcode), operand_class::SOURCE, pc, opcodes); util::stream_format(stream, ", "); + stream_gen(stream, Format9gen2(opcode), Format9i(opcode), operand_class::DESTINATION, pc, opcodes, true); + break; + case 0x02: case 0x03: + util::stream_format(stream, "%-8s ", mnemonic); + stream_gen(stream, Format9gen1(opcode), Format9f(opcode) ? 7 : 3, operand_class::SOURCE, pc, opcodes, true); + util::stream_format(stream, ", "); + stream_gen(stream, Format9gen2(opcode), Format9f(opcode) ? 3 : 7, operand_class::DESTINATION, pc, opcodes, true); + break; + case 0x04: case 0x05: case 0x07: + util::stream_format(stream, "%-8s ", mnemonic); + stream_gen(stream, Format9gen1(opcode), Format9f(opcode) ? 3 : 7, operand_class::SOURCE, pc, opcodes, true); + util::stream_format(stream, ", "); stream_gen(stream, Format9gen2(opcode), Format9i(opcode), operand_class::DESTINATION, pc, opcodes); break; case 0x01: case 0x06: @@ -873,9 +894,9 @@ offs_t ns32000_disassembler::disassemble(std::ostream &stream, offs_t pc, const { case 0x00: case 0x01: case 0x02: case 0x04: case 0x05 : case 0x08: case 0x0c : case 0x0d: util::stream_format(stream, "%-8s ", mnemonic); - stream_gen(stream, Format11gen1(opcode), Format11f(opcode), operand_class::SOURCE, pc, opcodes); + stream_gen(stream, Format11gen1(opcode), Format11f(opcode) ? 3 : 7, operand_class::SOURCE, pc, opcodes, true); util::stream_format(stream, ","); - stream_gen(stream, Format11gen2(opcode), Format11f(opcode), operand_class::DESTINATION, pc, opcodes); + stream_gen(stream, Format11gen2(opcode), Format11f(opcode) ? 3 : 7, operand_class::DESTINATION, pc, opcodes, true); break; default: /* Trap */ util::stream_format(stream, "%-8s ", mnemonic); diff --git a/src/devices/cpu/ns32000/ns32000dasm.h b/src/devices/cpu/ns32000/ns32000dasm.h index 93c38c62c98..c9f470e05d3 100644 --- a/src/devices/cpu/ns32000/ns32000dasm.h +++ b/src/devices/cpu/ns32000/ns32000dasm.h @@ -109,6 +109,7 @@ private: static char const *const R[]; static char const *const M[]; static char const *const PR[]; + static char const *const FP[]; std::string mnemonic_index(std::string form, const std::string &itype, const std::string &ftype); uint8_t opcode_format(uint8_t byte); @@ -119,7 +120,7 @@ private: static inline std::string get_options(uint8_t opts); static inline std::string get_reg_list(offs_t &pc, const data_buffer &opcodes, bool reverse); - void stream_gen(std::ostream &stream, u8 gen_addr, u8 op_len, operand_class op_class, offs_t &pc, const data_buffer &opcodes); + void stream_gen(std::ostream &stream, u8 gen_addr, u8 op_len, operand_class op_class, offs_t &pc, const data_buffer &opcodes, bool fpreg = false); u32 m_base_pc; }; diff --git a/src/devices/cpu/ns32000/slave.h b/src/devices/cpu/ns32000/slave.h new file mode 100644 index 00000000000..43ed52ecf80 --- /dev/null +++ b/src/devices/cpu/ns32000/slave.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#ifndef MAME_CPU_NS32000_SLAVE_H +#define MAME_CPU_NS32000_SLAVE_H + +#pragma once + +class ns32000_slave_interface : public device_interface +{ +public: + auto out_scb() { return m_out_scb.bind(); } + + ns32000_slave_interface(machine_config const &mconfig, device_t &device) + : device_interface(device, "ns32000_slave") + , m_out_scb(*this) + { + } + + enum slave_status : u16 + { + SLAVE_Q = 0x0001, + SLAVE_L = 0x0004, + SLAVE_F = 0x0020, + SLAVE_Z = 0x0040, + SLAVE_N = 0x0080, + }; + + virtual void state_add(device_state_interface &parent, int &index) = 0; + virtual void write_id(u16 data) = 0; + virtual void write_op(u16 data) = 0; + virtual u16 read_st(int *icount = nullptr) = 0; + virtual u16 read_op() = 0; + +protected: + // device_interface overrides + virtual void interface_post_start() override + { + m_out_scb.resolve_safe(); + } + + devcb_write_line m_out_scb; +}; + +#endif // MAME_CPU_NS32000_SLAVE_H diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index 2d04709a4a9..f16985610f0 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -386,6 +386,8 @@ pdp1_device::pdp1_device(const machine_config &mconfig, const char *tag, device_ , m_program_config("program", ENDIANNESS_BIG, 32, 18, -2) // data is actually 18 bits wide , m_extern_iot(*this) , m_io_sc_callback(*this) + , m_program(nullptr) + , m_reset_param(nullptr) { m_program_config.m_is_octal = true; } @@ -783,7 +785,7 @@ void pdp1_device::execute_run() /* read first word as instruction */ MB = 0; /* data will be transferred to IO register in response to RPB */ - m_extern_iot[2](2, 0, 1, IO, AC); + m_extern_iot[2](2, 1, MB, IO, AC); m_rim_step = 1; m_ios = 0; break; @@ -827,9 +829,8 @@ void pdp1_device::execute_run() case 2: /* read second word as data */ - MB = 0; /* data will be transferred to IO register in response to RPB */ - m_extern_iot[2](2, 0, 1, IO, AC); + m_extern_iot[2](2, 1, MB, IO, AC); m_rim_step = 3; m_ios = 0; break; diff --git a/src/devices/cpu/pdp1/pdp1.h b/src/devices/cpu/pdp1/pdp1.h index 0a81c8177d4..f1a4e934236 100644 --- a/src/devices/cpu/pdp1/pdp1.h +++ b/src/devices/cpu/pdp1/pdp1.h @@ -33,8 +33,7 @@ struct pdp1_reset_param_t #define IOT_NO_COMPLETION_PULSE -1 -class pdp1_device : public cpu_device - , public pdp1_reset_param_t +class pdp1_device : public cpu_device, public pdp1_reset_param_t { public: typedef device_delegate<void (int op2, int nac, int mb, int &io, int ac)> iot_delegate; diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp index 715cf574ee1..1871bc260bd 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.cpp +++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp @@ -130,9 +130,11 @@ pic16c5x_device::pic16c5x_device(const machine_config &mconfig, device_type type , ( ( program_width == 9 ) ? address_map_constructor(FUNC(pic16c5x_device::rom_9), this): ( ( program_width == 10 ) ? address_map_constructor(FUNC(pic16c5x_device::rom_10), this) : address_map_constructor(FUNC(pic16c5x_device::rom_11), this) ))) , m_data_config("data", ENDIANNESS_LITTLE, 8, data_width, 0 , ( ( data_width == 5 ) ? address_map_constructor(FUNC(pic16c5x_device::ram_5), this) : address_map_constructor(FUNC(pic16c5x_device::ram_7), this) ) ) + , m_internalram(nullptr) , m_reset_vector((program_width == 9) ? 0x1ff : ((program_width == 10) ? 0x3ff : 0x7ff)) , m_picmodel(picmodel) , m_temp_config(0) + , m_rtcc(0) , m_picRAMmask((data_width == 5) ? 0x1f : 0x7f) , m_read_a(*this) , m_read_b(*this) diff --git a/src/devices/cpu/t11/t11dasm.cpp b/src/devices/cpu/t11/t11dasm.cpp index 536d811eff0..13705f53477 100644 --- a/src/devices/cpu/t11/t11dasm.cpp +++ b/src/devices/cpu/t11/t11dasm.cpp @@ -119,10 +119,11 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data case 000: util::stream_format(stream, "HALT"); break; case 001: util::stream_format(stream, "WAIT"); break; case 002: util::stream_format(stream, "RTI"); flags = STEP_OUT; break; - case 003: util::stream_format(stream, "BPT"); break; - case 004: util::stream_format(stream, "IOT"); break; + case 003: util::stream_format(stream, "BPT"); flags = STEP_OVER; break; + case 004: util::stream_format(stream, "IOT"); flags = STEP_OVER; break; case 005: util::stream_format(stream, "RESET"); break; - case 006: util::stream_format(stream, "RTT"); break; + case 006: util::stream_format(stream, "RTT"); flags = STEP_OUT; break; + case 007: util::stream_format(stream, "MFPT"); break; default: util::stream_format(stream, ".WORD %06o", op); break; } break; @@ -135,21 +136,22 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data { case 000: if( (lo & 7) == 7 ) - util::stream_format(stream, "RTS"); + util::stream_format(stream, "RETURN"); else util::stream_format(stream, "RTS %s", regs[lo & 7]); flags = STEP_OUT; break; + // 00023x: SPL (not implemented on T-11) case 040: case 050: switch( lo & 15 ) { case 000: util::stream_format(stream, "NOP"); break; case 017: util::stream_format(stream, "CCC"); break; - case 001: util::stream_format(stream, "CEC"); break; - case 002: util::stream_format(stream, "CEV"); break; - case 004: util::stream_format(stream, "CEZ"); break; - case 010: util::stream_format(stream, "CEN"); break; + case 001: util::stream_format(stream, "CLC"); break; + case 002: util::stream_format(stream, "CLV"); break; + case 004: util::stream_format(stream, "CLZ"); break; + case 010: util::stream_format(stream, "CLN"); break; default: util::stream_format(stream, "Ccc #%02o", lo & 15); break; } break; @@ -207,7 +209,7 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data case 0004400: case 0004500: case 0004600: case 0004700: ea1 = MakeEA<false> (lo, pc, opcodes); if ( (hi & 7) == 7 ) - util::stream_format(stream, "JSR %s", ea1); + util::stream_format(stream, "CALL %s", ea1); else util::stream_format(stream, "JSR %s,%s", regs[hi & 7], ea1); flags = STEP_OVER; @@ -260,13 +262,17 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data ea1 = MakeEA<false> (lo, pc, opcodes); util::stream_format(stream, "ASL %s", ea1); break; -/* case 0006400: - util::stream_format(stream, "MARK #%o", lo); - break;*/ + // 0064xx: MARK (not implemented on T-11) + // 0065xx: MFPI (not implemented on T-11) + // 0066xx: MTPI (not implemented on T-11) case 0006700: ea1 = MakeEA<false> (lo, pc, opcodes); util::stream_format(stream, "SXT %s", ea1); break; + // 0070xx: CSM (not implemented on T-11) + // 0072xx: TSTSET (not implemented on T-11) + // 0073xx: WRTLCK (not implemented on T-11) + case 0010000: case 0010100: case 0010200: case 0010300: case 0010400: case 0010500: case 0010600: case 0010700: case 0011000: case 0011100: case 0011200: case 0011300: case 0011400: case 0011500: case 0011600: case 0011700: case 0012000: case 0012100: case 0012200: case 0012300: case 0012400: case 0012500: case 0012600: case 0012700: @@ -277,13 +283,7 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data case 0017000: case 0017100: case 0017200: case 0017300: case 0017400: case 0017500: case 0017600: case 0017700: ea1 = MakeEA<false> (hi, pc, opcodes); ea2 = MakeEA<false> (lo, pc, opcodes); - if (lo == 046) /* MOV src,-(SP) */ - util::stream_format(stream, "PUSH %s", ea1); - else - if (hi == 026) /* MOV (SP)+,buffer */ - util::stream_format(stream, "POP %s", ea2); - else /* all other */ - util::stream_format(stream, "MOV %s,%s", ea1, ea2); + util::stream_format(stream, "MOV %s,%s", ea1, ea2); break; case 0020000: case 0020100: case 0020200: case 0020300: case 0020400: case 0020500: case 0020600: case 0020700: case 0021000: case 0021100: case 0021200: case 0021300: case 0021400: case 0021500: case 0021600: case 0021700: @@ -346,11 +346,16 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data util::stream_format(stream, "ADD %s,%s", ea1, ea2); break; + // 070xxx: MUL (not implemented on T-11) + // 071xxx: DIV (not implemented on T-11) + // 072xxx: ASH (not implemented on T-11) + // 073xxx: ASHC (not implemented on T-11) case 0074000: case 0074100: case 0074200: case 0074300: case 0074400: case 0074500: case 0074600: case 0074700: ea1 = MakeEA<false> (lo, pc, opcodes); util::stream_format(stream, "XOR %s,%s", regs[hi & 7], ea1); break; - + // 075xxx: Floating Instruction Set (not implemented on T-11) + // 076xxx: Commercial Instruction Set (not implemented on T-11) case 0077000: case 0077100: case 0077200: case 0077300: case 0077400: case 0077500: case 0077600: case 0077700: addr = (pc - 2 * lo) & 0177777; util::stream_format(stream, "SOB %s,%06o", regs[hi & 7], addr); @@ -390,9 +395,11 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data break; case 0104000: case 0104100: case 0104200: case 0104300: util::stream_format(stream, "EMT %03o", op & 0377); + flags = STEP_OVER; break; case 0104400: case 0104500: case 0104600: case 0104700: util::stream_format(stream, "TRAP %03o", op & 0377); + flags = STEP_OVER; break; case 0105000: @@ -447,6 +454,8 @@ offs_t t11_disassembler::disassemble(std::ostream &stream, offs_t pc, const data ea1 = MakeEA<true> (lo, pc, opcodes); util::stream_format(stream, "MTPS %s", ea1); break; + // 1065xx: MFPD (not implemented on T-11) + // 1066xx: MTPD (not implemented on T-11) case 0106700: ea1 = MakeEA<true> (lo, pc, opcodes); util::stream_format(stream, "MFPS %s", ea1); diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index d5fd882a484..ab820fc1599 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -1178,7 +1178,7 @@ uint32_t tms340x0_device::tms340x0_ind16(screen_device &screen, bitmap_ind16 &bi params.heblnk = params.hsblnk = cliprect.max_x + 1; /* blank out the blank regions */ - uint16_t *dest = &bitmap.pix16(cliprect.min_y); + uint16_t *dest = &bitmap.pix(cliprect.min_y); for (x = cliprect.min_x; x < params.heblnk; x++) dest[x] = blackpen; for (x = params.hsblnk; x <= cliprect.max_x; x++) @@ -1209,7 +1209,7 @@ uint32_t tms340x0_device::tms340x0_rgb32(screen_device &screen, bitmap_rgb32 &bi params.heblnk = params.hsblnk = cliprect.max_x + 1; /* blank out the blank regions */ - uint32_t *dest = &bitmap.pix32(cliprect.min_y); + uint32_t *dest = &bitmap.pix(cliprect.min_y); for (x = cliprect.min_x; x < params.heblnk; x++) dest[x] = blackpen; for (x = params.hsblnk; x <= cliprect.max_x; x++) diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp index c2cf28f3f92..da29f23fbcd 100644 --- a/src/devices/cpu/tms57002/tms57002.cpp +++ b/src/devices/cpu/tms57002/tms57002.cpp @@ -929,11 +929,10 @@ void tms57002_device::sound_stream_update(sound_stream &stream, std::vector<read si[2] = s32(inputs[2].get(0) * in_scale) & 0xffffff; si[3] = s32(inputs[3].get(0) * in_scale) & 0xffffff; - stream_buffer::sample_t out_scale = 1.0 / (32768.0 * 65536.0); - outputs[0].put(0, stream_buffer::sample_t(s32(so[0] << 8)) * out_scale); - outputs[1].put(0, stream_buffer::sample_t(s32(so[1] << 8)) * out_scale); - outputs[2].put(0, stream_buffer::sample_t(s32(so[2] << 8)) * out_scale); - outputs[3].put(0, stream_buffer::sample_t(s32(so[3] << 8)) * out_scale); + outputs[0].put_int(0, s32(so[0] << 8) >> 1, 32768 * 32768); + outputs[1].put_int(0, s32(so[1] << 8) >> 1, 32768 * 32768); + outputs[2].put_int(0, s32(so[2] << 8) >> 1, 32768 * 32768); + outputs[3].put_int(0, s32(so[3] << 8) >> 1, 32768 * 32768); sync_w(1); } diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index 981356ebcd2..89fdcc8d817 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -220,6 +220,8 @@ void tms9995_device::device_start() m_source_value = 0; + m_index = 0; + // add the states for the debugger for (int i=0; i < 20; i++) { @@ -242,7 +244,7 @@ void tms9995_device::device_start() save_item(NAME(PC)); save_item(NAME(ST)); // save_item(NAME(PC_debug)); // only for debugger output - save_pointer(NAME(m_onchip_memory),256); + save_item(NAME(m_onchip_memory)); save_item(NAME(m_idle_state)); save_item(NAME(m_nmi_state)); save_item(NAME(m_hold_state)); @@ -285,7 +287,7 @@ void tms9995_device::device_start() save_item(NAME(m_cru_address)); save_item(NAME(m_cru_value)); save_item(NAME(m_cru_first_read)); - save_pointer(NAME(m_flag),16); + save_item(NAME(m_flag)); save_item(NAME(IR)); save_item(NAME(m_pre_IR)); save_item(NAME(m_command)); diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp index ea416cbe05c..b285fbc3048 100644 --- a/src/devices/cpu/unsp/unsp.cpp +++ b/src/devices/cpu/unsp/unsp.cpp @@ -256,11 +256,11 @@ void unsp_device::device_start() state_add(UNSP_FIQ_EN, "FIQE", m_core->m_enable_fiq).formatstr("%1u"); state_add(UNSP_FIR_MOV_EN, "FIR_MOV", m_core->m_fir_move).formatstr("%1u"); state_add(UNSP_SB, "SB", m_core->m_sb).formatstr("%1X"); - state_add(UNSP_AQ, "AQ", m_core->m_sb).formatstr("%1u"); - state_add(UNSP_FRA, "FRA", m_core->m_sb).formatstr("%1u"); - state_add(UNSP_BNK, "BNK", m_core->m_sb).formatstr("%1u"); - state_add(UNSP_INE, "INE", m_core->m_sb).formatstr("%1u"); - state_add(UNSP_PRI, "PRI", m_core->m_sb).formatstr("%1u"); + state_add(UNSP_AQ, "AQ", m_core->m_aq).formatstr("%1u"); + state_add(UNSP_FRA, "FRA", m_core->m_fra).formatstr("%1u"); + state_add(UNSP_BNK, "BNK", m_core->m_bnk).formatstr("%1u"); + state_add(UNSP_INE, "INE", m_core->m_ine).formatstr("%1u"); + state_add(UNSP_PRI, "PRI", m_core->m_pri).formatstr("%1u"); #if UNSP_LOG_OPCODES || UNSP_LOG_REGS state_add(UNSP_LOG_OPS,"LOG", m_log_ops).formatstr("%1u"); #endif diff --git a/src/devices/cpu/unsp/unspdasm_extended.cpp b/src/devices/cpu/unsp/unspdasm_extended.cpp index 3caa182b237..1655936647b 100644 --- a/src/devices/cpu/unsp/unspdasm_extended.cpp +++ b/src/devices/cpu/unsp/unspdasm_extended.cpp @@ -147,7 +147,7 @@ offs_t unsp_20_disassembler::disassemble_extended_group(std::ostream& stream, of uint8_t rb = (ximm & 0x000f) >> 0; uint8_t size = (ximm & 0x7000) >> 12; uint8_t rx = (ximm & 0x0e00) >> 9; - + if (size == 0) size = 8; int start = (rx + 1)&7; diff --git a/src/devices/cpu/vt50/vt50.cpp b/src/devices/cpu/vt50/vt50.cpp index 961dca5aa2c..7a964c4be5b 100644 --- a/src/devices/cpu/vt50/vt50.cpp +++ b/src/devices/cpu/vt50/vt50.cpp @@ -284,7 +284,7 @@ void vt5x_cpu_device::draw_char_line() if (xc > screen().visible_area().right() - 8) return; - u32 *pix = &m_bitmap.pix32(m_current_line, xc); + u32 *pix = &m_bitmap.pix(m_current_line, xc); if (m_video_process && m_cursor_ff && m_cursor_active) std::fill_n(pix, 9, rgb_t::white()); else if (!m_video_process || m_cursor_ff) diff --git a/src/devices/cpu/x86log.cpp b/src/devices/cpu/x86log.cpp index b97f2553f11..7c7b13d1966 100644 --- a/src/devices/cpu/x86log.cpp +++ b/src/devices/cpu/x86log.cpp @@ -37,7 +37,7 @@ x86log_context *x86log_create_context(const char *filename) x86log_context *log; /* allocate the log */ - log = global_alloc_clear<x86log_context>(); + log = new x86log_context; /* allocate the filename */ log->filename.assign(filename); @@ -59,7 +59,7 @@ void x86log_free_context(x86log_context *log) noexcept fclose(log->file); /* free the structure */ - global_free(log); + delete log; } diff --git a/src/devices/cpu/x86log.h b/src/devices/cpu/x86log.h index ba2a349a55f..1383295e720 100644 --- a/src/devices/cpu/x86log.h +++ b/src/devices/cpu/x86log.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_CPU_X86LOG_H +#define MAME_CPU_X86LOG_H -#ifndef __X86LOG_H__ -#define __X86LOG_H__ +#pragma once #include <cstdint> #include <cassert> @@ -38,34 +38,34 @@ typedef uint8_t x86code; /* code logging info */ struct log_comment { - x86code* base; - const char* string; + x86code* base = nullptr; + const char* string = nullptr; }; /* data ranges */ struct data_range_t { - x86code* base; - x86code* end; - int size; + x86code* base = nullptr; + x86code* end = nullptr; + int size = 0; }; /* the code logging context */ struct x86log_context { - std::string filename; /* name of the file */ - FILE* file; /* file we are logging to */ + std::string filename; // name of the file + FILE* file = nullptr; // file we are logging to - data_range_t data_range[MAX_DATA_RANGES]; /* list of data ranges */ - int data_range_count; /* number of data ranges */ + data_range_t data_range[MAX_DATA_RANGES]; // list of data ranges + int data_range_count = 0; // number of data ranges - log_comment comment_list[MAX_COMMENTS]; /* list of comments */ - int comment_count; /* number of live comments */ + log_comment comment_list[MAX_COMMENTS]; // list of comments + int comment_count = 0; // number of live comments - char comment_pool[COMMENT_POOL_SIZE]; /* string pool to hold comments */ - char* comment_pool_next; /* pointer to next string pool location */ + char comment_pool[COMMENT_POOL_SIZE]; // string pool to hold comments + char* comment_pool_next = nullptr; // pointer to next string pool location }; @@ -160,4 +160,4 @@ inline void x86log_printf(x86log_context* log, const char* format, Ts&&... xs) fflush(log->file); } -#endif /* __X86LOG_H__ */ +#endif // MAME_CPU_X86LOG_H diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp index c6e20ba66dd..5d17f822e60 100644 --- a/src/devices/imagedev/cassette.cpp +++ b/src/devices/imagedev/cassette.cpp @@ -26,8 +26,8 @@ DEFINE_DEVICE_TYPE(CASSETTE, cassette_image_device, "cassette_image", "Cassette" // cassette_image_device - constructor //------------------------------------------------- -cassette_image_device::cassette_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, CASSETTE, tag, owner, clock), +cassette_image_device::cassette_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, CASSETTE, tag, owner, clock), device_image_interface(mconfig, *this), device_sound_interface(mconfig, *this), m_cassette(nullptr), @@ -83,13 +83,13 @@ void cassette_image_device::update() switch (int(m_state & CASSETTE_MASK_UISTATE)) // cast to int to suppress unhandled enum value warning { case CASSETTE_RECORD: - cassette_put_sample(m_cassette, m_channel, m_position, new_position - m_position, m_value); + m_cassette->put_sample(m_channel, m_position, new_position - m_position, m_value); break; case CASSETTE_PLAY: if (m_cassette) { - cassette_get_sample(m_cassette, m_channel, new_position, 0.0, &m_value); + m_cassette->get_sample(m_channel, new_position, 0.0, &m_value); // See if reached end of tape double length = get_length(); if (new_position > length) @@ -167,9 +167,7 @@ double cassette_image_device::get_position() double cassette_image_device::get_length() { - struct CassetteInfo info; - - cassette_get_info(m_cassette, &info); + cassette_image::Info info = m_cassette->get_info(); return ((double) info.sample_count) / info.sample_frequency; } @@ -236,7 +234,7 @@ void cassette_image_device::device_start() m_state = m_default_state; m_value = 0; - stream_alloc_legacy(0, (m_stereo? 2:1), machine().sample_rate()); + stream_alloc(0, m_stereo? 2:1, machine().sample_rate()); } image_init_result cassette_image_device::call_create(int format_type, util::option_resolution *format_options) @@ -258,7 +256,7 @@ image_init_result cassette_image_device::internal_load(bool is_create) if (is_create || (length()==0)) // empty existing images are fine to write over. { // creating an image - err = cassette_create((void *)image, &image_ioprocs, &wavfile_format, m_create_opts, CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT, &m_cassette); + err = cassette_image::create((void *)image, &image_ioprocs, &cassette_image::wavfile_format, m_create_opts, cassette_image::FLAG_READWRITE|cassette_image::FLAG_SAVEONEXIT, m_cassette); if (err != cassette_image::error::SUCCESS) goto error; } @@ -273,9 +271,9 @@ image_init_result cassette_image_device::internal_load(bool is_create) // try opening the cassette int cassette_flags = is_readonly() - ? CASSETTE_FLAG_READONLY - : (CASSETTE_FLAG_READWRITE | CASSETTE_FLAG_SAVEONEXIT); - err = cassette_open_choices((void *)image, &image_ioprocs, filetype(), m_formats, cassette_flags, &m_cassette); + ? cassette_image::FLAG_READONLY + : (cassette_image::FLAG_READWRITE | cassette_image::FLAG_SAVEONEXIT); + err = cassette_image::open_choices((void *)image, &image_ioprocs, filetype(), m_formats, cassette_flags, m_cassette); // special case - if we failed due to readwrite not being supported, make the image be read only and retry if (err == cassette_image::error::READ_WRITE_UNSUPPORTED) @@ -337,8 +335,7 @@ void cassette_image_device::call_unload() update(); /* close out the cassette */ - cassette_close(m_cassette); - m_cassette = nullptr; + m_cassette.reset(); /* set to default state, but only change the UI state */ change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE); @@ -404,37 +401,29 @@ std::string cassette_image_device::call_display() // Cassette sound //------------------------------------------------- -void cassette_image_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cassette_image_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left_buffer = outputs[0]; - stream_sample_t *right_buffer = nullptr; - - if (m_stereo) - right_buffer = outputs[1]; - cassette_state state = get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER); if (exists() && (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED))) { cassette_image *cassette = get_image(); double time_index = get_position(); - double duration = ((double) samples) / machine().sample_rate(); + double duration = ((double) outputs[0].samples()) / outputs[0].sample_rate(); - cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT); - if (m_stereo) - cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT); + if (m_samples.size() < outputs[0].samples()) + m_samples.resize(outputs[0].samples()); - for (int i = samples - 1; i >= 0; i--) + for (int ch = 0; ch < outputs.size(); ch++) { - left_buffer[i] = ((int16_t *) left_buffer)[i]; - if (m_stereo) - right_buffer[i] = ((int16_t *) right_buffer)[i]; + cassette->get_samples(0, time_index, duration, outputs[0].samples(), 2, &m_samples[0], cassette_image::WAVEFORM_16BIT); + for (int sampindex = 0; sampindex < outputs[ch].samples(); sampindex++) + outputs[ch].put_int(sampindex, m_samples[sampindex], 32768); } } else { - memset(left_buffer, 0, sizeof(*left_buffer) * samples); - if (m_stereo) - memset(right_buffer, 0, sizeof(*right_buffer) * samples); + for (int ch = 0; ch < outputs.size(); ch++) + outputs[ch].fill(0); } } diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h index a661e8312a8..e36b61d688d 100644 --- a/src/devices/imagedev/cassette.h +++ b/src/devices/imagedev/cassette.h @@ -53,8 +53,8 @@ public: cassette_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~cassette_image_device(); - void set_formats(const struct CassetteFormat* const *formats) { m_formats = formats; } - void set_create_opts(const struct CassetteOptions *create_opts) { m_create_opts = create_opts; } + void set_formats(const cassette_image::Format* const *formats) { m_formats = formats; } + void set_create_opts(const cassette_image::Options *create_opts) { m_create_opts = create_opts; } void set_default_state(cassette_state default_state) { m_default_state = default_state; } void set_interface(const char *interface) { m_interface = interface; } @@ -92,7 +92,7 @@ public: void set_speaker(int state) { change_state(state ? CASSETTE_SPEAKER_ENABLED : CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); } int speaker_on() { return ((m_state & CASSETTE_MASK_SPEAKER) == CASSETTE_SPEAKER_ENABLED) ? 1 : 0; } - cassette_image *get_image() { return m_cassette; } + cassette_image *get_image() { return m_cassette.get(); } double get_position(); double get_length(); void set_speed(double speed); @@ -102,7 +102,7 @@ public: void seek(double time, int origin); // sound stream update overrides - void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; device_sound_interface& set_stereo() { m_stereo = true; return *this; } protected: @@ -117,7 +117,7 @@ protected: void update(); private: - cassette_image *m_cassette; + cassette_image::ptr m_cassette; cassette_state m_state; double m_position; double m_position_time; @@ -126,13 +126,14 @@ private: double m_speed; // speed multiplier for tape speeds other than standard 1.875ips (used in adam driver) int m_direction; // direction select char m_extension_list[256]; - const struct CassetteFormat* const *m_formats; - const struct CassetteOptions *m_create_opts; + const cassette_image::Format* const *m_formats; + const cassette_image::Options *m_create_opts; cassette_state m_default_state; const char * m_interface; image_init_result internal_load(bool is_create); bool m_stereo; + std::vector<s16> m_samples; }; // device type definition diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 3dd96644f1a..cf3ffefd524 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -178,7 +178,7 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t device_image_interface(mconfig, *this), input_format(nullptr), output_format(nullptr), - image(nullptr), + image(), fif_list(nullptr), index_timer(nullptr), tracks(0), @@ -307,7 +307,7 @@ void floppy_image_device::commit_image() if (err != osd_file::error::NONE) popmessage("Error, unable to truncate image: %d", int(err)); - output_format->save(&io, image); + output_format->save(&io, image.get()); } //------------------------------------------------- @@ -459,7 +459,7 @@ image_init_result floppy_image_device::call_load() io.filler = 0xff; int best = 0; floppy_image_format_t *best_format = nullptr; - for(floppy_image_format_t *format = fif_list; format; format = format->next) { + for (floppy_image_format_t *format = fif_list; format; format = format->next) { int score = format->identify(&io, form_factor); if(score > best) { best = score; @@ -467,18 +467,15 @@ image_init_result floppy_image_device::call_load() } } - if(!best_format) - { + if (!best_format) { seterror(IMAGE_ERROR_INVALIDIMAGE, "Unable to identify the image format"); return image_init_result::FAIL; } - image = global_alloc(floppy_image(tracks, sides, form_factor)); - if (!best_format->load(&io, form_factor, image)) - { + image = std::make_unique<floppy_image>(tracks, sides, form_factor); + if (!best_format->load(&io, form_factor, image.get())) { seterror(IMAGE_ERROR_UNSUPPORTED, "Incompatible image format or corrupted data"); - global_free(image); - image = nullptr; + image.reset(); return image_init_result::FAIL; } output_format = is_readonly() ? nullptr : best_format; @@ -501,8 +498,7 @@ void floppy_image_device::call_unload() if (image) { if(image_dirty) commit_image(); - global_free(image); - image = nullptr; + image.reset(); } wpt = 1; // disk sleeve is covering the sensor @@ -526,7 +522,7 @@ void floppy_image_device::call_unload() image_init_result floppy_image_device::call_create(int format_type, util::option_resolution *format_options) { - image = global_alloc(floppy_image(tracks, sides, form_factor)); + image = std::make_unique<floppy_image>(tracks, sides, form_factor); output_format = nullptr; // search for a suitable format based on the extension @@ -1248,7 +1244,7 @@ void floppy_sound_device::device_start() // If we don't have all samples, don't allocate a stream or access sample data. if (m_loaded) { - m_sound = stream_alloc_legacy(0, 1, clock()); // per-floppy stream + m_sound = stream_alloc(0, 1, clock()); // per-floppy stream } register_for_save_states(); } @@ -1369,21 +1365,21 @@ void floppy_sound_device::step(int zone) } //------------------------------------------------- -// sound_stream_update_legacy - update the sound stream +// sound_stream_update - update the sound stream //------------------------------------------------- -void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // We are using only one stream, unlike the parent class // Also, there is no need for interpolation, as we only expect // one sample rate of 44100 for all samples int16_t out; - stream_sample_t *samplebuffer = outputs[0]; + auto &samplebuffer = outputs[0]; int idx = 0; int sampleend = 0; - while (samples-- > 0) + for (int sampindex = 0; sampindex < samplebuffer.samples(); sampindex++) { out = 0; @@ -1477,7 +1473,7 @@ void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } // Write to the stream buffer - *(samplebuffer++) = out; + samplebuffer.put_int(sampindex, out, 32768); } } diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h index d07a12c146c..b163b0b6a42 100644 --- a/src/devices/imagedev/floppy.h +++ b/src/devices/imagedev/floppy.h @@ -154,7 +154,7 @@ protected: floppy_image_format_t *input_format; floppy_image_format_t *output_format; - floppy_image *image; + std::unique_ptr<floppy_image> image; char extension_list[256]; floppy_image_format_t *fif_list; emu_timer *index_timer; @@ -294,7 +294,7 @@ protected: private: // device_sound_interface overrides - void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; sound_stream* m_sound; int m_step_base; diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp index a90cf75ea54..61eabb12217 100644 --- a/src/devices/imagedev/mfmhd.cpp +++ b/src/devices/imagedev/mfmhd.cpp @@ -366,7 +366,7 @@ void mfm_harddisk_device::device_start() m_current_cylinder = m_landing_zone; // Park position m_spinup_timer->adjust(attotime::from_msec(m_spinupms)); - m_cache = global_alloc(mfmhd_trackimage_cache(machine())); + m_cache = std::make_unique<mfmhd_trackimage_cache>(machine()); // In 5 second periods, check whether the cache has dirty lines m_cache_timer->adjust(attotime::from_msec(5000), 0, attotime::from_msec(5000)); @@ -411,7 +411,7 @@ void mfm_harddisk_device::device_reset() void mfm_harddisk_device::device_stop() { - if (m_cache!=nullptr) global_free(m_cache); + m_cache.reset(); } /* @@ -1010,9 +1010,8 @@ mfmhd_trackimage_cache::~mfmhd_trackimage_cache() while (current != nullptr) { - global_free_array(current->encdata); mfmhd_trackimage* currenttmp = current->next; - global_free(current); + delete current; current = currenttmp; } } @@ -1025,7 +1024,7 @@ void mfmhd_trackimage_cache::write_back_one() { if (current->dirty) { - m_mfmhd->write_track(current->encdata, current->cylinder, current->head); + m_mfmhd->write_track(current->encdata.get(), current->cylinder, current->head); current->dirty = false; break; } @@ -1045,7 +1044,7 @@ void mfmhd_trackimage_cache::cleanup() if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head); if (current->dirty) { - m_mfmhd->write_track(current->encdata, current->cylinder, current->head); + m_mfmhd->write_track(current->encdata.get(), current->cylinder, current->head); current->dirty = false; } mfmhd_trackimage* currenttmp = current->next; @@ -1087,11 +1086,11 @@ void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int { if (TRACE_DETAIL) m_machine.logerror("[%s:cache] MFM HD allocate cache slot\n", mfmhd->tag()); previous = current; - current = global_alloc(mfmhd_trackimage); - current->encdata = global_alloc_array(uint16_t, tracksize); + current = new mfmhd_trackimage; + current->encdata = std::make_unique<uint16_t []>(tracksize); // Load the first tracks into the slots - state = m_mfmhd->load_track(current->encdata, cylinder, head); + state = m_mfmhd->load_track(current->encdata.get(), cylinder, head); if (state != CHDERR_NONE) throw emu_fatalerror("Cannot load (c=%d,h=%d) from hard disk", cylinder, head); current->dirty = false; @@ -1148,7 +1147,7 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head) current->next = m_tracks; // put the previous head into the next field m_tracks = current; // set this line as new head } - return current->encdata; + return current->encdata.get(); } else { @@ -1168,11 +1167,11 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head) if (current->dirty) { - m_mfmhd->write_track(current->encdata, current->cylinder, current->head); + m_mfmhd->write_track(current->encdata.get(), current->cylinder, current->head); current->dirty = false; } - state = m_mfmhd->load_track(current->encdata, cylinder, head); + state = m_mfmhd->load_track(current->encdata.get(), cylinder, head); current->dirty = false; current->cylinder = cylinder; diff --git a/src/devices/imagedev/mfmhd.h b/src/devices/imagedev/mfmhd.h index 2d689a168cb..007be4be420 100644 --- a/src/devices/imagedev/mfmhd.h +++ b/src/devices/imagedev/mfmhd.h @@ -27,7 +27,7 @@ public: bool dirty; int cylinder; int head; - uint16_t* encdata; // MFM encoding per byte + std::unique_ptr<uint16_t []> encdata; // MFM encoding per byte mfmhd_trackimage* next; }; @@ -152,7 +152,7 @@ private: attotime m_settle_time; attotime m_step_time; - mfmhd_trackimage_cache* m_cache; + std::unique_ptr<mfmhd_trackimage_cache> m_cache; mfmhd_image_format_t* m_format; void head_move(); diff --git a/src/devices/imagedev/midiin.cpp b/src/devices/imagedev/midiin.cpp index 6086cb48a3e..62c7cba52a1 100644 --- a/src/devices/imagedev/midiin.cpp +++ b/src/devices/imagedev/midiin.cpp @@ -26,7 +26,7 @@ midiin_device::midiin_device(const machine_config &mconfig, const char *tag, dev : device_t(mconfig, MIDIIN, tag, owner, clock), device_image_interface(mconfig, *this), device_serial_interface(mconfig, *this), - m_midi(nullptr), + m_midi(), m_timer(nullptr), m_input_cb(*this), m_xmit_read(0), @@ -43,7 +43,7 @@ void midiin_device::device_start() { m_input_cb.resolve_safe(); m_timer = timer_alloc(0); - m_midi = nullptr; + m_midi.reset(); m_timer->enable(false); } @@ -68,7 +68,7 @@ void midiin_device::device_timer(emu_timer &timer, device_timer_id id, int param uint8_t buf[8192*4]; int bytesRead; - if (m_midi == nullptr) { + if (!m_midi) { return; } @@ -91,14 +91,13 @@ void midiin_device::device_timer(emu_timer &timer, device_timer_id id, int param call_load -------------------------------------------------*/ -image_init_result midiin_device::call_load(void) +image_init_result midiin_device::call_load() { m_midi = machine().osd().create_midi_device(); if (!m_midi->open_input(filename())) { - global_free(m_midi); - m_midi = nullptr; + m_midi.reset(); return image_init_result::FAIL; } @@ -111,15 +110,14 @@ image_init_result midiin_device::call_load(void) call_unload -------------------------------------------------*/ -void midiin_device::call_unload(void) +void midiin_device::call_unload() { if (m_midi) { m_midi->close(); - global_free(m_midi); } - m_timer->enable(false); - m_midi = nullptr; + m_midi.reset(); + m_timer->enable(false); } void midiin_device::tra_complete() diff --git a/src/devices/imagedev/midiin.h b/src/devices/imagedev/midiin.h index ad9eeabf236..dbebdfd71fc 100644 --- a/src/devices/imagedev/midiin.h +++ b/src/devices/imagedev/midiin.h @@ -60,7 +60,7 @@ private: void xmit_char(uint8_t data); - osd_midi_device *m_midi; + std::unique_ptr<osd_midi_device> m_midi; emu_timer *m_timer; devcb_write_line m_input_cb; uint8_t m_xmitring[XMIT_RING_SIZE]; diff --git a/src/devices/imagedev/midiout.cpp b/src/devices/imagedev/midiout.cpp index 3c0613e2015..e9551a50d17 100644 --- a/src/devices/imagedev/midiout.cpp +++ b/src/devices/imagedev/midiout.cpp @@ -26,7 +26,7 @@ midiout_device::midiout_device(const machine_config &mconfig, const char *tag, d : device_t(mconfig, MIDIOUT, tag, owner, clock), device_image_interface(mconfig, *this), device_serial_interface(mconfig, *this), - m_midi(nullptr) + m_midi() { } @@ -36,7 +36,7 @@ midiout_device::midiout_device(const machine_config &mconfig, const char *tag, d void midiout_device::device_start() { - m_midi = nullptr; + m_midi.reset(); } void midiout_device::device_reset() @@ -51,14 +51,13 @@ void midiout_device::device_reset() call_load -------------------------------------------------*/ -image_init_result midiout_device::call_load(void) +image_init_result midiout_device::call_load() { m_midi = machine().osd().create_midi_device(); if (!m_midi->open_output(filename())) { - global_free(m_midi); - m_midi = nullptr; + m_midi.reset(); return image_init_result::FAIL; } @@ -69,13 +68,12 @@ image_init_result midiout_device::call_load(void) call_unload -------------------------------------------------*/ -void midiout_device::call_unload(void) +void midiout_device::call_unload() { if (m_midi) { m_midi->close(); - global_free(m_midi); - m_midi = nullptr; + m_midi.reset(); } } diff --git a/src/devices/imagedev/midiout.h b/src/devices/imagedev/midiout.h index 2b182e0273d..20bc87131c5 100644 --- a/src/devices/imagedev/midiout.h +++ b/src/devices/imagedev/midiout.h @@ -53,7 +53,7 @@ protected: virtual void rcv_complete() override; // Rx completed receiving byte private: - osd_midi_device *m_midi; + std::unique_ptr<osd_midi_device> m_midi; }; // device type definition diff --git a/src/devices/imagedev/picture.cpp b/src/devices/imagedev/picture.cpp index f80bfb2885e..e6736fb10c9 100644 --- a/src/devices/imagedev/picture.cpp +++ b/src/devices/imagedev/picture.cpp @@ -10,7 +10,7 @@ #include "emu.h" #include "picture.h" -#include "png.h" +#include "rendutil.h" /*************************************************************************** TYPE DEFINITIONS @@ -25,8 +25,7 @@ DEFINE_DEVICE_TYPE(IMAGE_PICTURE, picture_image_device, "picture_image", "Still picture_image_device::picture_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, IMAGE_PICTURE, tag, owner, clock), - device_image_interface(mconfig, *this), - m_picture(nullptr) + device_image_interface(mconfig, *this) { } @@ -36,11 +35,6 @@ picture_image_device::picture_image_device(const machine_config &mconfig, const picture_image_device::~picture_image_device() { - if (m_picture) - { - delete m_picture; - m_picture = nullptr; - } } @@ -50,24 +44,31 @@ void picture_image_device::device_start() image_init_result picture_image_device::call_load() { - m_picture = new bitmap_argb32; - if (png_read_bitmap(image_core_file(), *m_picture) != PNGERR_NONE) - { - delete m_picture; - m_picture = nullptr; - - // todo: try JPEG here. - return image_init_result::FAIL; + switch (render_detect_image(image_core_file())) + { + case RENDUTIL_IMGFORMAT_PNG: + render_load_png(m_picture, image_core_file()); + break; + + case RENDUTIL_IMGFORMAT_JPEG: + render_load_jpeg(m_picture, image_core_file()); + break; + + case RENDUTIL_IMGFORMAT_MSDIB: + render_load_msdib(m_picture, image_core_file()); + break; + + default: + m_picture.reset(); } - return image_init_result::PASS; + return m_picture.valid() ? image_init_result::PASS : image_init_result::FAIL; } void picture_image_device::call_unload() { - if (m_picture) + if (m_picture.valid()) { - delete m_picture; - m_picture = nullptr; + m_picture.reset(); } } diff --git a/src/devices/imagedev/picture.h b/src/devices/imagedev/picture.h index f8601345a89..1780a563318 100644 --- a/src/devices/imagedev/picture.h +++ b/src/devices/imagedev/picture.h @@ -41,14 +41,14 @@ public: virtual bool is_reset_on_load() const noexcept override { return false; } virtual const char *file_extensions() const noexcept override { return "png"; } - bitmap_argb32 &get_bitmap() { return *m_picture; } + const bitmap_argb32 &get_bitmap() { return m_picture; } protected: // device-level overrides virtual void device_start() override; private: - bitmap_argb32 *m_picture; + bitmap_argb32 m_picture; }; diff --git a/src/devices/machine/6840ptm.cpp b/src/devices/machine/6840ptm.cpp index 849e59c05a7..21d8c0d80e9 100644 --- a/src/devices/machine/6840ptm.cpp +++ b/src/devices/machine/6840ptm.cpp @@ -156,6 +156,11 @@ void ptm6840_device::device_reset() } } +void ptm6840_device::device_resolve_objects() +{ + for (int i = 0; i < 3; i++) + m_gate[i] = 0; +} //------------------------------------------------- // device_timer - handle timer callbacks diff --git a/src/devices/machine/6840ptm.h b/src/devices/machine/6840ptm.h index 537fd4e7c19..6836aa5d317 100644 --- a/src/devices/machine/6840ptm.h +++ b/src/devices/machine/6840ptm.h @@ -58,6 +58,7 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual void device_resolve_objects() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: diff --git a/src/devices/machine/8364_paula.cpp b/src/devices/machine/8364_paula.cpp index 1e10ca55b3e..6869ffb3395 100644 --- a/src/devices/machine/8364_paula.cpp +++ b/src/devices/machine/8364_paula.cpp @@ -58,7 +58,7 @@ void paula_8364_device::device_start() } // create the stream - m_stream = stream_alloc_legacy(0, 4, clock() / CLOCK_DIVIDER); + m_stream = stream_alloc(0, 4, clock() / CLOCK_DIVIDER); } //------------------------------------------------- @@ -159,10 +159,10 @@ void paula_8364_device::dma_reload(audio_channel *chan) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void paula_8364_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int channum, sampoffs = 0; @@ -176,11 +176,11 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_ // clear the sample data to 0 for (channum = 0; channum < 4; channum++) - memset(outputs[channum], 0, sizeof(stream_sample_t) * samples); + outputs[channum].fill(0); return; } - samples *= CLOCK_DIVIDER; + int samples = outputs[0].samples() * CLOCK_DIVIDER; // update the DMA states on each channel and reload if fresh for (channum = 0; channum < 4; channum++) @@ -215,7 +215,7 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_ audio_channel *chan = &m_channel[channum]; int volume = (nextvol == -1) ? chan->vol : nextvol; int period = (nextper == -1) ? chan->per : nextper; - stream_sample_t sample; + s32 sample; int i; // normalize the volume value @@ -247,7 +247,7 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_ // fill the buffer with the sample for (i = 0; i < ticks; i += CLOCK_DIVIDER) - outputs[channum][(sampoffs + i) / CLOCK_DIVIDER] = sample; + outputs[channum].put_int((sampoffs + i) / CLOCK_DIVIDER, sample, 32768); // account for the ticks; if we hit 0, advance chan->curticks -= ticks; diff --git a/src/devices/machine/8364_paula.h b/src/devices/machine/8364_paula.h index a2ac2feab26..9fa7a6ebf38 100644 --- a/src/devices/machine/8364_paula.h +++ b/src/devices/machine/8364_paula.h @@ -68,7 +68,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp index 36733555e7d..f0ebf10f612 100644 --- a/src/devices/machine/acorn_vidc.cpp +++ b/src/devices/machine/acorn_vidc.cpp @@ -492,9 +492,9 @@ void acorn_vidc10_device::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (is_cursor == true && dot == 0) continue; dot += pen_base; - bitmap.pix32(dsty, dstx+xi) = this->pen(dot); + bitmap.pix(dsty, dstx+xi) = this->pen(dot); if (m_crtc_interlace) - bitmap.pix32(dsty+1, dstx+xi) = this->pen(dot); + bitmap.pix(dsty+1, dstx+xi) = this->pen(dot); } } } diff --git a/src/devices/machine/alpha_8921.h b/src/devices/machine/alpha_8921.h index 88ecd850eb9..a6e8ccdb0ad 100644 --- a/src/devices/machine/alpha_8921.h +++ b/src/devices/machine/alpha_8921.h @@ -2,7 +2,7 @@ // copyright-holders:cam900 /*************************************************************************** - Alpha denshi ALPHA-8921 emulation + Alpha denshi ALPHA-8921 emulation ***************************************************************************/ diff --git a/src/devices/machine/am9519.h b/src/devices/machine/am9519.h index 315e0bd890d..ec84cd50e52 100644 --- a/src/devices/machine/am9519.h +++ b/src/devices/machine/am9519.h @@ -32,7 +32,7 @@ class am9519_device : public device_t { public: - am9519_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + am9519_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); auto out_int_callback() { return m_out_int_func.bind(); } diff --git a/src/devices/machine/bl_handhelds_menucontrol.cpp b/src/devices/machine/bl_handhelds_menucontrol.cpp new file mode 100644 index 00000000000..18982731069 --- /dev/null +++ b/src/devices/machine/bl_handhelds_menucontrol.cpp @@ -0,0 +1,214 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +// Menu controller, stores / increments menu position etc. used on handhelds that typically have BL on the boot screen (BaoBaoLong?) + +#include "emu.h" +#include "machine/bl_handhelds_menucontrol.h" + +DEFINE_DEVICE_TYPE(BL_HANDHELDS_MENUCONTROL, bl_handhelds_menucontrol_device, "blhandheldmenu", "BaoBaoLong Handhelds Menu Controller") + +bl_handhelds_menucontrol_device::bl_handhelds_menucontrol_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, BL_HANDHELDS_MENUCONTROL, tag, owner, clock), + m_is_unsp_type_hack(false) +{ +} + +READ_LINE_MEMBER(bl_handhelds_menucontrol_device::status_r) +{ + return m_clockstate; +} + +READ_LINE_MEMBER(bl_handhelds_menucontrol_device::data_r) +{ + return m_responsebit; +} + +// is there some 'carry' related behavior on the add / remove, because sometimes calculations are off by 1 eg command 0x05 (subtract) subcommand 0xf0 +// edge cases to test - moving up and left off entry 0, moving next / previous page when on any entry on the first/last pages, moving down/right off last entry, crossing 255/256 game boundary +void bl_handhelds_menucontrol_device::handle_command() +{ + uint8_t command = m_command; + + // additions and subtractions here are likely also meant to be done as high byte and low byte + if (m_menustate == MENU_READY_FOR_COMMAND) + { + if (command == 0x00) + { + m_menustate = MENU_COMMAND_00_IN; + m_response = m_menupos & 0xff; + } + else if (command == 0x01) + { + m_menustate = MENU_COMMAND_01_IN; + m_response = (m_menupos >> 8) & 0xff; + } + else if (command == 0x02) + { + m_menustate = MENU_COMMAND_02_IN; + } + else if (command == 0x03) + { + m_menustate = MENU_COMMAND_03_IN; + } + else if (command == 0x04) + { + m_menustate = MENU_COMMAND_04_IN; + } + else if (command == 0x05) + { + m_menustate = MENU_COMMAND_05_IN; + } + else if (command == 0x09) + { + // ... + } + else if ((command) == 0x10) + { + // this is followed by 0x1b, written if you try to move right off last entry + m_menupos = 0x00; + } + else if (command == 0x30) + { + m_menupos++; + } + else if (command == 0x37) + { + m_menupos--; + } + else if (command == 0x39) + { + m_menupos -= 4; + } + else if (command == 0x2c) + { + m_menupos = 0x01; + } + else + { + logerror("handle_command %02x (unknown)\n", command); + } + } + else if (m_menustate == MENU_COMMAND_00_IN) + { + m_menustate = MENU_READY_FOR_COMMAND; + } + else if (m_menustate == MENU_COMMAND_01_IN) + { + m_menustate = MENU_READY_FOR_COMMAND; + } + else if (m_menustate == MENU_COMMAND_02_IN) + { + m_menupos = (m_menupos & 0xff00) | ((command - 0x8) & 0xff); + m_menustate = MENU_READY_FOR_COMMAND; + } + else if (m_menustate == MENU_COMMAND_03_IN) + { + m_menupos = (m_menupos & 0x00ff) | (((command - 0x9) & 0xff) << 8); + m_menustate = MENU_READY_FOR_COMMAND; + } + else if (m_menustate == MENU_COMMAND_04_IN) + { + // used if you try to scroll up or left past 0 and the value becomes too large (a negative number) + if (m_is_unsp_type_hack) + { + if (command == 0x0d) + m_menupos += 4; + else if (command == 0x0a) + m_menupos += 0; + // used if you try to scroll up or left past 0 and the value becomes too large (a negative number) + // actually writes 0x314 split into 2 commands, so the 2nd write to 0x04 with param then instead 0b/16 sequence of writes instead of 26/0c adds to the high byte? + else if (command == 0x1e) + m_menupos += 0x310; + } + else + { + m_menupos += (command - 0x09); + m_menustate = MENU_READY_FOR_COMMAND; + } + + m_menustate = MENU_READY_FOR_COMMAND; + } + else if (m_menustate == MENU_COMMAND_05_IN) + { + // used if you try to scroll down past the and the value becomes too large + if (m_is_unsp_type_hack) + { + // actually writes 0x313 split into 2 commands, so the 2nd write to 0x05 with param then instead 0b/16 sequence of writes instead of 26/0c subtracts from the high byte? + if (command == 0x0b) + { + m_menupos -= 0xdc; + } + else if (command == 0x0e) + { + m_menupos -= 0x314; + } + } + else + { + if (command != 0xf0) + m_menupos -= (command - 0x0b); + else + m_menupos -= (command - 0x0a); // dphh8630 when pressing 'right' on final menu page + } + + m_menustate = MENU_READY_FOR_COMMAND; + } +} + +WRITE_LINE_MEMBER(bl_handhelds_menucontrol_device::clock_w) +{ + if (state) + { + m_clockstate = 1; + } + else + { + m_clockstate = 0; + m_command <<= 1; + m_command |= ((m_commandbit)); + m_responsebit = (m_response >> (7 - m_datashifterpos)) & 1; + m_datashifterpos++; + + if (m_datashifterpos == 8) + { + m_datashifterpos = 0; + handle_command(); + } + } +} + +WRITE_LINE_MEMBER(bl_handhelds_menucontrol_device::data_w) +{ + m_commandbit = state; +} + +WRITE_LINE_MEMBER(bl_handhelds_menucontrol_device::reset_w) +{ + m_datashifterpos = 0; +} + +void bl_handhelds_menucontrol_device::device_start() +{ + m_responsebit = 0; + m_clockstate = 0; + m_command = 0; + m_datashifterpos = 0; + m_menupos = 0; + m_response = 0; + m_commandbit = 0; + m_menustate = MENU_READY_FOR_COMMAND; + + save_item(NAME(m_menupos)); + save_item(NAME(m_clockstate)); + save_item(NAME(m_datashifterpos)); + save_item(NAME(m_responsebit)); + save_item(NAME(m_response)); + save_item(NAME(m_commandbit)); + save_item(NAME(m_command)); + save_item(NAME(m_menustate)); +} + +void bl_handhelds_menucontrol_device::device_reset() +{ +} diff --git a/src/devices/machine/bl_handhelds_menucontrol.h b/src/devices/machine/bl_handhelds_menucontrol.h new file mode 100644 index 00000000000..747a60db76b --- /dev/null +++ b/src/devices/machine/bl_handhelds_menucontrol.h @@ -0,0 +1,64 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#ifndef MAME_MACHINE_BL_HANDHELDS_MENUCONTROL_H +#define MAME_MACHINE_BL_HANDHELDS_MENUCONTROL_H + +#pragma once + +DECLARE_DEVICE_TYPE(BL_HANDHELDS_MENUCONTROL, bl_handhelds_menucontrol_device) + +class bl_handhelds_menucontrol_device : public device_t +{ +public: + // construction/destruction + bl_handhelds_menucontrol_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // the chip is the same between systems, but there's some logic not fully understood that is causing off-by-1 errors on some calcs + void set_is_unsp_type_hack() { m_is_unsp_type_hack = true; } + + DECLARE_READ_LINE_MEMBER(status_r); + DECLARE_READ_LINE_MEMBER(data_r); + DECLARE_WRITE_LINE_MEMBER(clock_w); + DECLARE_WRITE_LINE_MEMBER(data_w); + DECLARE_WRITE_LINE_MEMBER(reset_w); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: + // config + bool m_is_unsp_type_hack; + + // internal state + uint16_t m_menupos; + + // command handling + uint8_t m_clockstate; + uint8_t m_datashifterpos; + + uint8_t m_responsebit; + uint8_t m_response; + + uint8_t m_commandbit; + uint8_t m_command; + + void handle_command(); + + enum menustate : uint8_t + { + MENU_READY_FOR_COMMAND = 0, + + MENU_COMMAND_00_IN, + MENU_COMMAND_01_IN, + MENU_COMMAND_02_IN, + MENU_COMMAND_03_IN, + MENU_COMMAND_04_IN, + MENU_COMMAND_05_IN, + }; + + uint8_t m_menustate; +}; + +#endif // MAME_MACHINE_BL_HANDHELDS_MENUCONTROL_H diff --git a/src/devices/machine/bq4847.cpp b/src/devices/machine/bq4847.cpp index 09afd9b9424..7dd9031c814 100644 --- a/src/devices/machine/bq4847.cpp +++ b/src/devices/machine/bq4847.cpp @@ -305,6 +305,8 @@ uint8_t bq4847_device::read(offs_t address) set_register(reg_flags, 0xff, false); m_interrupt_cb(intrq_r()); } + else + if (regnum == reg_unused) value = 0; // Reg 15 is locked to 0 in BQ4847 LOGMASKED(LOG_REG, "Reg %d -> %02x\n", regnum, value); diff --git a/src/devices/machine/cs8900a.cpp b/src/devices/machine/cs8900a.cpp index 8a33504a2d8..6f6535150f7 100644 --- a/src/devices/machine/cs8900a.cpp +++ b/src/devices/machine/cs8900a.cpp @@ -4,11 +4,11 @@ /************************************************************************* - CS8900A ethernet controller implementation + CS8900A ethernet controller implementation - by Rhett Aultman <roadriverrail@gmail.com> - ported to MAME from VICE Project (https://sourceforge.net/p/vice-emu/) - VICE CS8900 code by Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de> + by Rhett Aultman <roadriverrail@gmail.com> + ported to MAME from VICE Project (https://sourceforge.net/p/vice-emu/) + VICE CS8900 code by Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de> **************************************************************************/ @@ -20,17 +20,17 @@ DEFINE_DEVICE_TYPE(CS8900A, cs8900a_device, "cs8900a", "CS8900A Crystal LAN 10Base-T Ethernet MAC") /* warn illegal behaviour */ -#define CS8900_DEBUG_WARN_REG (1 << 1U) /* warn about invalid register accesses */ -#define CS8900_DEBUG_WARN_RXTX (1 << 2U) /* warn about invalid rx or tx conditions */ +#define CS8900_DEBUG_WARN_REG (1 << 1U) /* warn about invalid register accesses */ +#define CS8900_DEBUG_WARN_RXTX (1 << 2U) /* warn about invalid rx or tx conditions */ -#define CS8900_DEBUG (1 << 3U) /* enable to see port reads */ +#define CS8900_DEBUG (1 << 3U) /* enable to see port reads */ #define CS8900_DEBUG_INIT (1 << 4U) -#define CS8900_DEBUG_LOAD (1 << 5U) /* enable to see port reads */ -#define CS8900_DEBUG_STORE (1 << 6U) /* enable to see port writes */ -#define CS8900_DEBUG_REGISTERS (1 << 7U) /* enable to see CS8900a register I/O */ -#define CS8900_DEBUG_RXTX_STATE (1 << 8U) /* enable to see tranceiver state changes */ -#define CS8900_DEBUG_RXTX_DATA (1 << 9U) /* enable to see data in/out flow */ -#define CS8900_DEBUG_FRAMES (1 << 10U) /* enable to see arch frame send/recv */ +#define CS8900_DEBUG_LOAD (1 << 5U) /* enable to see port reads */ +#define CS8900_DEBUG_STORE (1 << 6U) /* enable to see port writes */ +#define CS8900_DEBUG_REGISTERS (1 << 7U) /* enable to see CS8900a register I/O */ +#define CS8900_DEBUG_RXTX_STATE (1 << 8U) /* enable to see tranceiver state changes */ +#define CS8900_DEBUG_RXTX_DATA (1 << 9U) /* enable to see data in/out flow */ +#define CS8900_DEBUG_FRAMES (1 << 10U) /* enable to see arch frame send/recv */ /** #define CS8900_DEBUG_IGNORE_RXEVENT 1 **/ /* enable to ignore RXEVENT in DEBUG_REGISTERS */ #define VERBOSE 0 @@ -41,57 +41,57 @@ DEFINE_DEVICE_TYPE(CS8900A, cs8900a_device, "cs8900a", "CS8900A Crystal LAN 10Ba /* CS8900 registers */ -/* these are the 8 16-bit-ports for "I/O space configuration" - (see 4.10 on page 75 of cs8900a-4.pdf, the cs8900a data sheet) +/* these are the 8 16-bit-ports for "I/O space configuration" + (see 4.10 on page 75 of cs8900a-4.pdf, the cs8900a data sheet) - REMARK: The code operatoes the cs8900a in IO space configuration, as - it generates I/OW and I/OR signals. + REMARK: The code operatoes the cs8900a in IO space configuration, as + it generates I/OW and I/OR signals. */ /* - RW: RXTXDATA = DE00/DE01 - RW: RXTXDATA2 = DE02/DE03 (for 32-bit-operation) - -W: TXCMD = DE04/DE05 (TxCMD, Transmit Command) mapped to PP + 0144 (Reg. 9, Sec. 4.4, page 46) - -W: TXLENGTH = DE06/DE07 (TxLenght, Transmit Length) mapped to PP + 0146 - R-: INTSTQUEUE = DE08/DE09 (Interrupt Status Queue) mapped to PP + 0120 (ISQ, Sec. 5.1, page 78) - RW: PP_PTR = DE0A/DE0B (PacketPage Pointer) (see. page 75p: Read -011.---- ----.----) - RW: PP_DATA0 = DE0C/DE0D (PacketPage Data (Port 0)) - RW: PP_DATA1 = DE0E/DE0F (PacketPage Data (Port 1)) (for 32 bit only) + RW: RXTXDATA = DE00/DE01 + RW: RXTXDATA2 = DE02/DE03 (for 32-bit-operation) + -W: TXCMD = DE04/DE05 (TxCMD, Transmit Command) mapped to PP + 0144 (Reg. 9, Sec. 4.4, page 46) + -W: TXLENGTH = DE06/DE07 (TxLenght, Transmit Length) mapped to PP + 0146 + R-: INTSTQUEUE = DE08/DE09 (Interrupt Status Queue) mapped to PP + 0120 (ISQ, Sec. 5.1, page 78) + RW: PP_PTR = DE0A/DE0B (PacketPage Pointer) (see. page 75p: Read -011.---- ----.----) + RW: PP_DATA0 = DE0C/DE0D (PacketPage Data (Port 0)) + RW: PP_DATA1 = DE0E/DE0F (PacketPage Data (Port 1)) (for 32 bit only) */ enum io_space_conf_regs_e : u8 { - CS8900_ADDR_RXTXDATA = 0x00, /* RW */ - CS8900_ADDR_RXTXDATA2 = 0x02, /* RW 32 bit only! */ - CS8900_ADDR_TXCMD = 0x04, /* -W Maps to PP+0144 */ - CS8900_ADDR_TXLENGTH = 0x06, /* -W Maps to PP+0146 */ - CS8900_ADDR_INTSTQUEUE = 0x08, /* R- Interrupt status queue, maps to PP + 0120 */ - CS8900_ADDR_PP_PTR = 0x0a, /* RW PacketPage Pointer */ - CS8900_ADDR_PP_DATA = 0x0c, /* RW PacketPage Data, Port 0 */ - CS8900_ADDR_PP_DATA2 = 0x0e /* RW PacketPage Data, Port 1 - 32 bit only */ + CS8900_ADDR_RXTXDATA = 0x00, /* RW */ + CS8900_ADDR_RXTXDATA2 = 0x02, /* RW 32 bit only! */ + CS8900_ADDR_TXCMD = 0x04, /* -W Maps to PP+0144 */ + CS8900_ADDR_TXLENGTH = 0x06, /* -W Maps to PP+0146 */ + CS8900_ADDR_INTSTQUEUE = 0x08, /* R- Interrupt status queue, maps to PP + 0120 */ + CS8900_ADDR_PP_PTR = 0x0a, /* RW PacketPage Pointer */ + CS8900_ADDR_PP_DATA = 0x0c, /* RW PacketPage Data, Port 0 */ + CS8900_ADDR_PP_DATA2 = 0x0e /* RW PacketPage Data, Port 1 - 32 bit only */ }; /* Makros for reading and writing the visible register: */ -#define GET_CS8900_8(_xxx_) \ - (assert(_xxx_ < CS8900_COUNT_IO_REGISTER), \ - cs8900_ioregs[_xxx_] \ +#define GET_CS8900_8(_xxx_) \ + (assert(_xxx_ < CS8900_COUNT_IO_REGISTER), \ + cs8900_ioregs[_xxx_] \ ) -#define SET_CS8900_8(_xxx_, _val_) \ - do { \ - assert(_xxx_ < CS8900_COUNT_IO_REGISTER); \ - cs8900_ioregs[_xxx_] = (_val_) & 0xff; \ +#define SET_CS8900_8(_xxx_, _val_) \ + do { \ + assert(_xxx_ < CS8900_COUNT_IO_REGISTER); \ + cs8900_ioregs[_xxx_] = (_val_) & 0xff; \ } while (0) -#define GET_CS8900_16(_xxx_) \ - (assert(_xxx_ < CS8900_COUNT_IO_REGISTER), \ - cs8900_ioregs[_xxx_] | (cs8900_ioregs[_xxx_ + 1] << 8) \ +#define GET_CS8900_16(_xxx_) \ + (assert(_xxx_ < CS8900_COUNT_IO_REGISTER), \ + cs8900_ioregs[_xxx_] | (cs8900_ioregs[_xxx_ + 1] << 8) \ ) -#define SET_CS8900_16(_xxx_, _val_) \ - do { \ - assert(_xxx_ < CS8900_COUNT_IO_REGISTER); \ - cs8900_ioregs[_xxx_] = (_val_) & 0xff; \ - cs8900_ioregs[_xxx_ + 1] = (_val_ >> 8) & 0xff; \ +#define SET_CS8900_16(_xxx_, _val_) \ + do { \ + assert(_xxx_ < CS8900_COUNT_IO_REGISTER); \ + cs8900_ioregs[_xxx_] = (_val_) & 0xff; \ + cs8900_ioregs[_xxx_ + 1] = (_val_ >> 8) & 0xff; \ } while (0) /* The PacketPage register */ @@ -99,106 +99,106 @@ enum io_space_conf_regs_e : u8 { /* Macros for reading and writing the PacketPage register: */ -#define GET_PP_8(_xxx_) \ - (assert(_xxx_ < MAX_PACKETPAGE_ARRAY), \ - cs8900_packetpage[_xxx_] \ +#define GET_PP_8(_xxx_) \ + (assert(_xxx_ < MAX_PACKETPAGE_ARRAY), \ + cs8900_packetpage[_xxx_] \ ) -#define GET_PP_16(_xxx_) \ - (assert(_xxx_ < MAX_PACKETPAGE_ARRAY), \ - assert((_xxx_ & 1) == 0), \ - ((u16)cs8900_packetpage[_xxx_]) \ - |((u16)cs8900_packetpage[_xxx_ + 1] << 8) \ +#define GET_PP_16(_xxx_) \ + (assert(_xxx_ < MAX_PACKETPAGE_ARRAY), \ + assert((_xxx_ & 1) == 0), \ + ((u16)cs8900_packetpage[_xxx_]) \ + |((u16)cs8900_packetpage[_xxx_ + 1] << 8) \ ) -#define GET_PP_32(_xxx_) \ - (assert(_xxx_ < MAX_PACKETPAGE_ARRAY), \ - assert((_xxx_ & 3) == 0), \ - (((u32)cs8900_packetpage[_xxx_])) \ - |(((u32)cs8900_packetpage[_xxx_ + 1]) << 8) \ - |(((u32)cs8900_packetpage[_xxx_ + 2]) << 16) \ - |(((u32)cs8900_packetpage[_xxx_ + 3]) << 24) \ +#define GET_PP_32(_xxx_) \ + (assert(_xxx_ < MAX_PACKETPAGE_ARRAY), \ + assert((_xxx_ & 3) == 0), \ + (((u32)cs8900_packetpage[_xxx_])) \ + |(((u32)cs8900_packetpage[_xxx_ + 1]) << 8) \ + |(((u32)cs8900_packetpage[_xxx_ + 2]) << 16) \ + |(((u32)cs8900_packetpage[_xxx_ + 3]) << 24) \ ) -#define SET_PP_8(_xxx_, _val_) \ - do { \ - assert(_xxx_ < MAX_PACKETPAGE_ARRAY); \ - cs8900_packetpage[_xxx_] = (_val_) & 0xFF; \ +#define SET_PP_8(_xxx_, _val_) \ + do { \ + assert(_xxx_ < MAX_PACKETPAGE_ARRAY); \ + cs8900_packetpage[_xxx_] = (_val_) & 0xFF; \ } while (0) -#define SET_PP_16(_xxx_, _val_) \ - do { \ - assert(_xxx_ < MAX_PACKETPAGE_ARRAY); \ - assert((_xxx_ & 1) == 0), \ - cs8900_packetpage[_xxx_] = (_val_) & 0xFF; \ - cs8900_packetpage[_xxx_ + 1] = (_val_ >> 8) & 0xFF; \ +#define SET_PP_16(_xxx_, _val_) \ + do { \ + assert(_xxx_ < MAX_PACKETPAGE_ARRAY); \ + assert((_xxx_ & 1) == 0), \ + cs8900_packetpage[_xxx_] = (_val_) & 0xFF; \ + cs8900_packetpage[_xxx_ + 1] = (_val_ >> 8) & 0xFF; \ } while (0) -#define SET_PP_32(_xxx_, _val_) \ - do { \ - assert(_xxx_ < MAX_PACKETPAGE_ARRAY); \ - assert((_xxx_ & 3) == 0), \ - cs8900_packetpage[_xxx_] = (_val_) & 0xFF; \ - cs8900_packetpage[_xxx_ + 1] = (_val_ >> 8) & 0xFF; \ - cs8900_packetpage[_xxx_ + 2] = (_val_ >> 16) & 0xFF; \ - cs8900_packetpage[_xxx_ + 3] = (_val_ >> 24) & 0xFF; \ +#define SET_PP_32(_xxx_, _val_) \ + do { \ + assert(_xxx_ < MAX_PACKETPAGE_ARRAY); \ + assert((_xxx_ & 3) == 0), \ + cs8900_packetpage[_xxx_] = (_val_) & 0xFF; \ + cs8900_packetpage[_xxx_ + 1] = (_val_ >> 8) & 0xFF; \ + cs8900_packetpage[_xxx_ + 2] = (_val_ >> 16) & 0xFF; \ + cs8900_packetpage[_xxx_ + 3] = (_val_ >> 24) & 0xFF; \ } while (0) enum packetpage_regs_e : u16 { /* The packetpage register: see p. 39f */ - CS8900_PP_ADDR_PRODUCTID = 0x0000, /* R- - 4.3., p. 41 */ - CS8900_PP_ADDR_IOBASE = 0x0020, /* i RW - 4.3., p. 41 - 4.7., p. 72 */ - CS8900_PP_ADDR_INTNO = 0x0022, /* i RW - 3.2., p. 17 - 4.3., p. 41 */ - CS8900_PP_ADDR_DMA_CHAN = 0x0024, /* i RW - 3.2., p. 17 - 4.3., p. 41 */ - CS8900_PP_ADDR_DMA_SOF = 0x0026, /* ? R- - 4.3., p. 41 - 5.4., p. 89 */ - CS8900_PP_ADDR_DMA_FC = 0x0028, /* ? R- - 4.3., p. 41, "Receive DMA" */ - CS8900_PP_ADDR_RXDMA_BC = 0x002a, /* ? R- - 4.3., p. 41 - 5.4., p. 89 */ - CS8900_PP_ADDR_MEMBASE = 0x002c, /* i RW - 4.3., p. 41 - 4.9., p. 73 */ - CS8900_PP_ADDR_BPROM_BASE = 0x0030, /* i RW - 3.6., p. 24 - 4.3., p. 41 */ - CS8900_PP_ADDR_BPROM_MASK = 0x0034, /* i RW - 3.6., p. 24 - 4.3., p. 41 */ + CS8900_PP_ADDR_PRODUCTID = 0x0000, /* R- - 4.3., p. 41 */ + CS8900_PP_ADDR_IOBASE = 0x0020, /* i RW - 4.3., p. 41 - 4.7., p. 72 */ + CS8900_PP_ADDR_INTNO = 0x0022, /* i RW - 3.2., p. 17 - 4.3., p. 41 */ + CS8900_PP_ADDR_DMA_CHAN = 0x0024, /* i RW - 3.2., p. 17 - 4.3., p. 41 */ + CS8900_PP_ADDR_DMA_SOF = 0x0026, /* ? R- - 4.3., p. 41 - 5.4., p. 89 */ + CS8900_PP_ADDR_DMA_FC = 0x0028, /* ? R- - 4.3., p. 41, "Receive DMA" */ + CS8900_PP_ADDR_RXDMA_BC = 0x002a, /* ? R- - 4.3., p. 41 - 5.4., p. 89 */ + CS8900_PP_ADDR_MEMBASE = 0x002c, /* i RW - 4.3., p. 41 - 4.9., p. 73 */ + CS8900_PP_ADDR_BPROM_BASE = 0x0030, /* i RW - 3.6., p. 24 - 4.3., p. 41 */ + CS8900_PP_ADDR_BPROM_MASK = 0x0034, /* i RW - 3.6., p. 24 - 4.3., p. 41 */ /* 0x0038 - 0x003F: reserved */ - CS8900_PP_ADDR_EEPROM_CMD = 0x0040, /* i RW - 3.5., p. 23 - 4.3., p. 41 */ - CS8900_PP_ADDR_EEPROM_DATA = 0x0042, /* i RW - 3.5., p. 23 - 4.3., p. 41 */ + CS8900_PP_ADDR_EEPROM_CMD = 0x0040, /* i RW - 3.5., p. 23 - 4.3., p. 41 */ + CS8900_PP_ADDR_EEPROM_DATA = 0x0042, /* i RW - 3.5., p. 23 - 4.3., p. 41 */ /* 0x0044 - 0x004F: reserved */ - CS8900_PP_ADDR_REC_FRAME_BC = 0x0050, /* RW - 4.3., p. 41 - 5.2.9., p. 86 */ + CS8900_PP_ADDR_REC_FRAME_BC = 0x0050, /* RW - 4.3., p. 41 - 5.2.9., p. 86 */ /* 0x0052 - 0x00FF: reserved */ - CS8900_PP_ADDR_CONF_CTRL = 0x0100, /* - RW - 4.4., p. 46; see below */ - CS8900_PP_ADDR_STATUS_EVENT = 0x0120, /* - R- - 4.4., p. 46; see below */ + CS8900_PP_ADDR_CONF_CTRL = 0x0100, /* - RW - 4.4., p. 46; see below */ + CS8900_PP_ADDR_STATUS_EVENT = 0x0120, /* - R- - 4.4., p. 46; see below */ /* 0x0140 - 0x0143: reserved */ - CS8900_PP_ADDR_TXCMD = 0x0144, /* # -W - 4.5., p. 70 - 5.7., p. 98 */ - CS8900_PP_ADDR_TXLENGTH = 0x0146, /* # -W - 4.5., p. 70 - 5.7., p. 98 */ + CS8900_PP_ADDR_TXCMD = 0x0144, /* # -W - 4.5., p. 70 - 5.7., p. 98 */ + CS8900_PP_ADDR_TXLENGTH = 0x0146, /* # -W - 4.5., p. 70 - 5.7., p. 98 */ /* 0x0148 - 0x014F: reserved */ - CS8900_PP_ADDR_LOG_ADDR_FILTER = 0x0150, /* RW - 4.6., p. 71 - 5.3., p. 86 */ - CS8900_PP_ADDR_MAC_ADDR = 0x0158, /* # RW - 4.6., p. 71 - 5.3., p. 86 */ + CS8900_PP_ADDR_LOG_ADDR_FILTER = 0x0150, /* RW - 4.6., p. 71 - 5.3., p. 86 */ + CS8900_PP_ADDR_MAC_ADDR = 0x0158, /* # RW - 4.6., p. 71 - 5.3., p. 86 */ /* 0x015E - 0x03FF: reserved */ - CS8900_PP_ADDR_RXSTATUS = 0x0400, /* R- - 4.7., p. 72 - 5.2., p. 78 */ - CS8900_PP_ADDR_RXLENGTH = 0x0402, /* R- - 4.7., p. 72 - 5.2., p. 78 */ - CS8900_PP_ADDR_RX_FRAMELOC = 0x0404, /* R- - 4.7., p. 72 - 5.2., p. 78 */ + CS8900_PP_ADDR_RXSTATUS = 0x0400, /* R- - 4.7., p. 72 - 5.2., p. 78 */ + CS8900_PP_ADDR_RXLENGTH = 0x0402, /* R- - 4.7., p. 72 - 5.2., p. 78 */ + CS8900_PP_ADDR_RX_FRAMELOC = 0x0404, /* R- - 4.7., p. 72 - 5.2., p. 78 */ /* here, the received frame is stored */ - CS8900_PP_ADDR_TX_FRAMELOC = 0x0A00, /* -W - 4.7., p. 72 - 5.7., p. 98 */ + CS8900_PP_ADDR_TX_FRAMELOC = 0x0A00, /* -W - 4.7., p. 72 - 5.7., p. 98 */ /* here, the frame to transmit is stored */ - CS8900_PP_ADDR_END = 0x1000, /* memory to CS8900_PP_ADDR_END-1 is used */ + CS8900_PP_ADDR_END = 0x1000, /* memory to CS8900_PP_ADDR_END-1 is used */ /* CS8900_PP_ADDR_CONF_CTRL is subdivided: */ - CS8900_PP_ADDR_CC_RXCFG = 0x0102, /* # RW - 4.4.6., p. 52 - 0003 */ - CS8900_PP_ADDR_CC_RXCTL = 0x0104, /* # RW - 4.4.8., p. 54 - 0005 */ - CS8900_PP_ADDR_CC_TXCFG = 0x0106, /* RW - 4.4.9., p. 55 - 0007 */ - CS8900_PP_ADDR_CC_TXCMD = 0x0108, /* R- - 4.4.11., p. 57 - 0009 */ - CS8900_PP_ADDR_CC_BUFCFG = 0x010A, /* RW - 4.4.12., p. 58 - 000B */ - CS8900_PP_ADDR_CC_LINECTL = 0x0112, /* # RW - 4.4.16., p. 62 - 0013 */ - CS8900_PP_ADDR_CC_SELFCTL = 0x0114, /* RW - 4.4.18., p. 64 - 0015 */ - CS8900_PP_ADDR_CC_BUSCTL = 0x0116, /* RW - 4.4.20., p. 66 - 0017 */ - CS8900_PP_ADDR_CC_TESTCTL = 0x0118, /* RW - 4.4.22., p. 68 - 0019 */ + CS8900_PP_ADDR_CC_RXCFG = 0x0102, /* # RW - 4.4.6., p. 52 - 0003 */ + CS8900_PP_ADDR_CC_RXCTL = 0x0104, /* # RW - 4.4.8., p. 54 - 0005 */ + CS8900_PP_ADDR_CC_TXCFG = 0x0106, /* RW - 4.4.9., p. 55 - 0007 */ + CS8900_PP_ADDR_CC_TXCMD = 0x0108, /* R- - 4.4.11., p. 57 - 0009 */ + CS8900_PP_ADDR_CC_BUFCFG = 0x010A, /* RW - 4.4.12., p. 58 - 000B */ + CS8900_PP_ADDR_CC_LINECTL = 0x0112, /* # RW - 4.4.16., p. 62 - 0013 */ + CS8900_PP_ADDR_CC_SELFCTL = 0x0114, /* RW - 4.4.18., p. 64 - 0015 */ + CS8900_PP_ADDR_CC_BUSCTL = 0x0116, /* RW - 4.4.20., p. 66 - 0017 */ + CS8900_PP_ADDR_CC_TESTCTL = 0x0118, /* RW - 4.4.22., p. 68 - 0019 */ /* CS8900_PP_ADDR_STATUS_EVENT is subdivided: */ - CS8900_PP_ADDR_SE_ISQ = 0x0120, /* R- - 4.4.5., p. 51 - 0000 */ - CS8900_PP_ADDR_SE_RXEVENT = 0x0124, /* # R- - 4.4.7., p. 53 - 0004 */ - CS8900_PP_ADDR_SE_TXEVENT = 0x0128, /* R- - 4.4.10., p. 56 - 0008 */ - CS8900_PP_ADDR_SE_BUFEVENT = 0x012C, /* R- - 4.4.13., p. 59 - 000C */ - CS8900_PP_ADDR_SE_RXMISS = 0x0130, /* R- - 4.4.14., p. 60 - 0010 */ - CS8900_PP_ADDR_SE_TXCOL = 0x0132, /* R- - 4.4.15., p. 61 - 0012 */ - CS8900_PP_ADDR_SE_LINEST = 0x0134, /* R- - 4.4.17., p. 63 - 0014 */ - CS8900_PP_ADDR_SE_SELFST = 0x0136, /* R- - 4.4.19., p. 65 - 0016 */ - CS8900_PP_ADDR_SE_BUSST = 0x0138, /* # R- - 4.4.21., p. 67 - 0018 */ - CS8900_PP_ADDR_SE_TDR = 0x013C /* R- - 4.4.23., p. 69 - 001C */ + CS8900_PP_ADDR_SE_ISQ = 0x0120, /* R- - 4.4.5., p. 51 - 0000 */ + CS8900_PP_ADDR_SE_RXEVENT = 0x0124, /* # R- - 4.4.7., p. 53 - 0004 */ + CS8900_PP_ADDR_SE_TXEVENT = 0x0128, /* R- - 4.4.10., p. 56 - 0008 */ + CS8900_PP_ADDR_SE_BUFEVENT = 0x012C, /* R- - 4.4.13., p. 59 - 000C */ + CS8900_PP_ADDR_SE_RXMISS = 0x0130, /* R- - 4.4.14., p. 60 - 0010 */ + CS8900_PP_ADDR_SE_TXCOL = 0x0132, /* R- - 4.4.15., p. 61 - 0012 */ + CS8900_PP_ADDR_SE_LINEST = 0x0134, /* R- - 4.4.17., p. 63 - 0014 */ + CS8900_PP_ADDR_SE_SELFST = 0x0136, /* R- - 4.4.19., p. 65 - 0016 */ + CS8900_PP_ADDR_SE_BUSST = 0x0138, /* # R- - 4.4.21., p. 67 - 0018 */ + CS8900_PP_ADDR_SE_TDR = 0x013C /* R- - 4.4.23., p. 69 - 001C */ }; enum tx_rx_min_max_e : u16 { @@ -209,21 +209,21 @@ enum tx_rx_min_max_e : u16 { }; enum cs8900_tx_state_e : u8 { - CS8900_TX_IDLE = 0, - CS8900_TX_GOT_CMD = 1, - CS8900_TX_GOT_LEN = 2, - CS8900_TX_READ_BUSST = 3 + CS8900_TX_IDLE = 0, + CS8900_TX_GOT_CMD = 1, + CS8900_TX_GOT_LEN = 2, + CS8900_TX_READ_BUSST = 3 }; enum cs8900_rx_state_e : u8 { - CS8900_RX_IDLE = 0, - CS8900_RX_GOT_FRAME = 1 + CS8900_RX_IDLE = 0, + CS8900_RX_GOT_FRAME = 1 }; enum pp_ptr_masks_e : u16 { - PP_PTR_AUTO_INCR_FLAG = 0x8000, /* auto increment flag in package pointer */ - PP_PTR_FLAG_MASK = 0xf000, /* is always : x y 1 1 (with x=auto incr) */ - PP_PTR_ADDR_MASK = 0x0fff /* address portion of packet page pointer */ + PP_PTR_AUTO_INCR_FLAG = 0x8000, /* auto increment flag in package pointer */ + PP_PTR_FLAG_MASK = 0xf000, /* is always : x y 1 1 (with x=auto incr) */ + PP_PTR_ADDR_MASK = 0x0fff /* address portion of packet page pointer */ }; #define LO_BYTE(x) (u8)((x)& 0xff) @@ -255,10 +255,10 @@ void cs8900a_device::cs8900_set_tx_status(int ready, int error) u16 new_status = old_status & ~0x180; if (ready) - new_status |= 0x100; /* set Rdy4TxNOW */ + new_status |= 0x100; /* set Rdy4TxNOW */ if (error) - new_status |= 0x080; /* set TxBidErr */ + new_status |= 0x080; /* set TxBidErr */ if (new_status != old_status) { @@ -301,39 +301,39 @@ void cs8900a_device::device_reset() SET_PP_16(CS8900_PP_ADDR_DMA_CHAN, 0x0003); /* xxxx xxxx xxxx xx11b */ /* according to descriptions of the registers, see definitions of - CS8900_PP_ADDR_CC_... and CS8900_PP_ADDR_SE_... above! */ - - SET_PP_16(CS8900_PP_ADDR_CC_RXCFG, 0x0003); - SET_PP_16(CS8900_PP_ADDR_CC_RXCTL, 0x0005); - SET_PP_16(CS8900_PP_ADDR_CC_TXCFG, 0x0007); - SET_PP_16(CS8900_PP_ADDR_CC_TXCMD, 0x0009); - SET_PP_16(CS8900_PP_ADDR_CC_BUFCFG, 0x000B); - SET_PP_16(CS8900_PP_ADDR_CC_LINECTL, 0x0013); - SET_PP_16(CS8900_PP_ADDR_CC_SELFCTL, 0x0015); - SET_PP_16(CS8900_PP_ADDR_CC_BUSCTL, 0x0017); - SET_PP_16(CS8900_PP_ADDR_CC_TESTCTL, 0x0019); - - SET_PP_16(CS8900_PP_ADDR_SE_ISQ, 0x0000); - SET_PP_16(CS8900_PP_ADDR_SE_RXEVENT, 0x0004); - SET_PP_16(CS8900_PP_ADDR_SE_TXEVENT, 0x0008); - SET_PP_16(CS8900_PP_ADDR_SE_BUFEVENT, 0x000C); - SET_PP_16(CS8900_PP_ADDR_SE_RXMISS, 0x0010); - SET_PP_16(CS8900_PP_ADDR_SE_TXCOL, 0x0012); - SET_PP_16(CS8900_PP_ADDR_SE_LINEST, 0x0014); - SET_PP_16(CS8900_PP_ADDR_SE_SELFST, 0x0016); - SET_PP_16(CS8900_PP_ADDR_SE_BUSST, 0x0018); - SET_PP_16(CS8900_PP_ADDR_SE_TDR, 0x001C); - - SET_PP_16(CS8900_PP_ADDR_TXCMD, 0x0009); + CS8900_PP_ADDR_CC_... and CS8900_PP_ADDR_SE_... above! */ + + SET_PP_16(CS8900_PP_ADDR_CC_RXCFG, 0x0003); + SET_PP_16(CS8900_PP_ADDR_CC_RXCTL, 0x0005); + SET_PP_16(CS8900_PP_ADDR_CC_TXCFG, 0x0007); + SET_PP_16(CS8900_PP_ADDR_CC_TXCMD, 0x0009); + SET_PP_16(CS8900_PP_ADDR_CC_BUFCFG, 0x000B); + SET_PP_16(CS8900_PP_ADDR_CC_LINECTL, 0x0013); + SET_PP_16(CS8900_PP_ADDR_CC_SELFCTL, 0x0015); + SET_PP_16(CS8900_PP_ADDR_CC_BUSCTL, 0x0017); + SET_PP_16(CS8900_PP_ADDR_CC_TESTCTL, 0x0019); + + SET_PP_16(CS8900_PP_ADDR_SE_ISQ, 0x0000); + SET_PP_16(CS8900_PP_ADDR_SE_RXEVENT, 0x0004); + SET_PP_16(CS8900_PP_ADDR_SE_TXEVENT, 0x0008); + SET_PP_16(CS8900_PP_ADDR_SE_BUFEVENT, 0x000C); + SET_PP_16(CS8900_PP_ADDR_SE_RXMISS, 0x0010); + SET_PP_16(CS8900_PP_ADDR_SE_TXCOL, 0x0012); + SET_PP_16(CS8900_PP_ADDR_SE_LINEST, 0x0014); + SET_PP_16(CS8900_PP_ADDR_SE_SELFST, 0x0016); + SET_PP_16(CS8900_PP_ADDR_SE_BUSST, 0x0018); + SET_PP_16(CS8900_PP_ADDR_SE_TDR, 0x001C); + + SET_PP_16(CS8900_PP_ADDR_TXCMD, 0x0009); /* 4.4.19 Self Status Register, p. 65 - Important: set INITD (Bit 7) to signal device is ready */ - SET_PP_16(CS8900_PP_ADDR_SE_SELFST, 0x0896); + Important: set INITD (Bit 7) to signal device is ready */ + SET_PP_16(CS8900_PP_ADDR_SE_SELFST, 0x0896); cs8900_recv_control = GET_PP_16(CS8900_PP_ADDR_CC_RXCTL); /* spec: mac address is undefined after reset. - real HW: keeps the last set address. */ + real HW: keeps the last set address. */ for (int i = 0; i < 6; i++) SET_PP_8(CS8900_PP_ADDR_MAC_ADDR + i, cs8900_ia_mac[i]); @@ -380,13 +380,13 @@ cs8900a_device::cs8900a_device(const machine_config& mconfig, device_type type, , device_network_interface(mconfig, *this, 10.0f) , cs8900_ia_mac{0, 0, 0, 0, 0, 0} , cs8900_packetpage_ptr(0) - , cs8900_recv_control(0) /* copy of CC_RXCTL (contains all bits below) */ - , cs8900_recv_broadcast(false) /* broadcast */ - , cs8900_recv_mac(false) /* individual address (IA) */ - , cs8900_recv_multicast(false) /* multicast if address passes the hash filter */ - , cs8900_recv_correct(false) /* accept correct frames */ - , cs8900_recv_promiscuous(false) /* promiscuous mode */ - , cs8900_recv_hashfilter(false) /* accept if IA passes the hash filter */ + , cs8900_recv_control(0) /* copy of CC_RXCTL (contains all bits below) */ + , cs8900_recv_broadcast(false) /* broadcast */ + , cs8900_recv_mac(false) /* individual address (IA) */ + , cs8900_recv_multicast(false) /* multicast if address passes the hash filter */ + , cs8900_recv_correct(false) /* accept correct frames */ + , cs8900_recv_promiscuous(false) /* promiscuous mode */ + , cs8900_recv_hashfilter(false) /* accept if IA passes the hash filter */ , tx_buffer(CS8900_PP_ADDR_TX_FRAMELOC) , rx_buffer(CS8900_PP_ADDR_RXSTATUS) , tx_count(0) @@ -405,8 +405,8 @@ cs8900a_device::cs8900a_device(machine_config const& mconfig, char const *tag, d {} /* - This is a helper for cs8900_receive() to determine if the received frame should be accepted - according to the settings. + This is a helper for cs8900_receive() to determine if the received frame should be accepted + according to the settings. */ bool cs8900a_device::cs8900_should_accept(unsigned char *buffer, int length, bool *phashed, int *phash_index, bool *pcorrect_mac, bool *pbroadcast, bool *pmulticast) @@ -419,8 +419,8 @@ bool cs8900a_device::cs8900_should_accept(unsigned char *buffer, int length, boo *phashed = false; *phash_index = 0; *pcorrect_mac = false; - *pbroadcast = false; - *pmulticast = false; + *pbroadcast = false; + *pmulticast = false; LOGMASKED(CS8900_DEBUG_FRAMES, "cs8900_should_accept called with %02X:%02X:%02X:%02X:%02X:%02X, length=%4u", cs8900_ia_mac[0], cs8900_ia_mac[1], cs8900_ia_mac[2], @@ -496,8 +496,8 @@ u16 cs8900a_device::cs8900_receive() u8 buffer[MAX_RXLENGTH]; int len; - bool hashed = false; - int hash_index = 0; + bool hashed = false; + int hash_index = 0; bool rx_ok = false; bool correct_mac = false; bool broadcast = false; @@ -536,7 +536,7 @@ u16 cs8900a_device::cs8900_receive() { /* we already know the type of frame: Trust it! */ LOGMASKED(CS8900_DEBUG_FRAMES, "+++ cs8900_receive(): *** hashed=%u, correct_mac=%u, " - "broadcast=%u", hashed, correct_mac, broadcast); + "broadcast=%u", hashed, correct_mac, broadcast); } else { @@ -619,21 +619,21 @@ u16 cs8900a_device::cs8900_receive() } /* ------------------------------------------------------------------------- */ -/* reading and writing IO register functions */ +/* reading and writing IO register functions */ /* - These registers are currently fully or partially supported: - - CS8900_PP_ADDR_CC_RXCFG 0x0102 * # RW - 4.4.6., p. 52 - 0003 * - CS8900_PP_ADDR_CC_RXCTL 0x0104 * # RW - 4.4.8., p. 54 - 0005 * - CS8900_PP_ADDR_CC_LINECTL 0x0112 * # RW - 4.4.16., p. 62 - 0013 * - CS8900_PP_ADDR_SE_RXEVENT 0x0124 * # R- - 4.4.7., p. 53 - 0004 * - CS8900_PP_ADDR_SE_BUSST 0x0138 * # R- - 4.4.21., p. 67 - 0018 * - CS8900_PP_ADDR_TXCMD 0x0144 * # -W - 4.5., p. 70 - 5.7., p. 98 * - CS8900_PP_ADDR_TXLENGTH 0x0146 * # -W - 4.5., p. 70 - 5.7., p. 98 * - CS8900_PP_ADDR_MAC_ADDR 0x0158 * # RW - 4.6., p. 71 - 5.3., p. 86 * - 0x015a - 0x015c + These registers are currently fully or partially supported: + + CS8900_PP_ADDR_CC_RXCFG 0x0102 * # RW - 4.4.6., p. 52 - 0003 * + CS8900_PP_ADDR_CC_RXCTL 0x0104 * # RW - 4.4.8., p. 54 - 0005 * + CS8900_PP_ADDR_CC_LINECTL 0x0112 * # RW - 4.4.16., p. 62 - 0013 * + CS8900_PP_ADDR_SE_RXEVENT 0x0124 * # R- - 4.4.7., p. 53 - 0004 * + CS8900_PP_ADDR_SE_BUSST 0x0138 * # R- - 4.4.21., p. 67 - 0018 * + CS8900_PP_ADDR_TXCMD 0x0144 * # -W - 4.5., p. 70 - 5.7., p. 98 * + CS8900_PP_ADDR_TXLENGTH 0x0146 * # -W - 4.5., p. 70 - 5.7., p. 98 * + CS8900_PP_ADDR_MAC_ADDR 0x0158 * # RW - 4.6., p. 71 - 5.3., p. 86 * + 0x015a + 0x015c */ /* ------------------------------------------------------------------------- */ @@ -674,7 +674,7 @@ void cs8900a_device::cs8900_write_tx_buffer(u8 value, int odd_address) /* full frame transmitted? */ if (tx_count == tx_length) { - LOGMASKED(CS8900_DEBUG_FRAMES, "cs8900_arch_transmit() called with: " + LOGMASKED(CS8900_DEBUG_FRAMES, "cs8900_arch_transmit() called with:\t\t\t\t\t\t\t\t\t" "length=%4u and buffer %s", tx_length, debug_outbuffer(tx_length, &cs8900_packetpage[CS8900_PP_ADDR_TX_FRAMELOC]) ); @@ -714,19 +714,19 @@ u8 cs8900a_device::cs8900_read_rx_buffer(int odd_address) else { /* - According to the CS8900 spec, the handling is the following: - first read H, then L (RX_STATUS), then H, then L (RX_LENGTH). - Inside the RX frame data, we always get L then H, until the end is reached. - - even odd - CS8900_PP_ADDR_RXSTATUS: - proceed - CS8900_PP_ADDR_RXLENGTH: - proceed - CS8900_PP_ADDR_RX_FRAMELOC: - - - CS8900_PP_ADDR_RX_FRAMELOC+2: proceed - - CS8900_PP_ADDR_RX_FRAMELOC+4: proceed - + According to the CS8900 spec, the handling is the following: + first read H, then L (RX_STATUS), then H, then L (RX_LENGTH). + Inside the RX frame data, we always get L then H, until the end is reached. + + even odd + CS8900_PP_ADDR_RXSTATUS: - proceed + CS8900_PP_ADDR_RXLENGTH: - proceed + CS8900_PP_ADDR_RX_FRAMELOC: - - + CS8900_PP_ADDR_RX_FRAMELOC+2: proceed - + CS8900_PP_ADDR_RX_FRAMELOC+4: proceed - */ u16 addr = odd_address ? 1 : 0; - u8 value; + u8 value; /* read RXSTATUS or RX_LENGTH */ if (rx_count < 4) @@ -769,7 +769,7 @@ u8 cs8900a_device::cs8900_read_rx_buffer(int odd_address) /* handle side-effects of read and write operations */ /* - This is called *after* the relevant octets are written + This is called *after* the relevant octets are written */ void cs8900a_device::cs8900_sideeffects_write_pp(u16 ppaddress, int odd_address) { @@ -934,7 +934,7 @@ void cs8900a_device::cs8900_sideeffects_write_pp(u16 ppaddress, int odd_address) } /* - This is called *before* the relevant octets are read + This is called *before* the relevant octets are read */ void cs8900a_device::cs8900_sideeffects_read_pp(u16 ppaddress, int odd_address) { @@ -946,10 +946,10 @@ void cs8900a_device::cs8900_sideeffects_read_pp(u16 ppaddress, int odd_address) { int access_mask = (odd_address) ? 1 : 2; - /* update the status register only if the full word of the last - status was read! unfortunately different access patterns are - possible: either the status is read LH, LH, LH... - or HL, HL, HL, or even L, L, L or H, H, H */ + /* update the status register only if the full word of the last + status was read! unfortunately different access patterns are + possible: either the status is read LH, LH, LH... + or HL, HL, HL, or even L, L, L or H, H, H */ if ((access_mask & rxevent_read_mask) != 0) { /* receiver is not enabled */ @@ -962,8 +962,8 @@ void cs8900a_device::cs8900_sideeffects_read_pp(u16 ppaddress, int odd_address) /* perform frame reception */ u16 ret_val = cs8900_receive(); - /* RXSTATUS and RXEVENT are the same, except that RXSTATUS buffers - the old value while RXEVENT sets a new value whenever it is called + /* RXSTATUS and RXEVENT are the same, except that RXSTATUS buffers + the old value while RXEVENT sets a new value whenever it is called */ SET_PP_16(CS8900_PP_ADDR_RXSTATUS, ret_val); SET_PP_16(CS8900_PP_ADDR_SE_RXEVENT, ret_val); @@ -1399,11 +1399,11 @@ void cs8900a_device::cs8900_store(u16 io_address, u8 var) if (reg_base == CS8900_ADDR_PP_PTR) { - /* cv: we store the full package pointer in cs8900_packetpage_ptr variable. - this includes the mask area (0xf000) and the addr range (0x0fff). - we ensure that the bits 0x3000 are always set (as in real HW). - odd values of the pointer are valid and supported. - only register read and write have to be mapped to word boundary. */ + /* cv: we store the full package pointer in cs8900_packetpage_ptr variable. + this includes the mask area (0xf000) and the addr range (0x0fff). + we ensure that the bits 0x3000 are always set (as in real HW). + odd values of the pointer are valid and supported. + only register read and write have to be mapped to word boundary. */ word_value |= 0x3000; cs8900_packetpage_ptr = word_value; LOGMASKED(CS8900_DEBUG_STORE, "set PP Ptr to $%04X.\n", cs8900_packetpage_ptr); diff --git a/src/devices/machine/cs8900a.h b/src/devices/machine/cs8900a.h index 69931c583e5..74e4c8b20b3 100644 --- a/src/devices/machine/cs8900a.h +++ b/src/devices/machine/cs8900a.h @@ -3,11 +3,11 @@ /************************************************************************* - CS8900A ethernet controller implementation + CS8900A ethernet controller implementation - by Rhett Aultman <roadriverrail@gmail.com> - ported to MAME from VICE Project (https://sourceforge.net/p/vice-emu/) - VICE CS8900 code by Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de> + by Rhett Aultman <roadriverrail@gmail.com> + ported to MAME from VICE Project (https://sourceforge.net/p/vice-emu/) + VICE CS8900 code by Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de> **************************************************************************/ @@ -19,7 +19,7 @@ #include <queue> /*************************************************************************** - TYPE DEFINITIONS + TYPE DEFINITIONS ***************************************************************************/ class cs8900a_device : public device_t, public device_network_interface { @@ -57,13 +57,13 @@ private: u16 cs8900_packetpage_ptr; /* reveiver setup */ - u16 cs8900_recv_control; /* copy of CC_RXCTL (contains all bits below) */ - bool cs8900_recv_broadcast; /* broadcast */ - bool cs8900_recv_mac; /* individual address (IA) */ - bool cs8900_recv_multicast; /* multicast if address passes the hash filter */ - bool cs8900_recv_correct; /* accept correct frames */ - bool cs8900_recv_promiscuous; /* promiscuous mode */ - bool cs8900_recv_hashfilter; /* accept if IA passes the hash filter */ + u16 cs8900_recv_control; /* copy of CC_RXCTL (contains all bits below) */ + bool cs8900_recv_broadcast; /* broadcast */ + bool cs8900_recv_mac; /* individual address (IA) */ + bool cs8900_recv_multicast; /* multicast if address passes the hash filter */ + bool cs8900_recv_correct; /* accept correct frames */ + bool cs8900_recv_promiscuous; /* promiscuous mode */ + bool cs8900_recv_hashfilter; /* accept if IA passes the hash filter */ u16 tx_buffer; u16 rx_buffer; @@ -90,7 +90,7 @@ private: void cs8900_set_transmitter(int enabled); bool cs8900_should_accept(unsigned char *buffer, int length, bool *phashed, int *phash_index, bool *pcorrect_mac, bool *pbroadcast, bool *pmulticast); u16 cs8900_receive(void); - void cs8900_write_tx_buffer(u8 value, int odd_address); + void cs8900_write_tx_buffer(u8 value, int odd_address); u8 cs8900_read_rx_buffer(int odd_address); void cs8900_sideeffects_write_pp(u16 ppaddress, int odd_address); void cs8900_sideeffects_read_pp(u16 ppaddress, int odd_address); diff --git a/src/devices/machine/exorterm.cpp b/src/devices/machine/exorterm.cpp index 0b62597e3f1..9db3f0658e4 100644 --- a/src/devices/machine/exorterm.cpp +++ b/src/devices/machine/exorterm.cpp @@ -348,7 +348,7 @@ u32 exorterm155_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma u16 sy = 0, ma = 0; u8 disable_fac = m_disable_fac->read() == 0; u8 display_fac = m_display_fac->read() == 0; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); m_framecnt++; @@ -356,7 +356,7 @@ u32 exorterm155_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma { for (u8 ra = 0; ra < 12; ra++) { - u32 *p = &bitmap.pix32(sy++); + u32 *p = &bitmap.pix(sy++); // FAC codes are cleared on horizontal sync. u8 underline1 = 0; u8 underline2 = 0; diff --git a/src/devices/machine/generalplus_gpl16250soc.cpp b/src/devices/machine/generalplus_gpl16250soc.cpp index 2548929027c..1892bbe0880 100644 --- a/src/devices/machine/generalplus_gpl16250soc.cpp +++ b/src/devices/machine/generalplus_gpl16250soc.cpp @@ -219,12 +219,12 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(int channel) // mem.write_word(0x4d8d4, 0x4841); // golden tee IRQ? wait hack //if (mem.read_word(0x3510f) == 0x4845) - // mem.write_word(0x3510f, 0x4840); // camp rock force service mode + // mem.write_word(0x3510f, 0x4840); // camp rock force service mode if (mem.read_word(0x4abe7) == 0x4840) mem.write_word(0x4abe7, 0x4841); // camp rock IRQ? wait hack - + // clear params after operation m_dma_params[0][channel] = m_dma_params[0][channel] & 0x00f7; @@ -667,6 +667,12 @@ void sunplus_gcm394_base_device::unkarea_78b2_w(uint16_t data) { LOGMASKED(LOG_G void sunplus_gcm394_base_device::unkarea_78b8_w(uint16_t data) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b8_w %04x\n", machine().describe_context(), data); m_78b8 = data; } void sunplus_gcm394_base_device::unkarea_78f0_w(uint16_t data) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78f0_w %04x\n", machine().describe_context(), data); m_78f0 = data; } +uint16_t sunplus_gcm394_base_device::unkarea_78c0_r() +{ + LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78c0_r\n", machine().describe_context()); + return machine().rand(); +} + uint16_t sunplus_gcm394_base_device::unkarea_78d0_r() { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78d0_r\n", machine().describe_context()); @@ -964,6 +970,8 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map) map(0x0078b2, 0x0078b2).rw(FUNC(sunplus_gcm394_base_device::unkarea_78b2_r), FUNC(sunplus_gcm394_base_device::unkarea_78b2_w)); // 78b2 TimeBase C Control Register (P_TimeBaseC_Ctrl) map(0x0078b8, 0x0078b8).w(FUNC(sunplus_gcm394_base_device::unkarea_78b8_w)); // 78b8 TimeBase Counter Reset Register (P_TimeBase_Reset) + + map(0x0078c0, 0x0078c0).r(FUNC(sunplus_gcm394_base_device::unkarea_78c0_r)); // beijuehh map(0x0078d0, 0x0078d0).r(FUNC(sunplus_gcm394_base_device::unkarea_78d0_r)); // jak_s500 map(0x0078d8, 0x0078d8).r(FUNC(sunplus_gcm394_base_device::unkarea_78d8_r)); // jak_tsh diff --git a/src/devices/machine/generalplus_gpl16250soc.h b/src/devices/machine/generalplus_gpl16250soc.h index 8df8e780f78..fa2b176e421 100644 --- a/src/devices/machine/generalplus_gpl16250soc.h +++ b/src/devices/machine/generalplus_gpl16250soc.h @@ -319,6 +319,8 @@ private: void unkarea_78b8_w(uint16_t data); + uint16_t unkarea_78c0_r(); + uint16_t unkarea_78d0_r(); uint16_t unkarea_78d8_r(); diff --git a/src/devices/machine/generalplus_gpl16250soc_video.cpp b/src/devices/machine/generalplus_gpl16250soc_video.cpp index 37821e3a10c..ba6ca102ebf 100644 --- a/src/devices/machine/generalplus_gpl16250soc_video.cpp +++ b/src/devices/machine/generalplus_gpl16250soc_video.cpp @@ -1048,32 +1048,30 @@ void gcm394_base_video_device::palette_w(offs_t offset, uint16_t data) if (m_703a_palettebank & 0xfff0) { - fatalerror("palette writes with m_703a_palettebank %04x\n", m_703a_palettebank); - } - else - { - offset |= (m_703a_palettebank & 0x000c) << 6; - m_paletteram[offset] = data; - - // for debug - m_palette->set_pen_color(offset, rgb_t( - (((data >> 10) & 0x1f)<<3), - (((data >> 5) & 0x1f)<<3), - (((data >> 0) & 0x1f)<<3))); + LOGMASKED(LOG_GCM394_VIDEO_PALETTE,"palette writes with m_703a_palettebank %04x\n", m_703a_palettebank); } + + + offset |= (m_703a_palettebank & 0x000c) << 6; + m_paletteram[offset] = data; + + // for debug + m_palette->set_pen_color(offset, rgb_t( + (((data >> 10) & 0x1f)<<3), + (((data >> 5) & 0x1f)<<3), + (((data >> 0) & 0x1f)<<3))); + } uint16_t gcm394_base_video_device::palette_r(offs_t offset) { if (m_703a_palettebank & 0xfff0) { - fatalerror("palette read with m_703a_palettebank %04x\n", m_703a_palettebank); - } - else - { - offset |= (m_703a_palettebank & 0x000c) << 6; - return m_paletteram[offset]; + LOGMASKED(LOG_GCM394_VIDEO_PALETTE,"palette read with m_703a_palettebank %04x\n", m_703a_palettebank); } + + offset |= (m_703a_palettebank & 0x000c) << 6; + return m_paletteram[offset]; } void gcm394_base_video_device::video_701c_w(uint16_t data) diff --git a/src/devices/machine/ie15.cpp b/src/devices/machine/ie15.cpp index 3cdb35af145..eba7ace6fa7 100644 --- a/src/devices/machine/ie15.cpp +++ b/src/devices/machine/ie15.cpp @@ -637,7 +637,8 @@ void ie15_device::scanline_callback() uint32_t ie15_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { update_leds(); - memcpy(&bitmap.pix32(0), &m_tmpbmp[0], sizeof(uint32_t) * IE15_TOTAL_HORZ * IE15_TOTAL_VERT); + for (int y = 0; y < IE15_TOTAL_VERT; y++) + std::copy_n(&m_tmpbmp[y * IE15_TOTAL_HORZ], IE15_TOTAL_HORZ, &bitmap.pix(y)); return 0; } diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index ef3df359859..d04d3c1201a 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -308,11 +308,11 @@ void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int pa //------------------------------------------------- -// sound_stream_update_legacy - audio streamer for +// sound_stream_update - audio streamer for // laserdiscs //------------------------------------------------- -void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // compute AND values based on the squelch int16_t leftand = (m_audiosquelch & 1) ? 0x0000 : 0xffff; @@ -324,12 +324,12 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s samples_avail += m_audiobufsize; // if no attached ld, just clear the buffers - stream_sample_t *dst0 = outputs[0]; - stream_sample_t *dst1 = outputs[1]; - if (samples_avail < samples) + auto &dst0 = outputs[0]; + auto &dst1 = outputs[1]; + if (samples_avail < outputs[0].samples()) { - memset(dst0, 0, samples * sizeof(dst0[0])); - memset(dst1, 0, samples * sizeof(dst1[0])); + dst0.fill(0); + dst1.fill(0); } // otherwise, stream from our buffer @@ -340,10 +340,11 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s int sampout = m_audiobufout; // copy samples, clearing behind us as we go - while (sampout != m_audiobufin && samples-- > 0) + int sampindex; + for (sampindex = 0; sampout != m_audiobufin && sampindex < outputs[0].samples(); sampindex++) { - *dst0++ = buffer0[sampout] & leftand; - *dst1++ = buffer1[sampout] & rightand; + dst0.put_int(sampindex, buffer0[sampout] & leftand, 32768); + dst1.put_int(sampindex, buffer1[sampout] & rightand, 32768); buffer0[sampout] = 0; buffer1[sampout] = 0; sampout++; @@ -353,16 +354,16 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s m_audiobufout = sampout; // clear out the rest of the buffer - if (samples > 0) + if (sampindex < outputs[0].samples()) { sampout = (m_audiobufout == 0) ? m_audiobufsize - 1 : m_audiobufout - 1; - stream_sample_t fill0 = buffer0[sampout] & leftand; - stream_sample_t fill1 = buffer1[sampout] & rightand; + s32 fill0 = buffer0[sampout] & leftand; + s32 fill1 = buffer1[sampout] & rightand; - while (samples-- > 0) + for ( ; sampindex < outputs[0].samples(); sampindex++) { - *dst0++ = fill0; - *dst1++ = fill1; + dst0.put_int(sampindex, fill0, 32768); + dst1.put_int(sampindex, fill1, 32768); } } } @@ -712,10 +713,10 @@ void laserdisc_device::init_video() fillbitmap_yuy16(frame.m_bitmap, 40, 109, 240); // make a copy of the bitmap that clips out the VBI and horizontal blanking areas - frame.m_visbitmap.wrap(&frame.m_bitmap.pix16(44, frame.m_bitmap.width() * 8 / 720), - frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, - frame.m_bitmap.height() - 44, - frame.m_bitmap.rowpixels()); + frame.m_visbitmap.wrap(&frame.m_bitmap.pix( + 44, frame.m_bitmap.width() * 8 / 720), + frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, frame.m_bitmap.height() - 44, + frame.m_bitmap.rowpixels()); frame.m_visbitmap.set_palette(m_videopalette); } @@ -762,7 +763,7 @@ void laserdisc_device::init_audio() m_audio_callback.resolve(); // allocate a stream - m_stream = stream_alloc_legacy(0, 2, 48000); + m_stream = stream_alloc(0, 2, 48000); // allocate audio buffers m_audiomaxsamples = ((uint64_t)m_samplerate * 1000000 + m_fps_times_1million - 1) / m_fps_times_1million; @@ -789,7 +790,7 @@ void laserdisc_device::fillbitmap_yuy16(bitmap_yuy16 &bitmap, uint8_t yval, uint // write 32 bits of color (2 pixels at a time) for (int y = 0; y < bitmap.height(); y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); for (int x = 0; x < bitmap.width() / 2; x++) { *dest++ = color0; @@ -918,7 +919,8 @@ void laserdisc_device::read_track_data() frame->m_lastfield = m_curtrack * 2 + m_fieldnum; // set the video target information - m_avhuff_config.video.wrap(&frame->m_bitmap.pix16(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2); + m_avhuff_video.wrap(&frame->m_bitmap.pix(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2); + m_avhuff_config.video = &m_avhuff_video; // set the audio target information if (m_audiobufin + m_audiomaxsamples <= m_audiobufsize) @@ -995,13 +997,13 @@ void laserdisc_device::process_track_data() // remove the video if we had an error if (m_readresult != CHDERR_NONE) - m_avhuff_config.video.reset(); + m_avhuff_video.reset(); // count the field as read if we are successful - if (m_avhuff_config.video.valid()) + if (m_avhuff_video.valid()) { m_frame[m_videoindex].m_numfields++; - player_overlay(m_avhuff_config.video); + player_overlay(m_avhuff_video); } // pass the audio to the callback diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h index 8ca3abad222..14594bcf7cd 100644 --- a/src/devices/machine/laserdsc.h +++ b/src/devices/machine/laserdsc.h @@ -220,7 +220,7 @@ protected: virtual void device_validity_check(validity_checker &valid) const override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // subclass helpers void set_audio_squelch(bool squelchleft, bool squelchright) { m_stream->update(); m_audiosquelch = (squelchleft ? 1 : 0) | (squelchright ? 2 : 0); } @@ -277,28 +277,29 @@ private: std::vector<uint8_t> m_vbidata; // pointer to precomputed VBI data int m_width; // width of video int m_height; // height of video - uint32_t m_fps_times_1million; // frame rate of video + uint32_t m_fps_times_1million; // frame rate of video int m_samplerate; // audio samplerate int m_readresult; // result of the most recent read - uint32_t m_chdtracks; // number of tracks in the CHD - avhuff_decompress_config m_avhuff_config; // decompression configuration + uint32_t m_chdtracks; // number of tracks in the CHD + bitmap_yuy16 m_avhuff_video; // decompresed frame buffer + avhuff_decoder::config m_avhuff_config; // decompression configuration // async operations osd_work_queue * m_work_queue; // work queue - uint32_t m_queued_hunknum; // queued hunk + uint32_t m_queued_hunknum; // queued hunk // core states - uint8_t m_audiosquelch; // audio squelch state: bit 0 = audio 1, bit 1 = audio 2 - uint8_t m_videosquelch; // video squelch state: bit 0 = on/off - uint8_t m_fieldnum; // field number (0 or 1) - int32_t m_curtrack; // current track at this end of this vsync - uint32_t m_maxtrack; // maximum track number + uint8_t m_audiosquelch; // audio squelch state: bit 0 = audio 1, bit 1 = audio 2 + uint8_t m_videosquelch; // video squelch state: bit 0 = on/off + uint8_t m_fieldnum; // field number (0 or 1) + int32_t m_curtrack; // current track at this end of this vsync + uint32_t m_maxtrack; // maximum track number attoseconds_t m_attospertrack; // attoseconds per track, or 0 if not moving attotime m_sliderupdate; // time of last slider update // video data frame_data m_frame[3]; // circular list of frames - uint8_t m_videoindex; // index of the current video buffer + uint8_t m_videoindex; // index of the current video buffer bitmap_yuy16 m_emptyframe; // blank frame // audio data diff --git a/src/devices/machine/ldpr8210.cpp b/src/devices/machine/ldpr8210.cpp index fc94159ff6a..64392ed0c90 100644 --- a/src/devices/machine/ldpr8210.cpp +++ b/src/devices/machine/ldpr8210.cpp @@ -784,12 +784,12 @@ void pioneer_pr8210_device::overlay_draw_group(bitmap_yuy16 &bitmap, const uint8 void pioneer_pr8210_device::overlay_erase(bitmap_yuy16 &bitmap, float xstart, float xend) { - uint32_t xmin = (uint32_t)(xstart * 256.0f * float(bitmap.width())); - uint32_t xmax = (uint32_t)(xend * 256.0f * float(bitmap.width())); + uint32_t xmin = uint32_t(xstart * 256.0f * float(bitmap.width())); + uint32_t xmax = uint32_t(xend * 256.0f * float(bitmap.width())); for (uint32_t y = OVERLAY_Y; y < (OVERLAY_Y + (OVERLAY_Y_PIXELS + 2) * OVERLAY_PIXEL_HEIGHT); y++) { - uint16_t *dest = &bitmap.pix16(y, xmin >> 8); + uint16_t *dest = &bitmap.pix(y, xmin >> 8); uint16_t ymax = *dest >> 8; uint16_t ymin = ymax * 3 / 8; uint16_t yres = ymin + ((ymax - ymin) * (xmin & 0xff)) / 256; @@ -819,8 +819,8 @@ void pioneer_pr8210_device::overlay_erase(bitmap_yuy16 &bitmap, float xstart, fl void pioneer_pr8210_device::overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, float xstart) { - uint32_t xminbase = (uint32_t)(xstart * 256.0f * float(bitmap.width())); - uint32_t xsize = (uint32_t)(OVERLAY_PIXEL_WIDTH * 256.0f * float(bitmap.width())); + uint32_t xminbase = uint32_t(xstart * 256.0f * float(bitmap.width())); + uint32_t xsize = uint32_t(OVERLAY_PIXEL_WIDTH * 256.0f * float(bitmap.width())); // iterate over pixels const uint8_t *chdataptr = &text_bitmap[ch & 0x3f][0]; @@ -835,7 +835,7 @@ void pioneer_pr8210_device::overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, uint32_t xmax = xmin + xsize; for (uint32_t yy = 0; yy < OVERLAY_PIXEL_HEIGHT; yy++) { - uint16_t *dest = &bitmap.pix16(OVERLAY_Y + (y + 1) * OVERLAY_PIXEL_HEIGHT + yy, xmin >> 8); + uint16_t *dest = &bitmap.pix(OVERLAY_Y + (y + 1) * OVERLAY_PIXEL_HEIGHT + yy, xmin >> 8); uint16_t ymax = 0xff; uint16_t ymin = *dest >> 8; uint16_t yres = ymin + ((ymax - ymin) * (~xmin & 0xff)) / 256; diff --git a/src/devices/machine/m3002.cpp b/src/devices/machine/m3002.cpp index 8bb9edda2b9..fd93666a55f 100644 --- a/src/devices/machine/m3002.cpp +++ b/src/devices/machine/m3002.cpp @@ -351,13 +351,13 @@ void m3002_device::irq_update() { LOG("IRQ occurred\n"); m_irq_active = true; - m_irq_callback(ASSERT_LINE); + m_irq_callback(0); } else if (m_irq_active && (m_ram[0xf] & 0x0c) == 0) { LOG("IRQ cleared\n"); m_irq_active = false; - m_irq_callback(CLEAR_LINE); + m_irq_callback(1); } } diff --git a/src/devices/machine/m3002.h b/src/devices/machine/m3002.h index d39f904fe60..ef13c360e47 100644 --- a/src/devices/machine/m3002.h +++ b/src/devices/machine/m3002.h @@ -37,6 +37,8 @@ public: // device type constructor m3002_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + auto irq_out() { return m_irq_callback.bind(); } + // 4-bit read/write handlers u8 read(); void write(u8 data); diff --git a/src/devices/machine/mc68328.cpp b/src/devices/machine/mc68328.cpp index 3df500d2f0c..e3690287710 100644 --- a/src/devices/machine/mc68328.cpp +++ b/src/devices/machine/mc68328.cpp @@ -3044,20 +3044,17 @@ uint16_t mc68328_device::internal_read(offs_t offset, uint16_t mem_mask) uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { uint32_t vram_addr = m_regs.lssa & 0x00fffffe; - uint16_t word; - uint16_t *line; - int y, x, b; if (m_regs.lckcon & LCKCON_LCDC_EN) { - for (y = 0; y < 160; y++) + for (int y = 0; y < 160; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 160; x += 16, vram_addr += 2) + for (int x = 0; x < 160; x += 16, vram_addr += 2) { - word = space(AS_PROGRAM).read_word(vram_addr); - for (b = 0; b < 16; b++) + uint16_t const word = space(AS_PROGRAM).read_word(vram_addr); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -3066,11 +3063,11 @@ uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitm } else { - for (y = 0; y < 160; y++) + for (int y = 0; y < 160; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 160; x++) + for (int x = 0; x < 160; x++) { line[x] = 0; } diff --git a/src/devices/machine/mm58167.cpp b/src/devices/machine/mm58167.cpp index f226590e9d2..05aa4377ccb 100644 --- a/src/devices/machine/mm58167.cpp +++ b/src/devices/machine/mm58167.cpp @@ -247,10 +247,7 @@ void mm58167_device::write(offs_t offset, uint8_t data) break; case R_CTL_IRQCONTROL: - if (data != 0) - { - logerror("MM58167: IRQs not implemented\n"); - } + m_regs[R_CTL_IRQCONTROL]=data; break; } } diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 988c21c33e1..a13349e318f 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -987,7 +987,6 @@ std::unique_ptr<netlist::netlist_state_t> netlist_mame_device::base_validity_che auto lnetlist = std::make_unique<netlist::netlist_state_t>("netlist", plib::plog_delegate(&validity_logger::log, &logger)); // enable validation mode - lnetlist->set_extended_validation(true); lnetlist->set_static_solver_lib(std::make_unique<plib::dynlib_static>(nullptr)); diff --git a/src/devices/machine/ns32081.cpp b/src/devices/machine/ns32081.cpp new file mode 100644 index 00000000000..73941a85f2c --- /dev/null +++ b/src/devices/machine/ns32081.cpp @@ -0,0 +1,637 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * National Semiconductor 32081 Floating-Point Unit. + * + * Sources: + * - http://bitsavers.org/components/national/_dataBooks/1989_National_Microprocessor_Databook_32000_NSC800.pdf + * + * TODO: + * - testing + */ + +#include "emu.h" +#include "ns32081.h" + +#include "softfloat3/source/include/softfloat.h" + +#define LOG_GENERAL (1U << 0) +//#define VERBOSE (LOG_GENERAL) + +#include "logmacro.h" + +DEFINE_DEVICE_TYPE(NS32081, ns32081_device, "ns32081", "National Semiconductor 32081 Floating-Point Unit") + +enum fsr_mask : u32 +{ + FSR_TT = 0x00000007, // trap type + FSR_UEN = 0x00000008, // underflow trap enable + FSR_UF = 0x00000010, // underflow flag + FSR_IEN = 0x00000020, // inexact result trap enable + FSR_IF = 0x00000040, // inexact result flag + FSR_RM = 0x00000180, // rounding mode + FSR_SWF = 0x0000fe00, // software field +}; + +enum rm_mask : u32 +{ + RM_N = 0x00000000, // round to nearest value + RM_Z = 0x00000080, // round toward zero + RM_U = 0x00000100, // round toward positive infinity + RM_D = 0x00000180, // round toward negative infinity +}; + +enum tt_mask : u32 +{ + TT_UND = 0x00000001, // underflow + TT_OVF = 0x00000002, // overflow + TT_DVZ = 0x00000003, // divide by zero + TT_ILL = 0x00000004, // illegal instruction + TT_INV = 0x00000005, // invalid operation + TT_INX = 0x00000006, // inexact result + TT_RSV = 0x00000007, // reserved +}; + +enum state : unsigned +{ + IDLE = 0, + OPERATION = 1, // awaiting operation word + OPERAND = 2, // awaiting operands + STATUS = 4, // status word available + RESULT = 5, // result word available +}; + +enum idbyte : u8 +{ + FORMAT_9 = 0x3e, + FORMAT_11 = 0xbe, +}; + +enum operand_length : unsigned +{ + LENGTH_F = 4, // single precision + LENGTH_L = 8, // double precision +}; + +enum size_code : unsigned +{ + SIZE_B = 0, + SIZE_W = 1, + SIZE_D = 3, +}; + +ns32081_device::ns32081_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : device_t(mconfig, NS32081, tag, owner, clock) + , ns32000_slave_interface(mconfig, *this) +{ +} + +void ns32081_device::device_start() +{ + save_item(NAME(m_fsr)); + save_item(NAME(m_f)); + + save_item(NAME(m_idbyte)); + save_item(NAME(m_opword)); + save_item(STRUCT_MEMBER(m_op, expected)); + save_item(STRUCT_MEMBER(m_op, issued)); + save_item(STRUCT_MEMBER(m_op, value)); + save_item(NAME(m_status)); + + save_item(NAME(m_state)); + save_item(NAME(m_tcy)); + + m_complete = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32081_device::complete), this)); +} + +void ns32081_device::device_reset() +{ + m_fsr = 0; + std::fill_n(&m_f[0], ARRAY_LENGTH(m_f), 0); + + m_state = IDLE; +} + +void ns32081_device::state_add(device_state_interface &parent, int &index) +{ + parent.state_add(index++, "FSR", m_fsr).formatstr("%04X"); + + for (unsigned i = 0; i < 8; i++) + parent.state_add(index++, util::string_format("F%d", i).c_str(), m_f[i]).formatstr("%08X"); +} + +u16 ns32081_device::read_st(int *icount) +{ + if (m_state == STATUS) + { + m_state = (m_op[2].issued == m_op[2].expected) ? IDLE : RESULT; + + if (icount) + *icount -= m_tcy; + + LOG("read_st status 0x%04x tcy %d %s (%s)\n", m_status, m_tcy, + (m_state == RESULT ? "results pending" : "complete"), machine().describe_context()); + + return m_status; + } + + logerror("protocol error reading status word (%s)\n", machine().describe_context()); + return 0; +} + +u16 ns32081_device::read_op() +{ + if (m_state == RESULT && m_op[2].issued < m_op[2].expected) + { + u16 const data = u16(m_op[2].value >> (m_op[2].issued * 8)); + LOG("read_op word %d data 0x%04x (%s)\n", m_op[2].issued >> 1, data, machine().describe_context()); + + m_op[2].issued += 2; + + if (m_op[2].issued == m_op[2].expected) + { + LOG("read_op last result word issued\n"); + m_state = IDLE; + } + + return data; + } + + logerror("protocol error reading result word (%s)\n", machine().describe_context()); + return 0; +} + +void ns32081_device::write_id(u16 data) +{ + bool const match = (data == FORMAT_9) || (data == FORMAT_11); + + if (match) + { + LOG("write_id match 0x%04x (%s)\n", data, machine().describe_context()); + m_state = OPERATION; + } + else + { + LOG("write_id ignore 0x%04x (%s)\n", data, machine().describe_context()); + m_state = IDLE; + } + + m_idbyte = u8(data); +} + +void ns32081_device::write_op(u16 data) +{ + switch (m_state) + { + case OPERATION: + m_opword = swapendian_int16(data); + LOG("write_op opword 0x%04x (%s)\n", m_opword, machine().describe_context()); + + // initialize operands + for (operand &op : m_op) + { + op.expected = 0; + op.issued = 0; + op.value = 0; + } + + // decode operands + if (m_idbyte == FORMAT_9) + { + // format 9: 1111 1222 22oo ofii + unsigned const f_length = BIT(m_opword, 2) ? LENGTH_F : LENGTH_L; + unsigned const size = m_opword & 3; + + switch ((m_opword >> 3) & 7) + { + case 0: // movif + m_op[0].expected = size + 1; + m_op[2].expected = f_length; + break; + case 1: // lfsr + m_op[0].expected = 4; + break; + case 2: // movlf + m_op[0].expected = LENGTH_L; + m_op[2].expected = f_length; + break; + case 3: // movfl + m_op[0].expected = LENGTH_F; + m_op[2].expected = f_length; + break; + case 4: // roundfi + case 5: // truncfi + case 7: // floorfi + m_op[0].expected = f_length; + m_op[2].expected = size + 1; + break; + case 6: // sfsr + m_op[2].expected = 4; + break; + } + } + else if (m_idbyte == FORMAT_11) + { + // format 11: 1111 1222 22oo oo0f + unsigned const opcode = (m_opword >> 2) & 15; + unsigned const f_length = BIT(m_opword, 0) ? LENGTH_F : LENGTH_L; + + m_op[0].expected = f_length; + + // even opcodes have two input operands + if (!BIT(opcode, 0)) + m_op[1].expected = f_length; + + // all operations except CMPf issue a result + if (opcode != 2) + m_op[2].expected = f_length; + } + + // operand 1 in register + if (m_op[0].expected && !(m_opword & 0xc000)) + { + // exclude integer operands + if (m_idbyte == FORMAT_11 || ((m_opword >> 3) & 7) > 1) + { + unsigned const reg = (m_opword >> 11) & 7; + LOG("write_op read f%d\n", reg); + + m_op[0].value = m_f[reg ^ 0]; + if (m_op[0].expected == 8) + m_op[0].value |= u64(m_f[reg ^ 1]) << 32; + + m_op[0].issued = m_op[0].expected; + } + } + + // operand 2 in register + if (m_op[1].expected && !(m_opword & 0x0600)) + { + unsigned const reg = (m_opword >> 6) & 7; + LOG("write_op read f%d\n", reg); + + m_op[1].value = m_f[reg ^ 0]; + if (m_op[1].expected == 8) + m_op[1].value |= u64(m_f[reg ^ 1]) << 32; + + m_op[1].issued = m_op[1].expected; + } + + m_state = OPERAND; + break; + + case OPERAND: + // check awaiting operand word + if (m_op[0].issued < m_op[0].expected || m_op[1].issued < m_op[1].expected) + { + unsigned const n = (m_op[0].issued < m_op[0].expected) ? 0 : 1; + operand &op = m_op[n]; + + LOG("write_op op%d data 0x%04x (%s)\n", n, data, machine().describe_context()); + + // insert word into operand value + op.value |= u64(data) << (op.issued * 8); + op.issued += 2; + } + else + logerror("protocol error unexpected operand word 0x%04x (%s)\n", data, machine().describe_context()); + break; + } + + // start execution when all operands are available + if (m_state == OPERAND && m_op[0].issued >= m_op[0].expected && m_op[1].issued >= m_op[1].expected) + execute(); +} + +void ns32081_device::execute() +{ + softfloat_exceptionFlags = 0; + m_fsr &= ~FSR_TT; + + m_status = 0; + m_tcy = 0; + + switch (m_idbyte) + { + case FORMAT_9: + // format 9: 1111 1222 22oo ofii + { + bool const single = BIT(m_opword, 2); + unsigned const f_length = single ? LENGTH_F : LENGTH_L; + unsigned const size = m_opword & 3; + + switch ((m_opword >> 3) & 7) + { + case 0: + // MOVif src,dest + // gen,gen + // read.i,write.f + { + s32 const src = + (size == SIZE_D) ? s32(m_op[0].value) : + (size == SIZE_W) ? s16(m_op[0].value) : + s8(m_op[0].value); + + if (single) + m_op[2].value = i32_to_f32(src).v; + else + m_op[2].value = i32_to_f64(src).v; + m_op[2].expected = f_length; + m_tcy = 53; + } + break; + case 1: + // LFSR src + // gen + // read.D + m_fsr = u16(m_op[0].value); + + switch (m_fsr & FSR_RM) + { + case RM_N: softfloat_roundingMode = softfloat_round_near_even; break; + case RM_Z: softfloat_roundingMode = softfloat_round_minMag; break; + case RM_U: softfloat_roundingMode = softfloat_round_max; break; + case RM_D: softfloat_roundingMode = softfloat_round_min; break; + } + m_tcy = 18; + break; + case 2: + // MOVLF src,dest + // gen,gen + // read.L,write.F + m_op[2].value = f64_to_f32(float64_t{ m_op[0].value }).v; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc000) ? 23 : 27; + break; + case 3: + // MOVFL src,dest + // gen,gen + // read.F,write.L + m_op[2].value = f32_to_f64(float32_t{ u32(m_op[0].value) }).v; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc000) ? 22 : 26; + break; + case 4: + // ROUNDfi src,dest + // gen,gen + // read.f,write.i + if (single) + m_op[2].value = f32_to_i64(float32_t{ u32(m_op[0].value) }, softfloat_round_near_even, true); + else + m_op[2].value = f64_to_i64(float64_t{ m_op[0].value }, softfloat_round_near_even, true); + + if ((size == SIZE_D && s64(m_op[2].value) != s32(m_op[2].value)) + || (size == SIZE_W && s64(m_op[2].value) != s16(m_op[2].value)) + || (size == SIZE_B && s64(m_op[2].value) != s8(m_op[2].value))) + softfloat_exceptionFlags |= softfloat_flag_overflow; + + m_op[2].expected = size + 1; + m_tcy = (m_opword & 0xc000) ? 53 : 66; + break; + case 5: + // TRUNCfi src,dest + // gen,gen + // read.f,write.i + if (single) + m_op[2].value = f32_to_i64(float32_t{ u32(m_op[0].value) }, softfloat_round_minMag, true); + else + m_op[2].value = f64_to_i64(float64_t{ m_op[0].value }, softfloat_round_minMag, true); + + if ((size == SIZE_D && s64(m_op[2].value) != s32(m_op[2].value)) + || (size == SIZE_W && s64(m_op[2].value) != s16(m_op[2].value)) + || (size == SIZE_B && s64(m_op[2].value) != s8(m_op[2].value))) + softfloat_exceptionFlags |= softfloat_flag_overflow; + + m_op[2].expected = size + 1; + m_tcy = (m_opword & 0xc000) ? 53 : 66; + break; + case 6: + // SFSR dest + // gen + // write.D + m_op[2].value = m_fsr; + m_op[2].expected = 4; + m_tcy = 13; + break; + case 7: + // FLOORfi src,dest + // gen,gen + // read.f,write.i + if (single) + m_op[2].value = f32_to_i64(float32_t{ u32(m_op[0].value) }, softfloat_round_min, true); + else + m_op[2].value = f64_to_i64(float64_t{ m_op[0].value }, softfloat_round_min, true); + + if ((size == SIZE_D && s64(m_op[2].value) != s32(m_op[2].value)) + || (size == SIZE_W && s64(m_op[2].value) != s16(m_op[2].value)) + || (size == SIZE_B && s64(m_op[2].value) != s8(m_op[2].value))) + softfloat_exceptionFlags |= softfloat_flag_overflow; + + m_op[2].expected = size + 1; + m_tcy = (m_opword & 0xc000) ? 53 : 66; + break; + } + } + break; + + case FORMAT_11: + // format 11: 1111122222oooo0f + { + bool const single = BIT(m_opword, 0); + unsigned const f_length = single ? LENGTH_F : LENGTH_L; + + switch ((m_opword >> 2) & 15) + { + case 0x0: + // ADDf src,dest + // gen,gen + // read.f,rmw.f + if (single) + m_op[2].value = f32_add(float32_t{ u32(m_op[1].value) }, float32_t{ u32(m_op[0].value) }).v; + else + m_op[2].value = f64_add(float64_t{ m_op[1].value }, float64_t{ m_op[0].value }).v; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc600) ? 70 : 74; + break; + case 0x1: + // MOVf src,dest + // gen,gen + // read.f,write.f + m_op[2].value = m_op[0].value; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc000) ? 23 : 27; + break; + case 0x2: + // CMPf src1,src2 + // gen,gen + // read.f,read.f + if (m_op[0].value == m_op[1].value) + m_status |= SLAVE_Z; + if ((single && f32_le(float32_t{ u32(m_op[1].value) }, float32_t{ u32(m_op[0].value) })) + || (!single && f64_le(float64_t{ m_op[1].value }, float64_t{ m_op[0].value }))) + m_status |= SLAVE_N; + m_tcy = (m_opword & 0xc600) ? 45 : 49; + break; + case 0x3: + // Trap(SLAVE) + m_fsr |= TT_ILL; + m_status = SLAVE_Q; + break; + case 0x4: + // SUBf src,dest + // gen,gen + // read.f,rmw.f + if (single) + m_op[2].value = f32_sub(float32_t{ u32(m_op[1].value) }, float32_t{ u32(m_op[0].value) }).v; + else + m_op[2].value = f64_sub(float64_t{ m_op[1].value }, float64_t{ m_op[0].value }).v; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc600) ? 70 : 74; + break; + case 0x5: + // NEGf src,dest + // gen,gen + // read.f,write.f + if (single) + m_op[2].value = f32_mul(float32_t{ u32(m_op[0].value) }, i32_to_f32(-1)).v; + else + m_op[2].value = f64_mul(float64_t{ m_op[0].value }, i32_to_f64(-1)).v; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc000) ? 20 : 24; + break; + case 0x8: + // DIVf src,dest + // gen,gen + // read.f,rmw.f + if (single) + m_op[2].value = f32_div(float32_t{ u32(m_op[1].value) }, float32_t{ u32(m_op[0].value) }).v; + else + m_op[2].value = f64_div(float64_t{ m_op[1].value }, float64_t{ m_op[0].value }).v; + m_op[2].expected = f_length; + m_tcy = ((m_opword & 0xc600) ? 55 : 59) + (single ? 30 : 60); + break; + case 0x9: + // Trap(SLAVE) + m_fsr |= TT_ILL; + m_status = SLAVE_Q; + break; + case 0xc: + // MULf src,dest + // gen,gen + // read.f,rmw.f + if (single) + m_op[2].value = f32_mul(float32_t{ u32(m_op[1].value) }, float32_t{ u32(m_op[0].value) }).v; + else + m_op[2].value = f64_mul(float64_t{ m_op[1].value }, float64_t{ m_op[0].value }).v; + m_op[2].expected = f_length; + m_tcy = ((m_opword & 0xc600) ? 30 : 34) + (single ? 14 : 28); + break; + case 0xd: + // ABSf src,dest + // gen,gen + // read.f,write.f + if (single) + if (f32_lt(float32_t{ u32(m_op[0].value) }, float32_t{ 0 })) + m_op[2].value = f32_mul(float32_t{ u32(m_op[0].value) }, i32_to_f32(-1)).v; + else + m_op[2].value = float32_t{ u32(m_op[0].value) }.v; + else + if (f64_lt(float64_t{ m_op[0].value }, float64_t{ 0 })) + m_op[2].value = f64_mul(float64_t{ m_op[0].value }, i32_to_f64(-1)).v; + else + m_op[2].value = float64_t{ m_op[0].value }.v; + m_op[2].expected = f_length; + m_tcy = (m_opword & 0xc000) ? 20 : 24; + break; + } + } + break; + } + + // check for exceptions + if (softfloat_exceptionFlags & softfloat_flag_underflow) + { + m_fsr |= FSR_UF | TT_UND; + + if (m_fsr & FSR_UEN) + m_status |= SLAVE_Q; + else + m_op[2].value = 0; + } + else if (softfloat_exceptionFlags & softfloat_flag_overflow) + { + m_fsr |= TT_OVF; + m_status |= SLAVE_Q; + } + else if (softfloat_exceptionFlags & softfloat_flag_infinite) + { + m_fsr |= TT_DVZ; + m_status |= SLAVE_Q; + } + else if (softfloat_exceptionFlags & softfloat_flag_invalid) + m_fsr |= TT_INV; + else if (softfloat_exceptionFlags & softfloat_flag_inexact) + { + m_fsr |= FSR_IF | TT_INX; + + if (m_fsr & FSR_IEN) + m_status |= SLAVE_Q; + } + + // exceptions suppress result issue + if (m_status & SLAVE_Q) + m_op[2].expected = 0; + + if (VERBOSE & LOG_GENERAL) + { + static char const *format9[] = { "movif", "lfsr", "movlf", "movfl", "roundfi", "truncfi", "sfsr", "floorfi" }; + static char const *format11[] = + { + "addf", "movf", "cmpf", nullptr, "subf", "negf", nullptr, nullptr, + "divf", nullptr, nullptr, nullptr, "mulf", "absf", nullptr, nullptr + }; + + if (m_status & SLAVE_Q) + LOG("execute %s 0x%x,0x%x exception\n", + (m_idbyte == FORMAT_9) + ? format9[(m_opword >> 3) & 7] + : format11[(m_opword >> 2) & 15], + m_op[0].value, m_op[1].value); + else + LOG("execute %s 0x%x,0x%x result 0x%x\n", + (m_idbyte == FORMAT_9) + ? format9[(m_opword >> 3) & 7] + : format11[(m_opword >> 2) & 15], + m_op[0].value, m_op[1].value, m_op[2].value); + } + + // write-back floating point register results + if (m_op[2].expected && !(m_opword & 0x0600)) + { + // exclude integer results (roundfi, truncfi, sfsr, floorfi) + if (m_idbyte == FORMAT_11 || ((m_opword >> 3) & 7) < 4) + { + unsigned const reg = (m_opword >> 6) & 7; + + LOG("execute write-back f%d\n", reg); + + m_f[reg ^ 0] = u32(m_op[2].value >> 0); + if (m_op[2].expected == 8) + m_f[reg ^ 1] = u32(m_op[2].value >> 32); + + m_op[2].issued = m_op[2].expected; + } + } + + m_state = STATUS; + + if (m_out_scb) + m_complete->adjust(attotime::from_ticks(m_tcy, clock())); +} + +void ns32081_device::complete(void *buf, s32 param) +{ + m_out_scb(0); + m_out_scb(1); +} diff --git a/src/devices/machine/ns32081.h b/src/devices/machine/ns32081.h new file mode 100644 index 00000000000..4097494c830 --- /dev/null +++ b/src/devices/machine/ns32081.h @@ -0,0 +1,60 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#ifndef MAME_MACHINE_NS32081_H +#define MAME_MACHINE_NS32081_H + +#pragma once + +#include "cpu/ns32000/slave.h" + +class ns32081_device + : public device_t + , public ns32000_slave_interface +{ +public: + ns32081_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + virtual void state_add(device_state_interface &parent, int &index) override; + + virtual u16 read_st(int *icount = nullptr) override; + virtual u16 read_op() override; + + virtual void write_id(u16 data) override; + virtual void write_op(u16 data) override; + +protected: + // device_t overrides + virtual void device_start() override; + virtual void device_reset() override; + + void execute(); + void complete(void *buf, s32 param); + +private: + emu_timer *m_complete; + + // registers + u32 m_fsr; + u32 m_f[8]; + + // operating state + u8 m_idbyte; + u16 m_opword; + struct operand + { + unsigned expected; + unsigned issued; + u64 value; + } + m_op[3]; + u16 m_status; + + // implementation state + unsigned m_state; + unsigned m_tcy; +}; + +DECLARE_DEVICE_TYPE(NS32081, ns32081_device) + +#endif // MAME_MACHINE_NS32081_H diff --git a/src/devices/machine/ns32202.cpp b/src/devices/machine/ns32202.cpp new file mode 100644 index 00000000000..947bb6e38cd --- /dev/null +++ b/src/devices/machine/ns32202.cpp @@ -0,0 +1,698 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * National Semiconductor NS32202 Interrupt Control Unit (ICU). + * + * Sources: + * + * http://bitsavers.org/components/national/_dataBooks/1989_National_Microprocessor_Databook_32000_NSC800.pdf + * + * TODO + * - timer/counter + */ + +#include "emu.h" +#include "ns32202.h" + +#define LOG_GENERAL (1U << 0) +#define LOG_STATE (1U << 1) +#define LOG_REGW (1U << 2) +#define LOG_REGR (1U << 3) + +//#define VERBOSE (LOG_GENERAL|LOG_STATE|LOG_REGW|LOG_REGR) +#include "logmacro.h" + +DEFINE_DEVICE_TYPE(NS32202, ns32202_device, "ns32202", "NS32202 Interrupt Control Unit") + +enum mctl_mask : u8 +{ + MCTL_T16N8 = 0x01, // data bus mode + MCTL_NTAR = 0x02, // not auto-rotate mode + MCTL_FRZ = 0x08, // freeze interrupt pending + MCTL_CLKM = 0x10, // clock mode (square wave/pulsed) + MCTL_COUTM = 0x20, // cout mode (square wave/pulsed) + MCTL_COUTD = 0x40, // cout/scin input/output + MCTL_CFRZ = 0x80, // freeze counter readings +}; + +enum cctl_mask : u8 +{ + CCTL_CDCRL = 0x01, // decrement l-counter + CCTL_CDCRH = 0x02, // decrement h-counter + CCTL_CRUNL = 0x04, // l-counter running + CCTL_CRUNH = 0x08, // h-counter running + CCTL_COUT0 = 0x10, // zero detect l-counter + CCTL_COUT1 = 0x20, // zero detect h-counter + CCTL_CFNPS = 0x40, // clock not prescaled + CCTL_CCON = 0x80, // counters concatenated +}; + +enum cictl_mask : u8 +{ + CICTL_WENL = 0x01, // l-counter write enable + CICTL_CIEL = 0x02, // l-counter interrupt enable + CICTL_CIRL = 0x04, // l-counter interrupt request + CICTL_CERL = 0x08, // l-counter error flag + CICTL_WENH = 0x10, // h-counter write enable + CICTL_CIEH = 0x20, // h-counter interrupt enable + CICTL_CIRH = 0x40, // h-counter interrupt request + CICTL_CERH = 0x80, // h-counter error flag +}; + +ns32202_device::ns32202_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) + : device_t(mconfig, NS32202, tag, owner, clock) + , m_out_int(*this) + , m_out_cout(*this) + , m_out_port(*this) + , m_line_state(0xffff) + , m_out_int_state(false) + , m_out_cout_state(false) +{ +} + +void ns32202_device::device_start() +{ + m_out_int.resolve_safe(); + m_out_cout.resolve_safe(); + m_out_port.resolve_safe(); + + save_item(NAME(m_hvct)); + save_item(NAME(m_eltg)); + save_item(NAME(m_tpl)); + save_item(NAME(m_ipnd)); + save_item(NAME(m_isrv)); + save_item(NAME(m_imsk)); + save_item(NAME(m_csrc)); + save_item(NAME(m_fprt)); + save_item(NAME(m_mctl)); + save_item(NAME(m_ocasn)); + save_item(NAME(m_ciptr)); + save_item(NAME(m_pdat)); + save_item(NAME(m_ips)); + save_item(NAME(m_pdir)); + save_item(NAME(m_cctl)); + save_item(NAME(m_cictl)); + save_item(NAME(m_csv)); + save_item(NAME(m_ccv)); + + save_item(NAME(m_isrv_count)); + + save_item(NAME(m_line_state)); + save_item(NAME(m_out_int_state)); + save_item(NAME(m_out_cout_state)); + + m_interrupt = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32202_device::interrupt), this)); + m_counter[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32202_device::counter<0>), this)); + m_counter[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ns32202_device::counter<1>), this)); +} + +void ns32202_device::device_reset() +{ + m_eltg = 0xffff; + m_tpl = 0; + m_ipnd = 0; + m_isrv = 0; + m_imsk = 0xffff; + m_csrc = 0; + m_fprt = 0x0001; + + m_mctl = MCTL_COUTD; + m_ocasn = 0; + m_ciptr = 0xff; + m_ips = 0xff; + m_pdir = 0xff; + m_cictl = 0; +} + +void ns32202_device::set_int(bool int_state) +{ + if (int_state != m_out_int_state) + { + LOGMASKED(LOG_STATE, "int %s\n", int_state ? "asserted" : "cleared"); + + m_out_int_state = int_state; + m_out_int(!m_out_int_state); + } +} + +void ns32202_device::set_cout(bool cout_state) +{ + if (cout_state != m_out_cout_state) + { + LOGMASKED(LOG_STATE, "cout %s\n", cout_state ? "asserted" : "cleared"); + + m_out_cout_state = cout_state; + m_out_cout(!m_out_cout_state); + } +} + +template <unsigned ST1> void ns32202_device::map(address_map &map) +{ + map(0x00, 0x00).r(&ns32202_device::hvct_r<ST1, true>, "ns32202_device::hvct_r"); + map(0x01, 0x01).rw(&ns32202_device::hvct_r<ST1, false>, "ns32202_device::svct_r", FUNC(ns32202_device::svct_w)); + map(0x02, 0x02).rw(FUNC(ns32202_device::eltgl_r), FUNC(ns32202_device::eltgl_w)); + map(0x03, 0x03).rw(FUNC(ns32202_device::eltgh_r), FUNC(ns32202_device::eltgh_w)); + map(0x04, 0x04).rw(FUNC(ns32202_device::tpll_r), FUNC(ns32202_device::tpll_w)); + map(0x05, 0x05).rw(FUNC(ns32202_device::tplh_r), FUNC(ns32202_device::tplh_w)); + map(0x06, 0x06).rw(FUNC(ns32202_device::ipndl_r), FUNC(ns32202_device::ipndl_w)); + map(0x07, 0x07).rw(FUNC(ns32202_device::ipndh_r), FUNC(ns32202_device::ipndh_w)); + map(0x08, 0x08).rw(FUNC(ns32202_device::isrvl_r), FUNC(ns32202_device::isrvl_w)); + map(0x09, 0x09).rw(FUNC(ns32202_device::isrvh_r), FUNC(ns32202_device::isrvh_w)); + map(0x0a, 0x0a).rw(FUNC(ns32202_device::imskl_r), FUNC(ns32202_device::imskl_w)); + map(0x0b, 0x0b).rw(FUNC(ns32202_device::imskh_r), FUNC(ns32202_device::imskh_w)); + map(0x0c, 0x0c).rw(FUNC(ns32202_device::csrcl_r), FUNC(ns32202_device::csrcl_w)); + map(0x0d, 0x0d).rw(FUNC(ns32202_device::csrch_r), FUNC(ns32202_device::csrch_w)); + map(0x0e, 0x0e).rw(FUNC(ns32202_device::fprtl_r), FUNC(ns32202_device::fprtl_w)); + map(0x0f, 0x0f).rw(FUNC(ns32202_device::fprth_r), FUNC(ns32202_device::fprth_w)); + map(0x10, 0x10).rw(FUNC(ns32202_device::mctl_r), FUNC(ns32202_device::mctl_w)); + map(0x11, 0x11).rw(FUNC(ns32202_device::ocasn_r), FUNC(ns32202_device::ocasn_w)); + map(0x12, 0x12).rw(FUNC(ns32202_device::ciptr_r), FUNC(ns32202_device::ciptr_w)); + map(0x13, 0x13).rw(FUNC(ns32202_device::pdat_r), FUNC(ns32202_device::pdat_w)); + map(0x14, 0x14).rw(FUNC(ns32202_device::ips_r), FUNC(ns32202_device::ips_w)); + map(0x15, 0x15).rw(FUNC(ns32202_device::pdir_r), FUNC(ns32202_device::pdir_w)); + map(0x16, 0x16).rw(FUNC(ns32202_device::cctl_r), FUNC(ns32202_device::cctl_w)); + map(0x17, 0x17).rw(FUNC(ns32202_device::cictl_r), FUNC(ns32202_device::cictl_w)); + map(0x18, 0x18).rw(FUNC(ns32202_device::csvl_r<0>), FUNC(ns32202_device::csvl_w<0>)); + map(0x19, 0x19).rw(FUNC(ns32202_device::csvh_r<0>), FUNC(ns32202_device::csvh_w<0>)); + map(0x1a, 0x1a).rw(FUNC(ns32202_device::csvl_r<1>), FUNC(ns32202_device::csvl_w<1>)); + map(0x1b, 0x1b).rw(FUNC(ns32202_device::csvh_r<1>), FUNC(ns32202_device::csvh_w<1>)); + map(0x1c, 0x1c).rw(FUNC(ns32202_device::lccvl_r), FUNC(ns32202_device::lccvl_w)); + map(0x1d, 0x1d).rw(FUNC(ns32202_device::lccvh_r), FUNC(ns32202_device::lccvh_w)); + map(0x1e, 0x1e).rw(FUNC(ns32202_device::hccvl_r), FUNC(ns32202_device::hccvl_w)); + map(0x1f, 0x1f).rw(FUNC(ns32202_device::hccvh_r), FUNC(ns32202_device::hccvh_w)); +} + +template void ns32202_device::map<0>(address_map &map); +template void ns32202_device::map<1>(address_map &map); + +/* + * Set (and clear, for level-triggered interrupts) interrupt pending state + * based on edge/level/polarity configuration and previous/current line state, + * regardless of mask. + */ +template <unsigned Number> void ns32202_device::ir_w(int state) +{ + // ignore external interrupts assigned to counters + if (((m_cictl & CICTL_CIEL) && (m_ciptr & 15) == Number) || + ((m_cictl & CICTL_CIEH) && (m_ciptr >> 4) == Number)) + return; + + u16 const mask = 1 << Number; + + if (m_eltg & mask) + { + // level triggered + if (state == BIT(m_tpl, Number)) + m_ipnd |= mask; + else + m_ipnd &= ~mask; + } + else + { + // edge triggered + if (bool(state) == BIT(m_tpl, Number) && bool(state) ^ BIT(m_line_state, Number)) + m_ipnd |= mask; + } + + // record input line state + if (state) + m_line_state |= mask; + else + m_line_state &= ~mask; + + // datasheet states maximum 800ns + m_interrupt->adjust(attotime::from_nsec(600)); +} + +// instantiate all valid interrupt request templates +template void ns32202_device::ir_w<0>(int state); +template void ns32202_device::ir_w<1>(int state); +template void ns32202_device::ir_w<2>(int state); +template void ns32202_device::ir_w<3>(int state); +template void ns32202_device::ir_w<4>(int state); +template void ns32202_device::ir_w<5>(int state); +template void ns32202_device::ir_w<6>(int state); +template void ns32202_device::ir_w<7>(int state); +template void ns32202_device::ir_w<8>(int state); +template void ns32202_device::ir_w<9>(int state); +template void ns32202_device::ir_w<10>(int state); +template void ns32202_device::ir_w<11>(int state); +template void ns32202_device::ir_w<12>(int state); +template void ns32202_device::ir_w<13>(int state); +template void ns32202_device::ir_w<14>(int state); +template void ns32202_device::ir_w<15>(int state); + +/* + * Assert interrupt output if there are any unmasked pending interrupts; and + * - in auto-rotate mode and no interrupts are in-service; or + * - in fixed priority mode; and + * - no interrupts are in-service; or + * - unmasked pending interrupt has priority > in-service interrupt; or + * - unmasked pending cascade interrupt has priorty >= in-service interrupt + */ +void ns32202_device::interrupt(void *ptr, s32 param) +{ + // check for unmasked pending interrupts + if (!(m_ipnd & m_imsk)) + return; + + if (m_mctl & MCTL_NTAR) + { + // fixed priority mode + bool accept = false; + + // check any interrupts in-service + if (m_isrv) + { + // check interrupts in descending priority order + u16 mask = m_fprt; + for (unsigned i = 0; i < 16; i++) + { + // check interrupt in-service + if (m_isrv & mask) + { + // check equal priority unmasked pending cascade interrupt + if ((m_csrc & mask) && (m_ipnd & mask) && !(m_imsk & mask)) + { + LOGMASKED(LOG_STATE, "unmasked pending cascade in-service interrupt %d\n", 31 - count_leading_zeros(mask)); + accept = true; + } + + break; + } + + // check unmasked pending interrupt + if ((m_ipnd & mask) && !(m_imsk & mask)) + { + LOGMASKED(LOG_STATE, "unmasked pending interrupt %d\n", 31 - count_leading_zeros(mask)); + accept = true; + break; + } + + // rotate priority mask + mask = (mask << 1) | (mask >> 15); + } + } + else + accept = true; + + if (!accept) + return; + } + else if (m_isrv) + return; + + set_int(true); +} + +u8 ns32202_device::interrupt_acknowledge(bool side_effects) +{ + side_effects &= !machine().side_effects_disabled(); + u8 vector = m_hvct | 0x0f; + + if ((m_ipnd & m_imsk) && m_fprt) + { + // find highest priority unmasked pending interrupt + u16 mask = m_fprt; + for (unsigned i = 0; i < 16; i++) + { + if ((m_ipnd & mask) && !(m_imsk & mask)) + break; + + // rotate priority mask + mask = (mask << 1) | (mask >> 15); + } + + unsigned const number = 31 - count_leading_zeros(mask); + if (side_effects) + { + LOGMASKED(LOG_STATE, "acknowledge highest priority unmasked interrupt %d\n", number); + + if (m_mctl & MCTL_NTAR) + { + if (m_csrc & mask) + m_isrv_count[number]++; + } + else + m_fprt = mask; + + // mark interrupt in-service + m_isrv |= mask; + + // clear interrupt pending + m_ipnd &= ~(mask); + + // clear l-counter interrupt pending + if ((m_cictl & CICTL_CIEL) && (m_cictl & CICTL_CIRL) && BIT(mask, m_ciptr & 15)) + m_cictl &= ~CICTL_CIRL; + + // clear h-counter interrupt pending + if ((m_cictl & CICTL_CIEH) && (m_cictl & CICTL_CIRH) && BIT(mask, m_ciptr >> 4)) + m_cictl &= ~CICTL_CIRH; + + // clear interrupt output + set_int(false); + } + + // compute acknowledge vector + if (m_csrc & mask) + vector = 0xf0 | number; + else + vector = m_hvct | number; + } + else if (side_effects) + { + if (m_fprt) + LOGMASKED(LOG_STATE, "acknowledge without unmasked interrupt pending\n"); + else + LOGMASKED(LOG_STATE, "acknowledge with FPRT clear\n"); + + // clear pending edge for interrupt 15 + if (!BIT(m_eltg, 15)) + m_ipnd &= ~(1 << 15); + + // clear first priority + if (!(m_mctl & MCTL_NTAR)) + m_fprt = 0; + } + + if (side_effects) + LOGMASKED(LOG_STATE, "acknowledge vector 0x%02x\n", vector); + + return vector; +} + +u8 ns32202_device::interrupt_return(bool side_effects) +{ + side_effects &= !machine().side_effects_disabled(); + u8 vector = m_hvct | 0x0f; + + // find highest priority in-service interrupt + if (m_isrv && m_fprt) + { + u16 mask = m_fprt; + for (unsigned i = 0; i < 16; i++) + { + if (m_isrv & mask) + break; + + // rotate priority mask + mask = (mask << 1) | (mask >> 15); + } + unsigned const number = 31 - count_leading_zeros(mask); + + if (side_effects) + { + LOGMASKED(LOG_STATE, "return highest priority in-service interrupt %d\n", number); + + if (m_mctl & MCTL_NTAR) + { + if (m_csrc & mask) + { + m_isrv_count[number]--; + + if (!m_isrv_count[number]) + m_isrv &= ~mask; + } + else + // clear interrupt in-service + m_isrv &= ~mask; + } + else + { + // clear interrupt in-service + m_isrv &= ~mask; + + // rotate priority mask + m_fprt = (m_fprt << 1) | (m_fprt >> 15); + } + } + + // compute return vector + if (m_csrc & mask) + vector = 0xf0 | number; + else + vector = m_hvct | number; + } + else if (side_effects) + { + if (m_fprt) + LOGMASKED(LOG_STATE, "return without in-service interrupt\n"); + else + LOGMASKED(LOG_STATE, "return with FPRT clear\n"); + + if (!(m_mctl & MCTL_NTAR)) + // rotate priority mask + m_fprt = (m_fprt << 1) | (m_fprt >> 15); + } + + if (side_effects) + LOGMASKED(LOG_STATE, "return vector 0x%02x\n", vector); + + return vector; +} + +/* + * Check for level-triggered interrupts which become pending due to change of + * edge/level or polarity registers. + */ +void ns32202_device::interrupt_update() +{ + // compute new pending state + u16 const ipnd = m_ipnd | (m_eltg & ~(m_line_state ^ m_tpl)); + + // update and assert if state changed + if (ipnd ^ m_ipnd) + { + m_ipnd = ipnd; + m_interrupt->adjust(attotime::zero); + } +} + +// N=0 -> l-counter +template <unsigned N> void ns32202_device::counter(void *buf, s32 param) +{ + u32 const scaled_clock = clock() / ((m_cctl & CCTL_CFNPS) ? 1 : 4); + + // for now, assume this is the periodic timer triggered when we hit zero + // reload on cycle after zero + if (param) + { + u32 const ticks = (m_cctl & CCTL_CCON) + ? ((u32(m_csv[1]) << 16) | m_csv[0]) - ((u32(m_ccv[1]) << 16) | m_ccv[0]) + : m_csv[N] - m_ccv[N]; + + // reload current value + if (m_cctl & CCTL_CCON) + { + m_ccv[0] = m_csv[0]; + m_ccv[1] = m_csv[1]; + } + else + m_ccv[N] = m_csv[N]; + + // reschedule counter + m_counter[N]->adjust(attotime::from_ticks(ticks, scaled_clock), 0); + } + else + { + // clear current value + if (m_cctl & CCTL_CCON) + { + m_ccv[0] = 0; + m_ccv[1] = 0; + } + else + m_ccv[N] = 0; + + // schedule reload cycle + m_counter[N]->adjust(attotime::from_ticks(1, scaled_clock), 1); + + // update cout + if (!(m_mctl & MCTL_COUTD) && (m_cctl & (CCTL_COUT0 << N))) + { + if (m_mctl & MCTL_COUTM) + { + set_cout(true); + set_cout(false); + } + else + set_cout(!m_out_cout_state); + } + + // update port + if ((N == 1) && !(m_mctl & MCTL_T16N8) && (m_ocasn & 15)) + { + // TODO: trigger interrupts if IPS != 0 + + u8 const mask = (m_ocasn & ~m_pdir) & 15; + if (m_mctl & MCTL_CLKM) + { + m_pdat &= ~mask; + + m_out_port(0, m_ocasn & 15, mask); + m_out_port(0, 0, mask); + } + else + { + m_pdat ^= mask; + + m_out_port(0, m_pdat, mask); + } + } + + // interrupts + unsigned const shift = N ? 4 : 0; + if (m_cictl & (CICTL_CIEL << shift)) + { + // check counter interrupt error + if (m_cictl & (CICTL_CIRL << shift)) + m_cictl |= (CICTL_CERL << shift); + + // set counter interrupt request + m_cictl |= (CICTL_CIRL << shift); + + // raise interrupt + m_ipnd |= 1 << ((m_ciptr >> shift) & 15); + m_interrupt->adjust(attotime::zero); + } + } +} + +template <unsigned ST1, bool SideEffects> u8 ns32202_device::hvct_r() +{ + if (!ST1) + return interrupt_acknowledge(SideEffects); + else + return interrupt_return(SideEffects); +} + +void ns32202_device::eltgl_w(u8 data) +{ + m_eltg = (m_eltg & 0xff00) | data; + + interrupt_update(); +} + +void ns32202_device::eltgh_w(u8 data) +{ + m_eltg = (u16(data) << 8) | u8(m_eltg); + + interrupt_update(); +} + +void ns32202_device::tpll_w(u8 data) +{ + m_tpl = (m_tpl & 0xff00) | data; + + interrupt_update(); +} + +void ns32202_device::tplh_w(u8 data) +{ + m_tpl = (u16(data) << 8) | u8(m_tpl); + + interrupt_update(); +} + +void ns32202_device::csrcl_w(u8 data) +{ + m_csrc = (m_csrc & 0xff00) | data; + + // clear in-service counters + for (unsigned i = 0; i < 8; i++) + if (!BIT(m_csrc, i)) + m_isrv_count[i] = 0; +} + +void ns32202_device::csrch_w(u8 data) +{ + m_csrc = (u16(data) << 8) | u8(m_csrc); + + // clear in-service counters + for (unsigned i = 8; i < 16; i++) + if (!BIT(m_csrc, i)) + m_isrv_count[i] = 0; +} + +void ns32202_device::ipndl_w(u8 data) +{ + if (BIT(data, 6)) + // clear all pending interrupts in register + m_ipnd &= 0xff00; + else if (BIT(data, 7)) + { + // set interrupt + m_ipnd |= 1 << (data & 7); + + m_interrupt->adjust(attotime::zero); + } + else + // clear interrupt + m_ipnd &= ~(1 << (data & 7)); +} + +void ns32202_device::ipndh_w(u8 data) +{ + if (BIT(data, 6)) + // clear all pending interrupts in register + m_ipnd &= 0x00ff; + else if (BIT(data, 7)) + { + // set interrupt + m_ipnd |= 256 << (data & 7); + + m_interrupt->adjust(attotime::zero); + } + else + // clear interrupt + m_ipnd &= ~(256 << (data & 7)); +} + +void ns32202_device::fprtl_w(u8 data) +{ + m_fprt = 1 << (data & 15); +} + +void ns32202_device::cctl_w(u8 data) +{ + // disable l-counter in concatenated mode + if ((data & CCTL_CCON) && m_counter[0]->enabled()) + m_counter[0]->enable(false); + + // compute scaled clock + u32 const scaled_clock = clock() / ((data & CCTL_CFNPS) ? 1 : 4); + + // start/stop h-counter + if (!(m_cctl & CCTL_CRUNH) && (data & CCTL_CRUNH)) + m_counter[1]->adjust(attotime::from_ticks(1, scaled_clock), 1); + else if ((m_cctl & CCTL_CRUNH) && !(data & CCTL_CRUNH)) + m_counter[1]->enable(false); + + if (!(data & CCTL_CRUNH) && (data & CCTL_CDCRH)) + ; // TODO: decrement h-counter + + // start/stop l-counter + if (!(data & CCTL_CCON)) + { + if (!(m_cctl & CCTL_CRUNH) && (data & CCTL_CRUNH)) + m_counter[0]->adjust(attotime::from_ticks(1, scaled_clock), 1); + else if ((m_cctl & CCTL_CRUNH) && !(data & CCTL_CRUNH)) + m_counter[0]->enable(false); + + if (!(data & CCTL_CRUNL) && (data & CCTL_CDCRL)) + ; // TODO: decrement l-counter + } + + m_cctl = data & ~(CCTL_CRUNH | CCTL_CRUNL); +} + +void ns32202_device::cictl_w(u8 data) +{ + u8 const mask = + ((data & CICTL_WENL) ? (CICTL_CERL | CICTL_CIRL | CICTL_CIEL) : 0) | + ((data & CICTL_WENH) ? (CICTL_CERH | CICTL_CIRH | CICTL_CIEH) : 0); + + m_cictl = (m_cictl & ~mask) | (data & mask); +} diff --git a/src/devices/machine/ns32202.h b/src/devices/machine/ns32202.h new file mode 100644 index 00000000000..c6328e5fa38 --- /dev/null +++ b/src/devices/machine/ns32202.h @@ -0,0 +1,137 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +#ifndef MAME_MACHINE_NS32202_H +#define MAME_MACHINE_NS32202_H + +#pragma once + +class ns32202_device : public device_t +{ +public: + auto out_int() { return m_out_int.bind(); } + auto out_cout() { return m_out_cout.bind(); } + auto out_port() { return m_out_port.bind(); } + + template <unsigned Number> void ir_w(int state); + template <unsigned ST1> void map(address_map &map); + + ns32202_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + +protected: + // device_t overrides + virtual void device_start() override; + virtual void device_reset() override; + + void set_int(bool int_state); + void set_cout(bool cout_state); + + void interrupt(void *buf, s32 param); + u8 interrupt_acknowledge(bool side_effects); + u8 interrupt_return(bool side_effects); + + void interrupt_update(); + + template <unsigned N> void counter(void *buf, s32 param); + + template <unsigned ST1, bool SideEffects> u8 hvct_r(); + + u8 eltgl_r() { return u8(m_eltg); } + u8 eltgh_r() { return m_eltg >> 8; } + u8 tpll_r() { return u8(m_tpl); } + u8 tplh_r() { return m_tpl >> 8; } + u8 ipndl_r() { return u8(m_ipnd); } + u8 ipndh_r() { return m_ipnd >> 8; } + u8 isrvl_r() { return u8(m_isrv); } + u8 isrvh_r() { return m_isrv >> 8; } + u8 imskl_r() { return u8(m_imsk); } + u8 imskh_r() { return m_imsk >> 8; } + u8 csrcl_r() { return u8(m_csrc); } + u8 csrch_r() { return m_csrc >> 8; } + u8 fprtl_r() { return u8(m_fprt); } + u8 fprth_r() { return m_fprt >> 8; } + u8 mctl_r() { return m_mctl; } + u8 ocasn_r() { return m_ocasn; } + u8 ciptr_r() { return m_ciptr; } + u8 pdat_r() { return 0; } + u8 ips_r() { return m_ips; } + u8 pdir_r() { return m_pdir; } + u8 cctl_r() { return m_cctl; } + u8 cictl_r() { return m_cictl; } + template <unsigned N> u8 csvl_r() { return u8(m_csv[N]); } + template <unsigned N> u8 csvh_r() { return m_csv[N] >> 8; } + u8 lccvl_r() { return 0; } + u8 lccvh_r() { return 0; } + u8 hccvl_r() { return 0; } + u8 hccvh_r() { return 0; } + + void svct_w(u8 data) { m_hvct = data & 0xf0; } + + void eltgl_w(u8 data); + void eltgh_w(u8 data); + void tpll_w(u8 data); + void tplh_w(u8 data); + void ipndl_w(u8 data); + void ipndh_w(u8 data); + void isrvl_w(u8 data) { m_isrv = (m_isrv & 0xff00) | data; } + void isrvh_w(u8 data) { m_isrv = (u16(data) << 8) | u8(m_isrv); } + void imskl_w(u8 data) { m_imsk = (m_imsk & 0xff00) | data; m_interrupt->adjust(attotime::zero); } + void imskh_w(u8 data) { m_imsk = (u16(data) << 8) | u8(m_imsk); m_interrupt->adjust(attotime::zero); } + void csrcl_w(u8 data); + void csrch_w(u8 data); + void fprtl_w(u8 data); + void fprth_w(u8 data) {} + + void mctl_w(u8 data) { m_mctl = data; } + void ocasn_w(u8 data) { m_ocasn = data; } + void ciptr_w(u8 data) { m_ciptr = data; } + void pdat_w(u8 data) {} + void ips_w(u8 data) { m_ips = data; } + void pdir_w(u8 data) { m_pdir = data; } + void cctl_w(u8 data); + void cictl_w(u8 data); + + template <unsigned N> void csvl_w(u8 data) { m_csv[N] = (m_csv[N] & 0xff00) | data; } + template <unsigned N> void csvh_w(u8 data) { m_csv[N] = (u16(data) << 8) | u8(m_csv[N]); } + void lccvl_w(u8 data) {} + void lccvh_w(u8 data) {} + void hccvl_w(u8 data) {} + void hccvh_w(u8 data) {} + +private: + devcb_write_line m_out_int; + devcb_write_line m_out_cout; + devcb_write8 m_out_port; + + emu_timer *m_interrupt; + emu_timer *m_counter[2]; + + u8 m_hvct; // hardware vector + u16 m_eltg; // edge/level triggering + u16 m_tpl; // triggering polarity + u16 m_ipnd; // interrupts pending + u16 m_isrv; // interrupts in-service + u16 m_imsk; // interrupt mask + u16 m_csrc; // cascaded source + u16 m_fprt; // first priority + u8 m_mctl; // mode control + u8 m_ocasn; // output clock assignment + u8 m_ciptr; // counter interrupt pointer + u8 m_pdat; // port data + u8 m_ips; // interrupt/port select + u8 m_pdir; // port direction + u8 m_cctl; // counter control + u8 m_cictl; // counter interrupt control + u16 m_csv[2]; // counter starting value + u16 m_ccv[2]; // counter current value + + unsigned m_isrv_count[16]; + + u16 m_line_state; + bool m_out_int_state; + bool m_out_cout_state; +}; + +DECLARE_DEVICE_TYPE(NS32202, ns32202_device) + +#endif // MAME_MACHINE_NS32202_H diff --git a/src/devices/machine/pxa255.cpp b/src/devices/machine/pxa255.cpp index 07e7d997b8c..6bd82ec987c 100644 --- a/src/devices/machine/pxa255.cpp +++ b/src/devices/machine/pxa255.cpp @@ -1583,7 +1583,7 @@ uint32_t pxa255_periphs_device::screen_update(screen_device &screen, bitmap_rgb3 { for (int y = 0; y <= (m_lcd_regs.lccr2 & PXA255_LCCR2_LPP); y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); for (int x = 0; x <= (m_lcd_regs.lccr1 & PXA255_LCCR1_PPL); x++) { *dst++ = m_lcd_palette[m_lcd_framebuffer[y * ((m_lcd_regs.lccr1 & PXA255_LCCR1_PPL) + 1) + x]]; diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp index bdf95dc69d0..8ad26690bcf 100644 --- a/src/devices/machine/s2636.cpp +++ b/src/devices/machine/s2636.cpp @@ -203,7 +203,7 @@ void s2636_device::device_start() save_item(NAME(m_intreq)); save_item(NAME(m_intack)); - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); save_item(NAME(m_sample_cnt)); save_item(NAME(m_sound_lvl)); @@ -247,7 +247,7 @@ void s2636_device::render_next_line() // pre-clear the line for convenience rectangle const &vis_area = screen().visible_area(); - uint16_t *const row = &m_bitmap.pix16(m_screen_line); + uint16_t *const row = &m_bitmap.pix(m_screen_line); m_bitmap.plot_box(0, m_screen_line, m_bitmap.width(), 1, 0); if ((vis_area.min_y > m_screen_line) || (vis_area.max_y < m_screen_line)) @@ -447,13 +447,14 @@ void s2636_device::write_intack(int state) //------------------------------------------------- -// sound_stream_update_legacy - generate audio output +// sound_stream_update - generate audio output //------------------------------------------------- -void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) + +void s2636_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - while (samples--) + auto &buffer = outputs[0]; + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { if (!m_sample_cnt) { @@ -469,7 +470,7 @@ void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl } } - *buffer++ = m_sound_lvl ? 0x7fff : 0x0000; + buffer.put(sampindex, m_sound_lvl ? 1.0 : 0.0); m_sample_cnt--; } } diff --git a/src/devices/machine/s2636.h b/src/devices/machine/s2636.h index b5e41b83499..8803c629015 100644 --- a/src/devices/machine/s2636.h +++ b/src/devices/machine/s2636.h @@ -58,7 +58,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx index dcff99a7b70..8fae9ee616e 100644 --- a/src/devices/machine/s3c24xx.hxx +++ b/src/devices/machine/s3c24xx.hxx @@ -434,7 +434,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tpal() uint32_t color = s3c24xx_get_color_tpal(); for (int y = m_lcd.vpos_min; y <= m_lcd.vpos_max; y++) { - uint32_t *scanline = &bitmap.pix32(y, m_lcd.hpos_min); + uint32_t *scanline = &bitmap.pix(y, m_lcd.hpos_min); for (int x = m_lcd.hpos_min; x <= m_lcd.hpos_max; x++) { *scanline++ = color; @@ -445,7 +445,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tpal() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -467,7 +467,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -476,7 +476,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -490,7 +490,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -499,7 +499,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -513,7 +513,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -522,7 +522,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -536,7 +536,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -545,7 +545,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 16; i++) { *scanline++ = s3c24xx_get_color_stn_12(s3c24xx_lcd_dma_read_bits(12)); @@ -555,7 +555,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -563,7 +563,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -577,7 +577,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -586,7 +586,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -600,7 +600,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -609,7 +609,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -623,7 +623,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -632,7 +632,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -646,7 +646,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -655,7 +655,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -669,7 +669,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -678,7 +678,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_16() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -692,7 +692,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_16() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -751,9 +751,9 @@ void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bit { for (int y = 0; y < bitmap_dst.height(); y++) { - uint32_t *line0 = &bitmap_src_1.pix32(y); - uint32_t *line1 = &bitmap_src_2.pix32(y); - uint32_t *line2 = &bitmap_dst.pix32(y); + uint32_t const *const line0 = &bitmap_src_1.pix(y); + uint32_t const *const line1 = &bitmap_src_2.pix(y); + uint32_t *const line2 = &bitmap_dst.pix(y); for (int x = 0; x < bitmap_dst.width(); x++) { uint32_t color0 = line0[x]; @@ -764,9 +764,9 @@ void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bit uint16_t r1 = (color1 >> 16) & 0x000000ff; uint16_t g1 = (color1 >> 8) & 0x000000ff; uint16_t b1 = (color1 >> 0) & 0x000000ff; - uint8_t r = (uint8_t)((r0 + r1) >> 1); - uint8_t g = (uint8_t)((g0 + g1) >> 1); - uint8_t b = (uint8_t)((b0 + b1) >> 1); + uint8_t r = uint8_t((r0 + r1) >> 1); + uint8_t g = uint8_t((g0 + g1) >> 1); + uint8_t b = uint8_t((b0 + b1) >> 1); line2[x] = (r << 16) | (g << 8) | b; } } diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp index 6672127e20f..bf3a1ed811c 100644 --- a/src/devices/machine/s3c44b0.cpp +++ b/src/devices/machine/s3c44b0.cpp @@ -17,6 +17,8 @@ #include "coreutil.h" +#include <algorithm> + #define S3C44B0_INTCON (0x00 / 4) // Interrupt Control #define S3C44B0_INTPND (0x04 / 4) // Interrupt Request Status @@ -696,8 +698,8 @@ uint32_t s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitma { for (int y = 0; y < screen.height(); y++) { - uint32_t *scanline = &bitmap.pix32(y); - uint8_t *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1); + uint32_t *scanline = &bitmap.pix(y); + uint8_t const *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1); for (int x = 0; x < screen.width(); x++) { *scanline++ = rgb_t(vram[0], vram[1], vram[2]); @@ -710,8 +712,7 @@ uint32_t s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitma { for (int y = 0; y < screen.height(); y++) { - uint32_t *scanline = &bitmap.pix32(y); - memset(scanline, 0, screen.width() * 4); + std::fill_n(&bitmap.pix(y), screen.width(), 0); } } return 0; diff --git a/src/devices/machine/spg110_video.cpp b/src/devices/machine/spg110_video.cpp index a76fef3bb60..daf7fa5e158 100644 --- a/src/devices/machine/spg110_video.cpp +++ b/src/devices/machine/spg110_video.cpp @@ -4,6 +4,9 @@ #include "emu.h" #include "spg110_video.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SPG110_VIDEO, spg110_video_device, "spg110_video", "SPG110 System-on-a-Chip (Video)") spg110_video_device::spg110_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : @@ -649,9 +652,9 @@ uint32_t spg110_video_device::screen_update(screen_device &screen, bitmap_rgb32 for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); - uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y]; - memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1)); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); + const uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y]; + std::copy_n(src, cliprect.width(), dest); } return 0; diff --git a/src/devices/machine/spg290_ppu.cpp b/src/devices/machine/spg290_ppu.cpp index 8f47d61bf18..19ff7ccb1d2 100644 --- a/src/devices/machine/spg290_ppu.cpp +++ b/src/devices/machine/spg290_ppu.cpp @@ -354,9 +354,9 @@ inline void spg290_ppu_device::argb1555(bitmap_rgb32 &bitmap, const rectangle &c { rgb_t color = rgb_t(pal5bit(argb >> 10), pal5bit(argb >> 5), pal5bit(argb >> 0)); if (blend) - color = blend_colors(bitmap.pix32(posy, posx), color, blend); + color = blend_colors(bitmap.pix(posy, posx), color, blend); - bitmap.pix32(posy, posx) = color; + bitmap.pix(posy, posx) = color; } } @@ -366,9 +366,9 @@ inline void spg290_ppu_device::rgb565(bitmap_rgb32 &bitmap, const rectangle &cli { rgb_t color = rgb_t(pal5bit(rgb >> 11), pal6bit(rgb >> 5), pal5bit(rgb >> 0)); if (blend) - color = blend_colors(bitmap.pix32(posy, posx), color, blend); + color = blend_colors(bitmap.pix(posy, posx), color, blend); - bitmap.pix32(posy, posx) = color; + bitmap.pix(posy, posx) = color; } } diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h index 0eb2a29f82a..68d42675360 100644 --- a/src/devices/machine/spg2xx.h +++ b/src/devices/machine/spg2xx.h @@ -123,8 +123,6 @@ protected: devcb_write8 m_chip_sel; - emu_timer *m_screenpos_timer; - uint8_t m_fiq_vector; required_device<screen_device> m_screen; diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp index 07d01e88be5..2441ebf17ce 100644 --- a/src/devices/machine/spg2xx_audio.cpp +++ b/src/devices/machine/spg2xx_audio.cpp @@ -76,7 +76,7 @@ void spg2xx_audio_device::device_start() m_audio_beat = timer_alloc(TIMER_BEAT); m_audio_beat->adjust(attotime::never); - m_stream = stream_alloc_legacy(0, 2, 281250/4); + m_stream = stream_alloc(0, 2, 281250/4); m_channel_debug = -1; @@ -887,12 +887,12 @@ void spg2xx_audio_device::audio_w(offs_t offset, uint16_t data) } } -void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void spg2xx_audio_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *out_l = outputs[0]; - stream_sample_t *out_r = outputs[1]; + auto &out_l = outputs[0]; + auto &out_r = outputs[1]; - for (int i = 0; i < samples; i++) + for (int i = 0; i < out_l.samples(); i++) { int32_t left_total = 0; int32_t right_total = 0; @@ -992,8 +992,8 @@ void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, strea int32_t left_final = (int16_t)((left_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7); int32_t right_final = (int16_t)((right_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7); - *out_l++ = (int16_t)left_final; - *out_r++ = (int16_t)right_final; + out_l.put_int(i, int16_t(left_final), 32768); + out_r.put_int(i, int16_t(right_final), 32768); } } diff --git a/src/devices/machine/spg2xx_audio.h b/src/devices/machine/spg2xx_audio.h index 59d7635198d..588d49e7895 100644 --- a/src/devices/machine/spg2xx_audio.h +++ b/src/devices/machine/spg2xx_audio.h @@ -33,7 +33,7 @@ public: protected: // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void audio_beat_tick(); void audio_rampdown_tick(const uint32_t channel); diff --git a/src/devices/machine/spg_renderer.cpp b/src/devices/machine/spg_renderer.cpp index 0b6efe58c3f..78bc26438ae 100644 --- a/src/devices/machine/spg_renderer.cpp +++ b/src/devices/machine/spg_renderer.cpp @@ -831,7 +831,7 @@ void spg_renderer_device::update_palette_lookup() void spg_renderer_device::apply_saturation_and_fade(bitmap_rgb32& bitmap, const rectangle& cliprect, int scanline) { - uint32_t* src = &bitmap.pix32(scanline, cliprect.min_x); + uint32_t* src = &bitmap.pix(scanline, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/devices/machine/swtpc8212.cpp b/src/devices/machine/swtpc8212.cpp index 68af9d42e07..fffd6eefe7f 100644 --- a/src/devices/machine/swtpc8212.cpp +++ b/src/devices/machine/swtpc8212.cpp @@ -319,7 +319,7 @@ MC6845_UPDATE_ROW(swtpc8212_device::update_row) else font_color = rgb_t(0x00, 0xd0, 0x00); } - bitmap.pix32(y, x++) = font_color; + bitmap.pix(y, x++) = font_color; data <<= 1; } diff --git a/src/devices/machine/tc009xlvc.cpp b/src/devices/machine/tc009xlvc.cpp index e6fcb74a181..b2d302d3922 100644 --- a/src/devices/machine/tc009xlvc.cpp +++ b/src/devices/machine/tc009xlvc.cpp @@ -347,7 +347,7 @@ u32 tc0090lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { const int res_x = (global_flip()) ? 320 - x : x; - bitmap.pix16(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); + bitmap.pix(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); } } } @@ -398,7 +398,7 @@ u32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { const int res_x = (global_flip()) ? 320 - x : x; - bitmap.pix16(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); + bitmap.pix(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); } } } diff --git a/src/devices/machine/terminal.cpp b/src/devices/machine/terminal.cpp index fd07c5bff35..ccb101d8036 100644 --- a/src/devices/machine/terminal.cpp +++ b/src/devices/machine/terminal.cpp @@ -276,7 +276,7 @@ uint32_t generic_terminal_device::update(screen_device &device, bitmap_rgb32 &bi { for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); for (uint16_t x = ma; x < ma + m_width; x++) { diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp index 6328ec74dab..85aabb49335 100644 --- a/src/devices/machine/upd765.cpp +++ b/src/devices/machine/upd765.cpp @@ -174,6 +174,7 @@ upd765_family_device::upd765_family_device(const machine_config &mconfig, device ready_polled(true), select_connected(true), select_multiplexed(true), + has_dor(true), external_ready(false), recalibrate_steps(77), mode(mode_t::AT), @@ -181,8 +182,7 @@ upd765_family_device::upd765_family_device(const machine_config &mconfig, device drq_cb(*this), hdl_cb(*this), idx_cb(*this), - us_cb(*this), - dor_reset(0x00) + us_cb(*this) { } @@ -245,6 +245,7 @@ void upd765_family_device::device_start() cur_rate = 250000; tc = false; selected_drive = -1; + dor = 0x0c; // reset at upper levels may cause a write to tc ending up with // live_sync, which will crash if the live structure isn't @@ -267,7 +268,8 @@ void upd765_family_device::device_start() void upd765_family_device::device_reset() { - dor = dor_reset; + if(has_dor) + dor = 0x00; locked = false; soft_reset(); } @@ -304,6 +306,14 @@ void upd765_family_device::soft_reset() set_ds(select_multiplexed ? 0 : -1); check_irq(); + if(BIT(dor, 2)) + end_reset(); + else if(ready_polled) + poll_timer->adjust(attotime::never); +} + +void upd765_family_device::end_reset() +{ if(ready_polled) poll_timer->adjust(attotime::from_usec(100), 0, attotime::from_usec(1024)); } @@ -333,6 +343,25 @@ bool upd765_family_device::get_ready(int fid) return !external_ready; } +WRITE_LINE_MEMBER(upd765_family_device::reset_w) +{ + // This implementation is not valid for devices with DOR and possibly other extra registers. + // The working assumption is that no need to manipulate the RESET line directly when software can use DOR instead. + assert(!has_dor); + if(bool(state) == !BIT(dor, 2)) + return; + + LOGREGS("reset = %d\n", state); + if(state) { + dor &= 0xfb; + soft_reset(); + } + else { + dor |= 0x04; + end_reset(); + } +} + void upd765_family_device::set_ds(int fid) { if(selected_drive == fid) @@ -399,11 +428,16 @@ uint8_t upd765_family_device::dor_r() void upd765_family_device::dor_w(uint8_t data) { + assert(has_dor); LOGREGS("dor = %02x\n", data); uint8_t diff = dor ^ data; dor = data; - if(diff & 4) - soft_reset(); + if(BIT(diff, 2)) { + if(BIT(data, 2)) + end_reset(); + else + soft_reset(); + } for(int i=0; i<4; i++) { floppy_info &fi = flopi[i]; @@ -513,6 +547,9 @@ uint8_t upd765_family_device::fifo_r() void upd765_family_device::fifo_w(uint8_t data) { + if(!BIT(dor, 2)) + LOGWARN("%s: fifo_w(%02x) in reset\n", machine().describe_context(), data); + switch(main_phase) { case PHASE_CMD: { command[command_pos++] = data; @@ -780,7 +817,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x c=%d\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -796,7 +833,7 @@ void upd765_family_device::live_run(attotime limit) cur_live.data_separator_phase = false; cur_live.bit_counter = 0; cur_live.state = READ_HEADER_BLOCK_HEADER; - LOGLIVE("%s: Found A1\n", tts(cur_live.tm)); + LOGLIVE("%s: Found A1\n", cur_live.tm.to_string()); } if(!mfm && cur_live.shift_reg == 0xf57e) { @@ -804,7 +841,7 @@ void upd765_family_device::live_run(attotime limit) cur_live.data_separator_phase = false; cur_live.bit_counter = 0; cur_live.state = READ_ID_BLOCK; - LOGLIVE("%s: Found IDAM\n", tts(cur_live.tm)); + LOGLIVE("%s: Found IDAM\n", cur_live.tm.to_string()); } break; @@ -812,7 +849,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -832,11 +869,11 @@ void upd765_family_device::live_run(attotime limit) if(cur_live.shift_reg != 0x4489) cur_live.state = SEARCH_ADDRESS_MARK_HEADER; else - LOGLIVE("%s: Found A1\n", tts(cur_live.tm)); + LOGLIVE("%s: Found A1\n", cur_live.tm.to_string()); break; } if(cur_live.data_reg != 0xfe) { - LOGLIVE("%s: No ident byte found after triple-A1, continue search\n", tts(cur_live.tm)); + LOGLIVE("%s: No ident byte found after triple-A1, continue search\n", cur_live.tm.to_string()); cur_live.state = SEARCH_ADDRESS_MARK_HEADER; break; } @@ -854,7 +891,7 @@ void upd765_family_device::live_run(attotime limit) break; int slot = (cur_live.bit_counter >> 4)-1; - LOGLIVE("%s: slot=%d data=%02x crc=%04x\n", tts(cur_live.tm), slot, cur_live.data_reg, cur_live.crc); + LOGLIVE("%s: slot=%d data=%02x crc=%04x\n", cur_live.tm.to_string(), slot, cur_live.data_reg, cur_live.crc); cur_live.idbuf[slot] = cur_live.data_reg; if(slot == 5) { live_delay(IDLE); @@ -867,7 +904,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x c=%d.%x\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -912,7 +949,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -1218,7 +1255,7 @@ void upd765_family_device::live_run(attotime limit) break; default: - LOGWARN("%s: Unknown live state %d\n", tts(cur_live.tm), cur_live.state); + LOGWARN("%s: Unknown live state %d\n", cur_live.tm.to_string(), cur_live.state); return; } } @@ -2412,17 +2449,6 @@ bool upd765_family_device::get_irq() const return cur_irq; } -std::string upd765_family_device::tts(attotime t) -{ - const char *sign = ""; - if(t.seconds() < 0) { - t = attotime::zero - t; - sign = "-"; - } - int const nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; - return util::string_format("%s%04d.%03d,%03d,%03d", sign, int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); -} - std::string upd765_family_device::results() const { std::ostringstream stream; @@ -2440,7 +2466,7 @@ std::string upd765_family_device::results() const std::string upd765_family_device::ttsn() const { - return tts(machine().time()); + return machine().time().to_string(); } void upd765_family_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) @@ -2623,7 +2649,7 @@ bool upd765_family_device::write_one_bit(const attotime &limit) void upd765_family_device::live_write_raw(uint16_t raw) { - LOGLIVE("%s: write %04x %04x\n", tts(cur_live.tm), raw, cur_live.crc); + LOGLIVE("%s: write %04x %04x\n", cur_live.tm.to_string(), raw, cur_live.crc); cur_live.shift_reg = raw; cur_live.data_bit_context = raw & 1; } @@ -2643,7 +2669,7 @@ void upd765_family_device::live_write_mfm(uint8_t mfm) cur_live.data_reg = mfm; cur_live.shift_reg = raw; cur_live.data_bit_context = context; - LOGLIVE("%s: write %02x %04x %04x\n", tts(cur_live.tm), mfm, cur_live.crc, raw); + LOGLIVE("%s: write %02x %04x %04x\n", cur_live.tm.to_string(), mfm, cur_live.crc, raw); } void upd765_family_device::live_write_fm(uint8_t fm) @@ -2655,7 +2681,7 @@ void upd765_family_device::live_write_fm(uint8_t fm) cur_live.data_reg = fm; cur_live.shift_reg = raw; cur_live.data_bit_context = fm & 1; - LOGLIVE("%s: write %02x %04x %04x\n", tts(cur_live.tm), fm, cur_live.crc, raw); + LOGLIVE("%s: write %02x %04x %04x\n", cur_live.tm.to_string(), fm, cur_live.crc, raw); } bool upd765_family_device::sector_matches() const @@ -2672,17 +2698,17 @@ bool upd765_family_device::sector_matches() const upd765a_device::upd765a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, UPD765A, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; } upd765b_device::upd765b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, UPD765B, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; } i8272a_device::i8272a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, I8272A, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; } upd72065_device::upd72065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd72065_device(mconfig, UPD72065, tag, owner, clock) @@ -2691,7 +2717,7 @@ upd72065_device::upd72065_device(const machine_config &mconfig, const char *tag, upd72065_device::upd72065_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, type, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; recalibrate_steps = 255; } @@ -2713,7 +2739,7 @@ upd72069_device::upd72069_device(const machine_config &mconfig, const char *tag, i82072_device::i82072_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, I82072, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; recalibrate_steps = 255; } @@ -3089,7 +3115,7 @@ mcs3201_device::mcs3201_device(const machine_config &mconfig, const char *tag, d upd765_family_device(mconfig, MCS3201, tag, owner, clock), m_input_handler(*this) { - dor_reset = 0x0c; + has_dor = true; ready_polled = false; ready_connected = false; select_connected = true; diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h index 0c81f5aaa77..0ba8aa6d1c7 100644 --- a/src/devices/machine/upd765.h +++ b/src/devices/machine/upd765.h @@ -49,6 +49,7 @@ public: void ready_w(bool val); DECLARE_WRITE_LINE_MEMBER(tc_line_w) { tc_w(state == ASSERT_LINE); } + DECLARE_WRITE_LINE_MEMBER(reset_w); void set_rate(int rate); // rate in bps, to be used when the fdc is externally frequency-controlled @@ -231,7 +232,7 @@ protected: static constexpr int rates[4] = { 500000, 300000, 250000, 1000000 }; - bool ready_connected, ready_polled, select_connected, select_multiplexed; + bool ready_connected, ready_polled, select_connected, select_multiplexed, has_dor; bool external_ready; @@ -250,7 +251,7 @@ protected: bool fifo_write; uint8_t dor, dsr, msr, fifo[16], command[16], result[16]; uint8_t st1, st2, st3; - uint8_t fifocfg, dor_reset; + uint8_t fifocfg; uint8_t precomp; uint16_t spec; int sector_size; @@ -259,7 +260,6 @@ protected: emu_timer *poll_timer; - static std::string tts(attotime t); std::string results() const; std::string ttsn() const; @@ -288,6 +288,8 @@ protected: C_INCOMPLETE }; + void end_reset(); + void delay_cycles(emu_timer *tm, int cycles); void check_irq(); void fifo_expect(int size, bool write); diff --git a/src/devices/machine/wd1010.cpp b/src/devices/machine/wd1010.cpp index 96fb4b5fdd0..a330d6c7671 100644 --- a/src/devices/machine/wd1010.cpp +++ b/src/devices/machine/wd1010.cpp @@ -16,7 +16,7 @@ #define LOG_REGS (1U << 4) #define LOG_DATA (1U << 5) -//#define VERBOSE (LOG_CMD | LOG_INT | LOG_SEEK | LOG_REGS | LOG_DATA) +#define VERBOSE (LOG_CMD | LOG_INT | LOG_SEEK | LOG_REGS | LOG_DATA) //#define LOG_OUTPUT_STREAM std::cout #include "logmacro.h" @@ -46,7 +46,11 @@ DEFINE_DEVICE_TYPE(WD1010, wd1010_device, "wd1010", "Western Digital WD1010-05") wd1010_device::wd1010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, WD1010, tag, owner, clock), m_out_intrq_cb(*this), + m_out_bdrq_cb(*this), + m_out_bcs_cb(*this), m_out_bcr_cb(*this), + m_out_dirin_cb(*this), + m_out_wg_cb(*this), m_in_data_cb(*this), m_out_data_cb(*this), m_intrq(0), @@ -83,13 +87,18 @@ void wd1010_device::device_start() // resolve callbacks m_out_intrq_cb.resolve_safe(); + m_out_bdrq_cb.resolve_safe(); + m_out_bcs_cb.resolve_safe(); m_out_bcr_cb.resolve_safe(); + m_out_dirin_cb.resolve_safe(); + m_out_wg_cb.resolve_safe(); m_in_data_cb.resolve_safe(0); m_out_data_cb.resolve_safe(); // allocate timer m_seek_timer = timer_alloc(TIMER_SEEK); - m_data_timer = timer_alloc(TIMER_DATA); + m_read_timer = timer_alloc(TIMER_READ); + m_write_timer = timer_alloc(TIMER_WRITE); // register for save states save_item(NAME(m_intrq)); @@ -156,14 +165,12 @@ void wd1010_device::device_timer(emu_timer &timer, device_timer_id tid, int para break; - case TIMER_DATA: - - // check if data is ready or continue waiting - if (m_brdy) - cmd_write_sector(); - else - m_data_timer->adjust(attotime::from_usec(35)); + case TIMER_READ: + cmd_read_sector(); + break; + case TIMER_WRITE: + cmd_write_sector(); break; } } @@ -207,6 +214,26 @@ void wd1010_device::set_intrq(int state) } //------------------------------------------------- +// set_bdrq - set drq status +//------------------------------------------------- + +void wd1010_device::set_bdrq(int state) +{ + if ((!(m_status & STATUS_DRQ)) && state == 1) + { + LOGINT("DRQ 1\n"); + m_status |= STATUS_DRQ; + m_out_bdrq_cb(1); + } + else if ((m_status & STATUS_DRQ) && state == 0) + { + LOGINT("DRQ 0\n"); + m_status &= ~STATUS_DRQ; + m_out_bdrq_cb(0); + } +} + +//------------------------------------------------- // get_stepping_rate - calculate stepping rate //------------------------------------------------- @@ -305,6 +332,16 @@ void wd1010_device::brdy_w(int state) m_brdy = state; } +int wd1010_device::sc_r() +{ + return m_status & STATUS_SC ? 1 : 0; +} + +int wd1010_device::tk000_r() +{ + return m_drives[drive()].cylinder == 0 ? 1 : 0; +} + uint8_t wd1010_device::read(offs_t offset) { // if the controller is busy all reads return the status register @@ -423,13 +460,13 @@ void wd1010_device::write(offs_t offset, uint8_t data) if ((m_command >> 4) != CMD_SCAN_ID) m_status &= ~STATUS_SC; - int amount = 0; + int seek = 0; int target = 0; switch (m_command >> 4) { case CMD_RESTORE: - amount = m_drives[drive()].cylinder; + seek = m_drives[drive()].cylinder; target = 0; break; @@ -437,15 +474,17 @@ void wd1010_device::write(offs_t offset, uint8_t data) case CMD_READ_SECTOR: case CMD_WRITE_SECTOR: case CMD_WRITE_FORMAT: - amount = abs(m_drives[drive()].cylinder - m_cylinder); + seek = m_drives[drive()].cylinder - m_cylinder; target = m_cylinder; break; } + m_out_dirin_cb(seek > 0 ? 1 : 0); + if ((m_command >> 4) != CMD_SCAN_ID) - LOGSEEK("Seeking %d cylinders to %d\n", amount, target); + LOGSEEK("Seeking %d cylinders to %d\n", seek, target); - m_seek_timer->adjust(get_stepping_rate() * amount, target); + m_seek_timer->adjust(get_stepping_rate() * abs(seek), target); } break; @@ -465,12 +504,30 @@ void wd1010_device::cmd_restore() void wd1010_device::cmd_read_sector() { + if (m_status & STATUS_DRQ) + { + if (m_brdy) + { + set_bdrq(0); + + // if there's nothing left we're done + if (m_sector_count == 0) + { + end_command(); + return; + } + } + else + { + // continue waiting for the buffer to be ready + m_read_timer->adjust(attotime::from_usec(35)); + return; + } + } + hard_disk_file *file = m_drives[drive()].drive->get_hard_disk_file(); hard_disk_info *info = hard_disk_get_info(file); - m_out_bcr_cb(1); - m_out_bcr_cb(0); - // verify that we can read if (head() > info->heads) { @@ -479,91 +536,112 @@ void wd1010_device::cmd_read_sector() set_error(ERR_AC); end_command(); + return; } - else - { - uint8_t buffer[512]; - while (m_sector_count > 0) - { - LOGDATA("--> Transferring sector to buffer (lba = %08x)\n", get_lbasector()); + uint8_t buffer[512]; - hard_disk_read(file, get_lbasector(), buffer); + m_out_bcr_cb(1); + m_out_bcr_cb(0); - for (int i = 0; i < 512; i++) - m_out_data_cb(buffer[i]); + m_out_bcs_cb(1); - m_out_bcr_cb(1); - m_out_bcr_cb(0); + LOGDATA("--> Transferring sector to buffer (lba = %08x)\n", get_lbasector()); - // save last read head and sector number - m_drives[drive()].head = head(); - m_drives[drive()].sector = m_sector_number; + hard_disk_read(file, get_lbasector(), buffer); - if (BIT(m_command, 2)) - { - m_sector_number++; - m_sector_count--; - } - else - break; - } + for (int i = 0; i < 512; i++) + m_out_data_cb(buffer[i]); - end_command(); + // multi-sector read + if (BIT(m_command, 2)) + { + m_sector_number++; + m_sector_count--; + } + else + { + m_sector_count = 0; } + + if (m_sector_count == 0) + { + m_out_bcr_cb(1); + m_out_bcr_cb(0); + } + + m_out_bcs_cb(0); + + set_bdrq(1); + + // interrupt at bdrq time? + if (BIT(m_command, 3) == 0) + set_intrq(1); + + // now wait for brdy + m_read_timer->adjust(attotime::from_usec(35)); } void wd1010_device::cmd_write_sector() { - if (!(m_status & STATUS_DRQ)) - { - LOGDATA("Setting DATA REQUEST\n"); - m_status |= STATUS_DRQ; - m_data_timer->adjust(attotime::from_usec(35)); - return; - } + set_bdrq(1); + // wait if the buffer isn't ready if (m_brdy == 0) { - m_data_timer->adjust(attotime::from_usec(35)); + m_write_timer->adjust(attotime::from_usec(35)); return; } - LOGDATA("Clearing DATA REQUEST\n"); - m_status &= ~STATUS_DRQ; - hard_disk_file *file = m_drives[drive()].drive->get_hard_disk_file(); uint8_t buffer[512]; - while (m_sector_count > 0) + set_bdrq(0); + + m_out_bcr_cb(1); + m_out_bcr_cb(0); + + m_out_bcs_cb(1); + + m_out_wg_cb(1); + + if ((m_command >> 4) == CMD_WRITE_FORMAT) { - if ((m_command >> 4) == CMD_WRITE_FORMAT) - { - // we ignore the format specification and fill everything with 0xe5 - std::fill(std::begin(buffer), std::end(buffer), 0xe5); - } - else - { - // get data for sector from buffer chip - for (int i = 0; i < 512; i++) - buffer[i] = m_in_data_cb(); - } + // we ignore the format specification and fill everything with 0xe5 + std::fill(std::begin(buffer), std::end(buffer), 0xe5); + } + else + { + // get data for sector from buffer chip + for (int i = 0; i < 512; i++) + buffer[i] = m_in_data_cb(); + } - hard_disk_write(file, get_lbasector(), buffer); + hard_disk_write(file, get_lbasector(), buffer); - // save last read head and sector number - m_drives[drive()].head = head(); - m_drives[drive()].sector = m_sector_number; + // save last read head and sector number + m_drives[drive()].head = head(); + m_drives[drive()].sector = m_sector_number; - if (BIT(m_command, 2)) + // multi-sector write + if (BIT(m_command, 2) && m_sector_count > 0) + { + m_sector_number++; + m_sector_count--; + + // schedule another run if we aren't finished yet + if (m_sector_count > 0) { - m_sector_number++; - m_sector_count--; + m_out_bcs_cb(0); + m_out_wg_cb(0); + m_write_timer->adjust(attotime::from_usec(35)); + return; } - else - break; } + m_out_bcs_cb(0); + m_out_wg_cb(0); + end_command(); } diff --git a/src/devices/machine/wd1010.h b/src/devices/machine/wd1010.h index b6a637c99e9..268ab3a63ca 100644 --- a/src/devices/machine/wd1010.h +++ b/src/devices/machine/wd1010.h @@ -27,7 +27,11 @@ public: wd1010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto out_intrq_callback() { return m_out_intrq_cb.bind(); } + auto out_bdrq_callback() { return m_out_bdrq_cb.bind(); } + auto out_bcs_callback() { return m_out_bcs_cb.bind(); } auto out_bcr_callback() { return m_out_bcr_cb.bind(); } + auto out_dirin_callback() { return m_out_dirin_cb.bind(); } + auto out_wg_callback() { return m_out_wg_cb.bind(); } auto in_data_callback() { return m_in_data_cb.bind(); } auto out_data_callback() { return m_out_data_cb.bind(); } @@ -37,6 +41,10 @@ public: void drdy_w(int state); void brdy_w(int state); + // actually inputs to the controller from the drive + int sc_r(); + int tk000_r(); + protected: // device-level overrides virtual void device_start() override; @@ -81,11 +89,13 @@ private: enum { TIMER_SEEK, - TIMER_DATA + TIMER_READ, + TIMER_WRITE }; void set_error(int error); void set_intrq(int state); + void set_bdrq(int state); attotime get_stepping_rate(); void start_command(); void end_command(); @@ -107,7 +117,11 @@ private: void cmd_seek(); devcb_write_line m_out_intrq_cb; + devcb_write_line m_out_bdrq_cb; + devcb_write_line m_out_bcs_cb; devcb_write_line m_out_bcr_cb; + devcb_write_line m_out_dirin_cb; + devcb_write_line m_out_wg_cb; devcb_read8 m_in_data_cb; devcb_write8 m_out_data_cb; @@ -120,9 +134,11 @@ private: } m_drives[4]; emu_timer *m_seek_timer; - emu_timer *m_data_timer; + emu_timer *m_read_timer; + emu_timer *m_write_timer; int m_intrq; + //int m_bdrq; int m_brdy; uint8_t m_stepping_rate; uint8_t m_command; diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index 0259fb5d0b0..e3a7c8a1d00 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -724,6 +724,7 @@ uint8_t z80scc_device::modify_vector(uint8_t vec, int i, uint8_t src) // Modify vector according to Hi/lo bit of WR9 if (m_wr9 & WR9_BIT_SHSL) // Affect V4-V6 { + src = bitswap<4>(src, 3, 0, 1, 2); // order switched (see table above) vec &= 0x8f; vec |= src << 4; } diff --git a/src/devices/sound/2203intf.cpp b/src/devices/sound/2203intf.cpp index 6b579f486a3..3a1a31d26a2 100644 --- a/src/devices/sound/2203intf.cpp +++ b/src/devices/sound/2203intf.cpp @@ -54,13 +54,12 @@ void ym2203_device::timer_handler(int c, int count, int clock) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// stream_generate - handle a stream update //------------------------------------------------- - -void ym2203_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym2203_device::stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym2203_update_one(m_chip, outputs[0], samples); + ym2203_update_one(m_chip, outputs[0]); } @@ -108,7 +107,7 @@ void ym2203_device::calculate_rates() if (m_stream != nullptr) m_stream->set_sample_rate(rate); else - m_stream = machine().sound().stream_alloc_legacy(*this,0,1,rate, stream_update_legacy_delegate(&ym2203_device::stream_generate,this)); + m_stream = machine().sound().stream_alloc(*this,0,1,rate, stream_update_delegate(&ym2203_device::stream_generate,this), STREAM_DEFAULT_FLAGS); } //------------------------------------------------- diff --git a/src/devices/sound/2203intf.h b/src/devices/sound/2203intf.h index ccb5841cd82..df10125693a 100644 --- a/src/devices/sound/2203intf.h +++ b/src/devices/sound/2203intf.h @@ -39,7 +39,7 @@ protected: virtual void device_clock_changed() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); + void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); private: enum diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp index 4ca366fa117..b746ae15e66 100644 --- a/src/devices/sound/2608intf.cpp +++ b/src/devices/sound/2608intf.cpp @@ -63,12 +63,12 @@ void ym2608_device::timer_handler(int c,int count,int clock) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// stream_generate - handle a stream update //------------------------------------------------- -void ym2608_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym2608_device::stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym2608_update_one(m_chip, outputs, samples); + ym2608_update_one(m_chip, outputs); } void ym2608_device::device_post_load() @@ -93,7 +93,7 @@ void ym2608_device::device_start() m_timer[1] = timer_alloc(1); /* stream system initialize */ - m_stream = machine().sound().stream_alloc_legacy(*this,0,2,rate, stream_update_legacy_delegate(&ym2608_device::stream_generate,this)); + m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(&ym2608_device::stream_generate,this), STREAM_DEFAULT_FLAGS); /* initialize YM2608 */ m_chip = ym2608_init(this,clock(),rate, diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h index c6a3fec6fc9..ca1361ba867 100644 --- a/src/devices/sound/2608intf.h +++ b/src/devices/sound/2608intf.h @@ -39,7 +39,7 @@ protected: virtual void rom_bank_updated() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); + void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); private: void irq_handler(int irq); diff --git a/src/devices/sound/2610intf.cpp b/src/devices/sound/2610intf.cpp index 2f6e3e08620..b0ee9c99d32 100644 --- a/src/devices/sound/2610intf.cpp +++ b/src/devices/sound/2610intf.cpp @@ -62,20 +62,20 @@ void ym2610_device::timer_handler(int c,int count,int clock) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// stream_generate - handle a stream update //------------------------------------------------- -void ym2610_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym2610_device::stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym2610_update_one(m_chip, outputs, samples); + ym2610_update_one(m_chip, outputs); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// stream_generate - handle a stream update //------------------------------------------------- -void ym2610b_device::stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym2610b_device::stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym2610b_update_one(m_chip, outputs, samples); + ym2610b_update_one(m_chip, outputs); } @@ -102,7 +102,7 @@ void ym2610_device::device_start() m_timer[1] = timer_alloc(1); /* stream system initialize */ - m_stream = machine().sound().stream_alloc_legacy(*this,0,2,rate, stream_update_legacy_delegate(&ym2610_device::stream_generate,this)); + m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(&ym2610_device::stream_generate,this), STREAM_DEFAULT_FLAGS); if (!has_configured_map(0) && !has_configured_map(1)) { diff --git a/src/devices/sound/2610intf.h b/src/devices/sound/2610intf.h index a305f9d352d..9125feee4d6 100644 --- a/src/devices/sound/2610intf.h +++ b/src/devices/sound/2610intf.h @@ -40,7 +40,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); + virtual void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); void * m_chip; @@ -75,7 +75,7 @@ public: ym2610b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: - virtual void stream_generate(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void stream_generate(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; diff --git a/src/devices/sound/2612intf.cpp b/src/devices/sound/2612intf.cpp index 679333cdcf3..b856ef33e65 100644 --- a/src/devices/sound/2612intf.cpp +++ b/src/devices/sound/2612intf.cpp @@ -56,12 +56,12 @@ void ym2612_device::timer_handler(int c,int count,int clock) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ym2612_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym2612_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym2612_update_one(m_chip, outputs, samples, m_output_bits); + ym2612_update_one(m_chip, outputs, m_output_bits); } @@ -87,7 +87,7 @@ void ym2612_device::device_start() m_timer[1] = timer_alloc(1); /* stream system initialize */ - m_stream = stream_alloc_legacy(0,2,rate); + m_stream = stream_alloc(0,2,rate); /**** initialize YM2612 ****/ m_chip = ym2612_init(this,clock(),rate,&ym2612_device::static_timer_handler,&ym2612_device::static_irq_handler); @@ -108,7 +108,7 @@ void ym2612_device::calculate_rates() if (m_stream != nullptr) m_stream->set_sample_rate(rate); else - m_stream = stream_alloc_legacy(0,2,rate); + m_stream = stream_alloc(0,2,rate); } //------------------------------------------------- diff --git a/src/devices/sound/2612intf.h b/src/devices/sound/2612intf.h index f9447081d9b..c88b83ffef5 100644 --- a/src/devices/sound/2612intf.h +++ b/src/devices/sound/2612intf.h @@ -33,7 +33,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; u8 m_output_bits; private: diff --git a/src/devices/sound/262intf.cpp b/src/devices/sound/262intf.cpp index 0a76cdf6d2b..616cefc6377 100644 --- a/src/devices/sound/262intf.cpp +++ b/src/devices/sound/262intf.cpp @@ -50,12 +50,12 @@ void ymf262_device::timer_handler(int c, const attotime &period) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ymf262_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ymf262_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ymf262_update_one(m_chip, outputs, samples); + ymf262_update_one(m_chip, outputs); } //------------------------------------------------- @@ -81,7 +81,7 @@ void ymf262_device::device_start() if (!m_chip) throw emu_fatalerror("ymf262_device(%s): Error creating YMF262 chip", tag()); - m_stream = stream_alloc_legacy(0,4,rate); + m_stream = stream_alloc(0,4,rate); /* YMF262 setup */ ymf262_set_timer_handler (m_chip, &ymf262_device::static_timer_handler, this); diff --git a/src/devices/sound/262intf.h b/src/devices/sound/262intf.h index 09ae497748d..6c2376fc960 100644 --- a/src/devices/sound/262intf.h +++ b/src/devices/sound/262intf.h @@ -27,7 +27,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void irq_handler(int irq); diff --git a/src/devices/sound/3526intf.cpp b/src/devices/sound/3526intf.cpp index dce29c78440..906c3c3fd38 100644 --- a/src/devices/sound/3526intf.cpp +++ b/src/devices/sound/3526intf.cpp @@ -60,12 +60,12 @@ void ym3526_device::timer_handler(int c,const attotime &period) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ym3526_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym3526_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym3526_update_one(m_chip, outputs[0], samples); + ym3526_update_one(m_chip, outputs[0]); } @@ -109,7 +109,7 @@ void ym3526_device::calculate_rates() if (m_stream != nullptr) m_stream->set_sample_rate(rate); else - m_stream = stream_alloc_legacy(0,1,rate); + m_stream = stream_alloc(0,1,rate); } //------------------------------------------------- diff --git a/src/devices/sound/3526intf.h b/src/devices/sound/3526intf.h index 5b425f41241..a45825b57b5 100644 --- a/src/devices/sound/3526intf.h +++ b/src/devices/sound/3526intf.h @@ -32,7 +32,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void irq_handler(int irq); diff --git a/src/devices/sound/3812intf.cpp b/src/devices/sound/3812intf.cpp index b9287f21d9e..c74c75e27b0 100644 --- a/src/devices/sound/3812intf.cpp +++ b/src/devices/sound/3812intf.cpp @@ -62,12 +62,12 @@ void ym3812_device::timer_handler(int c, const attotime &period) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ym3812_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym3812_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - ym3812_update_one(m_chip, outputs[0], samples); + ym3812_update_one(m_chip, outputs[0]); } //------------------------------------------------- @@ -110,7 +110,7 @@ void ym3812_device::calculate_rates() if (m_stream != nullptr) m_stream->set_sample_rate(rate); else - m_stream = stream_alloc_legacy(0, 1, rate); + m_stream = stream_alloc(0, 1, rate); } //------------------------------------------------- diff --git a/src/devices/sound/3812intf.h b/src/devices/sound/3812intf.h index 46266bbbca2..5b2b4f9991a 100644 --- a/src/devices/sound/3812intf.h +++ b/src/devices/sound/3812intf.h @@ -30,7 +30,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp index 63056582a0e..5eed79dd138 100644 --- a/src/devices/sound/8950intf.cpp +++ b/src/devices/sound/8950intf.cpp @@ -56,12 +56,12 @@ void y8950_device::timer_handler(int c, const attotime &period) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void y8950_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void y8950_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - y8950_update_one(m_chip, outputs[0], samples); + y8950_update_one(m_chip, outputs[0]); } @@ -87,7 +87,7 @@ void y8950_device::device_start() /* ADPCM ROM data */ y8950_set_delta_t_memory(m_chip, &y8950_device::static_read_byte, &y8950_device::static_write_byte); - m_stream = stream_alloc_legacy(0,1,rate); + m_stream = stream_alloc(0,1,rate); /* port and keyboard handler */ y8950_set_port_handler(m_chip, &y8950_device::static_port_handler_w, &y8950_device::static_port_handler_r, this); y8950_set_keyboard_handler(m_chip, &y8950_device::static_keyboard_handler_w, &y8950_device::static_keyboard_handler_r, this); diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h index d1ba497c08d..9ed70e7cd92 100644 --- a/src/devices/sound/8950intf.h +++ b/src/devices/sound/8950intf.h @@ -41,7 +41,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void irq_handler(int irq); diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp index 7bedf5d660a..21d5fa081d0 100644 --- a/src/devices/sound/aica.cpp +++ b/src/devices/sound/aica.cpp @@ -1233,7 +1233,6 @@ void aica_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, w { int i; - constexpr stream_buffer::sample_t sample_scale = 1.0 / stream_buffer::sample_t(32768 << SHIFT); for (int s = 0; s < bufl.samples(); ++s) { s32 smpl = 0, smpr = 0; @@ -1293,8 +1292,8 @@ void aica_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, w smpr = clip16(smpr >> 3); } - bufl.put(s, stream_buffer::sample_t(smpl * m_LPANTABLE[MVOL() << 0xd]) * sample_scale); - bufr.put(s, stream_buffer::sample_t(smpr * m_LPANTABLE[MVOL() << 0xd]) * sample_scale); + bufl.put_int(s, smpl * m_LPANTABLE[MVOL() << 0xd], 32768 << SHIFT); + bufr.put_int(s, smpr * m_LPANTABLE[MVOL() << 0xd], 32768 << SHIFT); } } diff --git a/src/devices/sound/asc.cpp b/src/devices/sound/asc.cpp index e03494040ab..23ec35a2766 100644 --- a/src/devices/sound/asc.cpp +++ b/src/devices/sound/asc.cpp @@ -148,7 +148,6 @@ void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stre case 1: // FIFO mode { - constexpr stream_buffer::sample_t sample_scale = 64.0 / 32768.0; for (i = 0; i < outL.samples(); i++) { int8_t smpll, smplr; @@ -234,15 +233,14 @@ void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stre break; } - outL.put(i, stream_buffer::sample_t(smpll) * sample_scale); - outR.put(i, stream_buffer::sample_t(smplr) * sample_scale); + outL.put_int(i, smpll, 32768 / 64); + outR.put_int(i, smplr, 32768 / 64); } break; } case 2: // wavetable mode { - constexpr stream_buffer::sample_t sample_scale = 1.0 / (32768.0 * 4.0); for (i = 0; i < outL.samples(); i++) { int32_t mixL, mixR; @@ -269,8 +267,8 @@ void asc_device::sound_stream_update(sound_stream &stream, std::vector<read_stre mixR += smpl*256; } - outL.put(i, stream_buffer::sample_t(mixL) * sample_scale); - outR.put(i, stream_buffer::sample_t(mixR) * sample_scale); + outL.put_int(i, mixL, 32768 * 4); + outR.put_int(i, mixR, 32768 * 4); } break; } diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp index 17df6999989..91d0fdc46b9 100644 --- a/src/devices/sound/astrocde.cpp +++ b/src/devices/sound/astrocde.cpp @@ -126,7 +126,7 @@ void astrocade_io_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) @@ -146,7 +146,7 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector< constexpr stream_buffer::sample_t sample_scale = 1.0f / 60.0f; for (int sampindex = 0; sampindex < dest.samples(); sampindex += samples_this_time) { - stream_sample_t cursample = 0; + s32 cursample = 0; /* compute the number of cycles until the next master oscillator reset */ /* or until the next noise boundary */ diff --git a/src/devices/sound/awacs.cpp b/src/devices/sound/awacs.cpp index 19f734cd468..72cf31d7589 100644 --- a/src/devices/sound/awacs.cpp +++ b/src/devices/sound/awacs.cpp @@ -93,13 +93,12 @@ void awacs_device::sound_stream_update(sound_stream &stream, std::vector<read_st auto &outL = outputs[0]; auto &outR = outputs[1]; - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; if (m_playback_enable) { for (int i = 0; i < outL.samples(); i++) { - outL.put(i, stream_buffer::sample_t(s16(m_dma_space->read_word(offset + m_play_ptr))) * sample_scale); - outR.put(i, stream_buffer::sample_t(s16(m_dma_space->read_word(offset + m_play_ptr + 2))) * sample_scale); + outL.put_int(i, s16(m_dma_space->read_word(offset + m_play_ptr)), 32768); + outR.put_int(i, s16(m_dma_space->read_word(offset + m_play_ptr + 2)), 32768); m_play_ptr += 4; } diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp index 26e99cf1bc7..8ba53fb8b3f 100644 --- a/src/devices/sound/ay8910.cpp +++ b/src/devices/sound/ay8910.cpp @@ -1108,12 +1108,13 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s for (int chan = 0; chan < NUM_CHANNELS; chan++) { tone = &m_tone[chan]; - tone->count++; - if (tone->count >= tone->period) + const int period = std::max<int>(1,tone->period); + tone->count += is_expanded_mode() ? 16 : 1; + while (tone->count >= period) { tone->duty_cycle = (tone->duty_cycle - 1) & 0x1f; - tone->output = (m_feature & PSG_HAS_EXPANDED_MODE) ? BIT(duty_cycle[tone_duty(tone)], tone->duty_cycle) : BIT(tone->duty_cycle, 0); - tone->count = 0; + tone->output = is_expanded_mode() ? BIT(duty_cycle[tone_duty(tone)], tone->duty_cycle) : BIT(tone->duty_cycle, 0); + tone->count -= period; } } @@ -1124,8 +1125,9 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s * channels. */ m_count_noise = 0; + m_prescale_noise ^= 1; - if (!m_prescale_noise) + if (!m_prescale_noise || is_expanded_mode()) // AY8930 noise generator rate is twice compares as compatibility mode { /* The Random Number Generator of the 8910 is a 17-bit shift */ /* register. The input to the shift register is bit0 XOR bit3 */ @@ -1134,9 +1136,7 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s // TODO : get actually algorithm for AY8930 m_rng ^= (((m_rng & 1) ^ ((m_rng >> 3) & 1)) << 17); m_rng >>= 1; - m_prescale_noise = (m_feature & PSG_HAS_EXPANDED_MODE) ? 16 : 1; } - m_prescale_noise--; } for (int chan = 0; chan < NUM_CHANNELS; chan++) @@ -1336,7 +1336,7 @@ void ay8910_device::device_start() /* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */ /* This handled by the step parameter. Consequently we use a multipler of 2 here. */ - m_channel = stream_alloc(0, m_streams, (m_feature & PSG_HAS_EXPANDED_MODE) ? master_clock * 2 : master_clock / 8); + m_channel = stream_alloc(0, m_streams, master_clock / 8); ay_set_clock(master_clock); ay8910_statesave(); @@ -1389,9 +1389,9 @@ void ay8910_device::ay_set_clock(int clock) { // FIXME: this doesn't belong here, it should be an input pin exposed via devcb if (((m_feature & PSG_PIN26_IS_CLKSEL) && (m_flags & YM2149_PIN26_LOW)) || (m_feature & PSG_HAS_INTERNAL_DIVIDER)) - m_channel->set_sample_rate((m_feature & PSG_HAS_EXPANDED_MODE) ? clock : clock / 16); + m_channel->set_sample_rate(clock / 16); else - m_channel->set_sample_rate((m_feature & PSG_HAS_EXPANDED_MODE) ? clock * 2 : clock / 8); + m_channel->set_sample_rate(clock / 8); } void ay8910_device::device_clock_changed() @@ -1659,8 +1659,6 @@ void ay8910_device::set_type(psg_type_t psg_type) m_par = &ym2149_param; m_par_env = &ym2149_param_env; } - if (m_feature & PSG_HAS_EXPANDED_MODE) - m_step *= 16; } DEFINE_DEVICE_TYPE(AY8912, ay8912_device, "ay8912", "AY-3-8912A PSG") diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h index 373a850b662..407de93f8a3 100644 --- a/src/devices/sound/ay8910.h +++ b/src/devices/sound/ay8910.h @@ -268,7 +268,7 @@ private: inline u8 get_envelope_chan(int chan) { return is_expanded_mode() ? chan : 0; } inline bool noise_enable(int chan) { return BIT(m_regs[AY_ENABLE], 3 + chan); } - inline u8 noise_period() { return is_expanded_mode() ? m_regs[AY_NOISEPER] & 0xff : (m_regs[AY_NOISEPER] & 0x1f) << 1; } + inline u8 noise_period() { return is_expanded_mode() ? m_regs[AY_NOISEPER] & 0xff : m_regs[AY_NOISEPER] & 0x1f; } inline u8 noise_output() { return m_rng & 1; } inline bool is_expanded_mode() { return ((m_feature & PSG_HAS_EXPANDED_MODE) && ((m_mode & 0xe) == 0xa)); } diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp index 0edb1920a8c..5d0b0811854 100644 --- a/src/devices/sound/c140.cpp +++ b/src/devices/sound/c140.cpp @@ -77,12 +77,6 @@ DEFINE_DEVICE_TYPE(C219, c219_device, "c219", "Namco C219") // LIVE DEVICE //************************************************************************** -static inline stream_buffer::sample_t limit(stream_buffer::sample_t in) -{ - return std::max(-1.0f, std::min(1.0f, in)); -} - - //------------------------------------------------- // c140_device - constructor //------------------------------------------------- @@ -326,15 +320,10 @@ void c140_device::sound_stream_update(sound_stream &stream, std::vector<read_str { auto &dest1 = outputs[0]; auto &dest2 = outputs[1]; - constexpr stream_buffer::sample_t sample_scale = 8.0 / 32768.0; for (int i = 0; i < samples; i++) { - stream_buffer::sample_t val; - - val = stream_buffer::sample_t(*lmix++) * sample_scale; - dest1.put(i, limit(val)); - val = stream_buffer::sample_t(*rmix++) * sample_scale; - dest2.put(i, limit(val)); + dest1.put_int_clamp(i, *lmix++, 32768 / 8); + dest2.put_int_clamp(i, *rmix++, 32768 / 8); } } } @@ -465,15 +454,10 @@ void c219_device::sound_stream_update(sound_stream &stream, std::vector<read_str { auto &dest1 = outputs[0]; auto &dest2 = outputs[1]; - constexpr stream_buffer::sample_t sample_scale = 8.0 / 32768.0; for (int i = 0; i < samples; i++) { - stream_buffer::sample_t val; - - val = stream_buffer::sample_t(*lmix++) * sample_scale; - dest1.put(i, limit(val)); - val = stream_buffer::sample_t(*rmix++) * sample_scale; - dest2.put(i, limit(val)); + dest1.put_int_clamp(i, *lmix++, 32768 / 8); + dest2.put_int_clamp(i, *rmix++, 32768 / 8); } } } diff --git a/src/devices/sound/c352.cpp b/src/devices/sound/c352.cpp index 826f194437a..bea5a561b59 100644 --- a/src/devices/sound/c352.cpp +++ b/src/devices/sound/c352.cpp @@ -129,7 +129,6 @@ void c352_device::sound_stream_update(sound_stream &stream, std::vector<read_str auto &buffer_rl = outputs[2]; auto &buffer_rr = outputs[3]; - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int i = 0; i < buffer_fl.samples(); i++) { int out[4] = { 0, 0, 0, 0 }; @@ -174,10 +173,10 @@ void c352_device::sound_stream_update(sound_stream &stream, std::vector<read_str out[3] += (((v.flags & C352_FLG_PHASEFR) ? -s : s) * v.curr_vol[3]) >> 8; } - buffer_fl.put(i, stream_buffer::sample_t(s16(out[0] >> 3)) * sample_scale); - buffer_fr.put(i, stream_buffer::sample_t(s16(out[1] >> 3)) * sample_scale); - buffer_rl.put(i, stream_buffer::sample_t(s16(out[2] >> 3)) * sample_scale); - buffer_rr.put(i, stream_buffer::sample_t(s16(out[3] >> 3)) * sample_scale); + buffer_fl.put_int(i, s16(out[0] >> 3), 32768); + buffer_fr.put_int(i, s16(out[1] >> 3), 32768); + buffer_rl.put_int(i, s16(out[2] >> 3), 32768); + buffer_rr.put_int(i, s16(out[3] >> 3), 32768); } } diff --git a/src/devices/sound/c6280.cpp b/src/devices/sound/c6280.cpp index d01dd74125a..1b6666455c9 100644 --- a/src/devices/sound/c6280.cpp +++ b/src/devices/sound/c6280.cpp @@ -51,7 +51,6 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st outputs[0].fill(0); outputs[1].fill(0); - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int ch = 0; ch < 6; ch++) { channel *chan = &m_channel[ch]; @@ -88,8 +87,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st // based on Charles MacDonald's research chan->noise_seed = (seed >> 1) | ((BIT(seed, 0) ^ BIT(seed, 1) ^ BIT(seed, 11) ^ BIT(seed, 12) ^ BIT(seed, 17)) << 17); } - outputs[0].add(i, stream_buffer::sample_t(s16(vll * (data - 16))) * sample_scale); - outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (data - 16))) * sample_scale); + outputs[0].add_int(i, s16(vll * (data - 16)), 32768); + outputs[1].add_int(i, s16(vlr * (data - 16)), 32768); } } else @@ -98,8 +97,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st /* DDA mode */ for (int i = 0; i < outputs[0].samples(); i++) { - outputs[0].add(i, stream_buffer::sample_t(s16(vll * (chan->dda - 16))) * sample_scale); - outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (chan->dda - 16))) * sample_scale); + outputs[0].add_int(i, s16(vll * (chan->dda - 16)), 32768); + outputs[1].add_int(i, s16(vlr * (chan->dda - 16)), 32768); } } else @@ -138,8 +137,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st lfo_dstchan->tick = step; lfo_dstchan->index = (lfo_dstchan->index + 1) & 0x1f; } - outputs[0].add(i, stream_buffer::sample_t(s16(vll * (data - 16))) * sample_scale); - outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (data - 16))) * sample_scale); + outputs[0].add_int(i, s16(vll * (data - 16)), 32768); + outputs[1].add_int(i, s16(vlr * (data - 16)), 32768); } } } @@ -156,8 +155,8 @@ void c6280_device::sound_stream_update(sound_stream &stream, std::vector<read_st chan->tick = step; chan->index = (chan->index + 1) & 0x1f; } - outputs[0].add(i, stream_buffer::sample_t(s16(vll * (data - 16))) * sample_scale); - outputs[1].add(i, stream_buffer::sample_t(s16(vlr * (data - 16))) * sample_scale); + outputs[0].add_int(i, s16(vll * (data - 16)), 32768); + outputs[1].add_int(i, s16(vlr * (data - 16)), 32768); } } } diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp index ca2bd280de8..e208847510e 100644 --- a/src/devices/sound/cdda.cpp +++ b/src/devices/sound/cdda.cpp @@ -164,7 +164,6 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf int i; int16_t *audio_cache = (int16_t *) m_audio_cache.get(); - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int sampindex = 0; sampindex < bufL.samples(); ) { /* if no file, audio not playing, audio paused, or out of disc data, @@ -191,8 +190,8 @@ void cdda_device::get_audio_data(write_stream_view &bufL, write_stream_view &buf for (i = 0; i < samples; i++) { /* CD-DA data on the disc is big-endian */ - bufL.put(sampindex + i, stream_buffer::sample_t(s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ))) * sample_scale); m_audio_bptr++; - bufR.put(sampindex + i, stream_buffer::sample_t(s16(big_endianize_int16( audio_cache[ m_audio_bptr ] ))) * sample_scale); m_audio_bptr++; + bufL.put_int(sampindex + i, s16(big_endianize_int16( audio_cache[ m_audio_bptr ] )), 32768); m_audio_bptr++; + bufR.put_int(sampindex + i, s16(big_endianize_int16( audio_cache[ m_audio_bptr ] )), 32768); m_audio_bptr++; } sampindex += samples; diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp index e8168004811..f4a46748593 100644 --- a/src/devices/sound/cdp1864.cpp +++ b/src/devices/sound/cdp1864.cpp @@ -375,7 +375,7 @@ void cdp1864_device::dma_w(uint8_t data) color = (gdata << 2) | (bdata << 1) | rdata; } - m_bitmap.pix32(y, sx + x) = m_palette[color]; + m_bitmap.pix(y, sx + x) = m_palette[color]; data <<= 1; } diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp index 98580d7ae54..9e28aa4c048 100644 --- a/src/devices/sound/cdp1869.cpp +++ b/src/devices/sound/cdp1869.cpp @@ -574,29 +574,28 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, std::vector<read_ void cdp1869_device::draw_line(bitmap_rgb32 &bitmap, const rectangle &rect, int x, int y, uint8_t data, int color) { - int i; - pen_t fg = m_palette->pen(color); + pen_t const fg = m_palette->pen(color); data <<= 2; - for (i = 0; i < CH_WIDTH; i++) + for (int i = 0; i < CH_WIDTH; i++) { if (data & 0x80) { - bitmap.pix32(y, x) = fg; + bitmap.pix(y, x) = fg; if (!m_fresvert) { - bitmap.pix32(y + 1, x) = fg; + bitmap.pix(y + 1, x) = fg; } if (!m_freshorz) { - bitmap.pix32(y, x + 1) = fg; + bitmap.pix(y, x + 1) = fg; if (!m_fresvert) { - bitmap.pix32(y + 1, x + 1) = fg; + bitmap.pix(y + 1, x + 1) = fg; } } } diff --git a/src/devices/sound/cem3394.cpp b/src/devices/sound/cem3394.cpp index 5b288d2d700..e0c74635648 100644 --- a/src/devices/sound/cem3394.cpp +++ b/src/devices/sound/cem3394.cpp @@ -4,12 +4,7 @@ Curtis Electromusic Specialties CEM3394 µP-Controllable Synthesizer Voice - This driver handles CEM-3394 analog synth chip. Very crudely. - - Still to do: - - adjust the overall volume when multiple waves are being generated - - filter internal sound - - support resonance (don't understand how it works) + This driver handles CEM-3394 analog synth chip. ***************************************************************************/ @@ -19,6 +14,18 @@ #include <algorithm> +// various filter implementations to play with; currently SVTRAP works best +#define FILTER_TYPE_NONE (0) +#define FILTER_TYPE_SVTRAP (1) +#define FILTER_TYPE_ESQ1 (2) + +#define FILTER_TYPE FILTER_TYPE_SVTRAP + + +// logging +#define LOG_CONTROL_CHANGES (0) + + // use 0.25 as the base volume for pulses static constexpr double PULSE_VOLUME = 0.25; @@ -143,37 +150,96 @@ cem3394_device::cem3394_device(const machine_config &mconfig, const char *tag, d m_pulse_width(0), m_inv_sample_rate(1.0/48000.0) { + (void)m_filter_in; } //------------------------------------------------- -// sound_stream_update - generate sound to the mix -// buffer in mono +// filter - apply the lowpass filter at the given +// cutoff frequency //------------------------------------------------- +#if (FILTER_TYPE == FILTER_TYPE_NONE) + +double cem3394_device::filter(double input, double cutoff) +{ + return input; +} + +#elif (FILTER_TYPE == FILTER_TYPE_SVTRAP) + +double cem3394_device::filter(double input, double cutoff) +{ + // clamp cutoff to useful range, 50Hz-20kHz + cutoff = std::min(std::max(cutoff, 50.0), 20000.0); + + // clamp resonance to below 1.0 to prevent runaway behavior; when clamping, + // also apply an (arbitrary) scale factor to the output since we're close + // to resonance and the datasheet indicates there is an amplitude correction + // in this case + double outscale = 1.0; + double res = m_filter_resonance; + if (res > 0.99) + res = 0.99, outscale = 0.5; + + // core filter implementation + double g = tan(M_PI * cutoff * m_inv_sample_rate); + double k = 2.0 - 2.0 * res; + double a1 = 1.0 / (1.0 + g * (g + k)); + double a2 = g * a1; + double a3 = g * a2; + double v3 = input - m_filter_out[1]; + double v1 = a1 * m_filter_out[0] + a2 * v3; + double v2 = m_filter_out[1] + a2 * m_filter_out[0] + a3 * v3; + m_filter_out[0] = 2 * v1 - m_filter_out[0]; + m_filter_out[1] = 2 * v2 - m_filter_out[1]; + + // lowpass output is equal to v2 + double output = v2 * outscale; + + // catch any NaNs + if (std::isnan(output)) + { + logerror("NAN - vco: %6.0f cutoff: %6.0f res: %.5f output: %.5f\n", m_vco_step / m_inv_sample_rate, cutoff, m_filter_resonance, output); + output = 0; + m_filter_out[0] = m_filter_out[1] = 0; + } + + // if we go out of range, scale down to 1.0 and also scale our + // feedback terms to help us stay in control + else if (fabs(output) > 1.0) + { + double scale = 1.0 / fabs(output); + output *= scale; + m_filter_out[0] *= scale; + m_filter_out[1] *= scale; + } + return output; +} + +#elif (FILTER_TYPE == FILTER_TYPE_ESQ1) + double cem3394_device::filter(double input, double cutoff) { - // clamp cutoff to useful range, 20Hz-20kHz - cutoff = std::max(std::min(cutoff, 20000.0), 20.0); + // clamp cutoff to useful range, 50Hz-20kHz + cutoff = std::min(std::max(cutoff, 50.0), 20000.0); // clamp resonance to 0.95 to prevent infinite gain - double r = 4.0 * std::min(m_filter_resonance, 0.95); + double r = 4.0 * std::min(res, 0.95); + // core filter implementation double g = 2 * M_PI * cutoff; double zc = g / tan(g/2 * m_inv_sample_rate); - double gzc = zc / g; double gzc2 = gzc * gzc; double gzc3 = gzc2 * gzc; double gzc4 = gzc3 * gzc; double r1 = 1 + r; - double a0 = r1; double a1 = 4 * r1; double a2 = 6 * r1; double a3 = 4 * r1; double a4 = r1; - double b0 = r1 + 4 * gzc + 6 * gzc2 + 4 * gzc3 + gzc4; double b1 = 4 * (r1 + 2 * gzc - 2 * gzc3 - gzc4); double b2 = 6 * (r1 - 2 * gzc2 + gzc4); @@ -184,15 +250,18 @@ double cem3394_device::filter(double input, double cutoff) + m_filter_in[0] * a1 + m_filter_in[1] * a2 + m_filter_in[2] * a3 + m_filter_in[3] * a4 - m_filter_out[0] * b1 - m_filter_out[1] * b2 - m_filter_out[2] * b3 - m_filter_out[3] * b4) / b0; -// sound_assert(!std::isnan(output)); -// sound_assert(output >= -1.5 && output <= 1.5); - if (output < -1.5 || output > 1.5 || std::isnan(output)) + // catch NaNs + if (std::isnan(output)) { - if (m_filter_out[0] > -1.5 && m_filter_out[0] < 1.5) - printf("cutoff: %6.0f res: %.5f output: %.5f\n", cutoff, m_filter_resonance, output); + logerror("NAN - vco: %6.0f cutoff: %6.0f res: %.5f output: %.5f\n", m_vco_step / m_inv_sample_rate, cutoff, m_filter_resonance, output); + output = 0; } - if (std::isnan(output)) output = 0; + // if output goes significantly out of range, scale it down + else if (fabs(output) > 10.0) + output = 10.0; + + // update memories m_filter_in[3] = m_filter_in[2]; m_filter_in[2] = m_filter_in[1]; m_filter_in[1] = m_filter_in[0]; @@ -203,6 +272,7 @@ double cem3394_device::filter(double input, double cutoff) m_filter_out[1] = m_filter_out[0]; m_filter_out[0] = output; + // clamp to range and return if (output < -1.0) output = -1.0; else if (output > 1.0) @@ -210,6 +280,18 @@ double cem3394_device::filter(double input, double cutoff) return output; } +#else + +#error Unknown FILTER_TYPE + +#endif + + +//------------------------------------------------- +// sound_stream_update - generate sound to the mix +// buffer in mono +//------------------------------------------------- + void cem3394_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { auto &external = inputs[0]; @@ -370,6 +452,7 @@ void cem3394_device::set_voltage(int input, double voltage) case VCO_FREQUENCY: temp = m_vco_zero_freq * pow(2.0, -voltage * (1.0 / 0.75)); m_vco_step = temp * m_inv_sample_rate; + if (LOG_CONTROL_CHANGES) logerror("VCO_FREQ=%6.3fV -> freq=%f\n", voltage, temp); break; // wave select determines triangle/sawtooth enable @@ -381,6 +464,7 @@ void cem3394_device::set_voltage(int input, double voltage) m_wave_select |= WAVE_TRIANGLE | WAVE_SAWTOOTH; else if (voltage >= 2.3 && voltage <= 3.9) m_wave_select |= WAVE_SAWTOOTH; + if (LOG_CONTROL_CHANGES) logerror("WAVE_SEL=%6.3fV -> tri=%d saw=%d\n", voltage, (m_wave_select & WAVE_TRIANGLE) ? 1 : 0, (m_wave_select & WAVE_SAWTOOTH) ? 1 : 0); break; // pulse width determines duty cycle; 0.0 means 0%, 2.0 means 100% @@ -397,11 +481,13 @@ void cem3394_device::set_voltage(int input, double voltage) m_pulse_width = MINIMUM_WIDTH + (MAXIMUM_WIDTH - MINIMUM_WIDTH) * m_pulse_width; m_wave_select |= WAVE_PULSE; } + if (LOG_CONTROL_CHANGES) logerror("PULSE_WI=%6.3fV -> raw=%f adj=%f\n", voltage, voltage * 0.5, m_pulse_width); break; // final gain is pretty self-explanatory; 0.0 means ~90dB, 4.0 means 0dB case FINAL_GAIN: m_volume = compute_db_volume(voltage); + if (LOG_CONTROL_CHANGES) logerror("TOT_GAIN=%6.3fV -> vol=%f\n", voltage, m_volume); break; // mixer balance is a pan between the external input and the internal input @@ -417,11 +503,13 @@ void cem3394_device::set_voltage(int input, double voltage) m_mixer_internal = compute_db_volume(3.55 - 0.45 * (voltage * 0.25)); m_mixer_external = compute_db_volume(3.55 + voltage); } + if (LOG_CONTROL_CHANGES) logerror(" BALANCE=%6.3fV -> int=%f ext=%f\n", voltage, m_mixer_internal, m_mixer_external); break; // filter frequency varies from -3.0 to +4.0, at 0.375V/octave case FILTER_FREQENCY: m_filter_frequency = m_filter_zero_freq * pow(2.0, -voltage * (1.0 / 0.375)); + if (LOG_CONTROL_CHANGES) logerror("FLT_FREQ=%6.3fV -> freq=%f\n", voltage, m_filter_frequency); break; // modulation depth is 0.01*freq at 0V and 2.0*freq at 3.5V @@ -432,6 +520,7 @@ void cem3394_device::set_voltage(int input, double voltage) m_filter_modulation = 1.99; else m_filter_modulation = (voltage * (1.0 / 3.5)) * 1.98 + 0.01; + if (LOG_CONTROL_CHANGES) logerror("FLT_MODU=%6.3fV -> mod=%f\n", voltage, m_filter_modulation); break; // this is not yet implemented @@ -442,6 +531,7 @@ void cem3394_device::set_voltage(int input, double voltage) m_filter_resonance = 1.0; else m_filter_resonance = voltage * (1.0 / 2.5); + if (LOG_CONTROL_CHANGES) logerror("FLT_RESO=%6.3fV -> mod=%f\n", voltage, m_filter_resonance); break; } } diff --git a/src/devices/sound/dac76.cpp b/src/devices/sound/dac76.cpp index bbeb5728577..1c73d7b02c1 100644 --- a/src/devices/sound/dac76.cpp +++ b/src/devices/sound/dac76.cpp @@ -79,7 +79,7 @@ void dac76_device::sound_stream_update(sound_stream &stream, std::vector<read_st { // get current output level int step_size = (2 << m_chord); - stream_sample_t vout = m_level[m_chord] + m_step * step_size; + s32 vout = m_level[m_chord] + m_step * step_size; // apply sign bit vout *= (m_sb ? +1 : -1); diff --git a/src/devices/sound/dave.cpp b/src/devices/sound/dave.cpp index f26ea891879..b7f1487c025 100644 --- a/src/devices/sound/dave.cpp +++ b/src/devices/sound/dave.cpp @@ -205,7 +205,6 @@ void dave_device::sound_stream_update(sound_stream &stream, std::vector<read_str auto &buffer1 = outputs[0]; auto &buffer2 = outputs[1]; - constexpr stream_buffer::sample_t sample_scale = 1.0 / (4.0 * 32768.0); for (int sampindex = 0; sampindex < buffer1.samples(); sampindex++) { int vol[4]; @@ -264,8 +263,8 @@ void dave_device::sound_stream_update(sound_stream &stream, std::vector<read_str left_volume = output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6]; right_volume = output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7]; - buffer1.put(sampindex, stream_buffer::sample_t(left_volume) * sample_scale); - buffer2.put(sampindex, stream_buffer::sample_t(right_volume) * sample_scale); + buffer1.put_int(sampindex, left_volume, 32768 * 4); + buffer2.put_int(sampindex, right_volume, 32768 * 4); } } diff --git a/src/devices/sound/digitalk.cpp b/src/devices/sound/digitalk.cpp index 9ca0e6fa5f0..2bff98478e5 100644 --- a/src/devices/sound/digitalk.cpp +++ b/src/devices/sound/digitalk.cpp @@ -548,7 +548,6 @@ void digitalker_device::sound_stream_update(sound_stream &stream, std::vector<re { auto &sout = outputs[0]; int cpos = 0; - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; while(cpos != sout.samples()) { if(m_zero_count == 0 && m_dac_index == 128) digitalker_step(); @@ -563,10 +562,10 @@ void digitalker_device::sound_stream_update(sound_stream &stream, std::vector<re } else if(m_dac_index != 128) { while(cpos != sout.samples() && m_dac_index != 128) { - stream_buffer::sample_t v = stream_buffer::sample_t(m_dac[m_dac_index]) * sample_scale; + s32 v = m_dac[m_dac_index]; int pp = m_pitch_pos; while(cpos != sout.samples() && pp != m_pitch) { - sout.put(cpos++, v); + sout.put_int(cpos++, v, 32768); pp++; } if(pp == m_pitch) { diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp index 7d6a84a4fc7..47e517af633 100644 --- a/src/devices/sound/discrete.cpp +++ b/src/devices/sound/discrete.cpp @@ -44,9 +44,6 @@ #include <iostream> -/* for_each collides with c++ standard libraries - include it here */ -#define for_each(_T, _e, _l) for (_T _e = (_l)->begin_ptr() ; _e <= (_l)->end_ptr(); _e++) - // device type definition DEFINE_DEVICE_TYPE(DISCRETE, discrete_sound_device, "discrete", "Discrete Sound") @@ -93,7 +90,7 @@ DEFINE_DEVICE_TYPE(DISCRETE, discrete_sound_device, "discrete", "Discrete Sound" struct output_buffer { - double *node_buf; + std::unique_ptr<double []> node_buf; const double *source; volatile double *ptr; int node_num; @@ -110,47 +107,44 @@ class discrete_task { friend class discrete_device; public: - virtual ~discrete_task(void) { } + virtual ~discrete_task() { } - inline void step_nodes(void); + inline void step_nodes(); inline bool lock_threadid(int32_t threadid) { int expected = -1; return m_threadid.compare_exchange_weak(expected, threadid, std::memory_order_release,std::memory_order_relaxed); } - inline void unlock(void) { m_threadid = -1; } + inline void unlock() { m_threadid = -1; } //const linked_list_entry *list; - node_step_list_t step_list; + discrete_device::node_step_list_t step_list; /* list of source nodes */ - vector_t<input_buffer> source_list; /* discrete_source_node */ + std::vector<input_buffer> source_list; /* discrete_source_node */ - int task_group; + int task_group = 0; - discrete_task(discrete_device &pdev) - : task_group(0), m_device(pdev), m_threadid(-1), m_samples(0) -{ - source_list.clear(); - step_list.clear(); - m_buffers.clear(); + discrete_task(discrete_device &pdev) : m_device(pdev), m_threadid(-1) + { + // FIXME: the code expects to be able to take pointers to members of elements of this vector before it's filled + source_list.reserve(16); } protected: static void *task_callback(void *param, int threadid); - inline bool process(void); + inline bool process(); - void check(discrete_task *dest_task); + void check(discrete_task &dest_task); void prepare_for_queue(int samples); - vector_t<output_buffer> m_buffers; + std::vector<output_buffer> m_buffers; discrete_device & m_device; private: std::atomic<int32_t> m_threadid; - volatile int m_samples; - + volatile int m_samples = 0; }; @@ -181,29 +175,27 @@ private: * *************************************/ -inline void discrete_task::step_nodes(void) +inline void discrete_task::step_nodes() { - for_each(input_buffer *, sn, &source_list) + for (input_buffer &sn : source_list) { - sn->buffer = *sn->ptr++; + sn.buffer = *sn.ptr++; } if (EXPECTED(!m_device.profiling())) { - for_each(discrete_step_interface **, entry, &step_list) + for (discrete_step_interface *entry : step_list) { /* Now step the node */ - (*entry)->step(); + entry->step(); } } else { osd_ticks_t last = get_profile_ticks(); - for_each(discrete_step_interface **, entry, &step_list) + for (discrete_step_interface *node : step_list) { - discrete_step_interface *node = *entry; - node->run_time -= last; node->step(); last = get_profile_ticks(); @@ -212,23 +204,23 @@ inline void discrete_task::step_nodes(void) } /* buffer the outputs */ - for_each(output_buffer *, outbuf, &m_buffers) - *(outbuf->ptr++) = *outbuf->source; + for (output_buffer &outbuf : m_buffers) + *outbuf.ptr++ = *outbuf.source; } void *discrete_task::task_callback(void *param, int threadid) { - task_list_t *list = (task_list_t *) param; + const auto &list = *reinterpret_cast<const discrete_sound_device::task_list_t *>(param); do { - for_each(discrete_task **, task, list) + for (const auto &task : list) { /* try to lock */ - if ((*task)->lock_threadid(threadid)) + if (task->lock_threadid(threadid)) { - if (!(*task)->process()) + if (!task->process()) return nullptr; - (*task)->unlock(); + task->unlock(); } } } while (1); @@ -236,16 +228,14 @@ void *discrete_task::task_callback(void *param, int threadid) return nullptr; } -bool discrete_task::process(void) +bool discrete_task::process() { int samples = std::min(int(m_samples), MAX_SAMPLES_PER_TASK_SLICE); /* check dependencies */ - for_each(input_buffer *, sn, &source_list) + for (input_buffer &sn : source_list) { - int avail; - - avail = sn->linked_outbuf->ptr - sn->ptr; + int avail = sn.linked_outbuf->ptr - sn.ptr; if (avail < 0) throw emu_fatalerror("discrete_task::process: available samples are negative"); if (avail < samples) @@ -273,33 +263,35 @@ void discrete_task::prepare_for_queue(int samples) { m_samples = samples; /* set up task buffers */ - for_each(output_buffer *, ob, &m_buffers) - ob->ptr = ob->node_buf; + for (output_buffer &ob : m_buffers) + ob.ptr = ob.node_buf.get(); /* initialize sources */ - for_each(input_buffer *, sn, &source_list) + for (input_buffer &sn : source_list) { - sn->ptr = sn->linked_outbuf->node_buf; + sn.ptr = sn.linked_outbuf->node_buf.get(); } } -void discrete_task::check(discrete_task *dest_task) +void discrete_task::check(discrete_task &dest_task) { - int inputnum; + // FIXME: this function takes addresses of elements of a vector that has items added later + // 16 is enough for the systems in MAME, but the code should be fixed properly + m_buffers.reserve(16); /* Determine, which nodes in the task are referenced by nodes in dest_task * and add them to the list of nodes to be buffered for further processing */ - for_each(discrete_step_interface **, node_entry, &step_list) + for (discrete_step_interface *node_entry : step_list) { - discrete_base_node *task_node = (*node_entry)->self; + discrete_base_node *task_node = node_entry->self; - for_each(discrete_step_interface **, step_entry, &dest_task->step_list) + for (discrete_step_interface *step_entry : dest_task.step_list) { - discrete_base_node *dest_node = (*step_entry)->self; + discrete_base_node *dest_node = step_entry->self; /* loop over all active inputs */ - for (inputnum = 0; inputnum < dest_node->active_inputs(); inputnum++) + for (int inputnum = 0; inputnum < dest_node->active_inputs(); inputnum++) { int inputnode_num = dest_node->input_node(inputnum); if IS_VALUE_A_NODE(inputnode_num) @@ -307,11 +299,10 @@ void discrete_task::check(discrete_task *dest_task) /* Fixme: sub nodes ! */ if (NODE_DEFAULT_NODE(task_node->block_node()) == NODE_DEFAULT_NODE(inputnode_num)) { - input_buffer source; - int i, found = -1; + int found = -1; output_buffer *pbuf = nullptr; - for (i = 0; i < m_buffers.count(); i++) + for (int i = 0; i < m_buffers.size(); i++) // if (m_buffers[i].node->block_node() == inputnode_num) if (m_buffers[i].node_num == inputnode_num) { @@ -324,28 +315,20 @@ void discrete_task::check(discrete_task *dest_task) { output_buffer buf; - buf.node_buf = auto_alloc_array(m_device.machine(), double, - ((task_node->sample_rate() + sound_manager::STREAMS_UPDATE_FREQUENCY) / sound_manager::STREAMS_UPDATE_FREQUENCY)); - buf.ptr = buf.node_buf; + buf.node_buf = std::make_unique<double []>((task_node->sample_rate() + sound_manager::STREAMS_UPDATE_FREQUENCY) / sound_manager::STREAMS_UPDATE_FREQUENCY); + buf.ptr = buf.node_buf.get(); buf.source = dest_node->m_input[inputnum]; buf.node_num = inputnode_num; //buf.node = device->discrete_find_node(inputnode); - m_buffers.count(); - pbuf = m_buffers.add(buf); + m_buffers.push_back(std::move(buf)); + pbuf = &m_buffers.back(); } - m_device.discrete_log("dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode_num), NODE_CHILD_NODE_NUM(inputnode_num), this, task_group, dest_node->index(), dest_task->task_group); + m_device.discrete_log("dso_task_start - buffering %d(%d) in task %p group %d referenced by %d group %d", NODE_INDEX(inputnode_num), NODE_CHILD_NODE_NUM(inputnode_num), this, task_group, dest_node->index(), dest_task.task_group); /* register into source list */ - //source = auto_alloc(device->machine(), discrete_source_node); - //source.task = this; - //source.output_node = i; - source.linked_outbuf = pbuf; - source.buffer = 0.0; /* please compiler */ - source.ptr = nullptr; - dest_task->source_list.add(source); - - /* point the input to a buffered location */ - dest_node->m_input[inputnum] = &dest_task->source_list[dest_task->source_list.count()-1].buffer; // was copied! &source.buffer; + dest_task.source_list.push_back(input_buffer{ nullptr, pbuf, 0.0 }); + // FIXME: taking address of element of vector before it's filled + dest_node->m_input[inputnum] = &dest_task.source_list.back().buffer; } } @@ -374,7 +357,7 @@ discrete_base_node::discrete_base_node() : } -discrete_base_node::~discrete_base_node(void) +discrete_base_node::~discrete_base_node() { /* currently noting */ } @@ -398,7 +381,7 @@ void discrete_base_node::init(discrete_device *pdev, const discrete_block *xbloc } } -void discrete_base_node::save_state(void) +void discrete_base_node::save_state() { if (m_block->node != NODE_SPECIAL) m_device->save_item(NAME(m_output), m_block->node); @@ -410,7 +393,7 @@ discrete_base_node *discrete_device::discrete_find_node(int node) return m_indexed_node[NODE_INDEX(node)]; } -void discrete_base_node::resolve_input_nodes(void) +void discrete_base_node::resolve_input_nodes() { int inputnum; @@ -520,7 +503,7 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc if (intf[node_count].type == DSS_NULL) fatalerror("discrete_build_list: DISCRETE_REPLACE at end of node_list\n"); - for (int i=0; i < block_list.count(); i++) + for (int i=0; i < block_list.size(); i++) { const discrete_block *block = block_list[i]; @@ -540,9 +523,9 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc } else if (intf[node_count].type == DSO_DELETE) { - vector_t<int> deletethem; + std::vector<int> deletethem; - for (int i=0; i<block_list.count(); i++) + for (int i=0; i<block_list.size(); i++) { const discrete_block *block = block_list[i]; @@ -550,16 +533,16 @@ void discrete_device::discrete_build_list(const discrete_block *intf, sound_bloc (block->node <= intf[node_count].input_node[1])) { discrete_log("discrete_build_list() - DISCRETE_DELETE deleted NODE_%02d", NODE_INDEX(block->node) ); - deletethem.add(i); + deletethem.push_back(i); } } - for_each (int *, i, &deletethem) - block_list.remove(*i); + for (int i : deletethem) + block_list.erase(block_list.begin() + i); // FIXME: how is this supposed to work if there's more than one item to remove? indices are shifted back on each removal } else { discrete_log("discrete_build_list() - adding node %d\n", node_count); - block_list.add(&intf[node_count]); + block_list.push_back(&intf[node_count]); } node_count++; @@ -575,7 +558,7 @@ void discrete_device::discrete_sanity_check(const sound_block_list_t &block_list int node_count = 0; discrete_log("discrete_start() - Doing node list sanity check"); - for (int i=0; i < block_list.count(); i++) + for (int i=0; i < block_list.size(); i++) { const discrete_block *block = block_list[i]; @@ -618,61 +601,60 @@ void discrete_device::discrete_sanity_check(const sound_block_list_t &block_list * *************************************/ -static uint64_t list_run_time(const node_list_t &list) +static uint64_t list_run_time(const discrete_device::node_list_t &list) { uint64_t total = 0; - for_each(discrete_base_node **, node, &list) + for (const auto &node : list) { discrete_step_interface *step; - if ((*node)->interface(step)) + if (node->interface(step)) total += step->run_time; } return total; } -static uint64_t step_list_run_time(const node_step_list_t &list) +static uint64_t step_list_run_time(const discrete_device::node_step_list_t &list) { uint64_t total = 0; - for_each(discrete_step_interface **, node, &list) + for (discrete_step_interface *node : list) { - total += (*node)->run_time; + total += node->run_time; } return total; } -void discrete_device::display_profiling(void) +void discrete_device::display_profiling() { int count; uint64_t total; uint64_t tresh; - double tt; /* calculate total time */ total = list_run_time(m_node_list); - count = m_node_list.count(); + count = m_node_list.size(); /* print statistics */ - util::stream_format(std::cout, "Total Samples : %16d\n", m_total_samples); + osd_printf_info("Total Samples : %16d\n", m_total_samples); tresh = total / count; - util::stream_format(std::cout, "Threshold (mean): %16d\n", tresh / m_total_samples ); - for_each(discrete_base_node **, node, &m_node_list) + osd_printf_info("Threshold (mean): %16d\n", tresh / m_total_samples); + for (const auto &node : m_node_list) { discrete_step_interface *step; - if ((*node)->interface(step)) + if (node->interface(step)) if (step->run_time > tresh) - util::stream_format(std::cout, "%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), double(step->run_time) / double(total) * 100.0, double(step->run_time) / double(m_total_samples)); + osd_printf_info("%3d: %20s %8.2f %10.2f\n", node->index(), node->module_name(), double(step->run_time) / double(total) * 100.0, double(step->run_time) / double(m_total_samples)); } /* Task information */ - for_each(discrete_task **, task, &task_list) + for (const auto &task : task_list) { - tt = step_list_run_time((*task)->step_list); + double tt = step_list_run_time(task->step_list); - util::stream_format(std::cout, "Task(%d): %8.2f %15.2f\n", (*task)->task_group, tt / double(total) * 100.0, tt / double(m_total_samples)); + osd_printf_info("Task(%d): %8.2f %15.2f\n", task->task_group, tt / double(total) * 100.0, tt / double(m_total_samples)); } - util::stream_format(std::cout, "Average samples/double->update: %8.2f\n", double(m_total_samples) / double(m_total_stream_updates)); + osd_printf_info("Average samples/double->update: %8.2f\n", double(m_total_samples) / double(m_total_stream_updates)); } @@ -687,15 +669,15 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) { discrete_task *task = nullptr; /* list tail pointers */ - int has_tasks = 0; + bool has_tasks = false; /* check whether we have tasks ... */ if (USE_DISCRETE_TASKS) { - for (int i = 0; i < block_list.count(); i++) + for (int i = 0; !has_tasks && (i < block_list.size()); i++) { if (block_list[i]->type == DSO_TASK_START) - has_tasks = 1; + has_tasks = true; } } @@ -704,21 +686,23 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) /* make sure we have one simple task * No need to create a node since there are no dependencies. */ - task = auto_alloc_clear(machine(), <discrete_task>(*this)); - task_list.add(task); + task_list.push_back(std::make_unique<discrete_task>(*this)); + task = task_list.back().get(); } /* loop over all nodes */ - for (int i = 0; i < block_list.count(); i++) + for (int i = 0; i < block_list.size(); i++) { - const discrete_block *block = block_list[i]; + const discrete_block &block = *block_list[i]; + + // add to node list + m_node_list.push_back(block.factory(*this, block)); + discrete_base_node &node = *m_node_list.back(); - //discrete_base_node *node = block->factory->Create(this, block); - discrete_base_node *node = block->factory(this, block); - /* keep track of special nodes */ - if (block->node == NODE_SPECIAL) + if (block.node == NODE_SPECIAL) { - switch(block->type) + // keep track of special nodes + switch (block.type) { /* Output Node */ case DSO_OUTPUT: @@ -739,12 +723,12 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) { if (task != nullptr) fatalerror("init_nodes() - Nested DISCRETE_START_TASK.\n"); - task = auto_alloc_clear(machine(), <discrete_task>(*this)); - task->task_group = block->initial[0]; + task_list.push_back(std::make_unique<discrete_task>(*this)); + task = task_list.back().get(); + task->task_group = block.initial[0]; if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) fatalerror("discrete_dso_task: illegal task_group %d\n", task->task_group); - //util::stream_format(std::cout, "task group %d\n", task->task_group); - task_list.add(task); + //logerror("task group %d\n", task->task_group); } break; @@ -760,37 +744,33 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) fatalerror("init_nodes() - Failed, trying to create unknown special discrete node.\n"); } } - - /* otherwise, make sure we are not a duplicate, and put ourselves into the indexed list */ else { - if (m_indexed_node[NODE_INDEX(block->node)]) - fatalerror("init_nodes() - Duplicate entries for NODE_%02d\n", NODE_INDEX(block->node)); - m_indexed_node[NODE_INDEX(block->node)] = node; + // otherwise, make sure we are not a duplicate, and put ourselves into the indexed list + if (m_indexed_node[NODE_INDEX(block.node)]) + fatalerror("init_nodes() - Duplicate entries for NODE_%02d\n", NODE_INDEX(block.node)); + m_indexed_node[NODE_INDEX(block.node)] = &node; } - /* add to node list */ - m_node_list.add(node); - - /* our running order just follows the order specified */ - /* does the node step ? */ + // our running order just follows the order specified + // does the node step? discrete_step_interface *step; - if (node->interface(step)) + if (node.interface(step)) { /* do we belong to a task? */ if (task == nullptr) - fatalerror("init_nodes() - found node outside of task: %s\n", node->module_name() ); + fatalerror("init_nodes() - found node outside of task: %s\n", node.module_name()); else - task->step_list.add(step); + task->step_list.push_back(step); } - if (USE_DISCRETE_TASKS && block->type == DSO_TASK_END) + if (USE_DISCRETE_TASKS && block.type == DSO_TASK_END) { task = nullptr; } /* and register save state */ - node->save_state(); + node.save_state(); } if (!has_tasks) @@ -810,11 +790,11 @@ int discrete_device::same_module_index(const discrete_base_node &node) { int index = 0; - for_each(discrete_base_node **, n, &m_node_list) + for (const auto &n : m_node_list) { - if (*n == &node) + if (n.get() == &node) return index; - if ((*n)->module_type() == node.module_type()) + if (n->module_type() == node.module_type()) index++; } return -1; @@ -851,7 +831,7 @@ discrete_sound_device::discrete_sound_device(const machine_config &mconfig, cons { } -discrete_device::~discrete_device(void) +discrete_device::~discrete_device() { } @@ -862,7 +842,7 @@ discrete_device::~discrete_device(void) void discrete_device::device_start() { // create the stream - //m_stream = stream_alloc_legacy(0, 2, 22257); + //m_stream = stream_alloc(0, 2, 22257); const discrete_block *intf_start = m_intf; @@ -897,33 +877,33 @@ void discrete_device::device_start() m_node_list.clear(); /* allocate memory to hold pointers to nodes by index */ - m_indexed_node = auto_alloc_array_clear(this->machine(), discrete_base_node *, DISCRETE_MAX_NODES); + m_indexed_node = make_unique_clear<discrete_base_node * []>(DISCRETE_MAX_NODES); /* initialize the node data */ init_nodes(block_list); /* now go back and find pointers to all input nodes */ - for_each(discrete_base_node **, node, &m_node_list) + for (const auto &node : m_node_list) { - (*node)->resolve_input_nodes(); + node->resolve_input_nodes(); } /* allocate a queue */ m_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ); /* Process nodes which have a start func */ - for_each(discrete_base_node **, node, &m_node_list) + for (const auto &node : m_node_list) { - (*node)->start(); + node->start(); } /* Now set up tasks */ - for_each(discrete_task **, task, &task_list) + for (const auto &task : task_list) { - for_each(discrete_task **, dest_task, &task_list) + for (const auto &dest_task : task_list) { - if ((*task)->task_group > (*dest_task)->task_group) - (*dest_task)->check((*task)); + if (task->task_group > dest_task->task_group) + dest_task->check(*task); } } } @@ -942,9 +922,9 @@ void discrete_device::device_stop() /* Process nodes which have a stop func */ - for_each(discrete_base_node **, node, &m_node_list) + for (const auto &node : m_node_list) { - (*node)->stop(); + node->stop(); } if (DISCRETE_DEBUGLOG) @@ -969,31 +949,31 @@ void discrete_sound_device::device_start() discrete_device::device_start(); /* look for input stream nodes */ - for_each(discrete_base_node **, node, &m_node_list) + for (const auto &node : m_node_list) { /* if we are an stream input node, track that */ - discrete_dss_input_stream_node *input_stream = dynamic_cast<discrete_dss_input_stream_node *>(*node); + discrete_dss_input_stream_node *input_stream = dynamic_cast<discrete_dss_input_stream_node *>(node.get()); if (input_stream != nullptr) { - m_input_stream_list.add(input_stream); + m_input_stream_list.push_back(input_stream); } /* if this is an output interface, add it the output list */ discrete_sound_output_interface *out; - if ((*node)->interface(out)) - m_output_list.add(out); + if (node->interface(out)) + m_output_list.push_back(out); } /* if no outputs, give an error */ - if (m_output_list.count() == 0) + if (m_output_list.empty()) fatalerror("init_nodes() - Couldn't find an output node\n"); /* initialize the stream(s) */ - m_stream = stream_alloc(m_input_stream_list.count(), m_output_list.count(), m_sample_rate); + m_stream = stream_alloc(m_input_stream_list.size(), m_output_list.size(), m_sample_rate); /* Finalize stream_input_nodes */ - for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list) + for (discrete_dss_input_stream_node *node : m_input_stream_list) { - (*node)->stream_start(); + node->stream_start(); } @@ -1008,12 +988,12 @@ void discrete_device::device_reset() update_to_current_time(); /* loop over all nodes */ - for_each (discrete_base_node **, node, &m_node_list) + for (const auto &node : m_node_list) { /* Fimxe : node_level */ - (*node)->m_output[0] = 0; + node->m_output[0] = 0; - (*node)->reset(); + node->reset(); } } @@ -1026,7 +1006,7 @@ void discrete_sound_device::device_reset() // discrete_device_process - process a number of // samples. // -// input / output buffers are stream_sample_t +// input / output buffers are s32 // to not to have to convert the buffers. // a "discrete cpu" device will pass nullptr here //------------------------------------------------- @@ -1037,18 +1017,19 @@ void discrete_device::process(int samples) return; /* Setup tasks */ - for_each(discrete_task **, task, &task_list) + for (const auto &task : task_list) { /* unlock the thread */ - (*task)->unlock(); + task->unlock(); - (*task)->prepare_for_queue(samples); + task->prepare_for_queue(samples); } - for_each(discrete_task **, task, &task_list) + for (const auto &task : task_list) { /* Fire a work item for each task */ - osd_work_item_queue(m_queue, discrete_task::task_callback, (void *) &task_list, WORK_ITEM_FLAG_AUTO_RELEASE); + (void)task; + osd_work_item_queue(m_queue, discrete_task::task_callback, (void *)&task_list, WORK_ITEM_FLAG_AUTO_RELEASE); } osd_work_queue_wait(m_queue, osd_ticks_per_second()*10); @@ -1060,7 +1041,7 @@ void discrete_device::process(int samples) } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- @@ -1069,17 +1050,17 @@ void discrete_sound_device::sound_stream_update(sound_stream &stream, std::vecto int outputnum = 0; /* Setup any output streams */ - for_each(discrete_sound_output_interface **, node, &m_output_list) + for (discrete_sound_output_interface *node : m_output_list) { - (*node)->set_output_ptr(outputs[outputnum]); + node->set_output_ptr(outputs[outputnum]); outputnum++; } /* Setup any input streams */ - for_each(discrete_dss_input_stream_node **, node, &m_input_stream_list) + for (discrete_dss_input_stream_node *node : m_input_stream_list) { - (*node)->m_inview = &inputs[(*node)->m_stream_in_number]; - (*node)->m_inview_sample = 0; + node->m_inview = &inputs[node->m_stream_in_number]; + node->m_inview_sample = 0; } /* just process it */ diff --git a/src/devices/sound/discrete.h b/src/devices/sound/discrete.h index 65879da211f..20d445959fa 100644 --- a/src/devices/sound/discrete.h +++ b/src/devices/sound/discrete.h @@ -7,6 +7,9 @@ #include "machine/rescap.h" +#include <vector> + + /*********************************************************************** * * MAME - Discrete sound system emulation library @@ -3745,88 +3748,6 @@ enum * *************************************/ -/* - * add and delete may be slow - the focus is on access! - */ - - // TODO: replace with vector from utils -template<class _ElementType> struct vector_t -{ -public: - vector_t(int initial) { - m_count = 0; - m_allocated = initial; - m_arr = make_unique_clear<_ElementType[]>(m_allocated); - } - vector_t() { - m_count = 0; - m_allocated = 16; - m_arr = make_unique_clear<_ElementType[]>(m_allocated); - } - ~vector_t() { - m_arr = nullptr; - } - _ElementType& operator [] (unsigned int index) const // get array item - { - return m_arr[index]; - } - - vector_t(const vector_t &a) // copy constructor - { - m_allocated = a.count(); - if (m_allocated < 16) - m_allocated = 16; - m_count = a.count(); - m_arr = make_unique_clear<_ElementType[]>(m_allocated); - for (int i=0; i < m_count; i++) - m_arr[i] = a[i]; - } - vector_t& operator = (const vector_t &a) // assignment operator - { - if (this == &a) return *this; - m_allocated = a.count(); - if (m_allocated < 16) - m_allocated = 16; - m_count = a.count(); - m_arr = make_unique_clear<_ElementType[]>(m_allocated); - for (int i=0; i < m_count; i++) - m_arr[i] = a[i]; - return *this; - } - - inline _ElementType* add(_ElementType object) - { - if (m_count >= m_allocated) - { - auto oldarr = make_unique_clear<_ElementType[]>(m_allocated); - for (int i = 0; i < m_count; i++) - oldarr[i] = m_arr[i]; - - m_allocated *= 2; - m_arr = make_unique_clear<_ElementType[]>(m_allocated); - for (int i = 0; i < m_count; i++) - m_arr[i] = oldarr[i]; - } - m_arr[m_count] = object; - m_count++; - return &m_arr[m_count-1]; - } - inline void remove(int index) - { - for (int i=index+1; i < m_count; i++) - m_arr[i-1] = m_arr[i]; - m_count--; - } - inline void clear(void) { m_count = 0; } - inline int count(void) const { return m_count; } - inline _ElementType *begin_ptr(void) const { return m_arr.get(); } - inline _ElementType *end_ptr(void) const { return m_arr.get() + (m_count - 1); } -private: - std::unique_ptr<_ElementType[]> m_arr; - int m_count; - int m_allocated; -}; - /************************************* * * Node-specific struct types @@ -4180,14 +4101,10 @@ enum discrete_node_type *************************************/ struct discrete_block; -class discrete_node_base_factory; class discrete_task; class discrete_base_node; class discrete_dss_input_stream_node; class discrete_device; -typedef vector_t<discrete_base_node *> node_list_t; -typedef vector_t<discrete_dss_input_stream_node *> istream_node_list_t; -typedef vector_t<discrete_task *> task_list_t; /************************************* @@ -4207,7 +4124,7 @@ typedef vector_t<discrete_task *> task_list_t; struct discrete_block { int node; /* Output node number */ - discrete_base_node *(*factory)(discrete_device * pdev, const discrete_block *block); + std::unique_ptr<discrete_base_node> (*factory)(discrete_device &pdev, const discrete_block &block); int type; /* see defines below */ int active_inputs; /* Number of active inputs on this node type */ int input_node[DISCRETE_MAX_INPUTS];/* input/control nodes */ @@ -4216,7 +4133,6 @@ struct discrete_block const char * name; /* Node Name */ const char * mod_name; /* Module / class name */ }; -typedef vector_t<const discrete_block *> sound_block_list_t; /************************************* * @@ -4229,11 +4145,10 @@ class discrete_step_interface public: virtual ~discrete_step_interface() { } - virtual void step(void) = 0; + virtual void step() = 0; osd_ticks_t run_time; discrete_base_node * self; }; -typedef vector_t<discrete_step_interface *> node_step_list_t; class discrete_input_interface { @@ -4256,7 +4171,6 @@ public: //************************************************************************** class discrete_sound_output_interface; -typedef vector_t<discrete_sound_output_interface *> node_output_list_t; // ======================> discrete_device @@ -4270,12 +4184,16 @@ protected: discrete_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); public: + typedef std::vector<std::unique_ptr<discrete_task> > task_list_t; + typedef std::vector<std::unique_ptr<discrete_base_node> > node_list_t; + typedef std::vector<discrete_step_interface *> node_step_list_t; + // inline configuration helpers void set_intf(const discrete_block *intf) { m_intf = intf; } uint8_t read(offs_t offset); void write(offs_t offset, uint8_t data); - virtual ~discrete_device(void); + virtual ~discrete_device(); template<int DiscreteInput> DECLARE_WRITE_LINE_MEMBER(write_line) @@ -4285,7 +4203,7 @@ public: /* --------------------------------- */ - virtual void update_to_current_time(void) const { } + virtual void update_to_current_time() const { } /* process a number of samples */ void process(int samples); @@ -4303,14 +4221,13 @@ public: discrete_base_node *discrete_find_node(int node); /* are we profiling */ - inline int profiling(void) { return m_profiling; } + inline int profiling() { return m_profiling; } - inline int sample_rate(void) { return m_sample_rate; } - inline double sample_time(void) { return m_sample_time; } + inline int sample_rate() { return m_sample_rate; } + inline double sample_time() { return m_sample_time; } protected: - // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -4332,13 +4249,15 @@ protected: node_list_t m_node_list; /* node_description * */ private: + typedef std::vector<const discrete_block *> sound_block_list_t; + void discrete_build_list(const discrete_block *intf, sound_block_list_t &block_list); void discrete_sanity_check(const sound_block_list_t &block_list); - void display_profiling(void); + void display_profiling(); void init_nodes(const sound_block_list_t &block_list); /* internal node tracking */ - discrete_base_node ** m_indexed_node; + std::unique_ptr<discrete_base_node * []> m_indexed_node; /* tasks */ task_list_t task_list; /* discrete_task_context * */ @@ -4373,13 +4292,13 @@ public: set_intf(intf); } discrete_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - virtual ~discrete_sound_device(void) { }; + virtual ~discrete_sound_device() { }; /* --------------------------------- */ - virtual void update_to_current_time(void) const override { m_stream->update(); } + virtual void update_to_current_time() const override { m_stream->update(); } - sound_stream *get_stream(void) { return m_stream; } + sound_stream *get_stream() { return m_stream; } protected: // device-level overrides @@ -4390,6 +4309,9 @@ protected: virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: + typedef std::vector<discrete_dss_input_stream_node *> istream_node_list_t; + typedef std::vector<discrete_sound_output_interface *> node_output_list_t; + /* the output stream */ sound_stream *m_stream; @@ -4415,13 +4337,14 @@ class discrete_base_node friend class discrete_task; public: + virtual ~discrete_base_node(); - virtual void reset(void) { } - virtual void start(void) { } - virtual void stop(void) { } - virtual void save_state(void); + virtual void reset() { } + virtual void start() { } + virtual void stop() { } + virtual void save_state(); - virtual int max_output(void) { return 1; }; + virtual int max_output() { return 1; }; inline bool interface(discrete_step_interface *&intf) const { intf = m_step_intf; return (intf != nullptr); } inline bool interface(discrete_input_interface *&intf) const { intf = m_input_intf; return (intf != nullptr); } @@ -4434,36 +4357,35 @@ public: inline void set_output(int n, double val) { m_output[n] = val; } /* Return the node index, i.e. X from NODE(X) */ - inline int index(void) { return NODE_INDEX(m_block->node); } + inline int index() { return NODE_INDEX(m_block->node); } /* Return the node number, i.e. NODE(X) */ - inline int block_node(void) const { return m_block->node; } + inline int block_node() const { return m_block->node; } /* Custom function specific initialisation data */ - inline const void *custom_data(void) { return m_custom; } + inline const void *custom_data() { return m_custom; } inline int input_node(int inputnum) { return m_block->input_node[inputnum]; } /* Number of active inputs on this node type */ - inline int active_inputs(void) { return m_active_inputs; } + inline int active_inputs() { return m_active_inputs; } /* Bit Flags. 1 in bit location means input_is_node */ - inline int input_is_node(void) { return m_input_is_node; } + inline int input_is_node() { return m_input_is_node; } - inline double sample_time(void) { return m_device->sample_time(); } - inline int sample_rate(void) { return m_device->sample_rate(); } + inline double sample_time() { return m_device->sample_time(); } + inline int sample_rate() { return m_device->sample_rate(); } - const char * module_name(void) { return m_block->mod_name; } - inline int module_type(void) const { return m_block->type; } + const char * module_name() { return m_block->mod_name; } + inline int module_type() const { return m_block->type; } protected: discrete_base_node(); - virtual ~discrete_base_node(); /* finish node setup after allocation is complete */ void init(discrete_device * pdev, const discrete_block *block); - void resolve_input_nodes(void); + void resolve_input_nodes(); double m_output[DISCRETE_MAX_OUTPUTS]; /* The node's last output value */ const double * m_input[DISCRETE_MAX_INPUTS]; /* Addresses of Input values */ @@ -4482,28 +4404,18 @@ private: discrete_sound_output_interface * m_output_intf; }; -class discrete_node_base_factory -{ -public: - virtual discrete_base_node *Create(discrete_device * pdev, const discrete_block *block) = 0; - virtual ~discrete_node_base_factory() {} -}; - template <class C> -class discrete_node_factory : public discrete_node_base_factory +class discrete_node_factory { public: - discrete_base_node *Create(discrete_device * pdev, const discrete_block *block) override; -}; - -template <class C> -discrete_base_node * discrete_node_factory<C>::Create(discrete_device * pdev, const discrete_block *block) -{ - discrete_base_node *r = auto_alloc_clear(pdev->machine(), <C>()); + static std::unique_ptr<discrete_base_node> create(discrete_device &pdev, const discrete_block &block) + { + std::unique_ptr<discrete_base_node> r = make_unique_clear<C>(); - r->init(pdev, block); - return r; -} + r->init(&pdev, &block); + return r; + } +}; /************************************* * @@ -4520,16 +4432,10 @@ discrete_base_node * discrete_node_factory<C>::Create(discrete_device * pdev, co * *************************************/ -template <class C> -discrete_base_node *discrete_create_node(discrete_device * pdev, const discrete_block *block) -{ - return discrete_node_factory< C >().Create(pdev, block); -} - #define DISCRETE_SOUND_EXTERN(name) extern const discrete_block name[] #define DISCRETE_SOUND_START(name) const discrete_block name[] = { //#define DSC_SND_ENTRY(_nod, _class, _dss, _num, _iact, _iinit, _custom, _name) { _nod, new discrete_node_factory< DISCRETE_CLASS_NAME(_class) >, _dss, _num, _iact, _iinit, _custom, _name, # _class } -#define DSC_SND_ENTRY(_nod, _class, _dss, _num, _iact, _iinit, _custom, _name) { _nod, &discrete_create_node< DISCRETE_CLASS_NAME(_class) >, _dss, _num, _iact, _iinit, _custom, _name, # _class } +#define DSC_SND_ENTRY(_nod, _class, _dss, _num, _iact, _iinit, _custom, _name) { _nod, &discrete_node_factory< DISCRETE_CLASS_NAME(_class) >::create, _dss, _num, _iact, _iinit, _custom, _name, # _class } #define DISCRETE_SOUND_END DSC_SND_ENTRY( NODE_00, special, DSS_NULL , 0, DSE( NODE_NC ), DSE( 0 ) ,nullptr ,"DISCRETE_SOUND_END" ) }; diff --git a/src/devices/sound/dmadac.cpp b/src/devices/sound/dmadac.cpp index b3a7d84bbf5..384449fca9b 100644 --- a/src/devices/sound/dmadac.cpp +++ b/src/devices/sound/dmadac.cpp @@ -232,7 +232,7 @@ dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const ch } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- void dmadac_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) diff --git a/src/devices/sound/dspv.cpp b/src/devices/sound/dspv.cpp index 7305c1c5298..cf14ead15d3 100644 --- a/src/devices/sound/dspv.cpp +++ b/src/devices/sound/dspv.cpp @@ -95,6 +95,7 @@ void dspv_device::snd_w(offs_t offset, u16 data) void dspv_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } void dspv_device::device_start() diff --git a/src/devices/sound/es1373.cpp b/src/devices/sound/es1373.cpp index 9475b410f0b..1c707599188 100644 --- a/src/devices/sound/es1373.cpp +++ b/src/devices/sound/es1373.cpp @@ -120,7 +120,7 @@ void es1373_device::device_start() add_map(0x40, M_IO, FUNC(es1373_device::map)); // create the stream - m_stream = stream_alloc_legacy(0, 2, 44100/2); + m_stream = stream_alloc(0, 2, 44100/2); m_timer = timer_alloc(0, nullptr); m_timer->adjust(attotime::zero, 0, attotime::from_hz(44100/2/16)); @@ -230,24 +230,27 @@ void es1373_device::device_timer(emu_timer &timer, device_timer_id tid, int para } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void es1373_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void es1373_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { if (m_dac1.enable) { - logerror("%s: sound_stream_update_legacy DAC1 not implemented yet\n", tag()); + logerror("%s: sound_stream_update DAC1 not implemented yet\n", tag()); } if (m_dac2.enable) { - send_audio_out(m_dac2, ICSTATUS_DAC2_INT_MASK, outputs[0], outputs[1], samples); + send_audio_out(m_dac2, ICSTATUS_DAC2_INT_MASK, outputs[0], outputs[1]); + } else { + outputs[0].fill(0); + outputs[1].fill(0); } if (m_adc.enable) { if (m_adc.format!=SCTRL_16BIT_MONO) { - logerror("%s: sound_stream_update_legacy Only SCTRL_16BIT_MONO recorded supported\n", tag()); + logerror("%s: sound_stream_update Only SCTRL_16BIT_MONO recorded supported\n", tag()); } else { - for (int i=0; i<samples; i++) { + for (int i=0; i<outputs[0].samples(); i++) { if (m_adc.buf_count<=m_adc.buf_size) { if (LOG_ES) logerror("%s: ADC buf_count: %i buf_size: %i buf_rptr: %i buf_wptr: %i\n", machine().describe_context(), @@ -292,7 +295,7 @@ void es1373_device::sound_stream_update_legacy(sound_stream &stream, stream_samp //------------------------------------------------- // send_audio_out - Sends channel audio output data //------------------------------------------------- -void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, stream_sample_t *outL, stream_sample_t *outR, int samples) +void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, write_stream_view &outL, write_stream_view &outR) { // Only transfer PCI data if bus mastering is enabled // Fill initial half buffer @@ -303,8 +306,9 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, stream_s //uint32_t sample_size = calc_size(chan.format); // Send data to sound stream bool buf_row_done; - for (int i=0; i<samples; i++) { + for (int i=0; i<outL.samples(); i++) { buf_row_done = false; + int16_t lsamp = 0, rsamp = 0; if (chan.buf_count<=chan.buf_size) { // Only transfer PCI data if bus mastering is enabled // Fill half-buffer when read pointer is at start of next half @@ -314,7 +318,7 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, stream_s } if (LOG_ES && i==0) logerror("%s: chan: %X samples: %i buf_count: %X buf_size: %X buf_rptr: %X buf_wptr: %X\n", - machine().describe_context(), chan.number, samples, chan.buf_count, chan.buf_size, chan.buf_rptr, chan.buf_wptr); + machine().describe_context(), chan.number, outL.samples(), chan.buf_count, chan.buf_size, chan.buf_rptr, chan.buf_wptr); // Buffer is 4 bytes per location, need to switch on sample mode switch (chan.format) { case SCTRL_8BIT_MONO: @@ -324,28 +328,28 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, stream_s logerror("es1373_device::send_audio_out SCTRL_8BIT_STEREO not implemented yet\n"); break; case SCTRL_16BIT_MONO: - // The sound cache is 32 bit wide fifo, so each entry is two mono 16 bit samples - if ((chan.buf_count&0x1)) { - // Read high 16 bits - outL[i] = outR[i] = (int16_t)(m_sound_cache[chan.buf_rptr]>>16); - chan.buf_rptr++; - buf_row_done = true; - } else { - // Read low 16 bits - outL[i] = outR[i] = (int16_t)(m_sound_cache[chan.buf_rptr]&0xffff); - } - break; - case SCTRL_16BIT_STEREO: - // The sound cache is 32 bit wide fifo, so each entry is one stereo 16 bit sample - outL[i] = (int16_t) m_sound_cache[chan.buf_rptr]&0xffff; - outR[i] = (int16_t) m_sound_cache[chan.buf_rptr]>>16; + // The sound cache is 32 bit wide fifo, so each entry is two mono 16 bit samples + if ((chan.buf_count&0x1)) { + // Read high 16 bits + lsamp = rsamp = m_sound_cache[chan.buf_rptr]>>16; chan.buf_rptr++; buf_row_done = true; + } else { + // Read low 16 bits + lsamp = rsamp = m_sound_cache[chan.buf_rptr]&0xffff; + } + break; + case SCTRL_16BIT_STEREO: + // The sound cache is 32 bit wide fifo, so each entry is one stereo 16 bit sample + lsamp = m_sound_cache[chan.buf_rptr]&0xffff; + rsamp = m_sound_cache[chan.buf_rptr]>>16; + chan.buf_rptr++; + buf_row_done = true; break; } if (LOG_ES_FILE && m_tempCount<1000000) { m_tempCount++; - //logerror("es1373_device::sound_stream_update_legacy count: %i samp16: %X\n", i, samp16); + //logerror("es1373_device::sound_stream_update count: %i samp16: %X\n", i, samp16); //if (LOG_ES_FILE && m_eslog) //fprintf(m_eslog, "%i\n", samp16); } @@ -368,10 +372,9 @@ void es1373_device::send_audio_out(chan_info& chan, uint32_t intr_mask, stream_s if (buf_row_done && !(chan.buf_rptr&0xf)) { chan.buf_rptr -= 0x10; } - } else { - // Send zeros? - outL[i] = outR[i] = 0; } + outL.put_int(i, lsamp, 32768); + outR.put_int(i, rsamp, 32768); } } diff --git a/src/devices/sound/es1373.h b/src/devices/sound/es1373.h index 856d90d7af8..6e3cddb8a42 100644 --- a/src/devices/sound/es1373.h +++ b/src/devices/sound/es1373.h @@ -29,7 +29,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void device_add_mconfig(machine_config &config) override; virtual void device_post_load() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // Sound stream sound_stream *m_stream; @@ -55,7 +55,7 @@ private: void transfer_pci_audio(chan_info& chan, int type); uint32_t calc_size(const uint8_t &format); - void send_audio_out(chan_info& chan, uint32_t intr_mask, stream_sample_t *outL, stream_sample_t *outR, int samples); + void send_audio_out(chan_info& chan, uint32_t intr_mask, write_stream_view &outL, write_stream_view &outR); uint32_t m_tempCount; emu_timer *m_timer; diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index 36fcaaf8af1..f22d11473fc 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -2,7 +2,7 @@ // copyright-holders:R. Belmont /* - ES5503 - Ensoniq ES5503 "DOC" emulator v2.1.1 + ES5503 - Ensoniq ES5503 "DOC" emulator v2.1.2 By R. Belmont. Copyright R. Belmont. @@ -30,6 +30,9 @@ 2.0 (RB) - C++ conversion, more accurate oscillator IRQ timing 2.1 (RB) - Corrected phase when looping; synthLAB, Arkanoid, and Arkanoid II no longer go out of tune 2.1.1 (RB) - Fixed issue introduced in 2.0 where IRQs were delayed + 2.1.2 (RB) - Fixed SoundSmith POLY.SYNTH inst where one-shot on the even oscillator and swap on the odd should loop. + Conversely, the intro voice in FTA Delta Demo has swap on the even and one-shot on the odd and doesn't + want to loop. */ #include "emu.h" @@ -88,7 +91,8 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress { ES5503Osc *pOsc = &oscillators[onum]; ES5503Osc *pPartner = &oscillators[onum^1]; - int mode = (pOsc->control>>1) & 3; + const int mode = (pOsc->control>>1) & 3; + const int partnerMode = (pPartner->control>>1) & 3; // if 0 found in sample data or mode is not free-run, halt this oscillator if ((mode != MODE_FREE) || (type != 0)) @@ -112,8 +116,9 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress *accumulator = altram << resshift; } - // if swap mode, start the partner - if (mode == MODE_SWAP) + // if we're in swap mode or we're the even oscillator and the partner is in swap mode, + // start the partner. + if ((mode == MODE_SWAP) || ((partnerMode == MODE_SWAP) && ((onum & 1)==0))) { pPartner->control &= ~1; // clear the halt bit pPartner->accumulator = 0; // and make sure it starts from the top (does this also need phase preservation?) @@ -127,16 +132,15 @@ void es5503_device::halt_osc(int onum, int type, uint32_t *accumulator, int ress m_irq_func(1); } } - -void es5503_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - static int32_t mix[(44100/60)*2*8]; int32_t *mixp; int osc, snum, i; uint32_t ramptr; + int samples = outputs[0].samples(); - assert(samples < (44100/60)*2); - memset(mix, 0, sizeof(mix)); + assert(samples < (44100/50)); + std::fill_n(&m_mix_buffer[0], samples*output_channels, 0); for (int chan = 0; chan < output_channels; chan++) { @@ -155,7 +159,7 @@ void es5503_device::sound_stream_update_legacy(sound_stream &stream, stream_samp int8_t data = -128; int resshift = resshifts[pOsc->resolution] - pOsc->wavetblsize; uint32_t sizemask = accmasks[pOsc->wavetblsize]; - mixp = &mix[0] + chan; + mixp = &m_mix_buffer[0] + chan; for (snum = 0; snum < samples; snum++) { @@ -197,11 +201,14 @@ void es5503_device::sound_stream_update_legacy(sound_stream &stream, stream_samp } } } - - mixp = &mix[0]; - for (i = 0; i < samples; i++) - for (int chan = 0; chan < output_channels; chan++) - outputs[chan][i] = (*mixp++)>>3; + mixp = &m_mix_buffer[0]; + for (int chan = 0; chan < output_channels; chan++) + { + for (i = 0; i < outputs[chan].samples(); i++) + { + outputs[chan].put_int(i, *mixp++, 32768*8); + } + } } @@ -224,7 +231,7 @@ void es5503_device::device_start() save_pointer(STRUCT_MEMBER(oscillators, irqpend), 32); output_rate = (clock() / 8) / (2 + oscsenabled); - m_stream = stream_alloc_legacy(0, output_channels, output_rate); + m_stream = stream_alloc(0, output_channels, output_rate); m_timer = timer_alloc(0, nullptr); attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; @@ -236,6 +243,8 @@ void es5503_device::device_clock_changed() output_rate = (clock() / 8) / (2 + oscsenabled); m_stream->set_sample_rate(output_rate); + m_mix_buffer.resize((output_rate/50)*8); + attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; m_timer->adjust(update_rate, 0, update_rate); } @@ -388,12 +397,11 @@ void es5503_device::write(offs_t offset, u8 data) break; case 0xa0: // oscillator control - // if a fresh key-on, reset the ccumulator + // if a fresh key-on, reset the accumulator if ((oscillators[osc].control & 1) && (!(data&1))) { oscillators[osc].accumulator = 0; } - oscillators[osc].control = data; break; @@ -427,6 +435,8 @@ void es5503_device::write(offs_t offset, u8 data) output_rate = (clock()/8)/(2+oscsenabled); m_stream->set_sample_rate(output_rate); + m_mix_buffer.resize((output_rate/50)*8); + attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; m_timer->adjust(update_rate, 0, update_rate); break; diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h index 1483e91c8ac..2fd316aad8e 100644 --- a/src/devices/sound/es5503.h +++ b/src/devices/sound/es5503.h @@ -36,7 +36,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; @@ -84,6 +84,8 @@ private: emu_timer *m_timer; + std::vector<int32_t> m_mix_buffer; + void halt_osc(int onum, int type, uint32_t *accumulator, int resshift); }; diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp index b238409a1fa..3ea90a97261 100644 --- a/src/devices/sound/es5506.cpp +++ b/src/devices/sound/es5506.cpp @@ -106,7 +106,6 @@ static constexpr u32 FINE_FILTER_BIT = 16; static constexpr u32 FILTER_BIT = 12; static constexpr u32 FILTER_SHIFT = FINE_FILTER_BIT - FILTER_BIT; -static constexpr u32 MAX_SAMPLE_CHUNK = 10000; static constexpr u32 ULAW_MAXBITS = 8; namespace { @@ -163,9 +162,6 @@ es550x_device::es550x_device(const machine_config &mconfig, device_type type, co , m_mode(0) , m_irqv(0x80) , m_voice_index(0) - , m_scratch(nullptr) - , m_ulaw_lookup(nullptr) - , m_volume_lookup(nullptr) #if ES5506_MAKE_WAVS , m_wavraw(nullptr) #endif @@ -208,9 +204,6 @@ void es550x_device::device_start() m_sample_rate_changed_cb.resolve(); m_irqv = 0x80; - // allocate memory - m_scratch = make_unique_clear<s32[]>(2 * MAX_SAMPLE_CHUNK); - // register save save_item(NAME(m_sample_rate)); @@ -220,8 +213,6 @@ void es550x_device::device_start() save_item(NAME(m_irqv)); save_item(NAME(m_voice_index)); - save_pointer(NAME(m_scratch), 2 * MAX_SAMPLE_CHUNK); - save_item(STRUCT_MEMBER(m_voice, control)); save_item(STRUCT_MEMBER(m_voice, freqcount)); save_item(STRUCT_MEMBER(m_voice, start)); @@ -249,7 +240,7 @@ void es5506_device::device_start() channels = m_channels; // create the stream - m_stream = stream_alloc_legacy(0, 2 * channels, clock() / (16*32)); + m_stream = stream_alloc(0, 2 * channels, clock() / (16*32)); // initialize the regions if (m_region0 && !has_configured_map(0)) @@ -378,7 +369,7 @@ void es5505_device::device_start() channels = m_channels; // create the stream - m_stream = stream_alloc_legacy(0, 2 * channels, clock() / (16*32)); + m_stream = stream_alloc(0, 2 * channels, clock() / (16*32)); // initialize the regions if (m_region0 && !has_configured_map(0)) @@ -455,7 +446,7 @@ void es550x_device::update_internal_irq_state() void es550x_device::compute_tables(u32 total_volume_bit, u32 exponent_bit, u32 mantissa_bit) { // allocate ulaw lookup table - m_ulaw_lookup = make_unique_clear<s16[]>(1 << ULAW_MAXBITS); + m_ulaw_lookup.resize(1 << ULAW_MAXBITS); // generate ulaw lookup table for (int i = 0; i < (1 << ULAW_MAXBITS); i++) @@ -465,11 +456,11 @@ void es550x_device::compute_tables(u32 total_volume_bit, u32 exponent_bit, u32 m u32 mantissa = (rawval << 3) & 0xffff; if (exponent == 0) - m_ulaw_lookup[i] = (s16)mantissa >> 7; + m_ulaw_lookup[i] = s16(mantissa) >> 7; else { mantissa = (mantissa >> 1) | (~mantissa & 0x8000); - m_ulaw_lookup[i] = (s16)mantissa >> (7 - exponent); + m_ulaw_lookup[i] = s16(mantissa) >> (7 - exponent); } } @@ -477,7 +468,7 @@ void es550x_device::compute_tables(u32 total_volume_bit, u32 exponent_bit, u32 m m_volume_shift = total_volume_bit - volume_bit; const u32 volume_len = 1 << volume_bit; // allocate volume lookup table - m_volume_lookup = make_unique_clear<u32[]>(volume_len); + m_volume_lookup.resize(volume_len); // generate volume lookup table const u32 exponent_shift = 1 << exponent_bit; @@ -831,7 +822,7 @@ inline void es5505_device::check_for_end_reverse(es550x_voice *voice, u64 &accum ***********************************************************************************************/ -void es550x_device::generate_ulaw(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer, int samples) +void es550x_device::generate_ulaw(es550x_voice *voice, s32 *dest) { const u32 freqcount = voice->freqcount; u64 accum = voice->accum & m_address_acc_mask; @@ -862,8 +853,8 @@ void es550x_device::generate_ulaw(es550x_voice *voice, s32 *lbuffer, s32 *rbuffe update_envelopes(voice); // apply volumes and add - *lbuffer += get_sample(val1, voice->lvol); - *rbuffer += get_sample(val1, voice->rvol); + dest[0] += get_sample(val1, voice->lvol); + dest[1] += get_sample(val1, voice->rvol); // check for loop end check_for_end_forward(voice, accum); @@ -892,8 +883,8 @@ void es550x_device::generate_ulaw(es550x_voice *voice, s32 *lbuffer, s32 *rbuffe update_envelopes(voice); // apply volumes and add - *lbuffer += get_sample(val1, voice->lvol); - *rbuffer += get_sample(val1, voice->rvol); + dest[0] += get_sample(val1, voice->lvol); + dest[1] += get_sample(val1, voice->rvol); // check for loop end check_for_end_reverse(voice, accum); @@ -917,7 +908,7 @@ void es550x_device::generate_ulaw(es550x_voice *voice, s32 *lbuffer, s32 *rbuffe ***********************************************************************************************/ -void es550x_device::generate_pcm(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer, int samples) +void es550x_device::generate_pcm(es550x_voice *voice, s32 *dest) { const u32 freqcount = voice->freqcount; u64 accum = voice->accum & m_address_acc_mask; @@ -944,8 +935,8 @@ void es550x_device::generate_pcm(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer update_envelopes(voice); // apply volumes and add - *lbuffer += get_sample(val1, voice->lvol); - *rbuffer += get_sample(val1, voice->rvol); + dest[0] += get_sample(val1, voice->lvol); + dest[1] += get_sample(val1, voice->rvol); // check for loop end check_for_end_forward(voice, accum); @@ -970,8 +961,8 @@ void es550x_device::generate_pcm(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer update_envelopes(voice); // apply volumes and add - *lbuffer += get_sample(val1, voice->lvol); - *rbuffer += get_sample(val1, voice->rvol); + dest[0] += get_sample(val1, voice->lvol); + dest[1] += get_sample(val1, voice->rvol); // check for loop end check_for_end_reverse(voice, accum); @@ -1022,22 +1013,13 @@ inline void es550x_device::generate_irq(es550x_voice *voice, int v) ***********************************************************************************************/ -void es5506_device::generate_samples(s32 * const *outputs, int offset, int samples) +void es5506_device::generate_samples(std::vector<write_stream_view> &outputs) { - // skip if nothing to do - if (!samples) - return; - - // clear out the accumulators - for (int i = 0; i < m_channels << 1; i++) - { - memset(outputs[i] + offset, 0, sizeof(s32) * samples); - } - // loop while we still have samples to generate - while (samples) + for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++) { // loop over voices + s32 cursample[12] = { 0 }; for (int v = 0; v <= m_active_voices; v++) { es550x_voice *voice = &m_voice[v]; @@ -1049,40 +1031,29 @@ void es5506_device::generate_samples(s32 * const *outputs, int offset, int sampl const int voice_channel = get_ca(voice->control); const int channel = voice_channel % m_channels; const int l = channel << 1; - const int r = l + 1; - s32 *left = outputs[l] + offset; - s32 *right = outputs[r] + offset; // generate from the appropriate source if (voice->control & CONTROL_CMPD) - generate_ulaw(voice, left, right, samples); + generate_ulaw(voice, &cursample[l]); else - generate_pcm(voice, left, right, samples); + generate_pcm(voice, &cursample[l]); // does this voice have it's IRQ bit raised? generate_irq(voice, v); } - offset++; - samples--; + + for (int c = 0; c < outputs.size(); c++) + outputs[c].put_int(sampindex, cursample[c], 32768); } } -void es5505_device::generate_samples(s32 * const *outputs, int offset, int samples) +void es5505_device::generate_samples(std::vector<write_stream_view> &outputs) { - // skip if nothing to do - if (!samples) - return; - - // clear out the accumulators - for (int i = 0; i < m_channels << 1; i++) - { - memset(outputs[i] + offset, 0, sizeof(s32) * samples); - } - // loop while we still have samples to generate - while (samples) + for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++) { // loop over voices + s32 cursample[12] = { 0 }; for (int v = 0; v <= m_active_voices; v++) { es550x_voice *voice = &m_voice[v]; @@ -1100,19 +1071,17 @@ void es5505_device::generate_samples(s32 * const *outputs, int offset, int sampl const int voice_channel = get_ca(voice->control); const int channel = voice_channel % m_channels; const int l = channel << 1; - const int r = l + 1; - s32 *left = outputs[l] + offset; - s32 *right = outputs[r] + offset; // generate from the appropriate source // no compressed sample support - generate_pcm(voice, left, right, samples); + generate_pcm(voice, &cursample[l]); // does this voice have it's IRQ bit raised? generate_irq(voice, v); } - offset++; - samples--; + + for (int c = 0; c < outputs.size(); c++) + outputs[c].put_int(sampindex, cursample[c], 32768); } } @@ -2123,10 +2092,10 @@ u16 es5505_device::read(offs_t offset) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void es550x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void es550x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { #if ES5506_MAKE_WAVS // start the logging once we have a sample rate @@ -2138,39 +2107,30 @@ void es550x_device::sound_stream_update_legacy(sound_stream &stream, stream_samp #endif // loop until all samples are output - int offset = 0; - while (samples) - { - int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples; - - generate_samples(outputs, offset, length); + generate_samples(outputs); #if ES5506_MAKE_WAVS - // log the raw data - if (m_wavraw) + // log the raw data + if (m_wavraw) + { + // determine left/right source data + + s32 *lsrc = m_scratch, *rsrc = m_scratch + length; + int channel; + memset(lsrc, 0, sizeof(s32) * length * 2); + // loop over the output channels + for (channel = 0; channel < m_channels; channel++) { - // determine left/right source data - s32 *lsrc = m_scratch, *rsrc = m_scratch + length; - int channel; - memset(lsrc, 0, sizeof(s32) * length * 2); - // loop over the output channels - for (channel = 0; channel < m_channels; channel++) + s32 *l = outputs[(channel << 1)] + sampindex; + s32 *r = outputs[(channel << 1) + 1] + sampindex; + // add the current channel's samples to the WAV data + for (samp = 0; samp < length; samp++) { - s32 *l = outputs[(channel << 1)] + offset; - s32 *r = outputs[(channel << 1) + 1] + offset; - // add the current channel's samples to the WAV data - for (samp = 0; samp < length; samp++) - { - lsrc[samp] += l[samp]; - rsrc[samp] += r[samp]; - } + lsrc[samp] += l[samp]; + rsrc[samp] += r[samp]; } - wav_add_data_32lr(m_wavraw, lsrc, rsrc, length, 4); } -#endif - - // account for these samples - offset += length; - samples -= length; + wav_add_data_32lr(m_wavraw, lsrc, rsrc, length, 4); } +#endif } diff --git a/src/devices/sound/es5506.h b/src/devices/sound/es5506.h index da438066ceb..4e45617c8b7 100644 --- a/src/devices/sound/es5506.h +++ b/src/devices/sound/es5506.h @@ -84,7 +84,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void update_irq_state(); void update_internal_irq_state(); @@ -111,10 +111,10 @@ protected: virtual void update_envelopes(es550x_voice *voice) = 0; virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) = 0; virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) = 0; - void generate_ulaw(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer, int samples); - void generate_pcm(es550x_voice *voice, s32 *lbuffer, s32 *rbuffer, int samples); + void generate_ulaw(es550x_voice *voice, s32 *dest); + void generate_pcm(es550x_voice *voice, s32 *dest); inline void generate_irq(es550x_voice *voice, int v); - virtual void generate_samples(s32 * const *outputs, int offset, int samples) {}; + virtual void generate_samples(std::vector<write_stream_view> &outputs) {}; inline void update_index(es550x_voice *voice) { m_voice_index = voice->index; } virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) { return 0; } @@ -137,12 +137,11 @@ protected: es550x_voice m_voice[32]; // the 32 voices - std::unique_ptr<s32[]> m_scratch; - - std::unique_ptr<s16[]> m_ulaw_lookup; - std::unique_ptr<u32[]> m_volume_lookup; + std::vector<s16> m_ulaw_lookup; + std::vector<u32> m_volume_lookup; #if ES5506_MAKE_WAVS + std::vector<s32> m_scratch; void * m_wavraw; // raw waveform #endif @@ -190,7 +189,7 @@ protected: virtual void update_envelopes(es550x_voice *voice) override; virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) override; virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) override; - virtual void generate_samples(s32 * const *outputs, int offset, int samples) override; + virtual void generate_samples(std::vector<write_stream_view> &outputs) override; virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) override { update_index(voice); return m_cache[get_bank(voice->control)].read_word(addr); } @@ -244,7 +243,7 @@ protected: virtual void update_envelopes(es550x_voice *voice) override; virtual void check_for_end_forward(es550x_voice *voice, u64 &accum) override; virtual void check_for_end_reverse(es550x_voice *voice, u64 &accum) override; - virtual void generate_samples(s32 * const *outputs, int offset, int samples) override; + virtual void generate_samples(std::vector<write_stream_view> &outputs) override; virtual inline u16 read_sample(es550x_voice *voice, offs_t addr) override { update_index(voice); return m_cache[get_bank(voice->control)].read_word(addr); } diff --git a/src/devices/sound/esqpump.cpp b/src/devices/sound/esqpump.cpp index 7b37a2c9abd..bf34520869f 100644 --- a/src/devices/sound/esqpump.cpp +++ b/src/devices/sound/esqpump.cpp @@ -17,24 +17,18 @@ esq_5505_5510_pump_device::esq_5505_5510_pump_device(const machine_config &mconf : device_t(mconfig, ESQ_5505_5510_PUMP, tag, owner, clock) , device_sound_interface(mconfig, *this) , m_stream(nullptr) - , m_timer(nullptr) , m_esp(*this, finder_base::DUMMY_TAG) , m_esp_halted(true) , ticks_spent_processing(0) , samples_processed(0) { -#if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM - e = nullptr; -#endif } void esq_5505_5510_pump_device::device_start() { logerror("Clock = %d\n", clock()); - m_stream = stream_alloc_legacy(8, 2, clock()); - m_timer = timer_alloc(0); - m_timer->enable(false); + m_stream = stream_alloc(8, 2, clock(), STREAM_SYNCHRONOUS); #if PUMP_DETECT_SILENCE silent_for = 500; @@ -51,95 +45,79 @@ void esq_5505_5510_pump_device::device_start() #endif #if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM - e = make_unique_clear<int16_t[]>(0x4000); + e.resize(0x4000); ei = 0; #endif } -void esq_5505_5510_pump_device::device_stop() -{ - m_timer->enable(false); -} - -void esq_5505_5510_pump_device::device_reset() -{ - m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock())); - m_timer->enable(true); -} - void esq_5505_5510_pump_device::device_clock_changed() { m_stream->set_sample_rate(clock()); - m_timer->adjust(attotime::zero, 0, attotime::from_hz(clock())); } -void esq_5505_5510_pump_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void esq_5505_5510_pump_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - if (samples != 1) { - logerror("Pump: request for %d samples\n", samples); - } + sound_assert(outputs[0].samples() == 1); - stream_sample_t *left = outputs[0], *right = outputs[1]; - for (int i = 0; i < samples; i++) - { + auto &left = outputs[0]; + auto &right = outputs[1]; #define SAMPLE_SHIFT 4 - // anything for the 'aux' output? - int16_t l = inputs[0][i] >> SAMPLE_SHIFT; - int16_t r = inputs[1][i] >> SAMPLE_SHIFT; - - // push the samples into the ESP - m_esp->ser_w(0, inputs[2][i] >> SAMPLE_SHIFT); - m_esp->ser_w(1, inputs[3][i] >> SAMPLE_SHIFT); - m_esp->ser_w(2, inputs[4][i] >> SAMPLE_SHIFT); - m_esp->ser_w(3, inputs[5][i] >> SAMPLE_SHIFT); - m_esp->ser_w(4, inputs[6][i] >> SAMPLE_SHIFT); - m_esp->ser_w(5, inputs[7][i] >> SAMPLE_SHIFT); + constexpr stream_buffer::sample_t input_scale = 32768.0 / (1 << SAMPLE_SHIFT); + + // anything for the 'aux' output? + stream_buffer::sample_t l = inputs[0].get(0) * (1.0 / (1 << SAMPLE_SHIFT)); + stream_buffer::sample_t r = inputs[1].get(0) * (1.0 / (1 << SAMPLE_SHIFT)); + + // push the samples into the ESP + m_esp->ser_w(0, s32(inputs[2].get(0) * input_scale)); + m_esp->ser_w(1, s32(inputs[3].get(0) * input_scale)); + m_esp->ser_w(2, s32(inputs[4].get(0) * input_scale)); + m_esp->ser_w(3, s32(inputs[5].get(0) * input_scale)); + m_esp->ser_w(4, s32(inputs[6].get(0) * input_scale)); + m_esp->ser_w(5, s32(inputs[7].get(0) * input_scale)); #if PUMP_FAKE_ESP_PROCESSING - m_esp->ser_w(6, m_esp->ser_r(0) + m_esp->ser_r(2) + m_esp->ser_r(4)); - m_esp->ser_w(7, m_esp->ser_r(1) + m_esp->ser_r(3) + m_esp->ser_r(5)); + m_esp->ser_w(6, m_esp->ser_r(0) + m_esp->ser_r(2) + m_esp->ser_r(4)); + m_esp->ser_w(7, m_esp->ser_r(1) + m_esp->ser_r(3) + m_esp->ser_r(5)); #else - if (!m_esp_halted) { - logerror("passing one sample through ESP\n"); - osd_ticks_t a = osd_ticks(); - m_esp->run_once(); - osd_ticks_t b = osd_ticks(); - ticks_spent_processing += (b - a); - samples_processed++; - } + if (!m_esp_halted) { + logerror("passing one sample through ESP\n"); + osd_ticks_t a = osd_ticks(); + m_esp->run_once(); + osd_ticks_t b = osd_ticks(); + ticks_spent_processing += (b - a); + samples_processed++; + } #endif - // read the processed result from the ESP and add to the saved AUX data - int16_t ll = m_esp->ser_r(6); - int16_t rr = m_esp->ser_r(7); - l += ll; - r += rr; + // read the processed result from the ESP and add to the saved AUX data + stream_buffer::sample_t ll = stream_buffer::sample_t(m_esp->ser_r(6)) * (1.0 / 32768.0); + stream_buffer::sample_t rr = stream_buffer::sample_t(m_esp->ser_r(7)) * (1.0 / 32768.0); + l += ll; + r += rr; #if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM - // if we're processing the fake program through the ESP, the result should just be that of adding the inputs - int32_t el = (inputs[2][i]) + (inputs[4][i]) + (inputs[6][i]); - int32_t er = (inputs[3][i]) + (inputs[5][i]) + (inputs[7][i]); - int32_t e_next = el + er; - e[(ei + 0x1d0f) % 0x4000] = e_next; - - if (l != e[ei]) { - util::stream_format(std::cerr, "expected (%d) but have (%d)\n", e[ei], l); - } - ei = (ei + 1) % 0x4000; + // if we're processing the fake program through the ESP, the result should just be that of adding the inputs + stream_buffer::sample_t el = (inputs[2].get(0)) + (inputs[4].get(0)) + (inputs[6].get(0)); + stream_buffer::sample_t er = (inputs[3].get(0)) + (inputs[5].get(0)) + (inputs[7].get(0)); + stream_buffer::sample_t e_next = el + er; + e[(ei + 0x1d0f) % 0x4000] = e_next; + + if (fabs(l - e[ei]) > 1e-5) { + util::stream_format(std::cerr, "expected (%d) but have (%d)\n", e[ei], l); + } + ei = (ei + 1) % 0x4000; #endif - // write the combined data to the output - *left++ = l; - *right++ = r; - } + // write the combined data to the output + left.put(0, l); + right.put(0, r); #if PUMP_DETECT_SILENCE - for (int i = 0; i < samples; i++) { - if (outputs[0][i] == 0 && outputs[1][i] == 0) { - silent_for++; - } else { - silent_for = 0; - } + if (left.get(0) == 0 && right.get(0) == 0) { + silent_for++; + } else { + silent_for = 0; } bool silence = silent_for >= 500; if (was_silence != silence) { @@ -174,8 +152,3 @@ void esq_5505_5510_pump_device::sound_stream_update_legacy(sound_stream &stream, } #endif } - -void esq_5505_5510_pump_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - // ecery time there's a new sample period, update the stream! - m_stream->update(); -} diff --git a/src/devices/sound/esqpump.h b/src/devices/sound/esqpump.h index a4fb62b60ff..897475cd8b4 100644 --- a/src/devices/sound/esqpump.h +++ b/src/devices/sound/esqpump.h @@ -70,24 +70,16 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_stop() override; - virtual void device_reset() override; virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - - // timer callback overrides - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state: // sound stream sound_stream *m_stream; - // per-sample timer - emu_timer *m_timer; - // ESP signal processor required_device<es5510_device> m_esp; @@ -111,7 +103,7 @@ private: #endif #if !PUMP_FAKE_ESP_PROCESSING && PUMP_REPLACE_ESP_PROGRAM - std::unique_ptr<int16_t[]> e; + std::vector<stream_buffer::sample_t> e; int ei; #endif }; diff --git a/src/devices/sound/flt_biquad.cpp b/src/devices/sound/flt_biquad.cpp new file mode 100644 index 00000000000..a0416bfafb1 --- /dev/null +++ b/src/devices/sound/flt_biquad.cpp @@ -0,0 +1,487 @@ +// license:BSD-3-Clause +// copyright-holders:K.Wilkins,Couriersud,Derrick Renaud,Frank Palazzolo,Jonathan Gevaryahu +/* + This is an implementation of a Direct-form II digital biquad filter, + intended for use in audio paths for filtering audio to or from other + stream devices. + + It has a number of constructor-helpers for automatically generating + a biquad filter equivalent to the filter response of a few standard + analog second order filter topographies. + + This biquad filter implementation is based on one written by Frank + Palazzolo, K. Wilkins, Couriersud, and Derrick Renaud, with some changes: + * It uses the Q factor directly in the filter definitions, rather than the damping factor (1/Q) + * It implements every common type of digital biquad filter which I could find documentation for. + * The filter is Direct-form II instead of Direct-form I, which results in shorter compiled code. + + Possibly useful features which aren't implemented because nothing uses them yet: + * More Sallen-Key filter variations (band-pass, high-pass) + * Direct control of the 5 normalized biquad parameters for a custom/raw parameter filter. +*/ +#include "emu.h" +#include "flt_biquad.h" + +// we need the M_SQRT2 constant +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 +#endif + +// define this to display debug info about the filters being set up +#undef FLT_BIQUAD_DEBUG_SETUP + +// device type definition +DEFINE_DEVICE_TYPE(FILTER_BIQUAD, filter_biquad_device, "filter_biquad", "Biquad Filter") + +// allow the enum class for the biquad filter type to be saved by the savestate system +ALLOW_SAVE_TYPE(filter_biquad_device::biquad_type); + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// filter_biquad_device - constructor +//------------------------------------------------- + +// initialize with some sane defaults for a highpass filter with a cutoff at 16hz, same as flt_rc's 'ac' mode. +filter_biquad_device::filter_biquad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, FILTER_BIQUAD, tag, owner, clock), + device_sound_interface(mconfig, *this), + m_stream(nullptr), + m_type(biquad_type::HIGHPASS), + m_last_sample_rate(0), + m_fc(16.0), + m_q(M_SQRT2/2.0), + m_gain(1.0), + m_input(0.0), + m_w0(0.0), + m_w1(0.0), + m_w2(0.0), + m_output(0.0), + m_a1(0.0), + m_a2(0.0), + m_b0(1.0), + m_b1(0.0), + m_b2(0.0) +{ +} + +// set up the filter with the specified parameters and return a pointer to the new device +filter_biquad_device& filter_biquad_device::setup(biquad_type type, double fc, double q, double gain) +{ + m_type = type; + m_fc = fc; + m_q = q; + m_gain = gain; + return *this; +} + +// update an existing instance with new filter parameters +void filter_biquad_device::update_params(biquad_type type, double fc, double q, double gain) +{ + m_stream->update(); + m_type = type; + m_fc = fc; + m_q = q; + m_gain = gain; + recalc(); +} + + +//------------------------------------------------- +// Filter setup helpers for various filter models +//------------------------------------------------- + +// Sallen-Key filters + +/* Setup a biquad filter structure based on a single op-amp Sallen-Key low-pass filter circuit. + * + * .----------------------------. + * | | + * --- c2 | + * --- | + * | | + * r1 | r2 |\ | + * In >----ZZZZ----+--ZZZZ---+--------+ | \ | + * | '--|+ \ | + * --- c1 | >--+------> out + * --- .--|- / | + * | | | / | + * gnd | |/ | + * | | + * | r4 | + * +--ZZZZ---' + * | + * Z + * Z r3 + * Z + * | + * gnd + */ +filter_biquad_device& filter_biquad_device::opamp_sk_lowpass_setup(double r1, double r2, double r3, double r4, double c1, double c2) +{ + if ((r1 == 0) || (r2 == 0) || (r3 == 0) || (r4 == 0) || (c1 == 0) || (c2 == 0)) + { + fatalerror("filter_biquad_device::opamp_sk_lowpass_setup() - no parameters can be 0; parameters were: r1: %f, r2: %f, r3: %f, r4: %f, c1: %f, c2: %f", r1, r2, r3, r4, c1, c2); /* Filter can not be setup. Undefined results. */ + } + + // note: if R3 doesn't exist (no link to ground), pass a value of RES_M(999.99) or the like, i.e. an 'infinite resistor' + double const gain = (r3 + r4) / r3; + double const fc = 1.0 / (2 * M_PI * sqrt(r1 * r2 * c1 * c2)); + double const q = sqrt(r1 * r2 * c1 * c2) / ((r1 * c1) + (r2 * c1) + ((r2 * c2) * (1.0 - gain))); +#ifdef FLT_BIQUAD_DEBUG_SETUP + logerror("filter_biquad_device::opamp_sk_lowpass_setup() yields: fc = %f, Q = %f, gain = %f\n", fc, q, gain); +#endif + return setup(biquad_type::LOWPASS, fc, q, gain); +} + +// Multiple-Feedback filters +// (This is sometimes called a 'Rauch' filter circuit.) + +/* Setup a biquad filter structure based on a single op-amp Multiple-Feedback low-pass filter circuit. + * NOTE: vRef is not definable when setting up the filter. + * If the analog effects caused by vRef are important to the operation of the specific filter + * in question, a netlist implementation may work better under those circumstances. + * + * .--------+---------. + * | | | + * Z --- c2 | + * Z r3 --- | + * Z | | + * r1 | r2 | |\ | + * In >----ZZZZ----+---------+--ZZZZ--+ | \ | + * | '--|- \ | + * --- c1 | >--+------> out + * --- .--|+ / + * | | | / + * gnd vRef >---' |/ + * + */ +filter_biquad_device& filter_biquad_device::opamp_mfb_lowpass_setup(double r1, double r2, double r3, double c1, double c2) +{ + if ((r1 == 0) || (r2 == 0) || (r3 == 0) || (c2 == 0)) + { + fatalerror("filter_biquad_device::opamp_mfb_lowpass_setup() - only c1 can be 0; parameters were: r1: %f, r2: %f, r3: %f, c1: %f, c2: %f", r1, r2, r3, c1, c2); /* Filter can not be setup. Undefined results. */ + } + + double const gain = -r3 / r1; + double fc, q = (M_SQRT2 / 2.0); + if (c1 == 0) // set C1 to 0 to run this filter in a degraded single pole mode where C1 was left off the filter entirely. Certain Williams boards seem to have omitted C1, presumably by accident. + { + fc = (r1 * r3) / (2 * M_PI * ((r1 * r2) + (r1 * r3) + (r2 * r3)) * r3 * c2); +#ifdef FLT_BIQUAD_DEBUG_SETUP + logerror("filter_biquad_device::opamp_mfb_lowpass_setup() in degraded mode yields: fc = %f, Q = %f(ignored), gain = %f\n", fc, q, gain); +#endif + return setup(biquad_type::LOWPASS1P, fc, q, gain); + } + else + { + fc = 1.0 / (2 * M_PI * sqrt(r2 * r3 * c1 * c2)); + q = sqrt(r2 * r3 * c1 * c2) / ((r3 * c2) + (r2 * c2) + ((r2 * c2) * -gain)); +#ifdef FLT_BIQUAD_DEBUG_SETUP + logerror("filter_biquad_device::opamp_mfb_lowpass_setup() yields: fc = %f, Q = %f, gain = %f\n", fc, q, gain); +#endif + return setup(biquad_type::LOWPASS, fc, q, gain); + } +} + +/* Setup a biquad filter structure based on a single op-amp Multiple-Feedback band-pass filter circuit. + * NOTE: vRef is not definable when setting up the filter. + * If the analog effects caused by vRef are important to the operation of the specific filter + * in question, a netlist implementation may work better under those circumstances. + * NOTE2: If r2 is not used, then set it to 0 ohms, the code will ignore it and assume a fixed gain of 1. + * + * .--------+---------. + * | | | + * --- c1 Z | + * --- Z r3 | + * | Z | + * r1 | c2 | |\ | + * In >----ZZZZ----+---------+--||----+ | \ | + * Z '--|- \ | + * Z r2 | >--+------> out + * Z .--|+ / + * | | | / + * gnd vRef >---' |/ + * + */ +filter_biquad_device& filter_biquad_device::opamp_mfb_bandpass_setup(double r1, double r2, double r3, double c1, double c2) +{ + if ((r1 == 0) || (r3 == 0) || (c1 == 0) || (c2 == 0)) + { + fatalerror("filter_biquad_device::opamp_mfb_bandpass_setup() - only r2 can be 0; parameters were: r1: %f, r2: %f, r3: %f, c1: %f, c2: %f", r1, r2, r3, c1, c2); /* Filter can not be setup. Undefined results. */ + } + + double r_in, gain; + + if (r2 == 0) + { + gain = 1; + r_in = r1; + } + else + { + gain = r2 / (r1 + r2); + r_in = 1.0 / (1.0/r1 + 1.0/r2); + } + + double const fc = 1.0 / (2 * M_PI * sqrt(r_in * r3 * c1 * c2)); + double const q = sqrt(r3 / r_in * c1 * c2) / (c1 + c2); + gain *= -r3 / r_in * c2 / (c1 + c2); +#ifdef FLT_BIQUAD_DEBUG_SETUP + logerror("filter_biquad_device::opamp_mfb_bandpass_setup() yields: fc = %f, Q = %f, gain = %f\n", fc, q, gain); +#endif + return setup(biquad_type::BANDPASS, fc, q, gain); +} + +/* Setup a biquad filter structure based on a single op-amp Multiple-Feedback high-pass filter circuit. + * NOTE: vRef is not definable when setting up the filter. + * If the analog effects caused by vRef are important to the operation of the specific filter + * in question, a netlist implementation may work better under those circumstances. + * + * .--------+---------. + * | | | + * --- c3 Z | + * --- Z r2 | + * | Z | + * c1 | c2 | |\ | + * In >-----||-----+---------+---||---+ | \ | + * Z '--|- \ | + * Z r1 | >--+------> out + * Z .--|+ / + * | | | / + * gnd vRef >---' |/ + * + */ +filter_biquad_device& filter_biquad_device::opamp_mfb_highpass_setup(double r1, double r2, double c1, double c2, double c3) +{ + if ((r1 == 0) || (r2 == 0) || (c1 == 0) || (c2 == 0) || (c3 == 0)) + { + fatalerror("filter_biquad_device::opamp_mfb_highpass_setup() - no parameters can be 0; parameters were: r1: %f, r2: %f, c1: %f, c2: %f, c3: %f", r1, r2, c1, c2, c3); /* Filter can not be setup. Undefined results. */ + } + // TODO: if c1 is 0/shorted, should the circuit should work with a gain of 1 in a first order mode? + + double const gain = -c1 / c3; + double const fc = 1.0 / (2 * M_PI * sqrt(c2 * c3 * r1 * r2)); + double const q = sqrt(c2 * c3 * r1 * r2) / ((c2 * r1) + (c3 * r1) + ((c3 * r1) * -gain)); +#ifdef FLT_BIQUAD_DEBUG_SETUP + logerror("filter_biquad_device::opamp_mfb_highpass_setup() yields: fc = %f, Q = %f, gain = %f\n", fc, q, gain); +#endif + return setup(biquad_type::HIGHPASS, fc, q, gain); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void filter_biquad_device::device_start() +{ + m_stream = stream_alloc(1, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE); + m_last_sample_rate = 0; + recalc(); + + save_item(NAME(m_type)); + save_item(NAME(m_last_sample_rate)); + save_item(NAME(m_fc)); + save_item(NAME(m_q)); + save_item(NAME(m_gain)); + save_item(NAME(m_input)); + save_item(NAME(m_w0)); + save_item(NAME(m_w1)); + save_item(NAME(m_w2)); + save_item(NAME(m_output)); + save_item(NAME(m_a1)); + save_item(NAME(m_a2)); + save_item(NAME(m_b0)); + save_item(NAME(m_b1)); + save_item(NAME(m_b2)); +} + + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void filter_biquad_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + auto &src = inputs[0]; + auto &dst = outputs[0]; + + if (m_last_sample_rate != m_stream->sample_rate()) + { + recalc(); + m_last_sample_rate = m_stream->sample_rate(); + } + + for (int sampindex = 0; sampindex < dst.samples(); sampindex++) + { + m_input = src.get(sampindex); + step(); + dst.put(sampindex, m_output); + } +} + + +/* Calculate the filter context based on the passed filter type info. + * m_type - 1 of the 9 defined filter types + * m_fc - center frequency + * m_q - 'Q' (quality) factor of filter (1/damp) + * m_gain - overall filter gain. Set to 1.0 if not needed. The exact meaning of gain changes depending on the filter type. + */ +void filter_biquad_device::recalc() +{ + double const MGain = fabs(m_gain); // absolute multiplicative gain + double const DBGain = log10(MGain) * 20.0; // gain in dB + double const AMGain = pow(10, fabs(DBGain) / 20.0); // multiplicative gain of absolute DB + double const K = tan(M_PI * m_fc / m_stream->sample_rate()); + double const Ksquared = K * K; + double const KoverQ = K / m_q; + double normal = 1.0 / (1.0 + KoverQ + Ksquared); + + m_a1 = 2.0 * (Ksquared - 1.0) * normal; + m_a2 = (1.0 - KoverQ + Ksquared) * normal; + + switch (m_type) + { + case biquad_type::LOWPASS1P: + m_a1 = exp(-2.0 * M_PI * (m_fc / m_stream->sample_rate())); + m_b0 = 1.0 - m_a1; + m_a1 = -m_a1; + m_b1 = m_b2 = m_a2 = 0.0; + break; + case biquad_type::HIGHPASS1P: + m_a1 = -exp(-2.0 * M_PI * (0.5 - m_fc / m_stream->sample_rate())); + m_b0 = 1.0 + m_a1; + m_a1 = -m_a1; + m_b1 = m_b2 = m_a2 = 0.0; + break; + case biquad_type::LOWPASS: + m_b0 = Ksquared * normal; + m_b1 = 2.0 * m_b0; + m_b2 = 1.0 * m_b0; + m_a1 = 2.0 * (Ksquared - 1.0) * normal; + m_a2 = (1.0 - KoverQ + Ksquared) * normal; + break; + case biquad_type::HIGHPASS: + m_b0 = 1.0 * normal; + m_b1 = -2.0 * m_b0; + m_b2 = 1.0 * m_b0; + m_a1 = 2.0 * (Ksquared - 1.0) * normal; + m_a2 = (1.0 - KoverQ + Ksquared) * normal; + break; + case biquad_type::BANDPASS: + m_b0 = KoverQ * normal; + m_b1 = 0.0; + m_b2 = -1.0 * m_b0; + m_a1 = 2.0 * (Ksquared - 1.0) * normal; + m_a2 = (1.0 - KoverQ + Ksquared) * normal; + break; + case biquad_type::NOTCH: + m_b0 = (1.0 + Ksquared) * normal; + m_b1 = 2.0 * (Ksquared - 1.0) * normal; + m_b2 = 1.0 * m_b0; + m_a1 = 1.0 * m_b1; + m_a2 = (1.0 - KoverQ + Ksquared) * normal; + break; + case biquad_type::PEAK: + if (DBGain >= 0.0) + { + m_b0 = (1.0 + (AMGain * KoverQ) + Ksquared) * normal; + m_b1 = 2.0 * (Ksquared - 1.0) * normal; + m_b2 = (1.0 - (AMGain * KoverQ) + Ksquared) * normal; + m_a1 = 1.0 * m_b1; + m_a2 = (1.0 - KoverQ + Ksquared) * normal; + } + else + { + normal = 1.0 / (1.0 + (AMGain * KoverQ) + Ksquared); + m_b0 = (1.0 + KoverQ + Ksquared) * normal; + m_b1 = 2.0 * (Ksquared - 1.0) * normal; + m_b2 = (1.0 - KoverQ + Ksquared) * normal; + m_a1 = 1.0 * m_b1; + m_a2 = (1.0 - (AMGain * KoverQ) + Ksquared) * normal; + } + break; + case biquad_type::LOWSHELF: + if (DBGain >= 0.0) + { + normal = 1.0 / (1.0 + M_SQRT2 * K + Ksquared); + m_b0 = (1.0 + sqrt(2.0 * AMGain) * K + AMGain * Ksquared) * normal; + m_b1 = 2.0 * (AMGain * Ksquared - 1.0) * normal; + m_b2 = (1.0 - sqrt(2.0 * AMGain) * K + AMGain * Ksquared) * normal; + m_a1 = 2.0 * (Ksquared - 1.0) * normal; + m_a2 = (1.0 - M_SQRT2 * K + Ksquared) * normal; + } + else + { + normal = 1.0 / (1.0 + sqrt(2.0 * AMGain) * K + AMGain * Ksquared); + m_b0 = (1.0 + M_SQRT2 * K + Ksquared) * normal; + m_b1 = 2.0 * (Ksquared - 1.0) * normal; + m_b2 = (1.0 - M_SQRT2 * K + Ksquared) * normal; + m_a1 = 2.0 * (AMGain * Ksquared - 1.0) * normal; + m_a2 = (1.0 - sqrt(2.0 * AMGain) * K + AMGain * Ksquared) * normal; + } + break; + case biquad_type::HIGHSHELF: + if (DBGain >= 0.0) + { + normal = 1.0 / (1.0 + M_SQRT2 * K + Ksquared); + m_b0 = (AMGain + sqrt(2.0 * AMGain) * K + Ksquared) * normal; + m_b1 = 2.0 * (Ksquared - AMGain) * normal; + m_b2 = (AMGain - sqrt(2.0 * AMGain) * K + Ksquared) * normal; + m_a1 = 2.0 * (Ksquared - 1.0) * normal; + m_a2 = (1.0 - M_SQRT2 * K + Ksquared) * normal; + } + else + { + normal = 1.0 / (AMGain + sqrt(2.0 * AMGain) * K + Ksquared); + m_b0 = (1.0 + M_SQRT2 * K + Ksquared) * normal; + m_b1 = 2.0 * (Ksquared - 1.0) * normal; + m_b2 = (1.0 - M_SQRT2 * K + Ksquared) * normal; + m_a1 = 2.0 * (Ksquared - AMGain) * normal; + m_a2 = (AMGain - sqrt(2.0 * AMGain) * K + Ksquared) * normal; + } + break; + default: + fatalerror("filter_biquad_device::recalc() - Invalid filter type!"); + break; + } +#ifdef FLT_BIQUAD_DEBUG + logerror("Calculated Parameters:\n"); + logerror( "Gain (dB): %f, (raw): %f\n", DBGain, MGain); + logerror( "k: %f\n", K); + logerror( "normal: %f\n", normal); + logerror("b0: %f\n", m_b0); + logerror("b1: %f\n", m_b1); + logerror("b2: %f\n", m_b2); + logerror("a1: %f\n", m_a1); + logerror("a2: %f\n", m_a2); +#endif + // peak and shelf filters do not use gain for the entire signal, only for the peak/shelf portions + // side note: the first order lowpass and highpass filter analogues technically don't have gain either, + // but this can be 'faked' by adjusting the bx factors, so we support that anyway, even if it isn't realistic. + if ( (m_type != biquad_type::PEAK) + && (m_type != biquad_type::LOWSHELF) + && (m_type != biquad_type::HIGHSHELF) ) + { + m_b0 *= m_gain; + m_b1 *= m_gain; + m_b2 *= m_gain; +#ifdef FLT_BIQUAD_DEBUG + logerror("b0g: %f\n", m_b0); + logerror("b1g: %f\n", m_b1); + logerror("b2g: %f\n", m_b2); +#endif + } +} + +/* Step the filter */ +void filter_biquad_device::step() +{ + m_w2 = m_w1; + m_w1 = m_w0; + m_w0 = (-m_a1 * m_w1) + (-m_a2 * m_w2) + m_input; + m_output = (m_b0 * m_w0) + (m_b1 * m_w1) + (m_b2 * m_w2); +} diff --git a/src/devices/sound/flt_biquad.h b/src/devices/sound/flt_biquad.h new file mode 100644 index 00000000000..17050c75017 --- /dev/null +++ b/src/devices/sound/flt_biquad.h @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:K.Wilkins,Couriersud,Derrick Renaud,Frank Palazzolo,Jonathan Gevaryahu +#ifndef MAME_SOUND_FLT_BIQUAD_H +#define MAME_SOUND_FLT_BIQUAD_H + +#pragma once + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> filter_biquad_device + +class filter_biquad_device : public device_t, public device_sound_interface +{ +public: + enum class biquad_type : int + { + LOWPASS1P = 0, + HIGHPASS1P, + LOWPASS, + HIGHPASS, + BANDPASS, + NOTCH, + PEAK, + LOWSHELF, + HIGHSHELF + }; + + filter_biquad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + // set up the filter with the specified filter parameters and return a pointer to the new device + filter_biquad_device& setup(biquad_type type, double fc, double q, double gain); + // update an existing instance with new filter parameters + void update_params(biquad_type type, double fc, double q, double gain); + + // helper setup functions to create common filters representable by biquad filters + // Sallen-Key low-pass + filter_biquad_device& opamp_sk_lowpass_setup(double r1, double r2, double r3, double r4, double c1, double c2); + // TODO when needed: Sallen-Key band-pass + // TODO when needed: Sallen-Key high-pass + + // Multiple-Feedback low-pass + filter_biquad_device& opamp_mfb_lowpass_setup(double r1, double r2, double r3, double c1, double c2); + + // Multiple-Feedback band-pass + filter_biquad_device& opamp_mfb_bandpass_setup(double r1, double r2, double r3, double c1, double c2); + + // Multiple-Feedback high-pass + filter_biquad_device& opamp_mfb_highpass_setup(double r1, double r2, double c1, double c2, double c3); + + +protected: + // device-level overrides + virtual void device_start() override; + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + +private: + void recalc(); + void step(); + + sound_stream* m_stream; + biquad_type m_type; + int m_last_sample_rate; + double m_fc; + double m_q; + double m_gain; + + stream_buffer::sample_t m_input; + double m_w0, m_w1, m_w2; /* w[k], w[k-1], w[k-2], current and previous intermediate values */ + stream_buffer::sample_t m_output; + double m_a1, m_a2; /* digital filter coefficients, denominator */ + double m_b0, m_b1, m_b2; /* digital filter coefficients, numerator */ +}; + +DECLARE_DEVICE_TYPE(FILTER_BIQUAD, filter_biquad_device) + +#endif // MAME_SOUND_FLT_BIQUAD_H diff --git a/src/devices/sound/flt_rc.cpp b/src/devices/sound/flt_rc.cpp index 8de64b37a40..48d542283e0 100644 --- a/src/devices/sound/flt_rc.cpp +++ b/src/devices/sound/flt_rc.cpp @@ -23,6 +23,7 @@ filter_rc_device::filter_rc_device(const machine_config &mconfig, const char *ta m_k(0), m_memory(0), m_type(LOWPASS), + m_last_sample_rate(0), m_R1(1), m_R2(1), m_R3(1), @@ -37,8 +38,8 @@ filter_rc_device::filter_rc_device(const machine_config &mconfig, const char *ta void filter_rc_device::device_start() { - m_stream = stream_alloc_legacy(1, 1, machine().sample_rate()); - recalc(); + m_stream = stream_alloc(1, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE); + m_last_sample_rate = 0; save_item(NAME(m_k)); save_item(NAME(m_memory)); @@ -51,31 +52,37 @@ void filter_rc_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void filter_rc_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void filter_rc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t const *src = inputs[0]; - stream_sample_t *dst = outputs[0]; - int memory = m_memory; + auto &src = inputs[0]; + auto &dst = outputs[0]; + stream_buffer::sample_t memory = m_memory; + + if (m_last_sample_rate != m_stream->sample_rate()) + { + recalc(); + m_last_sample_rate = m_stream->sample_rate(); + } switch (m_type) { case LOWPASS: case LOWPASS_2C: - while (samples--) + for (int sampindex = 0; sampindex < dst.samples(); sampindex++) { - memory += ((*src++ - memory) * m_k) / 0x10000; - *dst++ = memory; + memory += (src.get(sampindex) - memory) * m_k; + dst.put(sampindex, memory); } break; case HIGHPASS: case AC: - while (samples--) + for (int sampindex = 0; sampindex < dst.samples(); sampindex++) { - *dst++ = *src - memory; - memory += ((*src++ - memory) * m_k) / 0x10000; + dst.put(sampindex, src.get(sampindex) - memory); + memory += (src.get(sampindex) - memory) * m_k; } break; } @@ -93,8 +100,8 @@ void filter_rc_device::recalc() if (m_C == 0.0) { /* filter disabled */ - m_k = 0x10000; - m_memory = 0x0; + m_k = 1.0; + m_memory = 0; return; } Req = (m_R1 * (m_R2 + m_R3)) / (m_R1 + m_R2 + m_R3); @@ -103,8 +110,8 @@ void filter_rc_device::recalc() if (m_C == 0.0) { /* filter disabled */ - m_k = 0x10000; - m_memory = 0x0; + m_k = 1.0; + m_memory = 0; return; } Req = m_R1; @@ -114,8 +121,8 @@ void filter_rc_device::recalc() if (m_C == 0.0) { /* filter disabled */ - m_k = 0x0; - m_memory = 0x0; + m_k = 0; + m_memory = 0; return; } Req = m_R1; @@ -126,5 +133,5 @@ void filter_rc_device::recalc() /* Cut Frequency = 1/(2*Pi*Req*C) */ /* k = (1-(EXP(-TIMEDELTA/RC))) */ - m_k = 0x10000 - 0x10000 * (exp(-1 / (Req * m_C) / machine().sample_rate())); + m_k = 1.0 - exp(-1 / (Req * m_C) / m_stream->sample_rate()); } diff --git a/src/devices/sound/flt_rc.h b/src/devices/sound/flt_rc.h index 9c1bc7f3381..d06d0ff75d1 100644 --- a/src/devices/sound/flt_rc.h +++ b/src/devices/sound/flt_rc.h @@ -95,7 +95,7 @@ public: { m_stream->update(); set_rc(type, R1, R2, R3, C); - recalc(); + m_last_sample_rate = 0; return *this; } @@ -109,16 +109,17 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void recalc(); private: sound_stream* m_stream; - int m_k; - int m_memory; + stream_buffer::sample_t m_k; + stream_buffer::sample_t m_memory; int m_type; + int m_last_sample_rate; double m_R1; double m_R2; double m_R3; diff --git a/src/devices/sound/flt_vol.cpp b/src/devices/sound/flt_vol.cpp index 8b8438f9b94..e43da0a1ee6 100644 --- a/src/devices/sound/flt_vol.cpp +++ b/src/devices/sound/flt_vol.cpp @@ -27,21 +27,19 @@ filter_volume_device::filter_volume_device(const machine_config &mconfig, const void filter_volume_device::device_start() { m_gain = 0x100; - m_stream = stream_alloc_legacy(1, 1, machine().sample_rate()); + m_stream = stream_alloc(1, 1, SAMPLE_RATE_OUTPUT_ADAPTIVE); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void filter_volume_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void filter_volume_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t const *src = inputs[0]; - stream_sample_t *dst = outputs[0]; - - while (samples--) - *dst++ = (*src++ * m_gain) >> 8; + // no need to work here; just copy input stream to output and apply gain + outputs[0] = inputs[0]; + outputs[0].apply_gain(m_gain); } @@ -49,5 +47,5 @@ void filter_volume_device::sound_stream_update_legacy(sound_stream &stream, stre void filter_volume_device::flt_volume_set_volume(float volume) { m_stream->update(); - m_gain = int(volume * 256); + m_gain = volume; } diff --git a/src/devices/sound/flt_vol.h b/src/devices/sound/flt_vol.h index 034c3a3cf79..6a3bdab17d5 100644 --- a/src/devices/sound/flt_vol.h +++ b/src/devices/sound/flt_vol.h @@ -24,11 +24,11 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream* m_stream; - int m_gain; + stream_buffer::sample_t m_gain; }; DECLARE_DEVICE_TYPE(FILTER_VOLUME, filter_volume_device) diff --git a/src/devices/sound/fm.cpp b/src/devices/sound/fm.cpp index 5679860a2f2..01d8ba11bf1 100644 --- a/src/devices/sound/fm.cpp +++ b/src/devices/sound/fm.cpp @@ -2111,12 +2111,11 @@ struct ym2203_state } // anonymous namespace /* Generate samples for one of the YM2203s */ -void ym2203_update_one(void *chip, FMSAMPLE *buffer, int length) +void ym2203_update_one(void *chip, write_stream_view &buf) { ym2203_state *F2203 = (ym2203_state *)chip; FM_OPN *OPN = &F2203->OPN; int i; - FMSAMPLE *buf = buffer; FM_CH *cch[3]; cch[0] = &F2203->CH[0]; @@ -2147,7 +2146,7 @@ void ym2203_update_one(void *chip, FMSAMPLE *buffer, int length) OPN->LFO_PM = 0; /* buffering */ - for (i=0; i < length ; i++) + for (i=0; i < buf.samples() ; i++) { /* clear outputs */ OPN->out_fm[0] = 0; @@ -2186,7 +2185,7 @@ void ym2203_update_one(void *chip, FMSAMPLE *buffer, int length) #endif /* buffering */ - buf[i] = lt; + buf.put_int(i, lt, 32768); } /* timer A control */ @@ -2727,19 +2726,18 @@ static inline void YM2608IRQMaskWrite(FM_OPN *OPN, ym2608_state *F2608, int v) } /* Generate samples for one of the YM2608s */ -void ym2608_update_one(void *chip, FMSAMPLE * const *buffer, int length) +void ym2608_update_one(void *chip, std::vector<write_stream_view> &buffer) { ym2608_state *F2608 = (ym2608_state *)chip; FM_OPN *OPN = &F2608->OPN; YM_DELTAT *DELTAT = &F2608->deltaT; int i,j; - FMSAMPLE *bufL,*bufR; FM_CH *cch[6]; int32_t *out_fm = OPN->out_fm; /* set bufer */ - bufL = buffer[0]; - bufR = buffer[1]; + auto &bufL = buffer[0]; + auto &bufR = buffer[1]; cch[0] = &F2608->CH[0]; cch[1] = &F2608->CH[1]; @@ -2770,7 +2768,7 @@ void ym2608_update_one(void *chip, FMSAMPLE * const *buffer, int length) /* buffering */ - for(i=0; i < length ; i++) + for(i=0; i < bufL.samples() ; i++) { advance_lfo(OPN); @@ -2840,14 +2838,9 @@ void ym2608_update_one(void *chip, FMSAMPLE * const *buffer, int length) lt += ((out_fm[5]>>1) & OPN->pan[10]); rt += ((out_fm[5]>>1) & OPN->pan[11]); - lt >>= FINAL_SH; - rt >>= FINAL_SH; - - Limit( lt, MAXOUT, MINOUT ); - Limit( rt, MAXOUT, MINOUT ); /* buffering */ - bufL[i] = lt; - bufR[i] = rt; + bufL.put_int_clamp(i, lt, 32768 << FINAL_SH); + bufR.put_int_clamp(i, rt, 32768 << FINAL_SH); #ifdef SAVE_SAMPLE SAVE_ALL_CHANNELS @@ -3275,19 +3268,18 @@ int ym2608_timer_over(void *chip,int c) /* YM2610(OPNB) */ /* Generate samples for one of the YM2610s */ -void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length) +void ym2610_update_one(void *chip, std::vector<write_stream_view> &buffer) { ym2610_state *F2610 = (ym2610_state *)chip; FM_OPN *OPN = &F2610->OPN; YM_DELTAT *DELTAT = &F2610->deltaT; int i,j; - FMSAMPLE *bufL,*bufR; FM_CH *cch[4]; int32_t *out_fm = OPN->out_fm; /* buffer setup */ - bufL = buffer[0]; - bufR = buffer[1]; + auto &bufL = buffer[0]; + auto &bufR = buffer[1]; cch[0] = &F2610->CH[1]; cch[1] = &F2610->CH[2]; @@ -3323,7 +3315,7 @@ void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length) refresh_fc_eg_chan( OPN, cch[3] ); /* buffering */ - for(i=0; i < length ; i++) + for(i=0; i < bufL.samples() ; i++) { advance_lfo(OPN); @@ -3386,20 +3378,13 @@ void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length) lt += ((out_fm[5]>>1) & OPN->pan[10]); rt += ((out_fm[5]>>1) & OPN->pan[11]); - - lt >>= FINAL_SH; - rt >>= FINAL_SH; - - Limit( lt, MAXOUT, MINOUT ); - Limit( rt, MAXOUT, MINOUT ); - #ifdef SAVE_SAMPLE SAVE_ALL_CHANNELS #endif /* buffering */ - bufL[i] = lt; - bufR[i] = rt; + bufL.put_int_clamp(i, lt, 32768 << FINAL_SH); + bufR.put_int_clamp(i, rt, 32768 << FINAL_SH); } /* timer A control */ @@ -3411,19 +3396,18 @@ void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length) #if BUILD_YM2610B /* Generate samples for one of the YM2610Bs */ -void ym2610b_update_one(void *chip, FMSAMPLE * const *buffer, int length) +void ym2610b_update_one(void *chip, std::vector<write_stream_view> &buffer) { ym2610_state *F2610 = (ym2610_state *)chip; FM_OPN *OPN = &F2610->OPN; YM_DELTAT *DELTAT = &F2610->deltaT; int i,j; - FMSAMPLE *bufL,*bufR; FM_CH *cch[6]; int32_t *out_fm = OPN->out_fm; /* buffer setup */ - bufL = buffer[0]; - bufR = buffer[1]; + auto &bufL = buffer[0]; + auto &bufR = buffer[1]; cch[0] = &F2610->CH[0]; cch[1] = &F2610->CH[1]; @@ -3453,7 +3437,7 @@ void ym2610b_update_one(void *chip, FMSAMPLE * const *buffer, int length) refresh_fc_eg_chan( OPN, cch[5] ); /* buffering */ - for(i=0; i < length ; i++) + for(i=0; i < bufL.samples() ; i++) { advance_lfo(OPN); @@ -3524,20 +3508,13 @@ void ym2610b_update_one(void *chip, FMSAMPLE * const *buffer, int length) lt += ((out_fm[5]>>1) & OPN->pan[10]); rt += ((out_fm[5]>>1) & OPN->pan[11]); - - lt >>= FINAL_SH; - rt >>= FINAL_SH; - - Limit( lt, MAXOUT, MINOUT ); - Limit( rt, MAXOUT, MINOUT ); - #ifdef SAVE_SAMPLE SAVE_ALL_CHANNELS #endif /* buffering */ - bufL[i] = lt; - bufR[i] = rt; + bufL.put_int_clamp(i, lt, 32768); + bufR.put_int_clamp(i, rt, 32768); } /* timer A control */ diff --git a/src/devices/sound/fm.h b/src/devices/sound/fm.h index d5d8760a449..45381d7dda9 100644 --- a/src/devices/sound/fm.h +++ b/src/devices/sound/fm.h @@ -50,7 +50,7 @@ template <typename X> constexpr TIME_TYPE MULTIPLY_TIME_BY_INT(TIME_TYPE const & #endif -typedef stream_sample_t FMSAMPLE; +typedef s32 FMSAMPLE; /* #if (FM_SAMPLE_BITS==16) typedef int16_t FMSAMPLE; @@ -108,7 +108,7 @@ void ym2203_reset_chip(void *chip); /* ** update one of chip */ -void ym2203_update_one(void *chip, FMSAMPLE *buffer, int length); +void ym2203_update_one(void *chip, write_stream_view &buffer); /* ** Write @@ -142,7 +142,7 @@ void * ym2608_init(device_t *device, int baseclock, int rate, void ym2608_clock_changed(void *chip, int clock, int rate); void ym2608_shutdown(void *chip); void ym2608_reset_chip(void *chip); -void ym2608_update_one(void *chip, FMSAMPLE * const *buffer, int length); +void ym2608_update_one(void *chip, std::vector<write_stream_view> &buffer); int ym2608_write(void *chip, int a,unsigned char v); unsigned char ym2608_read(void *chip,int a); @@ -158,10 +158,10 @@ void * ym2610_init(device_t *device, int baseclock, int rate, void ym2610_clock_changed(void *chip, int clock, int rate); void ym2610_shutdown(void *chip); void ym2610_reset_chip(void *chip); -void ym2610_update_one(void *chip, FMSAMPLE * const *buffer, int length); +void ym2610_update_one(void *chip, std::vector<write_stream_view> &buffer); #if BUILD_YM2610B -void ym2610b_update_one(void *chip, FMSAMPLE * const *buffer, int length); +void ym2610b_update_one(void *chip, std::vector<write_stream_view> &buffer); #endif /* BUILD_YM2610B */ int ym2610_write(void *chip, int a,unsigned char v); @@ -176,7 +176,7 @@ void * ym2612_init(device_t *device, int baseclock, int rate, void ym2612_clock_changed(void *chip, int clock, int rate); void ym2612_shutdown(void *chip); void ym2612_reset_chip(void *chip); -void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 output_bits); +void ym2612_update_one(void *chip, std::vector<write_stream_view> &buffer, u8 output_bits); int ym2612_write(void *chip, int a,unsigned char v); unsigned char ym2612_read(void *chip,int a); diff --git a/src/devices/sound/fm2612.cpp b/src/devices/sound/fm2612.cpp index b3482d0ac72..4f905bf80f1 100644 --- a/src/devices/sound/fm2612.cpp +++ b/src/devices/sound/fm2612.cpp @@ -2174,7 +2174,7 @@ static void init_tables(void) /*******************************************************************************/ /* Generate samples for one of the YM2612s */ -void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 output_bits) +void ym2612_update_one(void *chip, std::vector<write_stream_view> &buffer, u8 output_bits) { // TODO : 'ladder' effects for Mega Drive/Genesis const u8 output_shift = (output_bits > 14) ? 0 : (14 - output_bits); @@ -2183,13 +2183,12 @@ void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 outp fm2612_FM_OPN *OPN = &F2612->OPN; int32_t *out_fm = OPN->out_fm; int i; - FMSAMPLE *bufL,*bufR; fm2612_FM_CH *cch[6]; int lt,rt; /* set bufer */ - bufL = buffer[0]; - bufR = buffer[1]; + auto &bufL = buffer[0]; + auto &bufR = buffer[1]; cch[0] = &F2612->CH[0]; cch[1] = &F2612->CH[1]; @@ -2220,7 +2219,7 @@ void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 outp refresh_fc_eg_chan( OPN, cch[5] ); /* buffering */ - for(i=0; i < length ; i++) + for(i=0; i < bufL.samples() ; i++) { /* clear outputs */ out_fm[0] = 0; @@ -2302,8 +2301,8 @@ void ym2612_update_one(void *chip, FMSAMPLE * const *buffer, int length, u8 outp #endif /* buffering */ - bufL[i] = lt; - bufR[i] = rt; + bufL.put_int(i, lt, 32768); + bufR.put_int(i, rt, 32768); /* CSM mode: if CSM Key ON has occurred, CSM Key OFF need to be sent */ /* only if Timer A does not overflow again (i.e CSM Key ON not set again) */ diff --git a/src/devices/sound/fmopl.cpp b/src/devices/sound/fmopl.cpp index 99139310d69..cb4d5ae686e 100644 --- a/src/devices/sound/fmopl.cpp +++ b/src/devices/sound/fmopl.cpp @@ -1498,7 +1498,7 @@ const int8_t FM_OPL::lfo_pm_table[8*8*2] = { int FM_OPL::num_lock = 0; - +#if 0 static inline int limit( int val, int max, int min ) { if ( val > max ) val = max; @@ -1507,7 +1507,7 @@ static inline int limit( int val, int max, int min ) { return val; } - +#endif /* generic table initialize */ int FM_OPL::init_tables() @@ -2206,14 +2206,13 @@ void ym3812_set_update_handler(void *chip,OPL_UPDATEHANDLER UpdateHandler,device ** '*buffer' is the output buffer pointer ** 'length' is the number of samples that should be generated */ -void ym3812_update_one(void *chip, OPLSAMPLE *buffer, int length) +void ym3812_update_one(void *chip, write_stream_view &buf) { FM_OPL *OPL = (FM_OPL *)chip; uint8_t rhythm = OPL->rhythm&0x20; - OPLSAMPLE *buf = buffer; int i; - for( i=0; i < length ; i++ ) + for( i=0; i < buf.samples(); i++ ) { int lt; @@ -2242,11 +2241,6 @@ void ym3812_update_one(void *chip, OPLSAMPLE *buffer, int length) lt = OPL->output[0]; - lt >>= FINAL_SH; - - /* limit check */ - lt = limit( lt , MAXOUT, MINOUT ); - #ifdef SAVE_SAMPLE if (which==0) { @@ -2255,7 +2249,7 @@ void ym3812_update_one(void *chip, OPLSAMPLE *buffer, int length) #endif /* store to sound buffer */ - buf[i] = lt; + buf.put_int_clamp(i, lt, 32768 << FINAL_SH); OPL->advance(); } @@ -2335,14 +2329,13 @@ void ym3526_set_update_handler(void *chip,OPL_UPDATEHANDLER UpdateHandler,device ** '*buffer' is the output buffer pointer ** 'length' is the number of samples that should be generated */ -void ym3526_update_one(void *chip, OPLSAMPLE *buffer, int length) +void ym3526_update_one(void *chip, write_stream_view &buf) { FM_OPL *OPL = (FM_OPL *)chip; uint8_t rhythm = OPL->rhythm&0x20; - OPLSAMPLE *buf = buffer; int i; - for( i=0; i < length ; i++ ) + for( i=0; i < buf.samples() ; i++ ) { int lt; @@ -2371,11 +2364,6 @@ void ym3526_update_one(void *chip, OPLSAMPLE *buffer, int length) lt = OPL->output[0]; - lt >>= FINAL_SH; - - /* limit check */ - lt = limit( lt , MAXOUT, MINOUT ); - #ifdef SAVE_SAMPLE if (which==0) { @@ -2384,7 +2372,7 @@ void ym3526_update_one(void *chip, OPLSAMPLE *buffer, int length) #endif /* store to sound buffer */ - buf[i] = lt; + buf.put_int_clamp(i, lt, 32768 << FINAL_SH); OPL->advance(); } @@ -2491,15 +2479,14 @@ void y8950_set_delta_t_memory(void *chip, FM_READBYTE read_byte, FM_WRITEBYTE wr ** '*buffer' is the output buffer pointer ** 'length' is the number of samples that should be generated */ -void y8950_update_one(void *chip, OPLSAMPLE *buffer, int length) +void y8950_update_one(void *chip, write_stream_view &buf) { int i; FM_OPL *OPL = (FM_OPL *)chip; uint8_t rhythm = OPL->rhythm&0x20; YM_DELTAT &DELTAT = *OPL->deltat; - OPLSAMPLE *buf = buffer; - for( i=0; i < length ; i++ ) + for( i=0; i < buf.samples() ; i++ ) { int lt; @@ -2533,11 +2520,6 @@ void y8950_update_one(void *chip, OPLSAMPLE *buffer, int length) lt = OPL->output[0] + (OPL->output_deltat[0]>>11); - lt >>= FINAL_SH; - - /* limit check */ - lt = limit( lt , MAXOUT, MINOUT ); - #ifdef SAVE_SAMPLE if (which==0) { @@ -2546,7 +2528,7 @@ void y8950_update_one(void *chip, OPLSAMPLE *buffer, int length) #endif /* store to sound buffer */ - buf[i] = lt; + buf.put_int_clamp(i, lt, 32768 << FINAL_SH); OPL->advance(); } diff --git a/src/devices/sound/fmopl.h b/src/devices/sound/fmopl.h index add973a2369..bb484b0e41b 100644 --- a/src/devices/sound/fmopl.h +++ b/src/devices/sound/fmopl.h @@ -16,7 +16,7 @@ /* select output bits size of output : 8 or 16 */ #define OPL_SAMPLE_BITS 16 -typedef stream_sample_t OPLSAMPLE; +typedef s32 OPLSAMPLE; /* #if (OPL_SAMPLE_BITS==16) typedef int16_t OPLSAMPLE; @@ -44,7 +44,7 @@ void ym3812_reset_chip(void *chip); int ym3812_write(void *chip, int a, int v); unsigned char ym3812_read(void *chip, int a); int ym3812_timer_over(void *chip, int c); -void ym3812_update_one(void *chip, OPLSAMPLE *buffer, int length); +void ym3812_update_one(void *chip, write_stream_view &buffer); void ym3812_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, device_t *device); void ym3812_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, device_t *device); @@ -77,7 +77,7 @@ int ym3526_timer_over(void *chip, int c); ** '*buffer' is the output buffer pointer ** 'length' is the number of samples that should be generated */ -void ym3526_update_one(void *chip, OPLSAMPLE *buffer, int length); +void ym3526_update_one(void *chip, write_stream_view &buffer); void ym3526_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, device_t *device); void ym3526_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, device_t *device); @@ -100,7 +100,7 @@ void y8950_reset_chip(void *chip); int y8950_write(void *chip, int a, int v); unsigned char y8950_read (void *chip, int a); int y8950_timer_over(void *chip, int c); -void y8950_update_one(void *chip, OPLSAMPLE *buffer, int length); +void y8950_update_one(void *chip, write_stream_view &buffer); void y8950_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, device_t *device); void y8950_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, device_t *device); diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp index 41fbfc0a4c4..2a213408095 100644 --- a/src/devices/sound/gaelco.cpp +++ b/src/devices/sound/gaelco.cpp @@ -76,10 +76,10 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_typ Writes length bytes to the sound buffer ============================================================================*/ -void gaelco_gae1_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gaelco_gae1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* fill all data needed */ - for (int j = 0; j < samples; j++) + for (int j = 0; j < outputs[0].samples(); j++) { int output_l = 0, output_r = 0; @@ -177,12 +177,12 @@ void gaelco_gae1_device::sound_stream_update_legacy(sound_stream &stream, stream #endif /* now that we have computed all channels, save current data to the output buffer */ - outputs[0][j] = output_l; - outputs[1][j] = output_r; + outputs[0].put_int(j, output_l, 32768); + outputs[1].put_int(j, output_r, 32768); } - if (wavraw) - wav_add_data_32lr(wavraw, outputs[0], outputs[1], samples, 0); +// if (wavraw) +// wav_add_data_buffer(wavraw, outputs[0], outputs[1]); } /*============================================================================ @@ -253,7 +253,7 @@ void gaelco_gae1_device::gaelcosnd_w(offs_t offset, uint16_t data, uint16_t mem_ void gaelco_gae1_device::device_start() { u32 rate = clock() / 128; - m_stream = stream_alloc_legacy(0, 2, rate); + m_stream = stream_alloc(0, 2, rate); /* init volume table */ for (int vol = 0; vol < VOLUME_LEVELS; vol++) diff --git a/src/devices/sound/gaelco.h b/src/devices/sound/gaelco.h index 4f7eeaeb7a7..a598c64345d 100644 --- a/src/devices/sound/gaelco.h +++ b/src/devices/sound/gaelco.h @@ -43,7 +43,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp index 42944daf152..2fc1c81e5b0 100644 --- a/src/devices/sound/gb.cpp +++ b/src/devices/sound/gb.cpp @@ -142,7 +142,7 @@ cgb04_apu_device::cgb04_apu_device(const machine_config &mconfig, const char *ta void gameboy_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_channel = stream_alloc(0, 2, SAMPLE_RATE_OUTPUT_ADAPTIVE); m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameboy_sound_device::timer_callback),this)); m_timer->adjust(clocks_to_attotime(FRAME_CYCLES/128), 0, clocks_to_attotime(FRAME_CYCLES/128)); @@ -1211,18 +1211,18 @@ void cgb04_apu_device::apu_power_off() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void gameboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gameboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outputl = outputs[0]; - stream_sample_t *outputr = outputs[1]; - while (samples-- > 0) + auto &outputl = outputs[0]; + auto &outputr = outputs[1]; + for (int sampindex = 0; sampindex < outputl.samples(); sampindex++) { - stream_sample_t sample; - stream_sample_t left = 0; - stream_sample_t right = 0; + s32 sample; + s32 left = 0; + s32 right = 0; /* Mode 1 - Wave with Envelope and Sweep */ if (m_snd_1.on) @@ -1269,12 +1269,8 @@ void gameboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stre left *= m_snd_control.vol_left; right *= m_snd_control.vol_right; - /* pump up the volume */ - left <<= 6; - right <<= 6; - /* Update the buffers */ - *outputl++ = left; - *outputr++ = right; + outputl.put_int(sampindex, left, 32768 / 64); + outputr.put_int(sampindex, right, 32768 / 64); } } diff --git a/src/devices/sound/gb.h b/src/devices/sound/gb.h index a0ea67ed0a8..fee26bd8a74 100644 --- a/src/devices/sound/gb.h +++ b/src/devices/sound/gb.h @@ -25,7 +25,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; protected: enum diff --git a/src/devices/sound/hc55516.cpp b/src/devices/sound/hc55516.cpp index 6397d2c927c..2d96ad2cb3b 100644 --- a/src/devices/sound/hc55516.cpp +++ b/src/devices/sound/hc55516.cpp @@ -1,8 +1,18 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Jonathan Gevaryahu +// thanks-to:Zonn Moore /***************************************************************************** - Harris HC-55516 (and related) emulator + Continuously Variable Slope Demodulator standalone chip emulator: + Harris HC-55516 (sometimes labeled HCI-55516 or HC1-55516) + Harris HC-55532 (sometimes labeled HCI-55532 or HC1-55532) [preliminary] + Motorola MC-3417/MC-34115 + Motorola MC-3418 + TODO: research HC-55536 and HC-55564 differences vs HC-55516 (better auto-zeroing, and removal of the encoder offset compensation DAC?) + + Driver TODOs: + /src/mame/audio/exidy440.cpp has its own internal implementation of the MC3417 and MC3418, it should be using this file instead + *****************************************************************************/ @@ -10,7 +20,7 @@ #include "hc55516.h" -/* 4x oversampling */ +/* fixed samplerate of 192khz */ #define SAMPLE_RATE (48000 * 4) #define INTEGRATOR_LEAK_TC 0.001 @@ -18,36 +28,26 @@ #define FILTER_CHARGE_TC 0.004 #define FILTER_MIN 0.0416 #define FILTER_MAX 1.0954 -#define SAMPLE_GAIN 10000.0 - - - - -DEFINE_DEVICE_TYPE(HC55516, hc55516_device, "hc55516", "HC-55516") - -hc55516_device::hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : hc55516_device(mconfig, HC55516, tag, owner, clock) -{ -} - -hc55516_device::hc55516_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, type, tag, owner, clock), - device_sound_interface(mconfig, *this), - m_channel(nullptr), - m_active_clock_hi(0), - m_shiftreg_mask(0), - m_last_clock_state(0), - m_digit(0), - m_new_digit(0), - m_shiftreg(0), - m_curr_sample(0), - m_next_sample(0), - m_update_count(0), - m_filter(0), - m_integrator(0), - m_charge(0), - m_decay(0), - m_leak(0) +#define SAMPLE_GAIN (10000.0 / 32768.0) + + +//##################################### +// COMMON +//##################################### +cvsd_device_base::cvsd_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool active_clock_edge, uint8_t shiftreg_mask) + : device_t(mconfig, type, tag, owner, clock) + , device_sound_interface(mconfig, *this) + , m_clock_state_push_cb(*this) + , m_digin_pull_cb(*this) + , m_digout_push_cb(*this) + , m_active_clock_edge(active_clock_edge) + , m_shiftreg_mask(shiftreg_mask) + , m_last_clock_state(false) + , m_buffered_bit(false) + , m_shiftreg(0) + , m_curr_sample(0) + , m_next_sample(0) + , m_samples_generated(0) { } @@ -55,240 +55,490 @@ hc55516_device::hc55516_device(const machine_config &mconfig, device_type type, // device_start - device-specific startup //------------------------------------------------- -void hc55516_device::device_start() +void cvsd_device_base::device_start() { - start_common(0x07, true); + /* create the stream */ + m_stream = stream_alloc(0, 1, SAMPLE_RATE); + + save_item(NAME(m_last_clock_state)); + save_item(NAME(m_buffered_bit)); + save_item(NAME(m_shiftreg)); + save_item(NAME(m_curr_sample)); + save_item(NAME(m_next_sample)); + save_item(NAME(m_samples_generated)); } //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- -void hc55516_device::device_reset() +void cvsd_device_base::device_reset() { m_last_clock_state = 0; } -DEFINE_DEVICE_TYPE(MC3417, mc3417_device, "mc3417", "MC3417") +//------------------------------------------------- +// device_clock_changed - device-specific samplerate change +//------------------------------------------------- +/*void cvsd_device_base::device_clock_changed() +{ + // do nothing. + //m_stream->set_sample_rate(clock()); +}*/ -mc3417_device::mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : hc55516_device(mconfig, MC3417, tag, owner, clock) +READ_LINE_MEMBER( cvsd_device_base::clock_r ) { + // prevent debugger from changing the internal state + if (!machine().side_effects_disabled()) + m_stream->update(); /* bring up to date first */ + return clock_state_r(); } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- +WRITE_LINE_MEMBER( cvsd_device_base::mclock_w ) +{ + clock_w(state); +} -void mc3417_device::device_start() +WRITE_LINE_MEMBER( cvsd_device_base::digin_w ) { - start_common(0x07, false); + digit_w(state); } +// the following encode related functions don't do anything yet, don't call them. +/*void cvsd_device_base::audio_in_w(int16_t data) +{ + assert(0); +}*/ -DEFINE_DEVICE_TYPE(MC3418, mc3418_device, "mc3418", "MC3418") +WRITE_LINE_MEMBER( cvsd_device_base::dec_encq_w ) +{ + assert(0); +} -mc3418_device::mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : hc55516_device(mconfig, MC3418, tag, owner, clock) +READ_LINE_MEMBER( cvsd_device_base::digout_r ) { + return 0; } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- +// default and stub implementations -void mc3418_device::device_start() +inline bool cvsd_device_base::is_external_oscillator() { - start_common(0x0f, false); + return clock() != 0; } +inline bool cvsd_device_base::is_clock_changed(bool clock_state) +{ + return ((!m_last_clock_state && clock_state) || + (m_last_clock_state && !clock_state)); +} -void hc55516_device::start_common(uint8_t _shiftreg_mask, int _active_clock_hi) +inline bool cvsd_device_base::is_active_clock_transition(bool clock_state) { - /* compute the fixed charge, decay, and leak time constants */ - m_charge = pow(exp(-1.0), 1.0 / (FILTER_CHARGE_TC * 16000.0)); - m_decay = pow(exp(-1.0), 1.0 / (FILTER_DECAY_TC * 16000.0)); - m_leak = pow(exp(-1.0), 1.0 / (INTEGRATOR_LEAK_TC * 16000.0)); + return ((clock_state != m_last_clock_state) && + (clock_state == m_active_clock_edge)); +} - m_shiftreg_mask = _shiftreg_mask; - m_active_clock_hi = _active_clock_hi; - m_last_clock_state = 0; +inline bool cvsd_device_base::current_clock_state() +{ + // keep track of the clock state given its previous state and the number of samples produced + // i.e. if we generated m_samples_generated samples, at a sample rate of SAMPLE_RATE, then are we on a positive or negative level of a squarewave at clock() hz? SAMPLE_RATE may not be an integer multiple of clock() + //uint64_t fractions_of_second = (((uint64_t)m_samples_generated)<<32) / SAMPLE_RATE; // 32.32 bits of seconds passed so far + //uint32_t clock_edges_passed = (fractions_of_second * clock() * 2)>>32 + //return (((((uint64_t)m_samples_generated<<32) * clock() * 2 / SAMPLE_RATE)>>32) & 0x1)?true:false; + return (((uint64_t)m_samples_generated * clock() * 2 / SAMPLE_RATE) & 0x01)?true:false; +} - /* create the stream */ - m_channel = stream_alloc_legacy(0, 1, SAMPLE_RATE); +void cvsd_device_base::digit_w(int digit) +{ + m_stream->update(); + m_buffered_bit = digit ? true : false; +} - save_item(NAME(m_last_clock_state)); - save_item(NAME(m_digit)); - save_item(NAME(m_new_digit)); - save_item(NAME(m_shiftreg)); - save_item(NAME(m_curr_sample)); - save_item(NAME(m_next_sample)); - save_item(NAME(m_update_count)); - save_item(NAME(m_filter)); - save_item(NAME(m_integrator)); +void cvsd_device_base::clock_w(int state) +{ + /* update the output buffer first */ + m_stream->update(); + bool clock_state = state ? true : false; + + /* only makes sense for setups with a software driven clock */ + assert(!is_external_oscillator()); + + /* speech clock changing? */ + if (is_clock_changed(clock_state)) + { + /* clear the update count */ + m_samples_generated = 0; + process_bit(m_buffered_bit, clock_state); + } + + /* update the clock */ + m_last_clock_state = clock_state; } -inline int hc55516_device::is_external_oscillator() +int cvsd_device_base::clock_state_r() { - return clock() != 0; + /* only makes sense for setups with an external oscillator */ + assert(is_external_oscillator()); + + m_stream->update(); + + return current_clock_state(); } +void cvsd_device_base::process_bit(bool bit, bool clock_state) +{ + // stub +} -inline int hc55516_device::is_active_clock_transition(int clock_state) +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cvsd_device_base::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + // Stub, just return silence + auto &buffer = outputs[0]; + + m_samples_generated += buffer.samples(); + if (m_samples_generated >= SAMPLE_RATE) + m_samples_generated -= SAMPLE_RATE; + buffer.fill(0); +} + + +//######################################### +// HC55516 +//######################################### +DEFINE_DEVICE_TYPE(HC55516, hc55516_device, "hc55516", "HC-55516") + +hc55516_device::hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : hc55516_device(mconfig, HC55516, tag, owner, clock, 0xfc0, 6, 0xfc1, 4) +{ +} + +// overridable type for hc55532 etc +hc55516_device::hc55516_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t sylmask, int32_t sylshift, int32_t syladd, int32_t intshift) + : cvsd_device_base(mconfig, type, tag, owner, clock, RISING, 0x7) + , m_agc_push_cb(*this) + , m_fzq_pull_cb(*this) + , m_sylmask(sylmask) + , m_sylshift(sylshift) + , m_syladd(syladd) + , m_intshift(intshift) + , m_sylfilter(0) + , m_intfilter(0) + , m_agc(true) + , m_buffered_fzq(true) { - return (( m_active_clock_hi && !m_last_clock_state && clock_state) || - (!m_active_clock_hi && m_last_clock_state && !clock_state)); } +//------------------------------------------------- +// device_start - device-specific start +//------------------------------------------------- -inline int hc55516_device::current_clock_state() +void hc55516_device::device_start() { - return ((uint64_t)m_update_count * clock() * 2 / SAMPLE_RATE) & 0x01; + cvsd_device_base::device_start(); + save_item(NAME(m_sylfilter)); + save_item(NAME(m_intfilter)); + save_item(NAME(m_agc)); + save_item(NAME(m_buffered_fzq)); + + /* resolve lines */ + m_agc_push_cb.resolve(); + m_fzq_pull_cb.resolve(); } +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- -void hc55516_device::process_digit() +void hc55516_device::device_reset() { - double integrator = m_integrator, temp; + cvsd_device_base::device_reset(); + // simulate /FZ having been held for a while + m_sylfilter = 0x3f; + m_intfilter = 0; + m_agc = true; + m_buffered_fzq = true; // assuming /FZ was just released and is now high/inactive +} - /* shift the bit into the shift register */ - m_shiftreg = (m_shiftreg << 1) | m_digit; +// device specific functions - /* move the estimator up or down a step based on the bit */ - if (m_digit) - integrator += m_filter; - else - integrator -= m_filter; +WRITE_LINE_MEMBER( hc55516_device::fzq_w ) +{ + m_buffered_fzq = state; +} - /* simulate leakage */ - integrator *= m_leak; +READ_LINE_MEMBER( hc55516_device::agc_r ) +{ + // prevent debugger from changing the internal state + if (!machine().side_effects_disabled()) + m_stream->update(); /* bring up to date first */ + return m_agc; +} + +void hc55516_device::process_bit(bool bit, bool clock_state) +{ + bool frozen = ( ( (m_intfilter >= 0x180) && (!bit) ) || + ( (m_intfilter <= -0x180) && (bit) ) ); - /* if we got all 0's or all 1's in the last n bits, bump the step up */ - if (((m_shiftreg & m_shiftreg_mask) == 0) || - ((m_shiftreg & m_shiftreg_mask) == m_shiftreg_mask)) + int32_t sum; + if (is_active_clock_transition(clock_state)) { - m_filter = FILTER_MAX - ((FILTER_MAX - m_filter) * m_charge); + // grab the /FZ state; if the callback is present, use that, otherwise use the buffered state + bool fzq_state = false; + if (!m_fzq_pull_cb.isnull()) + fzq_state = m_fzq_pull_cb(); + else + fzq_state = m_buffered_fzq; + + if (!fzq_state) // /FZ is active low, if it is active, the input bit is ignored and the inverse of the previous bit in the shifter is used instead + bit = !(m_shiftreg&1); + + /* shift the new bit into the shift register */ + m_shiftreg = (m_shiftreg << 1) | (bit?1:0); + + /* if we got all 0's or all 1's in the last n bits... */ + if (((m_shiftreg & m_shiftreg_mask) == 0) || + ((m_shiftreg & m_shiftreg_mask) == m_shiftreg_mask)) + { + // coincidence is true + if (!frozen) m_sylfilter += (((~m_sylfilter) & m_sylmask) >> m_sylshift); + } + else + { + // coincidence is false + if (!frozen) m_sylfilter += (((~m_sylfilter) & m_sylmask) >> m_sylshift) + m_syladd; + } + m_sylfilter &= 0xfff; - if (m_filter > FILTER_MAX) - m_filter = FILTER_MAX; + sum = ( ((~m_intfilter) >> m_intshift) + 1 ) & 0x3ff; } - - /* simulate decay */ - else + else // inactive clock transition { - m_filter *= m_decay; + if (m_shiftreg&1) + { + sum = ( ( ~std::max(2, m_sylfilter >> 6) ) + 1 ) & 0x3ff; + } + else + { + sum = std::max(2, m_sylfilter >> 6) & 0x3ff; + } + } - if (m_filter < FILTER_MIN) - m_filter = FILTER_MIN; + if (sum & 0x200) + sum |= ~0x3ff; // sign extend + + if (!frozen) + { + m_intfilter += sum; + m_intfilter &= 0x3ff; + if (m_intfilter & 0x200) m_intfilter |= ~0x3ff; // sign extend } - /* compute the sample as a 32-bit word */ - temp = integrator * SAMPLE_GAIN; - m_integrator = integrator; + /* scale the result (-512 to 511) to -32768 thru 32767 */ + /* + F E D C B A 9 8 7 6 5 4 3 2 1 0 + 9 8 7 6 5 4 3 2 1 0/9 8 7 6 5 4 + */ + m_next_sample = ( (m_intfilter << 6) | ( ((m_intfilter & 0x3ff) ^ 0x200 ) >> 4 ) ); - /* compress the sample range to fit better in a 16-bit word */ - if (temp < 0) - m_next_sample = (int)(temp / (-temp * (1.0 / 32768.0) + 1.0)); + // update agc state + if ( (m_intfilter >= 0x100) || (m_intfilter <= -0x100) ) + m_agc = false; else - m_next_sample = (int)(temp / (temp * (1.0 / 32768.0) + 1.0)); + m_agc = true; + + // push agc state if a callback is present + if (!m_agc_push_cb.isnull()) + m_agc_push_cb(m_agc); } -void hc55516_device::clock_w(int state) +//------------------------------------------------- +// sound_stream_update_legacy - handle a stream update +//------------------------------------------------- + +void hc55516_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - uint8_t clock_state = state ? true : false; + auto &buffer = outputs[0]; - /* only makes sense for setups with a software driven clock */ - assert(!is_external_oscillator()); +/* + if (!is_external_oscillator()) + { + // track how many samples we've updated without a clock; if it's been more than 1/32 of a second, output silence + m_samples_generated += buffer.samples(); + if (m_samples_generated > SAMPLE_RATE / 32) + { + m_samples_generated = SAMPLE_RATE; + m_next_sample = 0; + } + } +*/ - /* speech clock changing? */ - if (is_active_clock_transition(clock_state)) + if (is_external_oscillator()) { - /* update the output buffer before changing the registers */ - m_channel->update(); + /* external oscillator */ + for (int i = 0; i < buffer.samples(); i++) + { + buffer.put_int(i, m_next_sample, 32768); - /* clear the update count */ - m_update_count = 0; + m_samples_generated++; - process_digit(); + uint8_t clock_state = current_clock_state(); + + /* pull in next digit on the appropriate edge of the clock */ + if (is_clock_changed(clock_state)) + { + process_bit(m_buffered_bit, clock_state); + } + + m_last_clock_state = clock_state; + } } - /* update the clock */ - m_last_clock_state = clock_state; + /* software driven clock */ + else + for (int i = 0; i < buffer.samples(); i++) + buffer.put_int(i, m_next_sample, 32768); } -void hc55516_device::digit_w(int digit) + +//######################################### +// HC55532 +//######################################### +DEFINE_DEVICE_TYPE(HC55532, hc55532_device, "hc55532", "HC-55532") + +hc55532_device::hc55532_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : hc55516_device(mconfig, HC55532, tag, owner, clock, 0xf80, 7, 0xfe1, 5) { - if (is_external_oscillator()) - { - m_channel->update(); - m_new_digit = digit & 1; - } - else - m_digit = digit & 1; } +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- -int hc55516_device::clock_state_r() +void hc55532_device::device_reset() { - /* only makes sense for setups with an external oscillator */ - assert(is_external_oscillator()); + cvsd_device_base::device_reset(); + // simulate /FZ having been held for a while + m_sylfilter = 0x7f; + m_intfilter = 0; + m_agc = true; + m_buffered_fzq = true; // assuming /FZ was just released and is now high/inactive +} - m_channel->update(); - return current_clock_state(); + +//########################################## +// MC3417 +//########################################## +DEFINE_DEVICE_TYPE(MC3417, mc3417_device, "mc3417", "MC3417") + +mc3417_device::mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mc3417_device(mconfig, MC3417, tag, owner, clock, 0x7) +{ } +// overridable type for mc3418 etc +mc3417_device::mc3417_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t shiftreg_mask) + : cvsd_device_base(mconfig, type, tag, owner, clock, FALLING, shiftreg_mask) + , m_charge(pow(exp(-1.0), 1.0 / (FILTER_CHARGE_TC * 16000.0))) + , m_decay(pow(exp(-1.0), 1.0 / (FILTER_DECAY_TC * 16000.0))) + , m_leak(pow(exp(-1.0), 1.0 / (INTEGRATOR_LEAK_TC * 16000.0))) + , m_sylfilter_d(0.0) + , m_intfilter_d(0.0) +{ +} //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// device_start - device-specific startup //------------------------------------------------- -void hc55516_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mc3417_device::device_start() { - stream_sample_t *buffer = outputs[0]; - int i; - int32_t sample, slope; + cvsd_device_base::device_start(); + save_item(NAME(m_sylfilter_d)); + save_item(NAME(m_intfilter_d)); +} - /* zero-length? bail */ - if (samples == 0) - return; +void mc3417_device::process_bit(bool bit, bool clock_state) +{ + if (is_active_clock_transition(clock_state)) + { + + /* shift the new bit into the shift register */ + m_shiftreg = (m_shiftreg << 1) | (bit?1:0); + + /* move the estimator up or down a step based on the bit */ + if (!bit) + m_intfilter_d += m_sylfilter_d; + else + m_intfilter_d -= m_sylfilter_d; + + /* simulate leakage */ + m_intfilter_d *= m_leak; + + /* if we got all 0's or all 1's in the last n bits, bump the step up */ + if (((m_shiftreg & m_shiftreg_mask) == 0) || + ((m_shiftreg & m_shiftreg_mask) == m_shiftreg_mask)) + { + // coincidence is true + m_sylfilter_d = FILTER_MAX - ((FILTER_MAX - m_sylfilter_d) * m_charge); + + if (m_sylfilter_d > FILTER_MAX) + m_sylfilter_d = FILTER_MAX; + } + else + { + m_sylfilter_d *= m_decay; + + if (m_sylfilter_d < FILTER_MIN) + m_sylfilter_d = FILTER_MIN; + } + + /* compute the sample as a 32-bit word */ + m_next_sample = m_intfilter_d * SAMPLE_GAIN; + } +} + +void mc3417_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + auto &buffer = outputs[0]; if (!is_external_oscillator()) { - /* track how many samples we've updated without a clock */ - m_update_count += samples; - if (m_update_count > SAMPLE_RATE / 32) + /* track how many samples we've updated without a clock; if it's been more than 1/32 of a second, output silence */ + m_samples_generated += buffer.samples(); + if (m_samples_generated > SAMPLE_RATE / 32) { - m_update_count = SAMPLE_RATE; + m_samples_generated = SAMPLE_RATE; m_next_sample = 0; } } /* compute the interpolation slope */ - sample = m_curr_sample; - slope = ((int32_t)m_next_sample - sample) / samples; + stream_buffer::sample_t sample = m_curr_sample; + stream_buffer::sample_t slope = (m_next_sample - sample) / buffer.samples(); m_curr_sample = m_next_sample; if (is_external_oscillator()) { /* external oscillator */ - for (i = 0; i < samples; i++, sample += slope) + for (int i = 0; i < buffer.samples(); i++, sample += slope) { - uint8_t clock_state; - - *buffer++ = sample; + buffer.put(i, sample); - m_update_count++; + m_samples_generated++; - clock_state = current_clock_state(); + uint8_t clock_state = current_clock_state(); /* pull in next digit on the appropriate edge of the clock */ - if (is_active_clock_transition(clock_state)) + if (is_clock_changed(clock_state)) { - m_digit = m_new_digit; - - process_digit(); + process_bit(m_buffered_bit, clock_state); } m_last_clock_state = clock_state; @@ -297,16 +547,18 @@ void hc55516_device::sound_stream_update_legacy(sound_stream &stream, stream_sam /* software driven clock */ else - for (i = 0; i < samples; i++, sample += slope) - *buffer++ = sample; + for (int i = 0; i < buffer.samples(); i++, sample += slope) + buffer.put(i, sample); } -void mc3417_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - hc55516_device::sound_stream_update_legacy(stream, inputs, outputs, samples); -} -void mc3418_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) + +//########################################## +// MC3418 +//########################################## +DEFINE_DEVICE_TYPE(MC3418, mc3418_device, "mc3418", "MC3418") + +mc3418_device::mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mc3417_device(mconfig, MC3418, tag, owner, clock, 0xf) { - hc55516_device::sound_stream_update_legacy(stream, inputs, outputs, samples); } diff --git a/src/devices/sound/hc55516.h b/src/devices/sound/hc55516.h index 96284167c52..48c1b768a4f 100644 --- a/src/devices/sound/hc55516.h +++ b/src/devices/sound/hc55516.h @@ -1,95 +1,176 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Jonathan Gevaryahu +// thanks-to:Zonn Moore #ifndef MAME_SOUND_HC55516_H #define MAME_SOUND_HC55516_H #pragma once -class hc55516_device : public device_t, public device_sound_interface +class cvsd_device_base : public device_t, public device_sound_interface { public: - hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - /* sets the digit (0 or 1) */ - void digit_w(int digit); - - /* sets the clock state (0 or 1, clocked on the rising edge) */ - void clock_w(int state); - - /* returns whether the clock is currently LO or HI */ - int clock_state_r(); + enum + { + RISING=true, + FALLING=false + }; + + auto clock_state_cb() { return m_clock_state_push_cb.bind(); } // A clock state change callback. Using this is a bad idea due to lack of synchronization to other devices. TODO: remove this. + auto digin_cb() { return m_digin_pull_cb.bind(); } // Digital in pull callback function, for use if a clock is specified and we need to pull in the digital in pin state, otherwise unused. TODO: this is not hooked up yet, and should be. + auto digout_cb() { return m_digout_push_cb.bind(); } // Digital out push callback function. TODO: this is not hooked up or implemented yet, although it is only really relevant for devices which use the CVSD chips in encode mode. + + READ_LINE_MEMBER( clock_r ); // Clock pull, really only relevant of something manually polls the clock (and clock is specified), which is a very bad design pattern and will cause synchronization/missed clock transition issues. This function WILL ASSERT if it is called and the clock hz is NOT specified! TODO: remove all use of this, and remove it. + WRITE_LINE_MEMBER( mclock_w ); // Clock push; this function WILL ASSERT if it is called and the clock hz IS specified! + WRITE_LINE_MEMBER( digin_w ); // Digital in push to the pin, as a pseudo 'buffer' implemented within the cvsd device itself. This is not technically accurate to hardware, and in the future should be deprecated in favor of digin_cb once the latter is implemented. + WRITE_LINE_MEMBER( dec_encq_w ); //DEC/ENC decode/encode select push. This is not implemented yet, and relies on an input audio stream. TODO: implement this beyond a do-nothing stub + READ_LINE_MEMBER( digout_r ); // Digital out pull. TODO: this is not hooked up or implemented yet, although it is only really relevant for devices which use the CVSD chips in encode mode. + //void audio_in_w(stream_buffer::sample_t data); // Audio In pin, an analog value of the audio waveform being pushed to the chip. TODO: this is not hooked up or implemented yet, and this should really be handled as an input stream from a separate DAC device, not a value push function at all. + void digit_w(int digit); /* sets the buffered digit (0 or 1), common to all chips. TODO: replace all use of this with digin_cb once implemented */ + void clock_w(int state); /* sets the clock state (0 or 1, clocked on the rising edge), common to all chips */ + virtual int clock_state_r(); /* returns whether the clock is currently LO or HI, common to all chips. TODO: get rid of all use of this, then get rid of it. */ protected: - hc55516_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + cvsd_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool active_clock_edge, uint8_t shiftreg_mask); // device-level overrides virtual void device_start() override; virtual void device_reset() override; + //virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; - void start_common(uint8_t _shiftreg_mask, int _active_clock_hi); + // callbacks + devcb_write_line m_clock_state_push_cb; ///TODO: get rid of this, if you use it you should feel bad + devcb_read_line m_digin_pull_cb; + devcb_write_line m_digout_push_cb; - // internal state - sound_stream *m_channel; - int m_active_clock_hi; - uint8_t m_shiftreg_mask; + // const state defined by constructor + const bool m_active_clock_edge; + const uint8_t m_shiftreg_mask; // it may be desirable to allow this to be changed by the user under some circumstances - uint8_t m_last_clock_state; - uint8_t m_digit; - uint8_t m_new_digit; + // internal state + sound_stream *m_stream; + bool m_last_clock_state; + bool m_buffered_bit; uint8_t m_shiftreg; + stream_buffer::sample_t m_curr_sample; + stream_buffer::sample_t m_next_sample; + uint32_t m_samples_generated; - int16_t m_curr_sample; - int16_t m_next_sample; + // specific internal handler overrides, overridden by each chip + virtual void process_bit(bool bit, bool clock_state); - uint32_t m_update_count; + ///TODO: get rid of these + inline bool is_external_oscillator(); + inline bool is_clock_changed(bool clock_state); + inline bool is_active_clock_transition(bool clock_state); + inline bool current_clock_state(); - double m_filter; - double m_integrator; - - double m_charge; - double m_decay; - double m_leak; - - inline int is_external_oscillator(); - inline int is_active_clock_transition(int clock_state); - inline int current_clock_state(); - void process_digit(); }; -class mc3417_device : public hc55516_device +class hc55516_device : public cvsd_device_base { public: - mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + auto fzq_cb() { return m_fzq_pull_cb.bind(); } // /FZ (partial reset) pull callback, ok to leave unconnected (we assume it is pulled high) + auto agc_cb() { return m_agc_push_cb.bind(); } // AGC callback function, called to push the state if the AGC pin changes, ok to leave unconnected + + WRITE_LINE_MEMBER( fzq_w ); // /FZ (partial reset) push + READ_LINE_MEMBER( agc_r ); // AGC pull + /* TODO: These are only relevant for encode mode, which isn't done yet! */ + //WRITE_LINE_MEMBER( aptq_w ); // /APT (silence encoder output) push + //WRITE_LINE_MEMBER( dec_encq_w ); // DEC/ENC decode/encode select push protected: + // overridable type for subclass + hc55516_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t sylmask, int32_t sylshift, int32_t syladd, int32_t intshift); + // device-level overrides virtual void device_start() override; + virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + + // callbacks + devcb_write_line m_agc_push_cb; + devcb_read_line m_fzq_pull_cb; + + // const coefficients defined by constructor + const uint32_t m_sylmask; + const int32_t m_sylshift; + const int32_t m_syladd; + const int32_t m_intshift; + + // internal state + int32_t m_sylfilter; + int32_t m_intfilter; + bool m_agc; + bool m_buffered_fzq; + + // internal handlers + virtual void process_bit(bool bit, bool clock_state) override; }; -class mc3418_device : public hc55516_device +class hc55532_device : public hc55516_device { public: - mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + hc55532_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +protected: + // device-level overrides + virtual void device_reset() override; +}; + + +class mc3417_device : public cvsd_device_base +{ +public: + mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // override for clock_w + //virtual void clock_w(int state) override; protected: + // overridable type for subclass + mc3417_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t shiftreg_mask); + // device-level overrides virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + + // const coefficients defined by constructor; should these be adjustable by the user or externally defined, as they are implemented using a set of two small lowpass filters outside the chip? + const double m_charge; + const double m_decay; + const double m_leak; + + // internal state + double m_sylfilter_d; + double m_intfilter_d; + + // internal handlers + virtual void process_bit(bool bit, bool clock_state) override; +}; + + +class mc3418_device : public mc3417_device +{ +public: + mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(HC55516, hc55516_device) +DECLARE_DEVICE_TYPE(HC55532, hc55532_device) +//DECLARE_DEVICE_TYPE(HC55536, hc55536_device) +//DECLARE_DEVICE_TYPE(HC55564, hc55564_device) DECLARE_DEVICE_TYPE(MC3417, mc3417_device) +//DECLARE_DEVICE_TYPE(MC34115, mc34115_device) DECLARE_DEVICE_TYPE(MC3418, mc3418_device) #endif // MAME_SOUND_HC55516_H diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp index fd2ef5b9689..31e143fea8c 100644 --- a/src/devices/sound/huc6230.cpp +++ b/src/devices/sound/huc6230.cpp @@ -21,12 +21,12 @@ constexpr int clamp(int val, int min, int max) { return std::min(max, std::max(min, val)); } -void huc6230_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void huc6230_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { - outputs[0][i] = inputs[0][i]; - outputs[1][i] = inputs[1][i]; + s32 samp0 = inputs[0].get(i) * 32768.0; + s32 samp1 = inputs[1].get(i) * 32768.0; for (int adpcm = 0; adpcm < 2; adpcm++) { @@ -35,9 +35,12 @@ void huc6230_device::sound_stream_update_legacy(sound_stream &stream, stream_sam if (!channel->m_playing) continue; - outputs[0][i] = clamp(outputs[0][i] + ((channel->m_output * channel->m_lvol) >> 3), -32768, 32767); - outputs[1][i] = clamp(outputs[1][i] + ((channel->m_output * channel->m_rvol) >> 3), -32768, 32767); + samp0 = clamp(samp0 + ((channel->m_output * channel->m_lvol) >> 3), -32768, 32767); + samp1 = clamp(samp1 + ((channel->m_output * channel->m_rvol) >> 3), -32768, 32767); } + + outputs[0].put_int(i, samp0, 32768); + outputs[1].put_int(i, samp1, 32768); } } @@ -172,7 +175,7 @@ void huc6230_device::device_start() m_vca_cb.resolve_safe(); - m_stream = stream_alloc_legacy(2, 2, clock() / 6); + m_stream = stream_alloc(2, 2, clock() / 6); m_adpcm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(huc6230_device::adpcm_timer),this)); for (int i = 0; i < 2; i++) diff --git a/src/devices/sound/huc6230.h b/src/devices/sound/huc6230.h index 27e67ce41a3..a2ca7824617 100644 --- a/src/devices/sound/huc6230.h +++ b/src/devices/sound/huc6230.h @@ -28,7 +28,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct adpcm_channel { diff --git a/src/devices/sound/i5000.cpp b/src/devices/sound/i5000.cpp index 747d5e96e19..6978b9336f3 100644 --- a/src/devices/sound/i5000.cpp +++ b/src/devices/sound/i5000.cpp @@ -44,7 +44,7 @@ void i5000snd_device::device_start() m_lut_volume[0xff] = 0; // create the stream - m_stream = stream_alloc_legacy(0, 2, clock() / 0x400); + m_stream = stream_alloc(0, 2, clock() / 0x400); m_rom_base = (uint16_t *)device().machine().root_device().memregion(":i5000snd")->base(); m_rom_mask = device().machine().root_device().memregion(":i5000snd")->bytes() / 2 - 1; @@ -114,9 +114,9 @@ bool i5000snd_device::read_sample(int ch) } -void i5000snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void i5000snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { int32_t mix_l = 0; int32_t mix_r = 0; @@ -157,8 +157,8 @@ void i5000snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sa mix_l += m_channels[ch].output_l; } - outputs[0][i] = mix_r / 16; - outputs[1][i] = mix_l / 16; + outputs[0].put_int(i, mix_r, 32768 * 16); + outputs[1].put_int(i, mix_l, 32768 * 16); } } diff --git a/src/devices/sound/i5000.h b/src/devices/sound/i5000.h index 0bb994ebdb6..abd84f5ac43 100644 --- a/src/devices/sound/i5000.h +++ b/src/devices/sound/i5000.h @@ -33,7 +33,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; sound_stream *m_stream; diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp index fa570814019..868bcb70bc4 100644 --- a/src/devices/sound/ics2115.cpp +++ b/src/devices/sound/ics2115.cpp @@ -63,7 +63,7 @@ void ics2115_device::device_start() m_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_0),this), this); m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ics2115_device::timer_cb_1),this), this); - m_stream = stream_alloc_legacy(0, 2, clock() / (32 * 32)); + m_stream = stream_alloc(0, 2, clock() / (32 * 32)); m_irq_cb.resolve_safe(); @@ -316,7 +316,7 @@ int ics2115_device::ics2115_voice::update_oscillator() } //TODO: proper interpolation for 8-bit samples (looping) -stream_sample_t ics2115_device::get_sample(ics2115_voice& voice) +s32 ics2115_device::get_sample(ics2115_voice& voice) { const u32 curaddr = voice.osc.acc >> 12; u32 nextaddr; @@ -385,13 +385,13 @@ void ics2115_device::ics2115_voice::update_ramp() } } -int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t * const outputs[2], int samples) +int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_view> &outputs) { bool irq_invalid = false; const u16 fine = 1 << (3*(voice.vol.incr >> 6)); voice.vol.add = (voice.vol.incr & 0x3f)<< (10 - fine); - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { const u32 volacc = (voice.vol.acc >> 10) & 0xffff; const u32 volume = (m_volume[volacc >> 4] * voice.state.ramp) >> 6; @@ -403,15 +403,15 @@ int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t * const ou //final output, even if they are not running. This means that whatever data value //that the voice is pointing at is contributing to the summation. //(austere note: this will of course fix some of the glitches due to multiple transition) - stream_sample_t sample = get_sample(voice); + s32 sample = get_sample(voice); //15-bit volume + (5-bit worth of 32 channel sum) + 16-bit samples = 4-bit extra if (!m_vmode || voice.playing()) { /*if (voice.playing()) {*/ - outputs[0][i] += (sample * vleft) >> (5 + volume_bits - 16); - outputs[1][i] += (sample * vright) >> (5 + volume_bits - 16); + outputs[0].add_int(i, (sample * vleft) >> (5 + volume_bits), 32768); + outputs[1].add_int(i, (sample * vright) >> (5 + volume_bits), 32768); } voice.update_ramp(); @@ -426,10 +426,10 @@ int ics2115_device::fill_output(ics2115_voice& voice, stream_sample_t * const ou return irq_invalid; } -void ics2115_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ics2115_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - memset(outputs[0], 0, samples * sizeof(stream_sample_t)); - memset(outputs[1], 0, samples * sizeof(stream_sample_t)); + outputs[0].fill(0); + outputs[1].fill(0); bool irq_invalid = false; for (int osc = 0; osc <= m_active_osc; osc++) @@ -443,11 +443,11 @@ void ics2115_device::sound_stream_update_legacy(sound_stream &stream, stream_sam /* #ifdef ICS2115_DEBUG u32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12); - stream_sample_t sample = get_sample(voice); + s32 sample = get_sample(voice); logerror("[%06x=%04x]", curaddr, (s16)sample); #endif */ - if (fill_output(voice, outputs, samples)) + if (fill_output(voice, outputs)) irq_invalid = true; #ifdef ICS2115_DEBUG @@ -479,13 +479,6 @@ void ics2115_device::sound_stream_update_legacy(sound_stream &stream, stream_sam logerror("|"); #endif - //rescale - for (int i = 0; i < samples; i++) - { - outputs[0][i] >>= 16; - outputs[1][i] >>= 16; - } - if (irq_invalid) recalc_irq(); diff --git a/src/devices/sound/ics2115.h b/src/devices/sound/ics2115.h index 777ee8eabf4..5dd18fcf4ed 100644 --- a/src/devices/sound/ics2115.h +++ b/src/devices/sound/ics2115.h @@ -39,7 +39,7 @@ protected: virtual void device_clock_changed() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface configuration virtual space_config_vector memory_space_config() const override; @@ -119,8 +119,8 @@ private: void recalc_irq(); // stream helper functions - int fill_output(ics2115_voice& voice, stream_sample_t * const outputs[2], int samples); - stream_sample_t get_sample(ics2115_voice& voice); + int fill_output(ics2115_voice& voice, std::vector<write_stream_view> &outputs); + s32 get_sample(ics2115_voice& voice); u8 read_sample(ics2115_voice& voice, u32 addr) { return m_cache.read_byte((voice.osc.saddr << 20) | (addr & 0xfffff)); } sound_stream *m_stream; diff --git a/src/devices/sound/iopspu.cpp b/src/devices/sound/iopspu.cpp index 73399b1ef2c..0267c31eadb 100644 --- a/src/devices/sound/iopspu.cpp +++ b/src/devices/sound/iopspu.cpp @@ -89,9 +89,10 @@ void iop_spu_device::dma_done(int bank) core.m_status &= ~STATUS_DMA_ACTIVE; } -void iop_spu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void iop_spu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // TODO + outputs[0].fill(0); } TIMER_CALLBACK_MEMBER(iop_spu_device::autodma_done_timer_hack) diff --git a/src/devices/sound/iopspu.h b/src/devices/sound/iopspu.h index 4348e471051..bea55615c04 100644 --- a/src/devices/sound/iopspu.h +++ b/src/devices/sound/iopspu.h @@ -48,7 +48,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // HACK: This timer is currently used to trigger an interrupt after the auto-DMA-transferred buffer would have been // mixed and played back, as the PS2 BIOS pulls a null return address and crashes if we trigger the auto-DMA-complete diff --git a/src/devices/sound/iremga20.cpp b/src/devices/sound/iremga20.cpp index ba49eaa75c4..3ec07d3de35 100644 --- a/src/devices/sound/iremga20.cpp +++ b/src/devices/sound/iremga20.cpp @@ -73,7 +73,7 @@ iremga20_device::iremga20_device(const machine_config &mconfig, const char *tag, void iremga20_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, clock()/4); + m_stream = stream_alloc(0, 2, clock()/4); save_item(NAME(m_regs)); for (int i = 0; i < 4; i++) @@ -126,19 +126,17 @@ void iremga20_device::rom_bank_updated() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void iremga20_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void iremga20_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; + auto &outL = outputs[0]; + auto &outR = outputs[1]; - outL = outputs[0]; - outR = outputs[1]; - - for (int i = 0; i < samples; i++) + for (int i = 0; i < outL.samples(); i++) { - stream_sample_t sampleout = 0; + s32 sampleout = 0; for (auto &ch : m_channel) { @@ -160,9 +158,8 @@ void iremga20_device::sound_stream_update_legacy(sound_stream &stream, stream_sa } } - sampleout >>= 2; - outL[i] = sampleout; - outR[i] = sampleout; + outL.put_int(i, sampleout, 32768 * 4); + outR.put_int(i, sampleout, 32768 * 4); } } diff --git a/src/devices/sound/iremga20.h b/src/devices/sound/iremga20.h index df9942c9ccb..ae60c563d78 100644 --- a/src/devices/sound/iremga20.h +++ b/src/devices/sound/iremga20.h @@ -36,7 +36,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/k005289.cpp b/src/devices/sound/k005289.cpp index bf07743f7d3..00fe18e2c2f 100644 --- a/src/devices/sound/k005289.cpp +++ b/src/devices/sound/k005289.cpp @@ -59,9 +59,7 @@ k005289_device::k005289_device(const machine_config &mconfig, const char *tag, d , m_sound_prom(*this, DEVICE_SELF) , m_stream(nullptr) , m_rate(0) - , m_mixer_table(nullptr) , m_mixer_lookup(nullptr) - , m_mixer_buffer(nullptr) { } @@ -74,10 +72,7 @@ void k005289_device::device_start() { /* get stream channels */ m_rate = clock() / CLOCK_DIVIDER; - m_stream = stream_alloc_legacy(0, 1, m_rate); - - /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - m_mixer_buffer = std::make_unique<short[]>(2 * m_rate); + m_stream = stream_alloc(0, 1, m_rate); /* build the mixer table */ make_mixer_table(2); @@ -101,17 +96,19 @@ void k005289_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void k005289_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void k005289_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; short *mix; int i,v,f; /* zap the contents of the mixer buffer */ - memset(m_mixer_buffer.get(), 0, samples * sizeof(int16_t)); + if (m_mixer_buffer.size() < buffer.samples()) + m_mixer_buffer.resize(buffer.samples()); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); v=m_volume[0]; f=m_frequency[0]; @@ -120,10 +117,10 @@ void k005289_device::sound_stream_update_legacy(sound_stream &stream, stream_sam const unsigned char *w = &m_sound_prom[m_waveform[0]]; int c = m_counter[0]; - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; /* add our contribution */ - for (i = 0; i < samples; i++) + for (i = 0; i < buffer.samples(); i++) { int offs; @@ -143,10 +140,10 @@ void k005289_device::sound_stream_update_legacy(sound_stream &stream, stream_sam const unsigned char *w = &m_sound_prom[m_waveform[1]]; int c = m_counter[1]; - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; /* add our contribution */ - for (i = 0; i < samples; i++) + for (i = 0; i < buffer.samples(); i++) { int offs; @@ -160,9 +157,9 @@ void k005289_device::sound_stream_update_legacy(sound_stream &stream, stream_sam } /* mix it down */ - mix = m_mixer_buffer.get(); - for (i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; + mix = &m_mixer_buffer[0]; + for (i = 0; i < buffer.samples(); i++) + buffer.put(i, m_mixer_lookup[*mix++]); } @@ -174,22 +171,22 @@ void k005289_device::sound_stream_update_legacy(sound_stream &stream, stream_sam void k005289_device::make_mixer_table(int voices) { int count = voices * 128; - int i; int gain = 16; /* allocate memory */ - m_mixer_table = std::make_unique<int16_t[]>(256 * voices); + m_mixer_table = std::make_unique<stream_buffer::sample_t []>(256 * voices); /* find the middle of the table */ - m_mixer_lookup = m_mixer_table.get() + (128 * voices); + m_mixer_lookup = &m_mixer_table[128 * voices]; /* fill in the table - 16 bit case */ - for (i = 0; i < count; i++) + for (int i = 0; i < count; i++) { int val = i * gain * 16 / voices; if (val > 32767) val = 32767; - m_mixer_lookup[ i] = val; - m_mixer_lookup[-i] = -val; + stream_buffer::sample_t fval = stream_buffer::sample_t(val) / 32768.0; + m_mixer_lookup[ i] = fval; + m_mixer_lookup[-i] = -fval; } } diff --git a/src/devices/sound/k005289.h b/src/devices/sound/k005289.h index a8dc7b1d0b0..989ab15ae6d 100644 --- a/src/devices/sound/k005289.h +++ b/src/devices/sound/k005289.h @@ -26,7 +26,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void make_mixer_table(int voices); @@ -36,9 +36,9 @@ private: int m_rate; /* mixer tables and internal buffers */ - std::unique_ptr<int16_t[]> m_mixer_table; - int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; + std::unique_ptr<stream_buffer::sample_t []> m_mixer_table; + stream_buffer::sample_t *m_mixer_lookup; + std::vector<short> m_mixer_buffer; uint32_t m_counter[2]; uint16_t m_frequency[2]; diff --git a/src/devices/sound/k007232.cpp b/src/devices/sound/k007232.cpp index 3b35eeb9d5c..a8b6c135a51 100644 --- a/src/devices/sound/k007232.cpp +++ b/src/devices/sound/k007232.cpp @@ -86,7 +86,7 @@ void k007232_device::device_start() for (auto & elem : m_wreg) elem = 0; - m_stream = stream_alloc_legacy(0, 2, clock()/128); + m_stream = stream_alloc(0, 2, clock()/128); save_item(STRUCT_MEMBER(m_channel, vol)); save_item(STRUCT_MEMBER(m_channel, addr)); @@ -206,14 +206,11 @@ void k007232_device::set_bank(int chan_a_bank, int chan_b_bank) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void k007232_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void k007232_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - memset(outputs[0], 0, samples * sizeof(stream_sample_t)); - memset(outputs[1], 0, samples * sizeof(stream_sample_t)); - if (K007232_LOG_PCM) { for (int i = 0; i < KDAC_A_PCM_MAX; i++) @@ -239,8 +236,9 @@ void k007232_device::sound_stream_update_legacy(sound_stream &stream, stream_sam } } - for (int j = 0; j < samples; j++) + for (int j = 0; j < outputs[0].samples(); j++) { + s32 lsum = 0, rsum = 0; for (int i = 0; i < KDAC_A_PCM_MAX; i++) { channel_t *channel = &m_channel[i]; @@ -279,9 +277,11 @@ void k007232_device::sound_stream_update_legacy(sound_stream &stream, stream_sam int out = (read_sample(i, addr) & 0x7f) - 0x40; - outputs[0][j] += out * vol_a; - outputs[1][j] += out * vol_b; + lsum += out * vol_a; + rsum += out * vol_b; } } + outputs[0].put_int(j, lsum, 32768); + outputs[1].put_int(j, rsum, 32768); } } diff --git a/src/devices/sound/k007232.h b/src/devices/sound/k007232.h index e9a4ba255da..57cb72fcf7b 100644 --- a/src/devices/sound/k007232.h +++ b/src/devices/sound/k007232.h @@ -37,7 +37,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface configuration virtual space_config_vector memory_space_config() const override; diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp index 0e39a94230a..9a1f748580e 100644 --- a/src/devices/sound/k051649.cpp +++ b/src/devices/sound/k051649.cpp @@ -56,7 +56,6 @@ k051649_device::k051649_device(const machine_config &mconfig, const char *tag, d , device_sound_interface(mconfig, *this) , m_stream(nullptr) , m_rate(0) - , m_mixer_table(nullptr) , m_mixer_lookup(nullptr) , m_test(0) { @@ -71,7 +70,7 @@ void k051649_device::device_start() { // get stream channels m_rate = clock()/16; - m_stream = stream_alloc_legacy(0, 1, m_rate); + m_stream = stream_alloc(0, 1, m_rate); // allocate a buffer to mix into - 1 second's worth should be more than enough m_mixer_buffer.resize(2 * m_rate); @@ -140,10 +139,10 @@ void k051649_device::device_clock_changed() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void k051649_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void k051649_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // zap the contents of the mixer buffer std::fill(m_mixer_buffer.begin(), m_mixer_buffer.end(), 0); @@ -159,7 +158,7 @@ void k051649_device::sound_stream_update_legacy(sound_stream &stream, stream_sam const int step = voice.frequency; // add our contribution - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { c += 32; while (c > step) @@ -177,9 +176,9 @@ void k051649_device::sound_stream_update_legacy(sound_stream &stream, stream_sam } // mix it down - stream_sample_t *buffer = outputs[0]; - for (int i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[m_mixer_buffer[i]]; + auto &buffer = outputs[0]; + for (int i = 0; i < buffer.samples(); i++) + buffer.put(i, m_mixer_lookup[m_mixer_buffer[i]]); } @@ -309,16 +308,17 @@ u8 k051649_device::k051649_test_r() void k051649_device::make_mixer_table(int voices) { // allocate memory - m_mixer_table = std::make_unique<s16[]>(512 * voices); + m_mixer_table.resize(512 * voices); // find the middle of the table - m_mixer_lookup = m_mixer_table.get() + (256 * voices); + m_mixer_lookup = &m_mixer_table[256 * voices]; // fill in the table - 16 bit case for (int i = 0; i < (voices * 256); i++) { const int val = std::min(32767, i * DEF_GAIN * 16 / voices); - m_mixer_lookup[ i] = val; - m_mixer_lookup[-i] = -val; + stream_buffer::sample_t fval = stream_buffer::sample_t(val) / 32768.0; + m_mixer_lookup[ i] = fval; + m_mixer_lookup[-i] = -fval; } } diff --git a/src/devices/sound/k051649.h b/src/devices/sound/k051649.h index 2fda5936685..368ef6c58a9 100644 --- a/src/devices/sound/k051649.h +++ b/src/devices/sound/k051649.h @@ -38,7 +38,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // Parameters for a channel @@ -71,8 +71,8 @@ private: int m_rate; /* mixer tables and internal buffers */ - std::unique_ptr<s16[]> m_mixer_table; - s16 *m_mixer_lookup; + std::vector<stream_buffer::sample_t> m_mixer_table; + stream_buffer::sample_t *m_mixer_lookup; std::vector<s16> m_mixer_buffer; /* chip registers */ diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index ff2356ac600..7337b0c8b91 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -115,7 +115,7 @@ void k053260_device::device_start() m_sh1_cb.resolve_safe(); m_sh2_cb.resolve_safe(); - m_stream = stream_alloc_legacy( 0, 2, clock() / CLOCKS_PER_SAMPLE ); + m_stream = stream_alloc( 0, 2, clock() / CLOCKS_PER_SAMPLE ); /* register with the save state system */ save_item(NAME(m_portdata)); @@ -301,25 +301,17 @@ void k053260_device::write(offs_t offset, u8 data) } } -static inline int limit(int val, int max, int min) -{ - return std::max(min, std::min(max, val)); -} - -static constexpr s32 MAXOUT = 0x7fff; -static constexpr s32 MINOUT = -0x8000; - //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void k053260_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void k053260_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { if (m_mode & 2) { - for ( int j = 0; j < samples; j++ ) + for ( int j = 0; j < outputs[0].samples(); j++ ) { - stream_sample_t buffer[2] = {0, 0}; + s32 buffer[2] = {0, 0}; for (auto & voice : m_voice) { @@ -327,14 +319,14 @@ void k053260_device::sound_stream_update_legacy(sound_stream &stream, stream_sam voice.play(buffer); } - outputs[0][j] = limit( buffer[0], MAXOUT, MINOUT ); - outputs[1][j] = limit( buffer[1], MAXOUT, MINOUT ); + outputs[0].put_int_clamp(j, buffer[0], 32768); + outputs[1].put_int_clamp(j, buffer[1], 32768); } } else { - std::fill_n(&outputs[0][0], samples, 0); - std::fill_n(&outputs[1][0], samples, 0); + outputs[0].fill(0); + outputs[1].fill(0); } } @@ -429,7 +421,7 @@ void k053260_device::KDSC_Voice::update_pan_volume() void k053260_device::KDSC_Voice::key_on() { m_position = m_kadpcm ? 1 : 0; // for kadpcm low bit is nybble offset, so must start at 1 due to preincrement - m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update_legacy + m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update m_output = 0; m_playing = true; if (LOG) m_device.logerror("K053260: start = %06x, length = %06x, pitch = %04x, vol = %02x:%x, loop = %s, %s\n", @@ -443,7 +435,7 @@ void k053260_device::KDSC_Voice::key_off() m_playing = false; } -void k053260_device::KDSC_Voice::play(stream_sample_t *outputs) +void k053260_device::KDSC_Voice::play(s32 *outputs) { m_counter += CLOCKS_PER_SAMPLE; diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h index 4288b603d5a..ad14244ceb9 100644 --- a/src/devices/sound/k053260.h +++ b/src/devices/sound/k053260.h @@ -42,7 +42,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; @@ -79,7 +79,7 @@ private: inline void update_pan_volume(); inline void key_on(); inline void key_off(); - inline void play(stream_sample_t *outputs); + inline void play(s32 *outputs); inline bool playing() { return m_playing; } inline u8 read_rom(bool side_effects); diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp index 2ed7dc134a2..cba942e002f 100644 --- a/src/devices/sound/k054539.cpp +++ b/src/devices/sound/k054539.cpp @@ -23,7 +23,6 @@ k054539_device::k054539_device(const machine_config &mconfig, const char *tag, d , device_sound_interface(mconfig, *this) , device_rom_interface(mconfig, *this) , flags(0) - , ram(nullptr) , reverb_pos(0) , cur_ptr(0) , cur_limit(0) @@ -115,7 +114,7 @@ void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_ }; - int16_t *rbase = (int16_t *)ram.get(); + int16_t *rbase = (int16_t *)&ram[0]; if(!(regs[0x22f] & 1)) { @@ -124,7 +123,6 @@ void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_ return; } - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for(int sample = 0; sample != outputs[0].samples(); sample++) { double lval, rval; if(!(flags & DISABLE_REVERB)) @@ -303,8 +301,8 @@ void k054539_device::sound_stream_update(sound_stream &stream, std::vector<read_ } } reverb_pos = (reverb_pos + 1) & 0x1fff; - outputs[0].put(sample, stream_buffer::sample_t(lval) * sample_scale); - outputs[1].put(sample, stream_buffer::sample_t(rval) * sample_scale); + outputs[0].put_int(sample, lval, 32768); + outputs[1].put_int(sample, rval, 32768); } } @@ -321,10 +319,11 @@ void k054539_device::init_chip() memset(posreg_latch, 0, sizeof(posreg_latch)); //* flags |= UPDATE_AT_KEYON; //* make it default until proven otherwise - ram = std::make_unique<uint8_t[]>(0x4000); + ram = std::make_unique<uint8_t []>(0x4000); + reverb_pos = 0; cur_ptr = 0; - memset(ram.get(), 0, 0x4000); + memset(&ram[0], 0, 0x4000); stream = stream_alloc(0, 2, clock() / 384); @@ -553,7 +552,7 @@ void k054539_device::device_reset() { regs[0x22c] = 0; regs[0x22f] = 0; - memset(ram.get(), 0, 0x4000); + memset(&ram[0], 0, 0x4000); m_timer->enable(false); } diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h index 6e4b6c10c8c..6c79ac6d0be 100644 --- a/src/devices/sound/k054539.h +++ b/src/devices/sound/k054539.h @@ -88,7 +88,7 @@ private: int flags; unsigned char regs[0x230]; - std::unique_ptr<uint8_t[]> ram; + std::unique_ptr<uint8_t []> ram; int reverb_pos; int32_t cur_ptr; diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp index 5280af611f6..2086b014478 100644 --- a/src/devices/sound/ks0164.cpp +++ b/src/devices/sound/ks0164.cpp @@ -50,7 +50,7 @@ void ks0164_device::device_start() space().install_rom(0, rend, ((1 << 23) - 1) ^ rmask, m_mem_region->base()); } - m_stream = stream_alloc_legacy(0, 2, clock()/3/2/2/32); + m_stream = stream_alloc(0, 2, clock()/3/2/2/32); space().cache(m_mem_cache); m_timer = timer_alloc(0); @@ -368,9 +368,9 @@ u16 ks0164_device::uncomp_8_16(u8 value) return o; } -void ks0164_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ks0164_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for(int sample = 0; sample != samples; sample++) { + for(int sample = 0; sample != outputs[0].samples(); sample++) { s32 suml = 0, sumr = 0; for(int voice = 0; voice < 0x20; voice++) { u16 *regs = m_sregs[voice]; @@ -415,7 +415,7 @@ void ks0164_device::sound_stream_update_legacy(sound_stream &stream, stream_samp sumr += samp; } } - outputs[0][sample] = suml >> 5; - outputs[1][sample] = sumr >> 5; + outputs[0].put_int(sample, suml, 32768 * 32); + outputs[1].put_int(sample, sumr, 32768 * 32); } } diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h index a668753f250..cc707699f2e 100644 --- a/src/devices/sound/ks0164.h +++ b/src/devices/sound/ks0164.h @@ -23,7 +23,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void device_add_mconfig(machine_config &config) override; virtual space_config_vector memory_space_config() const override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.cpp b/src/devices/sound/l7a1045_l6028_dsp_a.cpp index 280d12a20d9..7f567f86cbb 100644 --- a/src/devices/sound/l7a1045_l6028_dsp_a.cpp +++ b/src/devices/sound/l7a1045_l6028_dsp_a.cpp @@ -117,7 +117,7 @@ l7a1045_sound_device::l7a1045_sound_device(const machine_config &mconfig, const void l7a1045_sound_device::device_start() { /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, 66150); //clock() / 384); + m_stream = stream_alloc(0, 2, 66150); //clock() / 384); for (int voice = 0; voice < 32; voice++) { @@ -143,14 +143,14 @@ void l7a1045_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void l7a1045_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void l7a1045_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* Clear the buffers */ - memset(outputs[0], 0, samples*sizeof(*outputs[0])); - memset(outputs[1], 0, samples*sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); for (int i = 0; i < 32; i++) { @@ -165,7 +165,7 @@ void l7a1045_sound_device::sound_stream_update_legacy(sound_stream &stream, stre uint32_t pos = vptr->pos; uint32_t frac = vptr->frac; - for (int j = 0; j < samples; j++) + for (int j = 0; j < outputs[0].samples(); j++) { int32_t sample; uint8_t data; @@ -192,8 +192,8 @@ void l7a1045_sound_device::sound_stream_update_legacy(sound_stream &stream, stre sample = ((int8_t)(data & 0xfc)) << (3 - (data & 3)); frac += step; - outputs[0][j] += ((sample * vptr->l_volume) >> 9); - outputs[1][j] += ((sample * vptr->r_volume) >> 9); + outputs[0].add_int(j, sample * vptr->l_volume, 32768 * 512); + outputs[1].add_int(j, sample * vptr->r_volume, 32768 * 512); } vptr->pos = pos; diff --git a/src/devices/sound/l7a1045_l6028_dsp_a.h b/src/devices/sound/l7a1045_l6028_dsp_a.h index bc9c3b5d500..542b6aad386 100644 --- a/src/devices/sound/l7a1045_l6028_dsp_a.h +++ b/src/devices/sound/l7a1045_l6028_dsp_a.h @@ -33,7 +33,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct l7a1045_voice diff --git a/src/devices/sound/lmc1992.cpp b/src/devices/sound/lmc1992.cpp index ad412395d9d..cf0d8f35d33 100644 --- a/src/devices/sound/lmc1992.cpp +++ b/src/devices/sound/lmc1992.cpp @@ -171,12 +171,13 @@ void lmc1992_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void lmc1992_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void lmc1992_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } diff --git a/src/devices/sound/lmc1992.h b/src/devices/sound/lmc1992.h index cfaffc1f13f..beb893d9983 100644 --- a/src/devices/sound/lmc1992.h +++ b/src/devices/sound/lmc1992.h @@ -71,7 +71,7 @@ protected: virtual void device_start() override; // internal callbacks - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: inline void execute_command(int addr, int data); diff --git a/src/devices/sound/mas3507d.cpp b/src/devices/sound/mas3507d.cpp index 641ec52a06e..a5b7a7917d2 100644 --- a/src/devices/sound/mas3507d.cpp +++ b/src/devices/sound/mas3507d.cpp @@ -29,7 +29,7 @@ mas3507d_device::mas3507d_device(const machine_config &mconfig, const char *tag, void mas3507d_device::device_start() { current_rate = 44100; - stream = stream_alloc_legacy(0, 2, current_rate); + stream = stream_alloc(0, 2, current_rate); cb_sample.resolve(); } @@ -359,11 +359,8 @@ void mas3507d_device::fill_buffer() } } -void mas3507d_device::append_buffer(stream_sample_t * const *outputs, int &pos, int scount) +void mas3507d_device::append_buffer(std::vector<write_stream_view> &outputs, int &pos, int scount) { - if(!sample_count) - return; - buffered_frame_count = scount; int s1 = scount - pos; @@ -372,14 +369,13 @@ void mas3507d_device::append_buffer(stream_sample_t * const *outputs, int &pos, if(mp3_info.channels == 1) { for(int i=0; i<s1; i++) { - stream_sample_t v = samples[i]; - outputs[0][i+pos] = v; - outputs[1][i+pos] = v; + outputs[0].put_int(i+pos, samples[i], 32768); + outputs[1].put_int(i+pos, samples[i], 32768); } } else { for(int i=0; i<s1; i++) { - outputs[0][i+pos] = samples[i*2]; - outputs[1][i+pos] = samples[i*2+1]; + outputs[0].put_int(i+pos, samples[i*2], 32768); + outputs[1].put_int(i+pos, samples[i*2+1], 32768); } } @@ -400,8 +396,9 @@ void mas3507d_device::append_buffer(stream_sample_t * const *outputs, int &pos, total_frame_count += s1; } -void mas3507d_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int csamples) +void mas3507d_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + int csamples = outputs[0].samples(); int pos = 0; append_buffer(outputs, pos, csamples); @@ -419,10 +416,8 @@ void mas3507d_device::sound_stream_update_legacy(sound_stream &stream, stream_sa total_frame_count = 0; buffered_frame_count = 0; - for(int i=pos; i != csamples; i++) { - outputs[0][i] = 0; - outputs[1][i] = 0; - } + outputs[0].fill(0, pos); + outputs[1].fill(0, pos); return; } append_buffer(outputs, pos, csamples); diff --git a/src/devices/sound/mas3507d.h b/src/devices/sound/mas3507d.h index 31410fa576e..b04e157e2f2 100644 --- a/src/devices/sound/mas3507d.h +++ b/src/devices/sound/mas3507d.h @@ -27,7 +27,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: devcb_read16 cb_sample; @@ -63,7 +63,7 @@ private: void reg_write(uint32_t adr, uint32_t val); void fill_buffer(); - void append_buffer(stream_sample_t * const *outputs, int &pos, int samples); + void append_buffer(std::vector<write_stream_view> &outputs, int &pos, int samples); }; diff --git a/src/devices/sound/mea8000.cpp b/src/devices/sound/mea8000.cpp index 4f7fbc453ac..3cf2ad51a6e 100644 --- a/src/devices/sound/mea8000.cpp +++ b/src/devices/sound/mea8000.cpp @@ -134,7 +134,7 @@ void mea8000_device::device_start() init_tables(); - m_stream = stream_alloc_legacy(0, 1, clock() / 60); + m_stream = stream_alloc(0, 1, clock() / 60); save_item(NAME(m_output)); m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mea8000_device::timer_expire),this)); @@ -422,12 +422,9 @@ void mea8000_device::stop_frame() -void mea8000_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mea8000_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int samp = 0; samp < samples; samp++) - { - outputs[0][samp] = m_output; - } + outputs[0].fill(stream_buffer::sample_t(m_output) * (1.0 / 32768.0)); } /* next sample in frame, sampling at 64 kHz */ diff --git a/src/devices/sound/mea8000.h b/src/devices/sound/mea8000.h index 14cb0384d09..7538bffa62c 100644 --- a/src/devices/sound/mea8000.h +++ b/src/devices/sound/mea8000.h @@ -29,7 +29,7 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: /* filter coefficients from frequencies */ @@ -111,7 +111,7 @@ private: emu_timer *m_timer = nullptr; sound_stream * m_stream = nullptr; - stream_sample_t m_output = 0; + int32_t m_output = 0; int m_cos_table[TABLE_LEN]; /* fm => cos coefficient */ int m_exp_table[TABLE_LEN]; /* bw => exp coefficient */ diff --git a/src/devices/sound/mm5837.cpp b/src/devices/sound/mm5837.cpp index 7b59758fdcd..6049b64d0fe 100644 --- a/src/devices/sound/mm5837.cpp +++ b/src/devices/sound/mm5837.cpp @@ -13,21 +13,15 @@ //************************************************************************** -// CONSTEXPR DEFINITIONS -//************************************************************************** - -constexpr int mm5837_device::m_frequency[]; - - -//************************************************************************** // DEVICE DEFINITIONS //************************************************************************** DEFINE_DEVICE_TYPE(MM5837, mm5837_device, "mm5837", "MM5837 Digital Noise Source") +DEFINE_DEVICE_TYPE(MM5837_STREAM, mm5837_stream_device, "mm5837_stream", "MM5837 Digital Noise Stream") //************************************************************************** -// LIVE DEVICE +// MM5837 DEVICE //************************************************************************** //------------------------------------------------- @@ -37,12 +31,12 @@ DEFINE_DEVICE_TYPE(MM5837, mm5837_device, "mm5837", "MM5837 Digital Noise Source mm5837_device::mm5837_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, MM5837, tag, owner, clock), m_output_cb(*this), - m_vdd(0), m_timer(nullptr), - m_shift(0) + m_vdd(-12) { } + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -56,36 +50,70 @@ void mm5837_device::device_start() m_timer = timer_alloc(0); // register for save states - save_item(NAME(m_shift)); + save_item(NAME(m_source.m_shift)); } + //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- void mm5837_device::device_reset() { - // initialize with something - m_shift = 123456; + m_source.reset(); if (m_vdd < 16) - m_timer->adjust(attotime::zero, 0, attotime::from_hz(m_frequency[m_vdd])); + m_timer->adjust(attotime::zero, 0, attotime::from_hz(mm5837_source::frequency(m_vdd))); else throw emu_fatalerror("%s: Invalid voltage: %d\n", tag(), m_vdd); } + //------------------------------------------------- // device_timer - handle timer callbacks //------------------------------------------------- void mm5837_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - int tap_14 = BIT(m_shift, 13); - int tap_17 = BIT(m_shift, 16); - int zero = (m_shift == 0) ? 1 : 0; + m_output_cb(m_source.clock()); +} + + + +//************************************************************************** +// MM5837 STREAM DEVICE +//************************************************************************** + +//------------------------------------------------- +// mm5837_stream_device - constructor +//------------------------------------------------- + +mm5837_stream_device::mm5837_stream_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, MM5837_STREAM, tag, owner, clock), + device_sound_interface(mconfig, *this), + m_stream(nullptr), + m_vdd(-12) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mm5837_stream_device::device_start() +{ + m_stream = stream_alloc(0, 1, mm5837_source::frequency(m_vdd)); + save_item(NAME(m_source.m_shift)); +} - m_shift <<= 1; - m_shift |= tap_14 ^ tap_17 ^ zero; - m_output_cb(BIT(m_shift, 16)); +//------------------------------------------------- +// sound_stream_update - fill the sound buffer +//------------------------------------------------- + +void mm5837_stream_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++) + outputs[0].put(sampindex, m_source.clock() ? 1.0 : 0.0); } diff --git a/src/devices/sound/mm5837.h b/src/devices/sound/mm5837.h index 8c7f8287db6..49374537b9c 100644 --- a/src/devices/sound/mm5837.h +++ b/src/devices/sound/mm5837.h @@ -94,6 +94,66 @@ // TYPE DEFINITIONS //************************************************************************** +// ======================> mm5837_source + +class mm5837_source +{ +public: + // construction/destruction + mm5837_source() : + m_shift(0x1ffff) + { + } + + // reset to base state + void reset() + { + m_shift = 0x1ffff; + } + + // clock one time and return the shift value + u8 clock() + { + int tap_14 = BIT(m_shift, 13); + int tap_17 = BIT(m_shift, 16); + int zero = (m_shift == 0) ? 1 : 0; + + m_shift <<= 1; + m_shift |= tap_14 ^ tap_17 ^ zero; + + return BIT(m_shift, 16); + } + + // taken from the book 'mims circuit scrapbook, vol. 1' + static u32 frequency(double vdd) + { + // Vdd should be negative -6.2..-15V + if (vdd > -6.2 || vdd < -15) + throw emu_fatalerror("mm5837 frequency should be -6.2V .. -15V"); + + // curve fitting done in excel from this table: + // { 0, 0, 0, 0, 0, 0, 1, 2267, 8731, 16382, 23531, 32564, 38347, 40010, 37800, 33173 } + double result = 191.98*vdd*vdd*vdd + 5448.4*vdd*vdd + 43388*vdd + 105347; + + // datasheet claims frequency range 24-56kHz at Vdd=-14V, but also lists + // maximum cycle times as ranging from 1.1-2.4s; since the 17-bit shift + // register cycles after 131072 clocks, we would expect the actual cycle + // times to be 2.34-5.46s at the 24-56kHz frequency range, so I'm presuming + // that it ticks 2x per "clock", effectively running at 2x the frequency + result *= 2; + + // make sure the result isn't TOO crazy + result = std::max(result, 100.0); + return u32(result); + } + + // leave this public for easy saving + u32 m_shift; +}; + + +// ======================> mm5837_device + class mm5837_device : public device_t { public: @@ -101,7 +161,7 @@ public: mm5837_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // configuration - void set_vdd_voltage(int voltage) { m_vdd = voltage; } + void set_vdd(double voltage) { m_vdd = voltage; } auto output_callback() { return m_output_cb.bind(); } protected: @@ -111,24 +171,42 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: - // taken from the book 'mims circuit scrapbook, vol. 1' - // this is the frequency the chip runs at when given a vdd voltage of -0 to -15 - static constexpr int m_frequency[16] = { 0, 0, 0, 0, 0, 0, 1, 2267, 8731, 16382, 23531, 32564, 38347, 40010, 37800, 33173 }; + // internal state + devcb_write_line m_output_cb; // output callback + emu_timer *m_timer; // output timer + double m_vdd; // configured voltage + mm5837_source m_source; // noise source +}; - // callbacks - devcb_write_line m_output_cb; - // voltage (as positive number) - int m_vdd; +// ======================> mm5837_stream_device - // output timer - emu_timer *m_timer; +class mm5837_stream_device : public device_t, public device_sound_interface +{ +public: + // construction/destruction + mm5837_stream_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // configuration + void set_vdd(double voltage) { m_vdd = voltage; } + +protected: + // device-level overrides + virtual void device_start() override; + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; - // state - uint32_t m_shift; +private: + sound_stream *m_stream; // sound stream + double m_vdd; // configured voltage + mm5837_source m_source; // noise source }; -// device type definition + +// device type definitions DECLARE_DEVICE_TYPE(MM5837, mm5837_device) +DECLARE_DEVICE_TYPE(MM5837_STREAM, mm5837_stream_device) + #endif // MAME_SOUND_MM5837_H diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp index 05ab0bcd08e..fadef01dd20 100644 --- a/src/devices/sound/mos6560.cpp +++ b/src/devices/sound/mos6560.cpp @@ -173,20 +173,18 @@ inline uint8_t mos6560_device::read_colorram(offs_t offset) void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color ) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); - - m_bitmap.pix32(y + yoff, xoff + 0) = PALETTE_MOS[color[code >> 7]]; - m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 2) = PALETTE_MOS[color[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 4) = PALETTE_MOS[color[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 6) = PALETTE_MOS[color[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 1]]; + int code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); + + m_bitmap.pix(y + yoff, xoff + 0) = PALETTE_MOS[color[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, xoff + 1) = PALETTE_MOS[color[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, xoff + 2) = PALETTE_MOS[color[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, xoff + 3) = PALETTE_MOS[color[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, xoff + 4) = PALETTE_MOS[color[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, xoff + 5) = PALETTE_MOS[color[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, xoff + 6) = PALETTE_MOS[color[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, xoff + 7) = PALETTE_MOS[color[BIT(code, 0)]]; } } @@ -197,20 +195,18 @@ void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color ) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); - - m_bitmap.pix32(y + yoff, xoff + 0) = - m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[code >> 6]]; - m_bitmap.pix32(y + yoff, xoff + 2) = - m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, xoff + 4) = - m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, xoff + 6) = - m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 3]]; + int code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); + + m_bitmap.pix(y + yoff, xoff + 0) = m_bitmap.pix(y + yoff, xoff + 1) = + PALETTE_MOS[color[code >> 6]]; + m_bitmap.pix(y + yoff, xoff + 2) = m_bitmap.pix(y + yoff, xoff + 3) = + PALETTE_MOS[color[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, xoff + 4) = m_bitmap.pix(y + yoff, xoff + 5) = + PALETTE_MOS[color[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, xoff + 6) = m_bitmap.pix(y + yoff, xoff + 7) = + PALETTE_MOS[color[code & 3]]; } } @@ -221,9 +217,7 @@ void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yof void mos6560_device::drawlines( int first, int last ) { - int line, vline; - int offs, yoff, xoff, ybegin, yend, i, j; - int attr, ch; + int line; m_lastline = last; if (first >= last) @@ -231,12 +225,13 @@ void mos6560_device::drawlines( int first, int last ) for (line = first; (line < m_ypos) && (line < last); line++) { - for (j = 0; j < m_total_xsize; j++) - m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor]; + for (int j = 0; j < m_total_xsize; j++) + m_bitmap.pix(line, j) = PALETTE_MOS[m_framecolor]; } - for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) + for (int vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) { + int offs, yoff, xoff, ybegin, yend; if (m_matrix8x16) { offs = (vline >> 4) * m_chars_x; @@ -254,16 +249,16 @@ void mos6560_device::drawlines( int first, int last ) if (m_xpos > 0) { - for (i = ybegin; i <= yend; i++) - for (j = 0; j < m_xpos; j++) - m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor]; + for (int i = ybegin; i <= yend; i++) + for (int j = 0; j < m_xpos; j++) + m_bitmap.pix(yoff + i, j) = PALETTE_MOS[m_framecolor]; } for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++) { - ch = read_videoram((m_videoaddr + offs) & 0x3fff); + int ch = read_videoram((m_videoaddr + offs) & 0x3fff); - attr = (read_colorram((m_videoaddr + offs) & 0x3fff)) & 0xf; + int attr = (read_colorram((m_videoaddr + offs) & 0x3fff)) & 0xf; if (m_variant == TYPE_ATTACK_UFO) { @@ -301,9 +296,9 @@ void mos6560_device::drawlines( int first, int last ) if (xoff < m_total_xsize) { - for (i = ybegin; i <= yend; i++) - for (j = xoff; j < m_total_xsize; j++) - m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor]; + for (int i = ybegin; i <= yend; i++) + for (int j = xoff; j < m_total_xsize; j++) + m_bitmap.pix(yoff + i, j) = PALETTE_MOS[m_framecolor]; } if (m_matrix8x16) @@ -319,8 +314,8 @@ void mos6560_device::drawlines( int first, int last ) } for (; line < last; line++) - for (j = 0; j < m_total_xsize; j++) - m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor]; + for (int j = 0; j < m_total_xsize; j++) + m_bitmap.pix(line, j) = PALETTE_MOS[m_framecolor]; } @@ -620,20 +615,17 @@ void mos6560_device::soundport_w( int offset, int data ) void mos6560_device::sound_start() { - int i; - - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); /* buffer for fastest played sample for 5 second so we have enough data for min 5 second */ m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; - m_noise = std::make_unique<int8_t[]>(m_noisesize); + m_noise = std::make_unique<int8_t []>(m_noisesize); { int noiseshift = 0x7ffff8; - char data; - for (i = 0; i < m_noisesize; i++) + for (int i = 0; i < m_noisesize; i++) { - data = 0; + char data = 0; if (noiseshift & 0x400000) data |= 0x80; if (noiseshift & 0x100000) @@ -661,17 +653,13 @@ void mos6560_device::sound_start() if (m_tonesize > 0) { - m_tone = std::make_unique<int16_t[]>(m_tonesize); + m_tone = std::make_unique<int16_t []>(m_tonesize); - for (i = 0; i < m_tonesize; i++) + for (int i = 0; i < m_tonesize; i++) { - m_tone[i] = (int16_t)(sin (2 * M_PI * i / m_tonesize) * 127 + 0.5); + m_tone[i] = int16_t(sin (2 * M_PI * i / m_tonesize) * 127 + 0.5); } } - else - { - m_tone = nullptr; - } } @@ -888,15 +876,15 @@ void mos6560_device::device_timer(emu_timer &timer, device_timer_id id, int para } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void mos6560_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mos6560_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i, v; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (i = 0; i < samples; i++) + for (i = 0; i < buffer.samples(); i++) { v = 0; if (TONE1_ON /*||(m_tone1pos != 0) */ ) @@ -909,7 +897,7 @@ void mos6560_device::sound_stream_update_legacy(sound_stream &stream, stream_sam if (m_tone1pos >= m_tone1samples) { m_tone1pos = 0; - m_tone1samples = machine().sample_rate() / TONE1_FREQUENCY; + m_tone1samples = buffer.sample_rate() / TONE1_FREQUENCY; if (m_tone1samples == 0) m_tone1samples = 1; } @@ -925,7 +913,7 @@ void mos6560_device::sound_stream_update_legacy(sound_stream &stream, stream_sam if (m_tone2pos >= m_tone2samples) { m_tone2pos = 0; - m_tone2samples = machine().sample_rate() / TONE2_FREQUENCY; + m_tone2samples = buffer.sample_rate() / TONE2_FREQUENCY; if (m_tone2samples == 0) m_tone2samples = 1; } @@ -941,7 +929,7 @@ void mos6560_device::sound_stream_update_legacy(sound_stream &stream, stream_sam if (m_tone3pos >= m_tone3samples) { m_tone3pos = 0; - m_tone3samples = machine().sample_rate() / TONE3_FREQUENCY; + m_tone3samples = buffer.sample_rate() / TONE3_FREQUENCY; if (m_tone3samples == 0) m_tone3samples = 1; } @@ -956,12 +944,11 @@ void mos6560_device::sound_stream_update_legacy(sound_stream &stream, stream_sam m_noisepos = 0; } } - v = (v * VOLUME) << 2; - if (v > 32767) - buffer[i] = 32767; - else if (v < -32767) - buffer[i] = -32767; - else - buffer[i] = v; + v *= VOLUME; + if (v > 8191) + v = 8191; + else if (v < -8191) + v = -8191; + buffer.put_int(i, v, 8192); } } diff --git a/src/devices/sound/mos6560.h b/src/devices/sound/mos6560.h index cf657255198..182cba47dba 100644 --- a/src/devices/sound/mos6560.h +++ b/src/devices/sound/mos6560.h @@ -124,7 +124,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; inline uint8_t read_videoram(offs_t offset); inline uint8_t read_colorram(offs_t offset); @@ -176,8 +176,8 @@ protected: m_noisesamples; /* count of samples to give out per tone */ sound_stream *m_channel; - std::unique_ptr<int16_t[]> m_tone; - std::unique_ptr<int8_t[]> m_noise; + std::unique_ptr<int16_t []> m_tone; + std::unique_ptr<int8_t []> m_noise; emu_timer *m_line_timer; }; diff --git a/src/devices/sound/mos6581.cpp b/src/devices/sound/mos6581.cpp index 2fe073a1347..4ee3ddd7ebd 100644 --- a/src/devices/sound/mos6581.cpp +++ b/src/devices/sound/mos6581.cpp @@ -199,7 +199,7 @@ void mos6581_device::device_start() m_read_poty.resolve_safe(0xff); // create sound stream - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); // initialize SID engine m_token->device = this; @@ -235,13 +235,13 @@ void mos6581_device::device_post_load() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void mos6581_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mos6581_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - m_token->fill_buffer(outputs[0], samples); + m_token->fill_buffer(outputs[0]); } diff --git a/src/devices/sound/mos6581.h b/src/devices/sound/mos6581.h index 47e5959ef41..de05db489d3 100644 --- a/src/devices/sound/mos6581.h +++ b/src/devices/sound/mos6581.h @@ -65,7 +65,7 @@ protected: virtual void device_post_load() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void save_state(SID6581_t *token); private: diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp index 9105fd656e3..aa9604b3a78 100644 --- a/src/devices/sound/mos7360.cpp +++ b/src/devices/sound/mos7360.cpp @@ -297,7 +297,7 @@ void mos7360_device::device_start() screen().register_screen_bitmap(m_bitmap); // create sound stream - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); // buffer for fastest played sample for 5 second so we have enough data for min 5 second m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; @@ -454,16 +454,16 @@ void mos7360_device::device_timer(emu_timer &timer, device_timer_id id, int para //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void mos7360_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mos7360_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i, v, a; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (i = 0; i < samples; i++) + for (i = 0; i < buffer.samples(); i++) { v = 0; @@ -506,113 +506,100 @@ void mos7360_device::sound_stream_update_legacy(sound_stream &stream, stream_sam v = v * a; - buffer[i] = v; + buffer.put_int(i, v, 32768); } } void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { + int code; if (INROM) code = read_rom(m_chargenaddr + ch * 8 + y); else code = read_ram(m_chargenaddr + ch * 8 + y); - m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[color[code >> 7]]; - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[color[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[color[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[color[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[color[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[color[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[color[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[color[code & 1]]; + m_bitmap.pix(y + yoff, 0 + xoff) = PALETTE_MOS[color[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, 1 + xoff) = PALETTE_MOS[color[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, 2 + xoff) = PALETTE_MOS[color[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, 3 + xoff) = PALETTE_MOS[color[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, 4 + xoff) = PALETTE_MOS[color[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, 5 + xoff) = PALETTE_MOS[color[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, 6 + xoff) = PALETTE_MOS[color[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, 7 + xoff) = PALETTE_MOS[color[BIT(code, 0)]]; } } void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { + int code; if (INROM) code = read_rom(m_chargenaddr + ch * 8 + y); else code = read_ram(m_chargenaddr + ch * 8 + y); - m_bitmap.pix32(y + yoff, 0 + xoff) = - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_multi[code >> 6]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_multi[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_multi[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_multi[code & 3]]; + m_bitmap.pix(y + yoff, 0 + xoff) = m_bitmap.pix(y + yoff, 1 + xoff) = + PALETTE_MOS[m_multi[code >> 6]]; + m_bitmap.pix(y + yoff, 2 + xoff) = m_bitmap.pix(y + yoff, 3 + xoff) = + PALETTE_MOS[m_multi[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, 4 + xoff) = m_bitmap.pix(y + yoff, 5 + xoff) = + PALETTE_MOS[m_multi[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, 6 + xoff) = m_bitmap.pix(y + yoff, 7 + xoff) = + PALETTE_MOS[m_multi[code & 3]]; } } void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_ram(m_bitmapaddr + ch * 8 + y); - - m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[code >> 7]]; - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[code & 1]]; + int code = read_ram(m_bitmapaddr + ch * 8 + y); + + m_bitmap.pix(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 0)]]; } } void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_ram(m_bitmapaddr + ch * 8 + y); - - m_bitmap.pix32(y + yoff, 0 + xoff) = - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_bitmapmulti[code >> 6]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_bitmapmulti[code & 3]]; + int code = read_ram(m_bitmapaddr + ch * 8 + y); + + m_bitmap.pix(y + yoff, 0 + xoff) = m_bitmap.pix(y + yoff, 1 + xoff) = + PALETTE_MOS[m_bitmapmulti[code >> 6]]; + m_bitmap.pix(y + yoff, 2 + xoff) = m_bitmap.pix(y + yoff, 3 + xoff) = + PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, 4 + xoff) = m_bitmap.pix(y + yoff, 5 + xoff) = + PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, 6 + xoff) = m_bitmap.pix(y + yoff, 7 + xoff) = + PALETTE_MOS[m_bitmapmulti[code & 3]]; } } void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int color) { - int y; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { for (int x = 0; x < 8; x++) { - m_bitmap.pix32(y + yoff, x + xoff) = PALETTE_MOS[color]; + m_bitmap.pix(y + yoff, x + xoff) = PALETTE_MOS[color]; } } } void mos7360_device::drawlines(int first, int last) { - int line, vline, end; - int attr, ch, c1, c2, ecm; - int offs, yoff, xoff, ybegin, yend, xbegin, xend; - int i; - m_lastline = last; /* top part of display not rastered */ @@ -625,34 +612,44 @@ void mos7360_device::drawlines(int first, int last) if (!SCREENON) { - for (line = first; (line < last) && (line < m_bitmap.height()); line++) + for (int line = first; (line < last) && (line < m_bitmap.height()); line++) { for (int x = 0; x < m_bitmap.width(); x++) { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } return; } + int xbegin, xend; if (COLUMNS40) - xbegin = XPOS, xend = xbegin + 320; + { + xbegin = XPOS; + xend = xbegin + 320; + } else - xbegin = XPOS + 7, xend = xbegin + 304; + { + xbegin = XPOS + 7; + xend = xbegin + 304; + } + int end; if (last < m_y_begin) end = last; else end = m_y_begin + YPOS; + + int line; + for (line = first; line < end; line++) { - for (line = first; line < end; line++) + for (int x = 0; x < m_bitmap.width(); x++) { - for (int x = 0; x < m_bitmap.width(); x++) - { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; - } + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } + + int vline; if (LINES25) vline = line - m_y_begin - YPOS; else @@ -663,23 +660,23 @@ void mos7360_device::drawlines(int first, int last) else end = m_y_end + YPOS; - for (; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) + for (int ybegin, yend; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) { - offs = (vline >> 3) * 40; + int offs = (vline >> 3) * 40; ybegin = vline & 7; - yoff = line - ybegin; + int yoff = line - ybegin; yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); /* rendering 39 characters */ /* left and right borders are overwritten later */ - for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) + for (int xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) { if (HIRESON) { - ch = read_ram((m_videoaddr | 0x400) + offs); - attr = read_ram(m_videoaddr + offs); - c1 = ((ch >> 4) & 0xf) | (attr << 4); - c2 = (ch & 0xf) | (attr & 0x70); + int ch = read_ram((m_videoaddr | 0x400) + offs); + int attr = read_ram(m_videoaddr + offs); + int c1 = ((ch >> 4) & 0xf) | (attr << 4); + int c2 = (ch & 0xf) | (attr & 0x70); m_bitmapmulti[1] = m_c16_bitmap[1] = c1 & 0x7f; m_bitmapmulti[2] = m_c16_bitmap[0] = c2 & 0x7f; if (MULTICOLORON) @@ -693,13 +690,13 @@ void mos7360_device::drawlines(int first, int last) } else { - ch = read_ram((m_videoaddr | 0x400) + offs); - attr = read_ram(m_videoaddr + offs); + int ch = read_ram((m_videoaddr | 0x400) + offs); + int attr = read_ram(m_videoaddr + offs); // levente harsfalvi's docu says cursor off in ecm and multicolor if (ECMON) { // hardware reverse off - ecm = ch >> 6; + int ecm = ch >> 6; m_ecmcolor[0] = m_colors[ecm]; m_ecmcolor[1] = attr & 0x7f; draw_character(ybegin, yend, ch & ~0xc0, yoff, xoff, m_ecmcolor); @@ -741,16 +738,16 @@ void mos7360_device::drawlines(int first, int last) } } - for (i = ybegin; i <= yend; i++) + for (int i = ybegin; i <= yend; i++) { for (int x = 0; x < xbegin; x++) { - m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; } for (int x = xend; x < m_bitmap.width(); x++) { - m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; } } } @@ -764,7 +761,7 @@ void mos7360_device::drawlines(int first, int last) { for (int x = 0; x < m_bitmap.width(); x++) { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } } diff --git a/src/devices/sound/mos7360.h b/src/devices/sound/mos7360.h index 7e41bddb7c6..c8733dc3e46 100644 --- a/src/devices/sound/mos7360.h +++ b/src/devices/sound/mos7360.h @@ -110,7 +110,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // device_sound_interface callbacks - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; inline void set_interrupt(int mask); inline void clear_interrupt(int mask); diff --git a/src/devices/sound/msm5232.cpp b/src/devices/sound/msm5232.cpp index da8fc499dc7..972b83a8c53 100644 --- a/src/devices/sound/msm5232.cpp +++ b/src/devices/sound/msm5232.cpp @@ -34,7 +34,7 @@ void msm5232_device::device_start() init(clock(), rate); - m_stream = stream_alloc_legacy(0, 11, rate); + m_stream = stream_alloc(0, 11, rate); /* register with the save state system */ save_item(NAME(m_EN_out16)); @@ -725,34 +725,34 @@ void msm5232_device::set_clock(int clock) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void msm5232_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void msm5232_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buf1 = outputs[0]; - stream_sample_t *buf2 = outputs[1]; - stream_sample_t *buf3 = outputs[2]; - stream_sample_t *buf4 = outputs[3]; - stream_sample_t *buf5 = outputs[4]; - stream_sample_t *buf6 = outputs[5]; - stream_sample_t *buf7 = outputs[6]; - stream_sample_t *buf8 = outputs[7]; - stream_sample_t *bufsolo1 = outputs[8]; - stream_sample_t *bufsolo2 = outputs[9]; - stream_sample_t *bufnoise = outputs[10]; + auto &buf1 = outputs[0]; + auto &buf2 = outputs[1]; + auto &buf3 = outputs[2]; + auto &buf4 = outputs[3]; + auto &buf5 = outputs[4]; + auto &buf6 = outputs[5]; + auto &buf7 = outputs[6]; + auto &buf8 = outputs[7]; + auto &bufsolo1 = outputs[8]; + auto &bufsolo2 = outputs[9]; + auto &bufnoise = outputs[10]; int i; - for (i=0; i<samples; i++) + for (i=0; i<buf1.samples(); i++) { /* calculate all voices' envelopes */ EG_voices_advance(); TG_group_advance(0); /* calculate tones group 1 */ - buf1[i] = o2; - buf2[i] = o4; - buf3[i] = o8; - buf4[i] = o16; + buf1.put_int(i, o2, 32768); + buf2.put_int(i, o4, 32768); + buf3.put_int(i, o8, 32768); + buf4.put_int(i, o16, 32768); SAVE_SINGLE_CHANNEL(0,o2) SAVE_SINGLE_CHANNEL(1,o4) @@ -760,13 +760,13 @@ void msm5232_device::sound_stream_update_legacy(sound_stream &stream, stream_sam SAVE_SINGLE_CHANNEL(3,o16) TG_group_advance(1); /* calculate tones group 2 */ - buf5[i] = o2; - buf6[i] = o4; - buf7[i] = o8; - buf8[i] = o16; + buf5.put_int(i, o2, 32768); + buf6.put_int(i, o4, 32768); + buf7.put_int(i, o8, 32768); + buf8.put_int(i, o16, 32768); - bufsolo1[i] = solo8; - bufsolo2[i] = solo16; + bufsolo1.put_int(i, solo8, 32768); + bufsolo2.put_int(i, solo16, 32768); SAVE_SINGLE_CHANNEL(4,o2) SAVE_SINGLE_CHANNEL(5,o4) @@ -794,6 +794,6 @@ void msm5232_device::sound_stream_update_legacy(sound_stream &stream, stream_sam } } - bufnoise[i] = (m_noise_rng & (1<<16)) ? 32767 : 0; + bufnoise.put(i, (m_noise_rng & (1<<16)) ? 1.0 : 0.0); } } diff --git a/src/devices/sound/msm5232.h b/src/devices/sound/msm5232.h index 364f944353b..552cd7669e3 100644 --- a/src/devices/sound/msm5232.h +++ b/src/devices/sound/msm5232.h @@ -26,7 +26,7 @@ protected: virtual void device_post_load() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct VOICE { diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp index c4a5892990f..4ea099b947a 100644 --- a/src/devices/sound/multipcm.cpp +++ b/src/devices/sound/multipcm.cpp @@ -479,7 +479,7 @@ void multipcm_device::device_start() const float clock_divider = 180.0f; m_rate = (float)clock() / clock_divider; - m_stream = stream_alloc_legacy(0, 2, m_rate); + m_stream = stream_alloc(0, 2, m_rate); // Volume + pan table m_left_pan_table = make_unique_clear<int32_t[]>(0x800); @@ -575,7 +575,7 @@ void multipcm_device::device_start() save_item(NAME(m_address)); // Slots - m_slots = make_unique_clear<slot_t []>(28); + m_slots = std::make_unique<slot_t []>(28); save_pointer(STRUCT_MEMBER(m_slots, m_regs), 28); save_pointer(STRUCT_MEMBER(m_slots, m_playing), 28); @@ -628,22 +628,10 @@ void multipcm_device::device_clock_changed() } //----------------------------------------------------- -// clamp_to_int16 - clamp a 32-bit value to 16 bits +// convert_to_stream_sample - clamp a 32-bit value to +// 16 bits and convert to a stream_buffer::sample_t //----------------------------------------------------- -int16_t multipcm_device::clamp_to_int16(int32_t value) -{ - if (value < -32768) - { - return -32768; - } - else if (value > 32767) - { - return 32767; - } - return (int16_t)value; -} - #if MULTIPCM_LOG_SAMPLES void multipcm_device::dump_sample(slot_t &slot) { @@ -677,20 +665,12 @@ void multipcm_device::dump_sample(slot_t &slot) #endif //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void multipcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int32_t samples) +void multipcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *datap[2]; - - datap[0] = outputs[0]; - datap[1] = outputs[1]; - - memset(datap[0], 0, sizeof(*datap[0]) * samples); - memset(datap[1], 0, sizeof(*datap[1]) * samples); - - for (int32_t i = 0; i < samples; ++i) + for (int32_t i = 0; i < outputs[0].samples(); ++i) { int32_t smpl = 0; int32_t smpr = 0; @@ -741,8 +721,8 @@ void multipcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sa } } - datap[0][i] = clamp_to_int16(smpl); - datap[1][i] = clamp_to_int16(smpr); + outputs[0].put_int_clamp(i, smpl, 32768); + outputs[1].put_int_clamp(i, smpr, 32768); } } diff --git a/src/devices/sound/multipcm.h b/src/devices/sound/multipcm.h index 4308703b9dc..e8de5a06851 100644 --- a/src/devices/sound/multipcm.h +++ b/src/devices/sound/multipcm.h @@ -29,7 +29,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; @@ -37,17 +37,17 @@ protected: private: struct sample_t { - uint32_t m_start; - uint32_t m_loop; - uint32_t m_end; - uint8_t m_attack_reg; - uint8_t m_decay1_reg; - uint8_t m_decay2_reg; - uint8_t m_decay_level; - uint8_t m_release_reg; - uint8_t m_key_rate_scale; - uint8_t m_lfo_vibrato_reg; - uint8_t m_lfo_amplitude_reg; + uint32_t m_start = 0; + uint32_t m_loop = 0; + uint32_t m_end = 0; + uint8_t m_attack_reg = 0; + uint8_t m_decay1_reg = 0; + uint8_t m_decay2_reg = 0; + uint8_t m_decay_level = 0; + uint8_t m_release_reg = 0; + uint8_t m_key_rate_scale = 0; + uint8_t m_lfo_vibrato_reg = 0; + uint8_t m_lfo_amplitude_reg = 0; }; enum class state_t : u8 @@ -60,38 +60,38 @@ private: struct envelope_gen_t { - int32_t m_volume; - state_t m_state; - int32_t step; + int32_t m_volume = 0; + state_t m_state = state_t::ATTACK; + int32_t step = 0; //step vals - int32_t m_attack_rate; // Attack - int32_t m_decay1_rate; // Decay1 - int32_t m_decay2_rate; // Decay2 - int32_t m_release_rate; // Release - int32_t m_decay_level; // Decay level + int32_t m_attack_rate = 0; // Attack + int32_t m_decay1_rate = 0; // Decay1 + int32_t m_decay2_rate = 0; // Decay2 + int32_t m_release_rate = 0; // Release + int32_t m_decay_level = 0; // Decay level }; struct lfo_t { - uint16_t m_phase; - uint32_t m_phase_step; - int32_t *m_table; - int32_t *m_scale; + uint16_t m_phase = 0; + uint32_t m_phase_step = 0; + int32_t *m_table = nullptr; + int32_t *m_scale = nullptr; }; struct slot_t { - uint8_t m_regs[8]; - bool m_playing; + uint8_t m_regs[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + bool m_playing = false; sample_t m_sample; - uint32_t m_base; - uint32_t m_offset; - uint32_t m_step; - uint32_t m_pan; - uint32_t m_total_level; - uint32_t m_dest_total_level; - int32_t m_total_level_step; - int32_t m_prev_sample; + uint32_t m_base = 0; + uint32_t m_offset = 0; + uint32_t m_step = 0; + uint32_t m_pan = 0; + uint32_t m_total_level = 0; + uint32_t m_dest_total_level = 0; + int32_t m_total_level_step = 0; + int32_t m_prev_sample = 0; envelope_gen_t m_envelope_gen; lfo_t m_pitch_lfo; // Pitch lfo lfo_t m_amplitude_lfo; // AM lfo @@ -135,7 +135,7 @@ private: void write_slot(slot_t &slot, int32_t reg, uint8_t data); - int16_t clamp_to_int16(int32_t value); + stream_buffer::sample_t convert_to_stream_sample(int32_t value); #if MULTIPCM_LOG_SAMPLES void dump_sample(slot_t &slot); diff --git a/src/devices/sound/n63701x.cpp b/src/devices/sound/n63701x.cpp index f9dea8e4509..6f16c988d8e 100644 --- a/src/devices/sound/n63701x.cpp +++ b/src/devices/sound/n63701x.cpp @@ -46,7 +46,7 @@ namco_63701x_device::namco_63701x_device(const machine_config &mconfig, const ch void namco_63701x_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, clock()/1000); + m_stream = stream_alloc(0, 2, clock()/1000); for (int i = 0; i < 2; i++) { @@ -61,16 +61,16 @@ void namco_63701x_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void namco_63701x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int ch; for (ch = 0;ch < 2;ch++) { - stream_sample_t *buf = outputs[ch]; + auto &buf = outputs[ch]; voice_63701x *v = &m_voices[ch]; if (v->playing) @@ -80,12 +80,12 @@ void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, strea int vol = vol_table[v->volume]; int p; - for (p = 0;p < samples;p++) + for (p = 0;p < buf.samples();p++) { if (v->silence_counter) { v->silence_counter--; - *(buf++) = 0; + buf.put(p, 0); } else { @@ -94,17 +94,18 @@ void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, strea if (data == 0xff) /* end of sample */ { v->playing = 0; + buf.fill(0, p); break; } else if (data == 0x00) /* silence compression */ { data = base[(pos++) & 0xffff]; v->silence_counter = data; - *(buf++) = 0; + buf.put(p, 0); } else { - *(buf++) = vol * (data - 0x80); + buf.put_int(p, vol * (data - 0x80), 32768); } } } @@ -112,7 +113,7 @@ void namco_63701x_device::sound_stream_update_legacy(sound_stream &stream, strea v->position = pos; } else - memset(buf, 0, samples * sizeof(*buf)); + buf.fill(0); } } diff --git a/src/devices/sound/n63701x.h b/src/devices/sound/n63701x.h index 4992065d7bf..3ca5411df6d 100644 --- a/src/devices/sound/n63701x.h +++ b/src/devices/sound/n63701x.h @@ -25,7 +25,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct voice_63701x diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp index 830f3713b45..694dad0cd29 100644 --- a/src/devices/sound/namco.cpp +++ b/src/devices/sound/namco.cpp @@ -43,8 +43,6 @@ /* a position of waveform sample */ #define WAVEFORM_POSITION(n) (((n) >> m_f_fracbits) & 0x1f) -static constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; - DEFINE_DEVICE_TYPE(NAMCO, namco_device, "namco", "Namco") DEFINE_DEVICE_TYPE(NAMCO_15XX, namco_15xx_device, "namco_15xx", "Namco 15xx") DEFINE_DEVICE_TYPE(NAMCO_CUS30, namco_cus30_device, "namco_cus30", "Namco CUS30") @@ -54,7 +52,6 @@ namco_audio_device::namco_audio_device(const machine_config &mconfig, device_typ , device_sound_interface(mconfig, *this) , m_wave_ptr(*this, DEVICE_SELF) , m_last_channel(nullptr) - , m_soundregs(nullptr) , m_wavedata(nullptr) , m_wave_size(0) , m_sound_enable(false) @@ -69,11 +66,13 @@ namco_audio_device::namco_audio_device(const machine_config &mconfig, device_typ namco_device::namco_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : namco_audio_device(mconfig, NAMCO, tag, owner, clock) + , m_soundregs(nullptr) { } namco_15xx_device::namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :namco_audio_device(mconfig, NAMCO_15XX, tag, owner, clock) + , m_soundregs(nullptr) { } @@ -89,13 +88,9 @@ namco_cus30_device::namco_cus30_device(const machine_config &mconfig, const char void namco_audio_device::device_start() { - sound_channel *voice; - /* extract globals from the interface */ m_last_channel = m_channel_list + m_voices; - m_soundregs = auto_alloc_array_clear(machine(), uint8_t, 0x400); - /* build the waveform table */ build_decoded_waveform(m_wave_ptr); @@ -109,20 +104,17 @@ void namco_audio_device::device_start() m_sound_enable = true; /* register with the save state system */ - save_pointer(NAME(m_soundregs), 0x400); - if (m_wave_ptr == nullptr) save_pointer(NAME(m_wavedata), 0x400); save_item(NAME(m_voices)); save_item(NAME(m_sound_enable)); - save_pointer(NAME(m_waveform[0]), MAX_VOLUME * 32 * 8 * (1+m_wave_size)); + for (int v = 0; v < MAX_VOLUME; v++) + save_pointer(NAME(m_waveform[v]), 32 * 8 * (1+m_wave_size), v); /* reset all the voices */ - for (voice = m_channel_list; voice < m_last_channel; voice++) + for (sound_channel *voice = m_channel_list; voice < m_last_channel; voice++) { - int voicenum = voice - m_channel_list; - voice->frequency = 0; voice->volume[0] = voice->volume[1] = 0; voice->waveform_select = 0; @@ -132,18 +124,36 @@ void namco_audio_device::device_start() voice->noise_seed = 1; voice->noise_counter = 0; voice->noise_hold = 0; - - /* register with the save state system */ - save_item(NAME(voice->frequency), voicenum); - save_item(NAME(voice->counter), voicenum); - save_item(NAME(voice->volume), voicenum); - save_item(NAME(voice->noise_sw), voicenum); - save_item(NAME(voice->noise_state), voicenum); - save_item(NAME(voice->noise_seed), voicenum); - save_item(NAME(voice->noise_hold), voicenum); - save_item(NAME(voice->noise_counter), voicenum); - save_item(NAME(voice->waveform_select), voicenum); } + + /* register with the save state system */ + save_pointer(STRUCT_MEMBER(m_channel_list, frequency), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, counter), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, volume), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_sw), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_state), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_seed), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_hold), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_counter), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, waveform_select), m_voices); +} + + +void namco_device::device_start() +{ + namco_audio_device::device_start(); + + m_soundregs = make_unique_clear<uint8_t[]>(0x400); + save_pointer(NAME(m_soundregs), 0x400); +} + + +void namco_15xx_device::device_start() +{ + namco_audio_device::device_start(); + + m_soundregs = make_unique_clear<uint8_t[]>(0x400); + save_pointer(NAME(m_soundregs), 0x400); } @@ -198,14 +208,16 @@ void namco_audio_device::update_namco_waveform(int offset, uint8_t data) /* build the decoded waveform table */ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase) { - int16_t *p; - int size; - int offset; - int v; - - m_wavedata = (rgnbase != nullptr) ? rgnbase : auto_alloc_array_clear(machine(), uint8_t, 0x400); + if (rgnbase != nullptr) + m_wavedata = rgnbase; + else + { + m_waveram_alloc = make_unique_clear<uint8_t[]>(0x400); + m_wavedata = m_waveram_alloc.get(); + } /* 20pacgal has waves in RAM but old sound system */ + int size; if (rgnbase == nullptr && m_voices != 3) { m_wave_size = 1; @@ -217,20 +229,11 @@ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase) size = 32 * 8; /* 32 samples, 8 waveforms */ } - p = auto_alloc_array(machine(), int16_t, size * MAX_VOLUME); - - for (v = 0; v < MAX_VOLUME; v++) - { - m_waveform[v] = p; - p += size; - } + for (int v = 0; v < MAX_VOLUME; v++) + m_waveform[v] = std::make_unique<int16_t[]>(size); - /* We need waveform data. It fails if region is not specified. */ - if (m_wavedata) - { - for (offset = 0; offset < 256; offset++) - update_namco_waveform(offset, m_wavedata[offset]); - } + for (int offset = 0; offset < 256; offset++) + update_namco_waveform(offset, m_wavedata[offset]); } @@ -239,7 +242,7 @@ uint32_t namco_audio_device::namco_update_one(write_stream_view &buffer, const i { for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - buffer.add(sampindex, stream_buffer::sample_t(wave[WAVEFORM_POSITION(counter)]) * sample_scale); + buffer.add_int(sampindex, wave[WAVEFORM_POSITION(counter)], 32768); counter += freq; } @@ -329,15 +332,17 @@ void namco_cus30_device::pacman_sound_w(offs_t offset, uint8_t data) sound_channel *voice; int ch; + uint8_t *soundregs = &m_wavedata[0x100]; + data &= 0x0f; - if (m_soundregs[offset] == data) + if (soundregs[offset] == data) return; /* update the streams */ m_stream->update(); /* set the register */ - m_soundregs[offset] = data; + soundregs[offset] = data; if (offset < 0x10) ch = (offset - 5) / 5; @@ -364,11 +369,11 @@ void namco_cus30_device::pacman_sound_w(offs_t offset, uint8_t data) case 0x14: /* the frequency has 20 bits */ /* the first voice has extra frequency bits */ - voice->frequency = (ch == 0) ? m_soundregs[0x10] : 0; - voice->frequency += (m_soundregs[ch * 5 + 0x11] << 4); - voice->frequency += (m_soundregs[ch * 5 + 0x12] << 8); - voice->frequency += (m_soundregs[ch * 5 + 0x13] << 12); - voice->frequency += (m_soundregs[ch * 5 + 0x14] << 16); /* always 0 */ + voice->frequency = (ch == 0) ? soundregs[0x10] : 0; + voice->frequency += (soundregs[ch * 5 + 0x11] << 4); + voice->frequency += (soundregs[ch * 5 + 0x12] << 8); + voice->frequency += (soundregs[ch * 5 + 0x13] << 12); + voice->frequency += (soundregs[ch * 5 + 0x14] << 16); /* always 0 */ break; case 0x15: @@ -568,16 +573,16 @@ void namco_cus30_device::namcos1_sound_w(offs_t offset, uint8_t data) return; } - m_soundregs = m_wavedata + 0x100; + uint8_t *soundregs = &m_wavedata[0x100]; - if (m_soundregs[offset] == data) + if (soundregs[offset] == data) return; /* update the streams */ m_stream->update(); /* set the register */ - m_soundregs[offset] = data; + soundregs[offset] = data; ch = offset / 8; if (ch >= m_voices) @@ -596,9 +601,9 @@ void namco_cus30_device::namcos1_sound_w(offs_t offset, uint8_t data) case 0x02: case 0x03: /* the frequency has 20 bits */ - voice->frequency = (m_soundregs[ch * 8 + 0x01] & 15) << 16; /* high bits are from here */ - voice->frequency += m_soundregs[ch * 8 + 0x02] << 8; - voice->frequency += m_soundregs[ch * 8 + 0x03]; + voice->frequency = (soundregs[ch * 8 + 0x01] & 15) << 16; /* high bits are from here */ + voice->frequency += soundregs[ch * 8 + 0x02] << 8; + voice->frequency += soundregs[ch * 8 + 0x03]; break; case 0x04: @@ -699,13 +704,13 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r if (voice->noise_state) { - lmix.add(i, stream_buffer::sample_t(l_noise_data) * sample_scale); - rmix.add(i, stream_buffer::sample_t(r_noise_data) * sample_scale); + lmix.add_int(i, l_noise_data, 32768); + rmix.add_int(i, r_noise_data, 32768); } else { - lmix.add(i, stream_buffer::sample_t(-l_noise_data) * sample_scale); - rmix.add(i, stream_buffer::sample_t(-r_noise_data) * sample_scale); + lmix.add_int(i, -l_noise_data, 32768); + rmix.add_int(i, -r_noise_data, 32768); } if (hold) @@ -799,9 +804,9 @@ void namco_audio_device::sound_stream_update(sound_stream &stream, std::vector<r int cnt; if (voice->noise_state) - buffer.add(i, stream_buffer::sample_t(noise_data) * sample_scale); + buffer.add_int(i, noise_data, 32768); else - buffer.add(i, stream_buffer::sample_t(-noise_data) * sample_scale); + buffer.add_int(i, -noise_data, 32768); if (hold) { diff --git a/src/devices/sound/namco.h b/src/devices/sound/namco.h index 6b3cee6a1f5..f032a71a536 100644 --- a/src/devices/sound/namco.h +++ b/src/devices/sound/namco.h @@ -52,7 +52,6 @@ protected: /* data about the sound system */ sound_channel m_channel_list[MAX_VOICES]; sound_channel *m_last_channel; - uint8_t *m_soundregs; uint8_t *m_wavedata; /* global sound parameters */ @@ -66,8 +65,10 @@ protected: int m_voices; /* number of voices */ bool m_stereo; /* set to indicate stereo (e.g., System 1) */ + std::unique_ptr<uint8_t[]> m_waveram_alloc; + /* decoded waveform table */ - int16_t *m_waveform[MAX_VOLUME]; + std::unique_ptr<int16_t[]> m_waveform[MAX_VOLUME]; virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; @@ -79,13 +80,17 @@ public: void pacman_sound_w(offs_t offset, uint8_t data); - void polepos_sound_enable(int enable); - uint8_t polepos_sound_r(offs_t offset); void polepos_sound_w(offs_t offset, uint8_t data); protected: + // device-level overrides + virtual void device_start() override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + +private: + std::unique_ptr<uint8_t[]> m_soundregs; }; @@ -99,7 +104,13 @@ public: void sharedram_w(offs_t offset, uint8_t data); protected: + // device-level overrides + virtual void device_start() override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + +private: + std::unique_ptr<uint8_t[]> m_soundregs; }; diff --git a/src/devices/sound/namco_163.cpp b/src/devices/sound/namco_163.cpp index 153b0bfe042..08daf720d17 100644 --- a/src/devices/sound/namco_163.cpp +++ b/src/devices/sound/namco_163.cpp @@ -11,13 +11,14 @@ #include "emu.h" #include "namco_163.h" +#include <algorithm> + DEFINE_DEVICE_TYPE(NAMCO_163, namco_163_sound_device, "namco_163_sound", "Namco 163 (Sound)") namco_163_sound_device::namco_163_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, NAMCO_163, tag, owner, clock) , device_sound_interface(mconfig, *this) - , m_ram(nullptr) , m_reg_addr(0x78) , m_addr(0) , m_inc(false) @@ -33,10 +34,11 @@ namco_163_sound_device::namco_163_sound_device(const machine_config &mconfig, co void namco_163_sound_device::device_start() { - m_ram = make_unique_clear<u8[]>(0x80); - m_stream = stream_alloc_legacy(0, 1, clock() / 15); + std::fill(std::begin(m_ram), std::end(m_ram), 0); + + m_stream = stream_alloc(0, 1, clock() / 15); - save_pointer(NAME(m_ram), 0x80); + save_item(NAME(m_ram)); save_item(NAME(m_reg_addr)); save_item(NAME(m_addr)); save_item(NAME(m_inc)); @@ -143,15 +145,16 @@ u8 namco_163_sound_device::data_r() } -void namco_163_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void namco_163_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - std::fill_n(&outputs[0][0], samples, 0); - if (m_disable) + { + outputs[0].fill(0); return; + } // Slightly noisy but closer to real hardware behavior - for (int s = 0; s < samples; s++) + for (int s = 0; s < outputs[0].samples(); s++) { u32 phase = (m_ram[m_reg_addr + 5] << 16) | (m_ram[m_reg_addr + 3] << 8) | m_ram[m_reg_addr + 1]; const u32 freq = ((m_ram[m_reg_addr + 4] & 0x3) << 16) | (m_ram[m_reg_addr + 2] << 8) | m_ram[m_reg_addr + 0]; @@ -171,6 +174,6 @@ void namco_163_sound_device::sound_stream_update_legacy(sound_stream &stream, st { m_reg_addr = 0x78 - ((m_ram[0x7f] & 0x70) >> 1); } - outputs[0][s] = (output << 8); + outputs[0].put_int(s, output, 128); } } diff --git a/src/devices/sound/namco_163.h b/src/devices/sound/namco_163.h index 74d2ceacb68..f3a7428300d 100644 --- a/src/devices/sound/namco_163.h +++ b/src/devices/sound/namco_163.h @@ -24,7 +24,7 @@ protected: virtual void device_clock_changed() override; // global sound parameters - std::unique_ptr<u8[]> m_ram; + u8 m_ram[0x80]; u8 m_reg_addr; u8 m_addr; bool m_inc; @@ -34,7 +34,7 @@ protected: // internals inline s8 get_sample(u16 addr); - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; DECLARE_DEVICE_TYPE(NAMCO_163, namco_163_sound_device) diff --git a/src/devices/sound/nes_apu.cpp b/src/devices/sound/nes_apu.cpp index 1e79304fb3a..483b337475f 100644 --- a/src/devices/sound/nes_apu.cpp +++ b/src/devices/sound/nes_apu.cpp @@ -83,8 +83,8 @@ void nesapu_device::create_syncs(unsigned long sps) DEFINE_DEVICE_TYPE(NES_APU, nesapu_device, "nesapu", "N2A03 APU") -nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, NES_APU, tag, owner, clock) +nesapu_device::nesapu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, type, tag, owner, clock) , device_sound_interface(mconfig, *this) , m_samps_per_sync(0) , m_buffer_size(0) @@ -108,6 +108,11 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev } } +nesapu_device::nesapu_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock) + : nesapu_device(mconfig, NES_APU, tag, owner, clock) +{ +} + void nesapu_device::device_reset() { write(0x15, 0x00); @@ -134,7 +139,7 @@ void nesapu_device::calculate_rates() if (m_stream != nullptr) m_stream->set_sample_rate(rate); else - m_stream = stream_alloc_legacy(0, 1, rate); + m_stream = stream_alloc(0, 1, rate); } //------------------------------------------------- @@ -725,16 +730,15 @@ void nesapu_device::write(offs_t address, u8 value) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void nesapu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void nesapu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int accum; - stream_sample_t *output = outputs[0]; - memset( output, 0, samples*sizeof(*output) ); + auto &output = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < output.samples(); sampindex++) { accum = apu_square(&m_APU.squ[0]); accum += apu_square(&m_APU.squ[1]); @@ -742,12 +746,6 @@ void nesapu_device::sound_stream_update_legacy(sound_stream &stream, stream_samp accum += apu_noise(&m_APU.noi); accum += apu_dpcm(&m_APU.dpcm); - /* 8-bit clamps */ - if (accum > 127) - accum = 127; - else if (accum < -128) - accum = -128; - - *output++=accum<<8; + output.put_int_clamp(sampindex, accum, 128); } } diff --git a/src/devices/sound/nes_apu.h b/src/devices/sound/nes_apu.h index c0e2e02244b..673c967fec7 100644 --- a/src/devices/sound/nes_apu.h +++ b/src/devices/sound/nes_apu.h @@ -56,11 +56,13 @@ public: void write(offs_t offset, u8 data); protected: + nesapu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + // device-level overrides virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: /* GLOBAL CONSTANTS */ diff --git a/src/devices/sound/nes_apu_vt.cpp b/src/devices/sound/nes_apu_vt.cpp new file mode 100644 index 00000000000..f93c3203bac --- /dev/null +++ b/src/devices/sound/nes_apu_vt.cpp @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +// The XOP is the NES APU type found in VT platforms, it roughly doubles the functionality of the APU +// but in ways that means simply installing 2 APU devices isn't entirely correct (registers on one +// APU module having an effect on the other) + +// TODO: everything + +#include "emu.h" +#include "sound/nes_apu_vt.h" + +DEFINE_DEVICE_TYPE(NES_APU_VT, nes_apu_vt_device, "nes_apu_vt", "XOP APU") + +nes_apu_vt_device::nes_apu_vt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : nesapu_device(mconfig, NES_APU_VT, tag, owner, clock) +{ +} + +void nes_apu_vt_device::device_start() +{ + nesapu_device::device_start(); +} + +void nes_apu_vt_device::device_reset() +{ + nesapu_device::device_reset(); +} diff --git a/src/devices/sound/nes_apu_vt.h b/src/devices/sound/nes_apu_vt.h new file mode 100644 index 00000000000..f93616673fa --- /dev/null +++ b/src/devices/sound/nes_apu_vt.h @@ -0,0 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#ifndef MAME_AUDIO_NES_VT_APU_H +#define MAME_AUDIO_NES_VT_APU_H + +#pragma once + +#include "sound/nes_apu.h" + +DECLARE_DEVICE_TYPE(NES_APU_VT, nes_apu_vt_device) + +class nes_apu_vt_device : public nesapu_device +{ +public: + // construction/destruction + nes_apu_vt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: +}; + +#endif // MAME_AUDIO_NES_VT_APU_H diff --git a/src/devices/sound/nile.cpp b/src/devices/sound/nile.cpp index aeaeeaca59c..345c88f2bf0 100644 --- a/src/devices/sound/nile.cpp +++ b/src/devices/sound/nile.cpp @@ -68,7 +68,7 @@ nile_device::nile_device(const machine_config &mconfig, const char *tag, device_ void nile_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); save_item(NAME(m_sound_regs)); save_item(NAME(m_vpos)); save_item(NAME(m_frac)); @@ -78,23 +78,24 @@ void nile_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests +// sound_stream_update - handle update requests // for our sound stream //------------------------------------------------- -void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void nile_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint8_t *sound_ram = &m_sound_ram[0]; int v, i, snum; uint16_t *slot; - int32_t mix[48000*2]; + int32_t mix[4800*2]; int32_t *mixp; int16_t sample; int sptr, eptr, freq, lsptr, leptr; lsptr=leptr=0; - memset(mix, 0, sizeof(mix[0])*samples*2); + sound_assert(outputs[0].samples() * 2 < ARRAY_LENGTH(mix)); + std::fill_n(&mix[0], outputs[0].samples()*2, 0); for (v = 0; v < NILE_VOICES; v++) { @@ -111,7 +112,7 @@ void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample lsptr = slot[NILE_REG_LSPTR_HI]<<16 | slot[NILE_REG_LSPTR_LO]; leptr = slot[NILE_REG_LEPTR_HI]<<16 | slot[NILE_REG_LEPTR_LO]; - for (snum = 0; snum < samples; snum++) + for (snum = 0; snum < outputs[0].samples(); snum++) { sample = sound_ram[sptr + m_vpos[v]]<<8; @@ -159,10 +160,10 @@ void nile_device::sound_stream_update_legacy(sound_stream &stream, stream_sample } } mixp = &mix[0]; - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { - outputs[0][i] = (*mixp++)>>4; - outputs[1][i] = (*mixp++)>>4; + outputs[0].put_int(i, *mixp++, 32768 * 16); + outputs[1].put_int(i, *mixp++, 32768 * 16); } } diff --git a/src/devices/sound/nile.h b/src/devices/sound/nile.h index a87fb875c11..61add38d44e 100644 --- a/src/devices/sound/nile.h +++ b/src/devices/sound/nile.h @@ -23,7 +23,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: void nile_snd_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); diff --git a/src/devices/sound/okim6258.cpp b/src/devices/sound/okim6258.cpp index 5f063f4cd87..349fe9ca13c 100644 --- a/src/devices/sound/okim6258.cpp +++ b/src/devices/sound/okim6258.cpp @@ -114,7 +114,7 @@ void okim6258_device::device_start() m_divider = dividers[m_start_divider]; - m_stream = stream_alloc_legacy(0, 1, clock()/m_divider); + m_stream = stream_alloc(0, 1, clock()/m_divider); m_signal = -2; m_step = 0; @@ -138,20 +138,18 @@ void okim6258_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void okim6258_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void okim6258_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - - memset(outputs[0], 0, samples * sizeof(*outputs[0])); + auto &buffer = outputs[0]; if (m_status & STATUS_PLAYING) { int nibble_shift = m_nibble_shift; - while (samples) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { /* Compute the new amplitude and update the current step */ int nibble = (m_data_in >> nibble_shift) & 0xf; @@ -161,8 +159,7 @@ void okim6258_device::sound_stream_update_legacy(sound_stream &stream, stream_sa nibble_shift ^= 4; - *buffer++ = sample; - samples--; + buffer.put_int(sampindex, sample, 32768); } /* Update the parameters */ @@ -170,9 +167,7 @@ void okim6258_device::sound_stream_update_legacy(sound_stream &stream, stream_sa } else { - /* Fill with 0 */ - while (samples--) - *buffer++ = 0; + buffer.fill(0); } } diff --git a/src/devices/sound/okim6258.h b/src/devices/sound/okim6258.h index c8397b998bf..95189f0ef3c 100644 --- a/src/devices/sound/okim6258.h +++ b/src/devices/sound/okim6258.h @@ -47,7 +47,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void state_save_register(); diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp index c3aee26e52e..a6acbe12e9b 100644 --- a/src/devices/sound/okim6295.cpp +++ b/src/devices/sound/okim6295.cpp @@ -344,7 +344,6 @@ void okim6295_device::okim_voice::generate_adpcm(device_rom_interface &rom, writ return; // loop while we still have samples to generate - constexpr stream_buffer::sample_t sample_scale = 1.0 / 2048.0; for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { // fetch the next sample byte @@ -352,7 +351,7 @@ void okim6295_device::okim_voice::generate_adpcm(device_rom_interface &rom, writ // output to the buffer, scaling by the volume // signal in range -2048..2047 - buffer.add(sampindex, m_adpcm.clock(nibble) * sample_scale * m_volume); + buffer.add_int(sampindex, m_adpcm.clock(nibble) * m_volume, 2048); // next! if (++m_sample >= m_count) diff --git a/src/devices/sound/okim6376.cpp b/src/devices/sound/okim6376.cpp index 3cb3e6fc17b..d7cd143e003 100644 --- a/src/devices/sound/okim6376.cpp +++ b/src/devices/sound/okim6376.cpp @@ -169,7 +169,7 @@ void okim6376_device::device_start() m_ch2_update = 0; m_st_pulses = 0; /* generate the name and create the stream */ - m_stream = stream_alloc_legacy(0, 1, get_sample_rate()); + m_stream = stream_alloc(0, 1, get_sample_rate()); /* initialize the voices */ for (voice = 0; voice < OKIM6376_VOICES; voice++) @@ -578,21 +578,18 @@ void okim6376_device::write(uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void okim6376_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void okim6376_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int i; - - memset(outputs[0], 0, samples * sizeof(*outputs[0])); + outputs[0].fill(0); - for (i = 0; i < OKIM6376_VOICES; i++) + for (int i = 0; i < OKIM6376_VOICES; i++) { struct ADPCMVoice *voice = &m_voice[i]; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; int16_t sample_data[MAX_SAMPLE_CHUNK]; - int remaining = samples; if (i == 0) //channel 1 is the only channel to affect NAR { if (m_nartimer > 0) @@ -606,16 +603,16 @@ void okim6376_device::sound_stream_update_legacy(sound_stream &stream, stream_sa } /* loop while we have samples remaining */ - while (remaining) + for (int sampindex = 0; sampindex < buffer.samples(); ) { + int remaining = buffer.samples() - sampindex; int samples = (remaining > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : remaining; - int samp; generate_adpcm(voice, sample_data, samples,i); - for (samp = 0; samp < samples; samp++) - *buffer++ += sample_data[samp]; + for (int samp = 0; samp < samples; samp++) + buffer.add_int(sampindex + samp, sample_data[samp], 32768); - remaining -= samples; + sampindex += samples; } } } diff --git a/src/devices/sound/okim6376.h b/src/devices/sound/okim6376.h index 83be973fadf..34a23764e3a 100644 --- a/src/devices/sound/okim6376.h +++ b/src/devices/sound/okim6376.h @@ -32,7 +32,7 @@ protected: virtual void device_post_load() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp index a28cfb1af79..21e2624cd80 100644 --- a/src/devices/sound/okim9810.cpp +++ b/src/devices/sound/okim9810.cpp @@ -112,7 +112,7 @@ okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag, void okim9810_device::device_start() { // create the stream - m_stream = stream_alloc_legacy(0, 2, clock()); + m_stream = stream_alloc(0, 2, clock()); // save state stuff save_item(NAME(m_TMP_register)); @@ -214,15 +214,15 @@ void okim9810_device::rom_bank_updated() // our sound stream //------------------------------------------------- -void okim9810_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void okim9810_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // reset the output streams - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); // iterate over voices and accumulate sample data for (auto & elem : m_voice) - elem.generate_audio(*this, outputs, samples, m_global_volume, m_filter_type); + elem.generate_audio(*this, outputs, m_global_volume, m_filter_type); } @@ -613,8 +613,7 @@ okim9810_device::okim_voice::okim_voice() //------------------------------------------------- void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom, - stream_sample_t * const *buffers, - int samples, + std::vector<write_stream_view> &outputs, const uint8_t global_volume, const uint8_t filter_type) { @@ -623,8 +622,8 @@ void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom, return; // separate out left and right channels - stream_sample_t *outL = buffers[0]; - stream_sample_t *outR = buffers[1]; + auto &outL = outputs[0]; + auto &outR = outputs[1]; // get left and right volumes uint8_t volume_scale_left = volume_scale(global_volume, m_channel_volume, m_pan_volume_left); @@ -636,7 +635,7 @@ void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom, return; // loop while we still have samples to generate - while (samples-- != 0) + for (int sampindex = 0; sampindex < outL.samples(); sampindex++) { // If interpSampleNum == 0, we are at the beginning of a new interp chunk, gather data if (m_interpSampleNum == 0) @@ -747,11 +746,11 @@ void okim9810_device::okim_voice::generate_audio(device_rom_interface &rom, // output to the stereo buffers, scaling by the volume // signal in range -2048..2047, volume in range 2..128 => signal * volume / 8 in range -32768..32767 - int32_t interpValueL = (interpValue * (int32_t)volume_scale_left) / 8; - *outL++ += interpValueL; + int32_t interpValueL = (interpValue * (int32_t)volume_scale_left); + outL.add_int(sampindex, interpValueL, 32768 * 8); - int32_t interpValueR = (interpValue * (int32_t)volume_scale_right) / 8; - *outR++ += interpValueR; + int32_t interpValueR = (interpValue * (int32_t)volume_scale_right); + outR.add_int(sampindex, interpValueR, 32768 * 8); // if the interpsample has reached its end, move on to the next sample m_interpSampleNum++; diff --git a/src/devices/sound/okim9810.h b/src/devices/sound/okim9810.h index dfb4cd047aa..01977b23e2b 100644 --- a/src/devices/sound/okim9810.h +++ b/src/devices/sound/okim9810.h @@ -30,7 +30,7 @@ class okim9810_device : public device_t, public device_sound_interface, - public device_rom_interface<24> + public device_rom_interface<24, 0, 0, ENDIANNESS_BIG> { public: // construction/destruction @@ -87,7 +87,7 @@ protected: virtual void device_clock_changed() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; @@ -98,8 +98,7 @@ protected: public: okim_voice(); void generate_audio(device_rom_interface &rom, - stream_sample_t * const *buffers, - int samples, + std::vector<write_stream_view> &buffers, const uint8_t global_volume, const uint8_t filter_type); diff --git a/src/devices/sound/pcd3311.cpp b/src/devices/sound/pcd3311.cpp index deae4f61062..4b5a4fb87f5 100644 --- a/src/devices/sound/pcd3311.cpp +++ b/src/devices/sound/pcd3311.cpp @@ -48,10 +48,11 @@ void pcd3311_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void pcd3311_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void pcd3311_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } diff --git a/src/devices/sound/pcd3311.h b/src/devices/sound/pcd3311.h index f56d63633ba..5d5b8870008 100644 --- a/src/devices/sound/pcd3311.h +++ b/src/devices/sound/pcd3311.h @@ -48,7 +48,7 @@ protected: virtual void device_start() override; // internal callbacks - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: int m_a0; diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp index 5674ab6db18..23b0ee76a44 100644 --- a/src/devices/sound/qs1000.cpp +++ b/src/devices/sound/qs1000.cpp @@ -229,7 +229,7 @@ void qs1000_device::device_start() // The QS1000 operates at 24MHz. Creating a stream at that rate // would be overkill so we opt for a fraction of that rate which // gives reasonable results - m_stream = stream_alloc_legacy(0, 2, clock() / 32); + m_stream = stream_alloc(0, 2, clock() / 32); // Resolve CPU port callbacks m_in_p1_cb.resolve_safe(0); @@ -466,13 +466,13 @@ void qs1000_device::wave_w(offs_t offset, uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - +// sound_stream_update - //------------------------------------------------- -void qs1000_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void qs1000_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // Rset the output stream - memset(outputs[0], 0x0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0x0, samples * sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); // Iterate over voices and accumulate sample data for (auto & chan : m_channels) @@ -485,7 +485,7 @@ void qs1000_device::sound_stream_update_legacy(sound_stream &stream, stream_samp { if (chan.m_flags & QS1000_ADPCM) { - for (int samp = 0; samp < samples; samp++) + for (int samp = 0; samp < outputs[0].samples(); samp++) { if (chan.m_addr >= chan.m_loop_end) { @@ -529,13 +529,13 @@ void qs1000_device::sound_stream_update_legacy(sound_stream &stream, stream_samp chan.m_addr = (chan.m_addr + (chan.m_acc >> 18)) & QS1000_ADDRESS_MASK; chan.m_acc &= ((1 << 18) - 1); - outputs[0][samp] += (result * 4 * lvol * vol) >> 12; - outputs[1][samp] += (result * 4 * rvol * vol) >> 12; + outputs[0].add_int(samp, result * 4 * lvol * vol, 32768 << 12); + outputs[1].add_int(samp, result * 4 * rvol * vol, 32768 << 12); } } else { - for (int samp = 0; samp < samples; samp++) + for (int samp = 0; samp < outputs[0].samples(); samp++) { if (chan.m_addr >= chan.m_loop_end) { @@ -558,8 +558,8 @@ void qs1000_device::sound_stream_update_legacy(sound_stream &stream, stream_samp chan.m_addr = (chan.m_addr + (chan.m_acc >> 18)) & QS1000_ADDRESS_MASK; chan.m_acc &= ((1 << 18) - 1); - outputs[0][samp] += (result * lvol * vol) >> 12; - outputs[1][samp] += (result * rvol * vol) >> 12; + outputs[0].add_int(samp, result * lvol * vol, 32768 << 12); + outputs[1].add_int(samp, result * rvol * vol, 32768 << 12); } } } diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h index 0c16e69b193..aad353962a5 100644 --- a/src/devices/sound/qs1000.h +++ b/src/devices/sound/qs1000.h @@ -73,7 +73,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp index 232e367f1d2..29b2661add5 100644 --- a/src/devices/sound/qsound.cpp +++ b/src/devices/sound/qsound.cpp @@ -207,7 +207,7 @@ void qsound_device::device_add_mconfig(machine_config &config) void qsound_device::device_start() { // hope we get good synchronisation between the DSP and the sound system - m_stream = stream_alloc_legacy(0, 2, clock() / 2 / 1248); + m_stream = stream_alloc(0, 2, clock() / 2 / 1248); // save DSP communication state save_item(NAME(m_rom_bank)); @@ -251,13 +251,13 @@ void qsound_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void qsound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void qsound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - std::fill_n(outputs[0], samples, m_samples[0]); - std::fill_n(outputs[1], samples, m_samples[1]); + outputs[0].fill(stream_buffer::sample_t(m_samples[0]) * (1.0 / 32768.0)); + outputs[1].fill(stream_buffer::sample_t(m_samples[1]) * (1.0 / 32768.0)); } diff --git a/src/devices/sound/qsound.h b/src/devices/sound/qsound.h index ac0a1053ffe..6a9be5dfbc2 100644 --- a/src/devices/sound/qsound.h +++ b/src/devices/sound/qsound.h @@ -32,7 +32,7 @@ protected: virtual void device_reset() override; // device_sound_interface implementation - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface implementation virtual void rom_bank_updated() override; diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp index 9ff99ee8cab..913d22baed1 100644 --- a/src/devices/sound/qsoundhle.cpp +++ b/src/devices/sound/qsoundhle.cpp @@ -64,7 +64,7 @@ void qsound_hle_device::rom_bank_updated() void qsound_hle_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, clock() / 2 / 1248); // DSP program uses 1248 machine cycles per iteration + m_stream = stream_alloc(0, 2, clock() / 2 / 1248); // DSP program uses 1248 machine cycles per iteration init_register_map(); @@ -158,20 +158,16 @@ void qsound_hle_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void qsound_hle_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void qsound_hle_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - // Clear the buffers - std::fill_n(outputs[0], samples, 0); - std::fill_n(outputs[1], samples, 0); - - for (int i = 0; i < samples; i ++) + for (int i = 0; i < outputs[0].samples(); i ++) { update_sample(); - outputs[0][i] = m_out[0]; - outputs[1][i] = m_out[1]; + outputs[0].put_int(i, m_out[0], 32768); + outputs[1].put_int(i, m_out[1], 32768); } } diff --git a/src/devices/sound/qsoundhle.h b/src/devices/sound/qsoundhle.h index 23b92738b9b..4d6f61e0c7d 100644 --- a/src/devices/sound/qsoundhle.h +++ b/src/devices/sound/qsoundhle.h @@ -30,7 +30,7 @@ protected: virtual void device_reset() override; // device_sound_interface implementation - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface implementation virtual void rom_bank_updated() override; diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index b8de150f7f6..7495e484540 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -180,7 +180,7 @@ void rf5c400_device::device_start() save_item(STRUCT_MEMBER(m_channels, env_step)); save_item(STRUCT_MEMBER(m_channels, env_scale)); - m_stream = stream_alloc_legacy(0, 2, clock() / 384); + m_stream = stream_alloc(0, 2, clock() / 384); } //------------------------------------------------- @@ -195,10 +195,10 @@ void rf5c400_device::device_clock_changed() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void rf5c400_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void rf5c400_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i, ch; uint64_t end, loop; @@ -207,14 +207,14 @@ void rf5c400_device::sound_stream_update_legacy(sound_stream &stream, stream_sam uint8_t env_phase; double env_level, env_step, env_rstep; - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); for (ch=0; ch < 32; ch++) { rf5c400_channel *channel = &m_channels[ch]; - stream_sample_t *buf0 = outputs[0]; - stream_sample_t *buf1 = outputs[1]; + auto &buf0 = outputs[0]; + auto &buf1 = outputs[1]; // start = ((channel->startH & 0xFF00) << 8) | channel->startL; end = ((channel->endHloopH & 0xFF) << 16) | channel->endL; @@ -230,7 +230,7 @@ void rf5c400_device::sound_stream_update_legacy(sound_stream &stream, stream_sam env_step = channel->env_step; env_rstep = env_step * channel->env_scale; - for (i=0; i < samples; i++) + for (i=0; i < buf0.samples(); i++) { int16_t tmp; int32_t sample; @@ -300,8 +300,8 @@ void rf5c400_device::sound_stream_update_legacy(sound_stream &stream, stream_sam sample *= volume_table[vol]; sample = (sample >> 9) * env_level; - *buf0++ += sample * pan_table[lvol]; - *buf1++ += sample * pan_table[rvol]; + buf0.add_int(i, sample * pan_table[lvol], 32768); + buf1.add_int(i, sample * pan_table[rvol], 32768); pos += channel->step; if ((pos>>16) > end) diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h index fdd82910b76..6e729daad0a 100644 --- a/src/devices/sound/rf5c400.h +++ b/src/devices/sound/rf5c400.h @@ -34,7 +34,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp index 1c00941000b..f91e370b95f 100644 --- a/src/devices/sound/rf5c68.cpp +++ b/src/devices/sound/rf5c68.cpp @@ -81,7 +81,7 @@ void rf5c68_device::device_start() m_sample_end_cb.resolve(); /* allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, clock() / 384); + m_stream = stream_alloc(0, 2, clock() / 384); save_item(STRUCT_MEMBER(m_chan, enable)); save_item(STRUCT_MEMBER(m_chan, env)); @@ -116,21 +116,29 @@ device_memory_interface::space_config_vector rf5c68_device::memory_space_config( } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void rf5c68_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void rf5c68_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left = outputs[0]; - stream_sample_t *right = outputs[1]; - - /* start with clean buffers */ - memset(left, 0, samples * sizeof(*left)); - memset(right, 0, samples * sizeof(*right)); + auto &left = outputs[0]; + auto &right = outputs[1]; /* bail if not enabled */ if (!m_enable) + { + left.fill(0); + right.fill(0); return; + } + + if (m_mixleft.size() < left.samples()) + m_mixleft.resize(left.samples()); + if (m_mixright.size() < right.samples()) + m_mixright.resize(right.samples()); + + std::fill_n(&m_mixleft[0], left.samples(), 0); + std::fill_n(&m_mixright[0], right.samples(), 0); /* loop over channels */ for (pcm_channel &chan : m_chan) @@ -142,7 +150,7 @@ void rf5c68_device::sound_stream_update_legacy(sound_stream &stream, stream_samp int rv = ((chan.pan >> 4) & 0x0f) * chan.env; /* loop over the sample buffer */ - for (int j = 0; j < samples; j++) + for (int j = 0; j < left.samples(); j++) { int sample; @@ -170,13 +178,13 @@ void rf5c68_device::sound_stream_update_legacy(sound_stream &stream, stream_samp if (sample & 0x80) { sample &= 0x7f; - left[j] += (sample * lv) >> 5; - right[j] += (sample * rv) >> 5; + m_mixleft[j] += (sample * lv) >> 5; + m_mixright[j] += (sample * rv) >> 5; } else { - left[j] -= (sample * lv) >> 5; - right[j] -= (sample * rv) >> 5; + m_mixleft[j] -= (sample * lv) >> 5; + m_mixright[j] -= (sample * rv) >> 5; } } } @@ -188,19 +196,10 @@ void rf5c68_device::sound_stream_update_legacy(sound_stream &stream, stream_samp */ const u8 output_shift = (m_output_bits > 16) ? 0 : (16 - m_output_bits); const s32 output_nandmask = (1 << output_shift) - 1; - for (int j = 0; j < samples; j++) + for (int j = 0; j < left.samples(); j++) { - stream_sample_t temp; - - temp = left[j]; - if (temp > 32767) temp = 32767; - else if (temp < -32768) temp = -32768; - left[j] = temp & ~output_nandmask; - - temp = right[j]; - if (temp > 32767) temp = 32767; - else if (temp < -32768) temp = -32768; - right[j] = temp & ~output_nandmask; + left.put_int_clamp(j, m_mixleft[j] & ~output_nandmask, 32768); + right.put_int_clamp(j, m_mixright[j] & ~output_nandmask, 32768); } } diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h index 4a1d465e291..d78f378faaf 100644 --- a/src/devices/sound/rf5c68.h +++ b/src/devices/sound/rf5c68.h @@ -45,7 +45,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface configuration virtual space_config_vector memory_space_config() const override; @@ -75,6 +75,8 @@ private: u16 m_wbank; u8 m_enable; int m_output_bits; + std::vector<s32> m_mixleft; + std::vector<s32> m_mixright; sample_end_cb_delegate m_sample_end_cb; }; diff --git a/src/devices/sound/rolandpcm.cpp b/src/devices/sound/rolandpcm.cpp index 4916605dd7e..d3393785f88 100644 --- a/src/devices/sound/rolandpcm.cpp +++ b/src/devices/sound/rolandpcm.cpp @@ -61,7 +61,7 @@ void mb87419_mb87420_device::device_start() m_clock = clock() / 2; m_rate = m_clock / 512; // usually 32 KHz - m_stream = stream_alloc_legacy(0, 2, m_rate); + m_stream = stream_alloc(0, 2, m_rate); logerror("Roland PCM: Clock %u, Rate %u\n", m_clock, m_rate); } @@ -266,29 +266,29 @@ void mb87419_mb87420_device::write(offs_t offset, u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void mb87419_mb87420_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mb87419_mb87420_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - memset(outputs[0], 0, samples * sizeof(stream_sample_t)); - memset(outputs[1], 0, samples * sizeof(stream_sample_t)); + outputs[0].fill(0); + outputs[1].fill(0); for (auto& chn : m_chns) { if (! chn.enable || chn.play_dir == 0) continue; - for (int smpl = 0; smpl < samples; smpl ++) + for (int smpl = 0; smpl < outputs[0].samples(); smpl ++) { - stream_sample_t smp_data; + s32 smp_data; if (chn.play_dir > 0) smp_data = sample_interpolate(chn.smpl_cur, chn.smpl_nxt, chn.addr & 0x3FFF); else smp_data = sample_interpolate(chn.smpl_nxt, chn.smpl_cur, chn.addr & 0x3FFF); - smp_data = (smp_data * chn.volume) >> 14; // >>14 results in a good overall volume - outputs[0][smpl] += smp_data; - outputs[1][smpl] += smp_data; + smp_data = smp_data * chn.volume; + outputs[0].add_int(smpl, smp_data, 32768 << 14); // >>14 results in a good overall volume + outputs[1].add_int(smpl, smp_data, 32768 << 14); uint32_t old_addr = chn.addr; if (chn.play_dir > 0) diff --git a/src/devices/sound/rolandpcm.h b/src/devices/sound/rolandpcm.h index 5d1e814d517..1c77be39b98 100644 --- a/src/devices/sound/rolandpcm.h +++ b/src/devices/sound/rolandpcm.h @@ -24,7 +24,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/rp2c33_snd.cpp b/src/devices/sound/rp2c33_snd.cpp index 57e60cf9fb5..d0701041a6b 100644 --- a/src/devices/sound/rp2c33_snd.cpp +++ b/src/devices/sound/rp2c33_snd.cpp @@ -56,7 +56,7 @@ void rp2c33_sound_device::device_start() for (int i = 0; i < 4; i++) m_mvol_table[i] = int((65536.0 / (32.0 * 64.0)) * 2.0 / double(i + 2)); - m_stream = stream_alloc_legacy(0, 1, clock()); + m_stream = stream_alloc(0, 1, clock()); // save states save_item(NAME(m_regs)); @@ -218,12 +218,12 @@ void rp2c33_sound_device::write(offs_t offset, u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void rp2c33_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void rp2c33_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { m_output = 0; if (!m_env_halt && !m_wave_halt) @@ -234,7 +234,7 @@ void rp2c33_sound_device::sound_stream_update_legacy(sound_stream &stream, strea exec_mod(); exec_wave(); /* Update the buffers */ - outputs[0][i] = m_output * m_mvol_table[m_mvol]; + outputs[0].put_int(i, m_output * m_mvol_table[m_mvol], 32768); } } diff --git a/src/devices/sound/rp2c33_snd.h b/src/devices/sound/rp2c33_snd.h index 73b737409c2..bdb32e58f60 100644 --- a/src/devices/sound/rp2c33_snd.h +++ b/src/devices/sound/rp2c33_snd.h @@ -43,7 +43,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream = nullptr; diff --git a/src/devices/sound/s14001a.cpp b/src/devices/sound/s14001a.cpp index 5230a66b534..aa4506ba1c8 100644 --- a/src/devices/sound/s14001a.cpp +++ b/src/devices/sound/s14001a.cpp @@ -226,7 +226,7 @@ ALLOW_SAVE_TYPE(s14001a_device::states); // allow save_item on a non-fundamental void s14001a_device::device_start() { - m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate()); + m_stream = stream_alloc(0, 1, clock() ? clock() : machine().sample_rate()); // resolve callbacks m_ext_read_handler.resolve(); @@ -311,16 +311,16 @@ void s14001a_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void s14001a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void s14001a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { Clock(); int16_t sample = m_uOutputP2 - 7; // range -7..8 - outputs[0][i] = sample * 0xf00; + outputs[0].put_int(i, sample, 8); } } diff --git a/src/devices/sound/s14001a.h b/src/devices/sound/s14001a.h index 09f985a51dc..511503d9daa 100644 --- a/src/devices/sound/s14001a.h +++ b/src/devices/sound/s14001a.h @@ -31,7 +31,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: uint8_t readmem(uint16_t offset, bool phase); diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp index 9385273ba66..98cd204b503 100644 --- a/src/devices/sound/s_dsp.cpp +++ b/src/devices/sound/s_dsp.cpp @@ -160,7 +160,7 @@ void s_dsp_device::device_start() space().cache(m_cache); space().specific(m_data); - m_channel = stream_alloc_legacy(0, 2, clock() / 64); + m_channel = stream_alloc(0, 2, clock() / 64); state_register(); } @@ -1061,20 +1061,20 @@ void s_dsp_device::state_register() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void s_dsp_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void s_dsp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { s16 mix[2]; - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { mix[0] = mix[1] = 0; dsp_update(mix); /* Update the buffers */ - outputs[0][i] = (stream_sample_t)mix[0]; - outputs[1][i] = (stream_sample_t)mix[1]; + outputs[0].put_int(i, (s32)mix[0], 32768); + outputs[1].put_int(i, (s32)mix[1], 32768); } } diff --git a/src/devices/sound/s_dsp.h b/src/devices/sound/s_dsp.h index 4ab841d0ebd..00097b17303 100644 --- a/src/devices/sound/s_dsp.h +++ b/src/devices/sound/s_dsp.h @@ -30,7 +30,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface configuration virtual space_config_vector memory_space_config() const override; diff --git a/src/devices/sound/saa1099.cpp b/src/devices/sound/saa1099.cpp index cad84d184bb..080ebabe89c 100644 --- a/src/devices/sound/saa1099.cpp +++ b/src/devices/sound/saa1099.cpp @@ -161,7 +161,7 @@ saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, d void saa1099_device::device_start() { /* for each chip allocate one stream */ - m_stream = stream_alloc_legacy(0, 2, clock()/clock_divider); + m_stream = stream_alloc(0, 2, clock()/clock_divider); save_item(NAME(m_noise_params)); save_item(NAME(m_env_enable)); @@ -200,18 +200,18 @@ void saa1099_device::device_clock_changed() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void saa1099_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int j, ch; /* if the channels are disabled we're done */ if (!m_all_ch_enable) { /* init output data */ - memset(outputs[LEFT],0,samples*sizeof(*outputs[LEFT])); - memset(outputs[RIGHT],0,samples*sizeof(*outputs[RIGHT])); + outputs[LEFT].fill(0); + outputs[RIGHT].fill(0); return; } @@ -227,7 +227,7 @@ void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sam } /* fill all data needed */ - for( j = 0; j < samples; j++ ) + for( j = 0; j < outputs[0].samples(); j++ ) { int output_l = 0, output_r = 0; @@ -285,8 +285,8 @@ void saa1099_device::sound_stream_update_legacy(sound_stream &stream, stream_sam m_noise[ch].counter -= clock_divider; } /* write sound data to the buffer */ - outputs[LEFT][j] = output_l / 6; - outputs[RIGHT][j] = output_r / 6; + outputs[LEFT].put_int(j, output_l, 32768 * 6); + outputs[RIGHT].put_int(j, output_r, 32768 * 6); } } diff --git a/src/devices/sound/saa1099.h b/src/devices/sound/saa1099.h index 2f9361d5ce8..87f5b58f48a 100644 --- a/src/devices/sound/saa1099.h +++ b/src/devices/sound/saa1099.h @@ -32,7 +32,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct saa1099_channel diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp index 143be37ca40..b340da3d237 100644 --- a/src/devices/sound/scsp.cpp +++ b/src/devices/sound/scsp.cpp @@ -36,9 +36,6 @@ #include <algorithm> -static constexpr s32 clip16(int x) { return std::min(32767, std::max(-32768, x)); } -static constexpr s32 clip18(int x) { return std::min(131071, std::max(-131072, x)); } - #define SHIFT 12 #define LFO_SHIFT 8 #define FIX(v) ((u32) ((float) (1 << SHIFT) * (v))) @@ -165,11 +162,6 @@ scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_ m_timerC(nullptr), m_mcieb(0), m_mcipd(0), - m_bufferl(nullptr), - m_bufferr(nullptr), - m_exts0(nullptr), - m_exts1(nullptr), - m_length(0), m_RBUFDST(nullptr) { std::fill(std::begin(m_RINGBUF), std::end(m_RINGBUF), 0); @@ -212,7 +204,7 @@ void scsp_device::device_start() m_main_irq_cb.resolve_safe(); // Stereo output with EXTS0,1 Input (External digital audio output) - m_stream = stream_alloc_legacy(2, 2, clock() / 512); + m_stream = stream_alloc(2, 2, clock() / 512); for (int slot = 0; slot < 32; slot++) { @@ -317,17 +309,12 @@ void scsp_device::rom_bank_updated() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void scsp_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void scsp_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - m_exts0 = inputs[0]; - m_exts1 = inputs[1]; - m_bufferl = outputs[0]; - m_bufferr = outputs[1]; - m_length = samples; - DoMasterSamples(samples); + DoMasterSamples(inputs, outputs); } u8 scsp_device::DecodeSCI(u8 irq) @@ -1276,17 +1263,12 @@ inline s32 scsp_device::UpdateSlot(SCSP_SLOT *slot) return sample; } -void scsp_device::DoMasterSamples(int nsamples) +void scsp_device::DoMasterSamples(std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *bufr,*bufl; - stream_sample_t const *exts[2]; - - bufr = m_bufferr; - bufl = m_bufferl; - exts[0] = m_exts0; - exts[1] = m_exts1; + auto &bufr = outputs[1]; + auto &bufl = outputs[0]; - for (int s = 0; s < nsamples; ++s) + for (int s = 0; s < bufl.samples(); ++s) { s32 smpl = 0, smpr = 0; @@ -1342,7 +1324,7 @@ void scsp_device::DoMasterSamples(int nsamples) SCSP_SLOT *slot = m_Slots + i + 16; // 100217, 100237 EFSDL, EFPAN for EXTS0/1 if (EFSDL(slot)) { - m_DSP.EXTS[i] = exts[i][s]; + m_DSP.EXTS[i] = s32(inputs[i].get(s) * 32768.0); u16 Enc = ((EFPAN(slot)) << 0x8) | ((EFSDL(slot)) << 0xd); smpl += (m_DSP.EXTS[i] * m_LPANTABLE[Enc]) >> SHIFT; smpr += (m_DSP.EXTS[i] * m_RPANTABLE[Enc]) >> SHIFT; @@ -1351,17 +1333,14 @@ void scsp_device::DoMasterSamples(int nsamples) if (DAC18B()) { - smpl = clip18(smpl); - smpr = clip18(smpr); + bufl.put_int_clamp(s, smpl, 131072); + bufr.put_int_clamp(s, smpr, 131072); } else { - smpl = clip16(smpl >> 2); - smpr = clip16(smpr >> 2); + bufl.put_int_clamp(s, smpl >> 2, 32768); + bufr.put_int_clamp(s, smpr >> 2, 32768); } - - *bufl++ = smpl; - *bufr++ = smpr; } } diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h index 4fe8c5e2a91..7ff91fdb576 100644 --- a/src/devices/sound/scsp.h +++ b/src/devices/sound/scsp.h @@ -45,7 +45,7 @@ protected: virtual void rom_bank_updated() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum SCSP_STATE { SCSP_ATTACK, SCSP_DECAY1, SCSP_DECAY2, SCSP_RELEASE }; @@ -148,13 +148,6 @@ private: SCSPDSP m_DSP; - stream_sample_t *m_bufferl; - stream_sample_t *m_bufferr; - stream_sample_t const *m_exts0; - stream_sample_t const *m_exts1; - - int m_length; - s16 *m_RBUFDST; //this points to where the sample will be stored in the RingBuf //LFO @@ -187,7 +180,7 @@ private: void w16(u32 addr, u16 val); u16 r16(u32 addr); inline s32 UpdateSlot(SCSP_SLOT *slot); - void DoMasterSamples(int nsamples); + void DoMasterSamples(std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); //LFO void LFO_Init(); diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp index e93bbaec7ee..9b4d7a9c803 100644 --- a/src/devices/sound/segapcm.cpp +++ b/src/devices/sound/segapcm.cpp @@ -39,7 +39,7 @@ void segapcm_device::device_start() std::fill(&m_ram[0], &m_ram[0x800], 0xff); - m_stream = stream_alloc_legacy(0, 2, clock() / 128); + m_stream = stream_alloc(0, 2, clock() / 128); save_item(NAME(m_low)); save_pointer(NAME(m_ram), 0x800); @@ -68,14 +68,14 @@ void segapcm_device::rom_bank_updated() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void segapcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* clear the buffers */ - memset(outputs[0], 0, samples*sizeof(*outputs[0])); - memset(outputs[1], 0, samples*sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); // reg function // ------------------------------------------------ @@ -113,7 +113,7 @@ void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sam int i; /* loop over samples on this channel */ - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { int8_t v; @@ -132,8 +132,8 @@ void segapcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sam v = read_byte(offset + (addr >> 8)) - 0x80; /* apply panning and advance */ - outputs[0][i] += v * (regs[2] & 0x7f); - outputs[1][i] += v * (regs[3] & 0x7f); + outputs[0].add_int(i, v * (regs[2] & 0x7f), 32768); + outputs[1].add_int(i, v * (regs[3] & 0x7f), 32768); addr = (addr + regs[7]) & 0xffffff; } diff --git a/src/devices/sound/segapcm.h b/src/devices/sound/segapcm.h index 8b9942a5727..f9869f2211f 100644 --- a/src/devices/sound/segapcm.h +++ b/src/devices/sound/segapcm.h @@ -41,7 +41,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/sid.cpp b/src/devices/sound/sid.cpp index 26ba13a1f4b..86264810fda 100644 --- a/src/devices/sound/sid.cpp +++ b/src/devices/sound/sid.cpp @@ -29,34 +29,10 @@ float filterResTable[16]; #define maxLogicalVoices 4 -const int mix16monoMiddleIndex = 256*maxLogicalVoices/2; -uint16_t mix16mono[256*maxLogicalVoices]; - -uint16_t zero16bit = 0; /* either signed or unsigned */ -//uint32_t splitBufferLen; - -void MixerInit(int threeVoiceAmplify) +inline stream_buffer::sample_t mix_mono(uint16_t usum) { - long si; - uint16_t ui; - long ampDiv = maxLogicalVoices; - - if (threeVoiceAmplify) - { - ampDiv = (maxLogicalVoices-1); - } - - /* Mixing formulas are optimized by sample input value. */ - - si = (-128*maxLogicalVoices) * 256; - for (ui = 0; ui < sizeof(mix16mono)/sizeof(uint16_t); ui++) - { - mix16mono[ui] = (uint16_t)(si/ampDiv) + zero16bit; - si+=256; - } - + return stream_buffer::sample_t(int16_t(usum - maxLogicalVoices*128)) * (1.0 / (256 * maxLogicalVoices)); } - } // anonymous namespace @@ -85,22 +61,22 @@ inline void SID6581_t::syncEm() } -void SID6581_t::fill_buffer(stream_sample_t *buffer, uint32_t bufferLen) +void SID6581_t::fill_buffer(write_stream_view &buffer) { //void* SID6581_t::fill16bitMono(void* buffer, uint32_t numberOfSamples) - for (; bufferLen > 0; bufferLen--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer++ = (int16_t) mix16mono[unsigned(mix16monoMiddleIndex - +(*optr[0].outProc)(&optr[0]) + buffer.put(sampindex, mix_mono( + (*optr[0].outProc)(&optr[0]) +(*optr[1].outProc)(&optr[1]) - +(optr[2].outProc(&optr[2])&optr3_outputmask) + +((*optr[2].outProc)(&optr[2])&optr3_outputmask) /* hack for digi sounds does n't seam to come from a tone operator ghostbusters and goldrunner everything except volume zeroed */ +(masterVolume<<2) // +(*sampleEmuRout)() - )]; + )); syncEm(); } } @@ -227,8 +203,6 @@ void SID6581_t::init() enveEmuInit(PCMfreq, true); - MixerInit(0); - reset(); } diff --git a/src/devices/sound/sid.h b/src/devices/sound/sid.h index 6e5ad1dfa3f..ecf27c2b300 100644 --- a/src/devices/sound/sid.h +++ b/src/devices/sound/sid.h @@ -63,7 +63,7 @@ struct SID6581_t int port_r(running_machine &machine, int offset); void port_w(int offset, int data); - void fill_buffer(stream_sample_t *buffer, uint32_t bufferLen); + void fill_buffer(write_stream_view &buffer); private: void syncEm(); diff --git a/src/devices/sound/sn76477.cpp b/src/devices/sound/sn76477.cpp index 2903af1904b..b8db037e26b 100644 --- a/src/devices/sound/sn76477.cpp +++ b/src/devices/sound/sn76477.cpp @@ -203,7 +203,7 @@ sn76477_device::sn76477_device(const machine_config &mconfig, const char *tag, d void sn76477_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); if (clock() > 0) { @@ -1698,10 +1698,10 @@ void sn76477_device::state_save_register() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void sn76477_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { double one_shot_cap_charging_step; double one_shot_cap_discharging_step; @@ -1720,7 +1720,7 @@ void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sam double voltage_out; double center_to_peak_voltage_out; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* compute charging values, doing it here ensures that we always use the latest values */ one_shot_cap_charging_step = compute_one_shot_cap_charging_rate() / m_our_sample_rate; @@ -1744,7 +1744,7 @@ void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sam /* process 'samples' number of samples */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { /* update the one-shot cap voltage */ if (!m_one_shot_cap_voltage_ext) @@ -1993,10 +1993,10 @@ void sn76477_device::sound_stream_update_legacy(sound_stream &stream, stream_sam 32767 = 2 * OUT_CENTER_LEVEL_VOLTAGE + OUT_LOW_CLIP_THRESHOLD / Vout - Vmin \ - sample = | ----------- - 1 | * 32767 + sample = | ----------- - 1 | \ Vcen - Vmin / */ - *buffer++ = (((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1) * 32767; + buffer.put(sampindex, ((voltage_out - OUT_LOW_CLIP_THRESHOLD) / (OUT_CENTER_LEVEL_VOLTAGE - OUT_LOW_CLIP_THRESHOLD)) - 1); if (LOG_WAV && (!m_enable || !LOG_WAV_ENABLED_ONLY)) { diff --git a/src/devices/sound/sn76477.h b/src/devices/sound/sn76477.h index 42fa82e5efc..094f8e78e1b 100644 --- a/src/devices/sound/sn76477.h +++ b/src/devices/sound/sn76477.h @@ -147,7 +147,7 @@ protected: virtual void device_stop() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: /* chip's external interface */ diff --git a/src/devices/sound/sn76496.cpp b/src/devices/sound/sn76496.cpp index 9bc686dedb2..eac04a2d99f 100644 --- a/src/devices/sound/sn76496.cpp +++ b/src/devices/sound/sn76496.cpp @@ -378,7 +378,6 @@ void sn76496_base_device::sound_stream_update(sound_stream &stream, std::vector< int16_t out; int16_t out2 = 0; - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int sampindex = 0; sampindex < lbuffer->samples(); sampindex++) { // clock chip once @@ -445,9 +444,9 @@ void sn76496_base_device::sound_stream_update(sound_stream &stream, std::vector< if (m_negate) { out = -out; out2 = -out2; } - lbuffer->put(sampindex, stream_buffer::sample_t(out) * sample_scale); + lbuffer->put_int(sampindex, out, 32768); if (m_stereo) - rbuffer->put(sampindex, stream_buffer::sample_t(out2) * sample_scale); + rbuffer->put_int(sampindex, out2, 32768); } } diff --git a/src/devices/sound/snkwave.cpp b/src/devices/sound/snkwave.cpp index 718dde017fb..44e6ba51466 100644 --- a/src/devices/sound/snkwave.cpp +++ b/src/devices/sound/snkwave.cpp @@ -44,7 +44,7 @@ void snkwave_device::device_start() m_sample_rate = m_external_clock >> CLOCK_SHIFT; /* get stream channels */ - m_stream = stream_alloc_legacy(0, 1, m_sample_rate); + m_stream = stream_alloc(0, 1, m_sample_rate); /* reset all the voices */ m_frequency = 0; @@ -60,26 +60,26 @@ void snkwave_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests +// sound_stream_update - handle update requests // for our sound stream //------------------------------------------------- -void snkwave_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void snkwave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - - /* zap the contents of the buffer */ - memset(buffer, 0, samples * sizeof(*buffer)); + auto &buffer = outputs[0]; assert(m_counter < 0x1000); assert(m_frequency < 0x1000); /* if no sound, we're done */ if (m_frequency == 0xfff) + { + buffer.fill(0); return; + } /* generate sound into buffer while updating the counter */ - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int loops; int16_t out = 0; @@ -104,7 +104,7 @@ void snkwave_device::sound_stream_update_legacy(sound_stream &stream, stream_sam } } - *buffer++ = out; + buffer.put_int(sampindex, out, 32768); } } diff --git a/src/devices/sound/snkwave.h b/src/devices/sound/snkwave.h index 2ecb5f7715d..bf40a33e500 100644 --- a/src/devices/sound/snkwave.h +++ b/src/devices/sound/snkwave.h @@ -26,7 +26,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: static constexpr unsigned WAVEFORM_LENGTH = 16; diff --git a/src/devices/sound/sp0250.cpp b/src/devices/sound/sp0250.cpp index e18143a29b0..862b3781a7c 100644 --- a/src/devices/sound/sp0250.cpp +++ b/src/devices/sound/sp0250.cpp @@ -258,9 +258,8 @@ void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_s if (!m_pwm_mode) { - constexpr stream_buffer::sample_t sample_scale = 1.0 / 128.0; for (int sampindex = 0; sampindex < output.samples(); sampindex++) - output.put(sampindex, stream_buffer::sample_t(next()) * sample_scale); + output.put_int(sampindex, next(), 128); } else { diff --git a/src/devices/sound/sp0256.cpp b/src/devices/sound/sp0256.cpp index b4d18e6d6d3..5188d3bc31f 100644 --- a/src/devices/sound/sp0256.cpp +++ b/src/devices/sound/sp0256.cpp @@ -74,7 +74,7 @@ void sp0256_device::device_start() m_drq_cb(1); m_sby_cb(1); - m_stream = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER); + m_stream = stream_alloc(0, 1, clock() / CLOCK_DIVIDER); /* -------------------------------------------------------------------- */ /* Configure our internal variables. */ @@ -1260,16 +1260,16 @@ TIMER_CALLBACK_MEMBER(sp0256_device::set_lrq_timer_proc) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void sp0256_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void sp0256_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *output = outputs[0]; + auto &output = outputs[0]; int output_index = 0; int length, did_samp/*, old_idx*/; - while (output_index < samples) + while (output_index < output.samples()) { /* ---------------------------------------------------------------- */ /* First, drain as much of our scratch buffer as we can into the */ @@ -1278,20 +1278,20 @@ void sp0256_device::sound_stream_update_legacy(sound_stream &stream, stream_samp while (m_sc_tail != m_sc_head) { - output[output_index++] = m_scratch[m_sc_tail++ & SCBUF_MASK]; + output.put_int(output_index++, m_scratch[m_sc_tail++ & SCBUF_MASK], 32768); m_sc_tail &= SCBUF_MASK; - if (output_index > samples) + if (output_index >= output.samples()) break; } /* ---------------------------------------------------------------- */ /* If output outputs is full, then we're done. */ /* ---------------------------------------------------------------- */ - if (output_index > samples) + if (output_index > output.samples()) break; - length = samples - output_index; + length = output.samples() - output_index; /* ---------------------------------------------------------------- */ /* Process the current set of filter coefficients as long as the */ diff --git a/src/devices/sound/sp0256.h b/src/devices/sound/sp0256.h index 3720b3429ed..d1e1d5612cf 100644 --- a/src/devices/sound/sp0256.h +++ b/src/devices/sound/sp0256.h @@ -61,7 +61,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct lpc12_t diff --git a/src/devices/sound/spkrdev.cpp b/src/devices/sound/spkrdev.cpp index 3fc3467771e..184a628fe73 100644 --- a/src/devices/sound/spkrdev.cpp +++ b/src/devices/sound/spkrdev.cpp @@ -76,7 +76,7 @@ #include "sound/spkrdev.h" -static constexpr int16_t default_levels[2] = {0, 32767}; +static constexpr double default_levels[2] = {0.0, 1.0}; // Internal oversampling factor (interm. samples vs stream samples) static constexpr int RATE_MULTIPLIER = 4; @@ -102,7 +102,7 @@ void speaker_sound_device::device_start() int i; double x; - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); m_level = 0; for (i = 0; i < FILTER_LENGTH; i++) @@ -198,23 +198,23 @@ void speaker_sound_device::device_post_load() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- // This can be triggered by the core (based on emulated time) or via level_w(). -void speaker_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void speaker_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - int volume = m_levels[m_level]; + auto &buffer = outputs[0]; + double volume = m_levels[m_level]; double filtered_volume; attotime sampled_time = attotime::zero; - if (samples > 0) + if (buffer.samples() > 0) { /* Prepare to update time state */ sampled_time = attotime(0, m_channel_sample_period); - if (samples > 1) - sampled_time *= samples; + if (buffer.samples() > 1) + sampled_time *= buffer.samples(); /* Note: since the stream is in the process of being updated, * stream->sample_time() will return the time before the update! (MAME 0.130) @@ -222,19 +222,19 @@ void speaker_sound_device::sound_stream_update_legacy(sound_stream &stream, stre */ } - if (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); ) { /* Note that first interm. sample may be composed... */ filtered_volume = update_interm_samples_get_filtered_volume(volume); /* Composite volume is now quantized to the stream resolution */ - *buffer++ = (stream_sample_t)filtered_volume; + buffer.put(sampindex++, filtered_volume); /* Any additional samples will be homogeneous, however may need filtering across samples: */ - while (samples-- > 0) + while (sampindex < buffer.samples()) { filtered_volume = update_interm_samples_get_filtered_volume(volume); - *buffer++ = (stream_sample_t)filtered_volume; + buffer.put(sampindex++, filtered_volume); } /* Update the time state */ @@ -322,7 +322,7 @@ void speaker_sound_device::update_interm_samples(const attotime &time, int volum } -double speaker_sound_device::update_interm_samples_get_filtered_volume(int volume) +double speaker_sound_device::update_interm_samples_get_filtered_volume(double volume) { double filtered_volume, tempx; @@ -355,7 +355,7 @@ double speaker_sound_device::update_interm_samples_get_filtered_volume(int volum } -void speaker_sound_device::finalize_interm_sample(int volume) +void speaker_sound_device::finalize_interm_sample(double volume) { double fraction; @@ -401,7 +401,7 @@ double speaker_sound_device::get_filtered_volume() { if (i >= FILTER_LENGTH) i = 0; filtered_volume += m_composed_volume[i] * m_ampl[c]; - ampsum += m_ampl[c]; + ampsum += std::abs(m_ampl[c]); } filtered_volume /= ampsum; diff --git a/src/devices/sound/spkrdev.h b/src/devices/sound/spkrdev.h index 7411e47170d..596a4f94854 100644 --- a/src/devices/sound/spkrdev.h +++ b/src/devices/sound/spkrdev.h @@ -21,7 +21,7 @@ public: ~speaker_sound_device() {} // configuration - void set_levels(int num_levels, const int16_t *levels) { m_num_levels = num_levels; m_levels = levels; } + void set_levels(int num_levels, const double *levels) { m_num_levels = num_levels; m_levels = levels; } void level_w(int new_level); // can use as writeline @@ -32,7 +32,7 @@ protected: virtual void device_post_load() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // Length of anti-aliasing filter kernel, measured in number of intermediate samples @@ -47,9 +47,9 @@ private: void update_interm_samples(const attotime &time, int volume); // Updates the composed volume array and returns final filtered volume of next stream sample - double update_interm_samples_get_filtered_volume(int volume); + double update_interm_samples_get_filtered_volume(double volume); - void finalize_interm_sample(int volume); + void finalize_interm_sample(double volume); void init_next_interm_sample(); inline double make_fraction(const attotime &a, const attotime &b, double timediv); double get_filtered_volume(); @@ -80,7 +80,7 @@ private: double m_prevx, m_prevy; int m_num_levels; /* optional: number of levels (if not two) */ - const int16_t *m_levels; /* optional: pointer to level lookup table */ + const double *m_levels; /* optional: pointer to level lookup table */ }; DECLARE_DEVICE_TYPE(SPEAKER_SOUND, speaker_sound_device) diff --git a/src/devices/sound/spu.cpp b/src/devices/sound/spu.cpp index 82f5d3973ac..9a8f503cf04 100644 --- a/src/devices/sound/spu.cpp +++ b/src/devices/sound/spu.cpp @@ -272,7 +272,8 @@ public: invalid_end, loopaddr, last_update_end; - signed short *data,*loop,*dend; + std::unique_ptr<signed short []> data; + signed short *loop,*dend; adpcm_decoder decoder, update_decoder; mutable int ref_count; bool valid, @@ -301,8 +302,8 @@ public: ref_count--; if (ref_count==0) { - cache_size-=(dend-data)<<1; - global_free(this); + cache_size-=(dend-data.get())<<1; + delete this; } } @@ -521,7 +522,7 @@ public: head=xam->offset; marker_tail=xam->prev; if (marker_tail) marker_tail->next=nullptr; - global_free(xam); + delete xam; } // Set marker head to nullptr if the list is now empty @@ -544,7 +545,7 @@ public: { stream_marker *m=marker_head; marker_head=marker_head->next; - global_free(m); + delete m; } marker_head=marker_tail=nullptr; @@ -566,7 +567,7 @@ public: stream_marker *xam=marker_head; marker_head=xam->next; - global_free(xam); + delete xam; if (marker_head) marker_head->prev=nullptr; } @@ -606,12 +607,12 @@ static inline int clamp(const int v) spu_device::sample_cache::~sample_cache() { - global_free_array(data); + data.reset(); while (loop_cache) { sample_loop_cache *lc=loop_cache; loop_cache=lc->next; - global_free(lc); + delete lc; } } @@ -623,7 +624,7 @@ signed short *spu_device::sample_cache::get_sample_pointer(const unsigned int ad { if ((addr>=start) && (addr<end)) { - return data+(((addr-start)>>4)*28); + return &data[((addr-start)>>4)*28]; } else { return nullptr; @@ -668,9 +669,9 @@ bool spu_device::sample_cache::get_loop_pointer(cache_pointer *cp) unsigned int spu_device::sample_cache::get_sample_address(const signed short *ptr) const { - if ((ptr>=data) && (ptr<=dend)) + if ((ptr>=data.get()) && (ptr<=dend)) { - return start+(((ptr-data)/28)<<4); + return start+(((ptr-data.get())/28)<<4); } else { return -1; @@ -705,7 +706,7 @@ void spu_device::sample_cache::add_loop_cache(sample_loop_cache *lc) bool spu_device::sample_cache::is_valid_pointer(signed short *ptr) const { - if ((ptr>=data) && (data<=dend)) return true; + if ((ptr>=data.get()) && (data.get()<=dend)) return true; for (sample_loop_cache *slc=loop_cache; slc; slc=slc->next) if ((ptr>=slc->data) && (ptr<(slc->data+num_loop_cache_samples))) return true; @@ -720,7 +721,7 @@ bool spu_device::sample_cache::try_update(spu_device *spu) { if ((invalid_start>=start) && (invalid_end<=end)) { - adpcm_packet *ap=(adpcm_packet *)(spu->spu_ram+start); + adpcm_packet *ap=(adpcm_packet *)&spu->spu_ram[start]; unsigned int a; unsigned int loop=0; @@ -756,8 +757,8 @@ bool spu_device::sample_cache::try_update(spu_device *spu) printf("\n"); #endif - signed short *dp=data+(((invalid_start-start)>>4)*28); - ap=(adpcm_packet *)(spu->spu_ram+invalid_start); + signed short *dp=&data[((invalid_start-start)>>4)*28]; + ap=(adpcm_packet *)&spu->spu_ram[invalid_start]; for (a=invalid_start; a<invalid_end; a+=16, ap++) dp=update_decoder.decode_packet(ap,dp); @@ -779,7 +780,7 @@ bool spu_device::sample_cache::try_update(spu_device *spu) signed short *dpend=dp+lc->len; unsigned int adr=lc->loopstart; for (unsigned int i=0; ((i<num_loop_cache_packets) && (dp<dpend)); i++, adr+=16) - dp=tmp.decode_packet((adpcm_packet *)(spu->spu_ram+adr),dp); + dp=tmp.decode_packet((adpcm_packet *)&spu->spu_ram[adr],dp); } } @@ -847,7 +848,7 @@ bool spu_device::cache_pointer::update(spu_device *spu) // Cache is invalid, calculate play address offset from start of // old cache block - unsigned int off=ptr-cache->data, + unsigned int off=ptr-cache->data.get(), addr=cache->start; // Release cache block and get updated one @@ -856,7 +857,7 @@ bool spu_device::cache_pointer::update(spu_device *spu) // Calculate play address in new cache block - ptr=cache->data+off; + ptr=&cache->data[off]; if (ptr>=cache->dend) { @@ -870,7 +871,7 @@ bool spu_device::cache_pointer::update(spu_device *spu) // Return false if we do not have a cache block or the play address is invalid - if ((cache) && ((ptr>=cache->data) && (ptr<cache->dend))) + if ((cache) && ((ptr>=cache->data.get()) && (ptr<cache->dend))) { return true; } else @@ -967,15 +968,15 @@ void spu_device::device_start() m_irq_handler.resolve_safe(); voice=new voiceinfo [24]; - spu_ram=new unsigned char [spu_ram_size]; + spu_ram=std::make_unique<unsigned char []>(spu_ram_size); xa_buffer=new spu_stream_buffer(xa_sector_size,xa_buffer_sectors); cdda_buffer=new spu_stream_buffer(cdda_sector_size,cdda_buffer_sectors); init_stream(); - cache=new sample_cache *[spu_ram_size>>4]; - memset(cache,0,(spu_ram_size>>4)*sizeof(sample_cache *)); + cache=std::make_unique<sample_cache * []>(spu_ram_size>>4); + std::fill_n(cache.get(), spu_ram_size>>4, nullptr); // register save state stuff save_item(NAME(reg)); // this covers all spureg.* plus the reverb parameter block @@ -1031,16 +1032,16 @@ void spu_device::device_reset() cdda_playing=false; m_cd_out_ptr = 0; - memset(spu_ram,0,spu_ram_size); + memset(spu_ram.get(),0,spu_ram_size); memset(reg,0,0x200); memset(voice,0,sizeof(voiceinfo)*24); spureg.status|=(1<<7)|(1<<10); - memset(cache,0,(spu_ram_size>>4)*sizeof(sample_cache *)); + std::fill_n(cache.get(), spu_ram_size>>4, nullptr); for (auto & elem : output_buf) - elem=new unsigned char [output_buffer_size]; + elem=std::make_unique<unsigned char []>(output_buffer_size); output_head=output_tail=output_size=0; noise_t=0; @@ -1058,7 +1059,7 @@ void spu_device::device_post_load() dirty_flags = -1; // kill and reallocate reverb to avoid artifacts - global_free(rev); + delete rev; rev = new reverb(44100); // and do some update processing @@ -1074,16 +1075,16 @@ void spu_device::device_post_load() void spu_device::device_stop() { for (auto & elem : output_buf) - global_free_array(elem); + elem.reset(); kill_stream(); - global_free_array(spu_ram); + spu_ram.reset(); invalidate_cache(0,spu_ram_size); - global_free_array(cache); - global_free(xa_buffer); - global_free(cdda_buffer); - global_free_array(voice); + cache.reset(); + delete xa_buffer; + delete cdda_buffer; + delete [] voice; } // // @@ -1093,7 +1094,7 @@ void spu_device::init_stream() { const unsigned int hz=44100; - m_stream = stream_alloc_legacy(0, 2, hz); + m_stream = stream_alloc(0, 2, hz); rev=new reverb(hz); @@ -1107,7 +1108,7 @@ void spu_device::init_stream() void spu_device::kill_stream() { - global_free(rev); + delete rev; rev=nullptr; } @@ -1262,7 +1263,7 @@ void spu_device::write_data(const unsigned short data) assert(taddr<spu_ram_size); if (cache[taddr>>4]) flush_cache(cache[taddr>>4],taddr,taddr+2); - *((unsigned short *)(spu_ram+taddr))=data; + *((unsigned short *)&spu_ram[taddr])=data; taddr+=2; } @@ -1342,7 +1343,7 @@ spu_device::sample_cache *spu_device::get_sample_cache(const unsigned int addr) sc->start=addr; sc->loop=nullptr; - adpcm_packet *ap=(adpcm_packet *)(spu_ram+sc->start); + adpcm_packet *ap=(adpcm_packet *)&spu_ram[sc->start]; unsigned int a; for (a=addr; a<(512*1024); a+=16, ap++) { @@ -1358,13 +1359,13 @@ spu_device::sample_cache *spu_device::get_sample_cache(const unsigned int addr) sc->end=(std::min)(spu_ram_size,a+16); unsigned int sz=((sc->end-sc->start)>>4)*28; - sc->data=new signed short [sz]; + sc->data=std::make_unique<signed short []>(sz); sample_cache::cache_size+=sz<<1; sc->loopaddr=loop; - if (loop) sc->loop=sc->data+(((loop-sc->start)>>4)*28); + if (loop) sc->loop=&sc->data[((loop-sc->start)>>4)*28]; - signed short *dp=sc->data; - ap=(adpcm_packet *)(spu_ram+sc->start); + signed short *dp=sc->data.get(); + ap=(adpcm_packet *)&spu_ram[sc->start]; for (a=sc->start; a<sc->end; a+=16, ap++) dp=sc->decoder.decode_packet(ap,dp); @@ -1389,7 +1390,7 @@ bool spu_device::translate_sample_addr(const unsigned int addr, cache_pointer *c cp->reset(); if ((cp->cache=get_sample_cache(addr))) { - cp->ptr=cp->cache->data+(((addr-cp->cache->start)>>4)*28); + cp->ptr=&cp->cache->data[((addr-cp->cache->start)>>4)*28]; cp->cache->add_ref(); return true; } @@ -1530,7 +1531,7 @@ spu_device::sample_loop_cache *spu_device::get_loop_cache(sample_cache *cache, c signed short *dp=lc->data; for (unsigned int i=0; ((i<num_loop_cache_packets) && (adr<lpcache->end)); i++, adr+=16) - dp=tmp.decode_packet((adpcm_packet *)(spu_ram+adr),dp); + dp=tmp.decode_packet((adpcm_packet *)&spu_ram[adr],dp); #ifdef log_loop_cache log(log_spu,"spu: add loop cache %08x %08x->%08x (end at %08x)\n",lc,lpen,lpst,adr); @@ -1572,7 +1573,7 @@ void spu_device::update_voice_loop(const unsigned int v) { ra=spureg.voice[v].repaddr<<3; ra=(ra+0xf)&~0xf; - const adpcm_packet *ap=ra?(adpcm_packet *)(spu_ram+ra):nullptr; + const adpcm_packet *ap=ra?(adpcm_packet *)&spu_ram[ra]:nullptr; if (ap) { @@ -2393,8 +2394,8 @@ void spu_device::generate_xa(void *ptr, const unsigned int sz) // Write to SPU XA buffer (for emulation purposes - some games read this // back to do analysers, etc...) - *(signed short *)(spu_ram+xa_out_ptr)=vl; - *(signed short *)(spu_ram+xa_out_ptr+0x800)=vr; + *(signed short *)&spu_ram[xa_out_ptr]=vl; + *(signed short *)&spu_ram[xa_out_ptr+0x800]=vr; xa_out_ptr=(xa_out_ptr+2)&0x7ff; // Mix samples into output buffer @@ -2430,7 +2431,7 @@ void spu_device::generate_xa(void *ptr, const unsigned int sz) { xa_playing=false; - memset(spu_ram,0,0x1000); + memset(spu_ram.get(),0,0x1000); xa_out_ptr=0; } } @@ -2465,8 +2466,8 @@ void spu_device::generate_cdda(void *ptr, const unsigned int sz) int16_t vr = ((sp[1]*volr)>>15); // if the volume adjusted samples are stored here, vibribbon does nothing - *(signed short *)(spu_ram+m_cd_out_ptr)=sp[0]; - *(signed short *)(spu_ram+m_cd_out_ptr+0x400)=sp[1]; + *(signed short *)&spu_ram[m_cd_out_ptr]=sp[0]; + *(signed short *)&spu_ram[m_cd_out_ptr+0x400]=sp[1]; m_cd_out_ptr=(m_cd_out_ptr+2)&0x3ff; //if((m_cd_out_ptr == ((spureg.irq_addr << 3) & ~0x400)) && (spureg.ctrl & spuctrl_irq_enable)) @@ -2575,10 +2576,10 @@ void spu_device::generate(void *ptr, const unsigned int sz) while ((left) && (output_size)) { unsigned int n=(std::min)((std::min)(left,output_buffer_size-output_head),output_size); - memcpy(dp,output_buf[0]+output_head,n); + memcpy(dp,&output_buf[0][output_head],n); rev->process((signed short *)dp, - (signed short *)(output_buf[1]+output_head), + (signed short *)&output_buf[1][output_head], spu_reverb_cfg, (signed short)spureg.rvol_l, (signed short)spureg.rvol_r, @@ -2683,10 +2684,10 @@ void spu_device::process_until(const unsigned int tsample) process_samples=(std::min)(process_samples, (output_buffer_size-output_tail)>>2); - unsigned char *outptr=output_buf[0]+output_tail, - *reverbptr=output_buf[1]+output_tail, - *fmptr=output_buf[2]+output_tail, - *noiseptr=output_buf[3]+output_tail; + unsigned char *outptr=&output_buf[0][output_tail], + *reverbptr=&output_buf[1][output_tail], + *fmptr=&output_buf[2][output_tail], + *noiseptr=&output_buf[3][output_tail]; output_tail+=process_samples<<2; output_tail&=(output_buffer_size-1); @@ -2761,21 +2762,20 @@ void spu_device::update_timing() // // -void spu_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void spu_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; int16_t temp[44100], *src; - outL = outputs[0]; - outR = outputs[1]; + auto &outL = outputs[0]; + auto &outR = outputs[1]; - generate(temp, samples*4); // second parameter is bytes, * 2 (size of int16_t) * 2 (stereo) + generate(temp, outputs[0].samples()*4); // second parameter is bytes, * 2 (size of int16_t) * 2 (stereo) src = &temp[0]; - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { - *outL++ = *src++; - *outR++ = *src++; + outL.put_int(i, *src++, 32768); + outR.put_int(i, *src++, 32768); } } @@ -2797,13 +2797,13 @@ void spu_device::start_dma(uint8_t *mainram, bool to_spu, uint32_t size) { invalidate_cache(st,en); - memcpy(spu_ram+(spureg.trans_addr<<3), mainram, size); + memcpy(&spu_ram[spureg.trans_addr<<3], mainram, size); dirty_flags|=dirtyflag_ram; } else { - memcpy(mainram, spu_ram+(spureg.trans_addr<<3), size); + memcpy(mainram, &spu_ram[spureg.trans_addr<<3], size); } } @@ -3034,7 +3034,7 @@ bool spu_device::play_cdda(const unsigned int sector, const unsigned char *cdda) flip[i] = flip[i+1]; flip[i+1] = temp; } - // this should be done in generate but sound_stream_update_legacy may not be called frequently enough + // this should be done in generate but sound_stream_update may not be called frequently enough if(((spureg.irq_addr << 3) < 0x800) && (spureg.ctrl & spuctrl_irq_enable)) m_irq_handler(1); diff --git a/src/devices/sound/spu.h b/src/devices/sound/spu.h index 7913670c667..7aee602e38c 100644 --- a/src/devices/sound/spu.h +++ b/src/devices/sound/spu.h @@ -35,7 +35,7 @@ protected: virtual void device_post_load() override; virtual void device_stop() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; static constexpr float ms_to_rate(float ms) { return 1.0f / (ms * (float(spu_base_frequency_hz) / 1000.0f)); } static constexpr float s_to_rate(float s) { return ms_to_rate(s * 1000.0f); } @@ -49,7 +49,7 @@ protected: // internal state devcb_write_line m_irq_handler; - unsigned char *spu_ram; + std::unique_ptr<unsigned char []> spu_ram; reverb *rev; unsigned int taddr; unsigned int sample_t; @@ -73,13 +73,13 @@ protected: bool status_enabled, xa_playing, cdda_playing; int xa_voll, xa_volr, changed_xa_vol; voiceinfo *voice; - sample_cache **cache; + std::unique_ptr<sample_cache * []> cache; float samples_per_frame; float samples_per_cycle; static float freq_multiplier; - unsigned char *output_buf[4]; + std::unique_ptr<unsigned char []> output_buf[4]; unsigned int output_head; unsigned int output_tail; unsigned int output_size; diff --git a/src/devices/sound/spureverb.cpp b/src/devices/sound/spureverb.cpp index cf747af1acb..e57c33d448d 100644 --- a/src/devices/sound/spureverb.cpp +++ b/src/devices/sound/spureverb.cpp @@ -34,15 +34,11 @@ spu_device::reverb::reverb(const int hz, const int maxdelay) for (int c=0; c<2; c++) { for (int f=0; f<4; f++) { - y[c][f]=new signed short [maxdelay]; - memset(y[c][f], 0, sizeof(signed short) * maxdelay); + y[c][f]=make_unique_clear<signed short []>(maxdelay); } - x[c]=new signed short [maxdelay]; - memset(x[c], 0, sizeof(signed short) * maxdelay); - ax[c]=new signed short [maxdelay]; - memset(ax[c], 0, sizeof(signed short) * maxdelay); - ay[c]=new signed short [maxdelay]; - memset(ay[c], 0, sizeof(signed short) * maxdelay); + x[c]=make_unique_clear<signed short []>(maxdelay); + ax[c]=make_unique_clear<signed short []>(maxdelay); + ay[c]=make_unique_clear<signed short []>(maxdelay); } memset(bx1,0,sizeof(bx1)); memset(by1,0,sizeof(by1)); @@ -54,14 +50,6 @@ spu_device::reverb::reverb(const int hz, const int maxdelay) spu_device::reverb::~reverb() { - for (int c=0; c<2; c++) - { - for (int f=0; f<4; f++) - global_free_array(y[c][f]); - global_free_array(x[c]); - global_free_array(ax[c]); - global_free_array(ay[c]); - } } // diff --git a/src/devices/sound/spureverb.h b/src/devices/sound/spureverb.h index 64b174bcfb6..d87c3a6b4b8 100644 --- a/src/devices/sound/spureverb.h +++ b/src/devices/sound/spureverb.h @@ -29,12 +29,12 @@ struct spu_device::reverb_preset class spu_device::reverb { - signed short - *y[2][4], - *x[2], - *ax[2], - *ay[2], - bx1[2][2],by1[2]; + std::unique_ptr<signed short []> + y[2][4], + x[2], + ax[2], + ay[2]; + signed short bx1[2][2],by1[2]; int yp, max_delay, sound_hz; typedef int comb_param[2][4]; diff --git a/src/devices/sound/st0016.cpp b/src/devices/sound/st0016.cpp index e0318eca466..d13dfd7cacc 100644 --- a/src/devices/sound/st0016.cpp +++ b/src/devices/sound/st0016.cpp @@ -43,7 +43,7 @@ st0016_device::st0016_device(const machine_config &mconfig, const char *tag, dev void st0016_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); m_ram_read_cb.resolve_safe(0); save_item(NAME(m_vpos)); @@ -54,10 +54,10 @@ void st0016_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void st0016_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int v, i, snum; unsigned char *slot; @@ -66,7 +66,7 @@ void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_samp int16_t sample; int sptr, eptr, freq, lsptr, leptr; - memset(mix, 0, sizeof(mix[0])*samples*2); + memset(mix, 0, sizeof(mix[0])*outputs[0].samples()*2); for (v = 0; v < 8; v++) { @@ -82,7 +82,7 @@ void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_samp lsptr = slot[0x06]<<16 | slot[0x05]<<8 | slot[0x04]; leptr = slot[0x0a]<<16 | slot[0x09]<<8 | slot[0x08]; - for (snum = 0; snum < samples; snum++) + for (snum = 0; snum < outputs[0].samples(); snum++) { sample = m_ram_read_cb((sptr + m_vpos[v]) & 0x1fffff) << 8; @@ -124,10 +124,10 @@ void st0016_device::sound_stream_update_legacy(sound_stream &stream, stream_samp } mixp = &mix[0]; - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { - outputs[0][i] = (*mixp++)>>4; - outputs[1][i] = (*mixp++)>>4; + outputs[0].put_int(i, *mixp++, 32768<<4); + outputs[1].put_int(i, *mixp++, 32768<<4); } } diff --git a/src/devices/sound/st0016.h b/src/devices/sound/st0016.h index 21dd14e07c7..b18317da348 100644 --- a/src/devices/sound/st0016.h +++ b/src/devices/sound/st0016.h @@ -27,7 +27,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/devices/sound/swp00.cpp b/src/devices/sound/swp00.cpp index d4d323af0a5..f94006a1868 100644 --- a/src/devices/sound/swp00.cpp +++ b/src/devices/sound/swp00.cpp @@ -21,7 +21,7 @@ void swp00_device::device_add_mconfig(machine_config &config) void swp00_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); } void swp00_device::device_reset() @@ -97,6 +97,8 @@ void swp00_device::snd_w(offs_t offset, u8 data) // Synthesis -void swp00_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void swp00_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); + outputs[1].fill(0); } diff --git a/src/devices/sound/swp00.h b/src/devices/sound/swp00.h index 0bf2d8b43d3..ae732979606 100644 --- a/src/devices/sound/swp00.h +++ b/src/devices/sound/swp00.h @@ -21,7 +21,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void rom_bank_updated() override; virtual void device_add_mconfig(machine_config &config) override; diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp index c1c92c8cb27..a9de3851fef 100644 --- a/src/devices/sound/swp20.cpp +++ b/src/devices/sound/swp20.cpp @@ -69,7 +69,8 @@ void swp20_device::snd_w(offs_t offset, u8 data) logerror("w %02x, %02x %s\n", offset, data, machine().describe_context()); } -void swp20_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void swp20_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h index a65bae793a3..7323dd64f17 100644 --- a/src/devices/sound/swp20.h +++ b/src/devices/sound/swp20.h @@ -20,7 +20,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void rom_bank_updated() override; private: diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp index 849af9f9946..aec573aa07a 100644 --- a/src/devices/sound/swp30.cpp +++ b/src/devices/sound/swp30.cpp @@ -163,7 +163,7 @@ void swp30_device::device_add_mconfig(machine_config &config) void swp30_device::device_start() { - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); // Attenuantion for panning is 4.4 floating point. That means 0 // to -96.3dB. Since it's a nice range, we assume it's the same @@ -761,12 +761,12 @@ void swp30_device::snd_w(offs_t offset, u16 data) // Synthesis -void swp30_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void swp30_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // Loop first on the samples and not on the channels otherwise // effects will be annoying to implement. - for(int sample = 0; sample < samples; sample++) { + for(int sample = 0; sample < outputs[0].samples(); sample++) { // Accumulate on 64 bits, shift/clamp at the end s64 acc_left = 0, acc_right = 0; @@ -871,17 +871,9 @@ void swp30_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl // Global EQ is missing (it's done in the MEG) acc_left >>= (16+6); - if(acc_left < -0x8000) - acc_left = -0x8000; - else if(acc_left > 0x7fff) - acc_left = 0x7fff; - outputs[0][sample] = acc_left; + outputs[0].put_int_clamp(sample, acc_left, 32768); acc_right >>= (16+6); - if(acc_right < -0x8000) - acc_right = -0x8000; - else if(acc_right > 0x7fff) - acc_right = 0x7fff; - outputs[1][sample] = acc_right; + outputs[1].put_int_clamp(sample, acc_right, 32768); } } diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h index fc8424b66d2..1eb68270626 100644 --- a/src/devices/sound/swp30.h +++ b/src/devices/sound/swp30.h @@ -21,7 +21,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void rom_bank_updated() override; virtual void device_add_mconfig(machine_config &config) override; diff --git a/src/devices/sound/t6721a.cpp b/src/devices/sound/t6721a.cpp index 7c0c07544e0..2c29e31dc62 100644 --- a/src/devices/sound/t6721a.cpp +++ b/src/devices/sound/t6721a.cpp @@ -56,17 +56,18 @@ void t6721a_device::device_start() m_write_apd.resolve_safe(); // create sound stream - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void t6721a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void t6721a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } diff --git a/src/devices/sound/t6721a.h b/src/devices/sound/t6721a.h index 208cd7e8896..52a76393894 100644 --- a/src/devices/sound/t6721a.h +++ b/src/devices/sound/t6721a.h @@ -65,7 +65,7 @@ protected: virtual void device_start() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum diff --git a/src/devices/sound/t6w28.cpp b/src/devices/sound/t6w28.cpp index 6c024c37757..9525794e489 100644 --- a/src/devices/sound/t6w28.cpp +++ b/src/devices/sound/t6w28.cpp @@ -101,14 +101,14 @@ void t6w28_device::write(offs_t offset, uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i; - stream_sample_t *buffer0 = outputs[0]; - stream_sample_t *buffer1 = outputs[1]; + auto &buffer0 = outputs[0]; + auto &buffer1 = outputs[1]; /* If the volume is 0, increase the counter */ @@ -119,11 +119,11 @@ void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl /* note that I do count += samples, NOT count = samples + 1. You might think */ /* it's the same since the volume is 0, but doing the latter could cause */ /* interferencies when the program is rapidly modulating the volume. */ - if (m_count[i] <= samples*STEP) m_count[i] += samples*STEP; + if (m_count[i] <= buffer0.samples()*STEP) m_count[i] += buffer0.samples()*STEP; } } - while (samples > 0) + for (int sampindex = 0; sampindex < buffer0.samples(); sampindex++) { int vol[8]; unsigned int out0, out1; @@ -252,10 +252,8 @@ void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl if (out0 > MAX_OUTPUT * STEP) out0 = MAX_OUTPUT * STEP; if (out1 > MAX_OUTPUT * STEP) out1 = MAX_OUTPUT * STEP; - *(buffer0++) = out0 / STEP; - *(buffer1++) = out1 / STEP; - - samples--; + buffer0.put_int(sampindex, out0 / STEP, 32768); + buffer1.put_int(sampindex, out1 / STEP, 32768); } } @@ -296,7 +294,7 @@ void t6w28_device::device_start() int i; m_sample_rate = clock() / 16; - m_channel = stream_alloc_legacy(0, 2, m_sample_rate); + m_channel = stream_alloc(0, 2, m_sample_rate); for (i = 0;i < 8;i++) m_volume[i] = 0; diff --git a/src/devices/sound/t6w28.h b/src/devices/sound/t6w28.h index f1112f58839..6b953449f87 100644 --- a/src/devices/sound/t6w28.h +++ b/src/devices/sound/t6w28.h @@ -18,7 +18,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void set_gain(int gain); diff --git a/src/devices/sound/tc8830f.cpp b/src/devices/sound/tc8830f.cpp index e387cc746f7..85635f2f466 100644 --- a/src/devices/sound/tc8830f.cpp +++ b/src/devices/sound/tc8830f.cpp @@ -46,7 +46,7 @@ tc8830f_device::tc8830f_device(const machine_config &mconfig, const char *tag, d void tc8830f_device::device_start() { // create the stream - m_stream = stream_alloc_legacy(0, 1, clock() / 0x10); + m_stream = stream_alloc(0, 1, clock() / 0x10); // register for savestates save_item(NAME(m_playing)); @@ -79,11 +79,11 @@ void tc8830f_device::device_clock_changed() -void tc8830f_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tc8830f_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int32_t mix = 0; - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { if (m_playing) { @@ -125,7 +125,7 @@ void tc8830f_device::sound_stream_update_legacy(sound_stream &stream, stream_sam mix = m_output; } - outputs[0][i] = mix; + outputs[0].put_int(i, mix, 32768); } } diff --git a/src/devices/sound/tc8830f.h b/src/devices/sound/tc8830f.h index e0e715ccbef..0a447b02dba 100644 --- a/src/devices/sound/tc8830f.h +++ b/src/devices/sound/tc8830f.h @@ -32,7 +32,7 @@ protected: virtual void device_post_load() override; virtual void device_clock_changed() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/devices/sound/tiaintf.cpp b/src/devices/sound/tiaintf.cpp index 5c85db19b91..5a64db7bb4c 100644 --- a/src/devices/sound/tiaintf.cpp +++ b/src/devices/sound/tiaintf.cpp @@ -31,7 +31,7 @@ tia_device::tia_device(const machine_config &mconfig, const char *tag, device_t void tia_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, clock()); + m_channel = stream_alloc(0, 1, clock()); m_chip = tia_sound_init(this, clock(), clock(), 16); if (!m_chip) throw emu_fatalerror("tia_device(%s): Error creating TIA chip", tag()); @@ -49,12 +49,12 @@ void tia_device::device_stop() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tia_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tia_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - tia_process(m_chip, outputs[0], samples); + tia_process(m_chip, outputs[0]); } diff --git a/src/devices/sound/tiaintf.h b/src/devices/sound/tiaintf.h index c86be7173a9..8ef5d0341f7 100644 --- a/src/devices/sound/tiaintf.h +++ b/src/devices/sound/tiaintf.h @@ -24,7 +24,7 @@ protected: virtual void device_stop() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_channel; diff --git a/src/devices/sound/tiasound.cpp b/src/devices/sound/tiasound.cpp index 0e8275fb33f..87fa657bfab 100644 --- a/src/devices/sound/tiasound.cpp +++ b/src/devices/sound/tiasound.cpp @@ -90,16 +90,127 @@ namespace { -struct tia +class tia { - /* structures to hold the 6 tia sound control bytes */ - uint8_t AUDC[2]; /* AUDCx (15, 16) */ - uint8_t AUDF[2]; /* AUDFx (17, 18) */ - int16_t AUDV[2]; /* AUDVx (19, 1A) */ +public: + tia(device_t &device, int clock, int sample_rate, int gain) : + tia_gain(gain) // set the gain factor (normally use TIA_DEFAULT_GAIN) + { + // fill the polynomials + poly_init(Bit4, 4, 4, 3); + poly_init(Bit5, 5, 5, 3); + poly_init(Bit9, 9, 9, 5); + + // calculate the sample 'divide by N' value based on the playback freq. + Samp_n_max = ((uint16_t)(uint32_t)clock << 8) / sample_rate; + Samp_n_cnt = Samp_n_max; /* initialize all bits of the sample counter */ + + if (Samp_n_max < 256) // we need to use oversampling for sample_rate > clock_rate + { + Samp_n_max = ((uint16_t)(uint32_t)sample_rate << 8) / clock; + Samp_n_cnt = Samp_n_max; + oversampling = true; + } + + device.save_item(NAME(AUDC)); + device.save_item(NAME(AUDF)); + device.save_item(NAME(AUDV)); + device.save_item(NAME(Outvol)); + device.save_item(NAME(P4)); + device.save_item(NAME(P5)); + device.save_item(NAME(P9)); + device.save_item(NAME(Div_n_cnt)); + device.save_item(NAME(Div_n_max)); + device.save_item(NAME(Div_3_cnt)); + device.save_item(NAME(Samp_n_cnt)); + device.save_item(NAME(oversampling)); + } + + void write(offs_t offset, uint8_t data) + { + // determine which address was changed + uint8_t chan; + switch (offset) + { + case AUDC0: + AUDC[0] = data & 0x0f; + chan = 0; + break; + + case AUDC1: + AUDC[1] = data & 0x0f; + chan = 1; + break; + + case AUDF0: + AUDF[0] = data & 0x1f; + chan = 0; + break; + + case AUDF1: + AUDF[1] = data & 0x1f; + chan = 1; + break; + + case AUDV0: + AUDV[0] = ((data & 0x0f) << AUDV_SHIFT); + chan = 0; + break; + + case AUDV1: + AUDV[1] = ((data & 0x0f) << AUDV_SHIFT); + chan = 1; + break; + + default: + return; + } + + // an AUDC value of 0 is a special case + uint16_t new_val; + if (AUDC[chan] == SET_TO_1 || AUDC[chan] == POLY5_POLY5) + { + // indicate the clock is zero so no processing will occur + new_val = 0; + + // and set the output to the selected volume + Outvol[chan] = AUDV[chan]; + } + else + { + // otherwise calculate the 'divide by N' value + new_val = AUDF[chan] + 1; + + // if bits 2 & 3 are set, then multiply the 'div by n' count by 3 + if ((AUDC[chan] & DIV3_MASK) == DIV3_MASK && AUDC[chan] != POLY5_DIV3) + { + new_val *= 3; + } + } - int16_t Outvol[2]; /* last output volume for each channel */ + // only reset those channels that have changed + if (new_val != Div_n_max[chan]) + { + // reset the divide by n counters + Div_n_max[chan] = new_val; - int tia_gain; /* initialized in tia_sound_init() */ + // if the channel is now volume only or was volume only + if ((Div_n_cnt[chan] == 0) || (new_val == 0)) + { + // reset the counter (otherwise let it complete the previous) + Div_n_cnt[chan] = new_val; + } + } + } + + // structures to hold the 6 tia sound control bytes + uint8_t AUDC[2] = { 0, 0 }; // AUDCx (15, 16) + uint8_t AUDF[2] = { 0, 0 }; // AUDFx (17, 18) + int16_t AUDV[2] = { 0, 0 }; // AUDVx (19, 1A) + + int16_t Outvol[2] = { 0, 0 }; // last output volume for each channel + + int tia_gain; // initialized in tia_sound_init() /* Initialze the bit patterns for the polynomials. */ @@ -115,23 +226,41 @@ struct tia uint8_t Bit9[POLY9_SIZE]; - uint8_t P4[2]; /* Position pointer for the 4-bit POLY array */ - uint8_t P5[2]; /* Position pointer for the 5-bit POLY array */ - uint16_t P9[2]; /* Position pointer for the 9-bit POLY array */ + uint8_t P4[2] = { 0, 0 }; // Position pointer for the 4-bit POLY array + uint8_t P5[2] = { 0, 0 }; // Position pointer for the 5-bit POLY array + uint16_t P9[2] = { 0, 0 }; // Position pointer for the 9-bit POLY array - uint8_t Div_n_cnt[2]; /* Divide by n counter. one for each channel */ - uint8_t Div_n_max[2]; /* Divide by n maximum, one for each channel */ - uint8_t Div_3_cnt[2]; /* Div 3 counter, used for POLY5_DIV3 mode */ + uint8_t Div_n_cnt[2] = { 0, 0 }; // Divide by n counter. one for each channel + uint8_t Div_n_max[2] = { 0, 0 }; // Divide by n maximum, one for each channel + uint8_t Div_3_cnt[2] = { 3, 3 }; // Div 3 counter, used for POLY5_DIV3 mode /* In my routines, I treat the sample output as another divide by N counter. */ /* For better accuracy, the Samp_n_cnt has a fixed binary decimal point */ /* which has 8 binary digits to the right of the decimal point. */ - uint16_t Samp_n_max; /* Sample max, multiplied by 256 */ - uint16_t Samp_n_cnt; /* Sample cnt. */ + uint16_t Samp_n_max; // Sample max, multiplied by 256 + uint16_t Samp_n_cnt; // Sample cnt. + + bool oversampling = false; // Added oversampling for sample_rate > clock_rate + +private: + template <unsigned N> + static void poly_init(uint8_t (&poly)[N], int size, int f0, int f1) + { + const int mask = (1 << size) - 1; + int x = mask; + + for (int i = 0; i < mask; i++) + { + const int bit0 = ((size - f0) ? (x >> (size - f0)) : x) & 0x01; + const int bit1 = ((size - f1) ? (x >> (size - f1)) : x) & 0x01; + poly[i] = x & 1; + /* calculate next bit */ + x = (x >> 1) | ((bit0 ^ bit1) << ( size - 1) ); + } + } - int oversampling; /* Added oversampling for sample_rate > clock_rate */ }; @@ -163,88 +292,9 @@ constexpr uint8_t Div31[POLY5_SIZE] = /* */ /*****************************************************************************/ -void tia_write(void *_chip, offs_t offset, uint8_t data) +void tia_write(void *chip, offs_t offset, uint8_t data) { - struct tia *chip = (struct tia *)_chip; - uint16_t new_val; - uint8_t chan; - - /* determine which address was changed */ - switch (offset) - { - case AUDC0: - chip->AUDC[0] = data & 0x0f; - chan = 0; - break; - - case AUDC1: - chip->AUDC[1] = data & 0x0f; - chan = 1; - break; - - case AUDF0: - chip->AUDF[0] = data & 0x1f; - chan = 0; - break; - - case AUDF1: - chip->AUDF[1] = data & 0x1f; - chan = 1; - break; - - case AUDV0: - chip->AUDV[0] = ((data & 0x0f) << AUDV_SHIFT); - chan = 0; - break; - - case AUDV1: - chip->AUDV[1] = ((data & 0x0f) << AUDV_SHIFT); - chan = 1; - break; - - default: - chan = 255; - break; - } - - /* if the output value changed */ - if (chan != 255) - { - /* an AUDC value of 0 is a special case */ - if (chip->AUDC[chan] == SET_TO_1 || chip->AUDC[chan] == POLY5_POLY5) - { - /* indicate the clock is zero so no processing will occur */ - new_val = 0; - - /* and set the output to the selected volume */ - chip->Outvol[chan] = chip->AUDV[chan]; - } - else - { - /* otherwise calculate the 'divide by N' value */ - new_val = chip->AUDF[chan] + 1; - - /* if bits 2 & 3 are set, then multiply the 'div by n' count by 3 */ - if ((chip->AUDC[chan] & DIV3_MASK) == DIV3_MASK && chip->AUDC[chan] != POLY5_DIV3) - { - new_val *= 3; - } - } - - /* only reset those channels that have changed */ - if (new_val != chip->Div_n_max[chan]) - { - /* reset the divide by n counters */ - chip->Div_n_max[chan] = new_val; - - /* if the channel is now volume only or was volume only */ - if ((chip->Div_n_cnt[chan] == 0) || (new_val == 0)) - { - /* reset the counter (otherwise let it complete the previous) */ - chip->Div_n_cnt[chan] = new_val; - } - } - } + reinterpret_cast<tia *>(chip)->write(offset, data); } @@ -264,9 +314,9 @@ void tia_write(void *_chip, offs_t offset, uint8_t data) /* */ /*****************************************************************************/ -void tia_process(void *_chip, stream_sample_t *buffer, int length) +void tia_process(void *_chip, write_stream_view &buffer) { - struct tia *chip = (struct tia *)_chip; + tia *chip = (tia *)_chip; uint8_t audc0, audc1; uint8_t div_n_cnt0, div_n_cnt1; uint8_t p5_0, p5_1; @@ -286,7 +336,7 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length) div_n_cnt1 = chip->Div_n_cnt[1]; /* loop until the buffer is filled */ - while (length > 0) + for (int sampindex = 0; sampindex < buffer.samples(); ) { /* Process channel 0 */ if (div_n_cnt0 > 1) @@ -482,10 +532,7 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length) chip->Samp_n_cnt += chip->Samp_n_max; /* calculate the latest output value and place in buffer */ - *buffer++ = outvol_0 + outvol_1; - - /* and indicate one less byte to process */ - length--; + buffer.put_int(sampindex++, outvol_0 + outvol_1, 32768); } } else @@ -496,10 +543,9 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length) * byte contains the fractional part */ chip->Samp_n_cnt -= 256; /* calculate the latest output value and place in buffer */ - *buffer++ = outvol_0 + outvol_1; - length--; + buffer.put_int(sampindex++, outvol_0 + outvol_1, 32768); } - while ((chip->Samp_n_cnt >= 256) && (length > 0)); + while ((chip->Samp_n_cnt >= 256) && (sampindex < buffer.samples())); /* adjust the sample counter if necessary */ if (chip->Samp_n_cnt < 256) @@ -517,37 +563,6 @@ void tia_process(void *_chip, stream_sample_t *buffer, int length) } -static void poly_init(uint8_t *poly, int size, int f0, int f1) -{ - int mask = (1 << size) - 1; - int i, x = mask; - - for (i = 0; i < mask; i++) - { - int bit0 = ( ( size - f0 ) ? ( x >> ( size - f0 ) ) : x ) & 0x01; - int bit1 = ( ( size - f1 ) ? ( x >> ( size - f1 ) ) : x ) & 0x01; - poly[i] = x & 1; - /* calculate next bit */ - x = ( x >> 1 ) | ( ( bit0 ^ bit1 ) << ( size - 1) ); - } -} - -static void tia_save_state(device_t *device, tia *tia) -{ - device->save_item(NAME(tia->AUDC)); - device->save_item(NAME(tia->AUDF)); - device->save_item(NAME(tia->AUDV)); - device->save_item(NAME(tia->Outvol)); - device->save_item(NAME(tia->P4)); - device->save_item(NAME(tia->P5)); - device->save_item(NAME(tia->P9)); - device->save_item(NAME(tia->Div_n_cnt)); - device->save_item(NAME(tia->Div_n_max)); - device->save_item(NAME(tia->Div_3_cnt)); - device->save_item(NAME(tia->Samp_n_cnt)); - device->save_item(NAME(tia->oversampling)); -} - /*****************************************************************************/ /* Module: tia_sh_start() */ /* Purpose: to handle the power-up initialization functions */ @@ -565,52 +580,11 @@ static void tia_save_state(device_t *device, tia *tia) void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain) { - struct tia *chip; - int chan; - - chip = global_alloc_clear<struct tia>(); - - /* set the gain factor (normally use TIA_DEFAULT_GAIN) */ - chip->tia_gain = gain; - - /* fill the polynomials */ - poly_init(chip->Bit4, 4, 4, 3); - poly_init(chip->Bit5, 5, 5, 3); - poly_init(chip->Bit9, 9, 9, 5); - - /* calculate the sample 'divide by N' value based on the playback freq. */ - chip->Samp_n_max = ((uint16_t)(uint32_t)clock << 8) / sample_rate; - chip->Samp_n_cnt = chip->Samp_n_max; /* initialize all bits of the sample counter */ - - if (chip->Samp_n_max < 256) /* we need to use oversampling for sample_rate > clock_rate */ - { - chip->Samp_n_max = ((uint16_t)(uint32_t)sample_rate << 8) / clock; - chip->Samp_n_cnt = chip->Samp_n_max; - chip->oversampling = 1; - } - - /* initialize the local globals */ - for (chan = CHAN1; chan <= CHAN2; chan++) - { - chip->Outvol[chan] = 0; - chip->Div_n_cnt[chan] = 0; - chip->Div_n_max[chan] = 0; - chip->Div_3_cnt[chan] = 3; - chip->AUDC[chan] = 0; - chip->AUDF[chan] = 0; - chip->AUDV[chan] = 0; - chip->P4[chan] = 0; - chip->P5[chan] = 0; - chip->P9[chan] = 0; - } - - tia_save_state(device, chip); - - return chip; + return new tia(*device, clock, sample_rate, gain); } void tia_sound_free(void *chip) { - global_free((struct tia *)chip); + delete(reinterpret_cast<tia *>(chip)); } diff --git a/src/devices/sound/tiasound.h b/src/devices/sound/tiasound.h index b406bf14598..2edafdda912 100644 --- a/src/devices/sound/tiasound.h +++ b/src/devices/sound/tiasound.h @@ -41,7 +41,7 @@ void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain); void tia_sound_free(void *chip); -void tia_process(void *chip, stream_sample_t *buffer, int length); +void tia_process(void *chip, write_stream_view &buffer); void tia_write(void *chip, offs_t offset, uint8_t data); #endif // MAME_SOUND_TIASOUND_H diff --git a/src/devices/sound/tms3615.cpp b/src/devices/sound/tms3615.cpp index e59c64eab04..3f595c8a97b 100644 --- a/src/devices/sound/tms3615.cpp +++ b/src/devices/sound/tms3615.cpp @@ -46,7 +46,7 @@ void tms3615_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- void tms3615_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) diff --git a/src/devices/sound/tms36xx.cpp b/src/devices/sound/tms36xx.cpp index 73ec59b4121..08df1d03f51 100644 --- a/src/devices/sound/tms36xx.cpp +++ b/src/devices/sound/tms36xx.cpp @@ -355,7 +355,7 @@ void tms36xx_device::device_start() { int enable = 0; - m_channel = stream_alloc_legacy(0, 1, clock() * 64); + m_channel = stream_alloc(0, 1, clock() * 64); m_samplerate = clock() * 64; m_basefreq = clock(); @@ -394,23 +394,22 @@ void tms36xx_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tms36xx_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tms36xx_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int samplerate = m_samplerate; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* no tune played? */ if( !tunes[m_tune_num] || m_voices == 0 ) { - while (--samples >= 0) - buffer[samples] = 0; + buffer.fill(0); return; } - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = 0; @@ -444,7 +443,7 @@ void tms36xx_device::sound_stream_update_legacy(sound_stream &stream, stream_sam TONE( 0) TONE( 1) TONE( 2) TONE( 3) TONE( 4) TONE( 5) TONE( 6) TONE( 7) TONE( 8) TONE( 9) TONE(10) TONE(11) - *buffer++ = sum / m_voices; + buffer.put_int(sampindex, sum, 32768 * m_voices); } } diff --git a/src/devices/sound/tms36xx.h b/src/devices/sound/tms36xx.h index 03dd5dc2412..5693e3b8e7c 100644 --- a/src/devices/sound/tms36xx.h +++ b/src/devices/sound/tms36xx.h @@ -63,7 +63,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: // MM6221AA interface functions diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp index 73f5244738e..5782aa905af 100644 --- a/src/devices/sound/tms5110.cpp +++ b/src/devices/sound/tms5110.cpp @@ -1048,7 +1048,7 @@ void tms5110_device::device_start() m_data_cb.resolve(); /* initialize a stream */ - m_stream = stream_alloc_legacy(0, 1, clock() / 80); + m_stream = stream_alloc(0, 1, clock() / 80); m_state = CTL_STATE_INPUT; /* most probably not defined */ m_romclk_hack_timer = timer_alloc(0); @@ -1220,27 +1220,25 @@ int tms5110_device::romclk_hack_r() ******************************************************************************/ //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tms5110_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tms5110_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int16_t sample_data[MAX_SAMPLE_CHUNK]; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* loop while we still have samples to generate */ - while (samples) + for (int sampindex = 0; sampindex < buffer.samples(); ) { - int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples; - int index; + int length = buffer.samples() - sampindex; + if (length > MAX_SAMPLE_CHUNK) + length = MAX_SAMPLE_CHUNK; /* generate the samples and copy to the target buffer */ process(sample_data, length); - for (index = 0; index < length; index++) - *buffer++ = sample_data[index]; - - /* account for the samples */ - samples -= length; + for (int index = 0; index < length; index++) + buffer.put_int(sampindex++, sample_data[index], 32768); } } diff --git a/src/devices/sound/tms5110.h b/src/devices/sound/tms5110.h index 84c7f68fc73..e3bb2078075 100644 --- a/src/devices/sound/tms5110.h +++ b/src/devices/sound/tms5110.h @@ -60,7 +60,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; uint8_t TALK_STATUS() const { return m_SPEN | m_TALKD; } diff --git a/src/devices/sound/tms5220.cpp b/src/devices/sound/tms5220.cpp index 9c4974c34e2..d0afb710f46 100644 --- a/src/devices/sound/tms5220.cpp +++ b/src/devices/sound/tms5220.cpp @@ -2061,7 +2061,6 @@ void tms5220_device::sound_stream_update(sound_stream &stream, std::vector<read_ auto &output = outputs[0]; /* loop while we still have samples to generate */ - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int sampindex = 0; sampindex < output.samples(); ) { int length = (output.samples() > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : output.samples(); @@ -2069,7 +2068,7 @@ void tms5220_device::sound_stream_update(sound_stream &stream, std::vector<read_ /* generate the samples and copy to the target buffer */ process(sample_data, length); for (int index = 0; index < length; index++) - output.put(sampindex++, sample_data[index] * sample_scale); + output.put_int(sampindex++, sample_data[index], 32768); } } diff --git a/src/devices/sound/upd1771.cpp b/src/devices/sound/upd1771.cpp index bb8e61f2d00..2ec1d767ba0 100644 --- a/src/devices/sound/upd1771.cpp +++ b/src/devices/sound/upd1771.cpp @@ -255,7 +255,7 @@ void upd1771c_device::device_start() m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(upd1771c_device::ack_callback),this)); - m_channel = stream_alloc_legacy(0, 1, clock() / 4); + m_channel = stream_alloc(0, 1, clock() / 4); save_item(NAME(m_packet)); save_item(NAME(m_index)); @@ -476,12 +476,12 @@ TIMER_CALLBACK_MEMBER( upd1771c_device::ack_callback ) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void upd1771c_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; switch (m_state) { @@ -489,9 +489,9 @@ void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sa //logerror( "upd1771_STATE_TONE samps:%d %d %d %d %d %d\n",(int)samples, // (int)m_t_timbre,(int)m_t_offset,(int)m_t_volume,(int)m_t_period,(int)m_t_tpos); - while (--samples >= 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer++ = (WAVEFORMS[m_t_timbre][m_t_tpos]) * m_t_volume * 2; + buffer.put_int(sampindex, (WAVEFORMS[m_t_timbre][m_t_tpos]) * m_t_volume, 32768 / 2); m_t_ppos++; if (m_t_ppos >= m_t_period) @@ -506,10 +506,8 @@ void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sa break; case STATE_NOISE: - while (--samples >= 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer = 0; - //"wavetable-LFSR" component int wlfsr_val = ((int)noise_tbl[m_nw_tpos]) - 127;//data too wide @@ -535,23 +533,18 @@ void upd1771c_device::sound_stream_update_legacy(sound_stream &stream, stream_sa } } //not quite, but close. - *buffer+= ( + buffer.put_int(sampindex, (wlfsr_val * m_nw_volume) | (res[0] * m_n_volume[0]) | (res[1] * m_n_volume[1]) | - (res[2] * m_n_volume[2]) - ) ; - - buffer++; + (res[2] * m_n_volume[2]), + 32768) ; } break; default: //fill buffer with silence - while (--samples >= 0) - { - *buffer++ = 0; - } + buffer.fill(0); break; } } diff --git a/src/devices/sound/upd1771.h b/src/devices/sound/upd1771.h index 9fe86b58c1d..7c5cc5f7f95 100644 --- a/src/devices/sound/upd1771.h +++ b/src/devices/sound/upd1771.h @@ -32,7 +32,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: static constexpr unsigned MAX_PACKET_SIZE = 0x8000; diff --git a/src/devices/sound/upd7752.cpp b/src/devices/sound/upd7752.cpp index 19977dcafdc..7c063fbee95 100644 --- a/src/devices/sound/upd7752.cpp +++ b/src/devices/sound/upd7752.cpp @@ -72,7 +72,7 @@ device_memory_interface::space_config_vector upd7752_device::memory_space_config void upd7752_device::device_start() { /* TODO: clock */ - m_stream = stream_alloc_legacy(0, 1, clock() / 64); + m_stream = stream_alloc(0, 1, clock() / 64); m_status = 0; } @@ -96,11 +96,12 @@ void upd7752_device::device_stop() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void upd7752_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void upd7752_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } //************************************************************************** diff --git a/src/devices/sound/upd7752.h b/src/devices/sound/upd7752.h index b65048624f1..9693ee99f4d 100644 --- a/src/devices/sound/upd7752.h +++ b/src/devices/sound/upd7752.h @@ -30,7 +30,7 @@ protected: virtual void device_stop() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual space_config_vector memory_space_config() const override; private: diff --git a/src/devices/sound/upd934g.cpp b/src/devices/sound/upd934g.cpp index fecb6fc8a18..fc25628abbd 100644 --- a/src/devices/sound/upd934g.cpp +++ b/src/devices/sound/upd934g.cpp @@ -49,7 +49,7 @@ upd934g_device::upd934g_device(const machine_config &mconfig, const char *tag, d void upd934g_device::device_start() { // create sound stream - m_stream = stream_alloc_legacy(0, 4, 20000); + m_stream = stream_alloc(0, 4, 20000); // resolve callbacks m_data_cb.resolve_safe(0); @@ -81,32 +81,33 @@ void upd934g_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void upd934g_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void upd934g_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { for (unsigned ch = 0; ch < 4; ch++) { - std::fill(&outputs[ch][0], &outputs[ch][samples], 0); - if (m_ready && m_channel[ch].playing != -1) { uint16_t end = m_addr[m_channel[ch].playing + 1] - 1; - for (unsigned i = 0; i < samples; i++) + for (unsigned i = 0; i < outputs[ch].samples(); i++) { int8_t raw = static_cast<int8_t>(m_data_cb(m_channel[ch].pos)); - outputs[ch][i] = raw * (m_channel[ch].volume + 1) * 64; + outputs[ch].put_int(i, raw * (m_channel[ch].volume + 1), 32768 / 64); if (++m_channel[ch].pos >= end) { m_channel[ch].playing = -1; + outputs[ch].fill(0, i + 1); break; } } } + else + outputs[ch].fill(0); } } diff --git a/src/devices/sound/upd934g.h b/src/devices/sound/upd934g.h index ed145671c38..c61ac5a4910 100644 --- a/src/devices/sound/upd934g.h +++ b/src/devices/sound/upd934g.h @@ -36,7 +36,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: devcb_read8 m_data_cb; diff --git a/src/devices/sound/vgm_visualizer.cpp b/src/devices/sound/vgm_visualizer.cpp index c1f438f2b2c..bab3c909ddf 100644 --- a/src/devices/sound/vgm_visualizer.cpp +++ b/src/devices/sound/vgm_visualizer.cpp @@ -158,7 +158,7 @@ void vgmviz_device::apply_fft() void vgmviz_device::apply_waterfall() { - int total_bars = FFT_LENGTH / 2; + const int total_bars = FFT_LENGTH / 2; WDL_FFT_COMPLEX* bins[2] = { (WDL_FFT_COMPLEX*)m_fft_buf[0], (WDL_FFT_COMPLEX*)m_fft_buf[1] }; for (int bar = 0; bar < std::min<int>(total_bars, SCREEN_HEIGHT); bar++) { @@ -555,7 +555,7 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap m_clear_pending = false; } - const pen_t *pal = m_palette->pens(); + pen_t const *const pal = m_palette->pens(); int width = SCREEN_WIDTH; switch (SpecMode) @@ -563,31 +563,26 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap case SPEC_VIZ_PILLAR: for (int y = 2; y < SCREEN_HEIGHT; y++) { - uint32_t *src = &m_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y - 2); + uint32_t const *const src = &m_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y - 2); for (int x = SCREEN_WIDTH - 1; x >= 1; x--) { dst[x] = src[x - 1]; } } - width = (int)(SCREEN_WIDTH * 0.75f); + width = int(SCREEN_WIDTH * 0.75f); break; case SPEC_VIZ_TOP: for (int y = 1; y < SCREEN_HEIGHT; y++) { - uint32_t *src = &m_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y - 1); - for (int x = 0; x < SCREEN_WIDTH; x++) - { - dst[x] = src[x]; - } + std::copy_n(&m_bitmap.pix(y), SCREEN_WIDTH, &bitmap.pix(y - 1)); } break; default: break; } - int total_bars = FFT_LENGTH / 2; + const int total_bars = FFT_LENGTH / 2; WDL_FFT_COMPLEX *bins[2] = { (WDL_FFT_COMPLEX *)m_fft_buf[0], (WDL_FFT_COMPLEX *)m_fft_buf[1] }; for (int bar = 2; bar < total_bars && bar < width; bar += BarSize) @@ -614,8 +609,8 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap } for (int y = 0; y < SCREEN_HEIGHT; y++) { - int bar_y = SCREEN_HEIGHT - y; - uint32_t *line = &bitmap.pix32(y); + const int bar_y = SCREEN_HEIGHT - y; + uint32_t *const line = &bitmap.pix(y); for (int x = 0; x < BarSize; x++) { line[(bar - 2) + x] = bar_y <= level ? pal[256 + pal_index] : pal[black_index]; @@ -631,8 +626,8 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap for (int y = 0; y < SCREEN_HEIGHT; y++) { - int bar_y = SCREEN_HEIGHT - y; - uint32_t *line = &bitmap.pix32(y); + const int bar_y = SCREEN_HEIGHT - y; + uint32_t *const line = &bitmap.pix(y); line[0] = 0; if (bar_y > level) { @@ -643,9 +638,9 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap { if (bar_y < (level - 1)) { - const uint8_t r = (uint8_t)(((entry >> 16) & 0xff) * 0.75f); - const uint8_t g = (uint8_t)(((entry >> 8) & 0xff) * 0.75f); - const uint8_t b = (uint8_t)(((entry >> 0) & 0xff) * 0.75f); + const uint8_t r = uint8_t(((entry >> 16) & 0xff) * 0.75f); + const uint8_t g = uint8_t(((entry >> 8) & 0xff) * 0.75f); + const uint8_t b = uint8_t(((entry >> 0) & 0xff) * 0.75f); line[(bar - 2) + x] = 0xff000000 | (r << 16) | (g << 8) | b; } else @@ -653,9 +648,9 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap line[(bar - 2) + x] = pal[256 + pal_index]; } } - const uint8_t r = (uint8_t)(((entry >> 16) & 0xff) * 0.5f); - const uint8_t g = (uint8_t)(((entry >> 8) & 0xff) * 0.5f); - const uint8_t b = (uint8_t)(((entry >> 0) & 0xff) * 0.5f); + const uint8_t r = uint8_t(((entry >> 16) & 0xff) * 0.5f); + const uint8_t g = uint8_t(((entry >> 8) & 0xff) * 0.5f); + const uint8_t b = uint8_t(((entry >> 0) & 0xff) * 0.5f); line[(bar - 2) + (BarSize - 1)] = 0xff000000 | (r << 16) | (g << 8) | b; if (bar_y < level) { @@ -664,10 +659,11 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap } for (int x = 0; x < SCREEN_WIDTH; x++) { - bitmap.pix32(SCREEN_HEIGHT - 1, x) = 0; - bitmap.pix32(SCREEN_HEIGHT - 2, x) = 0; + bitmap.pix(SCREEN_HEIGHT - 1, x) = 0; + bitmap.pix(SCREEN_HEIGHT - 2, x) = 0; } - memcpy(&m_bitmap.pix32(0), &bitmap.pix32(0), sizeof(uint32_t) * SCREEN_WIDTH * SCREEN_HEIGHT); + for (int y = 0; y < SCREEN_HEIGHT; y++) + std::copy_n(&bitmap.pix(y), SCREEN_WIDTH, &m_bitmap.pix(y)); break; case SPEC_VIZ_TOP: level = int(raw_level * 63.0f); @@ -678,10 +674,11 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap for (int x = 0; x < BarSize; x++) { - bitmap.pix32(SCREEN_HEIGHT - 1, (bar - 2) + x) = level > 0 ? pal[256 + pal_index] : pal[black_index]; + bitmap.pix(SCREEN_HEIGHT - 1, (bar - 2) + x) = level > 0 ? pal[256 + pal_index] : pal[black_index]; } - memcpy(&m_bitmap.pix32(0), &bitmap.pix32(0), sizeof(uint32_t) * SCREEN_WIDTH * SCREEN_HEIGHT); + for (int y = 0; y < SCREEN_HEIGHT; y++) + std::copy_n(&bitmap.pix(y), SCREEN_WIDTH, &m_bitmap.pix(y)); break; } } @@ -700,7 +697,7 @@ void vgmviz_device::draw_waterfall(bitmap_rgb32 &bitmap) const int v0_index = (int)v0h; const int v1_index = (int)v1h; const float interp = v0h - (float)v0_index; - uint32_t* line = &bitmap.pix32(y); + uint32_t* line = &bitmap.pix(y); for (int x = 0; x < SCREEN_WIDTH; x++) { if (m_waterfall_length < SCREEN_WIDTH) @@ -736,8 +733,8 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) for (int x = 0; x < SCREEN_WIDTH; x++) { - bitmap.pix32(CHANNEL_CENTER, x) = MED_GRAY; - bitmap.pix32(CHANNEL_HEIGHT + 1 + CHANNEL_CENTER, x) = MED_GRAY; + bitmap.pix(CHANNEL_CENTER, x) = MED_GRAY; + bitmap.pix(CHANNEL_HEIGHT + 1 + CHANNEL_CENTER, x) = MED_GRAY; const float raw_l = m_audio_buf[1 - m_audio_fill_index][0][((int)m_history_length + 1 + x) % FFT_LENGTH]; const int sample_l = (int)((raw_l - 0.5f) * (CHANNEL_HEIGHT - 1)); @@ -746,7 +743,7 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) int y = endy_l - sample_l; do { - bitmap.pix32(y, x) = LEFT_COLOR; + bitmap.pix(y, x) = LEFT_COLOR; y += dy_l; } while(y != endy_l); @@ -757,11 +754,11 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) y = endy_r - sample_r; do { - bitmap.pix32(y, x) = RIGHT_COLOR; + bitmap.pix(y, x) = RIGHT_COLOR; y += dy_r; } while(y != endy_r); - bitmap.pix32(CHANNEL_HEIGHT, x) = WHITE; - bitmap.pix32(CHANNEL_HEIGHT + 1, x) = WHITE; + bitmap.pix(CHANNEL_HEIGHT, x) = WHITE; + bitmap.pix(CHANNEL_HEIGHT + 1, x) = WHITE; } } diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp index 3d3cc7863fd..71dd026000c 100644 --- a/src/devices/sound/vlm5030.cpp +++ b/src/devices/sound/vlm5030.cpp @@ -214,7 +214,7 @@ void vlm5030_device::device_start() device_reset(); m_phase = PH_IDLE; - m_channel = stream_alloc_legacy(0, 1, clock() / 440); + m_channel = stream_alloc(0, 1, clock() / 440); save_item(NAME(m_address)); save_item(NAME(m_pin_BSY)); @@ -491,22 +491,22 @@ if( m_interp_step != 1) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vlm5030_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int buf_count=0; int interp_effect; int i; int u[11]; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* running */ + int sampindex = 0; if( m_phase == PH_RUN || m_phase == PH_STOP ) { /* playing speech */ - while (samples > 0) + for ( ; sampindex < buffer.samples(); sampindex++) { int current_val; @@ -592,13 +592,7 @@ void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sam m_x[0] = u[0]; /* clipping, buffering */ - if (u[0] > 511) - buffer[buf_count] = 511<<6; - else if (u[0] < -511) - buffer[buf_count] = uint32_t(-511)<<6; - else - buffer[buf_count] = (u[0] << 6); - buf_count++; + buffer.put_int_clamp(sampindex, u[0], 512); /* sample count */ m_sample_count--; @@ -607,7 +601,6 @@ void vlm5030_device::sound_stream_update_legacy(sound_stream &stream, stream_sam if (m_pitch_count >= m_current_pitch ) m_pitch_count = 0; /* size */ - samples--; } /* return;*/ } @@ -616,7 +609,7 @@ phase_stop: switch( m_phase ) { case PH_SETUP: - if( m_sample_count <= samples) + if( m_sample_count <= buffer.samples()) { m_sample_count = 0; /* logerror("VLM5030 BSY=H\n" ); */ @@ -625,11 +618,11 @@ phase_stop: } else { - m_sample_count -= samples; + m_sample_count -= buffer.samples(); } break; case PH_END: - if( m_sample_count <= samples) + if( m_sample_count <= buffer.samples()) { m_sample_count = 0; /* logerror("VLM5030 BSY=L\n" ); */ @@ -638,13 +631,9 @@ phase_stop: } else { - m_sample_count -= samples; + m_sample_count -= buffer.samples(); } } /* silent buffering */ - while (samples > 0) - { - buffer[buf_count++] = 0x00; - samples--; - } + buffer.fill(0, sampindex); } diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h index 7520bf76007..4675d99fce4 100644 --- a/src/devices/sound/vlm5030.h +++ b/src/devices/sound/vlm5030.h @@ -34,7 +34,7 @@ protected: virtual void device_post_load() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp index 000a568d2a3..067e639ed78 100644 --- a/src/devices/sound/votrax.cpp +++ b/src/devices/sound/votrax.cpp @@ -489,7 +489,7 @@ void votrax_sc01_device::chip_update() m_noise = ((m_noise << 1) & 0x7ffe) | inp; m_cur_noise = !(((m_noise >> 14) ^ (m_noise >> 13)) & 1); - // logerror("%s tick %02x.%03x 625=%d 208=%d pitch=%02x.%x ns=%04x ni=%d noise=%d cl=%x.%x clf=%d/%d\n", machine().time().to_string(), m_ticks, m_phonetick, tick_625, tick_208, m_pitch >> 3, m_pitch & 7, m_noise, inp, m_cur_noise, m_closure >> 2, m_closure & 3, m_rom_closure, m_cur_closure); + // logerror("%s tick %02x.%03x 625=%d 208=%d pitch=%02x.%x ns=%04x ni=%d noise=%d cl=%x.%x clf=%d/%d\n", machine().time().to_string(), m_ticks, m_phonetick, tick_625, tick_208, m_pitch >> 3, m_pitch & 7, m_noise, inp, m_cur_noise, m_closure >> 2, m_closure & 3, m_rom_closure, m_cur_closure); } void votrax_sc01_device::filters_commit(bool force) @@ -877,8 +877,11 @@ void votrax_sc01_device::build_lowpass_filter(double *a, double *b, double c1t, // Unswitched cap, over amp-op, top double c1b) // Switched cap, over amp-op, bottom { + // The caps values puts the cutoff at around 150Hz, put that's no good. + // Recordings shows we want it around 4K, so fuzz it. + // Compute the only coefficient we care about - double k = c1b / (m_cclock * c1t); + double k = c1b / (m_cclock * c1t) * (150.0/4000.0); // Compute the filter cutoff frequency double fpeak = 1/(2*M_PI*k); @@ -1001,7 +1004,7 @@ void votrax_sc01_device::build_injection_filter(double *a, double *b, b[1] = k1 + m; // That ends up in a numerically unstable filter. Neutralize it for now. - a[0] = 1; + a[0] = 0; a[1] = 0; b[0] = 1; b[1] = 0; diff --git a/src/devices/sound/vrc6.cpp b/src/devices/sound/vrc6.cpp index 58022411766..d9b36f5b8a6 100644 --- a/src/devices/sound/vrc6.cpp +++ b/src/devices/sound/vrc6.cpp @@ -45,7 +45,7 @@ vrc6snd_device::vrc6snd_device(const machine_config &mconfig, const char *tag, d void vrc6snd_device::device_start() { - m_stream = stream_alloc_legacy(0, 1, clock()); + m_stream = stream_alloc(0, 1, clock()); m_freqctrl = m_pulsectrl[0] = m_pulsectrl[1] = 0; m_pulsefrql[0] = m_pulsefrql[1] = m_pulsefrqh[0] = m_pulsefrqh[1] = 0; @@ -89,19 +89,20 @@ void vrc6snd_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void vrc6snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vrc6snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - std::fill_n(&outputs[0][0], samples, 0); - // check global halt bit if (m_freqctrl & 1) + { + outputs[0].fill(0); return; + } - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { // update pulse1 if (m_pulsefrqh[0] & 0x80) @@ -198,9 +199,8 @@ void vrc6snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sam // sum 2 4-bit pulses, 1 5-bit saw = unsigned 6 bit output s16 tmp = (s16)(u8)(m_output[0] + m_output[1] + m_output[2]); - tmp <<= 8; - outputs[0][i] = tmp; + outputs[0].put_int(i, tmp, 128); } } diff --git a/src/devices/sound/vrc6.h b/src/devices/sound/vrc6.h index 0c1dd422d14..eb17dabff82 100644 --- a/src/devices/sound/vrc6.h +++ b/src/devices/sound/vrc6.h @@ -31,7 +31,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: u8 m_freqctrl, m_pulsectrl[2], m_sawrate, m_master_freq; diff --git a/src/devices/sound/vrender0.cpp b/src/devices/sound/vrender0.cpp index 09fb0f14940..fd86b56adea 100644 --- a/src/devices/sound/vrender0.cpp +++ b/src/devices/sound/vrender0.cpp @@ -148,7 +148,7 @@ void vr0sound_device::device_start() for (auto &elem : m_channel) elem.Cache = &m_fbcache; - m_stream = stream_alloc_legacy(0, 2, clock() / 972); // TODO : Correct source / divider? + m_stream = stream_alloc(0, 2, clock() / 972); // TODO : Correct source / divider? save_item(STRUCT_MEMBER(m_channel, CurSAddr)); save_item(STRUCT_MEMBER(m_channel, EnvVol)); @@ -208,13 +208,13 @@ device_memory_interface::space_config_vector vr0sound_device::memory_space_confi } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests +// sound_stream_update - handle update requests // for our sound stream //------------------------------------------------- -void vr0sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vr0sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - VR0_RenderAudio(samples, outputs[0], outputs[1]); + VR0_RenderAudio(outputs[0], outputs[1]); } u16 vr0sound_device::channel_r(offs_t offset) @@ -500,7 +500,7 @@ void vr0sound_device::channel_t::write(offs_t offset, u16 data, u16 mem_mask) } } -void vr0sound_device::VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_sample_t *r) +void vr0sound_device::VR0_RenderAudio(write_stream_view &l, write_stream_view &r) { int div; if (m_ChnClkNum) @@ -508,7 +508,7 @@ void vr0sound_device::VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_s else div = 1 << 16; - for (int s = 0; s < nsamples; s++) + for (int s = 0; s < l.samples(); s++) { s32 lsample = 0, rsample = 0; for (int i = 0; i <= m_MaxChn; i++) @@ -590,7 +590,7 @@ void vr0sound_device::VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_s lsample += (sample * channel->LChnVol) >> 8; rsample += (sample * channel->RChnVol) >> 8; } - l[s] = std::max(-32768, std::min(32767, lsample)); - r[s] = std::max(-32768, std::min(32767, rsample)); + l.put_int_clamp(s, lsample, 32768); + r.put_int_clamp(s, rsample, 32768); } } diff --git a/src/devices/sound/vrender0.h b/src/devices/sound/vrender0.h index 99e2235a1be..1e234232c69 100644 --- a/src/devices/sound/vrender0.h +++ b/src/devices/sound/vrender0.h @@ -78,7 +78,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface configuration virtual space_config_vector memory_space_config() const override; @@ -151,7 +151,7 @@ private: u8 m_MaxChn = 0x1f; // Max Channels - 1 u8 m_ChnClkNum = 0; // Clock Number per Channel u16 m_Ctrl = 0; // 0x602 Control Functions - void VR0_RenderAudio(int nsamples, stream_sample_t *l, stream_sample_t *r); + void VR0_RenderAudio(write_stream_view &l, write_stream_view &r); }; DECLARE_DEVICE_TYPE(SOUND_VRENDER0, vr0sound_device) diff --git a/src/devices/sound/wave.cpp b/src/devices/sound/wave.cpp index 27407a2dbd2..99c56615171 100644 --- a/src/devices/sound/wave.cpp +++ b/src/devices/sound/wave.cpp @@ -40,51 +40,36 @@ wave_device::wave_device(const machine_config &mconfig, const char *tag, device_ void wave_device::device_start() { - speaker_device_iterator spkiter(*owner()); - int speakers = spkiter.count(); - if (speakers > 1) - stream_alloc_legacy(0, 2, machine().sample_rate()); - else - stream_alloc_legacy(0, 1, machine().sample_rate()); + stream_alloc(0, 2, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void wave_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void wave_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left_buffer = outputs[0]; - stream_sample_t *right_buffer = nullptr; - - speaker_device_iterator spkiter(*owner()); - int speakers = spkiter.count(); - if (speakers > 1) - right_buffer = outputs[1]; - cassette_state state = m_cass->get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER); if (m_cass->exists() && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)))) { cassette_image *cassette = m_cass->get_image(); double time_index = m_cass->get_position(); - double duration = double(samples) / m_cass->machine().sample_rate(); + double duration = double(outputs[0].samples()) / outputs[0].sample_rate(); - cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT); - if (speakers > 1) - cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT); + if (m_sample_buf.size() < outputs[0].samples()) + m_sample_buf.resize(outputs[0].samples()); - for (int i = samples - 1; i >= 0; i--) + for (int ch = 0; ch < 2; ch++) { - left_buffer[i] = ((int16_t *) left_buffer)[i]; - if (speakers > 1) - right_buffer[i] = ((int16_t *) right_buffer)[i]; + cassette->get_samples(ch, time_index, duration, outputs[ch].samples(), 2, &m_sample_buf[0], cassette_image::WAVEFORM_16BIT); + for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++) + outputs[ch].put_int(sampindex, m_sample_buf[sampindex], 32768); } } else { - memset(left_buffer, 0, sizeof(*left_buffer) * samples); - if (speakers > 1) - memset(right_buffer, 0, sizeof(*right_buffer) * samples); + outputs[0].fill(0); + outputs[1].fill(0); } } diff --git a/src/devices/sound/wave.h b/src/devices/sound/wave.h index 9f2a834d6c1..e81379ee93a 100644 --- a/src/devices/sound/wave.h +++ b/src/devices/sound/wave.h @@ -30,10 +30,11 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: required_device<cassette_image_device> m_cass; + std::vector<s16> m_sample_buf; }; DECLARE_DEVICE_TYPE(WAVE, wave_device) diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp index 8334db4a299..b54fa6bd6cf 100644 --- a/src/devices/sound/x1_010.cpp +++ b/src/devices/sound/x1_010.cpp @@ -119,7 +119,7 @@ void x1_010_device::device_start() LOG_SOUND("masterclock = %d rate = %d\n", clock(), m_rate); /* get stream channels */ - m_stream = stream_alloc_legacy(0, 2, m_rate); + m_stream = stream_alloc(0, 2, m_rate); m_reg = make_unique_clear<u8[]>(0x2000); m_HI_WORD_BUF = make_unique_clear<u8[]>(0x2000); @@ -204,14 +204,14 @@ void x1_010_device::word_w(offs_t offset, u16 data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // mixer buffer zero clear - memset(outputs[0], 0, samples*sizeof(*outputs[0])); - memset(outputs[1], 0, samples*sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); // if (m_sound_enable == 0) return; @@ -220,8 +220,8 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp X1_010_CHANNEL *reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]); if ((reg->status & 1) != 0) // Key On { - stream_sample_t *bufL = outputs[0]; - stream_sample_t *bufR = outputs[1]; + auto &bufL = outputs[0]; + auto &bufR = outputs[1]; const int div = (reg->status & 0x80) ? 1 : 0; if ((reg->status & 2) == 0) // PCM sampling { @@ -240,7 +240,7 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp LOG_SOUND("Play sample %p - %p, channel %X volume %d:%d freq %X step %X offset %X\n", start, end, ch, volL, volR, freq, smp_step, smp_offs); } - for (int i = 0; i < samples; i++) + for (int i = 0; i < bufL.samples(); i++) { const u32 delta = smp_offs >> 4; // sample ended? @@ -250,8 +250,8 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp break; } const s8 data = (s8)(read_byte(start+delta)); - *bufL++ += (data * volL / 256); - *bufR++ += (data * volR / 256); + bufL.add_int(i, data * volL, 32768 * 256); + bufR.add_int(i, data * volR, 32768 * 256); smp_offs += smp_step; } m_smp_offset[ch] = smp_offs; @@ -272,7 +272,7 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp LOG_SOUND("Play waveform %X, channel %X volume %X freq %4X step %X offset %X\n", reg->volume, ch, reg->end, freq, smp_step, smp_offs); } - for (int i = 0; i < samples; i++) + for (int i = 0; i < bufL.samples(); i++) { const u32 delta = env_offs >> 10; // Envelope one shot mode @@ -285,8 +285,8 @@ void x1_010_device::sound_stream_update_legacy(sound_stream &stream, stream_samp const int volL = ((vol >> 4) & 0xf) * VOL_BASE; const int volR = ((vol >> 0) & 0xf) * VOL_BASE; const s8 data = (s8)(m_reg[start + ((smp_offs >> 10) & 0x7f)]); - *bufL++ += (data * volL / 256); - *bufR++ += (data * volR / 256); + bufL.add_int(i, data * volL, 32768 * 256); + bufR.add_int(i, data * volR, 32768 * 256); smp_offs += smp_step; env_offs += env_step; } diff --git a/src/devices/sound/x1_010.h b/src/devices/sound/x1_010.h index 3c8f1e60dc6..b6b266b0ba0 100644 --- a/src/devices/sound/x1_010.h +++ b/src/devices/sound/x1_010.h @@ -26,7 +26,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/ym2151.cpp b/src/devices/sound/ym2151.cpp index b519d9a1224..74cfa9643ae 100644 --- a/src/devices/sound/ym2151.cpp +++ b/src/devices/sound/ym2151.cpp @@ -1845,7 +1845,6 @@ void ym2151_device::sound_stream_update(sound_stream &stream, std::vector<read_s return; } - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int sampindex=0; sampindex<outputs[0].samples(); sampindex++) { advance_eg(); @@ -1864,16 +1863,8 @@ void ym2151_device::sound_stream_update(sound_stream &stream, std::vector<read_s outr += chanout[ch] & pan[2*ch+1]; } - if (outl > 32767) - outl = 32767; - else if (outl < -32768) - outl = -32768; - if (outr > 32767) - outr = 32767; - else if (outr < -32768) - outr = -32768; - outputs[0].put(sampindex, stream_buffer::sample_t(outl) * sample_scale); - outputs[1].put(sampindex, stream_buffer::sample_t(outr) * sample_scale); + outputs[0].put_int_clamp(sampindex, outl, 32768); + outputs[1].put_int_clamp(sampindex, outr, 32768); advance(); } diff --git a/src/devices/sound/ym2413.cpp b/src/devices/sound/ym2413.cpp index ca4a9acb874..28cf77c097b 100644 --- a/src/devices/sound/ym2413.cpp +++ b/src/devices/sound/ym2413.cpp @@ -1470,12 +1470,12 @@ void ym2413_device::write_reg(int r, int v) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ym2413_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ym2413_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for(int i=0; i < samples ; i++ ) + for(int i=0; i < outputs[0].samples() ; i++ ) { output[0] = 0; output[1] = 0; @@ -1496,8 +1496,8 @@ void ym2413_device::sound_stream_update_legacy(sound_stream &stream, stream_samp rhythm_calc(&P_CH[0], noise_rng & 1 ); } - outputs[0][i] = limit( output[0] , 32767, -32768 ); - outputs[1][i] = limit( output[1] , 32767, -32768 ); + outputs[0].put_int_clamp(i, output[0], 32768); + outputs[1].put_int_clamp(i, output[1], 32768); advance(); } @@ -1511,7 +1511,7 @@ void ym2413_device::device_start() { int rate = clock()/72; - m_stream = stream_alloc_legacy(0,2,rate); + m_stream = stream_alloc(0,2,rate); for (int x=0; x<TL_RES_LEN; x++) { diff --git a/src/devices/sound/ym2413.h b/src/devices/sound/ym2413.h index 2e1db357150..27174977332 100644 --- a/src/devices/sound/ym2413.h +++ b/src/devices/sound/ym2413.h @@ -25,7 +25,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; uint8_t m_inst_table[19][8]; diff --git a/src/devices/sound/ymf262.cpp b/src/devices/sound/ymf262.cpp index 6ec8e081021..708970a7c0b 100644 --- a/src/devices/sound/ymf262.cpp +++ b/src/devices/sound/ymf262.cpp @@ -639,6 +639,7 @@ static inline void OPL3_SLOT_CONNECT(OPL3 *chip, OPL3_SLOT *slot) { } } +#if 0 static inline int limit( int val, int max, int min ) { if ( val > max ) val = max; @@ -647,7 +648,7 @@ static inline int limit( int val, int max, int min ) { return val; } - +#endif /* status set and IRQ handling */ static inline void OPL3_STATUS_SET(OPL3 *chip,int flag) @@ -2618,19 +2619,19 @@ void ymf262_set_update_handler(void *chip, OPL3_UPDATEHANDLER UpdateHandler, dev ** '**buffers' is table of 4 pointers to the buffers: CH.A, CH.B, CH.C and CH.D ** 'length' is the number of samples that should be generated */ -void ymf262_update_one(void *_chip, OPL3SAMPLE * const *buffers, int length) +void ymf262_update_one(void *_chip, std::vector<write_stream_view> &buffers) { int i; OPL3 *chip = (OPL3 *)_chip; signed int *chanout = chip->chanout; uint8_t rhythm = chip->rhythm&0x20; - OPL3SAMPLE *ch_a = buffers[0]; // DO2 (mixed) left output for OPL4 - OPL3SAMPLE *ch_b = buffers[1]; // DO2 (mixed) right output for OPL4 - OPL3SAMPLE *ch_c = buffers[2]; // DO0 (FM only) left output for OPL4 - OPL3SAMPLE *ch_d = buffers[3]; // DO0 (FM only) right output for OPL4 + auto &ch_a = buffers[0]; // DO2 (mixed) left output for OPL4 + auto &ch_b = buffers[1]; // DO2 (mixed) right output for OPL4 + auto &ch_c = buffers[2]; // DO0 (FM only) left output for OPL4 + auto &ch_d = buffers[3]; // DO0 (FM only) right output for OPL4 - for( i=0; i < length ; i++ ) + for( i=0; i < ch_a.samples() ; i++ ) { int a,b,c,d; @@ -2782,16 +2783,6 @@ void ymf262_update_one(void *_chip, OPL3SAMPLE * const *buffers, int length) c += chanout[17] & chip->pan[70]; d += chanout[17] & chip->pan[71]; #endif - a >>= FINAL_SH; - b >>= FINAL_SH; - c >>= FINAL_SH; - d >>= FINAL_SH; - - /* limit check */ - a = limit( a , MAXOUT, MINOUT ); - b = limit( b , MAXOUT, MINOUT ); - c = limit( c , MAXOUT, MINOUT ); - d = limit( d , MAXOUT, MINOUT ); #ifdef SAVE_SAMPLE if (which==0) @@ -2801,10 +2792,10 @@ void ymf262_update_one(void *_chip, OPL3SAMPLE * const *buffers, int length) #endif /* store to sound buffer */ - ch_a[i] = a; - ch_b[i] = b; - ch_c[i] = c; - ch_d[i] = d; + ch_a.put_int_clamp(i, a, 32768 << FINAL_SH); + ch_b.put_int_clamp(i, a, 32768 << FINAL_SH); + ch_c.put_int_clamp(i, a, 32768 << FINAL_SH); + ch_d.put_int_clamp(i, a, 32768 << FINAL_SH); advance(chip); } diff --git a/src/devices/sound/ymf262.h b/src/devices/sound/ymf262.h index d459a9a68ee..fe131169fcf 100644 --- a/src/devices/sound/ymf262.h +++ b/src/devices/sound/ymf262.h @@ -8,7 +8,7 @@ /* select number of output bits: 8 or 16 */ #define OPL3_SAMPLE_BITS 16 -typedef stream_sample_t OPL3SAMPLE; +typedef s32 OPL3SAMPLE; /* #if (OPL3_SAMPLE_BITS==16) typedef int16_t OPL3SAMPLE; @@ -33,7 +33,7 @@ void ymf262_reset_chip(void *chip); int ymf262_write(void *chip, int a, int v); unsigned char ymf262_read(void *chip, int a); int ymf262_timer_over(void *chip, int c); -void ymf262_update_one(void *chip, OPL3SAMPLE * const *buffers, int length); +void ymf262_update_one(void *chip, std::vector<write_stream_view> &buffers); void ymf262_set_timer_handler(void *chip, OPL3_TIMERHANDLER TimerHandler, device_t *device); void ymf262_set_irq_handler(void *chip, OPL3_IRQHANDLER IRQHandler, device_t *device); diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp index 03ca33a2382..a473705b065 100644 --- a/src/devices/sound/ymf271.cpp +++ b/src/devices/sound/ymf271.cpp @@ -563,10 +563,10 @@ void ymf271_device::set_feedback(int slotnum, int64_t inp) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ymf271_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ymf271_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i, j; int op; @@ -599,7 +599,7 @@ void ymf271_device::sound_stream_update_legacy(sound_stream &stream, stream_samp if (m_slots[slot1].active) { - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { int64_t output1 = 0, output2 = 0, output3 = 0, output4 = 0; int64_t phase_mod1, phase_mod2, phase_mod3; @@ -833,7 +833,7 @@ void ymf271_device::sound_stream_update_legacy(sound_stream &stream, stream_samp mixp = &m_mix_buffer[0]; if (m_slots[slot1].active) { - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { int64_t output1 = 0, output3 = 0; int64_t phase_mod1, phase_mod3; @@ -900,7 +900,7 @@ void ymf271_device::sound_stream_update_legacy(sound_stream &stream, stream_samp if (m_slots[slot1].active) { - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { int64_t output1 = 0, output2 = 0, output3 = 0; int64_t phase_mod1, phase_mod3; @@ -1006,29 +1006,29 @@ void ymf271_device::sound_stream_update_legacy(sound_stream &stream, stream_samp } mixp = &m_mix_buffer[0]; - update_pcm(j + (3*12), mixp, samples); + update_pcm(j + (3*12), mixp, outputs[0].samples()); break; } // PCM case 3: { - update_pcm(j + (0*12), mixp, samples); - update_pcm(j + (1*12), mixp, samples); - update_pcm(j + (2*12), mixp, samples); - update_pcm(j + (3*12), mixp, samples); + update_pcm(j + (0*12), mixp, outputs[0].samples()); + update_pcm(j + (1*12), mixp, outputs[0].samples()); + update_pcm(j + (2*12), mixp, outputs[0].samples()); + update_pcm(j + (3*12), mixp, outputs[0].samples()); break; } } } mixp = &m_mix_buffer[0]; - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { - outputs[0][i] = (*mixp++)>>2; - outputs[1][i] = (*mixp++)>>2; - outputs[2][i] = (*mixp++)>>2; - outputs[3][i] = (*mixp++)>>2; + outputs[0].put_int(i, *mixp++, 32768 << 2); + outputs[1].put_int(i, *mixp++, 32768 << 2); + outputs[2].put_int(i, *mixp++, 32768 << 2); + outputs[3].put_int(i, *mixp++, 32768 << 2); } } @@ -1520,8 +1520,11 @@ u8 ymf271_device::read(offs_t offset) return 0xff; uint8_t ret = m_ext_readlatch; - m_ext_address = (m_ext_address + 1) & 0x7fffff; - m_ext_readlatch = read_byte(m_ext_address); + if (!machine().side_effects_disabled()) + { + m_ext_address = (m_ext_address + 1) & 0x7fffff; + m_ext_readlatch = read_byte(m_ext_address); + } return ret; } @@ -1660,64 +1663,56 @@ void ymf271_device::calculate_clock_correction() void ymf271_device::init_state() { - int i; - - for (i = 0; i < ARRAY_LENGTH(m_slots); i++) - { - save_item(NAME(m_slots[i].ext_en), i); - save_item(NAME(m_slots[i].ext_out), i); - save_item(NAME(m_slots[i].lfoFreq), i); - save_item(NAME(m_slots[i].pms), i); - save_item(NAME(m_slots[i].ams), i); - save_item(NAME(m_slots[i].detune), i); - save_item(NAME(m_slots[i].multiple), i); - save_item(NAME(m_slots[i].tl), i); - save_item(NAME(m_slots[i].keyscale), i); - save_item(NAME(m_slots[i].ar), i); - save_item(NAME(m_slots[i].decay1rate), i); - save_item(NAME(m_slots[i].decay2rate), i); - save_item(NAME(m_slots[i].decay1lvl), i); - save_item(NAME(m_slots[i].relrate), i); - save_item(NAME(m_slots[i].block), i); - save_item(NAME(m_slots[i].fns_hi), i); - save_item(NAME(m_slots[i].fns), i); - save_item(NAME(m_slots[i].feedback), i); - save_item(NAME(m_slots[i].waveform), i); - save_item(NAME(m_slots[i].accon), i); - save_item(NAME(m_slots[i].algorithm), i); - save_item(NAME(m_slots[i].ch0_level), i); - save_item(NAME(m_slots[i].ch1_level), i); - save_item(NAME(m_slots[i].ch2_level), i); - save_item(NAME(m_slots[i].ch3_level), i); - save_item(NAME(m_slots[i].startaddr), i); - save_item(NAME(m_slots[i].loopaddr), i); - save_item(NAME(m_slots[i].endaddr), i); - save_item(NAME(m_slots[i].altloop), i); - save_item(NAME(m_slots[i].fs), i); - save_item(NAME(m_slots[i].srcnote), i); - save_item(NAME(m_slots[i].srcb), i); - save_item(NAME(m_slots[i].step), i); - save_item(NAME(m_slots[i].stepptr), i); - save_item(NAME(m_slots[i].active), i); - save_item(NAME(m_slots[i].bits), i); - save_item(NAME(m_slots[i].volume), i); - save_item(NAME(m_slots[i].env_state), i); - save_item(NAME(m_slots[i].env_attack_step), i); - save_item(NAME(m_slots[i].env_decay1_step), i); - save_item(NAME(m_slots[i].env_decay2_step), i); - save_item(NAME(m_slots[i].env_release_step), i); - save_item(NAME(m_slots[i].feedback_modulation0), i); - save_item(NAME(m_slots[i].feedback_modulation1), i); - save_item(NAME(m_slots[i].lfo_phase), i); - save_item(NAME(m_slots[i].lfo_step), i); - save_item(NAME(m_slots[i].lfo_amplitude), i); - } - - for (i = 0; i < ARRAY_LENGTH(m_groups); i++) - { - save_item(NAME(m_groups[i].sync), i); - save_item(NAME(m_groups[i].pfm), i); - } + save_item(STRUCT_MEMBER(m_slots, ext_en)); + save_item(STRUCT_MEMBER(m_slots, ext_out)); + save_item(STRUCT_MEMBER(m_slots, lfoFreq)); + save_item(STRUCT_MEMBER(m_slots, pms)); + save_item(STRUCT_MEMBER(m_slots, ams)); + save_item(STRUCT_MEMBER(m_slots, detune)); + save_item(STRUCT_MEMBER(m_slots, multiple)); + save_item(STRUCT_MEMBER(m_slots, tl)); + save_item(STRUCT_MEMBER(m_slots, keyscale)); + save_item(STRUCT_MEMBER(m_slots, ar)); + save_item(STRUCT_MEMBER(m_slots, decay1rate)); + save_item(STRUCT_MEMBER(m_slots, decay2rate)); + save_item(STRUCT_MEMBER(m_slots, decay1lvl)); + save_item(STRUCT_MEMBER(m_slots, relrate)); + save_item(STRUCT_MEMBER(m_slots, block)); + save_item(STRUCT_MEMBER(m_slots, fns_hi)); + save_item(STRUCT_MEMBER(m_slots, fns)); + save_item(STRUCT_MEMBER(m_slots, feedback)); + save_item(STRUCT_MEMBER(m_slots, waveform)); + save_item(STRUCT_MEMBER(m_slots, accon)); + save_item(STRUCT_MEMBER(m_slots, algorithm)); + save_item(STRUCT_MEMBER(m_slots, ch0_level)); + save_item(STRUCT_MEMBER(m_slots, ch1_level)); + save_item(STRUCT_MEMBER(m_slots, ch2_level)); + save_item(STRUCT_MEMBER(m_slots, ch3_level)); + save_item(STRUCT_MEMBER(m_slots, startaddr)); + save_item(STRUCT_MEMBER(m_slots, loopaddr)); + save_item(STRUCT_MEMBER(m_slots, endaddr)); + save_item(STRUCT_MEMBER(m_slots, altloop)); + save_item(STRUCT_MEMBER(m_slots, fs)); + save_item(STRUCT_MEMBER(m_slots, srcnote)); + save_item(STRUCT_MEMBER(m_slots, srcb)); + save_item(STRUCT_MEMBER(m_slots, step)); + save_item(STRUCT_MEMBER(m_slots, stepptr)); + save_item(STRUCT_MEMBER(m_slots, active)); + save_item(STRUCT_MEMBER(m_slots, bits)); + save_item(STRUCT_MEMBER(m_slots, volume)); + save_item(STRUCT_MEMBER(m_slots, env_state)); + save_item(STRUCT_MEMBER(m_slots, env_attack_step)); + save_item(STRUCT_MEMBER(m_slots, env_decay1_step)); + save_item(STRUCT_MEMBER(m_slots, env_decay2_step)); + save_item(STRUCT_MEMBER(m_slots, env_release_step)); + save_item(STRUCT_MEMBER(m_slots, feedback_modulation0)); + save_item(STRUCT_MEMBER(m_slots, feedback_modulation1)); + save_item(STRUCT_MEMBER(m_slots, lfo_phase)); + save_item(STRUCT_MEMBER(m_slots, lfo_step)); + save_item(STRUCT_MEMBER(m_slots, lfo_amplitude)); + + save_item(STRUCT_MEMBER(m_groups, sync)); + save_item(STRUCT_MEMBER(m_groups, pfm)); save_item(NAME(m_regs_main)); save_item(NAME(m_timerA)); @@ -1748,7 +1743,7 @@ void ymf271_device::device_start() init_state(); m_mix_buffer.resize(m_master_clock/(384/4)); - m_stream = stream_alloc_legacy(0, 4, m_master_clock/384); + m_stream = stream_alloc(0, 4, m_master_clock/384); } //------------------------------------------------- diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h index 87f06eb8e73..1c628f34cf1 100644 --- a/src/devices/sound/ymf271.h +++ b/src/devices/sound/ymf271.h @@ -28,7 +28,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp index 7bda7b6b8ef..f9f308a4892 100644 --- a/src/devices/sound/ymf278b.cpp +++ b/src/devices/sound/ymf278b.cpp @@ -212,10 +212,10 @@ void ymf278b_device::compute_envelope(YMF278BSlot *slot) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ymf278b_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ymf278b_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i, j; YMF278BSlot *slot; @@ -223,14 +223,14 @@ void ymf278b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam int32_t *mixp; int32_t vl, vr; - ymf262_update_one(m_ymf262, outputs, samples); - vl = m_mix_level[m_fm_l]; - vr = m_mix_level[m_fm_r]; - for (i = 0; i < samples; i++) + ymf262_update_one(m_ymf262, outputs); + stream_buffer::sample_t fvl = stream_buffer::sample_t(m_mix_level[m_fm_l]) * (1.0 / 65536.0); + stream_buffer::sample_t fvr = stream_buffer::sample_t(m_mix_level[m_fm_r]) * (1.0 / 65536.0); + for (i = 0; i < outputs[0].samples(); i++) { // DO2 mixing - outputs[0][i] = (outputs[0][i] * vl) >> 16; - outputs[1][i] = (outputs[1][i] * vr) >> 16; + outputs[0].put(i, outputs[0].get(i) * fvl); + outputs[1].put(i, outputs[1].get(i) * fvr); } std::fill(m_mix_buffer.begin(), m_mix_buffer.end(), 0); @@ -243,7 +243,7 @@ void ymf278b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam { mixp = &m_mix_buffer[0]; - for (j = 0; j < samples; j++) + for (j = 0; j < outputs[0].samples(); j++) { if (slot->stepptr >= slot->endaddr) { @@ -316,12 +316,12 @@ void ymf278b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam mixp = &m_mix_buffer[0]; vl = m_mix_level[m_pcm_l]; vr = m_mix_level[m_pcm_r]; - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { - outputs[0][i] += (*mixp++ * vl) >> 16; - outputs[1][i] += (*mixp++ * vr) >> 16; - outputs[4][i] = *mixp++; - outputs[5][i] = *mixp++; + outputs[0].add_int(i, (*mixp++ * vl) >> 16, 32768); + outputs[1].add_int(i, (*mixp++ * vr) >> 16, 32768); + outputs[4].put_int(i, *mixp++, 32768); + outputs[5].put_int(i, *mixp++, 32768); } } @@ -1009,7 +1009,7 @@ void ymf278b_device::device_start() m_slots[i].num = i; } - m_stream = stream_alloc_legacy(0, 6, m_rate); + m_stream = stream_alloc(0, 6, m_rate); m_mix_buffer.resize(m_rate*4,0); // rate tables diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h index 03fa9880442..d872ce13e38 100644 --- a/src/devices/sound/ymf278b.h +++ b/src/devices/sound/ymf278b.h @@ -29,7 +29,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp index 94ef134bd4c..b2836c74967 100644 --- a/src/devices/sound/ymz280b.cpp +++ b/src/devices/sound/ymz280b.cpp @@ -412,18 +412,18 @@ int ymz280b_device::generate_pcm16(struct YMZ280BVoice *voice, s16 *buffer, int //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void ymz280b_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ymz280b_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *lacc = outputs[0]; - stream_sample_t *racc = outputs[1]; + auto &lacc = outputs[0]; + auto &racc = outputs[1]; int v; /* clear out the accumulator */ - memset(lacc, 0, samples * sizeof(lacc[0])); - memset(racc, 0, samples * sizeof(racc[0])); + lacc.fill(0); + racc.fill(0); /* loop over voices */ for (v = 0; v < 8; v++) @@ -432,11 +432,10 @@ void ymz280b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam s16 prev = voice->last_sample; s16 curr = voice->curr_sample; s16 *curr_data = m_scratch.get(); - s32 *ldest = lacc; - s32 *rdest = racc; + s32 sampindex = 0; u32 new_samples, samples_left; u32 final_pos; - int remaining = samples; + int remaining = lacc.samples(); int lvol = voice->output_left; int rvol = voice->output_right; @@ -453,8 +452,9 @@ void ymz280b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam while (remaining > 0 && voice->output_pos < FRAC_ONE) { int interp_sample = ((s32(prev) * (FRAC_ONE - voice->output_pos)) + (s32(curr) * voice->output_pos)) >> FRAC_BITS; - *ldest++ += interp_sample * lvol; - *rdest++ += interp_sample * rvol; + lacc.add_int(sampindex, interp_sample * lvol, 32768 * 256); + racc.add_int(sampindex, interp_sample * rvol, 32768 * 256); + sampindex++; voice->output_pos += voice->output_step; remaining--; } @@ -517,8 +517,9 @@ void ymz280b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam while (remaining > 0 && voice->output_pos < FRAC_ONE) { int interp_sample = ((s32(prev) * (FRAC_ONE - voice->output_pos)) + (s32(curr) * voice->output_pos)) >> FRAC_BITS; - *ldest++ += interp_sample * lvol; - *rdest++ += interp_sample * rvol; + lacc.add_int(sampindex, interp_sample * lvol, 32768 * 256); + racc.add_int(sampindex, interp_sample * rvol, 32768 * 256); + sampindex++; voice->output_pos += voice->output_step; remaining--; } @@ -536,12 +537,6 @@ void ymz280b_device::sound_stream_update_legacy(sound_stream &stream, stream_sam voice->last_sample = prev; voice->curr_sample = curr; } - - for (v = 0; v < samples; v++) - { - outputs[0][v] /= 256; - outputs[1][v] /= 256; - } } @@ -565,7 +560,7 @@ void ymz280b_device::device_start() } /* create the stream */ - m_stream = stream_alloc_legacy(0, 2, INTERNAL_SAMPLE_RATE); + m_stream = stream_alloc(0, 2, INTERNAL_SAMPLE_RATE); /* allocate memory */ assert(MAX_SAMPLE_CHUNK < 0x10000); diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h index ccbcb393bd8..5da3ea46cc3 100644 --- a/src/devices/sound/ymz280b.h +++ b/src/devices/sound/ymz280b.h @@ -36,7 +36,7 @@ protected: virtual void device_clock_changed() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides virtual void rom_bank_updated() override; diff --git a/src/devices/sound/ymz770.cpp b/src/devices/sound/ymz770.cpp index 3934c6ac6dd..9d489d8a89d 100644 --- a/src/devices/sound/ymz770.cpp +++ b/src/devices/sound/ymz770.cpp @@ -77,7 +77,7 @@ ymz770_device::ymz770_device(const machine_config &mconfig, device_type type, co void ymz770_device::device_start() { // create the stream - m_stream = stream_alloc_legacy(0, 2, m_sclock); + m_stream = stream_alloc(0, 2, m_sclock); for (auto & channel : m_channels) { @@ -178,18 +178,16 @@ void ymz770_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void ymz770_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void ymz770_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; + auto &outL = outputs[0]; + auto &outR = outputs[1]; - outL = outputs[0]; - outR = outputs[1]; - - for (int i = 0; i < samples; i++) + for (int i = 0; i < outL.samples(); i++) { sequencer(); @@ -282,8 +280,8 @@ retry: } if (m_mute) mixr = mixl = 0; - outL[i] = mixl; - outR[i] = mixr; + outL.put_int(i, mixl, 32768); + outR.put_int(i, mixr, 32768); } } diff --git a/src/devices/sound/ymz770.h b/src/devices/sound/ymz770.h index ade24f61501..6c87cef8de4 100644 --- a/src/devices/sound/ymz770.h +++ b/src/devices/sound/ymz770.h @@ -33,7 +33,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void internal_reg_write(uint8_t reg, uint8_t data); virtual uint32_t get_phrase_offs(int phrase) { return m_rom[(4 * phrase) + 1] << 16 | m_rom[(4 * phrase) + 2] << 8 | m_rom[(4 * phrase) + 3]; }; diff --git a/src/devices/sound/zsg2.cpp b/src/devices/sound/zsg2.cpp index b964bce5f14..2fa01cfb3a5 100644 --- a/src/devices/sound/zsg2.cpp +++ b/src/devices/sound/zsg2.cpp @@ -134,7 +134,7 @@ void zsg2_device::device_start() memset(&m_chan, 0, sizeof(m_chan)); - m_stream = stream_alloc_legacy(0, 4, clock() / 768); + m_stream = stream_alloc(0, 4, clock() / 768); m_mem_blocks = m_mem_base.length(); m_mem_copy = make_unique_clear<uint32_t[]>(m_mem_blocks); @@ -280,12 +280,12 @@ void zsg2_device::filter_samples(zchan *ch) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void zsg2_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void zsg2_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { int32_t mix[4] = {}; @@ -355,8 +355,7 @@ void zsg2_device::sound_stream_update_legacy(sound_stream &stream, stream_sample } for(int output=0; output<4; output++) - outputs[output][i] = std::min<int32_t>(std::max<int32_t>(mix[output], -32768), 32767); - + outputs[output].put_int_clamp(i, mix[output], 32768); } m_sample_count++; } diff --git a/src/devices/sound/zsg2.h b/src/devices/sound/zsg2.h index 592cbf83787..0239f6ff03d 100644 --- a/src/devices/sound/zsg2.h +++ b/src/devices/sound/zsg2.h @@ -29,7 +29,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: const uint16_t STATUS_ACTIVE = 0x8000; diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp index 4e7d04bcab6..9a3a0f8c339 100644 --- a/src/devices/video/315_5124.cpp +++ b/src/devices/video/315_5124.cpp @@ -1723,8 +1723,8 @@ void sega315_5124_device::draw_scanline(int pixel_offset_x, int pixel_plot_y, in void sega315_5124_device::blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line) { - u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x); - u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x); + u32 *const p_bitmap = &m_tmpbitmap.pix(pixel_plot_y + line, pixel_offset_x); + u8 *const p_y1 = &m_y1_bitmap.pix(pixel_plot_y + line, pixel_offset_x); int x = 0; if (m_vdp_mode == 4 && BIT(m_reg[0x00], 5)) @@ -1755,8 +1755,8 @@ void sega315_5377_device::blit_scanline(int *line_buffer, int *priority_selected } else { - u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x); - u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x); + u32 *const p_bitmap = &m_tmpbitmap.pix(pixel_plot_y + line, pixel_offset_x); + u8 *const p_y1 = &m_y1_bitmap.pix(pixel_plot_y + line, pixel_offset_x); int x = 0; /* border on left side of the GG active screen */ diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp index 77bd8a9094a..4360a4e78a1 100644 --- a/src/devices/video/315_5313.cpp +++ b/src/devices/video/315_5313.cpp @@ -2108,7 +2108,7 @@ void sega315_5313_device::render_videobuffer_to_screenbuffer(int scanline) if (scanline >= m_render_bitmap->height()) // safety, shouldn't happen now we allocate a fixed amount tho return; - lineptr = &m_render_bitmap->pix32(scanline); + lineptr = &m_render_bitmap->pix(scanline); } else lineptr = m_render_line.get(); diff --git a/src/devices/video/cdp1861.cpp b/src/devices/video/cdp1861.cpp index 6a79087990d..03bcd3e0e90 100644 --- a/src/devices/video/cdp1861.cpp +++ b/src/devices/video/cdp1861.cpp @@ -248,12 +248,11 @@ void cdp1861_device::dma_w(uint8_t data) { int sx = screen().hpos() + 4; int y = screen().vpos(); - int x; - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { pen_t color = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); - m_bitmap.pix32(y, sx + x) = color; + m_bitmap.pix(y, sx + x) = color; data <<= 1; } } diff --git a/src/devices/video/cdp1862.cpp b/src/devices/video/cdp1862.cpp index 977615955fe..66fa8d9e684 100644 --- a/src/devices/video/cdp1862.cpp +++ b/src/devices/video/cdp1862.cpp @@ -131,7 +131,6 @@ void cdp1862_device::dma_w(uint8_t data) int rd = 1, bd = 1, gd = 1; int sx = screen().hpos() + 4; int y = screen().vpos(); - int x; if (!m_con) { @@ -140,7 +139,7 @@ void cdp1862_device::dma_w(uint8_t data) gd = m_read_gd(); } - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { int color = CDP1862_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8; @@ -149,7 +148,7 @@ void cdp1862_device::dma_w(uint8_t data) color = (gd << 2) | (bd << 1) | rd; } - m_bitmap.pix32(y, sx + x) = m_palette[color]; + m_bitmap.pix(y, sx + x) = m_palette[color]; data <<= 1; } diff --git a/src/devices/video/cesblit.cpp b/src/devices/video/cesblit.cpp index 4cea7aef4f5..7e0e6a2085b 100644 --- a/src/devices/video/cesblit.cpp +++ b/src/devices/video/cesblit.cpp @@ -213,8 +213,6 @@ void cesblit_device::do_blit() // Draw bitmap_ind16 &bitmap = m_bitmap[layer][buffer]; - int x,y; - uint16_t pen; switch (mode & 0x20) { @@ -227,17 +225,17 @@ void cesblit_device::do_blit() uint8_t dst_pen = (m_color >> 8) & 0xff; uint8_t src_pen = (m_color >> 0) & 0xff; - for (y = y0; y != y1; y += dy) + for (int y = y0; y != y1; y += dy) { - for (x = x0; x != x1; x += dx) + for (int x = x0; x != x1; x += dx) { - pen = m_space->read_byte(addr); + uint16_t pen = m_space->read_byte(addr); if (pen == src_pen) pen = dst_pen; if (pen != 0xff) - bitmap.pix16((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; + bitmap.pix((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; ++addr; } @@ -247,14 +245,14 @@ void cesblit_device::do_blit() { // copy from ROM as is - for (y = y0; y != y1; y += dy) + for (int y = y0; y != y1; y += dy) { - for (x = x0; x != x1; x += dx) + for (int x = x0; x != x1; x += dx) { - pen = m_space->read_byte(addr); + uint16_t pen = m_space->read_byte(addr); if (pen != 0xff) - bitmap.pix16((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; + bitmap.pix((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; ++addr; } @@ -263,16 +261,18 @@ void cesblit_device::do_blit() break; case 0x20: // solid fill - pen = ((m_addr_hi >> 8) & 0xff) + color; + { + uint16_t pen = ((m_addr_hi >> 8) & 0xff) + color; - if ((pen & 0xff) == 0xff) - pen = 0xff; + if ((pen & 0xff) == 0xff) + pen = 0xff; - for (y = y0; y != y1; y += dy) - { - for (x = x0; x != x1; x += dx) + for (int y = y0; y != y1; y += dy) { - bitmap.pix16((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen; + for (int x = x0; x != x1; x += dx) + { + bitmap.pix((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen; + } } } break; diff --git a/src/devices/video/clgd542x.cpp b/src/devices/video/clgd542x.cpp index ace2e7a4820..eff9f5473c8 100644 --- a/src/devices/video/clgd542x.cpp +++ b/src/devices/video/clgd542x.cpp @@ -134,7 +134,6 @@ void cirrus_gd5428_device::device_reset() uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,bit; uint32_t ptr = (vga.svga_intf.vram_size - 0x4000); // cursor patterns are stored in the last 16kB of VRAM svga_device::screen_update(screen, bitmap, cliprect); @@ -145,11 +144,11 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 if(m_cursor_attr & 0x04) // 64x64 { ptr += ((m_cursor_addr & 0x3c) * 256); - for(y=0;y<64;y++) + for(int y=0;y<64;y++) { - for(x=0;x<64;x+=8) + for(int x=0;x<64;x+=8) { - for(bit=0;bit<8;bit++) + for(int bit=0;bit<8;bit++) { uint8_t pixel1 = vga.memory[ptr % vga.svga_intf.vram_size] >> (7-bit); uint8_t pixel2 = vga.memory[(ptr+512) % vga.svga_intf.vram_size] >> (7-bit); @@ -159,13 +158,13 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 case 0: // transparent - do nothing break; case 1: // background - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 16) | (m_ext_palette[0].green << 8) | (m_ext_palette[0].blue); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 16) | (m_ext_palette[0].green << 8) | (m_ext_palette[0].blue); break; case 2: // XOR - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit); break; case 3: // foreground - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 16) | (m_ext_palette[15].green << 8) | (m_ext_palette[15].blue); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 16) | (m_ext_palette[15].green << 8) | (m_ext_palette[15].blue); break; } } @@ -175,11 +174,11 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 else { ptr += ((m_cursor_addr & 0x3f) * 256); - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - for(x=0;x<32;x+=8) + for(int x=0;x<32;x+=8) { - for(bit=0;bit<8;bit++) + for(int bit=0;bit<8;bit++) { uint8_t pixel1 = vga.memory[ptr % vga.svga_intf.vram_size] >> (7-bit); uint8_t pixel2 = vga.memory[(ptr+128) % vga.svga_intf.vram_size] >> (7-bit); @@ -189,13 +188,13 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 case 0: // transparent - do nothing break; case 1: // background - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 18) | (m_ext_palette[0].green << 10) | (m_ext_palette[0].blue << 2); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 18) | (m_ext_palette[0].green << 10) | (m_ext_palette[0].blue << 2); break; case 2: // XOR - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit); break; case 3: // foreground - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 18) | (m_ext_palette[15].green << 10) | (m_ext_palette[15].blue << 2); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 18) | (m_ext_palette[15].green << 10) | (m_ext_palette[15].blue << 2); break; } } diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp index 9cc05ab747b..f58106fb5c4 100644 --- a/src/devices/video/ef9340_1.cpp +++ b/src/devices/video/ef9340_1.cpp @@ -16,7 +16,6 @@ This is implemented with a callback. The datasheet explains how to hook up TODO: - busy state (right now it is immediate) - internal display timing (on g7400, most of it is done externally) -- read slice from internal ROM - window boxing - Y zoom @@ -35,7 +34,7 @@ TODO: DEFINE_DEVICE_TYPE(EF9340_1, ef9340_1_device, "ef9340_1", "Thomson EF9340+EF9341") -ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, EF9340_1, tag, owner, clock) , device_video_interface(mconfig, *this) , m_charset(*this, "ef9340_1") @@ -46,7 +45,7 @@ ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, ROM_START( ef9340_1 ) - ROM_REGION( 0xA00, "ef9340_1", 0 ) + ROM_REGION( 0xa00, "ef9340_1", 0 ) ROM_LOAD( "charset_ef9340_1.rom", 0x0000, 0x0a00, BAD_DUMP CRC(8de85988) SHA1(f8e3892234da6626eb4302e171179ada5a51fca8) ) // taken from datasheet ROM_END @@ -66,10 +65,10 @@ void ef9340_1_device::device_start() screen().register_screen_bitmap(m_tmp_bitmap); m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust( screen().time_until_pos(0, 0), 0, screen().scan_period() ); + m_line_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period()); m_blink_timer = timer_alloc(TIMER_BLINK); - m_blink_timer->adjust( screen().time_until_pos(0, 0), 0, screen().frame_period() ); + m_blink_timer->adjust(screen().time_until_pos(0, 0), 0, screen().frame_period()); // zerofill m_ef9341.TA = 0; @@ -109,7 +108,7 @@ void ef9340_1_device::device_start() void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch ( id ) + switch (id) { case TIMER_LINE: ef9340_scanline(screen().vpos()); @@ -129,27 +128,27 @@ void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int par } -uint16_t ef9340_1_device::ef9340_get_c_addr(uint8_t x, uint8_t y) +u16 ef9340_1_device::ef9340_get_c_addr(u8 x, u8 y) { - if ( ( y & 0x18 ) == 0x18 ) + if ((y & 0x18) == 0x18) { - return 0x318 | ( ( x & 0x38 ) << 2 ) | ( x & 0x07 ); + return 0x318 | ((x & 0x38) << 2) | (x & 0x07); } - if ( x & 0x20 ) + if (x & 0x20) { - return 0x300 | ( ( y & 0x07 ) << 5 ) | ( y & 0x18 ) | ( x & 0x07 ); + return 0x300 | ((y & 0x07) << 5) | (y & 0x18) | (x & 0x07); } - return ( y & 0x1f ) << 5 | ( x & 0x1f ); + return (y & 0x1f) << 5 | (x & 0x1f); } void ef9340_1_device::ef9340_inc_c() { m_ef9340.X++; - if ( m_ef9340.X == 40 || m_ef9340.X == 48 || m_ef9340.X == 56 || m_ef9340.X == 64 ) + if (m_ef9340.X == 40 || m_ef9340.X == 48 || m_ef9340.X == 56 || m_ef9340.X == 64) { - m_ef9340.Y = ( m_ef9340.Y + 1 ) & 0x1f; - if ( m_ef9340.Y == 24 ) + m_ef9340.Y = (m_ef9340.Y + 1) & 0x1f; + if (m_ef9340.Y == 24) { m_ef9340.Y = 0; } @@ -158,27 +157,27 @@ void ef9340_1_device::ef9340_inc_c() } -void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) +void ef9340_1_device::ef9341_write(u8 command, u8 b, u8 data) { - LOG("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data ); + LOG("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data); - if ( command ) + if (command) { - if ( b ) + if (b) { m_ef9341.TB = data; m_ef9341.busy = true; - switch( m_ef9341.TB & 0xE0 ) + switch (m_ef9341.TB & 0xe0) { case 0x00: /* Begin row */ m_ef9340.X = 0; - m_ef9340.Y = m_ef9341.TA & 0x1F; + m_ef9340.Y = m_ef9341.TA & 0x1f; break; case 0x20: /* Load Y */ - m_ef9340.Y = m_ef9341.TA & 0x1F; + m_ef9340.Y = m_ef9341.TA & 0x1f; break; case 0x40: /* Load X */ - m_ef9340.X = m_ef9341.TA & 0x3F; + m_ef9340.X = m_ef9341.TA & 0x3f; break; case 0x60: /* INC C */ ef9340_inc_c(); @@ -186,13 +185,13 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) case 0x80: /* Load M */ m_ef9340.M = m_ef9341.TA; break; - case 0xA0: /* Load R */ + case 0xa0: /* Load R */ m_ef9340.R = m_ef9341.TA; break; - case 0xC0: /* Load Y0 */ - m_ef9340.Y0 = m_ef9341.TA & 0x3F; + case 0xc0: /* Load Y0 */ + m_ef9340.Y0 = m_ef9341.TA & 0x3f; break; - case 0xE0: /* Not interpreted */ + case 0xe0: /* Not interpreted */ break; } m_ef9341.busy = false; @@ -204,13 +203,13 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) } else { - if ( b ) + if (b) { - uint16_t addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff; + u16 addr = ef9340_get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff; m_ef9341.TB = data; m_ef9341.busy = true; - switch ( m_ef9340.M & 0xE0 ) + switch (m_ef9340.M & 0xe0) { case 0x00: /* Write */ m_ram_a[addr] = m_ef9341.TA; @@ -225,15 +224,15 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) case 0x80: /* Write slice */ { - uint8_t a = m_ram_a[addr]; - uint8_t b = m_ram_b[addr]; - uint8_t slice = m_ef9340.M & 0x0f; + u8 a = m_ram_a[addr]; + u8 b = m_ram_b[addr]; + u8 slice = m_ef9340.M & 0x0f; if (b >= 0xa0) m_write_exram(a << 12 | b << 4 | slice, m_ef9341.TA); // Increment slice number - m_ef9340.M = ( m_ef9340.M & 0xf0) | ( ( slice + 1 ) % 10 ); + m_ef9340.M = (m_ef9340.M & 0xf0) | ((slice + 1) % 10); } break; @@ -250,15 +249,15 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) } -uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) +u8 ef9340_1_device::ef9341_read(u8 command, u8 b) { - uint8_t data; + u8 data; - LOG("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A" ); + LOG("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A"); - if ( command ) + if (command) { - if ( b ) + if (b) { data = 0; } @@ -269,13 +268,13 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) } else { - if ( b ) + if (b) { - uint16_t addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff; + u16 addr = ef9340_get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff; data = m_ef9341.TB; m_ef9341.busy = true; - switch ( m_ef9340.M & 0xE0 ) + switch (m_ef9340.M & 0xe0) { case 0x20: /* Read */ m_ef9341.TA = m_ram_a[addr]; @@ -288,22 +287,22 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) m_ef9341.TB = m_ram_b[addr]; break; - case 0xA0: /* Read slice */ + case 0xa0: /* Read slice */ { - uint8_t a = m_ram_a[addr]; - uint8_t b = m_ram_b[addr]; - uint8_t slice = m_ef9340.M & 0x0f; + u8 a = m_ram_a[addr]; + u8 b = m_ram_b[addr]; + u8 slice = m_ef9340.M & 0x0f; m_ef9341.TA = 0xff; m_ef9341.TB = 0xff; if (b >= 0xa0) m_ef9341.TA = m_read_exram(a << 12 | b << 4 | slice); - else - logerror("ef9341 read slice from internal\n"); + else if (b < 0x80 && slice < 10) + m_ef9341.TA = m_charset[(((a & 0x80) | (b & 0x7f)) * 10) + slice]; // Increment slice number - m_ef9340.M = ( m_ef9340.M & 0xf0) | ( ( slice + 1 ) % 10 ); + m_ef9340.M = (m_ef9340.M & 0xf0) | ((slice + 1) % 10); } break; @@ -338,14 +337,14 @@ void ef9340_1_device::ef9340_scanline(int vpos) if (m_ef9340.R & 0x01 && vpos < max_vpos) { int y_row = 0; - uint16_t char_data = 0x00; - uint8_t fg = 0; - uint8_t bg = 0; + u16 char_data = 0x00; + u8 fg = 0; + u8 bg = 0; bool underline = false; bool blank = false; bool w_parity = false; - if ( vpos < 10 ) + if (vpos < 10) { // Service row if (m_ef9340.R & 0x08) @@ -357,7 +356,7 @@ void ef9340_1_device::ef9340_scanline(int vpos) { // Service row is disabled for (int i = 0; i < 40 * 8; i++) - m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + i) = 8; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + i) = 8; return; } } @@ -370,9 +369,9 @@ void ef9340_1_device::ef9340_scanline(int vpos) for (int x = 0; x < 40; x++) { int s = slice; - uint16_t addr = ef9340_get_c_addr(x, y_row); - uint8_t a = m_ram_a[addr]; - uint8_t b = m_ram_b[addr]; + u16 addr = ef9340_get_c_addr(x, y_row); + u8 a = m_ram_a[addr]; + u8 b = m_ram_b[addr]; bool blink = m_ef9340.R & 0x80 && m_ef9340.blink; bool cursor = m_ef9340.R & 0x10 && x == m_ef9340.X && y_row == m_ef9340.Y; bool invert = cursor && !blink; @@ -465,8 +464,8 @@ void ef9340_1_device::ef9340_scanline(int vpos) for (int i = 0; i < 8; i++) { - uint16_t d = blank ? 0 : (char_data & 1) ? fg : bg; - m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + x*8 + i) = d | 8; + u16 d = blank ? 0 : (char_data & 1) ? fg : bg; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + x*8 + i) = d | 8; char_data >>= 1; } @@ -480,7 +479,7 @@ void ef9340_1_device::ef9340_scanline(int vpos) else { for (int i = 0; i < 40 * 8; i++) - m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + i) = 0; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + i) = 0; } // determine next h parity @@ -494,12 +493,12 @@ void ef9340_1_device::ef9340_scanline(int vpos) } -uint32_t ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // note: palette d3 is transparency (datasheet calls it "I"), this handler masks it off for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix16(y, x) = m_tmp_bitmap.pix16(y, x) & 7; + bitmap.pix(y, x) = m_tmp_bitmap.pix(y, x) & 7; return 0; } diff --git a/src/devices/video/ef9340_1.h b/src/devices/video/ef9340_1.h index 61d1eb6d584..2d9a6671d27 100644 --- a/src/devices/video/ef9340_1.h +++ b/src/devices/video/ef9340_1.h @@ -18,7 +18,7 @@ class ef9340_1_device : public device_t, public: // construction/destruction template <typename T> - ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag) + ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&screen_tag) : ef9340_1_device(mconfig, tag, owner, clock) { set_screen(std::forward<T>(screen_tag)); @@ -29,13 +29,13 @@ public: auto write_exram() { return m_write_exram.bind(); } // ADR0-ADR3 in a0-a3, B in a4-a11, A in a12-a19 auto read_exram() { return m_read_exram.bind(); } // " - ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); inline bitmap_ind16 *get_bitmap() { return &m_tmp_bitmap; } - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void ef9341_write( uint8_t command, uint8_t b, uint8_t data ); - uint8_t ef9341_read( uint8_t command, uint8_t b ); + void ef9341_write(u8 command, u8 b, u8 data); + u8 ef9341_read(u8 command, u8 b); protected: // device-level overrides @@ -43,7 +43,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual const tiny_rom_entry *device_rom_region() const override; - inline uint16_t ef9340_get_c_addr(uint8_t x, uint8_t y); + inline u16 ef9340_get_c_addr(u8 x, u8 y); inline void ef9340_inc_c(); void ef9340_scanline(int vpos); @@ -55,7 +55,7 @@ protected: emu_timer *m_line_timer; emu_timer *m_blink_timer; - required_region_ptr<uint8_t> m_charset; + required_region_ptr<u8> m_charset; bitmap_ind16 m_tmp_bitmap; @@ -64,25 +64,25 @@ protected: struct { - uint8_t TA; - uint8_t TB; + u8 TA; + u8 TB; bool busy; } m_ef9341; struct { - uint8_t X; - uint8_t Y; - uint8_t Y0; - uint8_t R; - uint8_t M; + u8 X; + u8 Y; + u8 Y0; + u8 R; + u8 M; bool blink; int blink_prescaler; bool h_parity; } m_ef9340; - uint8_t m_ram_a[0x400]; - uint8_t m_ram_b[0x400]; + u8 m_ram_a[0x400]; + u8 m_ram_b[0x400]; devcb_write8 m_write_exram; devcb_read8 m_read_exram; diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp index 74aa3334c1c..4b8907d0da7 100644 --- a/src/devices/video/ef9345.cpp +++ b/src/devices/video/ef9345.cpp @@ -225,7 +225,7 @@ void ef9345_device::draw_char_40(uint8_t *c, uint16_t x, uint16_t y) for(int i = 0; i < scan_ysize; i++) for(int j = 0; j < scan_xsize; j++) - m_screen_out.pix32(y * 10 + i, x * 8 + j) = palette[c[8 * i + j] & 0x07]; + m_screen_out.pix(y * 10 + i, x * 8 + j) = palette[c[8 * i + j] & 0x07]; } // draw a char in 80 char line mode @@ -237,7 +237,7 @@ void ef9345_device::draw_char_80(uint8_t *c, uint16_t x, uint16_t y) for(int i = 0; i < scan_ysize; i++) for(int j = 0; j < scan_xsize; j++) - m_screen_out.pix32(y * 10 + i, x * 6 + j) = palette[c[6 * i + j] & 0x07]; + m_screen_out.pix(y * 10 + i, x * 6 + j) = palette[c[6 * i + j] & 0x07]; } diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp index 858b7309ca6..cef0a33664e 100644 --- a/src/devices/video/ef9364.cpp +++ b/src/devices/video/ef9364.cpp @@ -178,30 +178,27 @@ void ef9364_device::draw_border(uint16_t line) uint32_t ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,r; - unsigned char c; - - for( r = 0 ; r < NB_OF_ROWS ; r++ ) + for( int r = 0 ; r < NB_OF_ROWS ; r++ ) { - for( y = 0 ; y < 8 ; y++ ) + for( int y = 0 ; y < 8 ; y++ ) { - for( x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ ) + for( int x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ ) { if( ( ( x >> 3 ) != x_curs_pos ) || ( r != y_curs_pos ) || !cursor_state) { - c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) ); + unsigned char c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) ); if( m_charset[((c&0x7F)<<3) + y] & (0x80>>(x&7)) ) - m_screen_out.pix32((r*12)+y, x) = palette[1]; + m_screen_out.pix((r*12)+y, x) = palette[1]; else - m_screen_out.pix32((r*12)+y, x) = palette[0]; + m_screen_out.pix((r*12)+y, x) = palette[0]; } else { if(y != 7) - m_screen_out.pix32((r*12)+y, x) = palette[0]; + m_screen_out.pix((r*12)+y, x) = palette[0]; else - m_screen_out.pix32((r*12)+y, x) = palette[1]; + m_screen_out.pix((r*12)+y, x) = palette[1]; } } } diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp index a24783298d1..7697e6885e6 100644 --- a/src/devices/video/ef9365.cpp +++ b/src/devices/video/ef9365.cpp @@ -1156,18 +1156,15 @@ void ef9365_device::ef9365_exec(uint8_t cmd) uint32_t ef9365_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i,j,ptr,p; - unsigned char color_index; - - for(j=0;j<bitplane_yres;j++) + for(int j=0;j<bitplane_yres;j++) { - for(i=0;i<bitplane_xres;i++) + for(int i=0;i<bitplane_xres;i++) { - color_index = 0x00; + unsigned char color_index = 0x00; - ptr = ( bitplane_xres * j ) + i; + int ptr = ( bitplane_xres * j ) + i; - for( p = 0; p < nb_of_bitplanes; p++) + for(int p = 0; p < nb_of_bitplanes; p++) { if( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (ptr>>3)) & (0x80>>(ptr&7))) { @@ -1175,7 +1172,7 @@ uint32_t ef9365_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma } } - m_screen_out.pix32(j, i) = m_palette->pen( color_index ); + m_screen_out.pix(j, i) = m_palette->pen( color_index ); } } diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp index 3810dc76a76..5de27dc0b08 100644 --- a/src/devices/video/fixfreq.cpp +++ b/src/devices/video/fixfreq.cpp @@ -14,10 +14,11 @@ ***************************************************************************/ #include "emu.h" -#include "ui/uimain.h" -#include "rendutil.h" #include "fixfreq.h" +#include "render.h" +#include "ui/uimain.h" + // for quick and dirty debugging #define VERBOSE 0 #define LOG_OUTPUT_STREAM std::cerr diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp index 4f02d39bfab..06cceeca7b0 100644 --- a/src/devices/video/gb_lcd.cpp +++ b/src/devices/video/gb_lcd.cpp @@ -671,7 +671,7 @@ void cgb_ppu_device::device_reset() inline void dmg_ppu_device::plot_pixel(int x, int y, uint16_t color) { - m_bitmap.pix16(y, x) = color; + m_bitmap.pix(y, x) = color; } diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp index ab71569a9fe..e3e46b5ceae 100644 --- a/src/devices/video/gba_lcd.cpp +++ b/src/devices/video/gba_lcd.cpp @@ -267,7 +267,7 @@ inline void gba_lcd_device::update_mask(uint8_t* mask, int y) void gba_lcd_device::draw_scanline(int y) { - uint16_t *scanline = &m_bitmap.pix16(y); + uint16_t *const scanline = &m_bitmap.pix(y); if (is_set(dispcnt::forced_blank)) { diff --git a/src/devices/video/gf4500.cpp b/src/devices/video/gf4500.cpp index e8c35e7ff25..b703e7cb8c3 100644 --- a/src/devices/video/gf4500.cpp +++ b/src/devices/video/gf4500.cpp @@ -89,12 +89,11 @@ static rgb_t gf4500_get_color_16( uint16_t data ) uint32_t gf4500_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *vram = (uint16_t *)(m_data.get() + GF4500_FRAMEBUF_OFFSET / 4); - int x, y; - for (y = 0; y < 240; y++) + uint16_t const *vram = (uint16_t *)(m_data.get() + GF4500_FRAMEBUF_OFFSET / 4); + for (int y = 0; y < 240; y++) { - uint32_t *scanline = &bitmap.pix32(y); - for (x = 0; x < 320; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 320; x++) { *scanline++ = gf4500_get_color_16(*vram++); } diff --git a/src/devices/video/hd44102.cpp b/src/devices/video/hd44102.cpp index 3b05f1e5e69..1bb8cbf5a4d 100644 --- a/src/devices/video/hd44102.cpp +++ b/src/devices/video/hd44102.cpp @@ -268,7 +268,7 @@ uint32_t hd44102_device::screen_update(screen_device &screen, bitmap_ind16 &bitm { int color = (m_status & STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8); - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } z++; diff --git a/src/devices/video/hd44352.cpp b/src/devices/video/hd44352.cpp index 7fa4b53f1d0..1ca378723f3 100644 --- a/src/devices/video/hd44352.cpp +++ b/src/devices/video/hd44352.cpp @@ -152,7 +152,7 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t d = compute_newval((m_cursor_status>>5) & 0x07, m_video_ram[a][py*16*cw + px*cw + c + m_scroll * 48], m_cursor[c]); for (int b=0; b<8; b++) { - bitmap.pix16(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); + bitmap.pix(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); } } } @@ -163,7 +163,7 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t d = m_video_ram[a][py*16*cw + px*cw + c + m_scroll * 48]; for (int b=0; b<8; b++) { - bitmap.pix16(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); + bitmap.pix(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); } } } diff --git a/src/devices/video/hd44780.cpp b/src/devices/video/hd44780.cpp index 7abf8e0a979..8d6db247ba7 100644 --- a/src/devices/video/hd44780.cpp +++ b/src/devices/video/hd44780.cpp @@ -274,7 +274,7 @@ inline void hd44780_device::pixel_update(bitmap_ind16 &bitmap, u8 line, u8 pos, if (m_lines <= 2) { if (pos < m_chars) - bitmap.pix16(line * (line_height + 1) + y, pos * 6 + x) = state; + bitmap.pix(line * (line_height + 1) + y, pos * 6 + x) = state; } else if (m_lines <= 4) { @@ -287,7 +287,7 @@ inline void hd44780_device::pixel_update(bitmap_ind16 &bitmap, u8 line, u8 pos, } if (line < m_lines) - bitmap.pix16(line * (line_height + 1) + y, pos * 6 + x) = state; + bitmap.pix(line * (line_height + 1) + y, pos * 6 + x) = state; } } else diff --git a/src/devices/video/hd61830.cpp b/src/devices/video/hd61830.cpp index 26ee97cb22f..55bf2bbd588 100644 --- a/src/devices/video/hd61830.cpp +++ b/src/devices/video/hd61830.cpp @@ -360,9 +360,9 @@ uint16_t hd61830_device::draw_scanline(bitmap_ind16 &bitmap, const rectangle &cl if(y >= 0 && y < bitmap.height()) { if(((sx * m_hp) + x) >= 0 && ((sx * m_hp) + x) < bitmap.width()) - bitmap.pix16(y, (sx * m_hp) + x) = BIT(data1, x); + bitmap.pix(y, (sx * m_hp) + x) = BIT(data1, x); if(((sx * m_hp) + x + m_hp) >= 0 && ((sx * m_hp) + x + m_hp) < bitmap.width()) - bitmap.pix16(y, (sx * m_hp) + x + m_hp) = BIT(data2, x); + bitmap.pix(y, (sx * m_hp) + x + m_hp) = BIT(data2, x); } } } @@ -454,7 +454,7 @@ void hd61830_device::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, } if (sy < screen().height() && sx < screen().width()) - bitmap.pix16(sy, sx) = pixel; + bitmap.pix(sy, sx) = pixel; } } } diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp index e0b08389492..a740aaa93f9 100644 --- a/src/devices/video/hd63484.cpp +++ b/src/devices/video/hd63484.cpp @@ -2107,7 +2107,7 @@ void hd63484_device::draw_graphics_line(bitmap_ind16 &bitmap, const rectangle &c if (!m_display_cb.isnull()) m_display_cb(bitmap, cliprect, y, px, data & mask); else if (cliprect.contains(px, y)) - bitmap.pix16(y, px) = data & mask; + bitmap.pix(y, px) = data & mask; data >>= bpp; } diff --git a/src/devices/video/hd66421.cpp b/src/devices/video/hd66421.cpp index 22efe3689e8..6be96c81e1f 100644 --- a/src/devices/video/hd66421.cpp +++ b/src/devices/video/hd66421.cpp @@ -208,7 +208,7 @@ void hd66421_device::reg_dat_w(uint8_t data) void hd66421_device::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/devices/video/hp1ll3.cpp b/src/devices/video/hp1ll3.cpp index 9a1952d8c25..006b8823122 100644 --- a/src/devices/video/hp1ll3.cpp +++ b/src/devices/video/hp1ll3.cpp @@ -810,14 +810,14 @@ uint32_t hp1ll3_device::screen_update(screen_device &screen, bitmap_ind16 &bitma { if (!m_enable_video) { - bitmap.fill(rgb_t::black()); + bitmap.fill(0); return 0; } for (int y = 0; y < m_vert_pix_total; y++) { int const offset = m_sad + y*m_conf[CONF_WPL]; - uint16_t *p = &m_bitmap.pix16(y); + uint16_t *p = &m_bitmap.pix(y); for (int x = offset; x < offset + m_horiz_pix_total / 16; x++) { diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp index 1160f7edf13..08ca9abc5d9 100644 --- a/src/devices/video/huc6260.cpp +++ b/src/devices/video/huc6260.cpp @@ -69,7 +69,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para int hpos = screen().hpos(); int h = m_last_h; int v = m_last_v; - uint16_t *bitmap_line = &m_bmp->pix16(v); + uint16_t *bitmap_line = &m_bmp->pix(v); while ( h != hpos || v != vpos ) { @@ -112,7 +112,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para m_hsync_changed_cb( 1 ); m_pixel_clock = 0; v = ( v + 1 ) % m_height; - bitmap_line = &m_bmp->pix16(v); + bitmap_line = &m_bmp->pix(v); break; case HUC6260_HSYNC_START + 30: /* End/Start of VSync */ diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp index 42568090447..4ff0080777a 100644 --- a/src/devices/video/huc6261.cpp +++ b/src/devices/video/huc6261.cpp @@ -100,7 +100,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para int hpos = screen().hpos(); int h = m_last_h; int v = m_last_v; - uint32_t *bitmap_line = &m_bmp->pix32(v); + uint32_t *bitmap_line = &m_bmp->pix(v); while ( h != hpos || v != vpos ) { @@ -153,7 +153,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para m_huc6270_b->hsync_changed( 1 ); m_pixel_clock = 0; v = ( v + 1 ) % m_height; - bitmap_line = &m_bmp->pix32(v); + bitmap_line = &m_bmp->pix(v); break; case HUC6261_HSYNC_START + 30: /* End/Start of VSync */ diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index 8288dd9e552..4272f3dfeac 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -24,13 +24,13 @@ DEFINE_DEVICE_TYPE(I8245, i8245_device, "i8245", "Intel 8245") // i8244_device - constructor //------------------------------------------------- -i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : i8244_device(mconfig, I8244, tag, owner, clock) { } -i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) +i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock) , device_sound_interface(mconfig, *this) , device_video_interface(mconfig, *this) @@ -40,7 +40,7 @@ i8244_device::i8244_device(const machine_config &mconfig, device_type type, cons } -i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : i8244_device(mconfig, I8245, tag, owner, clock) { } @@ -135,7 +135,7 @@ void i8244_device::device_start() memset(m_vdc.reg, 0, 0x100); save_pointer(NAME(m_vdc.reg), 0x100); - memset( m_collision_map, 0, sizeof( m_collision_map ) ); + memset(m_collision_map, 0, sizeof(m_collision_map)); save_item(NAME(m_collision_map)); save_item(NAME(m_x_beam_pos)); @@ -174,13 +174,13 @@ void i8244_device::i8244_palette(palette_device &palette) const { 0xff, 0xff, 0xff } // I R G B }; - palette.set_pen_colors( 0, i8244_colors ); + palette.set_pen_colors(0, i8244_colors); } void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch ( id ) + switch (id) { case TIMER_HBLANK_START: // hblank starts (updates sound shift register) @@ -199,25 +199,25 @@ void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, } -offs_t i8244_device::fix_register_mirrors( offs_t offset ) +offs_t i8244_device::fix_register_mirrors(offs_t offset) { // quad x/y registers are mirrored for each quad - if ( ( offset & 0xC2 ) == 0x40 ) + if ((offset & 0xc2) == 0x40) { - offset &= ~0x0C; + offset &= ~0x0c; } // registers $A0-$AF are mirrored at $B0-$BF - if ( ( offset & 0xE0 ) == 0xA0 ) + if ((offset & 0xe0) == 0xa0) { offset &= ~0x10; } - return offset & 0xFF; + return offset & 0xff; } -bool i8244_device::invalid_register( offs_t offset, bool rw ) +bool i8244_device::invalid_register(offs_t offset, bool rw) { // object x/y/attr registers are not accessible when display is enabled // (sprite shape registers still are) @@ -280,9 +280,9 @@ bool i8244_device::invalid_register( offs_t offset, bool rw ) } -uint8_t i8244_device::read(offs_t offset) +u8 i8244_device::read(offs_t offset) { - uint8_t data; + u8 data; offset = fix_register_mirrors(offset); @@ -337,7 +337,7 @@ uint8_t i8244_device::read(offs_t offset) } -void i8244_device::write(offs_t offset, uint8_t data) +void i8244_device::write(offs_t offset, u8 data) { offset = fix_register_mirrors(offset); @@ -470,7 +470,7 @@ void i8244_device::write_cx(int x, bool cx) } -uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* Draw background color */ bitmap.fill(bitswap<3>(m_vdc.s.color,3,4,5), cliprect); @@ -478,28 +478,28 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int scanline = cliprect.min_y; scanline <= cliprect.max_y; scanline++) { /* Clear collision map */ - memset( m_collision_map, 0, sizeof( m_collision_map ) ); + memset(m_collision_map, 0, sizeof(m_collision_map)); /* Display grid if enabled */ - if ( m_vdc.s.control & 0x08 ) + if (m_vdc.s.control & 0x08) { - uint16_t color = bitswap<4>(m_vdc.s.color,6,0,1,2); + u16 color = bitswap<4>(m_vdc.s.color,6,0,1,2); int x_grid_offset = 13; int y_grid_offset = 24; int width = 16; int height = 24; - int w = ( m_vdc.s.control & 0x80 ) ? width : 2; + int w = (m_vdc.s.control & 0x80) ? width : 2; /* Draw horizontal part of the grid */ - for ( int y = 0; y < 9; y++ ) + for (int y = 0; y < 9; y++) { - if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3 ) + if (y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3) { - for ( int i = 0; i < 9; i++ ) + for (int i = 0; i < 9; i++) { - if ( BIT(m_vdc.s.hgrid[1][i] << 8 | m_vdc.s.hgrid[0][i], y) ) + if (BIT(m_vdc.s.hgrid[1][i] << 8 | m_vdc.s.hgrid[0][i], y)) { - for ( int k = 0; k < width + 2; k++ ) + for (int k = 0; k < width + 2; k++) { int x = (x_grid_offset + i * width + k) * 2; @@ -507,8 +507,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - m_collision_map[ px ] |= 0x20; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x20; + bitmap.pix(scanline, px) = color; } } } @@ -518,15 +518,15 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Draw dots part of the grid */ - if ( m_vdc.s.control & 0x40 ) + if (m_vdc.s.control & 0x40) { - for ( int y = 0; y < 9; y++ ) + for (int y = 0; y < 9; y++) { - if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3 ) + if (y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3) { - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - for ( int k = 0; k < 2; k++ ) + for (int k = 0; k < 2; k++) { int x = (x_grid_offset + i * width + k) * 2; @@ -534,8 +534,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - m_collision_map[ px ] |= 0x20; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x20; + bitmap.pix(scanline, px) = color; } } } @@ -545,15 +545,15 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Draw vertical part of the grid */ - for( int j = 1, y = 0; y < 8; y++, j <<= 1 ) + for (int j = 1, y = 0; y < 8; y++, j <<= 1) { - if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + ( y + 1 ) * height ) + if (y_grid_offset + y * height <= scanline && scanline < y_grid_offset + (y + 1) * height) { - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - if ( m_vdc.s.vgrid[i] & j ) + if (m_vdc.s.vgrid[i] & j) { - for ( int k = 0; k < w; k++ ) + for (int k = 0; k < w; k++) { int x = (x_grid_offset + i * width + k) * 2; @@ -561,8 +561,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap { if (cliprect.contains(px, scanline)) { - m_collision_map[ px ] |= 0x10; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x10; + bitmap.pix(scanline, px) = color; } } } @@ -573,37 +573,37 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Display objects if enabled */ - if ( m_vdc.s.control & 0x20 && scanline <= 242 ) + if (m_vdc.s.control & 0x20 && scanline <= 242) { /* Quad objects */ - for ( int i = ARRAY_LENGTH( m_vdc.s.quad ) - 1; i >= 0; i-- ) + for (int i = ARRAY_LENGTH(m_vdc.s.quad) - 1; i >= 0; i--) { int y = m_vdc.s.quad[i].single[0].y; // Character height is always determined by the height of the 4th character - int height = 8 - ( ( ( y >> 1 ) + m_vdc.s.quad[i].single[3].ptr ) & 7 ); + int height = 8 - (((y >> 1) + m_vdc.s.quad[i].single[3].ptr) & 7); if (height == 1) height = 8; - if ( y <= scanline && scanline < y + height * 2 ) + if (y <= scanline && scanline < y + height * 2) { int x = (m_vdc.s.quad[i].single[0].x + 5) * 2; - for ( int j = 0; j < ARRAY_LENGTH( m_vdc.s.quad[0].single ); j++, x += 16 ) + for (int j = 0; j < ARRAY_LENGTH(m_vdc.s.quad[0].single); j++, x += 16) { - uint16_t color = 8 + ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 ); - int offset = ( m_vdc.s.quad[i].single[j].ptr | ( ( m_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 ); - uint8_t chr = m_charset[ offset & 0x1FF ]; + u16 color = 8 + ((m_vdc.s.quad[i].single[j].color >> 1) & 0x07); + int offset = (m_vdc.s.quad[i].single[j].ptr | ((m_vdc.s.quad[i].single[j].color & 0x01) << 8)) + (y >> 1) + ((scanline - y) >> 1); + u8 chr = m_charset[offset & 0x1ff]; - for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 ) + for (u8 m = 0x80; m > 0; m >>= 1, x += 2) { - if ( chr & m ) + if (chr & m) { for (int px = x; px < x + 2; px++) { if (cliprect.contains(px, scanline)) { // Check collision with self - u8 colx = m_collision_map[ px ]; + u8 colx = m_collision_map[px]; if (colx & 0x80) { colx &= ~0x80; @@ -618,8 +618,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (m_vdc.s.collision & 0x80) m_collision_status |= colx; - m_collision_map[ px ] |= 0x80; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x80; + bitmap.pix(scanline, px) = color; } } } @@ -629,29 +629,29 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Regular foreground objects */ - for ( int i = ARRAY_LENGTH( m_vdc.s.foreground ) - 1; i >= 0; i-- ) + for (int i = ARRAY_LENGTH(m_vdc.s.foreground) - 1; i >= 0; i--) { int y = m_vdc.s.foreground[i].y; - int height = 8 - ( ( ( y >> 1 ) + m_vdc.s.foreground[i].ptr ) & 7 ); + int height = 8 - (((y >> 1) + m_vdc.s.foreground[i].ptr) & 7); if (height == 1) height = 8; - if ( y <= scanline && scanline < y + height * 2 ) + if (y <= scanline && scanline < y + height * 2) { - uint16_t color = 8 + ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 ); - int offset = ( m_vdc.s.foreground[i].ptr | ( ( m_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 ); - uint8_t chr = m_charset[ offset & 0x1FF ]; + u16 color = 8 + ((m_vdc.s.foreground[i].color >> 1) & 0x07); + int offset = (m_vdc.s.foreground[i].ptr | ((m_vdc.s.foreground[i].color & 0x01) << 8)) + (y >> 1) + ((scanline - y) >> 1); + u8 chr = m_charset[offset & 0x1ff]; int x = (m_vdc.s.foreground[i].x + 5) * 2; - for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 ) + for (u8 m = 0x80; m > 0; m >>= 1, x += 2) { - if ( chr & m ) + if (chr & m) { for (int px = x; px < x + 2; px++) { if (cliprect.contains(px, scanline)) { // Check collision with self - u8 colx = m_collision_map[ px ]; + u8 colx = m_collision_map[px]; if (colx & 0x80) { colx &= ~0x80; @@ -666,8 +666,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (m_vdc.s.collision & 0x80) m_collision_status |= colx; - m_collision_map[ px ] |= 0x80; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x80; + bitmap.pix(scanline, px) = color; } } } @@ -676,30 +676,30 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Sprites */ - for ( int i = ARRAY_LENGTH( m_vdc.s.sprites ) - 1; i >= 0; i-- ) + for (int i = ARRAY_LENGTH(m_vdc.s.sprites) - 1; i >= 0; i--) { int y = m_vdc.s.sprites[i].y; int height = 8; bool zoom_enable = bool(m_vdc.s.sprites[i].color & 4); int zoom_px = zoom_enable ? 4 : 2; - if ( y <= scanline && scanline < y + height * zoom_px ) + if (y <= scanline && scanline < y + height * zoom_px) { - uint16_t color = 8 + ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 ); - uint8_t chr = m_vdc.s.shape[i][ ( ( scanline - y ) / zoom_px ) ]; + u16 color = 8 + ((m_vdc.s.sprites[i].color >> 3) & 0x07); + u8 chr = m_vdc.s.shape[i][((scanline - y) / zoom_px)]; int x = (m_vdc.s.sprites[i].x + 5) * 2; int x_shift = 0; - switch ( m_vdc.s.sprites[i].color & 0x03 ) + switch (m_vdc.s.sprites[i].color & 0x03) { case 1: // Xg attribute set x_shift = 1; break; case 2: // S attribute set - x_shift = ( ( ( scanline - y ) / zoom_px ) & 0x01 ) ^ 0x01; + x_shift = (((scanline - y) / zoom_px) & 0x01) ^ 0x01; break; case 3: // Xg and S attributes set - x_shift = ( ( scanline - y ) / zoom_px ) & 0x01; + x_shift = ((scanline - y) / zoom_px) & 0x01; break; default: break; @@ -707,9 +707,9 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap x += x_shift * (zoom_px / 2); - for ( uint8_t m = 0x01; m > 0; m <<= 1, x += zoom_px ) + for (u8 m = 0x01; m > 0; m <<= 1, x += zoom_px) { - if ( chr & m ) + if (chr & m) { for (int px = x; px < x + zoom_px; px++) { @@ -718,15 +718,15 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap u8 mask = 1 << i; // Check if we collide with an already drawn source object - if (m_vdc.s.collision & m_collision_map[ px ]) + if (m_vdc.s.collision & m_collision_map[px]) m_collision_status |= mask; // Check if an already drawn object would collide with us if (m_vdc.s.collision & mask) - m_collision_status |= m_collision_map[ px ]; + m_collision_status |= m_collision_map[px]; - m_collision_map[ px ] |= mask; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= mask; + bitmap.pix(scanline, px) = color; } } } @@ -783,9 +783,9 @@ void i8244_device::sound_update() // loop sound signal |= feedback << 23; - m_vdc.s.shift3 = signal & 0xFF; - m_vdc.s.shift2 = ( signal >> 8 ) & 0xFF; - m_vdc.s.shift1 = ( signal >> 16 ) & 0xFF; + m_vdc.s.shift3 = signal & 0xff; + m_vdc.s.shift2 = (signal >> 8) & 0xff; + m_vdc.s.shift1 = (signal >> 16) & 0xff; // sound interrupt if (++m_sh_count == 24) diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index 3568f5a613d..565ed13826f 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -27,68 +27,68 @@ class i8244_device : public device_t { public: // construction/destruction - i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // configuration helpers auto irq_cb() { return m_irq_func.bind(); } i8244_device &set_screen_size(int width, int height, int cropx = 0, int cropy = 0); - uint8_t read(offs_t offset); - void write(offs_t offset, uint8_t data); + u8 read(offs_t offset); + void write(offs_t offset, u8 data); void write_cx(int x, bool cx); // CX pin on current scanline int vblank(); int hblank(); void i8244_palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: union vdc_t { - uint8_t reg[0x100]; + u8 reg[0x100]; struct { // 0x00 struct { - uint8_t y,x,color,unused; + u8 y,x,color,unused; } sprites[4]; // 0x10 struct { - uint8_t y,x,ptr,color; + u8 y,x,ptr,color; } foreground[12]; // 0x40 struct { struct { - uint8_t y,x,ptr,color; + u8 y,x,ptr,color; } single[4]; } quad[4]; // 0x80 - uint8_t shape[4][8]; + u8 shape[4][8]; // 0xa0 - uint8_t control; - uint8_t status; - uint8_t collision; - uint8_t color; - uint8_t y; - uint8_t x; - uint8_t unused; - uint8_t shift1; - uint8_t shift2; - uint8_t shift3; - uint8_t sound; - uint8_t unused2[5+0x10]; + u8 control; + u8 status; + u8 collision; + u8 color; + u8 y; + u8 x; + u8 unused; + u8 shift1; + u8 shift2; + u8 shift3; + u8 sound; + u8 unused2[5+0x10]; // 0xc0 - uint8_t hgrid[2][0x10]; - uint8_t vgrid[0x10]; - uint8_t unused3[0x10]; + u8 hgrid[2][0x10]; + u8 vgrid[0x10]; + u8 unused3[0x10]; } s; }; - i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); // device-level overrides virtual void device_config_complete() override; @@ -103,8 +103,8 @@ protected: int get_y_beam(); int get_x_beam(); - offs_t fix_register_mirrors( offs_t offset ); - bool invalid_register( offs_t offset, bool rw ); + offs_t fix_register_mirrors(offs_t offset); + bool invalid_register(offs_t offset, bool rw); /* timers */ static constexpr device_timer_id TIMER_VBLANK_START = 0; @@ -113,7 +113,7 @@ protected: // callbacks devcb_write_line m_irq_func; - required_region_ptr<uint8_t> m_charset; + required_region_ptr<u8> m_charset; emu_timer *m_hblank_timer; emu_timer *m_vblank_timer; @@ -135,12 +135,12 @@ protected: int m_bgate_start; vdc_t m_vdc; - uint8_t m_collision_map[0x200]; + u8 m_collision_map[0x200]; - uint8_t m_x_beam_pos = 0; - uint8_t m_y_beam_pos = 0; - uint8_t m_control_status = 0; - uint8_t m_collision_status = 0; + u8 m_x_beam_pos = 0; + u8 m_y_beam_pos = 0; + u8 m_control_status = 0; + u8 m_collision_status = 0; bool m_sh_written = false; bool m_sh_pending = false; @@ -155,7 +155,7 @@ class i8245_device : public i8244_device { public: // construction/destruction - i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: virtual void set_default_params() override; diff --git a/src/devices/video/imagetek_i4100.cpp b/src/devices/video/imagetek_i4100.cpp index 030314636c1..8c0eaff1011 100644 --- a/src/devices/video/imagetek_i4100.cpp +++ b/src/devices/video/imagetek_i4100.cpp @@ -59,7 +59,7 @@ 8 to 64 (independently for width and height) with an 8 pixel granularity. The "tile" address is a multiple of 8x8 pixels. - Each sprite can be shrinked to ~1/4 or enlarged to ~32x following + Each sprite can be shrunk to ~1/4 or enlarged to ~32x following an exponential curve of sizes (with one zoom value for both width and height) @@ -295,7 +295,7 @@ imagetek_i4300_device::imagetek_i4300_device(const machine_config &mconfig, cons //------------------------------------------------- // device_add_mconfig - device-specific machine -// configuration addiitons +// configuration additions //------------------------------------------------- void imagetek_i4100_device::device_add_mconfig(machine_config &config) @@ -331,6 +331,10 @@ void imagetek_i4100_device::expand_gfx1() void imagetek_i4100_device::device_start() { m_inited_hack = false; + + m_screen_blank = false; + m_screen_flip = false; + save_item(NAME(m_rombank)); save_item(NAME(m_crtc_unlock)); save_item(NAME(m_sprite_count)); @@ -395,7 +399,7 @@ void imagetek_i4100_device::vram_2_w(offs_t offset, uint16_t data, uint16_t mem_ /* Some game uses almost only the blitter to write to the tilemaps. The CPU can only access a "window" of 512x256 pixels in the upper left corner of the big tilemap */ -// TODO: Puzzlet, Sankokushi & Lady Killer contradicts with aformentioned description (more like RMW?) +// TODO: Puzzlet, Sankokushi & Lady Killer contradicts with aforementioned description (more like RMW?) static inline offs_t RMW_OFFS(offs_t offset) { @@ -923,8 +927,8 @@ void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 & for (int y = sy; y < ey; y++) { const u8 *source = source_base + (y_index >> 16) * width; - u32 *dest = &bitmap.pix32(y); - u8 *pri = &priority_bitmap.pix8(y); + u32 *dest = &bitmap.pix(y); + u8 *pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -1200,8 +1204,8 @@ void imagetek_i4100_device::draw_tilemap(screen_device &screen, bitmap_rgb32 &bi int const srctilerow = srcline >> tileshift; srcline &= tilemask; - u32 *dst = &bitmap.pix32(y); - u8 *priority_baseaddr = &priority_bitmap.pix8(y); + u32 *dst = &bitmap.pix(y); + u8 *priority_baseaddr = &priority_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/devices/video/m50458.cpp b/src/devices/video/m50458.cpp index 97e67af8a75..e2404684700 100644 --- a/src/devices/video/m50458.cpp +++ b/src/devices/video/m50458.cpp @@ -204,21 +204,19 @@ void m50458_device::device_validity_check(validity_checker &valid) const void m50458_device::device_start() { - uint16_t tmp; - uint8_t *pcg = memregion("m50458")->base(); - int tile; - int yi; - uint16_t src,dst; + uint8_t const *const pcg = memregion("m50458")->base(); /* Create an array for shadow gfx */ /* this will spread the source ROM into four directions (up-left, up-right, down-left, down-right) thus creating a working shadow copy */ m_shadow_gfx = make_unique_clear<uint8_t[]>(0x1200); - for(tile=0;tile<0x80;tile++) + for(int tile=0;tile<0x80;tile++) { - for(yi=1;yi<17;yi++) + for(int yi=1;yi<17;yi++) { - src = (tile & 0x7f)*36+yi*2; /* source offset */ + uint16_t tmp, dst; + + uint16_t const src = (tile & 0x7f)*36+yi*2; /* source offset */ dst = (tile & 0x7f)*36+(yi-1)*2; /* destination offset */ @@ -331,40 +329,34 @@ WRITE_LINE_MEMBER( m50458_device::set_clock_line ) uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t *pcg = memregion("m50458")->base(); - uint8_t bg_r,bg_g,bg_b; + uint8_t const *const pcg = memregion("m50458")->base(); /* TODO: there's probably a way to control the brightness in this */ - bg_r = m_phase & 1 ? 0xdf : 0; - bg_g = m_phase & 2 ? 0xdf : 0; - bg_b = m_phase & 4 ? 0xdf : 0; + uint8_t const bg_r = m_phase & 1 ? 0xdf : 0; + uint8_t const bg_g = m_phase & 2 ? 0xdf : 0; + uint8_t const bg_b = m_phase & 4 ? 0xdf : 0; bitmap.fill(rgb_t(0xff,bg_r,bg_g,bg_b),cliprect); - for(y=0;y<12;y++) + for(int y=0;y<12;y++) { - for(x=0;x<24;x++) + for(int x=0;x<24;x++) { - int xi,yi; - uint16_t tile; int y_base = y; if(y != 0 && m_scrr > 1) { y_base+=(m_scrr - 1); } if(y_base > 11) { y_base -= 11; } if(m_scrr && y == 11) { y_base = 0; } /* Guess: repeat line 0 if scrolling is active */ - tile = read_word(x+y_base*24); + uint16_t const tile = read_word(x+y_base*24); - for(yi=0;yi<18;yi++) + for(int yi=0;yi<18;yi++) { - for(xi=4;xi<16;xi++) /* TODO: remove 4 / 16 / -4 offset once that the ROM is fixed */ + for(int xi=4;xi<16;xi++) /* TODO: remove 4 / 16 / -4 offset once that the ROM is fixed */ { - uint8_t pix; - uint8_t color = (tile & 0x700) >> 8; - uint16_t offset = ((tile & 0x7f)*36+yi*2); - int res_y,res_x; - uint8_t xh,yh; + uint8_t const color = (tile & 0x700) >> 8; + uint16_t const offset = ((tile & 0x7f)*36+yi*2); + uint8_t pix; if(xi>=8) pix = ((pcg[offset+1] >> (7-(xi & 0x7))) & 1) << 1; else @@ -382,8 +374,8 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(yi == 17 && tile & 0x1000) /* underline? */ pix |= 1; - res_y = y*18+yi; - res_x = x*12+(xi-4); + int res_y = y*18+yi; + int res_x = x*12+(xi-4); if(y != 0 && y != 11) { @@ -419,9 +411,9 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(res_y > 215 || res_x > 288) continue; - for(yh=0;yh<m_vsz1+1;yh++) - for(xh=0;xh<m_hsz1+1;xh++) - bitmap.pix32(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; + for(uint8_t yh=0;yh<m_vsz1+1;yh++) + for(uint8_t xh=0;xh<m_hsz1+1;xh++) + bitmap.pix(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; } else if(y_base == 11) { @@ -432,9 +424,9 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(res_y > 215 || res_x > 288) continue; - for(yh=0;yh<m_vsz3+1;yh++) - for(xh=0;xh<m_hsz3+1;xh++) - bitmap.pix32(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; + for(uint8_t yh=0;yh<m_vsz3+1;yh++) + for(uint8_t xh=0;xh<m_hsz3+1;xh++) + bitmap.pix(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; } else { @@ -444,9 +436,9 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(res_y > 215 || res_x > 288) continue; - for(yh=0;yh<m_vsz2+1;yh++) - for(xh=0;xh<m_hsz2+1;xh++) - bitmap.pix32(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; + for(uint8_t yh=0;yh<m_vsz2+1;yh++) + for(uint8_t xh=0;xh<m_hsz2+1;xh++) + bitmap.pix(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; } } } diff --git a/src/devices/video/mb88303.cpp b/src/devices/video/mb88303.cpp index 1112012db1d..16a24122306 100644 --- a/src/devices/video/mb88303.cpp +++ b/src/devices/video/mb88303.cpp @@ -339,7 +339,7 @@ void mb88303_device::update_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipre const uint32_t color = BIT(gfx[row], bit) ? 0xffffffff : 0; if (!show_background() && !color) continue; - bitmap.pix32(bitmap_y + row + m_vert_display_pos, bitmap_x + (6 - bit) + m_horiz_display_pos) = color; + bitmap.pix(bitmap_y + row + m_vert_display_pos, bitmap_x + (6 - bit) + m_horiz_display_pos) = color; } } } diff --git a/src/devices/video/mb90082.cpp b/src/devices/video/mb90082.cpp index b56e4e61409..27ef9238ec6 100644 --- a/src/devices/video/mb90082.cpp +++ b/src/devices/video/mb90082.cpp @@ -207,44 +207,37 @@ void mb90082_device::write(uint8_t data) uint32_t mb90082_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t *pcg = memregion("mb90082")->base(); - uint16_t tile,attr; - uint8_t bg_r,bg_g,bg_b; + uint8_t const *const pcg = memregion("mb90082")->base(); /* TODO: there's probably a way to control the brightness in this */ - bg_b = m_uc & 1 ? 0xdf : 0; - bg_g = m_uc & 2 ? 0xdf : 0; - bg_r = m_uc & 4 ? 0xdf : 0; + uint8_t const bg_b = m_uc & 1 ? 0xdf : 0; + uint8_t const bg_g = m_uc & 2 ? 0xdf : 0; + uint8_t const bg_r = m_uc & 4 ? 0xdf : 0; bitmap.fill(rgb_t(0xff,bg_r,bg_g,bg_b),cliprect); - for(y=0;y<12;y++) + for(int y=0;y<12;y++) { - for(x=0;x<24;x++) + for(int x=0;x<24;x++) { - int xi,yi; - - tile = read_word(x+y*24); - attr = read_word((x+y*24)|0x200); + uint16_t tile = read_word(x+y*24); + uint16_t attr = read_word((x+y*24)|0x200); /* TODO: charset hook-up is obviously WRONG so following mustn't be trusted at all */ - for(yi=0;yi<16;yi++) + for(int yi=0;yi<16;yi++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - uint8_t pix; - uint8_t color = (attr & 0x70) >> 4; - uint8_t r,g,b; + uint8_t const color = (attr & 0x70) >> 4; - pix = (pcg[(tile*8)+(yi >> 1)] >> (7-(xi >> 1))) & 1; + uint8_t const pix = (pcg[(tile*8)+(yi >> 1)] >> (7-(xi >> 1))) & 1; /* TODO: check this */ - b = (color & 1) ? 0xff : 0; - g = (color & 2) ? 0xff : 0; - r = (color & 4) ? 0xff : 0; + uint8_t const b = (color & 1) ? 0xff : 0; + uint8_t const g = (color & 2) ? 0xff : 0; + uint8_t const r = (color & 4) ? 0xff : 0; if(tile != 0xff && pix != 0) - bitmap.pix32(y*16+yi,x*16+xi) = r << 16 | g << 8 | b; + bitmap.pix(y*16+yi,x*16+xi) = r << 16 | g << 8 | b; } } } diff --git a/src/devices/video/mb_vcu.cpp b/src/devices/video/mb_vcu.cpp index 745675243e6..09ac807f13a 100644 --- a/src/devices/video/mb_vcu.cpp +++ b/src/devices/video/mb_vcu.cpp @@ -526,36 +526,33 @@ void mb_vcu_device::vbank_clear_w(uint8_t data) uint32_t mb_vcu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t dot; - bitmap.fill(m_palette->pen(0x100),cliprect); - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - dot = read_byte((x >> 0)|(y<<8)|1<<16|(m_vbank ^ 1)<<18); + uint8_t dot = read_byte((x >> 0)|(y<<8)|1<<16|(m_vbank ^ 1)<<18); //if(dot != 0xf) { dot|= m_vregs[1] << 4; - bitmap.pix32(y,x) = m_palette->pen(dot); + bitmap.pix(y,x) = m_palette->pen(dot); } } } - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - dot = read_byte((x >> 0)|(y<<8)|0<<16|(m_vbank ^ 1)<<18); + uint8_t dot = read_byte((x >> 0)|(y<<8)|0<<16|(m_vbank ^ 1)<<18); if(dot != 0xf) { dot|= m_vregs[1] << 4; - bitmap.pix32(y,x) = m_palette->pen(dot); + bitmap.pix(y,x) = m_palette->pen(dot); } } } diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp index b8cc7148243..abf5692b7c7 100644 --- a/src/devices/video/mc6845.cpp +++ b/src/devices/video/mc6845.cpp @@ -108,6 +108,7 @@ mc6845_device::mc6845_device(const machine_config &mconfig, device_type type, co : device_t(mconfig, type, tag, owner, clock) , device_video_interface(mconfig, *this, false) , m_show_border_area(true) + , m_noninterlace_adjust(0) , m_interlace_adjust(0) , m_clk_scale(1) , m_visarea_adjust_min_x(0) @@ -188,7 +189,7 @@ void mc6845_device::transparent_update() { m_update_addr++; m_update_addr &= 0x3fff; - call_on_update_address(0); + call_on_update_address(MODE_UPDATE_STROBE); } else { @@ -267,7 +268,7 @@ void mc6845_device::register_w(uint8_t data) { m_update_addr = ((data & 0x3f) << 8) | (m_update_addr & 0x00ff); if(MODE_TRANSPARENT_PHI2) - call_on_update_address(0); + call_on_update_address(MODE_UPDATE_STROBE); } break; case 0x13: @@ -275,7 +276,7 @@ void mc6845_device::register_w(uint8_t data) { m_update_addr = ((data & 0xff) << 0) | (m_update_addr & 0xff00); if(MODE_TRANSPARENT_PHI2) - call_on_update_address(0); + call_on_update_address(MODE_UPDATE_STROBE); } break; case 0x1f: transparent_update(); break; @@ -993,7 +994,7 @@ void mc6845_device::device_timer(emu_timer &timer, device_timer_id id, int param case TIMER_UPD_ADR: /* fire a update address strobe */ - call_on_update_address(0); + call_on_update_address(MODE_UPDATE_STROBE); break; case TIMER_UPD_TRANS: @@ -1122,7 +1123,7 @@ uint8_t mc6845_device::draw_scanline(int y, bitmap_rgb32 &bitmap, const rectangl // is in units of characters and is relative to the start of the // displayable area, not relative to the screen bitmap origin. int8_t cursor_x = cursor_visible ? (m_cursor_addr - m_current_disp_addr) : -1; - int de = (y < m_max_visible_y) ? 1 : 0; + int de = (y <= m_max_visible_y) ? 1 : 0; int vbp = m_vert_pix_total - m_vsync_off_pos; if (vbp < 0) vbp = 0; int hbp = m_horiz_pix_total - m_hsync_off_pos; @@ -1250,6 +1251,7 @@ void mc6845_device::device_start() m_horiz_char_total = 0xff; m_max_ras_addr = 0x1f; m_vert_char_total = 0x7f; + m_mode_control = 0x00; m_supports_disp_start_addr_r = false; // MC6845 can not read Display Start (double checked on datasheet) m_supports_vert_sync_width = false; @@ -1779,7 +1781,7 @@ MC6845_UPDATE_ROW( mos8563_device::vdc_update_row ) if (x < 0) x = 0; int color = BIT(code, 7) ? fg : bg; - bitmap.pix32(vbp + y, hbp + x) = pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = pen(de ? color : 0); } } else @@ -1815,7 +1817,7 @@ MC6845_UPDATE_ROW( mos8563_device::vdc_update_row ) if (x < 0) x = 0; int color = BIT(data, 7) ? fg : bg; - bitmap.pix32(vbp + y, hbp + x) = pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = pen(de ? color : 0); if ((bit < 8) || !HSS_SEMI) data <<= 1; } diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h index 78a8ad57345..78fe0eac5f3 100644 --- a/src/devices/video/mc6847.h +++ b/src/devices/video/mc6847.h @@ -81,7 +81,7 @@ protected: pixel_t *bitmap_addr(bitmap_rgb32 &bitmap, int y, int x) { - return &bitmap.pix32(y, x); + return &bitmap.pix(y, x); } static uint8_t simplify_mode(uint8_t data, uint8_t mode) @@ -183,8 +183,8 @@ protected: if( (mode & MODE_AS) || ((mode & (MODE_AG|MODE_GM0) ) == MODE_AG) ) { - pixel_t *line1 = &bitmap.pix32(y + base_y, base_x); - pixel_t *line2 = &bitmap.pix32(y + base_y + 1, base_x); + pixel_t *line1 = &bitmap.pix(y + base_y, base_x); + pixel_t *line2 = &bitmap.pix(y + base_y + 1, base_x); std::map<std::pair<pixel_t,pixel_t>,pixel_t>::const_iterator newColor; for( int pixel = 0; pixel < bitmap.width() - (base_x * 2); ++pixel ) diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp index b88cad06c64..a6e3c246a76 100644 --- a/src/devices/video/mos6566.cpp +++ b/src/devices/video/mos6566.cpp @@ -515,55 +515,37 @@ inline void mos6566_device::draw_background() inline void mos6566_device::draw_mono( uint16_t p, uint8_t c0, uint8_t c1 ) { - uint8_t c[2]; + uint8_t const c[2] = { c0, c1 }; uint8_t data = m_gfx_data; - c[0] = c0; - c[1] = c1; - - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 7] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 6] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 5] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 4] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 3] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 2] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 1] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[c[data]]; - m_fore_coll_buf[p + 0] = data & 1; + for (unsigned i = 0; i < 8; i++) + { + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 7 - i) = PALETTE_MOS[c[data & 1]]; + m_fore_coll_buf[p + 7 - i] = data & 1; + data >>= 1; + } } inline void mos6566_device::draw_multi( uint16_t p, uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3 ) { - uint8_t c[4]; + uint8_t const c[4] = { c0, c1, c2, c3 }; uint8_t data = m_gfx_data; - c[0] = c0; - c[1] = c1; - c[2] = c2; - c[3] = c3; - - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 7] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 6] = data & 2; data >>= 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 5] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 4] = data & 2; data >>= 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 3] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 2] = data & 2; data >>= 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[c[data]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[c[data]]; m_fore_coll_buf[p + 1] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[c[data]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[c[data]]; m_fore_coll_buf[p + 0] = data & 2; } @@ -2078,57 +2060,23 @@ void mos6566_device::draw_graphics() draw_mono(p, tmp_col, m_color_data & 0x0f); break; case 5: - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 7] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 6] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 5] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 4] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 3] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 2] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 1] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 0] = 0; - break; case 6: - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 7] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 6] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 5] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 4] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 3] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 2] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 1] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 0] = 0; - break; case 7: - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; m_fore_coll_buf[p + 7] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; m_fore_coll_buf[p + 6] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; m_fore_coll_buf[p + 5] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; m_fore_coll_buf[p + 4] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; m_fore_coll_buf[p + 3] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; m_fore_coll_buf[p + 2] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; m_fore_coll_buf[p + 1] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; m_fore_coll_buf[p + 0] = 0; break; } @@ -2203,12 +2151,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } } @@ -2251,12 +2199,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } } @@ -2282,12 +2230,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } } @@ -2308,12 +2256,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } } @@ -2363,12 +2311,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } } @@ -2393,12 +2341,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } } diff --git a/src/devices/video/msm6255.cpp b/src/devices/video/msm6255.cpp index f7f0ee2928a..de34d079cde 100644 --- a/src/devices/video/msm6255.cpp +++ b/src/devices/video/msm6255.cpp @@ -328,9 +328,7 @@ void msm6255_device::draw_scanline(bitmap_ind16 &bitmap, const rectangle &clipre uint8_t cpd = m_cpr & CPR_CPD_MASK; uint16_t car = (m_cur << 8) | m_clr; - int sx, x; - - for (sx = 0; sx < hn; sx++) + for (int sx = 0; sx < hn; sx++) { uint8_t data = read_byte(ma, ra); @@ -345,9 +343,9 @@ void msm6255_device::draw_scanline(bitmap_ind16 &bitmap, const rectangle &clipre } } - for (x = 0; x < hp; x++) + for (int x = 0; x < hp; x++) { - bitmap.pix16(y, (sx * hp) + x) = BIT(data, 7); + bitmap.pix(y, (sx * hp) + x) = BIT(data, 7); data <<= 1; } diff --git a/src/devices/video/nt7534.cpp b/src/devices/video/nt7534.cpp index e777aac55dc..15fd1fb41e5 100644 --- a/src/devices/video/nt7534.cpp +++ b/src/devices/video/nt7534.cpp @@ -148,7 +148,7 @@ uint32_t nt7534_device::screen_update(screen_device &screen, bitmap_ind16 &bitma { uint8_t py = (y + m_display_start_line - 32) % 65; uint8_t page = py/8; - bitmap.pix16(y, x) = BIT(m_ddram[page*132 + px], py%8); + bitmap.pix(y, x) = BIT(m_ddram[page*132 + px], py%8); } } diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index 33f2f48d999..9f0bf5c48a7 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -449,42 +449,37 @@ uint32_t vga_device::start_addr() void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t ch, attr; - uint8_t bits; - uint32_t font_base; - uint32_t *bitmapline; int width=VGA_CH_WIDTH, height = (vga.crtc.maximum_scan_line) * (vga.crtc.scan_doubling + 1); - int pos, line, column, mask, w, h, addr; - uint8_t blink_en,fore_col,back_col; - pen_t pen; if(vga.crtc.cursor_enable) vga.cursor.visible = screen().frame_number() & 0x10; else vga.cursor.visible = 0; - for (addr = vga.crtc.start_addr, line = -vga.crtc.preset_row_scan; line < TEXT_LINES; + for (int addr = vga.crtc.start_addr, line = -vga.crtc.preset_row_scan; line < TEXT_LINES; line += height, addr += (offset()>>1)) { - for (pos = addr, column=0; column<TEXT_COLUMNS; column++, pos++) + for (int pos = addr, column=0; column<TEXT_COLUMNS; column++, pos++) { - ch = vga.memory[(pos<<1) + 0]; - attr = vga.memory[(pos<<1) + 1]; - font_base = 0x20000+(ch<<5); + uint8_t ch = vga.memory[(pos<<1) + 0]; + uint8_t attr = vga.memory[(pos<<1) + 1]; + uint32_t font_base = 0x20000+(ch<<5); font_base += ((attr & 8) ? vga.sequencer.char_sel.A : vga.sequencer.char_sel.B)*0x2000; - blink_en = (vga.attribute.data[0x10]&8&&screen().frame_number() & 0x20) ? attr & 0x80 : 0; + uint8_t blink_en = (vga.attribute.data[0x10]&8&&screen().frame_number() & 0x20) ? attr & 0x80 : 0; - fore_col = attr & 0xf; - back_col = (attr & 0x70) >> 4; + uint8_t fore_col = attr & 0xf; + uint8_t back_col = (attr & 0x70) >> 4; back_col |= (vga.attribute.data[0x10]&8) ? 0 : ((attr & 0x80) >> 4); - for (h = std::max(-line, 0); (h < height) && (line+h < std::min(TEXT_LINES, bitmap.height())); h++) + for (int h = std::max(-line, 0); (h < height) && (line+h < std::min(TEXT_LINES, bitmap.height())); h++) { - bitmapline = &bitmap.pix32(line+h); - bits = vga.memory[font_base+(h>>(vga.crtc.scan_doubling))]; + uint32_t *const bitmapline = &bitmap.pix(line+h); + uint8_t bits = vga.memory[font_base+(h>>(vga.crtc.scan_doubling))]; + int mask, w; for (mask=0x80, w=0; (w<width)&&(w<8); w++, mask>>=1) { + pen_t pen; if (bits&mask) pen = vga.pens[blink_en ? back_col : fore_col]; else @@ -498,6 +493,7 @@ void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) if (w<width) { /* 9 column */ + pen_t pen; if (TEXT_COPY_9COLUMN(ch)&&(bits&1)) pen = vga.pens[blink_en ? back_col : fore_col]; else @@ -510,7 +506,7 @@ void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) } if (vga.cursor.visible&&(pos==vga.crtc.cursor_addr)) { - for (h=vga.crtc.cursor_scan_start; + for (int h=vga.crtc.cursor_scan_start; (h<=vga.crtc.cursor_scan_end)&&(h<height)&&(line+h<TEXT_LINES); h++) { @@ -525,34 +521,29 @@ void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) void vga_device::vga_vh_ega(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int pos, line, column, c, addr, i, yi; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - uint32_t *bitmapline; - pen_t pen; int pel_shift = (vga.attribute.pel_shift & 7); // popmessage("%08x %02x",EGA_START_ADDRESS,pel_shift); /**/ - for (addr=EGA_START_ADDRESS, pos=0, line=0; line<LINES; - line += height, addr += offset()) + for (int addr=EGA_START_ADDRESS, line=0; line<LINES; line += height, addr += offset()) { - for(yi=0;yi<height;yi++) + for (int yi=0;yi<height;yi++) { - bitmapline = &bitmap.pix32(line + yi); + uint32_t *const bitmapline = &bitmap.pix(line + yi); - for (pos=addr, c=0, column=0; column<EGA_COLUMNS+1; column++, c+=8, pos=(pos+1)&0xffff) + for (int pos=addr, c=0, column=0; column<EGA_COLUMNS+1; column++, c+=8, pos=(pos+1)&0xffff) { - int data[4]; + int data[4] = { + vga.memory[(pos & 0xffff)], + vga.memory[(pos & 0xffff)+0x10000]<<1, + vga.memory[(pos & 0xffff)+0x20000]<<2, + vga.memory[(pos & 0xffff)+0x30000]<<3 }; - data[0]=vga.memory[(pos & 0xffff)]; - data[1]=vga.memory[(pos & 0xffff)+0x10000]<<1; - data[2]=vga.memory[(pos & 0xffff)+0x20000]<<2; - data[3]=vga.memory[(pos & 0xffff)+0x30000]<<3; - - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { - pen = vga.pens[(data[0]&1) | (data[1]&2) | (data[2]&4) | (data[3]&8)]; + pen_t pen = vga.pens[(data[0]&1) | (data[1]&2) | (data[2]&4) | (data[3]&8)]; data[0]>>=1; data[1]>>=1; @@ -571,26 +562,21 @@ void vga_device::vga_vh_ega(bitmap_rgb32 &bitmap, const rectangle &cliprect) /* TODO: I'm guessing that in 256 colors mode every pixel actually outputs two pixels. Is it right? */ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; - uint16_t mask_comp; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int yi; - int xi; int pel_shift = (vga.attribute.pel_shift & 6); int addrmask = vga.crtc.no_wrap ? -1 : 0xffff; /* line compare is screen sensitive */ - mask_comp = 0x3ff; //| (LINES & 0x300); + uint16_t mask_comp = 0x3ff; //| (LINES & 0x300); // popmessage("%02x %02x",vga.attribute.pel_shift,vga.sequencer.data[4] & 0x08); - curr_addr = 0; + int curr_addr = 0; if(!(vga.sequencer.data[4] & 0x08)) { - for (addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) { - for(yi = 0;yi < height; yi++) + for(int yi = 0;yi < height; yi++) { if((line + yi) < (vga.crtc.line_compare & mask_comp)) curr_addr = addr; @@ -599,15 +585,15 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) curr_addr = 0; pel_shift = 0; } - bitmapline = &bitmap.pix32(line + yi); - for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=8, pos++) + uint32_t *const bitmapline = &bitmap.pix(line + yi); + for (int pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=8, pos++) { if(pos > 0x80000/4) return; - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - if(!screen().visible_area().contains(c+xi-(pel_shift), line + yi)) + if (!screen().visible_area().contains(c+xi-(pel_shift), line + yi)) continue; bitmapline[c+xi-(pel_shift)] = pen(vga.memory[(pos & addrmask)+((xi >> 1)*0x10000)]); } @@ -617,22 +603,22 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) } else { - for (addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) { - for(yi = 0;yi < height; yi++) + for(int yi = 0;yi < height; yi++) { if((line + yi) < (vga.crtc.line_compare & mask_comp)) curr_addr = addr; if((line + yi) == (vga.crtc.line_compare & mask_comp)) curr_addr = 0; - bitmapline = &bitmap.pix32(line + yi); + uint32_t *const bitmapline = &bitmap.pix(line + yi); //addr %= 0x80000; - for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=0x10, pos+=0x8) + for (int pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=0x10, pos+=0x8) { if(pos + 0x08 > 0x80000) return; - for(xi=0;xi<0x10;xi++) + for (int xi=0;xi<0x10;xi++) { if(!screen().visible_area().contains(c+xi-(pel_shift), line + yi)) continue; @@ -646,28 +632,23 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) void vga_device::vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *bitmapline; int height = (vga.crtc.scan_doubling + 1); - int x,xi,y,yi; - uint32_t addr; - pen_t pen; - int width; - width = (vga.crtc.horz_disp_end + 1) * 8; + int width = (vga.crtc.horz_disp_end + 1) * 8; - for(y=0;y<LINES;y++) + for(int y=0;y<LINES;y++) { - addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/4); + uint32_t addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/4); - for(x=0;x<width;x+=4) + for(int x=0;x<width;x+=4) { - for(yi=0;yi<height;yi++) + for(int yi=0;yi<height;yi++) { - bitmapline = &bitmap.pix32(y * height + yi); + uint32_t *const bitmapline = &bitmap.pix(y * height + yi); - for(xi=0;xi<4;xi++) + for(int xi=0;xi<4;xi++) { - pen = vga.pens[(vga.memory[addr] >> (6-xi*2)) & 3]; + pen_t pen = vga.pens[(vga.memory[addr] >> (6-xi*2)) & 3]; if(!screen().visible_area().contains(x+xi, y * height + yi)) continue; bitmapline[x+xi] = pen; @@ -681,28 +662,23 @@ void vga_device::vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) void vga_device::vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *bitmapline; int height = (vga.crtc.scan_doubling + 1); - int x,xi,y,yi; - uint32_t addr; - pen_t pen; - int width; - width = (vga.crtc.horz_disp_end + 1) * 8; + int width = (vga.crtc.horz_disp_end + 1) * 8; - for(y=0;y<LINES;y++) + for(int y=0;y<LINES;y++) { - addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/8); + uint32_t addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/8); - for(x=0;x<width;x+=8) + for(int x=0;x<width;x+=8) { - for(yi=0;yi<height;yi++) + for(int yi=0;yi<height;yi++) { - bitmapline = &bitmap.pix32(y * height + yi); + uint32_t *const bitmapline = &bitmap.pix(y * height + yi); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = vga.pens[(vga.memory[addr] >> (7-xi)) & 1]; + pen_t pen = vga.pens[(vga.memory[addr] >> (7-xi)) & 1]; if(!screen().visible_area().contains(x+xi, y * height + yi)) continue; bitmapline[x+xi] = pen; @@ -716,18 +692,12 @@ void vga_device::vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; - uint16_t mask_comp; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int yi; - int xi; - uint8_t start_shift; -// uint16_t line_length; /* line compare is screen sensitive */ - mask_comp = 0x3ff; - curr_addr = 0; + uint16_t mask_comp = 0x3ff; + int curr_addr = 0; +// uint16_t line_length; // if(vga.crtc.dw) // line_length = vga.crtc.offset << 3; // doubleword mode // else @@ -735,29 +705,27 @@ void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) // line_length = vga.crtc.offset << 4; // } - start_shift = (!(vga.sequencer.data[4] & 0x08)) ? 2 : 0; + uint8_t start_shift = (!(vga.sequencer.data[4] & 0x08)) ? 2 : 0; + for (int addr = VGA_START_ADDRESS << start_shift, line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) { - for (addr = VGA_START_ADDRESS << start_shift, line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) + for (int yi = 0;yi < height; yi++) { - for(yi = 0;yi < height; yi++) + if((line + yi) < (vga.crtc.line_compare & mask_comp)) + curr_addr = addr; + if((line + yi) == (vga.crtc.line_compare & mask_comp)) + curr_addr = 0; + uint32_t *const bitmapline = &bitmap.pix(line + yi); + addr %= vga.svga_intf.vram_size; + for (int pos=curr_addr, c=0, column=0; column<VGA_COLUMNS; column++, c+=8, pos+=0x8) { - if((line + yi) < (vga.crtc.line_compare & mask_comp)) - curr_addr = addr; - if((line + yi) == (vga.crtc.line_compare & mask_comp)) - curr_addr = 0; - bitmapline = &bitmap.pix32(line + yi); - addr %= vga.svga_intf.vram_size; - for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS; column++, c+=8, pos+=0x8) - { - if(pos + 0x08 >= vga.svga_intf.vram_size) - return; + if(pos + 0x08 >= vga.svga_intf.vram_size) + return; - for(xi=0;xi<8;xi++) - { - if(!screen().visible_area().contains(c+xi, line + yi)) - continue; - bitmapline[c+xi] = pen(vga.memory[(pos+(xi))]); - } + for (int xi=0;xi<8;xi++) + { + if(!screen().visible_area().contains(c+xi, line + yi)) + continue; + bitmapline[c+xi] = pen(vga.memory[(pos+(xi))]); } } } @@ -767,38 +735,29 @@ void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8)) - #define IV 0xff000000 + constexpr uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - - uint32_t *bitmapline; -// uint16_t mask_comp; /* line compare is screen sensitive */ -// mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) +// uint16_t mask_comp = 0xff | (TLINES & 0x300); + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) { if(pos + 0x10 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=2) + for(int xi=0,xm=0;xi<8;xi++,xm+=2) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MV(pos+xm)&0x7c00)>>10; - g = (MV(pos+xm)&0x03e0)>>5; - b = (MV(pos+xm)&0x001f)>>0; + int r = (MV(pos+xm)&0x7c00)>>10; + int g = (MV(pos+xm)&0x03e0)>>5; + int b = (MV(pos+xm)&0x001f)>>0; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); @@ -811,38 +770,29 @@ void svga_device::svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8)) - #define IV 0xff000000 + constexpr uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - - uint32_t *bitmapline; -// uint16_t mask_comp; /* line compare is screen sensitive */ -// mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) +// uint16_t mask_comp = 0xff | (TLINES & 0x300); + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) { if(pos + 0x10 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=2) + for (int xi=0,xm=0;xi<8;xi++,xm+=2) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MV(pos+xm)&0xf800)>>11; - g = (MV(pos+xm)&0x07e0)>>5; - b = (MV(pos+xm)&0x001f)>>0; + int r = (MV(pos+xm)&0xf800)>>11; + int g = (MV(pos+xm)&0x07e0)>>5; + int b = (MV(pos+xm)&0x001f)>>0; r = (r << 3) | (r & 0x7); g = (g << 2) | (g & 0x3); b = (b << 3) | (b & 0x7); @@ -855,39 +805,30 @@ void svga_device::svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16)) - #define ID 0xff000000 + constexpr uint32_t ID = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; - -// uint16_t mask_comp; /* line compare is screen sensitive */ -// mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS<<1, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) +// uint16_t mask_comp = 0xff | (TLINES & 0x300); + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS<<1, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=24) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=24) { if(pos + 24 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=3) + for (int xi=0,xm=0;xi<8;xi++,xm+=3) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MD(pos+xm)&0xff0000)>>16; - g = (MD(pos+xm)&0x00ff00)>>8; - b = (MD(pos+xm)&0x0000ff)>>0; - bitmapline[c+xi] = IV|(r<<16)|(g<<8)|(b<<0); + int r = (MD(pos+xm)&0xff0000)>>16; + int g = (MD(pos+xm)&0x00ff00)>>8; + int b = (MD(pos+xm)&0x0000ff)>>0; + bitmapline[c+xi] = ID|(r<<16)|(g<<8)|(b<<0); } } } @@ -896,39 +837,32 @@ void svga_device::svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16)) - #define ID 0xff000000 + constexpr uint32_t ID = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; // uint16_t mask_comp; /* line compare is screen sensitive */ // mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=(offset()), curr_addr+=(offset())) + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=(offset()), curr_addr+=(offset())) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x20) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x20) { if(pos + 0x20 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=4) + for (int xi=0,xm=0;xi<8;xi++,xm+=4) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MD(pos+xm)&0xff0000)>>16; - g = (MD(pos+xm)&0x00ff00)>>8; - b = (MD(pos+xm)&0x0000ff)>>0; - bitmapline[c+xi] = IV|(r<<16)|(g<<8)|(b<<0); + int r = (MD(pos+xm)&0xff0000)>>16; + int g = (MD(pos+xm)&0x00ff00)>>8; + int b = (MD(pos+xm)&0x0000ff)>>0; + bitmapline[c+xi] = ID|(r<<16)|(g<<8)|(b<<0); } } } @@ -936,13 +870,11 @@ void svga_device::svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect) uint8_t vga_device::pc_vga_choosevideomode() { - int i; - if (vga.crtc.sync_en) { if (vga.dac.dirty) { - for (i=0; i<256;i++) + for (int i=0; i<256;i++) { /* TODO: color shifters? */ set_pen_color(i, (vga.dac.color[3*(i & vga.dac.mask)] & 0x3f) << 2, @@ -954,7 +886,7 @@ uint8_t vga_device::pc_vga_choosevideomode() if (vga.attribute.data[0x10] & 0x80) { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x0f) |((vga.attribute.data[0x14]&0xf)<<4)); @@ -962,7 +894,7 @@ uint8_t vga_device::pc_vga_choosevideomode() } else { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x3f) |((vga.attribute.data[0x14]&0xc)<<4)); @@ -997,13 +929,11 @@ uint8_t vga_device::pc_vga_choosevideomode() uint8_t svga_device::pc_vga_choosevideomode() { - int i; - if (vga.crtc.sync_en) { if (vga.dac.dirty) { - for (i=0; i<256;i++) + for (int i=0; i<256;i++) { /* TODO: color shifters? */ set_pen_color(i, (vga.dac.color[3*(i & vga.dac.mask)] & 0x3f) << 2, @@ -1015,7 +945,7 @@ uint8_t svga_device::pc_vga_choosevideomode() if (vga.attribute.data[0x10] & 0x80) { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x0f) |((vga.attribute.data[0x14]&0xf)<<4)); @@ -1023,7 +953,7 @@ uint8_t svga_device::pc_vga_choosevideomode() } else { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x3f) |((vga.attribute.data[0x14]&0xc)<<4)); @@ -1132,32 +1062,26 @@ uint32_t svga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, uint32_t s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t cur_mode; - svga_device::screen_update(screen, bitmap, cliprect); - cur_mode = pc_vga_choosevideomode(); + uint8_t cur_mode = pc_vga_choosevideomode(); // draw hardware graphics cursor // TODO: support 16 bit and greater video modes if(s3.cursor_mode & 0x01) // if cursor is enabled { - uint32_t src; - uint32_t* dst; - uint8_t val; - int x,y; uint16_t cx = s3.cursor_x & 0x07ff; uint16_t cy = s3.cursor_y & 0x07ff; - uint32_t bg_col; - uint32_t fg_col; - int r,g,b; - uint32_t datax; if(cur_mode == SCREEN_OFF || cur_mode == TEXT_MODE || cur_mode == MONO_MODE || cur_mode == CGA_MODE || cur_mode == EGA_MODE) return 0; // cursor only works in VGA or SVGA modes - src = s3.cursor_start_addr * 1024; // start address is in units of 1024 bytes + uint32_t src = s3.cursor_start_addr * 1024; // start address is in units of 1024 bytes + uint32_t bg_col; + uint32_t fg_col; + int r,g,b; + uint32_t datax; switch(cur_mode) { case RGB15_MODE: @@ -1204,16 +1128,16 @@ uint32_t s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma // ,(s3.cursor_fg[0])|(s3.cursor_fg[1]<<8)|(s3.cursor_fg[2]<<16)|(s3.cursor_fg[3]<<24)); // for(x=0;x<64;x++) // printf("%08x: %02x %02x %02x %02x\n",src+x*4,vga.memory[src+x*4],vga.memory[src+x*4+1],vga.memory[src+x*4+2],vga.memory[src+x*4+3]); - for(y=0;y<64;y++) + for(int y=0;y<64;y++) { if(cy + y < cliprect.max_y && cx < cliprect.max_x) { - dst = &bitmap.pix32(cy + y, cx); - for(x=0;x<64;x++) + uint32_t *const dst = &bitmap.pix(cy + y, cx); + for(int x=0;x<64;x++) { uint16_t bita = (vga.memory[(src+1) % vga.svga_intf.vram_size] | ((vga.memory[(src+0) % vga.svga_intf.vram_size]) << 8)) >> (15-(x % 16)); uint16_t bitb = (vga.memory[(src+3) % vga.svga_intf.vram_size] | ((vga.memory[(src+2) % vga.svga_intf.vram_size]) << 8)) >> (15-(x % 16)); - val = ((bita & 0x01) << 1) | (bitb & 0x01); + uint8_t val = ((bita & 0x01) << 1) | (bitb & 0x01); if(s3.extended_dac_ctrl & 0x10) { // X11 mode switch(val) diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp index bad650cf0a6..d769ff54162 100644 --- a/src/devices/video/ppu2c0x.cpp +++ b/src/devices/video/ppu2c0x.cpp @@ -30,37 +30,6 @@ #include "screen.h" - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -/* default monochromatic colortable */ -static const pen_t default_colortable_mono[] = -{ - 0,1,2,3, - 0,1,2,3, - 0,1,2,3, - 0,1,2,3, - 0,1,2,3, - 0,1,2,3, - 0,1,2,3, - 0,1,2,3, -}; - -/* default colortable */ -static const pen_t default_colortable[] = -{ - 0,1,2,3, - 0,5,6,7, - 0,9,10,11, - 0,13,14,15, - 0,17,18,19, - 0,21,22,23, - 0,25,26,27, - 0,29,30,31, -}; - //************************************************************************** // GLOBAL VARIABLES //************************************************************************** @@ -119,7 +88,6 @@ ppu2c0x_device::ppu2c0x_device(const machine_config& mconfig, device_type type, device_t(mconfig, type, tag, owner, clock), device_memory_interface(mconfig, *this), device_video_interface(mconfig, *this), - device_palette_interface(mconfig, *this), m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, internal_map), m_cpu(*this, finder_base::DUMMY_TAG), m_scanline(0), // reset the scanline count @@ -234,7 +202,7 @@ ppu2c05_04_device::ppu2c05_04_device(const machine_config& mconfig, const char* // device_start - device-specific startup //------------------------------------------------- -void ppu2c0x_device::device_start() +void ppu2c0x_device::start_nopalram() { // bind our handler m_int_callback.resolve_safe(); @@ -252,25 +220,8 @@ void ppu2c0x_device::device_start() /* allocate a screen bitmap, videomem and spriteram, a dirtychar array and the monochromatic colortable */ m_bitmap = std::make_unique<bitmap_rgb32>(VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT); m_spriteram = make_unique_clear<uint8_t[]>(SPRITERAM_SIZE); - m_colortable = std::make_unique<pen_t[]>(ARRAY_LENGTH(default_colortable)); - m_colortable_mono = std::make_unique<pen_t[]>(ARRAY_LENGTH(default_colortable_mono)); - - m_palette_ram.resize(0x20); - - for (int i = 0; i < 0x20; i++) - m_palette_ram[i] = 0x00; - - /* initialize the color tables */ - for (int i = 0; i < ARRAY_LENGTH(default_colortable_mono); i++) - { - /* monochromatic table */ - m_colortable_mono[i] = default_colortable_mono[i]; - - /* color table */ - m_colortable[i] = default_colortable[i]; - } - init_palette(); + init_palette_tables(); // register for state saving save_item(NAME(m_scanline)); @@ -289,15 +240,25 @@ void ppu2c0x_device::device_start() save_item(NAME(m_scanlines_per_frame)); save_item(NAME(m_vblank_first_scanline)); save_item(NAME(m_regs)); - save_item(NAME(m_palette_ram)); save_item(NAME(m_draw_phase)); save_item(NAME(m_tilecount)); save_pointer(NAME(m_spriteram), SPRITERAM_SIZE); - save_pointer(NAME(m_colortable), ARRAY_LENGTH(default_colortable)); - save_pointer(NAME(m_colortable_mono), ARRAY_LENGTH(default_colortable_mono)); + save_item(NAME(*m_bitmap)); } +void ppu2c0x_device::device_start() +{ + start_nopalram(); + + m_palette_ram.resize(0x20); + + for (int i = 0; i < 0x20; i++) + m_palette_ram[i] = 0x00; + + save_item(NAME(m_palette_ram)); +} + //************************************************************************** // INLINE HELPERS //************************************************************************** @@ -332,12 +293,49 @@ inline void ppu2c0x_device::writebyte(offs_t address, uint8_t data) * *************************************/ -void ppu2c0x_device::init_palette() +void ppu2c0x_device::apply_color_emphasis_and_clamp(bool is_pal_or_dendy, int color_emphasis, double& R, double& G, double& B) { - init_palette(false); + if (is_pal_or_dendy) // PAL machines swap the colour emphasis bits, this means the red/blue highlighting on rampart tally bar doesn't look as good + { + color_emphasis = bitswap<3>(color_emphasis, 2, 0, 1); + } + + double r_mod = 0.0; + double g_mod = 0.0; + double b_mod = 0.0; + + switch (color_emphasis) + { + case 0: r_mod = 1.0; g_mod = 1.0; b_mod = 1.0; break; + case 1: r_mod = 1.24; g_mod = .915; b_mod = .743; break; + case 2: r_mod = .794; g_mod = 1.09; b_mod = .882; break; + case 3: r_mod = .905; g_mod = 1.03; b_mod = 1.28; break; + case 4: r_mod = .741; g_mod = .987; b_mod = 1.0; break; + case 5: r_mod = 1.02; g_mod = .908; b_mod = .979; break; + case 6: r_mod = 1.02; g_mod = .98; b_mod = .653; break; + case 7: r_mod = .75; g_mod = .75; b_mod = .75; break; + } + + R = R * r_mod; + G = G * g_mod; + B = B * b_mod; + + /* Clipping, in case of saturation */ + if (R < 0) + R = 0; + if (R > 255) + R = 255; + if (G < 0) + G = 0; + if (G > 255) + G = 255; + if (B < 0) + B = 0; + if (B > 255) + B = 255; } -rgb_t ppu2c0x_device::nespal_to_RGB(int color_intensity, int color_num) +rgb_t ppu2c0x_device::nespal_to_RGB(int color_intensity, int color_num, int color_emphasis, bool is_pal_or_dendy) { const double tint = 0.22; /* adjust to taste */ const double hue = 287.0; @@ -390,25 +388,15 @@ rgb_t ppu2c0x_device::nespal_to_RGB(int color_intensity, int color_num) double G = (y - (Kb * Ku * u + Kr * Kv * v) / (1 - Kb - Kr)) * 255.0; double B = (y + Ku * u) * 255.0; - /* Clipping, in case of saturation */ - if (R < 0) - R = 0; - if (R > 255) - R = 255; - if (G < 0) - G = 0; - if (G > 255) - G = 255; - if (B < 0) - B = 0; - if (B > 255) - B = 255; + apply_color_emphasis_and_clamp(is_pal_or_dendy, color_emphasis, R, G, B); return rgb_t(floor(R + .5), floor(G + .5), floor(B + .5)); } -void ppu2c0x_device::init_palette(bool indirect) +void ppu2c0x_device::init_palette_tables() { + bool is_pal = m_scanlines_per_frame != NTSC_SCANLINES_PER_FRAME; + /* This routine builds a palette using a transformation from */ /* the YUV (Y, B-Y, R-Y) to the RGB color space */ @@ -421,45 +409,23 @@ void ppu2c0x_device::init_palette(bool indirect) /* Loop through the emphasis modes (8 total) */ for (int color_emphasis = 0; color_emphasis < 8; color_emphasis++) { - /* - double r_mod = 0.0; - double g_mod = 0.0; - double b_mod = 0.0; - - switch (color_emphasis) - { - case 0: r_mod = 1.0; g_mod = 1.0; b_mod = 1.0; break; - case 1: r_mod = 1.24; g_mod = .915; b_mod = .743; break; - case 2: r_mod = .794; g_mod = 1.09; b_mod = .882; break; - case 3: r_mod = .905; g_mod = 1.03; b_mod = 1.28; break; - case 4: r_mod = .741; g_mod = .987; b_mod = 1.0; break; - case 5: r_mod = 1.02; g_mod = .908; b_mod = .979; break; - case 6: r_mod = 1.02; g_mod = .98; b_mod = .653; break; - case 7: r_mod = .75; g_mod = .75; b_mod = .75; break; - } - */ - /* loop through the 4 intensities */ for (int color_intensity = 0; color_intensity < 4; color_intensity++) { /* loop through the 16 colors */ for (int color_num = 0; color_num < 16; color_num++) { - rgb_t col = nespal_to_RGB(color_intensity, color_num); + rgb_t col = nespal_to_RGB(color_intensity, color_num, color_emphasis, is_pal); + + m_nespens[entry] = (uint32_t)col; + entry++; - /* Round, and set the value */ - if (indirect) - set_indirect_color(entry++, col); - else - set_pen_color(entry++, col); } } } - - /* color tables are modified at run-time, and are initialized on 'ppu2c0x_reset' */ } -void ppu2c0x_rgb_device::init_palette() +void ppu2c0x_rgb_device::init_palette_tables() { /* Loop through the emphasis modes (8 total) */ int entry = 0; @@ -471,27 +437,14 @@ void ppu2c0x_rgb_device::init_palette() int G = ((color_emphasis & 2) ? 7 : m_palette_data[color_num * 3 + 1]); int B = ((color_emphasis & 4) ? 7 : m_palette_data[color_num * 3 + 2]); - set_pen_color(entry++, pal3bit(R), pal3bit(G), pal3bit(B)); + m_nespens[entry] = (pal3bit(R)<<16) | (pal3bit(G)<<8) | pal3bit(B); + + //set_pen_color(entry++, pal3bit(R), pal3bit(G), pal3bit(B)); + entry++; } } - - /* color tables are modified at run-time, and are initialized on 'ppu2c0x_reset' */ } -#if 0 -/* the charlayout we use for the chargen */ -static const gfx_layout ppu_charlayout = -{ - 8, 8, /* 8*8 characters */ - 0, - 2, /* 2 bits per pixel */ - { 8*8, 0 }, /* the two bitplanes are separated */ - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 16*8 /* every char takes 16 consecutive bytes */ -}; -#endif - /************************************* * * PPU Initialization and Disposal @@ -609,24 +562,34 @@ void ppu2c0x_device::shift_tile_plane_data(uint8_t& pix) m_planebuf[1] = m_planebuf[1] << 1; } -void ppu2c0x_device::draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t*& dest, const pen_t* color_table) +void ppu2c0x_device::draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t*& dest) { - pen_t pen; + uint32_t usepen; if (pix) { - const pen_t* paldata = &color_table[4 * color]; - pen = this->pen(paldata[pix]); + uint8_t pen = ((4 * color) + pix) & 0x1f; + uint16_t palval = m_palette_ram[pen]; + + if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) + palval &= 0x30; + + // apply colour emphasis + palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 1); + + usepen = m_nespens[palval]; } else { - pen = back_pen; + usepen = m_nespens[back_pen]; } - *dest = pen; + + + *dest = usepen; } -void ppu2c0x_device::draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, pen_t back_pen, uint32_t*& dest, const pen_t* color_table) +void ppu2c0x_device::draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, uint32_t back_pen, uint32_t*& dest) { int color = (((color_byte >> color_bits) & 0x03)); @@ -640,7 +603,7 @@ void ppu2c0x_device::draw_tile(uint8_t* line_priority, int color_byte, int color if ((start_x + i) >= 0 && (start_x + i) < VISIBLE_SCREEN_WIDTH) { - draw_tile_pixel(pix, color, back_pen, dest, color_table); + draw_tile_pixel(pix, color, back_pen, dest); // priority marking if (pix) @@ -659,24 +622,6 @@ void ppu2c0x_device::draw_background(uint8_t* line_priority) { bitmap_rgb32& bitmap = *m_bitmap; - uint8_t color_mask; - const pen_t* color_table; - - /* setup the color mask and colortable to use */ - if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) - { - color_mask = 0xf0; - color_table = m_colortable_mono.get(); - } - else - { - color_mask = 0xff; - color_table = m_colortable.get(); - } - - /* cache the background pen */ - pen_t back_pen = pen(m_back_color & color_mask); - /* determine where in the nametable to start drawing from */ /* based on the current scanline and scroll regs */ uint8_t scroll_x_coarse = m_refresh_data & 0x001f; @@ -691,7 +636,7 @@ void ppu2c0x_device::draw_background(uint8_t* line_priority) /* set up dest */ int start_x = (m_x_fine ^ 0x07) - 7; - uint32_t* dest = &bitmap.pix32(m_scanline, start_x); + uint32_t* dest = &bitmap.pix(m_scanline, start_x); m_tilecount = 0; @@ -730,7 +675,7 @@ void ppu2c0x_device::draw_background(uint8_t* line_priority) // plus something that accounts for y address += scroll_y_fine; - draw_tile(line_priority, color_byte, color_bits, address, start_x, back_pen, dest, color_table); + draw_tile(line_priority, color_byte, color_bits, address, start_x, m_back_color, dest); start_x += 8; @@ -748,28 +693,32 @@ void ppu2c0x_device::draw_background(uint8_t* line_priority) /* if the left 8 pixels for the background are off, blank 'em */ if (!(m_regs[PPU_CONTROL1] & PPU_CONTROL1_BACKGROUND_L8)) { - dest = &bitmap.pix32(m_scanline); + dest = &bitmap.pix(m_scanline); for (int i = 0; i < 8; i++) { - *(dest++) = back_pen; + draw_back_pen(dest, m_back_color); + dest++; + line_priority[i] ^= 0x02; } } } +void ppu2c0x_device::draw_back_pen(uint32_t* dst, int back_pen) +{ + *dst = m_nespens[back_pen]; +} + void ppu2c0x_device::draw_background_pen() { bitmap_rgb32& bitmap = *m_bitmap; /* setup the color mask and colortable to use */ - uint8_t color_mask = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) ? 0xf0 : 0xff; - - /* cache the background pen */ - pen_t back_pen = pen(m_back_color & color_mask); + uint8_t color_mask = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) ? 0x30 : 0x3f; // Fill this scanline with the background pen. for (int i = 0; i < bitmap.width(); i++) - bitmap.pix32(m_scanline, i) = back_pen; + draw_back_pen(&bitmap.pix(m_scanline, i), m_back_color & color_mask); } void ppu2c0x_device::read_sprite_plane_data(int address) @@ -796,8 +745,16 @@ void ppu2c0x_device::make_sprite_pixel_data(uint8_t& pixel_data, int flipx) void ppu2c0x_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32& bitmap) { - const pen_t* paldata = &m_colortable[4 * color]; - bitmap.pix32(m_scanline, sprite_xpos + pixel) = pen(paldata[pixel_data]); + uint16_t palval = m_palette_ram[((4 * color) | pixel_data) & 0x1f]; + + if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) + palval &= 0x30; + + // apply colour emphasis + palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 1); + + uint32_t pix = m_nespens[palval]; + bitmap.pix(m_scanline, sprite_xpos + pixel) = pix; } void ppu2c0x_device::read_extra_sprite_bits(int sprite_index) @@ -1074,12 +1031,14 @@ void ppu2c0x_device::update_visible_enabled_scanline() void ppu2c0x_device::update_visible_disabled_scanline() { bitmap_rgb32& bitmap = *m_bitmap; - pen_t back_pen; + uint32_t back_pen; /* setup the color mask and colortable to use */ - uint8_t color_mask = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) ? 0xf0 : 0xff; + uint8_t color_mask = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) ? 0x30 : 0x3f; + + uint16_t palval = m_back_color & color_mask; - back_pen = pen(m_back_color & color_mask); + back_pen = palval; if (m_paletteram_in_ppuspace) { @@ -1092,13 +1051,13 @@ void ppu2c0x_device::update_visible_disabled_scanline() // pen. Micro Machines makes use of this feature. int pen_num = m_palette_ram[(m_videomem_addr & 0x03) ? (m_videomem_addr & 0x1f) : 0]; - back_pen = pen(pen_num); + back_pen = pen_num; } } // Fill this scanline with the background pen. for (int i = 0; i < bitmap.width(); i++) - bitmap.pix32(m_scanline, i) = back_pen; + draw_back_pen(&bitmap.pix(m_scanline, i), back_pen); } void ppu2c0x_device::update_visible_scanline() @@ -1135,29 +1094,20 @@ void ppu2c0x_device::update_scanline() void ppu2c0x_device::palette_write(offs_t offset, uint8_t data) { - int color_emphasis = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) * 2; - // palette RAM is only 6 bits wide data &= 0x3f; - // transparent pens are mirrored! if (offset & 0x3) { + // regular pens, no mirroring m_palette_ram[offset & 0x1f] = data; - m_colortable[offset & 0x1f] = data + color_emphasis; - m_colortable_mono[offset & 0x1f] = (data & 0xf0) + color_emphasis; } else { - int i; + // transparent pens are mirrored! if (0 == (offset & 0xf)) { m_back_color = data; - for (i = 0; i < 32; i += 4) - { - m_colortable[i] = data + color_emphasis; - m_colortable_mono[i] = (data & 0xf0) + color_emphasis; - } } m_palette_ram[offset & 0xf] = m_palette_ram[(offset & 0xf) + 0x10] = data; } @@ -1279,18 +1229,6 @@ void ppu2c0x_device::write(offs_t offset, uint8_t data) break; case PPU_CONTROL1: /* 1 */ - /* if color intensity has changed, change all the color tables to reflect them */ - if ((data & PPU_CONTROL1_COLOR_EMPHASIS) != (m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS)) - { - int i; - for (i = 0; i <= 0x1f; i++) - { - uint8_t oldColor = m_palette_ram[i]; - - m_colortable[i] = oldColor + (data & PPU_CONTROL1_COLOR_EMPHASIS) * 2; - } - } - //logerror("control1 write: %02x (scanline: %d)\n", data, m_scanline); m_regs[PPU_CONTROL1] = data; break; diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h index fcd53435809..9d8fa0f5351 100644 --- a/src/devices/video/ppu2c0x.h +++ b/src/devices/video/ppu2c0x.h @@ -42,8 +42,7 @@ class ppu2c0x_device : public device_t, public device_memory_interface, - public device_video_interface, - public device_palette_interface + public device_video_interface { public: typedef device_delegate<void (int scanline, int vblank, int blanked)> scanline_delegate; @@ -76,16 +75,16 @@ public: auto int_callback() { return m_int_callback.bind(); } /* routines */ - rgb_t nespal_to_RGB(int color_intensity, int color_num); - virtual void init_palette(); - void init_palette(bool indirect); - virtual uint32_t palette_entries() const override { return 4*16*8; } + void apply_color_emphasis_and_clamp(bool is_pal_or_dendy, int color_emphasis, double& R, double& G, double& B); + rgb_t nespal_to_RGB(int color_intensity, int color_num, int color_emphasis, bool is_pal_or_dendy); + virtual void init_palette_tables(); virtual void read_tile_plane_data(int address, int color); virtual void shift_tile_plane_data(uint8_t &pix); - virtual void draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t *&dest, const pen_t *color_table); - virtual void draw_tile(uint8_t *line_priority, int color_byte, int color_bits, int address, int start_x, pen_t back_pen, uint32_t *&dest, const pen_t *color_table); + virtual void draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t *&dest); + virtual void draw_tile(uint8_t *line_priority, int color_byte, int color_bits, int address, int start_x, uint32_t back_pen, uint32_t *&dest); virtual void draw_background( uint8_t *line_priority ); + virtual void draw_back_pen(uint32_t* dst, int back_pen); void draw_background_pen(); virtual void read_sprite_plane_data(int address); @@ -131,6 +130,8 @@ public: void set_vram_dest(uint16_t dest); void ppu2c0x(address_map &map); + + bool in_vblanking() { return (m_scanline >= m_vblank_first_scanline - 1); } protected: ppu2c0x_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, address_map_constructor internal_map); @@ -184,6 +185,8 @@ protected: required_device<cpu_device> m_cpu; + void start_nopalram(); + int m_scanlines_per_frame; /* number of scanlines per frame */ int m_security_value; /* 2C05 protection */ int m_vblank_first_scanline; /* the very first scanline where VBLANK occurs */ @@ -205,12 +208,12 @@ protected: int m_refresh_data; /* refresh-related */ int m_x_fine; /* refresh-related */ int m_tilecount; /* MMC5 can change attributes to subsets of the 34 visible tiles */ - std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */ - std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */ latch_delegate m_latch; uint8_t readbyte(offs_t address); + + uint32_t m_nespens[0x40*8]; private: static constexpr device_timer_id TIMER_HBLANK = 0; static constexpr device_timer_id TIMER_NMI = 1; @@ -246,7 +249,7 @@ class ppu2c0x_rgb_device : public ppu2c0x_device { protected: ppu2c0x_rgb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0); - virtual void init_palette() override; + virtual void init_palette_tables() override; private: required_region_ptr<uint8_t> m_palette_data; diff --git a/src/devices/video/ppu2c0x_sh6578.cpp b/src/devices/video/ppu2c0x_sh6578.cpp index c74fa5e54fb..a63fa2a5162 100644 --- a/src/devices/video/ppu2c0x_sh6578.cpp +++ b/src/devices/video/ppu2c0x_sh6578.cpp @@ -51,12 +51,14 @@ void ppu_sh6578_device::ppu_internal_map(address_map& map) void ppu_sh6578_device::device_start() { - ppu2c0x_device::device_start(); + start_nopalram(); m_palette_ram.resize(0x40); for (int i = 0; i < 0x40; i++) m_palette_ram[i] = 0x00; + + save_item(NAME(m_palette_ram)); } void ppu_sh6578_device::device_reset() @@ -89,7 +91,7 @@ void ppu_sh6578_device::scanline_increment_fine_ycounter() void ppu_sh6578_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32& bitmap) { uint8_t palval = m_palette_ram[(pixel_data | color << 2)] & 0x3f; - bitmap.pix32(m_scanline, sprite_xpos + pixel) = this->pen(palval); + bitmap.pix(m_scanline, sprite_xpos + pixel) = m_nespens[palval]; } void ppu_sh6578_device::read_tile_plane_data(int address, int color) @@ -97,15 +99,25 @@ void ppu_sh6578_device::read_tile_plane_data(int address, int color) m_planebuf[0] = readbyte(address); m_planebuf[1] = readbyte(address + 8); - m_extplanebuf[0] = readbyte(address + 16); - m_extplanebuf[1] = readbyte(address + 24); + if (m_colsel_pntstart & 0x80) + { + m_extplanebuf[0] = readbyte(address + 16); + m_extplanebuf[1] = readbyte(address + 24); + } } -void ppu_sh6578_device::draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, pen_t back_pen, uint32_t*& dest, const pen_t* color_table) +void ppu_sh6578_device::draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, uint32_t back_pen, uint32_t*& dest) { int color = color_byte; - color &= 0xc; + if (m_colsel_pntstart & 0x80) + { + color &= 0xc; + } + else + { + color &= 0xf; + } read_tile_plane_data(address, color); @@ -116,19 +128,29 @@ void ppu_sh6578_device::draw_tile(uint8_t* line_priority, int color_byte, int co pix = ((m_planebuf[0] & 0x80) >> 7); pix |= ((m_planebuf[1] & 0x80) >> 6); - pix |= ((m_extplanebuf[0] & 0x80) >> 5); - pix |= ((m_extplanebuf[1] & 0x80) >> 4); + + if (m_colsel_pntstart & 0x80) + { + pix |= ((m_extplanebuf[0] & 0x80) >> 5); + pix |= ((m_extplanebuf[1] & 0x80) >> 4); + } m_planebuf[0] <<= 1; m_planebuf[1] <<= 1; - m_extplanebuf[0] <<= 1; - m_extplanebuf[1] <<= 1; + + if (m_colsel_pntstart & 0x80) + { + m_extplanebuf[0] <<= 1; + m_extplanebuf[1] <<= 1; + } if ((start_x + i) >= 0 && (start_x + i) < VISIBLE_SCREEN_WIDTH) { pen_t pen; - uint8_t palval = m_palette_ram[(pix | color << 2)] & 0x3f; + uint8_t palval; + + palval = m_palette_ram[(pix | color << 2)] & 0x3f; bool trans = false; if ((palval & 0x1f) == 0x1f) @@ -136,12 +158,12 @@ void ppu_sh6578_device::draw_tile(uint8_t* line_priority, int color_byte, int co if (!trans) { - pen = this->pen(palval); + pen = m_nespens[palval]; } else { uint8_t palval = m_palette_ram[0x0] & 0x3f; - pen = this->pen(palval); + pen = m_nespens[palval]; } *dest = pen; @@ -158,23 +180,24 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) { bitmap_rgb32& bitmap = *m_bitmap; - uint8_t color_mask; - const pen_t* color_table; + uint8_t color_mask = 0xff; + //const pen_t* color_table; /* setup the color mask and colortable to use */ + + //TODO FIX if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) { color_mask = 0xf0; - color_table = m_colortable_mono.get(); } else { color_mask = 0xff; - color_table = m_colortable.get(); } + /* cache the background pen */ - pen_t back_pen = pen(m_back_color & color_mask); + pen_t back_pen = m_nespens[m_back_color & color_mask]; /* determine where in the nametable to start drawing from */ /* based on the current scanline and scroll regs */ @@ -190,7 +213,7 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) /* set up dest */ int start_x = (m_x_fine ^ 0x07) - 7; - uint32_t* dest = &bitmap.pix32(m_scanline, start_x); + uint32_t* dest = &bitmap.pix(m_scanline, start_x); m_tilecount = 0; @@ -225,7 +248,7 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) // plus something that accounts for y address += scroll_y_fine; - draw_tile(line_priority, (color_byte >> 4) & 0xf, 0, address, start_x, back_pen, dest, color_table); + draw_tile(line_priority, (color_byte >> 4) & 0xf, 0, address, start_x, back_pen, dest); start_x += 8; @@ -243,7 +266,7 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) /* if the left 8 pixels for the background are off, blank 'em */ if (!(m_regs[PPU_CONTROL1] & PPU_CONTROL1_BACKGROUND_L8)) { - dest = &bitmap.pix32(m_scanline); + dest = &bitmap.pix(m_scanline); for (int i = 0; i < 8; i++) { *(dest++) = back_pen; diff --git a/src/devices/video/ppu2c0x_sh6578.h b/src/devices/video/ppu2c0x_sh6578.h index 9671bf00dfb..34448ac9dfa 100644 --- a/src/devices/video/ppu2c0x_sh6578.h +++ b/src/devices/video/ppu2c0x_sh6578.h @@ -33,7 +33,7 @@ private: void scanline_increment_fine_ycounter() override; void read_tile_plane_data(int address, int color) override; - void draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, pen_t back_pen, uint32_t*& dest, const pen_t* color_table) override; + void draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, uint32_t back_pen, uint32_t*& dest) override; virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32& bitmap) override; //virtual void draw_sprites(uint8_t* line_priority) override; diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 04da1b8740b..2b8b9b6e3dd 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -47,14 +47,10 @@ ppu_vt03pal_device::ppu_vt03pal_device(const machine_config& mconfig, const char uint8_t ppu_vt03_device::palette_read(offs_t offset) { - if (m_201x_regs[0] & 0x80) - { - return m_newpal[offset]; - } - else - { + if (offset < 0x20) return ppu2c0x_device::palette_read(offset); - } + else + return m_palette_ram[offset]; } void ppu_vt03_device::set_201x_descramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5) @@ -67,110 +63,17 @@ void ppu_vt03_device::set_201x_descramble(uint8_t reg0, uint8_t reg1, uint8_t re m_2012_2017_descramble[5] = reg5; } -void ppu_vt03_device::set_new_pen(int i) -{ - if ((i < 0x20) && ((i & 0x3) == 0)) - { - set_pen_color(i & 0x7f, rgb_t(0, 0, 0)); - } - else - { - if (m_pal_mode == PAL_MODE_NEW_RGB) - { - uint16_t rgbval = (m_newpal[i & 0x7f] & 0xff) | ((m_newpal[(i & 0x7f) + 0x80] & 0xff) << 8); - uint8_t blue = (rgbval & 0x001f) << 3; - uint8_t green = (rgbval & 0x3e0) >> 2; - uint8_t red = (rgbval & 0x7C00) >> 7; - set_pen_color(i & 0x7f, rgb_t(red, green, blue)); - } - else if (m_pal_mode == PAL_MODE_NEW_RGB12) - { - uint16_t rgbval = (m_newpal[i & 0x7f] & 0x3f) | ((m_newpal[(i & 0x7f) + 0x80] & 0x3f) << 6); - uint8_t red = (rgbval & 0x000f) << 4; - uint8_t green = (rgbval & 0x0f0); - uint8_t blue = (rgbval & 0xf00) >> 4; - set_pen_color(i & 0x7f, rgb_t(red, green, blue)); - } - else - { - // Credit to NewRisingSun - uint16_t palval = (m_newpal[i & 0x7f] & 0x3f) | ((m_newpal[(i & 0x7f) + 0x80] & 0x3f) << 6); - int nPhase = (palval >> 0) & 0xF; - int nLuma = (palval >> 4) & 0xF; - int nChroma = (palval >> 8) & 0xF; - float phaseOffset = -11.0; - //bool inverted = false; - if ((nLuma < (nChroma + 1) >> 1 || nLuma > 15 - (nChroma >> 1)) && (m_pal_mode != PAL_MODE_NEW_VG)) - { - //inverted = true; - // Strange color number wrap-around. Is this for protection reasons, or a bug of the original hardware? - // The VT03 data sheet advises programmers that 4 <= nLuma*2 +nChroma <= 0x1F, which does not correspond exactly to this condition. - static const unsigned char altPhases[16] = { 13, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 0, 14, 15 }; - static const float altPhaseOffset[16] = { -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, -5, -5, -5 }; // Slight tweak in phase 6 for Z-Dog - phaseOffset += altPhaseOffset[nPhase]; // These "alternative" colors seem to be slightly shifted in addition to being wrapped-around, at least in EmuVT. - nPhase = altPhases[nPhase]; - nChroma = 16 - nChroma; - nLuma = (nLuma - 8) & 0xF; - } - - float fLuma = (nLuma - 4) / 9.625; // Value determined from matching saturation =0 phases 1-12 - float fChroma = nChroma / 18.975; // Value determined from matching phases 0 and 13 across all luminance and saturation levels - float fPhase = ((nPhase - 2) * 30.0 + phaseOffset) * M_PI / 180.0; - - if (m_pal_mode == PAL_MODE_NEW_VG) - { - if (fPhase > 0 && fPhase < 13) - { - fLuma /= 1.5; - fChroma /= 2; - } - } - - float Y = fLuma; - float C = fChroma; - if (nPhase == 0 || nPhase > 12) C = 0.0;// Phases 0 and 13-15 are grays - if (nPhase == 0) Y += fChroma; // Phase 0 is the upper bound of the waveform - if (nPhase == 13) Y -= fChroma; // Phase 13 is the lower bound of the waveform - if (nPhase >= 14) Y = 0.0; // Phases 14 and 15 always black - - float V = sin(fPhase) * C * 1.05; // 1.05 needed to get closer to EmuVT palette's color levels in phases 1-12 - float U = cos(fPhase) * C * 1.05; - float R = Y + 1.1400 * V + 0.0000 * U; - float G = Y - 0.5807 * V - 0.3940 * U; - float B = Y - 0.0000 * V + 2.0290 * U; - if (R < 0.0) R = 0.0; - if (R > 1.0) R = 1.0; - if (G < 0.0) G = 0.0; - if (G > 1.0) G = 1.0; - if (B < 0.0) B = 0.0; - if (B > 1.0) B = 1.0; - int RV = R * 255.0; - int GV = G * 255.0; - int BV = B * 255.0; - - set_pen_color(i & 0x7f, rgb_t(RV, GV, BV)); - } - } -} - void ppu_vt03_device::palette_write(offs_t offset, uint8_t data) { - //logerror("pal write %d %02x\n", offset, data); - // why is the check pal_mask = (m_pal_mode == PAL_MODE_NEW_VG) ? 0x08 : 0x80 in set_2010_reg and 0x04 : 0x80 here? - uint8_t pal_mask = (m_pal_mode == PAL_MODE_NEW_VG) ? 0x04 : 0x80; - - if (m_201x_regs[0] & pal_mask) + if (offset < 0x20) { - m_newpal[offset & 0xff] = data; - set_new_pen(offset); + ppu2c0x_device::palette_write(offset, data); } else { - //if(m_pal_mode == PAL_MODE_NEW_VG) // ddrdismx writes the palette before setting the register but doesn't use 'PAL_MODE_NEW_VG', Konami logo is missing if you don't allow writes to be stored for when we switch - m_newpal[offset & 0xff] = data; - ppu2c0x_device::palette_write(offset, data); + m_palette_ram[offset] = data; } } @@ -235,20 +138,131 @@ uint8_t ppu_vt03_device::read_extended(offs_t offset) } -void ppu_vt03_device::init_palette() + +void ppu_vt03_device::init_vtxx_rgb555_palette_tables() { - // todo, work out the format of the 12 palette bits instead of just calling the main init - ppu2c0x_device::init_palette(true); + int entry = 0; + for (int emp = 0; emp < 8; emp++) + { + for (int palval = 0; palval < 0x8000; palval++) + { + // uint16_t rgbval = (m_palette_ram[i & 0x7f] & 0xff) | ((m_palette_ram[(i & 0x7f) + 0x80] & 0xff) << 8); + uint8_t blue = (palval & 0x001f) << 3; + uint8_t green = (palval & 0x3e0) >> 2; + uint8_t red = (palval & 0x7C00) >> 7; + + // TODO: apply emphasis values if they work in this mode + m_vtpens_rgb555[entry] = rgb_t(red, green, blue); + entry++; + } + } +} + +void ppu_vt03_device::init_vtxx_rgb444_palette_tables() +{ + int entry = 0; + for (int emp = 0; emp < 8; emp++) + { + for (int palval = 0; palval < 0x1000; palval++) + { + //uint16_t rgbval = (m_palette_ram[i & 0x7f] & 0x3f) | ((m_palette_ram[(i & 0x7f) + 0x80] & 0x3f) << 6); + uint8_t red = (palval & 0x000f) << 4; + uint8_t green = (palval & 0x0f0); + uint8_t blue = (palval & 0xf00) >> 4; + + // TODO: apply emphasis values if they work in this mode + m_vtpens_rgb444[entry] = rgb_t(red, green, blue); + entry++; + } + } +} +// what cases are palmode 1 anyway? +void ppu_vt03_device::init_vt03_palette_tables(int palmode) +{ + // the 12-bit VT HSV format, Credit to NewRisingSun + int entry = 0; + for (int color_emphasis = 0; color_emphasis < 8; color_emphasis++) + { + for (int palval = 0; palval < 0x1000; palval++) + { + int nPhase = (palval >> 0) & 0xF; + int nLuma = (palval >> 4) & 0xF; + int nChroma = (palval >> 8) & 0xF; + float phaseOffset = -11.0; + //bool inverted = false; + if ((nLuma < (nChroma + 1) >> 1 || nLuma > 15 - (nChroma >> 1)) && (palmode != 1)) + { + //inverted = true; + // Strange color number wrap-around. Is this for protection reasons, or a bug of the original hardware? + // The VT03 data sheet advises programmers that 4 <= nLuma*2 +nChroma <= 0x1F, which does not correspond exactly to this condition. + static const unsigned char altPhases[16] = { 13, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 0, 14, 15 }; + static const float altPhaseOffset[16] = { -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, -5, -5, -5 }; // Slight tweak in phase 6 for Z-Dog + phaseOffset += altPhaseOffset[nPhase]; // These "alternative" colors seem to be slightly shifted in addition to being wrapped-around, at least in EmuVT. + nPhase = altPhases[nPhase]; + nChroma = 16 - nChroma; + nLuma = (nLuma - 8) & 0xF; + } + + float fLuma = (nLuma - 4) / 9.625; // Value determined from matching saturation =0 phases 1-12 + float fChroma = nChroma / 18.975; // Value determined from matching phases 0 and 13 across all luminance and saturation levels + float fPhase = ((nPhase - 2) * 30.0 + phaseOffset) * M_PI / 180.0; + + if (palmode == 1) + { + if (fPhase > 0 && fPhase < 13) + { + fLuma /= 1.5; + fChroma /= 2; + } + } + + float Y = fLuma; + float C = fChroma; + if (nPhase == 0 || nPhase > 12) C = 0.0;// Phases 0 and 13-15 are grays + if (nPhase == 0) Y += fChroma; // Phase 0 is the upper bound of the waveform + if (nPhase == 13) Y -= fChroma; // Phase 13 is the lower bound of the waveform + if (nPhase >= 14) Y = 0.0; // Phases 14 and 15 always black + + float V = sin(fPhase) * C * 1.05; // 1.05 needed to get closer to EmuVT palette's color levels in phases 1-12 + float U = cos(fPhase) * C * 1.05; + float R = Y + 1.1400 * V + 0.0000 * U; + float G = Y - 0.5807 * V - 0.3940 * U; + float B = Y - 0.0000 * V + 2.0290 * U; + if (R < 0.0) R = 0.0; + if (R > 1.0) R = 1.0; + if (G < 0.0) G = 0.0; + if (G > 1.0) G = 1.0; + if (B < 0.0) B = 0.0; + if (B > 1.0) B = 1.0; + int RV = R * 255.0; + int GV = G * 255.0; + int BV = B * 255.0; + + // does this really apply to the VT palette? + //bool is_pal = m_scanlines_per_frame != NTSC_SCANLINES_PER_FRAME; + //apply_color_emphasis_and_clamp(is_pal, color_emphasis, R, G, B); + + m_vtpens[entry] = rgb_t(RV, GV, BV); + entry++; + } + } } void ppu_vt03_device::device_start() { - ppu2c0x_device::device_start(); + start_nopalram(); + + m_palette_ram.resize(0x100); - m_newpal = std::make_unique<uint8_t[]>(0x100); - save_pointer(NAME(m_newpal), 0x100); + for (int i = 0; i < 0x100; i++) + m_palette_ram[i] = 0x00; + save_item(NAME(m_palette_ram)); save_item(NAME(m_201x_regs)); + + init_vt03_palette_tables(0); + init_vtxx_rgb555_palette_tables(); + init_vtxx_rgb444_palette_tables(); } uint8_t ppu_vt03_device::get_201x_reg(int reg) @@ -270,16 +284,12 @@ void ppu_vt03_device::device_reset() m_read_bg.resolve_safe(0); m_read_sp.resolve_safe(0); for (int i = 0; i < 0xff; i++) - m_newpal[i] = 0x0; + m_palette_ram[i] = 0x0; // todo: what are the actual defaults for these? for (int i = 0; i < 0x20; i++) set_201x_reg(i, 0x00); - //m_201x_regs[0] = 0x86; // alt fix for ddrdismx would be to set the default palette mode here - - init_palette(); - m_read_bg4_bg3 = 0; m_va34 = 0; } @@ -353,7 +363,8 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u { if (!is16pix) { - bitmap.pix32(m_scanline, sprite_xpos + pixel) = pen(pixel_data + (4 * color)); + uint8_t pen = pixel_data + (4 * color); + draw_tile_pixel_inner(pen, &bitmap.pix(m_scanline, sprite_xpos + pixel)); } else { @@ -361,9 +372,16 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u we probably need to split them out again and draw them at xpos+8 with a cliprect - not seen used yet */ if ((pixel_data & 0x03) != 0) - bitmap.pix32(m_scanline, sprite_xpos + pixel) = pen((pixel_data & 0x03) + (4 * color)); + { + uint8_t pen = (pixel_data & 0x03) + (4 * color); + draw_tile_pixel_inner(pen, &bitmap.pix(m_scanline, sprite_xpos + pixel)); + } + if (((pixel_data >> 5) & 0x03) != 0) - bitmap.pix32(m_scanline, sprite_xpos + pixel + 8) = pen(((pixel_data >> 5) & 0x03) + (4 * color)); + { + uint8_t pen = ((pixel_data >> 5) & 0x03) + (4 * color); + draw_tile_pixel_inner(pen, &bitmap.pix(m_scanline, sprite_xpos + pixel + 8)); + } //ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel, pixel_data & 0x03, bitmap); //ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel + 8, (pixel_data >> 5) & 0x03, bitmap); } @@ -414,13 +432,100 @@ void ppu_vt03_device::shift_tile_plane_data(uint8_t& pix) } } -void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t*& dest, const pen_t* color_table) + +void ppu_vt03_device::draw_back_pen(uint32_t* dst, int back_pen) +{ + if (m_201x_regs[0] & 0x80) + { + // is the back_pen always just pen 0 in VT modes? (using last data written to a transparent pen as per NES logic doesn't work as writes are split across 2 bytes) + draw_tile_pixel_inner(0, dst); + } + else + { + // in normal modes we still have the data from the palette writes as the 'backpen' so treat it as before + uint32_t pix; + pix = m_nespens[back_pen & 0x1ff]; + *dst = pix; + } +} + + +void ppu_vt03_device::draw_tile_pixel_inner(uint8_t pen, uint32_t *dest) +{ + if (m_201x_regs[0] & 0x80) + { + if (m_pal_mode == PAL_MODE_NEW_RGB) // unknown newer VT mode + { + uint32_t palval; + palval = (m_palette_ram[pen & 0x7f] & 0xff) | ((m_palette_ram[(pen & 0x7f) + 0x80] & 0x7f) << 8); + + // does grayscale mode exist here? (we haven't calculated any colours for it) + //if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) + // palval &= 0x30; + + // apply colour emphasis (does it really exist here?) (we haven't calculated any colours for it, so ths has no effect) + palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 10); + + uint32_t pix; + pix = m_vtpens_rgb555[palval & 0x3ffff]; + *dest = pix; + } + else if (m_pal_mode == PAL_MODE_NEW_RGB12) // unknown newer VT mode + { + uint32_t palval; + palval = (m_palette_ram[pen & 0x7f] & 0x3f) | ((m_palette_ram[(pen & 0x7f) + 0x80] & 0x3f) << 6); + + // does grayscale mode exist here? (we haven't calculated any colours for it) + //if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) + // palval &= 0x30; + + // apply colour emphasis (does it really exist here?) (we haven't calculated any colours for it, so ths has no effect) + palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 7); + + uint32_t pix; + pix = m_vtpens_rgb444[palval & 0x7fff]; + *dest = pix; + } + else // VT03 mode + { + uint32_t palval; + palval = (m_palette_ram[pen & 0x7f] & 0x3f) | ((m_palette_ram[(pen & 0x7f) + 0x80] & 0x3f) << 6); + + // does grayscale mode exist here? (we haven't calculated any colours for it) + //if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) + // palval &= 0x30; + + // apply colour emphasis (does it really exist here?) (we calculate values for it when building the palette lookup) + palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 7); + + uint32_t pix; + pix = m_vtpens[palval & 0x7fff]; + *dest = pix; + } + } + else // old colour compatible mode + { + uint16_t palval; + palval = (m_palette_ram[pen & 0x7f] & 0x3f); + + if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) + palval &= 0x30; + + // apply colour emphasis + palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 1); + + uint32_t pix; + pix = m_nespens[palval & 0x1ff]; + *dest = pix; + } +} +void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t*& dest) { int is4bpp = get_201x_reg(0x0) & 0x02; if (!is4bpp) { - ppu2c0x_device::draw_tile_pixel(pix, color, back_pen, dest, color_table); + ppu2c0x_device::draw_tile_pixel(pix, color, back_pen, dest); } else { @@ -442,9 +547,10 @@ void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, ui } else { - pen = 0; // fixme backpen logic probably differs on vt03 due to extra colours + pen = 0; // back_pen; // fixme backpen logic probably differs on vt03 due to extra colours } - *dest = this->pen(pen); + + draw_tile_pixel_inner(pen, dest); } } @@ -468,24 +574,6 @@ void ppu_vt03_device::set_2010_reg(uint8_t data) 2 : SP16EN 1 : BK16EN 0 : PIX16EN */ - uint8_t pal_mask = (m_pal_mode == PAL_MODE_NEW_VG) ? 0x08 : 0x80; - if ((m_201x_regs[0x0] & pal_mask) != (data & pal_mask)) - { - if (data & pal_mask) - { - for (int i = 0; i < 256; i++) - { - set_new_pen(i); - } - } - else - { - for (int i = 0; i < 256; i++) - { - set_pen_indirect(i, i); - } - } - } m_201x_regs[0x0] = data; } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index c238f91b031..f63da1ebdf1 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -19,7 +19,6 @@ enum vtxx_pal_mode { PAL_MODE_VT0x, PAL_MODE_NEW_RGB, - PAL_MODE_NEW_VG, PAL_MODE_NEW_RGB12, }; @@ -40,13 +39,15 @@ public: virtual uint8_t palette_read(offs_t offset) override; virtual void palette_write(offs_t offset, uint8_t data) override; - virtual uint32_t palette_entries() const override { return 256; } - virtual uint32_t palette_indirect_entries() const override { return 4*16*8; } - virtual void init_palette() override; + void init_vt03_palette_tables(int palmode); + void init_vtxx_rgb555_palette_tables(); + void init_vtxx_rgb444_palette_tables(); virtual void read_tile_plane_data(int address, int color) override; virtual void shift_tile_plane_data(uint8_t &pix) override; - virtual void draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t *&dest, const pen_t *color_table) override; + virtual void draw_tile_pixel(uint8_t pix, int color, uint32_t back_pen, uint32_t *&dest) override; + inline void draw_tile_pixel_inner(uint8_t pen, uint32_t *dest); + virtual void draw_back_pen(uint32_t* dst, int back_pen) override; virtual void read_sprite_plane_data(int address) override; virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx) override; @@ -70,12 +71,14 @@ protected: bool m_is_pal; bool m_is_50hz; + uint32_t m_vtpens[0x1000*8]; + uint32_t m_vtpens_rgb555[0x8000*8]; + uint32_t m_vtpens_rgb444[0x1000*8]; + private: devcb_read8 m_read_bg; devcb_read8 m_read_sp; - std::unique_ptr<uint8_t[]> m_newpal; - int m_read_bg4_bg3; int m_va34; @@ -89,8 +92,6 @@ private: vtxx_pal_mode m_pal_mode = PAL_MODE_VT0x; void set_2010_reg(uint8_t data); - - void set_new_pen(int i); }; class ppu_vt03pal_device : public ppu_vt03_device { diff --git a/src/devices/video/psx.cpp b/src/devices/video/psx.cpp index 83cd0e5c02d..b73adb2a319 100644 --- a/src/devices/video/psx.cpp +++ b/src/devices/video/psx.cpp @@ -265,8 +265,8 @@ void psxgpu_device::DebugMesh( int n_coordx, int n_coordy ) (int16_t)n_x.w.h <= width - 1 && (int16_t)n_y.w.h <= height - 1 ) { - if( m_debug.mesh->pix16( n_y.w.h, n_x.w.h ) != 0xffff ) - m_debug.mesh->pix16( n_y.w.h, n_x.w.h ) = n_colour; + if( m_debug.mesh->pix( n_y.w.h, n_x.w.h ) != 0xffff ) + m_debug.mesh->pix( n_y.w.h, n_x.w.h ) = n_colour; } n_x.d += n_dx; @@ -364,7 +364,7 @@ int psxgpu_device::DebugMeshDisplay( bitmap_rgb32 &bitmap, const rectangle &clip if( m_debug.b_mesh ) { for( int y = cliprect.min_y; y <= cliprect.max_y; y++ ) - draw_scanline16( bitmap, cliprect.min_x, y, cliprect.max_x + 1 - cliprect.min_x, &m_debug.mesh->pix16( y ), pens() ); + draw_scanline16( bitmap, cliprect.min_x, y, cliprect.max_x + 1 - cliprect.min_x, &m_debug.mesh->pix( y ), pens() ); } m_debug.b_clear = 1; @@ -772,7 +772,7 @@ uint32_t psxgpu_device::update_screen(screen_device &screen, bitmap_rgb32 &bitma while( n_line > 0 ) { uint16_t *p_n_src = p_p_vram[ n_y + n_displaystarty ] + 3 * n_x + n_displaystartx; - uint32_t *p_n_dest = &bitmap.pix32(n_y + n_top, n_x + n_left); + uint32_t *p_n_dest = &bitmap.pix(n_y + n_top, n_x + n_left); n_column = n_columns; while( n_column > 0 ) diff --git a/src/devices/video/saa5050.cpp b/src/devices/video/saa5050.cpp index 77af6be01ea..b873edfbbb9 100644 --- a/src/devices/video/saa5050.cpp +++ b/src/devices/video/saa5050.cpp @@ -661,9 +661,7 @@ uint32_t saa5050_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm int g = BIT(color, 1) * 0xff; int b = BIT(color, 2) * 0xff; - rgb_t rgb = rgb_t(r, g, b); - - bitmap.pix32(y, x++) = rgb; + bitmap.pix(y, x++) = rgb_t(r, g, b); } } } diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp index 17fc68c6b9a..96e1e7d3ca5 100644 --- a/src/devices/video/scn2674.cpp +++ b/src/devices/video/scn2674.cpp @@ -1178,7 +1178,7 @@ TIMER_CALLBACK_MEMBER(scn2674_device::scanline_timer) } if (!m_display_enabled) - std::fill_n(&m_bitmap.pix32(m_linecounter), m_character_per_row * m_hpixels_per_column, rgb_t::black()); + std::fill_n(&m_bitmap.pix(m_linecounter), m_character_per_row * m_hpixels_per_column, rgb_t::black()); if (m_gfx_enabled || (charrow == (m_scanline_per_char_row - 1))) m_address = address; diff --git a/src/devices/video/sed1330.cpp b/src/devices/video/sed1330.cpp index 101ebe72944..37d95caac7b 100644 --- a/src/devices/video/sed1330.cpp +++ b/src/devices/video/sed1330.cpp @@ -605,7 +605,7 @@ void sed1330_device::data_w(uint8_t data) void sed1330_device::draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int r, uint16_t va, bool cursor) { - uint16_t *p = &bitmap.pix16(y, 0); + uint16_t *p = &bitmap.pix(y); for (int sx = 0; sx < m_cr; sx++, p += m_fx) { @@ -653,7 +653,7 @@ void sed1330_device::draw_graphics_scanline(bitmap_ind16 &bitmap, const rectangl for (int x = 0; x < m_fx; x++) { - bitmap.pix16(y, (sx * m_fx) + x) = BIT(data, 7); + bitmap.pix(y, (sx * m_fx) + x) = BIT(data, 7); data <<= 1; } } diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp index a74f7af905d..e0b4eb544b1 100644 --- a/src/devices/video/snes_ppu.cpp +++ b/src/devices/video/snes_ppu.cpp @@ -1251,7 +1251,7 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) if (m_screen_disabled) /* screen is forced blank */ for (int x = 0; x < SNES_SCR_WIDTH * 2; x++) - bitmap.pix32(0, x) = rgb_t::black(); + bitmap.pix(0, x) = rgb_t::black(); else { uint8_t window_above[256]; @@ -1323,8 +1323,8 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int g = (c & 0x3e0) >> 5; const int b = (c & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 0) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); - bitmap.pix32(0, x * 2 + 1) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(0, x * 2 + 0) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(0, x * 2 + 1) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); } else if (!blurring) { @@ -1337,8 +1337,8 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int b0 = (c0 & 0x7c00) >> 10; const int b1 = (c1 & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); - bitmap.pix32(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); + bitmap.pix(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); + bitmap.pix(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); } else { @@ -1348,7 +1348,7 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int r0 = (c0 & 0x1f); const int g0 = (c0 & 0x3e0) >> 5; const int b0 = (c0 & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); + bitmap.pix(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); prev = curr; curr = luma[pixel(x, above, below, window_above, window_below)]; @@ -1357,7 +1357,7 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int r1 = (c1 & 0x1f); const int g1 = (c1 & 0x3e0) >> 5; const int b1 = (c1 & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); + bitmap.pix(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); prev = curr; } diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp index 473fa710f7d..f79f0aec207 100644 --- a/src/devices/video/stvvdp2.cpp +++ b/src/devices/video/stvvdp2.cpp @@ -2530,11 +2530,11 @@ void saturn_state::stv_vdp2_drawgfxzoom( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = source_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); + uint8_t const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { if(stv_vdp2_window_process(x,y)) { @@ -2552,11 +2552,11 @@ void saturn_state::stv_vdp2_drawgfxzoom( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = source_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); + uint8_t const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { if(stv_vdp2_window_process(x,y)) { @@ -2574,11 +2574,11 @@ void saturn_state::stv_vdp2_drawgfxzoom( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = source_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); + uint8_t const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { if(stv_vdp2_window_process(x,y)) { @@ -2716,17 +2716,16 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - int r,g,b,data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2743,17 +2742,16 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - int r,g,b,data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - data = (source[(x_index*2+0)>>16]<<0)|(source[(x_index*2+1)>>16]<<8); - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int data = (source[(x_index*2+0)>>16]<<0)|(source[(x_index*2+1)>>16]<<8); + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2770,17 +2768,16 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - int r,g,b,data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2877,21 +2874,18 @@ void saturn_state::stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectan for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - uint16_t data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - int r,g,b; - - data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; + uint16_t data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; if ((data & 0x8000) || (transparency & STV_TRANSPARENCY_NONE)) { - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2986,26 +2980,21 @@ void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectan if( ex>sx ) { /* skip if inner loop doesn't draw anything */ - int y; - - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*32; - uint32_t *dest = &dest_bmp.pix32(y); - uint32_t data; + uint8_t const *const source = gfxdata + (y_index>>16)*32; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; + int x_index = x_index_base; - for( x=sx; x<ex; x++ ) + for( int x=sx; x<ex; x++ ) { - int r,g,b; - - data = (source[(x_index>>16)*4+0] << 24) | (source[(x_index>>16)*4+1] << 16) | (source[(x_index>>16)*4+2] << 8) | (source[(x_index>>16)*4+3] << 0); + uint32_t data = (source[(x_index>>16)*4+0] << 24) | (source[(x_index>>16)*4+1] << 16) | (source[(x_index>>16)*4+2] << 8) | (source[(x_index>>16)*4+3] << 0); if ((data & 0x80000000) || (transparency & STV_TRANSPARENCY_NONE)) { - b = (data & 0xff0000) >> 16; - g = (data & 0x00ff00) >> 8; - r = (data & 0x0000ff); + int b = (data & 0xff0000) >> 16; + int g = (data & 0x00ff00) >> 8; + int r = (data & 0x0000ff); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -3078,27 +3067,23 @@ void saturn_state::stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle /* skip if inner loop doesn't draw anything */ if (ex > sx) { - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + uint8_t const *const source = source_base + y_index*gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const uint8_t *source = source_base + y_index*gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + if(stv_vdp2_window_process(x,y)) { - if(stv_vdp2_window_process(x,y)) - { - int c = (source[x_index]); - if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) - dest[x] = alpha_blend_r32( dest[x], pal[c], alpha ); - } - - x_index += xinc; + int c = (source[x_index]); + if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) + dest[x] = alpha_blend_r32( dest[x], pal[c], alpha ); } - y_index += yinc; + + x_index += xinc; } + y_index += yinc; } } } @@ -3155,27 +3140,23 @@ void saturn_state::stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectan /* skip if inner loop doesn't draw anything */ if (ex > sx) { - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + uint8_t const *const source = source_base + y_index*gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const uint8_t *source = source_base + y_index*gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + if(stv_vdp2_window_process(x,y)) { - if(stv_vdp2_window_process(x,y)) - { - int c = (source[x_index]); - if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) - dest[x] = pal[c]; - } - - x_index += xinc; + int c = (source[x_index]); + if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) + dest[x] = pal[c]; } - y_index += yinc; + + x_index += xinc; } + y_index += yinc; } } } @@ -3227,9 +3208,9 @@ void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr dot_data += pal_bank; if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data); + bitmap.pix(ydst, xdst) = m_palette->pen(dot_data); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); + bitmap.pix(ydst, xdst) = alpha_blend_r32(bitmap.pix(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); } } } @@ -3287,9 +3268,9 @@ void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr dot_data += pal_bank; if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data); + bitmap.pix(ydst, xdst) = m_palette->pen(dot_data); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); + bitmap.pix(ydst, xdst) = alpha_blend_r32(bitmap.pix(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); } } } @@ -3344,9 +3325,9 @@ void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip dot_data += pal_bank; if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data); + bitmap.pix(ydst, xdst) = m_palette->pen(dot_data); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); + bitmap.pix(ydst, xdst) = alpha_blend_r32(bitmap.pix(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); } } } @@ -3403,9 +3384,9 @@ void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = rgb_t(r, g, b); + bitmap.pix(ydst, xdst) = rgb_t(r, g, b); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32( bitmap.pix32(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); + bitmap.pix(ydst, xdst) = alpha_blend_r32( bitmap.pix(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); } } } @@ -3461,9 +3442,9 @@ void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = rgb_t(r, g, b); + bitmap.pix(ydst, xdst) = rgb_t(r, g, b); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32( bitmap.pix32(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); + bitmap.pix(ydst, xdst) = alpha_blend_r32( bitmap.pix(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); } } } @@ -4354,9 +4335,9 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli uint16_t pen; pen = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; - pix = bitmap.pix32(y, x); + pix = bitmap.pix(y, x); - bitmap.pix32(y, x) = add_blend_r32(m_palette->pen(pen & 0x7ff),pix); + bitmap.pix(y, x) = add_blend_r32(m_palette->pen(pen & 0x7ff),pix); } } } @@ -4364,12 +4345,8 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t is_roz) { - int x,y,xi,yi; - uint8_t h_size,v_size; - uint32_t pix; - - h_size = STV_VDP2_MZSZH+1; - v_size = STV_VDP2_MZSZV+1; + uint8_t h_size = STV_VDP2_MZSZH+1; + uint8_t v_size = STV_VDP2_MZSZV+1; if(is_roz) v_size = 1; @@ -4380,15 +4357,15 @@ void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &c if(STV_VDP2_LSMD == 3) v_size <<= 1; - for(y=cliprect.top();y<=cliprect.bottom();y+=v_size) + for(int y=cliprect.top();y<=cliprect.bottom();y+=v_size) { - for(x=cliprect.left();x<=cliprect.right();x+=h_size) + for(int x=cliprect.left();x<=cliprect.right();x+=h_size) { - pix = bitmap.pix32(y, x); + uint32_t pix = bitmap.pix(y, x); - for(yi=0;yi<v_size;yi++) - for(xi=0;xi<h_size;xi++) - bitmap.pix32(y+yi, x+xi) = pix; + for(int yi=0;yi<v_size;yi++) + for(int xi=0;xi<h_size;xi++) + bitmap.pix(y+yi, x+xi) = pix; } } } @@ -4726,7 +4703,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, //dx = (RP.A * RP.dx) + (RP.B * RP.dy); //dy = (RP.D * RP.dx) + (RP.E * RP.dy); - line = &bitmap.pix32(vcnt); + line = &bitmap.pix(vcnt); // TODO: nuke this spaghetti code if ( !use_coeff_table || RP.dkax == 0 ) @@ -4814,7 +4791,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, continue; } - pix = roz_bitmap.pix32(y & planerenderedsizey, x & planerenderedsizex); + pix = roz_bitmap.pix(y & planerenderedsizey, x & planerenderedsizex); if (stv2_current_tilemap.transparency & STV_TRANSPARENCY_ALPHA) { if ((stv2_current_tilemap.transparency & STV_TRANSPARENCY_NONE) || (pix & 0xffffff)) @@ -4918,7 +4895,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if ( x & clipxmask || y & clipymask ) continue; - pix = roz_bitmap.pix32(y & planerenderedsizey, x & planerenderedsizex); + pix = roz_bitmap.pix(y & planerenderedsizey, x & planerenderedsizex); if (stv2_current_tilemap.transparency & STV_TRANSPARENCY_ALPHA) { if ((stv2_current_tilemap.transparency & STV_TRANSPARENCY_NONE) || (pix & 0xffffff)) @@ -5753,12 +5730,9 @@ void saturn_state::stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cli void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t* gfxdata = m_vdp2.gfx_decode.get(); - uint32_t base_offs,base_mask; - uint8_t interlace; + uint8_t const *const gfxdata = m_vdp2.gfx_decode.get(); - interlace = (STV_VDP2_LSMD == 3)+1; + uint8_t interlace = (STV_VDP2_LSMD == 3)+1; // popmessage("Back screen %08x %08x %08x",STV_VDP2_BDCLMD,STV_VDP2_BKCLMD,STV_VDP2_BKTA); @@ -5767,27 +5741,24 @@ void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cli bitmap.fill(m_palette->black_pen(), cliprect); else { - base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; + uint32_t base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; - for(y=cliprect.top();y<=cliprect.bottom();y++) + for(int y=cliprect.top();y<=cliprect.bottom();y++) { - base_offs = ((STV_VDP2_BKTA ) & base_mask) << 1; + uint32_t base_offs = ((STV_VDP2_BKTA ) & base_mask) << 1; if(STV_VDP2_BKCLMD) base_offs += ((y / interlace) << 1); - for(x=cliprect.left();x<=cliprect.right();x++) + for(int x=cliprect.left();x<=cliprect.right();x++) { - int r,g,b; - uint16_t dot; - - dot = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; - b = pal5bit((dot & 0x7c00) >> 10); - g = pal5bit((dot & 0x03e0) >> 5); - r = pal5bit( dot & 0x001f); + uint16_t dot = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; + int b = pal5bit((dot & 0x7c00) >> 10); + int g = pal5bit((dot & 0x03e0) >> 5); + int r = pal5bit( dot & 0x001f); if(STV_VDP2_BKCOEN) stv_vdp2_compute_color_offset( &r, &g, &b, STV_VDP2_BKCOSL ); - bitmap.pix32(y, x) = rgb_t(r, g, b); + bitmap.pix(y, x) = rgb_t(r, g, b); } } } @@ -6737,7 +6708,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, continue; framebuffer_line = m_vdp1.framebuffer_display_lines[y]; - bitmap_line = &bitmap.pix32(y); + bitmap_line = &bitmap.pix(y); for ( x = cliprect.left(); x <= cliprect.right(); x++ ) { @@ -6830,7 +6801,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, continue; framebuffer_line = m_vdp1.framebuffer_display_lines[y]; - bitmap_line = &bitmap.pix32(y); + bitmap_line = &bitmap.pix(y); for ( x = cliprect.left(); x <= cliprect.right(); x++ ) { @@ -6941,12 +6912,12 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, framebuffer_line = m_vdp1.framebuffer_display_lines[y]; if ( interlace_framebuffer == 0 ) { - bitmap_line = &bitmap.pix32(y); + bitmap_line = &bitmap.pix(y); } else { - bitmap_line = &bitmap.pix32(2*y); - bitmap_line2 = &bitmap.pix32(2*y + 1); + bitmap_line = &bitmap.pix(2*y); + bitmap_line2 = &bitmap.pix(2*y + 1); } for ( x = cliprect.left(); x <= cliprect.right() /(double_x+1) ; x++ ) diff --git a/src/devices/video/t6963c.cpp b/src/devices/video/t6963c.cpp index 96995f62c68..215911ed3ff 100644 --- a/src/devices/video/t6963c.cpp +++ b/src/devices/video/t6963c.cpp @@ -346,7 +346,7 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma data = m_display_ram->read_byte(m_cgram_offset + c * 8 + cy); for(int cx=0; cx<m_font_size; cx++) - bitmap.pix16(y * 8 + cy, x * m_font_size + cx) = BIT(data, m_font_size - 1 - cx); + bitmap.pix(y * 8 + cy, x * m_font_size + cx) = BIT(data, m_font_size - 1 - cx); } } @@ -362,13 +362,13 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma switch(m_mode & 7) { case 0: // OR - bitmap.pix16(y, x * m_font_size + i) |= pix; + bitmap.pix(y, x * m_font_size + i) |= pix; break; case 1: // EXOR - bitmap.pix16(y, x * m_font_size + i) ^= pix; + bitmap.pix(y, x * m_font_size + i) ^= pix; break; case 3: // AND - bitmap.pix16(y, x * m_font_size + i) &= pix; + bitmap.pix(y, x * m_font_size + i) &= pix; break; case 4: // Text attribute logerror("%s: Unimplemented Text attribute\n", machine().describe_context()); diff --git a/src/devices/video/t6963c.h b/src/devices/video/t6963c.h index 33b748e38c3..aaaeb7c3e57 100644 --- a/src/devices/video/t6963c.h +++ b/src/devices/video/t6963c.h @@ -45,7 +45,7 @@ public: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - static constexpr feature_type unemulated_features() { return feature::GRAPHICS; } + static constexpr feature_type imperfect_features() { return feature::GRAPHICS; } protected: // device-specific overrides diff --git a/src/devices/video/t6a04.cpp b/src/devices/video/t6a04.cpp index 8b55f8ce153..a5dc8bfa928 100644 --- a/src/devices/video/t6a04.cpp +++ b/src/devices/video/t6a04.cpp @@ -110,7 +110,7 @@ uint32_t t6a04_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int b=7; b>=0; b--) { - bitmap.pix16(x&0x3f, y*8+b) = data & 1; + bitmap.pix(x&0x3f, y*8+b) = data & 1; data>>=1; } } diff --git a/src/devices/video/tms3556.cpp b/src/devices/video/tms3556.cpp index dbd45105a97..3088e02e685 100644 --- a/src/devices/video/tms3556.cpp +++ b/src/devices/video/tms3556.cpp @@ -573,12 +573,12 @@ void tms3556_device::draw_line(bitmap_ind16 &bmp, int line) // if (m_control_regs[4] & 0x??) // { // interlaced mode -// ln = &bmp->pix16(line, m_field); +// ln = &bmp->pix(line, m_field); // } // else { /* non-interlaced mode */ - ln = &bmp.pix16(line); - ln2 = &bmp.pix16(line, 1); + ln = &bmp.pix(line); + ln2 = &bmp.pix(line, 1); double_lines = 1; } diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp index 129b364e860..27395fecacb 100644 --- a/src/devices/video/tms9928a.cpp +++ b/src/devices/video/tms9928a.cpp @@ -365,7 +365,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par int raw_vpos = screen().vpos(); int vpos = raw_vpos * m_vertical_size / screen().height(); uint16_t BackColour = m_Regs[7] & 15; - uint32_t *p = &m_tmpbmp.pix32(vpos); + uint32_t *p = &m_tmpbmp.pix(vpos); int y = vpos - m_top_border; diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp index 0876a3b9923..e82858056e7 100644 --- a/src/devices/video/v9938.cpp +++ b/src/devices/video/v9938.cpp @@ -1863,12 +1863,12 @@ void v99x8_device::refresh_32(int line) if (m_cont_reg[9] & 0x08) { - ln = &m_bitmap.pix32(m_scanline*2+((m_stat_reg[2]>>1)&1)); + ln = &m_bitmap.pix(m_scanline*2+((m_stat_reg[2]>>1)&1)); } else { - ln = &m_bitmap.pix32(m_scanline*2); - ln2 = &m_bitmap.pix32(m_scanline*2+1); + ln = &m_bitmap.pix(m_scanline*2); + ln2 = &m_bitmap.pix(m_scanline*2+1); double_lines = true; } diff --git a/src/devices/video/vector.cpp b/src/devices/video/vector.cpp index 28b507323d5..46a21b535be 100644 --- a/src/devices/video/vector.cpp +++ b/src/devices/video/vector.cpp @@ -42,10 +42,11 @@ **************************************************************************** */ #include "emu.h" -#include "emuopts.h" -#include "rendutil.h" #include "vector.h" +#include "emuopts.h" +#include "render.h" + #define VECTOR_WIDTH_DENOM 512 @@ -85,7 +86,7 @@ void vector_device::device_start() m_vector_index = 0; /* allocate memory for tables */ - m_vector_list = make_unique_clear<point[]>(MAX_POINTS); + m_vector_list = std::make_unique<point[]>(MAX_POINTS); } /* diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp index c493e3d3a05..6b8cae5f04f 100644 --- a/src/devices/video/vic4567.cpp +++ b/src/devices/video/vic4567.cpp @@ -20,6 +20,8 @@ #include "screen.h" +#include <algorithm> + /***************************************************************************** CONSTANTS @@ -424,105 +426,93 @@ TIMER_CALLBACK_MEMBER( vic3_device::timer_timeout ) void vic3_device::draw_character( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); + int code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = code; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = color[code >> 7]; - if ((xoff + 1 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = color[(code >> 6) & 1]; - if ((xoff + 2 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = color[(code >> 5) & 1]; - if ((xoff + 3 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = color[(code >> 4) & 1]; - if ((xoff + 4 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = color[(code >> 3) & 1]; - if ((xoff + 5 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = color[(code >> 2) & 1]; - if ((xoff + 6 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = color[(code >> 1) & 1]; - if ((xoff + 7 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = color[code & 1]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = color[code >> 7]; + if ((xoff + 1 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = color[(code >> 6) & 1]; + if ((xoff + 2 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = color[(code >> 5) & 1]; + if ((xoff + 3 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = color[(code >> 4) & 1]; + if ((xoff + 4 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = color[(code >> 3) & 1]; + if ((xoff + 5 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = color[(code >> 2) & 1]; + if ((xoff + 6 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = color[(code >> 1) & 1]; + if ((xoff + 7 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = color[code & 1]; } } void vic3_device::draw_character_multi( int ybegin, int yend, int ch, int yoff, int xoff, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); + int code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = m_foreground[code]; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_multi[code >> 6]; - if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_multi[code >> 6]; - if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = m_multi[(code >> 4) & 3]; - if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = m_multi[(code >> 4) & 3]; - if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = m_multi[(code >> 2) & 3]; - if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = m_multi[(code >> 2) & 3]; - if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = m_multi[code & 3]; - if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = m_multi[code & 3]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = m_multi[code >> 6]; + if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = m_multi[code >> 6]; + if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = m_multi[(code >> 4) & 3]; + if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = m_multi[(code >> 4) & 3]; + if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = m_multi[(code >> 2) & 3]; + if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = m_multi[(code >> 2) & 3]; + if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = m_multi[code & 3]; + if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = m_multi[code & 3]; } } void vic3_device::draw_bitmap( int ybegin, int yend, int ch, int yoff, int xoff, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); + int code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = code; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_c64_bitmap[code >> 7]; - if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_c64_bitmap[(code >> 6) & 1]; - if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = m_c64_bitmap[(code >> 5) & 1]; - if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = m_c64_bitmap[(code >> 4) & 1]; - if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = m_c64_bitmap[(code >> 3) & 1]; - if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = m_c64_bitmap[(code >> 2) & 1]; - if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = m_c64_bitmap[(code >> 1) & 1]; - if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = m_c64_bitmap[code & 1]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = m_c64_bitmap[code >> 7]; + if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = m_c64_bitmap[(code >> 6) & 1]; + if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = m_c64_bitmap[(code >> 5) & 1]; + if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = m_c64_bitmap[(code >> 4) & 1]; + if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = m_c64_bitmap[(code >> 3) & 1]; + if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = m_c64_bitmap[(code >> 2) & 1]; + if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = m_c64_bitmap[(code >> 1) & 1]; + if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = m_c64_bitmap[code & 1]; } } void vic3_device::draw_bitmap_multi( int ybegin, int yend, int ch, int yoff, int xoff, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); + int code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = m_foreground[code]; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_bitmapmulti[code >> 6]; - if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_bitmapmulti[code >> 6]; - if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = m_bitmapmulti[(code >> 4) & 3]; - if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = m_bitmapmulti[(code >> 4) & 3]; - if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = m_bitmapmulti[(code >> 2) & 3]; - if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = m_bitmapmulti[(code >> 2) & 3]; - if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = m_bitmapmulti[code & 3]; - if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = m_bitmapmulti[code & 3]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = m_bitmapmulti[code >> 6]; + if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = m_bitmapmulti[code >> 6]; + if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = m_bitmapmulti[(code >> 4) & 3]; + if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = m_bitmapmulti[(code >> 4) & 3]; + if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = m_bitmapmulti[(code >> 2) & 3]; + if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = m_bitmapmulti[(code >> 2) & 3]; + if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = m_bitmapmulti[code & 3]; + if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = m_bitmapmulti[code & 3]; } } void vic3_device::draw_sprite_code( int y, int xbegin, int code, int color, int start_x, int end_x ) { - int mask, x; - if ((y < YPOS) || (y >= (VIC2_STARTVISIBLELINES + VIC2_VISIBLELINES)) || (xbegin <= 1) || (xbegin >= (VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS))) return; - for (x = 0, mask = 0x80; x < 8; x++, mask >>= 1) + for (int x = 0, mask = 0x80; x < 8; x++, mask >>= 1) { if (code & mask) { if ((xbegin + x > start_x) && (xbegin + x < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x) = color; + m_bitmap->pix(y + FIRSTLINE, xbegin + x) = color; } } } void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior, int start_x, int end_x ) { - int x, mask, shift; - if ((y < YPOS) || (y >= (VIC2_STARTVISIBLELINES + VIC2_VISIBLELINES)) || (xbegin <= 1) || (xbegin >= (VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS))) return; - for (x = 0, mask = 0xc0, shift = 6; x < 8; x += 2, mask >>= 2, shift -= 2) + for (int x = 0, mask = 0xc0, shift = 6; x < 8; x += 2, mask >>= 2, shift -= 2) { if (code & mask) { @@ -530,17 +520,17 @@ void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior { case 1: if ((xbegin + x + 1 > start_x) && (xbegin + x + 1 < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; break; case 2: if ((xbegin + x > start_x) && (xbegin + x < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; break; case 3: if ((xbegin + x > start_x) && (xbegin + x < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; if ((xbegin + x + 1> start_x) && (xbegin + x + 1< end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; break; } } @@ -549,8 +539,6 @@ void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior void vic3_device::sprite_collision( int nr, int y, int x, int mask ) { - int value, xdiff; - for (int i = 7; i > nr; i--) { if (!SPRITEON(i) || !m_sprites[i].paintedline[y] || (SPRITE_COLLISION(i) && SPRITE_COLLISION(nr))) @@ -559,8 +547,9 @@ void vic3_device::sprite_collision( int nr, int y, int x, int mask ) if ((x + 7 < SPRITE_X_POS(i)) || (x >= SPRITE_X_POS(i) + SPRITE_X_SIZE(i))) continue; - xdiff = x - SPRITE_X_POS(i); + int xdiff = x - SPRITE_X_POS(i); + int value; if ((x & 7) == (SPRITE_X_POS(i) & 7)) value = m_sprites[i].bitmap[y][xdiff >> 3]; else if (xdiff < 0) @@ -785,17 +774,6 @@ void vic3_device::draw_sprite_multi( int nr, int yoff, int ybegin, int yend, int } } -#ifndef memset16 -static void *memset16(void *dest, int value, size_t size) -{ - int i; - - for (i = 0; i < size; i++) - ((short *) dest)[i] = value; - return dest; -} -#endif - void vic3_device::drawlines( int first, int last, int start_x, int end_x ) { int line, vline, end; @@ -825,7 +803,7 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x ) { for (line = first; (line < last) && (line < m_bitmap->height()); line++) { - memset16(&m_bitmap->pix16(line + FIRSTLINE), 0, m_bitmap->width()); + std::fill_n(&m_bitmap->pix(line + FIRSTLINE), m_bitmap->width(), 0); } return; } @@ -841,7 +819,7 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x ) for (line = first; line < end; line++) { - memset16(&m_bitmap->pix16(line + FIRSTLINE), FRAMECOLOR, m_bitmap->width()); + std::fill_n(&m_bitmap->pix(line + FIRSTLINE), m_bitmap->width(), FRAMECOLOR); } if (LINES25) @@ -1013,20 +991,14 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x ) for (; line < end; line++) { - memset16(&m_bitmap->pix16(line + FIRSTLINE), FRAMECOLOR, m_bitmap->width()); + std::fill_n(&m_bitmap->pix(line + FIRSTLINE), m_bitmap->width(), FRAMECOLOR); } } void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) { - int line, vline, end; - int attr, ch, ecm; - int syend; - int offs, yoff, xoff, ybegin, yend, xbegin, xend; - int i; - if (VIC3_BITPLANES) - return ; + return; /* temporary allowing vic3 displaying 80 columns */ if (m_reg[0x31] & 0x80) @@ -1040,8 +1012,8 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) /* top part of display not rastered */ first -= VIC2_YPOS - YPOS; - xbegin = VIC2_STARTVISIBLECOLUMNS; - xend = xbegin + VIC2_VISIBLECOLUMNS; + int xbegin = VIC2_STARTVISIBLECOLUMNS; + int xend = xbegin + VIC2_VISIBLECOLUMNS; if (!SCREENON) { xbegin = VIC2_STARTVISIBLECOLUMNS; @@ -1068,12 +1040,13 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) xend = xbegin + 304; } + int end; if (first + 1 < m_y_begin) end = first + 1; else end = m_y_begin + YPOS; - line = first; + int line = first; // top border if (line < end) { @@ -1088,7 +1061,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) line = end; } - vline = line - YPOS + 3 - VERTICALPOS; + int vline = line - YPOS + 3 - VERTICALPOS; if (first + 1 < m_y_end + YPOS) end = first + 1; @@ -1097,23 +1070,23 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) if (line < end) { - offs = (vline >> 3) * 40; - ybegin = vline & 7; - yoff = line - ybegin; - yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); + int offs = (vline >> 3) * 40; + int ybegin = vline & 7; + int yoff = line - ybegin; + int yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); /* rendering 39 characters */ /* left and right borders are overwritten later */ m_shift[line] = HORIZONTALPOS; - for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) + for (int xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) { - ch = m_dma_read_cb(m_videoaddr + offs); + int ch = m_dma_read_cb(m_videoaddr + offs); #if 0 - attr = m_dma_read_color_cb(m_videoaddr + offs); + int attr = m_dma_read_color_cb(m_videoaddr + offs); #else /* temporary until vic3 finished */ - attr = m_dma_read_color_cb((m_videoaddr + offs)&0x3ff)&0x0f; + int attr = m_dma_read_color_cb((m_videoaddr + offs)&0x3ff)&0x0f; #endif if (HIRESON) { @@ -1131,7 +1104,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) } else if (ECMON) { - ecm = ch >> 6; + int ecm = ch >> 6; m_ecmcolor[0] = m_colors[ecm]; m_ecmcolor[1] = attr; draw_character(ybegin, yend, ch & ~0xC0, yoff, xoff, m_ecmcolor, start_x, end_x); @@ -1149,7 +1122,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) } /* sprite priority, sprite overwrites lowerprior pixels */ - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { if (SPRITEON (i) && (yoff + ybegin >= SPRITE_Y_POS (i)) && @@ -1158,7 +1131,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) { int wrapped = - SPRITE_Y_POS (i) + 6; - syend = yend; + int syend = yend; if (SPRITE_Y_EXPAND (i)) { @@ -1187,7 +1160,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) { int wrapped = yoff + ybegin - SPRITE_Y_POS (i); - syend = yend; + int syend = yend; if (SPRITE_Y_EXPAND (i)) { @@ -1659,77 +1632,76 @@ uint8_t vic3_device::port_r(offs_t offset) } -#define VIC3_MASK(M) \ - if (M) \ - { \ - if (M & 0x01) \ - colors[0] = m_c64_mem_r_cb(VIC3_ADDR(0) + offset); \ - if (M & 0x02) \ - colors[1] = m_c64_mem_r_cb(VIC3_ADDR(1) + offset) << 1; \ - if (M & 0x04) \ - colors[2] = m_c64_mem_r_cb(VIC3_ADDR(2) + offset) << 2; \ - if (M & 0x08) \ - colors[3] = m_c64_mem_r_cb(VIC3_ADDR(3) + offset) << 3; \ - if (M & 0x10) \ - colors[4] = m_c64_mem_r_cb(VIC3_ADDR(4) + offset) << 4; \ - if (M & 0x20) \ - colors[5] = m_c64_mem_r_cb(VIC3_ADDR(5) + offset) << 5; \ - if (M & 0x40) \ - colors[6] = m_c64_mem_r_cb(VIC3_ADDR(6) + offset) << 6; \ - if (M & 0x80) \ - colors[7] = m_c64_mem_r_cb(VIC3_ADDR(7) + offset) << 7; \ - for (i = 7; i >= 0; i--) \ - { \ - p = 0; \ - if (M & 0x01) \ - { \ - p = colors[0] & 0x01; \ - colors[0] >>= 1; \ - } \ - if (M & 0x02) \ - { \ - p |= colors[1] & 0x02; \ - colors[1] >>= 1; \ - } \ - if (M & 0x04) \ - { \ - p |= colors[2] & 0x04; \ - colors[2] >>= 1; \ - } \ - if (M & 0x08) \ - { \ - p |= colors[3] & 0x08; \ - colors[3] >>= 1; \ - } \ - if (M & 0x10) \ - { \ - p |= colors[4] & 0x10; \ - colors[4] >>= 1; \ - } \ - if (M & 0x20) \ - { \ - p |= colors[5] & 0x20; \ - colors[5] >>= 1; \ - } \ - if (M & 0x40) \ - { \ - p |= colors[6] & 0x40; \ - colors[6] >>= 1; \ - } \ - if (M & 0x80) \ - { \ - p |= colors[7] & 0x80; \ - colors[7] >>= 1; \ - } \ - m_bitmap->pix16(YPOS + y, XPOS + x + i) = p; \ - } \ +#define VIC3_MASK(M) \ + if (M) \ + { \ + if (M & 0x01) \ + colors[0] = m_c64_mem_r_cb(VIC3_ADDR(0) + offset); \ + if (M & 0x02) \ + colors[1] = m_c64_mem_r_cb(VIC3_ADDR(1) + offset) << 1; \ + if (M & 0x04) \ + colors[2] = m_c64_mem_r_cb(VIC3_ADDR(2) + offset) << 2; \ + if (M & 0x08) \ + colors[3] = m_c64_mem_r_cb(VIC3_ADDR(3) + offset) << 3; \ + if (M & 0x10) \ + colors[4] = m_c64_mem_r_cb(VIC3_ADDR(4) + offset) << 4; \ + if (M & 0x20) \ + colors[5] = m_c64_mem_r_cb(VIC3_ADDR(5) + offset) << 5; \ + if (M & 0x40) \ + colors[6] = m_c64_mem_r_cb(VIC3_ADDR(6) + offset) << 6; \ + if (M & 0x80) \ + colors[7] = m_c64_mem_r_cb(VIC3_ADDR(7) + offset) << 7; \ + for (int i = 7; i >= 0; i--) \ + { \ + int p = 0; \ + if (M & 0x01) \ + { \ + p = colors[0] & 0x01; \ + colors[0] >>= 1; \ + } \ + if (M & 0x02) \ + { \ + p |= colors[1] & 0x02; \ + colors[1] >>= 1; \ + } \ + if (M & 0x04) \ + { \ + p |= colors[2] & 0x04; \ + colors[2] >>= 1; \ + } \ + if (M & 0x08) \ + { \ + p |= colors[3] & 0x08; \ + colors[3] >>= 1; \ + } \ + if (M & 0x10) \ + { \ + p |= colors[4] & 0x10; \ + colors[4] >>= 1; \ + } \ + if (M & 0x20) \ + { \ + p |= colors[5] & 0x20; \ + colors[5] >>= 1; \ + } \ + if (M & 0x40) \ + { \ + p |= colors[6] & 0x40; \ + colors[6] >>= 1; \ + } \ + if (M & 0x80) \ + { \ + p |= colors[7] & 0x80; \ + colors[7] >>= 1; \ + } \ + m_bitmap->pix(YPOS + y, XPOS + x + i) = p; \ + } \ } #define VIC3_ADDR(a) VIC3_BITPLANE_IADDR(a) void vic3_device::interlace_draw_block( int x, int y, int offset ) { int colors[8] = {0}; - int i, p; switch (VIC3_BITPLANES_MASK) { @@ -1776,13 +1748,13 @@ void vic3_device::interlace_draw_block( int x, int y, int offset ) if (VIC3_BITPLANES_MASK & 0x80) colors[7] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(7) + offset) << 7; - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { - m_bitmap->pix16(YPOS + y, XPOS + x + i) = - (colors[0] & 0x01) | (colors[1] & 0x02) - | (colors[2] & 0x04) | (colors[3] & 0x08) - | (colors[4] & 0x10) | (colors[5] & 0x20) - | (colors[6] & 0x40) | (colors[7] & 0x80); + m_bitmap->pix(YPOS + y, XPOS + x + i) = + (colors[0] & 0x01) | (colors[1] & 0x02) | + (colors[2] & 0x04) | (colors[3] & 0x08) | + (colors[4] & 0x10) | (colors[5] & 0x20) | + (colors[6] & 0x40) | (colors[7] & 0x80); colors[0] >>= 1; colors[1] >>= 1; colors[2] >>= 1; @@ -1800,7 +1772,6 @@ void vic3_device::interlace_draw_block( int x, int y, int offset ) void vic3_device::draw_block( int x, int y, int offset ) { int colors[8] = {0}; - int i, p; switch (VIC3_BITPLANES_MASK) { @@ -1847,13 +1818,13 @@ void vic3_device::draw_block( int x, int y, int offset ) if (VIC3_BITPLANES_MASK & 0x80) colors[7] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(7) + offset) << 7; - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { - m_bitmap->pix16(YPOS + y, XPOS + x + i) = - (colors[0] & 0x01) | (colors[1] & 0x02) - | (colors[2] & 0x04) | (colors[3] & 0x08) - | (colors[4] & 0x10) | (colors[5] & 0x20) - | (colors[6] & 0x40) | (colors[7] & 0x80); + m_bitmap->pix(YPOS + y, XPOS + x + i) = + (colors[0] & 0x01) | (colors[1] & 0x02) | + (colors[2] & 0x04) | (colors[3] & 0x08) | + (colors[4] & 0x10) | (colors[5] & 0x20) | + (colors[6] & 0x40) | (colors[7] & 0x80); colors[0] >>= 1; colors[1] >>= 1; colors[2] >>= 1; @@ -1869,17 +1840,15 @@ void vic3_device::draw_block( int x, int y, int offset ) void vic3_device::draw_bitplanes() { - int x, y, y1s, offset; - rectangle vis; const rectangle &visarea = screen().visible_area(); if (VIC3_LINES == 400) { /* interlaced! */ - for (y1s = 0, offset = 0; y1s < 400; y1s += 16) + for (int y1s = 0, offset = 0; y1s < 400; y1s += 16) { - for (x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) + for (int x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) { - for (y = y1s; y < y1s + 16; y += 2, offset++) + for (int y = y1s; y < y1s + 16; y += 2, offset++) { if (m_interlace) draw_block(x, y, offset); @@ -1892,11 +1861,11 @@ void vic3_device::draw_bitplanes() } else { - for (y1s = 0, offset = 0; y1s < 200; y1s += 8) + for (int y1s = 0, offset = 0; y1s < 200; y1s += 8) { - for (x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) + for (int x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) { - for (y = y1s; y < y1s + 8; y++, offset++) + for (int y = y1s; y < y1s + 8; y++, offset++) { draw_block(x, y, offset); } @@ -1906,25 +1875,25 @@ void vic3_device::draw_bitplanes() if (XPOS > 0) { - vis.set(0, XPOS - 1, 0, visarea.bottom()); + rectangle vis(0, XPOS - 1, 0, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } if (XPOS + VIC3_BITPLANES_WIDTH < visarea.right()) { - vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.right(), 0, visarea.bottom()); + rectangle vis(XPOS + VIC3_BITPLANES_WIDTH, visarea.right(), 0, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } if (YPOS > 0) { - vis.set(0, visarea.right(), 0, YPOS - 1); + rectangle vis(0, visarea.right(), 0, YPOS - 1); m_bitmap->fill(FRAMECOLOR, vis); } if (YPOS + VIC3_LINES < visarea.bottom()) { - vis.set(0, visarea.right(), YPOS + VIC3_LINES, visarea.bottom()); + rectangle vis(0, visarea.right(), YPOS + VIC3_LINES, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } } diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index 72ef43032ef..ebc9555f25c 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -917,8 +917,8 @@ int voodoo_device::voodoo_update(bitmap_rgb32 &bitmap, const rectangle &cliprect for (y = cliprect.min_y; y <= cliprect.max_y; y++) if (y >= fbi.yoffs) { - uint16_t *src = (uint16_t *)(fbi.ram + fbi.rgboffs[drawbuf]) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; - uint32_t *dst = &bitmap.pix32(y); + uint16_t const *const src = (uint16_t *)(fbi.ram + fbi.rgboffs[drawbuf]) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; + uint32_t *const dst = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = fbi.pen[src[x]]; } @@ -944,8 +944,8 @@ int voodoo_device::voodoo_update(bitmap_rgb32 &bitmap, const rectangle &cliprect { for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t* src = (uint16_t*)(fbi.ram + fbi.auxoffs) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; - uint32_t* dst = &bitmap.pix32(y); + uint16_t const *const src = (uint16_t*)(fbi.ram + fbi.auxoffs) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; + uint32_t *const dst = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = ((src[x] << 8) & 0xff0000) | ((src[x] >> 0) & 0xff00) | ((src[x] >> 8) & 0xff); } diff --git a/src/devices/video/vrender0.cpp b/src/devices/video/vrender0.cpp index f2bb5c74ac1..8a0e7c9319c 100644 --- a/src/devices/video/vrender0.cpp +++ b/src/devices/video/vrender0.cpp @@ -716,7 +716,7 @@ uint32_t vr0video_device::screen_update(screen_device &screen, bitmap_ind16 &bit uint32_t const dx = cliprect.left(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) - std::copy_n(&m_DisplayDest[(y * 1024) + dx], width, &bitmap.pix16(y, dx)); + std::copy_n(&m_DisplayDest[(y * 1024) + dx], width, &bitmap.pix(y, dx)); return 0; } diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 0c6c34e3fcc..c585373c74e 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -8,6 +8,9 @@ #include "emu.h" #include "zeus2.h" +#include <algorithm> + + #define LOG_REGS 1 // Setting ALWAYS_LOG_FIFO will always log the fifo versus having to hold 'L' #define ALWAYS_LOG_FIFO 0 @@ -236,10 +239,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap for (y = cliprect.min_y; y <= cliprect.max_y; y++) { uint32_t *colorptr = &m_frameColor[frame_addr_from_xy(0, y, false)]; - uint32_t *dest = &bitmap.pix32(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) { - dest[x] = colorptr[x]; - } + std::copy(colorptr + cliprect.min_x, colorptr + cliprect.max_x + 1, &bitmap.pix(y, cliprect.min_x)); } } @@ -265,7 +265,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap int xoffs = screen.visible_area().min_x; for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { if (1) { diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp index 61f7375d236..604e05ab864 100644 --- a/src/emu/addrmap.cpp +++ b/src/emu/addrmap.cpp @@ -873,7 +873,7 @@ void address_map::global_mask(offs_t mask) address_map_entry &address_map::operator()(offs_t start, offs_t end) { - address_map_entry *ptr = global_alloc(address_map_entry(*m_device, *this, start, end)); + address_map_entry *ptr = new address_map_entry(*m_device, *this, start, end); m_entrylist.append(*ptr); return *ptr; } diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp index 6145e668a23..027d8828e32 100644 --- a/src/emu/crsshair.cpp +++ b/src/emu/crsshair.cpp @@ -9,11 +9,15 @@ ***************************************************************************/ #include "emu.h" +#include "crsshair.h" + +#include "config.h" #include "emuopts.h" +#include "render.h" #include "rendutil.h" -#include "config.h" +#include "screen.h" + #include "xmlfile.h" -#include "crsshair.h" @@ -168,32 +172,45 @@ void render_crosshair::set_default_bitmap() void render_crosshair::create_bitmap() { - int x, y; rgb_t color = m_player < ARRAY_LENGTH(crosshair_colors) ? crosshair_colors[m_player] : rgb_t::white(); // if we have a bitmap and texture for this player, kill it - if (m_bitmap == nullptr) + if (!m_bitmap) { m_bitmap = std::make_unique<bitmap_argb32>(); m_texture = m_machine.render().texture_alloc(render_texture::hq_scale); } + else + { + m_bitmap->reset(); + } emu_file crossfile(m_machine.options().crosshair_path(), OPEN_FLAG_READ); if (!m_name.empty()) { // look for user specified file - std::string filename = m_name + ".png"; - render_load_png(*m_bitmap, crossfile, nullptr, filename.c_str()); + if (crossfile.open(m_name + ".png") == osd_file::error::NONE) + { + render_load_png(*m_bitmap, crossfile); + crossfile.close(); + } } else { // look for default cross?.png in crsshair/game dir - std::string filename = string_format("cross%d.png", m_player + 1); - render_load_png(*m_bitmap, crossfile, m_machine.system().name, filename.c_str()); + std::string const filename = string_format("cross%d.png", m_player + 1); + if (crossfile.open(m_machine.system().name + (PATH_SEPARATOR + filename)) == osd_file::error::NONE) + { + render_load_png(*m_bitmap, crossfile); + crossfile.close(); + } // look for default cross?.png in crsshair dir - if (!m_bitmap->valid()) - render_load_png(*m_bitmap, crossfile, nullptr, filename.c_str()); + if (!m_bitmap->valid() && (crossfile.open(filename) == osd_file::error::NONE)) + { + render_load_png(*m_bitmap, crossfile); + crossfile.close(); + } } /* if that didn't work, use the built-in one */ @@ -204,14 +221,14 @@ void render_crosshair::create_bitmap() m_bitmap->fill(rgb_t(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ - for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) + for (int y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ - u32 *dest0 = &m_bitmap->pix32(y); - u32 *dest1 = &m_bitmap->pix32(CROSSHAIR_RAW_SIZE - 1 - y); + u32 *const dest0 = &m_bitmap->pix(y); + u32 *const dest1 = &m_bitmap->pix(CROSSHAIR_RAW_SIZE - 1 - y); /* extract to two rows simultaneously */ - for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) + for (int x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = rgb_t(0xff,0x00,0x00,0x00) | color; } @@ -328,6 +345,7 @@ void render_crosshair::draw(render_container &container, u8 fade) crosshair_manager::crosshair_manager(running_machine &machine) : m_machine(machine) , m_usage(false) + , m_fade(0) , m_animation_counter(0) , m_auto_time(CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT) { diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index c6dda192e59..9b33eac7b45 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -122,6 +122,11 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu symtable.add("min", 2, 2, std::bind(&debugger_commands::execute_min, this, _1, _2)); symtable.add("max", 2, 2, std::bind(&debugger_commands::execute_max, this, _1, _2)); symtable.add("if", 3, 3, std::bind(&debugger_commands::execute_if, this, _1, _2)); + symtable.add("abs", 1, 1, std::bind(&debugger_commands::execute_abs, this, _1, _2)); + symtable.add("bit", 2, 3, std::bind(&debugger_commands::execute_bit, this, _1, _2)); + symtable.add("s8", 1, 1, std::bind(&debugger_commands::execute_s8, this, _1, _2)); + symtable.add("s16", 1, 1, std::bind(&debugger_commands::execute_s16, this, _1, _2)); + symtable.add("s32", 1, 1, std::bind(&debugger_commands::execute_s32, this, _1, _2)); symtable.add("cpunum", std::bind(&debugger_commands::get_cpunum, this)); /* add all single-entry save state globals */ @@ -322,9 +327,9 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu m_cheat.cpu[0] = m_cheat.cpu[1] = 0; } -/*------------------------------------------------- - execute_min - return the minimum of two values --------------------------------------------------*/ +//------------------------------------------------- +// execute_min - return the minimum of two values +//------------------------------------------------- u64 debugger_commands::execute_min(int params, const u64 *param) { @@ -332,9 +337,9 @@ u64 debugger_commands::execute_min(int params, const u64 *param) } -/*------------------------------------------------- - execute_max - return the maximum of two values --------------------------------------------------*/ +//------------------------------------------------- +// execute_max - return the maximum of two values +//------------------------------------------------- u64 debugger_commands::execute_max(int params, const u64 *param) { @@ -342,9 +347,9 @@ u64 debugger_commands::execute_max(int params, const u64 *param) } -/*------------------------------------------------- - execute_if - if (a) return b; else return c; --------------------------------------------------*/ +//------------------------------------------------- +// execute_if - if (a) return b; else return c; +//------------------------------------------------- u64 debugger_commands::execute_if(int params, const u64 *param) { @@ -353,6 +358,59 @@ u64 debugger_commands::execute_if(int params, const u64 *param) //------------------------------------------------- +// execute_abs - return the absolute value +//------------------------------------------------- + +u64 debugger_commands::execute_abs(int params, const u64 *param) +{ + return std::abs(s64(param[0])); +} + + +//------------------------------------------------- +// execute_bit - extract bit field from value +//------------------------------------------------- + +u64 debugger_commands::execute_bit(int params, const u64 *param) +{ + if (params == 2) + return BIT(param[0], param[1]); + else + return BIT(param[0], param[1], param[2]); +} + + +//------------------------------------------------- +// execute_s8 - sign-extend from 8 bits +//------------------------------------------------- + +u64 debugger_commands::execute_s8(int params, const u64 *param) +{ + return s8(param[0]); +} + + +//------------------------------------------------- +// execute_s16 - sign-extend from 16 bits +//------------------------------------------------- + +u64 debugger_commands::execute_s16(int params, const u64 *param) +{ + return s16(param[0]); +} + + +//------------------------------------------------- +// execute_s32 - sign-extend from 32 bits +//------------------------------------------------- + +u64 debugger_commands::execute_s32(int params, const u64 *param) +{ + return s32(param[0]); +} + + +//------------------------------------------------- // get_cpunum - getter callback for the // 'cpunum' symbol //------------------------------------------------- @@ -592,12 +650,12 @@ bool debugger_commands::debug_command_parameter_command(const char *param) /* validate the comment; success if no error */ CMDERR err = m_console.validate_command(param); - if (err == CMDERR_NONE) + if (err.error_class() == CMDERR::NONE) return true; /* output an error */ m_console.printf("Error in command: %s\n", param); - m_console.printf(" %*s^", CMDERR_ERROR_OFFSET(err), ""); + m_console.printf(" %*s^", err.error_offset(), ""); m_console.printf("%s\n", debugger_console::cmderr_to_string(err)); return 0; } diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index dad1979da39..e2ebec7e2fc 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -87,6 +87,11 @@ private: u64 execute_min(int params, const u64 *param); u64 execute_max(int params, const u64 *param); u64 execute_if(int params, const u64 *param); + u64 execute_abs(int params, const u64 *param); + u64 execute_bit(int params, const u64 *param); + u64 execute_s8(int params, const u64 *param); + u64 execute_s16(int params, const u64 *param); + u64 execute_s32(int params, const u64 *param); u64 get_cpunum(); u64 global_get(global_entry *global); diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index b547b1b536c..500310bd459 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -86,24 +86,15 @@ debugger_console::debugger_console(running_machine &machine) void debugger_console::exit() { - /* free allocated memory */ - if (m_console_textbuf) - { - text_buffer_free(m_console_textbuf); - } - m_console_textbuf = nullptr; - - if (m_errorlog_textbuf) - { - text_buffer_free(m_errorlog_textbuf); - } - m_errorlog_textbuf = nullptr; + // free allocated memory + m_console_textbuf.reset(); + m_errorlog_textbuf.reset(); - /* free the command list */ + // free the command list m_commandlist.clear(); - /* close the logfile, if any */ - m_logfile = nullptr; + // close the logfile, if any + m_logfile.reset(); } @@ -167,7 +158,7 @@ void debugger_console::execute_condump(int ref, const std::vector<std::string>& return; } - for (auto line_info : text_buffer_get_lines(m_console_textbuf)) + for (auto line_info : text_buffer_lines(*m_console_textbuf)) { fwrite(line_info.text, sizeof(char), line_info.length, f); fputc('\n', f); @@ -259,7 +250,7 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char /* no params is an error */ if (params == 0) - return CMDERR_NONE; + return CMDERR::none(); /* the first parameter has the command and the real first parameter; separate them */ for (p = param[0]; *p && isspace(u8(*p)); p++) { } @@ -296,9 +287,9 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char /* error if not found */ if (!found) - return MAKE_CMDERR_UNKNOWN_COMMAND(0); + return CMDERR::unknown_command(0); if (foundcount > 1) - return MAKE_CMDERR_AMBIGUOUS_COMMAND(0); + return CMDERR::ambiguous_command(0); /* NULL-terminate and trim space around all the parameters */ for (i = 1; i < params; i++) @@ -310,9 +301,9 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char /* see if we have the right number of parameters */ if (params < found->minparams) - return MAKE_CMDERR_NOT_ENOUGH_PARAMS(0); + return CMDERR::not_enough_params(0); if (params > found->maxparams) - return MAKE_CMDERR_TOO_MANY_PARAMS(0); + return CMDERR::too_many_params(0); /* execute the handler */ if (execute) @@ -320,7 +311,7 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char std::vector<std::string> params_vec(param, param + params); found->handler(found->ref, params_vec); } - return CMDERR_NONE; + return CMDERR::none(); } @@ -333,7 +324,6 @@ CMDERR debugger_console::internal_parse_command(const std::string &original_comm { char command[MAX_COMMAND_LENGTH], parens[MAX_COMMAND_LENGTH]; char *params[MAX_COMMAND_PARAMS] = { nullptr }; - CMDERR result; char *command_start; char *p, c = 0; @@ -363,9 +353,9 @@ CMDERR debugger_console::internal_parse_command(const std::string &original_comm case '(': case '[': case '{': parens[parendex++] = c; break; - case ')': if (parendex == 0 || parens[--parendex] != '(') return MAKE_CMDERR_UNBALANCED_PARENS(p - command); break; - case ']': if (parendex == 0 || parens[--parendex] != '[') return MAKE_CMDERR_UNBALANCED_PARENS(p - command); break; - case '}': if (parendex == 0 || parens[--parendex] != '{') return MAKE_CMDERR_UNBALANCED_PARENS(p - command); break; + case ')': if (parendex == 0 || parens[--parendex] != '(') return CMDERR::unbalanced_parens(p - command); break; + case ']': if (parendex == 0 || parens[--parendex] != '[') return CMDERR::unbalanced_parens(p - command); break; + case '}': if (parendex == 0 || parens[--parendex] != '{') return CMDERR::unbalanced_parens(p - command); break; case ',': if (parendex == 0) params[paramcount++] = p; break; case ';': if (parendex == 0) foundend = true; break; case '-': if (parendex == 0 && paramcount == 1 && p[1] == '-') isexpr = true; *p = c; break; @@ -379,9 +369,9 @@ CMDERR debugger_console::internal_parse_command(const std::string &original_comm /* check for unbalanced parentheses or quotes */ if (instring) - return MAKE_CMDERR_UNBALANCED_QUOTES(p - command); + return CMDERR::unbalanced_quotes(p - command); if (parendex != 0) - return MAKE_CMDERR_UNBALANCED_PARENS(p - command); + return CMDERR::unbalanced_parens(p - command); /* NULL-terminate if we ended in a semicolon */ p--; @@ -406,17 +396,17 @@ CMDERR debugger_console::internal_parse_command(const std::string &original_comm } catch (expression_error &err) { - return MAKE_CMDERR_EXPRESSION_ERROR(err); + return CMDERR::expression_error(err); } } else { - result = internal_execute_command(execute, paramcount, ¶ms[0]); - if (result != CMDERR_NONE) - return MAKE_CMDERR(CMDERR_ERROR_CLASS(result), command_start - command); + const CMDERR result = internal_execute_command(execute, paramcount, ¶ms[0]); + if (result.error_class() != CMDERR::NONE) + return CMDERR(result.error_class(), command_start - command); } } - return CMDERR_NONE; + return CMDERR::none(); } @@ -426,21 +416,19 @@ CMDERR debugger_console::internal_parse_command(const std::string &original_comm CMDERR debugger_console::execute_command(const std::string &command, bool echo) { - CMDERR result; - /* echo if requested */ if (echo) printf(">%s\n", command.c_str()); /* parse and execute */ - result = internal_parse_command(command, true); + const CMDERR result = internal_parse_command(command, true); /* display errors */ - if (result != CMDERR_NONE) + if (result.error_class() != CMDERR::NONE) { if (!echo) printf(">%s\n", command.c_str()); - printf(" %*s^\n", CMDERR_ERROR_OFFSET(result), ""); + printf(" %*s^\n", result.error_offset(), ""); printf("%s\n", cmderr_to_string(result).c_str()); } @@ -559,16 +547,16 @@ void debugger_console::process_source_file() std::string debugger_console::cmderr_to_string(CMDERR error) { - int offset = CMDERR_ERROR_OFFSET(error); - switch (CMDERR_ERROR_CLASS(error)) + const int offset = error.error_offset(); + switch (error.error_class()) { - case CMDERR_UNKNOWN_COMMAND: return "unknown command"; - case CMDERR_AMBIGUOUS_COMMAND: return "ambiguous command"; - case CMDERR_UNBALANCED_PARENS: return "unbalanced parentheses"; - case CMDERR_UNBALANCED_QUOTES: return "unbalanced quotes"; - case CMDERR_NOT_ENOUGH_PARAMS: return "not enough parameters for command"; - case CMDERR_TOO_MANY_PARAMS: return "too many parameters for command"; - case CMDERR_EXPRESSION_ERROR: return string_format("error in assignment expression: %s", + case CMDERR::UNKNOWN_COMMAND: return "unknown command"; + case CMDERR::AMBIGUOUS_COMMAND: return "ambiguous command"; + case CMDERR::UNBALANCED_PARENS: return "unbalanced parentheses"; + case CMDERR::UNBALANCED_QUOTES: return "unbalanced quotes"; + case CMDERR::NOT_ENOUGH_PARAMS: return "not enough parameters for command"; + case CMDERR::TOO_MANY_PARAMS: return "too many parameters for command"; + case CMDERR::EXPRESSION_ERROR: return string_format("error in assignment expression: %s", expression_error(static_cast<expression_error::error_code>(offset)).code_string()); default: return "unknown error"; } @@ -591,7 +579,7 @@ std::string debugger_console::cmderr_to_string(CMDERR error) void debugger_console::print_core(const char *text) { // FIXME: this invokes strlen() twice; compute it once and pass it to text_buffer_print - text_buffer_print(m_console_textbuf, text); + text_buffer_print(*m_console_textbuf, text); if (m_logfile) m_logfile->write(text, strlen(text)); } @@ -605,7 +593,7 @@ void debugger_console::print_core_wrap(const char *text, int wrapcol) { // FIXME: this invokes strlen() twice; compute it once and pass it to text_buffer_print // FIXME: also look into honoring wrapcol for the logfile - text_buffer_print_wrap(m_console_textbuf, text, wrapcol); + text_buffer_print_wrap(*m_console_textbuf, text, wrapcol); if (m_logfile) m_logfile->write(text, strlen(text)); } @@ -627,7 +615,7 @@ void debugger_console::vprintf(util::format_argument_pack<std::ostream> &&args) { print_core(util::string_format(std::move(args)).c_str()); - /* force an update of any console views */ + // force an update of any console views m_machine.debug_view().update_all(DVT_CONSOLE); } @@ -641,7 +629,7 @@ void debugger_console::vprintf_wrap(int wrapcol, util::format_argument_pack<std: { print_core_wrap(util::string_format(args).c_str(), wrapcol); - /* force an update of any console views */ + // force an update of any console views m_machine.debug_view().update_all(DVT_CONSOLE); } @@ -649,7 +637,7 @@ void debugger_console::vprintf_wrap(int wrapcol, util::format_argument_pack<std: { print_core_wrap(util::string_format(std::move(args)).c_str(), wrapcol); - /* force an update of any console views */ + // force an update of any console views m_machine.debug_view().update_all(DVT_CONSOLE); } @@ -662,10 +650,8 @@ void debugger_console::vprintf_wrap(int wrapcol, util::format_argument_pack<std: void debugger_console::errorlog_write_line(const char *line) { if (m_errorlog_textbuf) - { - text_buffer_print(m_errorlog_textbuf, line); - } + text_buffer_print(*m_errorlog_textbuf, line); - /* force an update of any log views */ + // force an update of any log views m_machine.debug_view().update_all(DVT_LOG); } diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 949b236774a..2d811523650 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -25,20 +25,10 @@ #define MAX_COMMAND_LENGTH 4096 #define MAX_COMMAND_PARAMS 128 -/* flags for command parsing */ -#define CMDFLAG_NONE (0x0000) -#define CMDFLAG_KEEP_QUOTES (0x0001) -#define CMDFLAG_CUSTOM_HELP (0x0002) - -/* values for the error code in a command error */ -#define CMDERR_NONE (0) -#define CMDERR_UNKNOWN_COMMAND (1) -#define CMDERR_AMBIGUOUS_COMMAND (2) -#define CMDERR_UNBALANCED_PARENS (3) -#define CMDERR_UNBALANCED_QUOTES (4) -#define CMDERR_NOT_ENOUGH_PARAMS (5) -#define CMDERR_TOO_MANY_PARAMS (6) -#define CMDERR_EXPRESSION_ERROR (7) +// flags for command parsing +constexpr u32 CMDFLAG_NONE = 0x0000; +constexpr u32 CMDFLAG_KEEP_QUOTES = 0x0001; +constexpr u32 CMDFLAG_CUSTOM_HELP = 0x0002; /* parameter separator macros */ #define CMDPARAM_SEPARATOR "\0" @@ -47,53 +37,66 @@ /*************************************************************************** - MACROS + TYPE DEFINITIONS ***************************************************************************/ -/* command error assembly/disassembly macros */ -#define CMDERR_ERROR_CLASS(x) ((x) >> 16) -#define CMDERR_ERROR_OFFSET(x) ((x) & 0xffff) -#define MAKE_CMDERR(a,b) (((a) << 16) | ((b) & 0xffff)) - -/* macros to assemble specific error conditions */ -#define MAKE_CMDERR_UNKNOWN_COMMAND(x) MAKE_CMDERR(CMDERR_UNKNOWN_COMMAND, (x)) -#define MAKE_CMDERR_AMBIGUOUS_COMMAND(x) MAKE_CMDERR(CMDERR_AMBIGUOUS_COMMAND, (x)) -#define MAKE_CMDERR_UNBALANCED_PARENS(x) MAKE_CMDERR(CMDERR_UNBALANCED_PARENS, (x)) -#define MAKE_CMDERR_UNBALANCED_QUOTES(x) MAKE_CMDERR(CMDERR_UNBALANCED_QUOTES, (x)) -#define MAKE_CMDERR_NOT_ENOUGH_PARAMS(x) MAKE_CMDERR(CMDERR_NOT_ENOUGH_PARAMS, (x)) -#define MAKE_CMDERR_TOO_MANY_PARAMS(x) MAKE_CMDERR(CMDERR_TOO_MANY_PARAMS, (x)) -#define MAKE_CMDERR_EXPRESSION_ERROR(x) MAKE_CMDERR(CMDERR_EXPRESSION_ERROR, (x)) +// CMDERR is an error code for command evaluation +class CMDERR +{ +public: + // values for the error code in a command error + static constexpr u16 NONE = 0; + static constexpr u16 UNKNOWN_COMMAND = 1; + static constexpr u16 AMBIGUOUS_COMMAND = 2; + static constexpr u16 UNBALANCED_PARENS = 3; + static constexpr u16 UNBALANCED_QUOTES = 4; + static constexpr u16 NOT_ENOUGH_PARAMS = 5; + static constexpr u16 TOO_MANY_PARAMS = 6; + static constexpr u16 EXPRESSION_ERROR = 7; + + // command error assembly/disassembly + constexpr CMDERR(u16 c, u16 o) : m_error_class(c), m_error_offset(o) { } + constexpr u16 error_class() const { return m_error_class; } + constexpr u16 error_offset() const { return m_error_offset; } + + // assemble specific error conditions + static constexpr CMDERR none() { return CMDERR(NONE, 0); } + static constexpr CMDERR unknown_command(u16 x) { return CMDERR(UNKNOWN_COMMAND, x); } + static constexpr CMDERR ambiguous_command(u16 x) { return CMDERR(AMBIGUOUS_COMMAND, x); } + static constexpr CMDERR unbalanced_parens(u16 x) { return CMDERR(UNBALANCED_PARENS, x); } + static constexpr CMDERR unbalanced_quotes(u16 x) { return CMDERR(UNBALANCED_QUOTES, x); } + static constexpr CMDERR not_enough_params(u16 x) { return CMDERR(NOT_ENOUGH_PARAMS, x); } + static constexpr CMDERR too_many_params(u16 x) { return CMDERR(TOO_MANY_PARAMS, x); } + static constexpr CMDERR expression_error(u16 x) { return CMDERR(EXPRESSION_ERROR, x); } +private: + u16 m_error_class, m_error_offset; -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ +}; -/* CMDERR is an error code for command evaluation */ -typedef u32 CMDERR; class debugger_console { public: debugger_console(running_machine &machine); - /* command handling */ + // command handling CMDERR execute_command(const std::string &command, bool echo); CMDERR validate_command(const char *command); void register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function<void(int, const std::vector<std::string> &)> handler); void source_script(const char *file); void process_source_file(); - /* console management */ - void vprintf(util::format_argument_pack<std::ostream> const &args); - void vprintf(util::format_argument_pack<std::ostream> &&args); - void vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> const &args); - void vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> &&args); - text_buffer * get_console_textbuf() const { return m_console_textbuf; } + // console management + void vprintf(util::format_argument_pack<std::ostream> const &args); + void vprintf(util::format_argument_pack<std::ostream> &&args); + void vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> const &args); + void vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> &&args); + text_buffer &get_console_textbuf() const { return *m_console_textbuf; } /* errorlog management */ - void errorlog_write_line(const char *line); - text_buffer * get_errorlog_textbuf() const { return m_errorlog_textbuf; } + void errorlog_write_line(const char *line); + text_buffer &get_errorlog_textbuf() const { return *m_errorlog_textbuf; } /* convenience templates */ template <typename Format, typename... Params> @@ -143,10 +146,10 @@ private: running_machine &m_machine; // visible CPU device (the one that commands should apply to) - device_t *m_visiblecpu; + device_t *m_visiblecpu; - text_buffer *m_console_textbuf; - text_buffer *m_errorlog_textbuf; + text_buffer_ptr m_console_textbuf; + text_buffer_ptr m_errorlog_textbuf; std::forward_list<debug_command> m_commandlist; diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index 1d88f0485e2..a104bb82529 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -326,7 +326,7 @@ debug_view_manager::~debug_view_manager() { debug_view *oldhead = m_viewlist; m_viewlist = oldhead->m_next; - global_free(oldhead); + delete oldhead; } } @@ -340,25 +340,25 @@ debug_view *debug_view_manager::alloc_view(debug_view_type type, debug_view_osd_ switch (type) { case DVT_CONSOLE: - return append(global_alloc(debug_view_console(machine(), osdupdate, osdprivate))); + return append(new debug_view_console(machine(), osdupdate, osdprivate)); case DVT_STATE: - return append(global_alloc(debug_view_state(machine(), osdupdate, osdprivate))); + return append(new debug_view_state(machine(), osdupdate, osdprivate)); case DVT_DISASSEMBLY: - return append(global_alloc(debug_view_disasm(machine(), osdupdate, osdprivate))); + return append(new debug_view_disasm(machine(), osdupdate, osdprivate)); case DVT_MEMORY: - return append(global_alloc(debug_view_memory(machine(), osdupdate, osdprivate))); + return append(new debug_view_memory(machine(), osdupdate, osdprivate)); case DVT_LOG: - return append(global_alloc(debug_view_log(machine(), osdupdate, osdprivate))); + return append(new debug_view_log(machine(), osdupdate, osdprivate)); case DVT_BREAK_POINTS: - return append(global_alloc(debug_view_breakpoints(machine(), osdupdate, osdprivate))); + return append(new debug_view_breakpoints(machine(), osdupdate, osdprivate)); case DVT_WATCH_POINTS: - return append(global_alloc(debug_view_watchpoints(machine(), osdupdate, osdprivate))); + return append(new debug_view_watchpoints(machine(), osdupdate, osdprivate)); default: fatalerror("Attempt to create invalid debug view type %d\n", type); @@ -378,7 +378,7 @@ void debug_view_manager::free_view(debug_view &view) if (*viewptr == &view) { *viewptr = view.m_next; - global_free(&view); + delete &view; break; } } diff --git a/src/emu/debug/dvtext.cpp b/src/emu/debug/dvtext.cpp index 63ad674ec10..6a4d2893562 100644 --- a/src/emu/debug/dvtext.cpp +++ b/src/emu/debug/dvtext.cpp @@ -9,10 +9,12 @@ ***************************************************************************/ #include "emu.h" -#include "debugvw.h" #include "dvtext.h" + #include "debugcon.h" #include "debugger.h" +#include "debugvw.h" + //************************************************************************** // DEBUG VIEW TEXTBUF @@ -22,11 +24,16 @@ // debug_view_textbuf - constructor //------------------------------------------------- -debug_view_textbuf::debug_view_textbuf(running_machine &machine, debug_view_type type, debug_view_osd_update_func osdupdate, void *osdprivate, text_buffer &textbuf) - : debug_view(machine, type, osdupdate, osdprivate), - m_textbuf(textbuf), - m_at_bottom(true), - m_topseq(0) +debug_view_textbuf::debug_view_textbuf( + running_machine &machine, + debug_view_type type, + debug_view_osd_update_func osdupdate, + void *osdprivate, + text_buffer &textbuf) + : debug_view(machine, type, osdupdate, osdprivate) + , m_textbuf(textbuf) + , m_at_bottom(true) + , m_topseq(0) { } @@ -47,7 +54,7 @@ debug_view_textbuf::~debug_view_textbuf() void debug_view_textbuf::clear() { begin_update(); - text_buffer_clear(&m_textbuf); + text_buffer_clear(m_textbuf); m_at_bottom = true; m_topseq = 0; end_update(); @@ -61,8 +68,8 @@ void debug_view_textbuf::clear() void debug_view_textbuf::view_update() { // update the console info - m_total.x = text_buffer_max_width(&m_textbuf); - m_total.y = text_buffer_num_lines(&m_textbuf); + m_total.x = text_buffer_max_width(m_textbuf); + m_total.y = text_buffer_num_lines(m_textbuf); if (m_total.x < 80) m_total.x = 80; @@ -71,24 +78,24 @@ void debug_view_textbuf::view_update() if (!m_at_bottom) { curseq = m_topseq; - if (!text_buffer_get_seqnum_line(&m_textbuf, curseq)) + if (!text_buffer_get_seqnum_line(m_textbuf, curseq)) m_at_bottom = true; } if (m_at_bottom) { - curseq = text_buffer_line_index_to_seqnum(&m_textbuf, m_total.y - 1); + curseq = text_buffer_line_index_to_seqnum(m_textbuf, m_total.y - 1); if (m_total.y < m_visible.y) curseq -= m_total.y - 1; else curseq -= m_visible.y - 1; } - m_topleft.y = curseq - text_buffer_line_index_to_seqnum(&m_textbuf, 0); + m_topleft.y = curseq - text_buffer_line_index_to_seqnum(m_textbuf, 0); // loop over visible rows debug_view_char *dest = &m_viewdata[0]; for (u32 row = 0; row < m_visible.y; row++) { - const char *line = text_buffer_get_seqnum_line(&m_textbuf, curseq++); + const char *line = text_buffer_get_seqnum_line(m_textbuf, curseq++); u32 col = 0; // if this visible row is valid, add it to the buffer @@ -133,7 +140,7 @@ void debug_view_textbuf::view_notify(debug_view_notification type) /* otherwise, track the seqence number of the top line */ if (!m_at_bottom) - m_topseq = text_buffer_line_index_to_seqnum(&m_textbuf, m_topleft.y); + m_topseq = text_buffer_line_index_to_seqnum(m_textbuf, m_topleft.y); } } @@ -148,7 +155,7 @@ void debug_view_textbuf::view_notify(debug_view_notification type) //------------------------------------------------- debug_view_console::debug_view_console(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate) - : debug_view_textbuf(machine, DVT_CONSOLE, osdupdate, osdprivate, *machine.debugger().console().get_console_textbuf()) + : debug_view_textbuf(machine, DVT_CONSOLE, osdupdate, osdprivate, machine.debugger().console().get_console_textbuf()) { } @@ -163,6 +170,6 @@ debug_view_console::debug_view_console(running_machine &machine, debug_view_osd_ //------------------------------------------------- debug_view_log::debug_view_log(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate) - : debug_view_textbuf(machine, DVT_LOG, osdupdate, osdprivate, *machine.debugger().console().get_errorlog_textbuf()) + : debug_view_textbuf(machine, DVT_LOG, osdupdate, osdprivate, machine.debugger().console().get_errorlog_textbuf()) { } diff --git a/src/emu/debug/dvtext.h b/src/emu/debug/dvtext.h index 14a323794db..e6b65c137b3 100644 --- a/src/emu/debug/dvtext.h +++ b/src/emu/debug/dvtext.h @@ -31,7 +31,12 @@ public: protected: // construction/destruction - debug_view_textbuf(running_machine &machine, debug_view_type type, debug_view_osd_update_func osdupdate, void *osdprivate, text_buffer &textbuf); + debug_view_textbuf( + running_machine &machine, + debug_view_type type, + debug_view_osd_update_func osdupdate, + void *osdprivate, + text_buffer &textbuf); virtual ~debug_view_textbuf(); protected: @@ -41,9 +46,9 @@ protected: private: // internal state - text_buffer & m_textbuf; /* pointer to the text buffer */ - bool m_at_bottom; /* are we tracking new stuff being added? */ - u32 m_topseq; /* sequence number of the top line */ + text_buffer & m_textbuf; // pointer to the text buffer + bool m_at_bottom; // are we tracking new stuff being added? + u32 m_topseq; // sequence number of the top line }; diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index ea445c4b14a..e9e8a86ab78 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -248,8 +248,6 @@ private: // a single token class parse_token { - friend class simple_list<parse_token>; - // operator flags enum { diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp index 395a58482a7..ab7bf6505b3 100644 --- a/src/emu/debug/textbuf.cpp +++ b/src/emu/debug/textbuf.cpp @@ -35,24 +35,17 @@ struct text_buffer , linesize(lineoffs ? lines : 0) { } - ~text_buffer() - { - if (buffer) - delete [] buffer; - if (lineoffs) - delete [] lineoffs; - } - char *const buffer; - s32 *const lineoffs; - s32 const bufsize; - s32 bufstart = 0; - s32 bufend = 0; - s32 const linesize; - s32 linestart = 0; - s32 lineend = 0; - u32 linestartseq = 0; - s32 maxwidth = 0; + std::unique_ptr<char []> const buffer; + std::unique_ptr<s32 []> const lineoffs; + s32 const bufsize; + s32 bufstart = 0; + s32 bufend = 0; + s32 const linesize; + s32 linestart = 0; + s32 lineend = 0; + u32 linestartseq = 0; + s32 maxwidth = 0; /*------------------------------------------------- buffer_used - return the number of bytes @@ -88,22 +81,19 @@ struct text_buffer text_buffer_alloc - allocate a new text buffer -------------------------------------------------*/ -text_buffer *text_buffer_alloc(u32 bytes, u32 lines) +text_buffer_ptr text_buffer_alloc(u32 bytes, u32 lines) { // allocate memory for the text buffer object - text_buffer *const text(new (std::nothrow) text_buffer(bytes, lines)); + text_buffer_ptr text(new (std::nothrow) text_buffer(bytes, lines)); if (!text) return nullptr; if (!text->buffer || !text->lineoffs) - { - delete text; return nullptr; - } // initialize the buffer description - text_buffer_clear(text); + text_buffer_clear(*text); return text; } @@ -114,7 +104,7 @@ text_buffer *text_buffer_alloc(u32 bytes, u32 lines) text buffer -------------------------------------------------*/ -void text_buffer_free(text_buffer *text) +void text_buffer_deleter::operator()(text_buffer *text) const { delete text; } @@ -124,21 +114,21 @@ void text_buffer_free(text_buffer *text) text_buffer_clear - clear a text buffer -------------------------------------------------*/ -void text_buffer_clear(text_buffer *text) +void text_buffer_clear(text_buffer &text) { - /* reset all the buffer pointers and other bits */ - text->bufstart = 0; - text->bufend = 0; + // reset all the buffer pointers and other bits + text.bufstart = 0; + text.bufend = 0; - text->linestart = 0; - text->lineend = 0; - text->linestartseq = 0; + text.linestart = 0; + text.lineend = 0; + text.linestartseq = 0; - text->maxwidth = 0; + text.maxwidth = 0; - /* create the initial line */ - text->lineoffs[0] = 0; - text->buffer[text->lineoffs[0]] = 0; + // create the initial line + text.lineoffs[0] = 0; + text.buffer[text.lineoffs[0]] = 0; } @@ -154,9 +144,9 @@ void text_buffer_clear(text_buffer *text) buffer -------------------------------------------------*/ -void text_buffer_print(text_buffer *text, const char *data) +void text_buffer_print(text_buffer &text, const char *data) { - text_buffer_print_wrap(text, data, 10000); + text_buffer_print_wrap(text, data, MAX_LINE_LENGTH); } @@ -166,21 +156,21 @@ void text_buffer_print(text_buffer *text, const char *data) column -------------------------------------------------*/ -void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) +void text_buffer_print_wrap(text_buffer &text, const char *data, int wrapcol) { - s32 stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH; + s32 const stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH; s32 needed_space; /* we need to ensure there is enough space for this string plus enough for the max line length */ needed_space = s32(strlen(data)) + MAX_LINE_LENGTH; /* make space in the buffer if we need to */ - while (text->buffer_space() < needed_space && text->linestart != text->lineend) + while (text.buffer_space() < needed_space && text.linestart != text.lineend) { - text->linestartseq++; - if (++text->linestart >= text->linesize) - text->linestart = 0; - text->bufstart = text->lineoffs[text->linestart]; + text.linestartseq++; + if (++text.linestart >= text.linesize) + text.linestart = 0; + text.bufstart = text.lineoffs[text.linestart]; } /* now add the data */ @@ -191,14 +181,14 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) /* a CR resets our position */ if (ch == '\r') - text->bufend = text->lineoffs[text->lineend]; + text.bufend = text.lineoffs[text.lineend]; /* non-CR data is just characters */ else if (ch != '\n') - text->buffer[text->bufend++] = ch; + text.buffer[text.bufend++] = ch; /* an explicit newline or line-too-long condition inserts a newline */ - linelen = text->bufend - text->lineoffs[text->lineend]; + linelen = text.bufend - text.lineoffs[text.lineend]; if (ch == '\n' || linelen >= stopcol) { int overflow = 0; @@ -208,7 +198,7 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) { /* scan backwards, removing characters along the way */ overflow = 1; - while (overflow < linelen && text->buffer[text->bufend - overflow] != ' ') + while (overflow < linelen && text.buffer[text.bufend - overflow] != ' ') overflow++; /* if we found a space, take it; otherwise, reset and pretend we didn't try */ @@ -219,39 +209,39 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) } /* did we beat the max width */ - if (linelen > text->maxwidth) - text->maxwidth = linelen; + if (linelen > text.maxwidth) + text.maxwidth = linelen; /* append a terminator */ if (overflow == 0) - text->buffer[text->bufend++] = 0; + text.buffer[text.bufend++] = 0; else - text->buffer[text->bufend - overflow] = 0; + text.buffer[text.bufend - overflow] = 0; /* determine what the next line will be */ - if (++text->lineend >= text->linesize) - text->lineend = 0; + if (++text.lineend >= text.linesize) + text.lineend = 0; /* if we're out of lines, consume the next one */ - if (text->lineend == text->linestart) + if (text.lineend == text.linestart) { - text->linestartseq++; - if (++text->linestart >= text->linesize) - text->linestart = 0; - text->bufstart = text->lineoffs[text->linestart]; + text.linestartseq++; + if (++text.linestart >= text.linesize) + text.linestart = 0; + text.bufstart = text.lineoffs[text.linestart]; } /* if we don't have enough room in the buffer for a max line, wrap to the start */ - if (text->bufend + MAX_LINE_LENGTH + 1 >= text->bufsize) - text->bufend = 0; + if (text.bufend + MAX_LINE_LENGTH + 1 >= text.bufsize) + text.bufend = 0; /* create a new empty line */ - text->lineoffs[text->lineend] = text->bufend - (overflow ? (overflow - 1) : 0); + text.lineoffs[text.lineend] = text.bufend - (overflow ? (overflow - 1) : 0); } } /* nullptr terminate what we have on this line */ - text->buffer[text->bufend] = 0; + text.buffer[text.bufend] = 0; } @@ -267,9 +257,9 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) width of all lines seen so far -------------------------------------------------*/ -u32 text_buffer_max_width(text_buffer *text) +u32 text_buffer_max_width(text_buffer const &text) { - return text->maxwidth; + return text.maxwidth; } @@ -278,12 +268,10 @@ u32 text_buffer_max_width(text_buffer *text) lines in the text buffer -------------------------------------------------*/ -u32 text_buffer_num_lines(text_buffer *text) +u32 text_buffer_num_lines(text_buffer const &text) { - s32 lines = text->lineend + 1 - text->linestart; - if (lines <= 0) - lines += text->linesize; - return lines; + s32 const lines = text.lineend + 1 - text.linestart; + return (lines <= 0) ? (lines + text.linesize) : lines; } @@ -292,9 +280,9 @@ u32 text_buffer_num_lines(text_buffer *text) line index into a sequence number -------------------------------------------------*/ -u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index) +u32 text_buffer_line_index_to_seqnum(text_buffer const &text, u32 index) { - return text->linestartseq + index; + return text.linestartseq + index; } @@ -303,18 +291,13 @@ u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index) an indexed line in the buffer -------------------------------------------------*/ -const char *text_buffer_get_seqnum_line(text_buffer *text, u32 seqnum) +const char *text_buffer_get_seqnum_line(text_buffer const &text, u32 seqnum) { - u32 numlines = text_buffer_num_lines(text); - u32 index = seqnum - text->linestartseq; + u32 const numlines = text_buffer_num_lines(text); + u32 const index = seqnum - text.linestartseq; if (index >= numlines) return nullptr; - return &text->buffer[text->lineoffs[(text->linestart + index) % text->linesize]]; -} - -text_buffer_lines text_buffer_get_lines(text_buffer *text) -{ - return text_buffer_lines(*text); + return &text.buffer[text.lineoffs[(text.linestart + index) % text.linesize]]; } /*--------------------------------------------------------------------- @@ -324,22 +307,21 @@ text_buffer_lines text_buffer_get_lines(text_buffer *text) text_buffer_line text_buffer_lines::text_buffer_line_iterator::operator*() const { - const char *line = &m_buffer.buffer[m_buffer.lineoffs[m_lineptr]]; + char const *const line = &m_buffer.buffer[m_buffer.lineoffs[m_lineptr]]; auto next_lineptr = m_lineptr + 1; if (next_lineptr == m_buffer.linesize) next_lineptr = 0; - const char *nextline = &m_buffer.buffer[m_buffer.lineoffs[next_lineptr]]; - - /* -1 for the '\0' at the end of line */ + char const *const nextline = &m_buffer.buffer[m_buffer.lineoffs[next_lineptr]]; + // -1 for the '\0' at the end of line ptrdiff_t difference = (nextline - line) - 1; if (difference < 0) difference += m_buffer.bufsize; - return text_buffer_line{ line, (size_t)difference }; + return text_buffer_line{ line, size_t(difference) }; } /*--------------------------------------------------------------------- diff --git a/src/emu/debug/textbuf.h b/src/emu/debug/textbuf.h index f7514701eec..20ad94139bb 100644 --- a/src/emu/debug/textbuf.h +++ b/src/emu/debug/textbuf.h @@ -11,8 +11,11 @@ #ifndef MAME_EMU_DEBUG_TEXTBUF_H #define MAME_EMU_DEBUG_TEXTBUF_H +#include <memory> + #include "emucore.h" + /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -25,29 +28,27 @@ struct text_buffer_line size_t length; }; -/* helper class that makes it possible to iterate over the lines of a text_buffer */ +// helper class for iterating over the lines of a text_buffer class text_buffer_lines { private: - text_buffer &m_buffer; + const text_buffer &m_buffer; public: - text_buffer_lines(text_buffer& buffer) : m_buffer(buffer) { } + text_buffer_lines(const text_buffer& buffer) : m_buffer(buffer) { } class text_buffer_line_iterator { - text_buffer &m_buffer; + const text_buffer &m_buffer; s32 m_lineptr; public: - text_buffer_line_iterator(text_buffer &buffer, s32 lineptr) : + text_buffer_line_iterator(const text_buffer &buffer, s32 lineptr) : m_buffer(buffer), m_lineptr(lineptr) { } - /* technically this isn't a valid forward iterator, because - * operator * doesn't return a reference - */ + // technically this isn't a valid forward iterator, because operator * doesn't return a reference text_buffer_line operator*() const; text_buffer_line_iterator &operator++(); @@ -55,7 +56,7 @@ public: { return m_lineptr != rhs.m_lineptr; } - /* according to C++ spec, only != is needed; == is present for completeness. */ + // according to C++ spec, only != is needed; == is present for completeness. bool operator==(const text_buffer_line_iterator& rhs) { return !operator!=(rhs); } }; @@ -70,34 +71,32 @@ public: FUNCTION PROTOTYPES ***************************************************************************/ -/* allocate a new text buffer */ -text_buffer *text_buffer_alloc(u32 bytes, u32 lines); - -/* free a text buffer */ -void text_buffer_free(text_buffer *text); +// free a text buffer +struct text_buffer_deleter { void operator()(text_buffer *text) const; }; +using text_buffer_ptr = std::unique_ptr<text_buffer, text_buffer_deleter>; -/* clear a text buffer */ -void text_buffer_clear(text_buffer *text); +// allocate a new text buffer +text_buffer_ptr text_buffer_alloc(u32 bytes, u32 lines); -/* "print" data to a text buffer */ -void text_buffer_print(text_buffer *text, const char *data); +// clear a text buffer +void text_buffer_clear(text_buffer &text); -/* "print" data to a text buffer with word wrapping to a given column */ -void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol); +// "print" data to a text buffer +void text_buffer_print(text_buffer &text, const char *data); -/* get the maximum width of lines seen so far */ -u32 text_buffer_max_width(text_buffer *text); +// "print" data to a text buffer with word wrapping to a given column +void text_buffer_print_wrap(text_buffer &text, const char *data, int wrapcol); -/* get the current number of lines in the buffer */ -u32 text_buffer_num_lines(text_buffer *text); +// get the maximum width of lines seen so far +u32 text_buffer_max_width(const text_buffer &text); -/* get an absolute sequence number for a given line */ -u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index); +// get the current number of lines in the buffer +u32 text_buffer_num_lines(const text_buffer &text); -/* get a sequenced line from the text buffer */ -const char *text_buffer_get_seqnum_line(text_buffer *text, u32 seqnum); +// get an absolute sequence number for a given line +u32 text_buffer_line_index_to_seqnum(const text_buffer &text, u32 index); -/* get an iterable container of the lines in the buffer */ -text_buffer_lines text_buffer_get_lines(text_buffer* text); +// get a sequenced line from the text buffer +const char *text_buffer_get_seqnum_line(const text_buffer &text, u32 seqnum); -#endif /* MAME_EMU_DEBUG_TEXTBUF_H */ +#endif // MAME_EMU_DEBUG_TEXTBUF_H diff --git a/src/emu/device.h b/src/emu/device.h index 55c3641f678..53534fe60d5 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -205,7 +205,7 @@ private: template <typename DeviceClass> static std::unique_ptr<device_t> create_device(device_type_impl_base const &type, machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) { - return make_unique_clear<DeviceClass>(mconfig, tag, owner, clock); + return std::make_unique<DeviceClass>(mconfig, tag, owner, clock); } template <typename DriverClass> @@ -298,7 +298,7 @@ public: template <typename... Params> std::unique_ptr<DeviceClass> create(machine_config &mconfig, char const *tag, device_t *owner, Params &&... args) const { - return make_unique_clear<DeviceClass>(mconfig, tag, owner, std::forward<Params>(args)...); + return std::make_unique<DeviceClass>(mconfig, tag, owner, std::forward<Params>(args)...); } template <typename... Params> DeviceClass &operator()(machine_config &mconfig, char const *tag, Params &&... args) const; diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index d2c063ff205..10d16150b76 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -66,15 +66,10 @@ device_sound_interface &device_sound_interface::add_route(u32 output, device_t & //------------------------------------------------- -// stream_alloc_legacy - allocate a stream implicitly +// stream_alloc - allocate a stream implicitly // associated with this device //------------------------------------------------- -sound_stream *device_sound_interface::stream_alloc_legacy(int inputs, int outputs, int sample_rate) -{ - return device().machine().sound().stream_alloc_legacy(*this, inputs, outputs, sample_rate, stream_update_legacy_delegate(&device_sound_interface::sound_stream_update_legacy, this)); -} - sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate) { return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), STREAM_DEFAULT_FLAGS); @@ -382,17 +377,6 @@ void device_sound_interface::interface_pre_reset() //------------------------------------------------- -// sound_stream_update_legacy - implementation -// that should be overridden by legacy devices -//------------------------------------------------- - -void device_sound_interface::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - throw emu_fatalerror("sound_stream_update_legacy called but not overridden by owning class"); -} - - -//------------------------------------------------- // sound_stream_update - default implementation // that should be overridden //------------------------------------------------- diff --git a/src/emu/disound.h b/src/emu/disound.h index d6135123ddb..2e4546da52c 100644 --- a/src/emu/disound.h +++ b/src/emu/disound.h @@ -77,11 +77,9 @@ public: device_sound_interface &reset_routes() { m_route_list.clear(); return *this; } // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); // stream creation - sound_stream *stream_alloc_legacy(int inputs, int outputs, int sample_rate); sound_stream *stream_alloc(int inputs, int outputs, int sample_rate); sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags); @@ -138,7 +136,7 @@ protected: // internal state u8 m_outputs; // number of outputs std::vector<u8> m_outputmap; // map of inputs to outputs - std::vector<bool> m_output_clear; // flag for tracking cleared buffers + std::vector<bool> m_output_clear; // flag for tracking cleared buffers sound_stream *m_mixer_stream; // mixing stream }; diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp index ae8ba0b0e63..06e3d1947af 100644 --- a/src/emu/distate.cpp +++ b/src/emu/distate.cpp @@ -56,8 +56,7 @@ device_state_entry::device_state_entry(int index, const char *symbol, u8 size, u m_datasize(size), m_flags(flags), m_symbol(symbol), - m_default_format(true), - m_sizemask(sizemask) + m_default_format(true) { assert(size == 1 || size == 2 || size == 4 || size == 8 || (flags & DSF_FLOATING_POINT) != 0); @@ -79,8 +78,7 @@ device_state_entry::device_state_entry(int index, device_state_interface *dev) m_datasize(0), m_flags(DSF_DIVIDER | DSF_READONLY), m_symbol(), - m_default_format(true), - m_sizemask(0) + m_default_format(true) { } diff --git a/src/emu/distate.h b/src/emu/distate.h index 5ab34a24cf9..5888313440e 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -119,7 +119,6 @@ private: std::string m_symbol; // symbol for display; all lower-case version for expressions std::string m_format; // supported formats bool m_default_format; // true if we are still using default format - u64 m_sizemask; // mask derived from the data size }; diff --git a/src/emu/emualloc.cpp b/src/emu/emualloc.cpp index bc08416abb9..1dd78feaeed 100644 --- a/src/emu/emualloc.cpp +++ b/src/emu/emualloc.cpp @@ -143,7 +143,7 @@ void resource_pool::remove(void *ptr) // delete the object and break if (LOG_ALLOCS) fprintf(stderr, "#%06d, delete %d bytes\n", u32(deleteme->m_id), u32(deleteme->m_size)); - global_free(deleteme); + delete deleteme; break; } } diff --git a/src/emu/emualloc.h b/src/emu/emualloc.h index 0ed7cc7ea75..630c3d0a1fd 100644 --- a/src/emu/emualloc.h +++ b/src/emu/emualloc.h @@ -26,10 +26,10 @@ //************************************************************************** // pool allocation helpers -#define pool_alloc(_pool, _type) (_pool).add_object(global_alloc(_type)) -#define pool_alloc_clear(_pool, _type) (_pool).add_object(global_alloc_clear _type) -#define pool_alloc_array(_pool, _type, _num) (_pool).add_array(global_alloc_array(_type,_num), (_num)) -#define pool_alloc_array_clear(_pool, _type, _num) (_pool).add_array(global_alloc_array_clear<_type>(_num), (_num)) +#define pool_alloc(_pool, _type) (_pool).add_object(new _type) +#define pool_alloc_clear(_pool, _type) (_pool).add_object(make_unique_clear _type .release()) +#define pool_alloc_array(_pool, _type, _num) (_pool).add_array(new _type [_num], (_num)) +#define pool_alloc_array_clear(_pool, _type, _num) (_pool).add_array(make_unique_clear<_type []>(_num).release(), (_num)) #define pool_free(_pool, v) (_pool).remove(v) diff --git a/src/emu/emucore.h b/src/emu/emucore.h index b03612512cd..5a2446637c8 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -85,9 +85,6 @@ typedef void genf(void); // pen_t is used to represent pixel values in bitmaps typedef u32 pen_t; -// stream_sample_t is used to represent a single sample in a sound stream -typedef s32 stream_sample_t; - //************************************************************************** diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp index 2233586fe6b..2a2682874c4 100644 --- a/src/emu/fileio.cpp +++ b/src/emu/fileio.cpp @@ -762,16 +762,21 @@ osd_file::error emu_file::attempt_zipped() int header = -1; // see if we can find a file with the right name and (if available) CRC - if (m_openflags & OPEN_FLAG_HAS_CRC) header = zip->search(m_crc, filename, false); - if (header < 0 && (m_openflags & OPEN_FLAG_HAS_CRC)) header = zip->search(m_crc, filename, true); + if (m_openflags & OPEN_FLAG_HAS_CRC) + header = zip->search(m_crc, filename, false); + if (header < 0 && (m_openflags & OPEN_FLAG_HAS_CRC)) + header = zip->search(m_crc, filename, true); // if that failed, look for a file with the right CRC, but the wrong filename - if (header < 0 && (m_openflags & OPEN_FLAG_HAS_CRC)) header = zip->search(m_crc); + if (header < 0 && (m_openflags & OPEN_FLAG_HAS_CRC)) + header = zip->search(m_crc); // if that failed, look for a file with the right name; // reporting a bad checksum is more helpful and less confusing than reporting "ROM not found" - if (header < 0) header = zip->search(filename, false); - if (header < 0) header = zip->search(filename, true); + if (header < 0) + header = zip->search(filename, false); + if (header < 0) + header = zip->search(filename, true); // if we got it, read the data if (header >= 0) @@ -782,6 +787,7 @@ osd_file::error emu_file::attempt_zipped() // build a hash with just the CRC m_hashes.reset(); m_hashes.add_crc(m_zipfile->current_crc()); + m_fullpath = savepath; return (m_openflags & OPEN_FLAG_NO_PRELOAD) ? osd_file::error::NONE : load_zipped_file(); } diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index f406ee6420b..e9fd8d7b6d7 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -1282,7 +1282,7 @@ void ioport_field::expand_diplocation(const char *location, std::string &errorbu errorbuf.append(string_format("Switch location '%s' has invalid format!\n", location)); // allocate a new entry - m_diploclist.append(*global_alloc(ioport_diplocation(name.c_str(), swnum, invert))); + m_diploclist.append(*new ioport_diplocation(name.c_str(), swnum, invert)); entries++; // advance to the next item @@ -1618,15 +1618,15 @@ ioport_port_live::ioport_port_live(ioport_port &port) // allocate analog state if it's analog analog_field *analog = nullptr; if (field.is_analog()) - analog = &analoglist.append(*global_alloc(analog_field(field))); + analog = &analoglist.append(*new analog_field(field)); // allocate a dynamic field for reading if (field.has_dynamic_read()) - readlist.append(*global_alloc(dynamic_field(field))); + readlist.append(*new dynamic_field(field)); // allocate a dynamic field for writing if (field.has_dynamic_write()) - writelist.append(*global_alloc(dynamic_field(field))); + writelist.append(*new dynamic_field(field)); // let the field initialize its live state field.init_live_state(analog); @@ -1694,9 +1694,10 @@ time_t ioport_manager::initialize() if (&port.second->device() == &device) { for (ioport_field &field : port.second->fields()) - if (field.type_class()==INPUT_CLASS_CONTROLLER) + if (field.type_class() == INPUT_CLASS_CONTROLLER) { - if (players < field.player() + 1) players = field.player() + 1; + if (players < field.player() + 1) + players = field.player() + 1; field.set_player(field.player() + player_offset); } } @@ -1956,7 +1957,7 @@ digital_joystick &ioport_manager::digjoystick(int player, int number) return joystick; // create a new one - return m_joystick_list.append(*global_alloc(digital_joystick(player, number))); + return m_joystick_list.append(*new digital_joystick(player, number)); } @@ -2120,6 +2121,67 @@ void ioport_manager::load_config(config_type cfg_type, util::xml::data_node cons for (input_type_entry &entry : m_typelist) for (input_seq_type seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; ++seqtype) entry.defseq(seqtype) = entry.seq(seqtype); + + // load keyboard enable/disable state + if (cfg_type == config_type::GAME) + { + std::vector<bool> kbd_enable_set; + bool keyboard_enabled = false, missing_enabled = false; + for (util::xml::data_node const *kbdnode = parentnode->get_child("keyboard"); kbdnode; kbdnode = kbdnode->get_next_sibling("keyboard")) + { + char const *const tag = kbdnode->get_attribute_string("tag", nullptr); + int const enabled = kbdnode->get_attribute_int("enabled", -1); + if (tag && (0 <= enabled)) + { + size_t i; + for (i = 0; natkeyboard().keyboard_count() > i; ++i) + { + if (!strcmp(natkeyboard().keyboard_device(i).tag(), tag)) + { + if (kbd_enable_set.empty()) + kbd_enable_set.resize(natkeyboard().keyboard_count(), false); + kbd_enable_set[i] = true; + if (enabled) + { + if (!natkeyboard().keyboard_is_keypad(i)) + keyboard_enabled = true; + natkeyboard().enable_keyboard(i); + } + else + { + natkeyboard().disable_keyboard(i); + } + break; + } + } + missing_enabled = missing_enabled || (enabled && (natkeyboard().keyboard_count() <= i)); + } + } + + // if keyboard enable configuration was loaded, patch it up for principle of least surprise + if (!kbd_enable_set.empty()) + { + for (size_t i = 0; natkeyboard().keyboard_count() > i; ++i) + { + if (!natkeyboard().keyboard_is_keypad(i)) + { + if (!keyboard_enabled && missing_enabled) + { + natkeyboard().enable_keyboard(i); + keyboard_enabled = true; + } + else if (!kbd_enable_set[i]) + { + if (keyboard_enabled) + natkeyboard().disable_keyboard(i); + else + natkeyboard().enable_keyboard(i); + keyboard_enabled = true; + } + } + } + } + } } @@ -2358,6 +2420,14 @@ void ioport_manager::save_default_inputs(util::xml::data_node &parentnode) void ioport_manager::save_game_inputs(util::xml::data_node &parentnode) { + // save keyboard enable/disable state + for (size_t i = 0; natkeyboard().keyboard_count() > i; ++i) + { + util::xml::data_node *const kbdnode = parentnode.add_child("keyboard", nullptr); + kbdnode->set_attribute("tag", natkeyboard().keyboard_device(i).tag()); + kbdnode->set_attribute_int("enabled", natkeyboard().keyboard_enabled(i)); + } + // iterate over ports for (auto &port : m_portlist) for (ioport_field &field : port.second->fields()) @@ -3011,7 +3081,7 @@ ioport_configurer& ioport_configurer::field_alloc(ioport_type type, ioport_value // append the field if (type != IPT_UNKNOWN && type != IPT_UNUSED) m_curport->m_active |= mask; - m_curfield = &m_curport->m_fieldlist.append(*global_alloc(ioport_field(*m_curport, type, defval, mask, string_from_token(name)))); + m_curfield = &m_curport->m_fieldlist.append(*new ioport_field(*m_curport, type, defval, mask, string_from_token(name))); // reset the current setting m_cursetting = nullptr; @@ -3068,7 +3138,7 @@ ioport_configurer& ioport_configurer::setting_alloc(ioport_value value, const ch if (m_curfield == nullptr) throw emu_fatalerror("alloc_setting called with no active field (value=%X name=%s)\n", value, name); - m_cursetting = global_alloc(ioport_setting(*m_curfield, value & m_curfield->mask(), string_from_token(name))); + m_cursetting = new ioport_setting(*m_curfield, value & m_curfield->mask(), string_from_token(name)); // append a new setting m_curfield->m_settinglist.append(*m_cursetting); return *this; diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index ada0f04672e..246cca0dd3e 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -199,7 +199,7 @@ void running_machine::start() m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this)); // initialize UI input - m_ui_input = make_unique_clear<ui_input_manager>(*this); + m_ui_input = std::make_unique<ui_input_manager>(*this); // init the osd layer m_manager.osd().init(*this); @@ -230,7 +230,7 @@ void running_machine::start() // needs rom bases), and finally initialize CPUs (which needs // complete address spaces). These operations must proceed in this // order - m_rom_load = make_unique_clear<rom_load_manager>(*this); + m_rom_load = std::make_unique<rom_load_manager>(*this); m_memory.initialize(); // save the random seed or save states might be broken in drivers that use the rand() method @@ -239,7 +239,7 @@ void running_machine::start() // initialize image devices m_image = std::make_unique<image_manager>(*this); m_tilemap = std::make_unique<tilemap_manager>(*this); - m_crosshair = make_unique_clear<crosshair_manager>(*this); + m_crosshair = std::make_unique<crosshair_manager>(*this); m_network = std::make_unique<network_manager>(*this); // initialize the debugger diff --git a/src/emu/natkeyboard.cpp b/src/emu/natkeyboard.cpp index 53a95f46a4b..85c1b986205 100644 --- a/src/emu/natkeyboard.cpp +++ b/src/emu/natkeyboard.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles,Vas Crabb /*************************************************************************** natkeyboard.cpp @@ -12,6 +12,9 @@ #include "natkeyboard.h" #include "emuopts.h" +#include <algorithm> +#include <cstring> + //************************************************************************** // DEBUGGING @@ -317,9 +320,11 @@ const char_info charinfo[] = natural_keyboard::natural_keyboard(running_machine &machine) : m_machine(machine) + , m_have_charkeys(false) , m_in_use(false) , m_bufbegin(0) , m_bufend(0) + , m_current_code(nullptr) , m_fieldnum(0) , m_status_keydown(false) , m_last_cr(false) @@ -330,8 +335,8 @@ natural_keyboard::natural_keyboard(running_machine &machine) , m_charqueue_empty() { // try building a list of keycodes; if none are available, don't bother - build_codes(machine.ioport()); - if (!m_keycode_map.empty()) + build_codes(); + if (m_have_charkeys) { m_buffer.resize(KEY_BUFFER_SIZE); m_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(natural_keyboard::timer), this)); @@ -370,16 +375,18 @@ void natural_keyboard::set_in_use(bool usage) machine().options().set_value(OPTION_NATURAL_KEYBOARD, usage, OPTION_PRIORITY_CMDLINE); // lock out (or unlock) all keyboard inputs - for (auto &port : machine().ioport().ports()) - for (ioport_field &field : port.second->fields()) - if (field.type() == IPT_KEYBOARD) - { - field.live().lockout = usage; + for (kbd_dev_info &devinfo : m_keyboards) + { + for (ioport_field &field : devinfo.keyfields) + { + bool const is_keyboard(field.type() == IPT_KEYBOARD); + field.live().lockout = !devinfo.enabled || (is_keyboard && usage); - // clear pressed status when going out of use - if (!usage) - field.set_value(0); - } + // clear pressed status when going out of use + if (is_keyboard && !usage) + field.set_value(0); + } + } } } @@ -413,19 +420,24 @@ void natural_keyboard::post_char(char32_t ch, bool normalize_crlf) machine().logerror("natural_keyboard::post_char(): code=%i (%s) field.name='%s'\n", int(ch), unicode_to_string(ch).c_str(), (code != nullptr && code->field[0] != nullptr) ? code->field[0]->name() : "<null>"); } - // can we post this key in the queue directly? if (can_post_directly(ch)) + { + // can post this key in the queue directly internal_post(ch); - - // can we post this key with an alternate representation? + } else if (can_post_alternate(ch)) { - const char_info *info = char_info::find(ch); + // can post this key with an alternate representation + char_info const *const info = char_info::find(ch); assert(info != nullptr && info->alternate != nullptr); - const char *altstring = info->alternate; - while (*altstring != 0) + char const *altstring = info->alternate; + unsigned remain(std::strlen(altstring)); + while (remain) { - altstring += uchar_from_utf8(&ch, altstring, strlen(altstring)); + int const used(uchar_from_utf8(&ch, altstring, remain)); + assert(0 < used); + altstring += used; + remain -= used; internal_post(ch); } } @@ -601,16 +613,60 @@ void natural_keyboard::paste() // chars //------------------------------------------------- -void natural_keyboard::build_codes(ioport_manager &manager) +void natural_keyboard::build_codes() { - // find all shift keys - unsigned mask = 0; - std::array<ioport_field *, SHIFT_COUNT> shift; - std::fill(std::begin(shift), std::end(shift), nullptr); + ioport_manager &manager(machine().ioport()); + + // find all the devices with keyboard or keypad inputs for (auto const &port : manager.ports()) { + auto devinfo( + std::find_if( + m_keyboards.begin(), + m_keyboards.end(), + [&port] (kbd_dev_info const &info) + { + return &port.second->device() == &info.device.get(); + })); for (ioport_field &field : port.second->fields()) { + bool const is_keyboard(field.type() == IPT_KEYBOARD); + if (is_keyboard || (field.type() == IPT_KEYPAD)) + { + if (m_keyboards.end() == devinfo) + devinfo = m_keyboards.emplace(devinfo, port.second->device()); + devinfo->keyfields.emplace_back(field); + if (is_keyboard) + devinfo->keyboard = true; + else + devinfo->keypad = true; + } + } + } + std::sort( + std::begin(m_keyboards), + std::end(m_keyboards), + [] (kbd_dev_info const &l, kbd_dev_info const &r) + { + return 0 > std::strcmp(l.device.get().tag(), r.device.get().tag()); + }); + + // set up key mappings for each keyboard + std::array<ioport_field *, SHIFT_COUNT> shift; + unsigned mask; + bool have_keyboard(false); + for (kbd_dev_info &devinfo : m_keyboards) + { + // enable all pure keypads and the first keyboard + if (!devinfo.keyboard || !have_keyboard) + devinfo.enabled = true; + have_keyboard = have_keyboard || devinfo.keyboard; + + // find all shift keys + std::fill(std::begin(shift), std::end(shift), nullptr); + mask = 0; + for (ioport_field &field : devinfo.keyfields) + { if (field.type() == IPT_KEYBOARD) { std::vector<char32_t> const codes = field.keyboard_codes(0); @@ -624,13 +680,11 @@ void natural_keyboard::build_codes(ioport_manager &manager) } } } - } - // iterate over ports and fields - for (auto const &port : manager.ports()) - { - for (ioport_field &field : port.second->fields()) + // iterate over keyboard/keypad fields + for (ioport_field &field : devinfo.keyfields) { + field.live().lockout = !devinfo.enabled; if (field.type() == IPT_KEYBOARD) { // iterate over all shift states @@ -644,13 +698,14 @@ void natural_keyboard::build_codes(ioport_manager &manager) { if (((code < UCHAR_SHIFT_BEGIN) || (code > UCHAR_SHIFT_END)) && (code != 0)) { - keycode_map::iterator const found(m_keycode_map.find(code)); + m_have_charkeys = true; + keycode_map::iterator const found(devinfo.codemap.find(code)); keycode_map_entry newcode; std::fill(std::begin(newcode.field), std::end(newcode.field), nullptr); newcode.shift = curshift; newcode.condition = field.condition(); - unsigned fieldnum = 0; + unsigned fieldnum(0); for (unsigned i = 0, bits = curshift; (i < SHIFT_COUNT) && bits; ++i, bits >>= 1) { if (BIT(bits, 0)) @@ -658,11 +713,11 @@ void natural_keyboard::build_codes(ioport_manager &manager) } newcode.field[fieldnum] = &field; - if (m_keycode_map.end() == found) + if (devinfo.codemap.end() == found) { keycode_map_entries entries; entries.emplace_back(newcode); - m_keycode_map.emplace(code, std::move(entries)); + devinfo.codemap.emplace(code, std::move(entries)); } else found->second.emplace_back(newcode); @@ -670,7 +725,7 @@ void natural_keyboard::build_codes(ioport_manager &manager) if (LOG_NATURAL_KEYBOARD) { machine().logerror("natural_keyboard: code=%u (%s) port=%p field.name='%s'\n", - code, unicode_to_string(code), (void *)&port, field.name()); + code, unicode_to_string(code), (void *)&field.port(), field.name()); } } } @@ -678,15 +733,31 @@ void natural_keyboard::build_codes(ioport_manager &manager) } } } + + // sort mapping entries by shift state + for (auto &mapping : devinfo.codemap) + { + std::sort( + mapping.second.begin(), + mapping.second.end(), + [] (keycode_map_entry const &x, keycode_map_entry const &y) { return x.shift < y.shift; }); + } } +} - // sort mapping entries by shift state - for (auto &mapping : m_keycode_map) + +//------------------------------------------------- +// set_keyboard_enabled - enable or disable a +// device with key inputs +//------------------------------------------------- + +void natural_keyboard::set_keyboard_enabled(size_t n, bool enable) +{ + if (enable != m_keyboards[n].enabled) { - std::sort( - mapping.second.begin(), - mapping.second.end(), - [] (keycode_map_entry const &x, keycode_map_entry const &y) { return x.shift < y.shift; }); + m_keyboards[n].enabled = enable; + for (ioport_field &field : m_keyboards[n].keyfields) + field.live().lockout = !enable || ((field.type() == IPT_KEYBOARD) && in_use()); } } @@ -801,13 +872,15 @@ void natural_keyboard::timer(void *ptr, int param) // the driver does not have a queue_chars handler // loop through this character's component codes - const keycode_map_entry *const code = find_code(m_buffer[m_bufbegin]); + if (!m_fieldnum) + m_current_code = find_code(m_buffer[m_bufbegin]); bool advance; - if (code) + if (m_current_code) { + keycode_map_entry const code(*m_current_code); do { - ioport_field *const field = code->field[m_fieldnum]; + ioport_field *const field = code.field[m_fieldnum]; if (field) { // special handling for toggle fields @@ -817,8 +890,8 @@ void natural_keyboard::timer(void *ptr, int param) field->set_value(!field->digital_value()); } } - while (code->field[m_fieldnum] && (++m_fieldnum < code->field.size()) && m_status_keydown); - advance = (m_fieldnum >= code->field.size()) || !code->field[m_fieldnum]; + while (code.field[m_fieldnum] && (++m_fieldnum < code.field.size()) && m_status_keydown); + advance = (m_fieldnum >= code.field.size()) || !code.field[m_fieldnum]; } else { @@ -888,13 +961,20 @@ std::string natural_keyboard::unicode_to_string(char32_t ch) const const natural_keyboard::keycode_map_entry *natural_keyboard::find_code(char32_t ch) const { - keycode_map::const_iterator const found(m_keycode_map.find(ch)); - if (m_keycode_map.end() == found) - return nullptr; - for (keycode_map_entry const &entry : found->second) + for (kbd_dev_info const &devinfo : m_keyboards) { - if (entry.condition.eval()) - return &entry; + if (devinfo.enabled) + { + keycode_map::const_iterator const found(devinfo.codemap.find(ch)); + if (devinfo.codemap.end() != found) + { + for (keycode_map_entry const &entry : found->second) + { + if (entry.condition.eval()) + return &entry; + } + } + } } return nullptr; } @@ -908,25 +988,43 @@ void natural_keyboard::dump(std::ostream &str) const { constexpr size_t left_column_width = 24; - // loop through all codes - bool first(true); - for (auto &code : m_keycode_map) + // loop through all devices + bool firstdev(true); + for (kbd_dev_info const &devinfo : m_keyboards) { - // describe the character code - std::string const description(string_format("%08X (%s) ", code.first, unicode_to_string(code.first))); + if (!firstdev) + str << '\n'; + util::stream_format( + str, + "%s(%s) - %s%s%s %sabled\n", + devinfo.device.get().type().shortname(), + devinfo.device.get().tag(), + devinfo.keyboard ? "keyboard" : "", + (devinfo.keyboard && devinfo.keypad) ? "/" : "", + devinfo.keypad ? "keypad" : "", + devinfo.enabled ? "en" : "dis"); + firstdev = false; + + // loop through all codes + bool firstkey(true); + for (auto &code : devinfo.codemap) + { + // describe the character code + std::string const description(string_format("%08X (%s) ", code.first, unicode_to_string(code.first))); - // pad with spaces - util::stream_format(str, "%-*s", left_column_width, description); + // pad with spaces + util::stream_format(str, "%-*s", left_column_width, description); - for (auto &entry : code.second) - { - // identify the keys used - for (std::size_t field = 0; (entry.field.size() > field) && entry.field[field]; ++field) - util::stream_format(str, "%s'%s'", first ? "" : ", ", entry.field[field]->name()); + for (auto &entry : code.second) + { + // identify the keys used + for (std::size_t field = 0; (entry.field.size() > field) && entry.field[field]; ++field) + util::stream_format(str, "%s'%s'", firstkey ? "" : ", ", entry.field[field]->name()); - // carriage return - str << '\n'; - first = false; + // carriage return + str << '\n'; + firstkey = false; + } } } } diff --git a/src/emu/natkeyboard.h b/src/emu/natkeyboard.h index d411eb74173..c3454ee8dd4 100644 --- a/src/emu/natkeyboard.h +++ b/src/emu/natkeyboard.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles,Vas Crabb /*************************************************************************** natkeyboard.h @@ -12,8 +12,12 @@ #pragma once +#include <array> +#include <functional> #include <iosfwd> +#include <string> #include <unordered_map> +#include <vector> //************************************************************************** @@ -21,9 +25,9 @@ //************************************************************************** // keyboard helper function delegates -typedef delegate<int (const char32_t *, size_t)> ioport_queue_chars_delegate; -typedef delegate<bool (char32_t)> ioport_accept_char_delegate; -typedef delegate<bool ()> ioport_charqueue_empty_delegate; +using ioport_queue_chars_delegate = delegate<int (const char32_t *, size_t)>; +using ioport_accept_char_delegate = delegate<bool (char32_t)>; +using ioport_charqueue_empty_delegate = delegate<bool ()>; // ======================> natural_keyboard @@ -41,13 +45,19 @@ public: running_machine &machine() const { return m_machine; } bool empty() const { return (m_bufbegin == m_bufend); } bool full() const { return ((m_bufend + 1) % m_buffer.size()) == m_bufbegin; } - bool can_post() const { return (!m_queue_chars.isnull() || !m_keycode_map.empty()); } + bool can_post() const { return m_have_charkeys || !m_queue_chars.isnull(); } bool is_posting() const { return (!empty() || (!m_charqueue_empty.isnull() && !m_charqueue_empty())); } bool in_use() const { return m_in_use; } // configuration void configure(ioport_queue_chars_delegate queue_chars, ioport_accept_char_delegate accept_char, ioport_charqueue_empty_delegate charqueue_empty); void set_in_use(bool usage); + size_t keyboard_count() const { return m_keyboards.size(); } + device_t &keyboard_device(size_t n) const { return m_keyboards[n].device; } + bool keyboard_is_keypad(size_t n) const { return !m_keyboards[n].keyboard; } + bool keyboard_enabled(size_t n) const { return m_keyboards[n].enabled; } + void enable_keyboard(size_t n) { set_keyboard_enabled(n, true); } + void disable_keyboard(size_t n) { set_keyboard_enabled(n, false); } // posting void post_char(char32_t ch, bool normalize_crlf = false); @@ -74,13 +84,27 @@ private: { std::array<ioport_field *, SHIFT_COUNT + 1> field; unsigned shift; - ioport_condition condition; + ioport_condition condition; }; typedef std::vector<keycode_map_entry> keycode_map_entries; typedef std::unordered_map<char32_t, keycode_map_entries> keycode_map; + // per-device character-to-key mapping + struct kbd_dev_info + { + kbd_dev_info(device_t &dev) : device(dev) { } + + std::reference_wrapper<device_t> device; + std::vector<std::reference_wrapper<ioport_field> > keyfields; + keycode_map codemap; + bool keyboard = false; + bool keypad = false; + bool enabled = false; + }; + // internal helpers - void build_codes(ioport_manager &manager); + void build_codes(); + void set_keyboard_enabled(size_t n, bool enable); bool can_post_directly(char32_t ch); bool can_post_alternate(char32_t ch); attotime choose_delay(char32_t ch); @@ -90,11 +114,14 @@ private: const keycode_map_entry *find_code(char32_t ch) const; // internal state + std::vector<kbd_dev_info> m_keyboards; // info on keyboard devices in system running_machine & m_machine; // reference to our machine + bool m_have_charkeys; // are there keys with character? bool m_in_use; // is natural keyboard in use? u32 m_bufbegin; // index of starting character u32 m_bufend; // index of ending character std::vector<char32_t> m_buffer; // actual buffer + keycode_map_entry const * m_current_code; // current code being typed unsigned m_fieldnum; // current step in multi-key sequence bool m_status_keydown; // current keydown status bool m_last_cr; // was the last char a CR? @@ -103,7 +130,6 @@ private: ioport_queue_chars_delegate m_queue_chars; // queue characters callback ioport_accept_char_delegate m_accept_char; // accept character callback ioport_charqueue_empty_delegate m_charqueue_empty; // character queue empty callback - keycode_map m_keycode_map; // keycode map }; diff --git a/src/emu/recording.cpp b/src/emu/recording.cpp index 2e134f03f4a..dd75c27d62f 100644 --- a/src/emu/recording.cpp +++ b/src/emu/recording.cpp @@ -248,7 +248,7 @@ mng_movie_recording::mng_movie_recording(screen_device *screen, std::map<std::st mng_movie_recording::~mng_movie_recording() { if (m_mng_file) - mng_capture_stop(*m_mng_file); + util::mng_capture_stop(*m_mng_file); } @@ -264,10 +264,10 @@ bool mng_movie_recording::initialize(std::unique_ptr<emu_file> &&file, bitmap_t set_frame_period(attotime::from_hz(rate)); m_mng_file = std::move(file); - png_error pngerr = mng_capture_start(*m_mng_file, snap_bitmap, rate); - if (pngerr != PNGERR_NONE) - osd_printf_error("Error capturing MNG, png_error=%d\n", pngerr); - return pngerr == PNGERR_NONE; + util::png_error pngerr = util::mng_capture_start(*m_mng_file, snap_bitmap, rate); + if (pngerr != util::png_error::NONE) + osd_printf_error("Error capturing MNG, png_error=%d\n", std::underlying_type_t<util::png_error>(pngerr)); + return pngerr == util::png_error::NONE; } @@ -278,15 +278,15 @@ bool mng_movie_recording::initialize(std::unique_ptr<emu_file> &&file, bitmap_t bool mng_movie_recording::append_single_video_frame(bitmap_rgb32 &bitmap, const rgb_t *palette, int palette_entries) { // set up the text fields in the movie info - png_info pnginfo; + util::png_info pnginfo; if (current_frame() == 0) { for (auto &ent : m_info_fields) pnginfo.add_text(ent.first.c_str(), ent.second.c_str()); } - png_error error = mng_capture_frame(*m_mng_file, pnginfo, bitmap, palette_entries, palette); - return error == png_error::PNGERR_NONE; + util::png_error error = util::mng_capture_frame(*m_mng_file, pnginfo, bitmap, palette_entries, palette); + return error == util::png_error::NONE; } diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 46123a02b3f..9c7e808bc9f 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -337,11 +337,10 @@ void render_texture::reset(render_manager &manager, texture_scaler_func scaler, void render_texture::release() { // free all scaled versions - for (auto & elem : m_scaled) + for (auto &elem : m_scaled) { - m_manager->invalidate_all(elem.bitmap); - global_free(elem.bitmap); - elem.bitmap = nullptr; + m_manager->invalidate_all(elem.bitmap.get()); + elem.bitmap.reset(); elem.seqid = 0; } @@ -378,12 +377,9 @@ void render_texture::set_bitmap(bitmap_t &bitmap, const rectangle &sbounds, text // invalidate all scaled versions for (auto & elem : m_scaled) { - if (elem.bitmap != nullptr) - { - m_manager->invalidate_all(elem.bitmap); - global_free(elem.bitmap); - } - elem.bitmap = nullptr; + if (elem.bitmap) + m_manager->invalidate_all(elem.bitmap.get()); + elem.bitmap.reset(); elem.seqid = 0; } } @@ -460,21 +456,21 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo // didn't find one -- take the entry with the lowest seqnum for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++) - if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap)) + if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap.get())) lowest = scalenum; if (-1 == lowest) throw emu_fatalerror("render_texture::get_scaled: Too many live texture instances!"); // throw out any existing entries scaled = &m_scaled[lowest]; - if (scaled->bitmap != nullptr) + if (scaled->bitmap) { - m_manager->invalidate_all(scaled->bitmap); - global_free(scaled->bitmap); + m_manager->invalidate_all(scaled->bitmap.get()); + scaled->bitmap.reset(); } // allocate a new bitmap - scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight)); + scaled->bitmap = std::make_unique<bitmap_argb32>(dwidth, dheight); scaled->seqid = ++m_curseq; // let the scaler do the work @@ -482,8 +478,8 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo } // finally fill out the new info - primlist.add_reference(scaled->bitmap); - texinfo.base = &scaled->bitmap->pix32(0); + primlist.add_reference(scaled->bitmap.get()); + texinfo.base = &scaled->bitmap->pix(0); texinfo.rowpixels = scaled->bitmap->rowpixels(); texinfo.width = dwidth; texinfo.height = dheight; @@ -718,8 +714,8 @@ void render_container::overlay_scale(bitmap_argb32 &dest, bitmap_argb32 &source, // simply replicate the source bitmap over the target for (int y = 0; y < dest.height(); y++) { - u32 *src = &source.pix32(y % source.height()); - u32 *dst = &dest.pix32(y); + u32 const *const src = &source.pix(y % source.height()); + u32 *dst = &dest.pix(y); int sx = 0; // loop over columns @@ -1022,6 +1018,7 @@ void render_target::set_view(unsigned viewindex) { m_curview = viewindex; current_view().recompute(visibility_mask(), m_layerconfig.zoom_to_screen()); + current_view().preload(); } } @@ -1051,6 +1048,7 @@ void render_target::set_visibility_toggle(unsigned index, bool enable) else m_views[m_curview].second &= ~(u32(1) << index); current_view().recompute(visibility_mask(), m_layerconfig.zoom_to_screen()); + current_view().preload(); } @@ -1086,13 +1084,14 @@ unsigned render_target::configured_view(const char *viewname, int targetindex, i screen_device const &screen = screens[index() % screens.size()]; for (unsigned i = 0; !view && (m_views.size() > i); ++i) { - for (screen_device const &viewscreen : m_views[i].first.get().screens()) + for (layout_view::item &viewitem : m_views[i].first.get().items()) { - if (&viewscreen == &screen) + screen_device const *const viewscreen(viewitem.screen()); + if (viewscreen == &screen) { view = &m_views[i].first.get(); } - else + else if (viewscreen) { view = nullptr; break; @@ -1107,9 +1106,8 @@ unsigned render_target::configured_view(const char *viewname, int targetindex, i for (unsigned i = 0; !view && (m_views.size() > i); ++i) { layout_view &curview = m_views[i].first; - if (curview.screen_count() >= screens.size()) - if (std::find_if(screens.begin(), screens.end(), [&curview] (screen_device &screen) { return !curview.has_screen(screen); }) == screens.end()) - view = &curview; + if (std::find_if(screens.begin(), screens.end(), [&curview] (screen_device &screen) { return !curview.has_screen(screen); }) == screens.end()) + view = &curview; } } } @@ -1345,43 +1343,37 @@ render_primitive_list &render_target::get_primitives() if (m_manager.machine().phase() >= machine_phase::RESET) { // we're running - iterate over items in the view - for (layout_view::item &curitem : current_view().items()) + for (layout_view::item &curitem : current_view().visible_items()) { - if ((visibility_mask() & curitem.visibility_mask()) == curitem.visibility_mask()) - { - // first apply orientation to the bounds - render_bounds bounds = curitem.bounds(); - apply_orientation(bounds, root_xform.orientation); - normalize_bounds(bounds); - - // apply the transform to the item - object_transform item_xform; - item_xform.xoffs = root_xform.xoffs + bounds.x0 * root_xform.xscale; - item_xform.yoffs = root_xform.yoffs + bounds.y0 * root_xform.yscale; - item_xform.xscale = (bounds.x1 - bounds.x0) * root_xform.xscale; - item_xform.yscale = (bounds.y1 - bounds.y0) * root_xform.yscale; - item_xform.color.r = curitem.color().r * root_xform.color.r; - item_xform.color.g = curitem.color().g * root_xform.color.g; - item_xform.color.b = curitem.color().b * root_xform.color.b; - item_xform.color.a = curitem.color().a * root_xform.color.a; - item_xform.orientation = orientation_add(curitem.orientation(), root_xform.orientation); - item_xform.no_center = false; - - // if there is no associated element, it must be a screen element - if (curitem.screen()) - add_container_primitives(list, root_xform, item_xform, curitem.screen()->container(), curitem.blend_mode()); - else - add_element_primitives(list, item_xform, *curitem.element(), curitem.state(), curitem.blend_mode()); - } + // first apply orientation to the bounds + render_bounds bounds = curitem.bounds(); + apply_orientation(bounds, root_xform.orientation); + normalize_bounds(bounds); + + // apply the transform to the item + object_transform item_xform; + item_xform.xoffs = root_xform.xoffs + bounds.x0 * root_xform.xscale; + item_xform.yoffs = root_xform.yoffs + bounds.y0 * root_xform.yscale; + item_xform.xscale = (bounds.x1 - bounds.x0) * root_xform.xscale; + item_xform.yscale = (bounds.y1 - bounds.y0) * root_xform.yscale; + item_xform.color = curitem.color() * root_xform.color; + item_xform.orientation = orientation_add(curitem.orientation(), root_xform.orientation); + item_xform.no_center = false; + + // if there is no associated element, it must be a screen element + if (curitem.screen()) + add_container_primitives(list, root_xform, item_xform, curitem.screen()->container(), curitem.blend_mode()); + else + add_element_primitives(list, item_xform, *curitem.element(), curitem.state(), curitem.blend_mode()); } } else { // if we are not in the running stage, draw an outer box render_primitive *prim = list.alloc(render_primitive::QUAD); - set_render_bounds_xy(prim->bounds, 0.0f, 0.0f, (float)m_width, (float)m_height); + prim->bounds.set_xy(0.0f, 0.0f, (float)m_width, (float)m_height); prim->full_bounds = prim->bounds; - set_render_color(&prim->color, 1.0f, 0.1f, 0.1f, 0.1f); + prim->color.set(1.0f, 0.1f, 0.1f, 0.1f); prim->texture.base = nullptr; prim->flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA); list.append(*prim); @@ -1389,9 +1381,9 @@ render_primitive_list &render_target::get_primitives() if (m_width > 1 && m_height > 1) { prim = list.alloc(render_primitive::QUAD); - set_render_bounds_xy(prim->bounds, 1.0f, 1.0f, (float)(m_width - 1), (float)(m_height - 1)); + prim->bounds.set_xy(1.0f, 1.0f, float(m_width - 1), float(m_height - 1)); prim->full_bounds = prim->bounds; - set_render_color(&prim->color, 1.0f, 0.0f, 0.0f, 0.0f); + prim->color.set(1.0f, 0.0f, 0.0f, 0.0f); prim->texture.base = nullptr; prim->flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA); list.append(*prim); @@ -1471,7 +1463,7 @@ bool render_target::map_point_container(s32 target_x, s32 target_y, render_conta std::swap(target_f.first, target_f.second); // try to find the right container - auto const &items(current_view().screen_items()); + auto const &items(current_view().visible_screen_items()); auto const found(std::find_if( items.begin(), items.end(), @@ -1479,11 +1471,12 @@ bool render_target::map_point_container(s32 target_x, s32 target_y, render_conta if (items.end() != found) { layout_view::item &item(*found); - if (item.bounds().includes(target_f.first, target_f.second)) + render_bounds const bounds(item.bounds()); + if (bounds.includes(target_f.first, target_f.second)) { // point successfully mapped - container_x = (target_f.first - item.bounds().x0) / item.bounds().width(); - container_y = (target_f.second - item.bounds().y0) / item.bounds().height(); + container_x = (target_f.first - bounds.x0) / bounds.width(); + container_y = (target_f.second - bounds.y0) / bounds.height(); return true; } } @@ -1536,17 +1529,21 @@ bool render_target::map_point_input(s32 target_x, s32 target_y, ioport_port *&in if (m_hit_test[i] && m_hit_test[items.size() + i]) { layout_view::item &item(items[i]); - if (item.has_input()) - { - // point successfully mapped - input_port = item.input_tag_and_mask(input_mask); - input_x = (target_f.first - item.bounds().x0) / item.bounds().width(); - input_y = (target_f.second - item.bounds().y0) / item.bounds().height(); - return true; - } - else + render_bounds const bounds(item.bounds()); + if (bounds.includes(target_f.first, target_f.second)) { - break; + if (item.has_input()) + { + // point successfully mapped + std::tie(input_port, input_mask) = item.input_tag_and_mask(); + input_x = (target_f.first - bounds.x0) / bounds.width(); + input_y = (target_f.second - bounds.y0) / bounds.height(); + return true; + } + else + { + break; + } } } } @@ -1623,7 +1620,10 @@ void render_target::resolve_tags() { view.resolve_tags(); if (¤t_view() == &view) + { view.recompute(visibility_mask(), m_layerconfig.zoom_to_screen()); + view.preload(); + } } } } @@ -1665,7 +1665,7 @@ void render_target::load_layout_files(util::xml::data_node const &rootnode, bool // if there's an explicit file, load that first const std::string &basename = m_manager.machine().basename(); - have_artwork |= load_layout_file(m_manager.machine().root_device(), basename.c_str(), rootnode); + have_artwork |= load_layout_file(m_manager.machine().root_device(), rootnode, m_manager.machine().options().art_path(), basename.c_str()); // if we're only loading this file, we know our final result if (!singlefile) @@ -1909,20 +1909,17 @@ void render_target::load_additional_layout_files(const char *basename, bool have int viewindex(0); for (layout_view *view = nth_view(viewindex); need_tiles && view; view = nth_view(++viewindex)) { - if (view->screen_count() >= screens.size()) + bool screen_missing(false); + for (screen_device &screen : iter) { - bool screen_missing(false); - for (screen_device &screen : iter) + if (!view->has_screen(screen)) { - if (!view->has_screen(screen)) - { - screen_missing = true; - break; - } + screen_missing = true; + break; } - if (!screen_missing) - need_tiles = false; } + if (!screen_missing) + need_tiles = false; } } if (need_tiles) @@ -2087,7 +2084,7 @@ void render_target::load_additional_layout_files(const char *basename, bool have } // try to parse it - if (!load_layout_file(m_manager.machine().root_device(), nullptr, *root)) + if (!load_layout_file(m_manager.machine().root_device(), *root, m_manager.machine().options().art_path(), nullptr)) throw emu_fatalerror("Couldn't parse generated layout??"); } } @@ -2114,7 +2111,7 @@ bool render_target::load_layout_file(const char *dirname, const internal_layout zerr = inflateInit(&stream); if (zerr != Z_OK) { - fatalerror("could not inflateInit"); + osd_printf_error("render_target::load_layout_file: zlib initialization error\n"); return false; } @@ -2130,23 +2127,21 @@ bool render_target::load_layout_file(const char *dirname, const internal_layout } else if (zerr != Z_OK) { - fatalerror("decompression error\n"); + osd_printf_error("render_target::load_layout_file: zlib decompression error\n"); + inflateEnd(&stream); return false; } // clean up zerr = inflateEnd(&stream); if (zerr != Z_OK) - { - fatalerror("inflateEnd error\n"); - return false; - } + osd_printf_error("render_target::load_layout_file: zlib cleanup error\n"); util::xml::file::ptr rootnode(util::xml::file::string_read(reinterpret_cast<char const *>(tempout.get()), nullptr)); tempout.reset(); // if we didn't get a properly-formatted XML file, record a warning and exit - if (!load_layout_file(device ? *device : m_manager.machine().root_device(), dirname, *rootnode)) + if (!load_layout_file(device ? *device : m_manager.machine().root_device(), *rootnode, m_manager.machine().options().art_path(), dirname)) { osd_printf_warning("Improperly formatted XML string, ignoring\n"); return false; @@ -2160,28 +2155,39 @@ bool render_target::load_layout_file(const char *dirname, const internal_layout bool render_target::load_layout_file(const char *dirname, const char *filename) { // build the path and optionally prepend the directory - std::string fname = std::string(filename).append(".lay"); + std::string fname; if (dirname) - fname.insert(0, PATH_SEPARATOR).insert(0, dirname); + fname.append(dirname).append(PATH_SEPARATOR); + fname.append(filename).append(".lay"); - // attempt to open the file; bail if we can't - emu_file layoutfile(m_manager.machine().options().art_path(), OPEN_FLAG_READ); - layoutfile.set_restrict_to_mediapath(1); - osd_file::error const filerr(layoutfile.open(fname)); - if (filerr != osd_file::error::NONE) - return false; - - // read the file + // attempt to open matching files util::xml::parse_options parseopt; util::xml::parse_error parseerr; parseopt.error = &parseerr; - util::xml::file::ptr rootnode(util::xml::file::read(layoutfile, &parseopt)); - if (!rootnode) + emu_file layoutfile(m_manager.machine().options().art_path(), OPEN_FLAG_READ); + layoutfile.set_restrict_to_mediapath(1); + bool result(false); + for (osd_file::error filerr = layoutfile.open(fname); osd_file::error::NONE == filerr; filerr = layoutfile.open_next()) { - if (parseerr.error_message) + // read the file and parse as XML + util::xml::file::ptr const rootnode(util::xml::file::read(layoutfile, &parseopt)); + if (rootnode) + { + // extract directory name from location of layout file + std::string artdir(layoutfile.fullpath()); + auto const dirsep(std::find_if(artdir.rbegin(), artdir.rend(), &util::is_directory_separator)); + artdir.erase(dirsep.base(), artdir.end()); + + // record a warning if we didn't get a properly-formatted XML file + if (!load_layout_file(m_manager.machine().root_device(), *rootnode, nullptr, artdir.c_str())) + osd_printf_warning("Improperly formatted XML layout file '%s', ignoring\n", filename); + else + result = true; + } + else if (parseerr.error_message) { osd_printf_warning( - "Error parsing XML file '%s' at line %d column %d: %s, ignoring\n", + "Error parsing XML layout file '%s' at line %d column %d: %s, ignoring\n", filename, parseerr.error_line, parseerr.error_column, @@ -2189,29 +2195,18 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) } else { - osd_printf_warning("Error parsing XML file '%s', ignorning\n", filename); + osd_printf_warning("Error parsing XML layout file '%s', ignorning\n", filename); } - return false; - } - - // if we didn't get a properly-formatted XML file, record a warning and exit - if (!load_layout_file(m_manager.machine().root_device(), dirname, *rootnode)) - { - osd_printf_warning("Improperly formatted XML file '%s', ignoring\n", filename); - return false; - } - else - { - return true; } + return result; } -bool render_target::load_layout_file(device_t &device, const char *dirname, util::xml::data_node const &rootnode) +bool render_target::load_layout_file(device_t &device, util::xml::data_node const &rootnode, const char *searchpath, const char *dirname) { // parse and catch any errors try { - m_filelist.emplace_back(device, rootnode, dirname); + m_filelist.emplace_back(device, rootnode, searchpath, dirname); } catch (emu_fatalerror &) { @@ -2240,7 +2235,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const cliprect.y0 = xform.yoffs; cliprect.x1 = xform.xoffs + xform.xscale; cliprect.y1 = xform.yoffs + xform.yscale; - sect_render_bounds(cliprect, m_bounds); + cliprect &= m_bounds; float root_xoffs = root_xform.xoffs + fabsf(root_xform.xscale - xform.xscale) * 0.5f; float root_yoffs = root_xform.yoffs + fabsf(root_xform.yscale - xform.yscale) * 0.5f; @@ -2250,7 +2245,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const root_cliprect.y0 = root_yoffs; root_cliprect.x1 = root_xoffs + root_xform.xscale; root_cliprect.y1 = root_yoffs + root_xform.yscale; - sect_render_bounds(root_cliprect, m_bounds); + root_cliprect &= m_bounds; // compute the container transform object_transform container_xform; @@ -2480,7 +2475,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const // allocate a primitive render_primitive *prim = list.alloc(render_primitive::QUAD); - set_render_bounds_wh(prim->bounds, xform.xoffs, xform.yoffs, xform.xscale, xform.yscale); + prim->bounds.set_wh(xform.xoffs, xform.yoffs, xform.xscale, xform.yscale); prim->full_bounds = prim->bounds; prim->color = container_xform.color; width = render_round_nearest(prim->bounds.x1) - render_round_nearest(prim->bounds.x0); @@ -2528,24 +2523,18 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob // compute the bounds s32 width = render_round_nearest(xform.xscale); s32 height = render_round_nearest(xform.yscale); - set_render_bounds_wh(prim->bounds, render_round_nearest(xform.xoffs), render_round_nearest(xform.yoffs), (float) width, (float) height); + prim->bounds.set_wh(render_round_nearest(xform.xoffs), render_round_nearest(xform.yoffs), float(width), float(height)); prim->full_bounds = prim->bounds; if (xform.orientation & ORIENTATION_SWAP_XY) std::swap(width, height); - width = std::min(width, m_maxtexwidth); - height = std::min(height, m_maxtexheight); + width = (std::min)(width, m_maxtexwidth); + height = (std::min)(height, m_maxtexheight); // get the scaled texture and append it - texture->get_scaled(width, height, prim->texture, list, prim->flags); // compute the clip rect - render_bounds cliprect; - cliprect.x0 = render_round_nearest(xform.xoffs); - cliprect.y0 = render_round_nearest(xform.yoffs); - cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale); - cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale); - sect_render_bounds(cliprect, m_bounds); + render_bounds cliprect = prim->bounds & m_bounds; // determine UV coordinates and apply clipping prim->texcoords = oriented_texcoords[xform.orientation]; @@ -2694,7 +2683,10 @@ void render_target::config_load(util::xml::data_node const &targetnode) } if (¤t_view() == &view->first.get()) + { current_view().recompute(visibility_mask(), m_layerconfig.zoom_to_screen()); + current_view().preload(); + } } } @@ -2956,9 +2948,9 @@ void render_target::add_clear_extents(render_primitive_list &list) if (x1 - x0 > 0) { render_primitive *prim = list.alloc(render_primitive::QUAD); - set_render_bounds_xy(prim->bounds, (float)x0, (float)y0, (float)x1, (float)y1); + prim->bounds.set_xy(float(x0), float(y0), float(x1), float(y1)); prim->full_bounds = prim->bounds; - set_render_color(&prim->color, 1.0f, 0.0f, 0.0f, 0.0f); + prim->color.set(1.0f, 0.0f, 0.0f, 0.0f); prim->texture.base = nullptr; prim->flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA); clearlist.append(*prim); @@ -3012,7 +3004,7 @@ void render_target::add_clear_and_optimize_primitive_list(render_primitive_list if (PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_RGB_MULTIPLY) { // RGB multiply will multiply against 0, leaving nothing - set_render_color(&prim.color, 1.0f, 0.0f, 0.0f, 0.0f); + prim.color.set(1.0f, 0.0f, 0.0f, 0.0f); prim.texture.base = nullptr; prim.flags = (prim.flags & ~PRIMFLAG_BLENDMODE_MASK) | PRIMFLAG_BLENDMODE(BLENDMODE_NONE); } @@ -3051,11 +3043,11 @@ done: //------------------------------------------------- render_manager::render_manager(running_machine &machine) - : m_machine(machine), - m_ui_target(nullptr), - m_live_textures(0), - m_texture_id(0), - m_ui_container(global_alloc(render_container(*this))) + : m_machine(machine) + , m_ui_target(nullptr) + , m_live_textures(0) + , m_texture_id(0) + , m_ui_container(new render_container(*this)) { // register callbacks machine.configuration().config_register("video", config_load_delegate(&render_manager::config_load, this), config_save_delegate(&render_manager::config_save, this)); @@ -3093,7 +3085,7 @@ bool render_manager::is_live(screen_device &screen) const if (!target.hidden()) { layout_view const *view = &target.current_view(); - if (view->has_screen(screen)) + if (view->has_visible_screen(screen)) return true; } } @@ -3129,12 +3121,12 @@ float render_manager::max_update_rate() const render_target *render_manager::target_alloc(const internal_layout *layoutfile, u32 flags) { - return &m_targetlist.append(*global_alloc(render_target(*this, layoutfile, flags))); + return &m_targetlist.append(*new render_target(*this, layoutfile, flags)); } render_target *render_manager::target_alloc(util::xml::data_node const &layout, u32 flags) { - return &m_targetlist.append(*global_alloc(render_target(*this, layout, flags))); + return &m_targetlist.append(*new render_target(*this, layout, flags)); } @@ -3251,19 +3243,9 @@ void render_manager::texture_free(render_texture *texture) // font_alloc - allocate a new font instance //------------------------------------------------- -render_font *render_manager::font_alloc(const char *filename) -{ - return global_alloc(render_font(*this, filename)); -} - - -//------------------------------------------------- -// font_free - release a font instance -//------------------------------------------------- - -void render_manager::font_free(render_font *font) +std::unique_ptr<render_font> render_manager::font_alloc(const char *filename) { - global_free(font); + return std::unique_ptr<render_font>(new render_font(*this, filename)); } @@ -3301,7 +3283,7 @@ void render_manager::resolve_tags() render_container *render_manager::container_alloc(screen_device *screen) { - auto container = global_alloc(render_container(*this, screen)); + auto container = new render_container(*this, screen); if (screen != nullptr) m_screen_container_list.append(*container); return container; diff --git a/src/emu/render.h b/src/emu/render.h index 1545a3f041d..41cf1e42e1c 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -46,6 +46,7 @@ #ifndef MAME_EMU_RENDER_H #define MAME_EMU_RENDER_H +#include "rendertypes.h" #include "screen.h" #include <array> @@ -61,29 +62,10 @@ #include <vector> -namespace emu { namespace render { namespace detail { - -class layout_environment; -class view_environment; - -} } } // namespace emu::render::detail - - //************************************************************************** // CONSTANTS //************************************************************************** -// blending modes -enum -{ - BLENDMODE_NONE = 0, // no blending - BLENDMODE_ALPHA, // standard alpha blend - BLENDMODE_RGB_MULTIPLY, // apply source alpha to source pix, then multiply RGB values - BLENDMODE_ADD, // apply source alpha to source pix, then add to destination - - BLENDMODE_COUNT -}; - // render creation flags constexpr u8 RENDER_CREATE_NO_ART = 0x01; // ignore any views that have art in them @@ -174,48 +156,6 @@ constexpr u32 PRIMFLAG_GET_VECTORBUF(u32 x) { return (x & PRIMFLAG_VECTORBUF_MAS // texture scaling callback typedef void (*texture_scaler_func)(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); -// render_bounds - floating point bounding rectangle -struct render_bounds -{ - float x0; // leftmost X coordinate - float y0; // topmost Y coordinate - float x1; // rightmost X coordinate - float y1; // bottommost Y coordinate - - constexpr float width() const { return x1 - x0; } - constexpr float height() const { return y1 - y0; } - constexpr float aspect() const { return width() / height(); } - constexpr bool includes(float x, float y) const { return (x >= x0) && (x <= x1) && (y >= y0) && (y <= y1); } -}; - - -// render_color - floating point set of ARGB values -struct render_color -{ - float a; // alpha component (0.0 = transparent, 1.0 = opaque) - float r; // red component (0.0 = none, 1.0 = max) - float g; // green component (0.0 = none, 1.0 = max) - float b; // blue component (0.0 = none, 1.0 = max) -}; - - -// render_texuv - floating point set of UV texture coordinates -struct render_texuv -{ - float u; // U coordinate (0.0-1.0) - float v; // V coordinate (0.0-1.0) -}; - - -// render_quad_texuv - floating point set of UV texture coordinates -struct render_quad_texuv -{ - render_texuv tl; // top-left UV coordinate - render_texuv tr; // top-right UV coordinate - render_texuv bl; // bottom-left UV coordinate - render_texuv br; // bottom-right UV coordinate -}; - // render_texinfo - texture information struct render_texinfo @@ -232,6 +172,31 @@ struct render_texinfo }; +namespace emu { namespace render { namespace detail { + +struct bounds_step +{ + int state; + render_bounds bounds; + render_bounds delta; +}; +using bounds_vector = std::vector<bounds_step>; + +struct color_step +{ + int state; + render_color color; + render_color delta; +}; +using color_vector = std::vector<color_step>; + + +class layout_environment; +class view_environment; + +} } } // namespace emu::render::detail + + // ======================> render_layer_config // render_layer_config - describes the state of layers @@ -411,8 +376,8 @@ private: // a scaled_texture contains a single scaled entry for a texture struct scaled_texture { - bitmap_argb32 * bitmap; // final bitmap - u32 seqid; // sequence number + std::unique_ptr<bitmap_argb32> bitmap; // final bitmap + u32 seqid; // sequence number }; // internal state @@ -573,7 +538,7 @@ public: using environment = emu::render::detail::layout_environment; // construction/destruction - layout_element(environment &env, util::xml::data_node const &elemnode, const char *dirname); + layout_element(environment &env, util::xml::data_node const &elemnode); virtual ~layout_element(); // getters @@ -581,6 +546,9 @@ public: int default_state() const { return m_defstate; } render_texture *state_texture(int state); + // operations + void preload(); + private: /// \brief An image, rectangle, or disk in an element /// @@ -595,7 +563,7 @@ private: typedef std::unique_ptr<component> ptr; // construction/destruction - component(environment &env, util::xml::data_node const &compnode, const char *dirname); + component(environment &env, util::xml::data_node const &compnode); virtual ~component() = default; // setup @@ -610,11 +578,13 @@ private: render_color color(int state) const; // operations - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) = 0; + virtual void preload(running_machine &machine); + virtual void draw(running_machine &machine, bitmap_argb32 &dest, int state); protected: - // helper - virtual int maxstate() const { return -1; } + // helpers + virtual int maxstate() const; + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); // drawing helpers void draw_text(render_font &font, bitmap_argb32 &dest, const rectangle &bounds, const char *str, int align, const render_color &color); @@ -629,21 +599,8 @@ private: void apply_skew(bitmap_argb32 &dest, int skewwidth); private: - struct bounds_step - { - int state; - render_bounds bounds; - render_bounds delta; - }; - using bounds_vector = std::vector<bounds_step>; - - struct color_step - { - int state; - render_color color; - render_color delta; - }; - using color_vector = std::vector<color_step>; + using bounds_vector = emu::render::detail::bounds_vector; + using color_vector = emu::render::detail::color_vector; // internal state int const m_statemask; // bits of state used to control visibility @@ -685,13 +642,13 @@ private: int m_state; // associated state number }; - typedef component::ptr (*make_component_func)(environment &env, util::xml::data_node const &compnode, const char *dirname); + typedef component::ptr (*make_component_func)(environment &env, util::xml::data_node const &compnode); typedef std::map<std::string, make_component_func> make_component_map; // internal helpers static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); - template <typename T> static component::ptr make_component(environment &env, util::xml::data_node const &compnode, const char *dirname); - template <int D> static component::ptr make_dotmatrix_component(environment &env, util::xml::data_node const &compnode, const char *dirname); + template <typename T> static component::ptr make_component(environment &env, util::xml::data_node const &compnode); + template <int D> static component::ptr make_dotmatrix_component(environment &env, util::xml::data_node const &compnode); static make_component_map const s_make_component; // maps component XML names to creator functions @@ -787,16 +744,16 @@ public: // getters layout_element *element() const { return m_element; } screen_device *screen() { return m_screen; } - const render_bounds &bounds() const { return m_bounds; } - const render_color &color() const { return m_color; } + render_bounds bounds() const; + render_color color() const; int blend_mode() const { return m_blend_mode; } u32 visibility_mask() const { return m_visibility_mask; } int orientation() const { return m_orientation; } - render_container *screen_container(running_machine &machine) const; + render_container *screen_container() const { return m_screen ? &m_screen->container() : nullptr; } // interactivity bool has_input() const { return bool(m_input_port); } - ioport_port *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_port; }; + std::pair<ioport_port *, ioport_value> input_tag_and_mask() const { return std::make_pair(m_input_port, m_input_mask); }; bool clickthrough() const { return m_clickthrough; } // fetch state based on configured source @@ -806,16 +763,30 @@ public: void resolve_tags(); private: + using bounds_vector = emu::render::detail::bounds_vector; + using color_vector = emu::render::detail::color_vector; + + int animation_state() const; + static layout_element *find_element(view_environment &env, util::xml::data_node const &itemnode, element_map &elemmap); - static render_bounds make_bounds(view_environment &env, util::xml::data_node const &itemnode, layout_group::transform const &trans); + static bounds_vector make_bounds(view_environment &env, util::xml::data_node const &itemnode, layout_group::transform const &trans); + static color_vector make_color(view_environment &env, util::xml::data_node const &itemnode, render_color const &mult); + static std::string make_animoutput_tag(view_environment &env, util::xml::data_node const &itemnode); + static std::string make_animinput_tag(view_environment &env, util::xml::data_node const &itemnode); + static ioport_value make_animmask(view_environment &env, util::xml::data_node const &itemnode); static std::string make_input_tag(view_environment &env, util::xml::data_node const &itemnode); static int get_blend_mode(view_environment &env, util::xml::data_node const &itemnode); - static unsigned get_input_shift(ioport_value mask); + static unsigned get_state_shift(ioport_value mask); // internal state layout_element *const m_element; // pointer to the associated element (non-screens only) output_finder<> m_output; // associated output + output_finder<> m_animoutput; // associated output for animation if different bool const m_have_output; // whether we actually have an output + bool const m_have_animoutput; // whether we actually have an output for animation + ioport_port * m_animinput_port; // input port used for animation + ioport_value const m_animmask; // mask for animation state + u8 const m_animshift; // shift for animation state ioport_port * m_input_port; // input port of this item ioport_field const * m_input_field; // input port field of this item ioport_value const m_input_mask; // input mask of this item @@ -824,14 +795,15 @@ public: bool m_clickthrough; // should click pass through to lower elements screen_device * m_screen; // pointer to screen int m_orientation; // orientation of this item - render_bounds m_bounds; // bounds of the item - render_color m_color; // color of the item + bounds_vector m_bounds; // bounds of the item + color_vector const m_color; // color of the item int m_blend_mode; // blending mode to use when drawing u32 m_visibility_mask; // combined mask of parent visibility groups // cold items std::string const m_input_tag; // input tag of this item - render_bounds const m_rawbounds; // raw (original) bounds of the item + std::string const m_animinput_tag; // tag of input port for animation state + bounds_vector const m_rawbounds; // raw (original) bounds of the item bool const m_has_clickthrough; // whether clickthrough was explicitly configured }; using item_list = std::list<item>; @@ -901,22 +873,25 @@ public: // getters item_list &items() { return m_items; } + bool has_screen(screen_device &screen); const std::string &name() const { return m_name; } - size_t screen_count() const { return m_screens.size(); } + size_t visible_screen_count() const { return m_screens.size(); } float effective_aspect() const { return m_effaspect; } const render_bounds &bounds() const { return m_bounds; } - bool has_screen(screen_device &screen) const; - const item_ref_vector &screen_items() const { return m_screen_items; } + bool has_visible_screen(screen_device &screen) const; + const item_ref_vector &visible_items() const { return m_visible_items; } + const item_ref_vector &visible_screen_items() const { return m_screen_items; } const item_ref_vector &interactive_items() const { return m_interactive_items; } const edge_vector &interactive_edges_x() const { return m_interactive_edges_x; } const edge_vector &interactive_edges_y() const { return m_interactive_edges_y; } - const screen_ref_vector &screens() const { return m_screens; } + const screen_ref_vector &visible_screens() const { return m_screens; } const visibility_toggle_vector &visibility_toggles() const { return m_vistoggles; } u32 default_visibility_mask() const { return m_defvismask; } bool has_art() const { return m_has_art; } // operations void recompute(u32 visibility_mask, bool zoom_to_screens); + void preload(); // resolve tags, if any void resolve_tags(); @@ -945,6 +920,7 @@ private: float m_effaspect; // X/Y of the layout in current configuration render_bounds m_bounds; // computed bounds of the view in current configuration item_list m_items; // list of layout items + item_ref_vector m_visible_items; // all visible items item_ref_vector m_screen_items; // visible items that represent screens to draw item_ref_vector m_interactive_items;// visible items that can accept pointer input edge_vector m_interactive_edges_x; @@ -971,7 +947,7 @@ public: using view_list = std::list<layout_view>; // construction/destruction - layout_file(device_t &device, util::xml::data_node const &rootnode, char const *dirname); + layout_file(device_t &device, util::xml::data_node const &rootnode, char const *searchpath, char const *dirname); ~layout_file(); // getters @@ -984,7 +960,6 @@ private: // add elements and parameters void add_elements( - char const *dirname, environment &env, util::xml::data_node const &parentnode, group_map &groupmap, @@ -1093,7 +1068,7 @@ private: void load_additional_layout_files(const char *basename, bool have_artwork); bool load_layout_file(const char *dirname, const char *filename); bool load_layout_file(const char *dirname, const internal_layout &layout_data, device_t *device = nullptr); - bool load_layout_file(device_t &device, const char *dirname, util::xml::data_node const &rootnode); + bool load_layout_file(device_t &device, util::xml::data_node const &rootnode, const char *searchpath, const char *dirname); void add_container_primitives(render_primitive_list &list, const object_transform &root_xform, const object_transform &xform, render_container &container, int blendmode); void add_element_primitives(render_primitive_list &list, const object_transform &xform, layout_element &element, int state, int blendmode); std::pair<float, float> map_point_internal(s32 target_x, s32 target_y); @@ -1192,8 +1167,7 @@ public: void texture_free(render_texture *texture); // fonts - render_font *font_alloc(const char *filename = nullptr); - void font_free(render_font *font); + std::unique_ptr<render_font> font_alloc(const char *filename = nullptr); // reference tracking void invalidate_all(void *refptr); diff --git a/src/emu/rendertypes.h b/src/emu/rendertypes.h new file mode 100644 index 00000000000..0fa698cc931 --- /dev/null +++ b/src/emu/rendertypes.h @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles, Vas Crabb +/*************************************************************************** + + render.h + + Core renderer constants and structures for MAME. + +***************************************************************************/ +#ifndef MAME_EMU_RENDERTYPES_H +#define MAME_EMU_RENDERTYPES_H + +#pragma once + +#include <algorithm> + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + + +// blending modes +enum +{ + BLENDMODE_NONE = 0, // no blending + BLENDMODE_ALPHA, // standard alpha blend + BLENDMODE_RGB_MULTIPLY, // apply source alpha to source pix, then multiply RGB values + BLENDMODE_ADD, // apply source alpha to source pix, then add to destination + + BLENDMODE_COUNT +}; + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// render_bounds - floating point bounding rectangle +struct render_bounds +{ + float x0; // leftmost X coordinate + float y0; // topmost Y coordinate + float x1; // rightmost X coordinate + float y1; // bottommost Y coordinate + + constexpr float width() const { return x1 - x0; } + constexpr float height() const { return y1 - y0; } + constexpr float aspect() const { return width() / height(); } + constexpr bool includes(float x, float y) const { return (x >= x0) && (x <= x1) && (y >= y0) && (y <= y1); } + + // intersection + constexpr render_bounds operator&(render_bounds const &b) const + { + return render_bounds{ (std::max)(x0, b.x0), (std::max)(y0, b.y0), (std::min)(x1, b.x1), (std::min)(y1, b.y1) }; + } + + render_bounds &operator&=(render_bounds const &b) + { + x0 = (std::max)(x0, b.x0); + y0 = (std::max)(y0, b.y0); + x1 = (std::min)(x1, b.x1); + y1 = (std::min)(y1, b.y1); + return *this; + } + + // union + constexpr render_bounds operator|(render_bounds const &b) const + { + return render_bounds{ (std::min)(x0, b.x0), (std::min)(y0, b.y0), (std::max)(x1, b.x1), (std::max)(y1, b.y1) }; + } + + render_bounds &operator|=(render_bounds const &b) + { + x0 = (std::min)(x0, b.x0); + y0 = (std::min)(y0, b.y0); + x1 = (std::max)(x1, b.x1); + y1 = (std::max)(y1, b.y1); + return *this; + } + + render_bounds &set_xy(float left, float top, float right, float bottom) + { + x0 = left; + y0 = top; + x1 = right; + y1 = bottom; + return *this; + } + + render_bounds &set_wh(float left, float top, float width, float height) + { + x0 = left; + y0 = top; + x1 = left + width; + y1 = top + height; + return *this; + } +}; + + +// render_color - floating point set of ARGB values +struct render_color +{ + float a; // alpha component (0.0 = transparent, 1.0 = opaque) + float r; // red component (0.0 = none, 1.0 = max) + float g; // green component (0.0 = none, 1.0 = max) + float b; // blue component (0.0 = none, 1.0 = max) + + constexpr render_color operator*(render_color const &c) const + { + return render_color{ a * c.a, r * c.r, g * c.g, b * c.b }; + } + + render_color &operator*=(render_color const &c) + { + a *= c.a; + r *= c.r; + g *= c.g; + b *= c.b; + return *this; + } + + render_color &set(float alpha, float red, float green, float blue) + { + a = alpha; + r = red; + g = green; + b = blue; + return *this; + } +}; + + +// render_texuv - floating point set of UV texture coordinates +struct render_texuv +{ + float u; // U coordinate (0.0-1.0) + float v; // V coordinate (0.0-1.0) +}; + + +// render_quad_texuv - floating point set of UV texture coordinates +struct render_quad_texuv +{ + render_texuv tl; // top-left UV coordinate + render_texuv tr; // top-right UV coordinate + render_texuv bl; // bottom-left UV coordinate + render_texuv br; // bottom-right UV coordinate +}; + +#endif // MAME_EMU_RENDERTYPES_H diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index 7b69a6e97e5..13249a083fc 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -664,7 +664,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight; - u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; + u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix(desty, 0) : nullptr; { for (int x = 0; x < gl.bmwidth; x++) { @@ -723,7 +723,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; ++y) { int const desty(y + m_height + m_yoffs - gl.yoffs - gl.bmheight); - u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix32(desty) : nullptr); + u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix(desty) : nullptr); if (m_format == format::TEXT) { @@ -1531,7 +1531,7 @@ bool render_font::save_cached(const char *filename, u64 length, u32 hash) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight; - const u32 *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; + u32 const *const src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix(desty) : nullptr; for (int x = 0; x < gl.bmwidth; x++) { if (src != nullptr && rgb_t(src[x]).a() != 0) diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h index aa04a094d75..fc0c4853733 100644 --- a/src/emu/rendfont.h +++ b/src/emu/rendfont.h @@ -27,9 +27,10 @@ class render_font // construction/destruction render_font(render_manager &manager, const char *filename); - virtual ~render_font(); public: + virtual ~render_font(); + // getters render_manager &manager() const { return m_manager; } diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 198fa03998a..1f10941bbab 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -17,6 +17,7 @@ #include "rendutil.h" #include "video/rgbutil.h" +#include "nanosvg.h" #include "vecstream.h" #include "xmlfile.h" @@ -27,6 +28,7 @@ #include <cstdio> #include <cstring> #include <iomanip> +#include <limits> #include <locale> #include <sstream> #include <stdexcept> @@ -36,8 +38,9 @@ #define LOG_GROUP_BOUNDS_RESOLUTION (1U << 1) #define LOG_INTERACTIVE_ITEMS (1U << 2) +#define LOG_IMAGE_LOAD (1U << 3) -//#define VERBOSE (LOG_GROUP_BOUNDS_RESOLUTION | LOG_INTERACTIVE_ITEMS) +//#define VERBOSE (LOG_GROUP_BOUNDS_RESOLUTION | LOG_INTERACTIVE_ITEMS | LOG_IMAGE_LOAD) #define LOG_OUTPUT_FUNC osd_printf_verbose #include "logmacro.h" @@ -77,8 +80,6 @@ enum LINE_CAP_END = 2 }; -std::locale const f_portable_locale("C"); - constexpr layout_group::transform identity_transform{{ {{ 1.0F, 0.0F, 0.0F }}, {{ 0.0F, 1.0F, 0.0F }}, {{ 0.0F, 0.0F, 1.0F }} }}; @@ -96,9 +97,27 @@ inline void render_bounds_transform(render_bounds &bounds, layout_group::transfo (bounds.x1 * trans[1][0]) + (bounds.y1 * trans[1][1]) + trans[1][2] }; } -constexpr render_color render_color_multiply(render_color const &x, render_color const &y) +inline void alpha_blend(u32 &dest, u32 a, u32 r, u32 g, u32 b, u32 inva) { - return render_color{ x.a * y.a, x.r * y.r, x.g * y.g, x.b * y.b }; + rgb_t const dpix(dest); + u32 const da(dpix.a()); + u32 const finala((a * 255) + (da * inva)); + u32 const finalr(r + (u32(dpix.r()) * da * inva)); + u32 const finalg(g + (u32(dpix.g()) * da * inva)); + u32 const finalb(b + (u32(dpix.b()) * da * inva)); + dest = rgb_t(finala / 255, finalr / finala, finalg / finala, finalb / finala); +} + +inline void alpha_blend(u32 &dest, render_color const &c, float fill) +{ + u32 const a(c.a * fill * 255.0F); + if (a) + { + u32 const r(u32(c.r * (255.0F * 255.0F)) * a); + u32 const g(u32(c.g * (255.0F * 255.0F)) * a); + u32 const b(u32(c.b * (255.0F * 255.0F)) * a); + alpha_blend(dest, a, r, g, b, 255 - a); + } } @@ -213,7 +232,7 @@ private: if (m_text_valid && !m_float_valid) { std::istringstream stream(m_text); - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); if (m_text[0] == '$') { stream.get(); @@ -249,7 +268,7 @@ private: if (m_text_valid && !m_int_valid && !m_float_valid) { std::istringstream stream(m_text); - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); if (m_text[0] == '$') { stream.get(); @@ -308,7 +327,7 @@ private: if (m_text_valid && !m_int_valid) { std::istringstream stream(m_text); - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); if (m_text[0] == '$') { stream.get(); @@ -530,7 +549,7 @@ private: int parse_int(char const *begin, char const *end, int defvalue) { std::istringstream stream; - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); int result; if (begin[0] == '$') { @@ -584,25 +603,37 @@ private: entry_vector m_entries; util::ovectorstream m_buffer; + std::shared_ptr<NSVGrasterizer> const m_svg_rasterizer; device_t &m_device; + char const *const m_search_path; + char const *const m_directory_name; layout_environment *const m_next = nullptr; bool m_cached = false; public: - explicit layout_environment(device_t &device) - : m_device(device) + layout_environment(device_t &device, char const *searchpath, char const *dirname) + : m_svg_rasterizer(nsvgCreateRasterizer(), util::nsvg_deleter()) + , m_device(device) + , m_search_path(searchpath) + , m_directory_name(dirname) { } explicit layout_environment(layout_environment &next) - : m_device(next.m_device) + : m_svg_rasterizer(next.m_svg_rasterizer) + , m_device(next.m_device) + , m_search_path(next.m_search_path) + , m_directory_name(next.m_directory_name) , m_next(&next) { } layout_environment(layout_environment const &) = delete; - device_t &device() { return m_device; } - running_machine &machine() { return device().machine(); } - bool is_root_device() { return &device() == &machine().root_device(); } + device_t &device() const { return m_device; } + running_machine &machine() const { return device().machine(); } + bool is_root_device() const { return &device() == &machine().root_device(); } + char const *search_path() const { return m_search_path; } + char const *directory_name() const { return m_directory_name; } + std::shared_ptr<NSVGrasterizer> const &svg_rasterizer() const { return m_svg_rasterizer; } void set_parameter(std::string &&name, std::string &&value) { @@ -660,7 +691,7 @@ public: unsigned const decprefix((expanded.first[0] == '#') ? 1U : 0U); bool const floatchars(std::find_if(expanded.first, expanded.second, [] (char ch) { return ('.' == ch) || ('e' == ch) || ('E' == ch); }) != expanded.second); std::istringstream stream(std::string(expanded.first + hexprefix + decprefix, expanded.second)); - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); if (!hexprefix && !decprefix && floatchars) { stream >> floatincrement; @@ -767,7 +798,7 @@ public: // similar to what XML nodes do std::pair<char const *, char const *> const expanded(expand(attrib)); std::istringstream stream(std::string(expanded.first, expanded.second)); - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); float result; return (stream >> result) ? result : defvalue; } @@ -791,34 +822,44 @@ public: void parse_bounds(util::xml::data_node const *node, render_bounds &result) { - // default to unit rectangle if (!node) { + // default to unit rectangle result.x0 = result.y0 = 0.0F; result.x1 = result.y1 = 1.0F; } else { - // parse attributes + // horizontal position/size if (node->has_attribute("left")) { - // left/right/top/bottom format result.x0 = get_attribute_float(*node, "left", 0.0F); result.x1 = get_attribute_float(*node, "right", 1.0F); - result.y0 = get_attribute_float(*node, "top", 0.0F); - result.y1 = get_attribute_float(*node, "bottom", 1.0F); } - else if (node->has_attribute("x")) + else { - // x/y/width/height format - result.x0 = get_attribute_float(*node, "x", 0.0F); - result.x1 = result.x0 + get_attribute_float(*node, "width", 1.0F); - result.y0 = get_attribute_float(*node, "y", 0.0F); - result.y1 = result.y0 + get_attribute_float(*node, "height", 1.0F); + float const width = get_attribute_float(*node, "width", 1.0F); + if (node->has_attribute("xc")) + result.x0 = get_attribute_float(*node, "xc", 0.0F) - (width / 2.0F); + else + result.x0 = get_attribute_float(*node, "x", 0.0F); + result.x1 = result.x0 + width; + } + + // vertical position/size + if (node->has_attribute("top")) + { + result.y0 = get_attribute_float(*node, "top", 0.0F); + result.y1 = get_attribute_float(*node, "bottom", 1.0F); } else { - throw layout_syntax_error("bounds element requires either left or x attribute"); + float const height = get_attribute_float(*node, "height", 1.0F); + if (node->has_attribute("yc")) + result.y0 = get_attribute_float(*node, "yc", 0.0F) - (height / 2.0F); + else + result.y0 = get_attribute_float(*node, "y", 0.0F); + result.y1 = result.y0 + height; } // check for errors @@ -911,6 +952,175 @@ public: } } } // namespace emu::render::detail +namespace { + +bool add_bounds_step(emu::render::detail::layout_environment &env, emu::render::detail::bounds_vector &steps, util::xml::data_node const &node) +{ + int const state(env.get_attribute_int(node, "state", 0)); + auto const pos( + std::lower_bound( + steps.begin(), + steps.end(), + state, + [] (emu::render::detail::bounds_step const &lhs, int rhs) { return lhs.state < rhs; })); + if ((steps.end() != pos) && (state == pos->state)) + return false; + + auto &ins(*steps.emplace(pos, emu::render::detail::bounds_step{ state, { 0.0F, 0.0F, 0.0F, 0.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } })); + env.parse_bounds(&node, ins.bounds); + return true; +} + +void set_bounds_deltas(emu::render::detail::bounds_vector &steps) +{ + if (steps.empty()) + { + steps.emplace_back(emu::render::detail::bounds_step{ 0, { 0.0F, 0.0F, 1.0F, 1.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } }); + } + else + { + auto i(steps.begin()); + auto j(i); + while (steps.end() != ++j) + { + assert(j->state > i->state); + + i->delta.x0 = (j->bounds.x0 - i->bounds.x0) / (j->state - i->state); + i->delta.x1 = (j->bounds.x1 - i->bounds.x1) / (j->state - i->state); + i->delta.y0 = (j->bounds.y0 - i->bounds.y0) / (j->state - i->state); + i->delta.y1 = (j->bounds.y1 - i->bounds.y1) / (j->state - i->state); + + i = j; + } + } +} + +void normalize_bounds(emu::render::detail::bounds_vector &steps, float x0, float y0, float xoffs, float yoffs, float xscale, float yscale) +{ + auto i(steps.begin()); + i->bounds.x0 = x0 + (i->bounds.x0 - xoffs) * xscale; + i->bounds.x1 = x0 + (i->bounds.x1 - xoffs) * xscale; + i->bounds.y0 = y0 + (i->bounds.y0 - yoffs) * yscale; + i->bounds.y1 = y0 + (i->bounds.y1 - yoffs) * yscale; + + auto j(i); + while (steps.end() != ++j) + { + j->bounds.x0 = x0 + (j->bounds.x0 - xoffs) * xscale; + j->bounds.x1 = x0 + (j->bounds.x1 - xoffs) * xscale; + j->bounds.y0 = y0 + (j->bounds.y0 - yoffs) * yscale; + j->bounds.y1 = y0 + (j->bounds.y1 - yoffs) * yscale; + + i->delta.x0 = (j->bounds.x0 - i->bounds.x0) / (j->state - i->state); + i->delta.x1 = (j->bounds.x1 - i->bounds.x1) / (j->state - i->state); + i->delta.y0 = (j->bounds.y0 - i->bounds.y0) / (j->state - i->state); + i->delta.y1 = (j->bounds.y1 - i->bounds.y1) / (j->state - i->state); + + i = j; + } +} + +render_bounds accumulate_bounds(emu::render::detail::bounds_vector const &steps) +{ + auto i(steps.begin()); + render_bounds result(i->bounds); + while (steps.end() != ++i) + result |= i->bounds; + return result; +} + +inline render_bounds interpolate_bounds(emu::render::detail::bounds_vector const &steps, int state) +{ + auto pos( + std::lower_bound( + steps.begin(), + steps.end(), + state, + [] (emu::render::detail::bounds_step const &lhs, int rhs) { return lhs.state < rhs; })); + if (steps.begin() == pos) + { + return pos->bounds; + } + else + { + --pos; + render_bounds result(pos->bounds); + result.x0 += pos->delta.x0 * (state - pos->state); + result.x1 += pos->delta.x1 * (state - pos->state); + result.y0 += pos->delta.y0 * (state - pos->state); + result.y1 += pos->delta.y1 * (state - pos->state); + return result; + } +} + + +bool add_color_step(emu::render::detail::layout_environment &env, emu::render::detail::color_vector &steps, util::xml::data_node const &node) +{ + int const state(env.get_attribute_int(node, "state", 0)); + auto const pos( + std::lower_bound( + steps.begin(), + steps.end(), + state, + [] (emu::render::detail::color_step const &lhs, int rhs) { return lhs.state < rhs; })); + if ((steps.end() != pos) && (state == pos->state)) + return false; + + steps.emplace(pos, emu::render::detail::color_step{ state, env.parse_color(&node), { 0.0F, 0.0F, 0.0F, 0.0F } }); + return true; +} + +void set_color_deltas(emu::render::detail::color_vector &steps) +{ + if (steps.empty()) + { + steps.emplace_back(emu::render::detail::color_step{ 0, { 1.0F, 1.0F, 1.0F, 1.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } }); + } + else + { + auto i(steps.begin()); + auto j(i); + while (steps.end() != ++j) + { + assert(j->state > i->state); + + i->delta.a = (j->color.a - i->color.a) / (j->state - i->state); + i->delta.r = (j->color.r - i->color.r) / (j->state - i->state); + i->delta.g = (j->color.g - i->color.g) / (j->state - i->state); + i->delta.b = (j->color.b - i->color.b) / (j->state - i->state); + + i = j; + } + } +} + +inline render_color interpolate_color(emu::render::detail::color_vector const &steps, int state) +{ + auto pos( + std::lower_bound( + steps.begin(), + steps.end(), + state, + [] (emu::render::detail::color_step const &lhs, int rhs) { return lhs.state < rhs; })); + if (steps.begin() == pos) + { + return pos->color; + } + else + { + --pos; + render_color result(pos->color); + result.a += pos->delta.a * (state - pos->state); + result.r += pos->delta.r * (state - pos->state); + result.g += pos->delta.g * (state - pos->state); + result.b += pos->delta.b * (state - pos->state); + return result; + } +} + +} // anonymous namespace + + //************************************************************************** // LAYOUT ELEMENT @@ -938,7 +1148,7 @@ layout_element::make_component_map const layout_element::s_make_component{ // layout_element - constructor //------------------------------------------------- -layout_element::layout_element(environment &env, util::xml::data_node const &elemnode, const char *dirname) +layout_element::layout_element(environment &env, util::xml::data_node const &elemnode) : m_machine(env.machine()) , m_defstate(env.get_attribute_int(elemnode, "defstate", -1)) , m_statemask(0) @@ -954,13 +1164,13 @@ layout_element::layout_element(environment &env, util::xml::data_node const &ele throw layout_syntax_error(util::string_format("unknown element component %s", compnode->get_name())); // insert the new component into the list - component const &newcomp(**m_complist.emplace(m_complist.end(), make_func->second(env, *compnode, dirname))); + component const &newcomp(**m_complist.emplace(m_complist.end(), make_func->second(env, *compnode))); // accumulate bounds if (first) bounds = newcomp.overall_bounds(); else - union_render_bounds(bounds, newcomp.overall_bounds()); + bounds |= newcomp.overall_bounds(); first = false; // determine the maximum state @@ -1123,7 +1333,7 @@ void layout_group::resolve_bounds(environment &env, group_map &groupmap, std::ve seen.push_back(this); if (!m_bounds_resolved) { - set_render_bounds_xy(m_bounds, 0.0F, 0.0F, 1.0F, 1.0F); + m_bounds.set_xy(0.0F, 0.0F, 1.0F, 1.0F); environment local(env); bool empty(true); resolve_bounds(local, m_groupnode, groupmap, seen, empty, false, false, true); @@ -1177,11 +1387,22 @@ void layout_group::resolve_bounds( !strcmp(itemnode->get_name(), "marquee")) { render_bounds itembounds; - env.parse_bounds(itemnode->get_child("bounds"), itembounds); + util::xml::data_node const *boundsnode = itemnode->get_child("bounds"); + env.parse_bounds(boundsnode, itembounds); + while (boundsnode) + { + boundsnode = boundsnode->get_next_sibling("bounds"); + if (boundsnode) + { + render_bounds b; + env.parse_bounds(boundsnode, b); + itembounds |= b; + } + } if (empty) m_bounds = itembounds; else - union_render_bounds(m_bounds, itembounds); + m_bounds |= itembounds; empty = false; LOGMASKED(LOG_GROUP_BOUNDS_RESOLUTION, "Accumulate item bounds (%s %s %s %s) -> (%s %s %s %s)\n", itembounds.x0, itembounds.y0, itembounds.x1, itembounds.y1, @@ -1197,7 +1418,7 @@ void layout_group::resolve_bounds( if (empty) m_bounds = itembounds; else - union_render_bounds(m_bounds, itembounds); + m_bounds |= itembounds; empty = false; LOGMASKED(LOG_GROUP_BOUNDS_RESOLUTION, "Accumulate group '%s' reference explicit bounds (%s %s %s %s) -> (%s %s %s %s)\n", itemnode->get_attribute_string("ref", ""), @@ -1225,7 +1446,7 @@ void layout_group::resolve_bounds( if (empty) m_bounds = itembounds; else - union_render_bounds(m_bounds, itembounds); + m_bounds |= itembounds; empty = false; unresolved = false; LOGMASKED(LOG_GROUP_BOUNDS_RESOLUTION, "Accumulate group '%s' reference computed bounds (%s %s %s %s) -> (%s %s %s %s)\n", @@ -1302,6 +1523,18 @@ render_texture *layout_element::state_texture(int state) //------------------------------------------------- +// preload - perform expensive loading upfront +// for all components +//------------------------------------------------- + +void layout_element::preload() +{ + for (component::ptr const &curcomp : m_complist) + curcomp->preload(machine()); +} + + +//------------------------------------------------- // element_scale - scale an element by rendering // all the components at the appropriate // resolution @@ -1311,23 +1544,11 @@ void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, c { texture const &elemtex(*reinterpret_cast<texture const *>(param)); - // iterate over components that are part of the current state + // draw components that are visible in the current state for (auto const &curcomp : elemtex.m_element->m_complist) { if ((elemtex.m_state & curcomp->statemask()) == curcomp->stateval()) - { - // get the local scaled bounds - render_bounds const compbounds(curcomp->bounds(elemtex.m_state)); - rectangle bounds( - render_round_nearest(compbounds.x0 * dest.width()), - render_round_nearest(compbounds.x1 * dest.width()), - render_round_nearest(compbounds.y0 * dest.height()), - render_round_nearest(compbounds.y1 * dest.height())); - bounds &= dest.cliprect(); - - // based on the component type, add to the texture - curcomp->draw(elemtex.m_element->machine(), dest, bounds, elemtex.m_state); - } + curcomp->draw(elemtex.m_element->machine(), dest, elemtex.m_state); } } @@ -1337,54 +1558,46 @@ class layout_element::image_component : public component { public: // construction/destruction - image_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) - , m_dirname(dirname ? dirname : "") + image_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) + , m_rasterizer(env.svg_rasterizer()) + , m_searchpath(env.search_path() ? env.search_path() : "") + , m_dirname(env.directory_name() ? env.directory_name() : "") , m_imagefile(env.get_attribute_string(compnode, "file", "")) , m_alphafile(env.get_attribute_string(compnode, "alphafile", "")) + , m_data(get_data(compnode)) { } -protected: // overrides - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void preload(running_machine &machine) override { - if (!m_bitmap.valid()) - load_bitmap(machine); + if (!m_bitmap.valid() && !m_svg) + load_image(machine); + } +protected: + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, rectangle const &bounds, int state) override + { + if (!m_bitmap.valid() && !m_svg) + load_image(machine); + + if (m_bitmap.valid()) + draw_bitmap(dest, bounds, state); + else if (m_svg) + draw_svg(dest, bounds, state); + } + +private: + // internal helpers + void draw_bitmap(bitmap_argb32 &dest, rectangle const &bounds, int state) + { render_color const c(color(state)); if (m_hasalpha || (1.0F > c.a)) { bitmap_argb32 tempbitmap(dest.width(), dest.height()); render_resample_argb_bitmap_hq(tempbitmap, m_bitmap, c); - for (s32 y0 = 0, y1 = bounds.top(); bounds.bottom() >= y1; ++y0, ++y1) - { - u32 const *src(&tempbitmap.pix(y0, 0)); - u32 *dst(&dest.pix(y1, bounds.left())); - for (s32 x1 = bounds.left(); bounds.right() >= x1; ++x1, ++src, ++dst) - { - rgb_t const a(*src); - u32 const aa(a.a()); - if (aa) - { - rgb_t const b(*dst); - u32 const ba(b.a()); - if (ba) - { - u32 const ca((aa * 255) + (ba * (255 - aa))); - *dst = rgb_t( - u8(ca / 255), - u8(((a.r() * aa * 255) + (b.r() * ba * (255 - aa))) / ca), - u8(((a.g() * aa * 255) + (b.g() * ba * (255 - aa))) / ca), - u8(((a.b() * aa * 255) + (b.b() * ba * (255 - aa))) / ca)); - } - else - { - *dst = *src; - } - } - } - } + alpha_blend(tempbitmap, dest, bounds); } else { @@ -1393,57 +1606,362 @@ protected: } } -private: - // internal helpers - void load_bitmap(running_machine &machine) + void draw_svg(bitmap_argb32 &dest, rectangle const &bounds, int state) { - emu_file file(machine.options().art_path(), OPEN_FLAG_READ); + // rasterise into a temporary bitmap + float const xscale(bounds.width() / m_svg->width); + float const yscale(bounds.height() / m_svg->height); + float const drawscale((std::max)(xscale, yscale)); + bitmap_argb32 tempbitmap(int(m_svg->width * drawscale), int(m_svg->height * drawscale)); + nsvgRasterize( + m_rasterizer.get(), + m_svg.get(), + 0, 0, drawscale, + reinterpret_cast<unsigned char *>(&tempbitmap.pix(0)), + tempbitmap.width(), tempbitmap.height(), + tempbitmap.rowbytes()); + + // correct colour format and multiply by state colour + bool havealpha(false); + render_color const c(color(state)); + for (s32 y = 0; tempbitmap.height() > y; ++y) + { + u32 *dst(&tempbitmap.pix(y)); + for (s32 x = 0; tempbitmap.width() > x; ++x, ++dst) + { + u8 const *const src(reinterpret_cast<u8 const *>(dst)); + rgb_t const d( + u8((float(src[3]) * c.a) + 0.5), + u8((float(src[0]) * c.r) + 0.5), + u8((float(src[1]) * c.g) + 0.5), + u8((float(src[2]) * c.b) + 0.5)); + *dst = d; + havealpha = havealpha || (d.a() < 255U); + } + } - ru_imgformat const format = render_detect_image(file, m_dirname.c_str(), m_imagefile.c_str()); - switch (format) + // find most efficient way to insert it in the target bitmap + if (!havealpha) { - case RENDUTIL_IMGFORMAT_ERROR: - break; + if ((tempbitmap.width() == bounds.width()) && (tempbitmap.height() == bounds.height())) + { + for (s32 y = 0; tempbitmap.height() > y; ++y) + std::copy_n(&tempbitmap.pix(y), bounds.width(), &dest.pix(y + bounds.top(), bounds.left())); + } + else + { + bitmap_argb32 destsub(dest, bounds); + render_resample_argb_bitmap_hq(destsub, tempbitmap, render_color{ 1.0F, 1.0F, 1.0F, 1.0F }); + } + } + else if ((tempbitmap.width() == bounds.width()) && (tempbitmap.height() == bounds.height())) + { + alpha_blend(tempbitmap, dest, bounds); + } + else + { + bitmap_argb32 scaled(bounds.width(), bounds.height()); + render_resample_argb_bitmap_hq(scaled, tempbitmap, render_color{ 1.0F, 1.0F, 1.0F, 1.0F }); + tempbitmap.reset(); + alpha_blend(scaled, dest, bounds); + } + } - case RENDUTIL_IMGFORMAT_PNG: - // load the basic bitmap - m_hasalpha = render_load_png(m_bitmap, file, m_dirname.c_str(), m_imagefile.c_str()); - break; + void alpha_blend(bitmap_argb32 const &srcbitmap, bitmap_argb32 &dstbitmap, rectangle const &bounds) + { + for (s32 y0 = 0, y1 = bounds.top(); bounds.bottom() >= y1; ++y0, ++y1) + { + u32 const *src(&srcbitmap.pix(y0, 0)); + u32 *dst(&dstbitmap.pix(y1, bounds.left())); + for (s32 x1 = bounds.left(); bounds.right() >= x1; ++x1, ++src, ++dst) + { + rgb_t const a(*src); + u32 const aa(a.a()); + if (255 == aa) + { + *dst = *src; + } + else if (aa) + { + rgb_t const b(*dst); + u32 const ba(b.a()); + if (ba) + { + u32 const ca((aa * 255) + (ba * (255 - aa))); + *dst = rgb_t( + u8(ca / 255), + u8(((a.r() * aa * 255) + (b.r() * ba * (255 - aa))) / ca), + u8(((a.g() * aa * 255) + (b.g() * ba * (255 - aa))) / ca), + u8(((a.b() * aa * 255) + (b.b() * ba * (255 - aa))) / ca)); + } + else + { + *dst = *src; + } + } + } + } + } - default: - // try JPG - render_load_jpeg(m_bitmap, file, m_dirname.c_str(), m_imagefile.c_str()); - break; + void load_image(running_machine &machine) + { + // if we have a filename, go with that + emu_file file(m_searchpath.empty() ? m_dirname : m_searchpath, OPEN_FLAG_READ); + if (!m_imagefile.empty()) + { + std::string filename; + if (!m_searchpath.empty()) + filename = m_dirname; + if (!filename.empty() && !util::is_directory_separator(filename[filename.size() - 1])) + filename.append(PATH_SEPARATOR); + filename.append(m_imagefile); + LOGMASKED(LOG_IMAGE_LOAD, "Image component attempt to load image file '%s'\n", filename); + osd_file::error const imgerr = file.open(filename); + if (osd_file::error::NONE == imgerr) + { + if (!load_bitmap(file)) + { + LOGMASKED(LOG_IMAGE_LOAD, "Image component will attempt to parse file as SVG\n"); + load_svg(file); + } + file.close(); + } + else + { + LOGMASKED(LOG_IMAGE_LOAD, "Image component unable to open image file '%s'\n", filename); + } + } + else if (!m_data.empty()) + { + load_image_data(); } // load the alpha bitmap if specified - if (m_bitmap.valid() && !m_alphafile.empty()) - render_load_png(m_bitmap, file, m_dirname.c_str(), m_alphafile.c_str(), true); + if (!m_alphafile.empty()) + { + if (m_bitmap.valid()) + { + std::string filename; + if (!m_searchpath.empty()) + filename = m_dirname; + if (!filename.empty() && !util::is_directory_separator(filename[filename.size() - 1])) + filename.append(PATH_SEPARATOR); + filename.append(m_alphafile); + LOGMASKED(LOG_IMAGE_LOAD, "Image component attempt to load alpha channel from file '%s'\n", filename); + osd_file::error const alferr = file.open(filename); + if (osd_file::error::NONE == alferr) + { + // TODO: no way to detect corner case where we had alpha from the image but the alpha PNG makes it entirely opaque + if (render_load_png(m_bitmap, file, true)) + m_hasalpha = true; + file.close(); + } + else + { + LOGMASKED(LOG_IMAGE_LOAD, "Image component unable to open alpha channel file '%s'\n", filename); + } + } + else if (m_svg) + { + osd_printf_warning("Component alpha channel file '%s' ignored for SVG image '%s'\n", m_alphafile, m_imagefile); + } + } - // if we can't load the bitmap, allocate a dummy one and report an error - if (!m_bitmap.valid()) + // if we can't load an image, allocate a dummy one and report an error + if (!m_bitmap.valid() && !m_svg) { // draw some stripes in the bitmap m_bitmap.allocate(100, 100); m_bitmap.fill(0); for (int step = 0; step < 100; step += 25) for (int line = 0; line < 100; line++) - m_bitmap.pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); + m_bitmap.pix((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); // log an error if (m_alphafile.empty()) - osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile); + osd_printf_warning("Unable to load component image '%s'\n", m_imagefile); else - osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile, m_alphafile); + osd_printf_warning("Unable to load component image '%s'/'%s'\n", m_imagefile, m_alphafile); } + + // clear out this stuff in case it's large + if (!m_svg) + m_rasterizer.reset(); + m_searchpath.clear(); + m_dirname.clear(); + m_imagefile.clear(); + m_alphafile.clear(); + m_data.clear(); + } + + void load_image_data() + { + // in-place Base64 decode + static constexpr char base64chars[] = + "\t\n\v\f\r +/0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + static constexpr char base64tail[] = + "\t\n\v\f\r ="; + std::string::size_type const tail(m_data.find_first_not_of(base64chars)); + std::string::size_type const end(m_data.find_first_not_of(base64tail, tail)); + if (std::string::npos == end) + { + LOGMASKED(LOG_IMAGE_LOAD, "Image component decoding Base64 image data\n"); + char *dst(&m_data[0]); + unsigned trailing(0U); + for (std::string::size_type i = 0U; (m_data.size() > i) && ('=' != m_data[i]); ++i) + { + u8 sym; + if (('A' <= m_data[i]) && ('Z' >= m_data[i])) + sym = m_data[i] - 'A'; + else if (('a' <= m_data[i]) && ('z' >= m_data[i])) + sym = m_data[i] - 'a' + 26; + else if (('0' <= m_data[i]) && ('9' >= m_data[i])) + sym = m_data[i] - '0' + 52; + else if ('+' == m_data[i]) + sym = 62; + else if ('/' == m_data[i]) + sym = 63; + else + continue; + if (trailing) + *dst |= (sym << 2) >> trailing; + else + *dst = sym << 2; + if (trailing >= 2U) + ++dst; + trailing = (trailing + 6U) & 7U; + if (trailing) + *dst = sym << (8U - trailing); + } + m_data.resize(dst - &m_data[0]); + } + + // make a file wrapper for the data and see if it looks like a bitmap + util::core_file::ptr file; + osd_file::error const filerr(util::core_file::open_ram(m_data.c_str(), m_data.size(), OPEN_FLAG_READ, file)); + bool const bitmapdata((osd_file::error::NONE == filerr) && file && load_bitmap(*file)); + file.reset(); + + // if it didn't look like a bitmap, see if it looks like it might be XML and hence SVG + if (!bitmapdata) + { + bool const utf16be((0xfe == u8(m_data[0])) && (0xff == u8(m_data[1]))); + bool const utf16le((0xff == u8(m_data[0])) && (0xfe == u8(m_data[1]))); + bool const utf8((0xef == u8(m_data[0])) && (0xbb == u8(m_data[1])) && (0xbf == u8(m_data[2]))); + std::string::size_type const found(m_data.find_first_not_of("\t\n\v\f\r ")); + bool const xmltag((std::string::npos != found) && ('<' == m_data[found])); + if (utf16be || utf16le || utf8 || xmltag) + { + LOGMASKED(LOG_IMAGE_LOAD, "Image component will attempt to parse data as SVG\n"); + parse_svg(&m_data[0]); + } + } + } + + bool load_bitmap(util::core_file &file) + { + ru_imgformat const format = render_detect_image(file); + switch (format) + { + case RENDUTIL_IMGFORMAT_ERROR: + LOGMASKED(LOG_IMAGE_LOAD, "Image component error detecting image file format\n"); + return false; + + case RENDUTIL_IMGFORMAT_PNG: + LOGMASKED(LOG_IMAGE_LOAD, "Image component detected PNG file format\n"); + m_hasalpha = render_load_png(m_bitmap, file); + return true; + + case RENDUTIL_IMGFORMAT_JPEG: + LOGMASKED(LOG_IMAGE_LOAD, "Image component detected JPEG file format\n"); + render_load_jpeg(m_bitmap, file); + return true; + + case RENDUTIL_IMGFORMAT_MSDIB: + LOGMASKED(LOG_IMAGE_LOAD, "Image component detected Microsoft DIB file format\n"); + render_load_msdib(m_bitmap, file); + return true; + + default: + LOGMASKED(LOG_IMAGE_LOAD, "Image component failed to detect bitmap file format\n"); + return false; + } + } + + void load_svg(util::core_file &file) + { + u64 len(file.size()); + if ((std::numeric_limits<size_t>::max() - 1) < len) + { + osd_printf_warning("Component image '%s' is too large to read into memory\n", m_imagefile); + return; + } + std::unique_ptr<char []> svgbuf(new (std::nothrow) char [size_t(len) + 1]); + if (!svgbuf) + { + osd_printf_warning("Error allocating memory to read component image '%s'\n", m_imagefile); + return; + } + svgbuf[len] = '\0'; + for (char *ptr = svgbuf.get(); len; ) + { + u32 const block(u32(std::min<u64>(std::numeric_limits<u32>::max(), len))); + u32 const read(file.read(ptr, block)); + if (!read) + { + osd_printf_warning("Error reading component image '%s'\n", m_imagefile); + return; + } + ptr += read; + len -= read; + } + parse_svg(svgbuf.get()); + } + + void parse_svg(char *svgdata) + { + if (!m_rasterizer) + { + osd_printf_warning("No SVG rasteriser available, won't attempt to parse component image '%s' as SVG\n", m_imagefile); + return; + } + m_svg.reset(nsvgParse(svgdata, "px", 72)); + if (!m_svg) + { + osd_printf_warning("Failed to parse component image '%s' as SVG\n", m_imagefile); + return; + } + if ((0.0F >= m_svg->width) || (0.0F >= m_svg->height)) + { + osd_printf_warning("Parsing component image '%s' as SVG produced empty image\n", m_imagefile); + m_svg.reset(); + return; + } + } + + static std::string get_data(util::xml::data_node const &compnode) + { + util::xml::data_node const *datanode(compnode.get_child("data")); + if (datanode && datanode->get_value()) + return datanode->get_value(); + else + return ""; } // internal state - bitmap_argb32 m_bitmap; // source bitmap for images - std::string const m_dirname; // directory name of image file (for lazy loading) - std::string const m_imagefile; // name of the image file (for lazy loading) - std::string const m_alphafile; // name of the alpha file (for lazy loading) - bool m_hasalpha = false; // is there any alpha component present? + util::nsvg_image_ptr m_svg; // parsed SVG image + std::shared_ptr<NSVGrasterizer> m_rasterizer; // SVG rasteriser + bitmap_argb32 m_bitmap; // source bitmap for images + bool m_hasalpha = false; // is there any alpha component present? + + // cold state + std::string m_searchpath; // asset search path (for lazy loading) + std::string m_dirname; // directory name of image file (for lazy loading) + std::string m_imagefile; // name of the image file (for lazy loading) + std::string m_alphafile; // name of the alpha file (for lazy loading) + std::string m_data; // embedded image data }; @@ -1452,42 +1970,39 @@ class layout_element::rect_component : public component { public: // construction/destruction - rect_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + rect_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } protected: // overrides - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { - // compute premultiplied colors - render_color const c = color(state); - u32 const r = c.r * c.a * 255.0f; - u32 const g = c.g * c.a * 255.0f; - u32 const b = c.b * c.a * 255.0f; - u32 const inva = (1.0f - c.a) * 255.0f; - - // iterate over X and Y - for (u32 y = bounds.top(); y <= bounds.bottom(); y++) + render_color const c(color(state)); + if (1.0f <= c.a) { - for (u32 x = bounds.left(); x <= bounds.right(); x++) + // optimise opaque pixels + u32 const f(rgb_t(u8(c.r * 255), u8(c.g * 255), u8(c.b * 255))); + s32 const width(bounds.width()); + for (u32 y = bounds.top(); y <= bounds.bottom(); ++y) + std::fill_n(&dest.pix(y, bounds.left()), width, f); + } + else if (c.a) + { + // compute premultiplied colors + u32 const a(c.a * 255.0F); + u32 const r(u32(c.r * (255.0F * 255.0F)) * a); + u32 const g(u32(c.g * (255.0F * 255.0F)) * a); + u32 const b(u32(c.b * (255.0F * 255.0F)) * a); + u32 const inva(255 - a); + + // we're translucent, add in the destination pixel contribution + for (u32 y = bounds.top(); y <= bounds.bottom(); ++y) { - u32 finalr = r; - u32 finalg = g; - u32 finalb = b; - - // if we're translucent, add in the destination pixel contribution - if (inva > 0) - { - rgb_t dpix = dest.pix32(y, x); - finalr += (dpix.r() * inva) >> 8; - finalg += (dpix.g() * inva) >> 8; - finalb += (dpix.b() * inva) >> 8; - } - - // store the target pixel, dividing the RGBA values by the overall scale factor - dest.pix32(y, x) = rgb_t(finalr, finalg, finalb); + u32 *dst(&dest.pix(y, bounds.left())); + for (u32 x = bounds.left(); x <= bounds.right(); ++x, ++dst) + alpha_blend(*dst, a, r, g, b, inva); } } } @@ -1499,60 +2014,261 @@ class layout_element::disk_component : public component { public: // construction/destruction - disk_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + disk_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } -protected: // overrides - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw(running_machine &machine, bitmap_argb32 &dest, int state) override { - // compute premultiplied colors + // compute premultiplied color render_color const c(color(state)); - u32 const r = c.r * c.a * 255.0f; - u32 const g = c.g * c.a * 255.0f; - u32 const b = c.b * c.a * 255.0f; - u32 const inva = (1.0f - c.a) * 255.0f; - - // find the center - float const xcenter = float(bounds.xcenter()); - float const ycenter = float(bounds.ycenter()); - float const xradius = float(bounds.width()) * 0.5f; - float const yradius = float(bounds.height()) * 0.5f; - float const ooyradius2 = 1.0f / (yradius * yradius); - - // iterate over y - for (u32 y = bounds.top(); y <= bounds.bottom(); y++) - { - float ycoord = ycenter - (float(y) + 0.5f); - float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2); + u32 const f(rgb_t(u8(c.r * 255), u8(c.g * 255), u8(c.b * 255))); + u32 const a(c.a * 255.0F); + u32 const r(c.r * c.a * (255.0F * 255.0F * 255.0F)); + u32 const g(c.g * c.a * (255.0F * 255.0F * 255.0F)); + u32 const b(c.b * c.a * (255.0F * 255.0F * 255.0F)); + u32 const inva(255 - a); + if (!a) + return; - // compute left/right coordinates - s32 left = s32(xcenter - xval + 0.5f); - s32 right = s32(xcenter + xval + 0.5f); + // calculate the position and size + render_bounds const curbounds = bounds(state); + float const xcenter = (curbounds.x0 + curbounds.x1) * float(dest.width()) * 0.5F; + float const ycenter = (curbounds.y0 + curbounds.y1) * float(dest.height()) * 0.5F; + float const xradius = curbounds.width() * float(dest.width()) * 0.5F; + float const yradius = curbounds.height() * float(dest.height()) * 0.5F; + s32 const miny = s32(curbounds.y0 * float(dest.height())); + s32 const maxy = s32(std::ceil(curbounds.y1 * float(dest.height()))) - 1; - // draw this scanline - for (u32 x = left; x < right; x++) + if (miny == maxy) + { + // fits in a single row of pixels - integrate entire area of ellipse + float const scale = xradius * yradius * 0.5F; + s32 const minx = s32(curbounds.x0 * float(dest.width())); + s32 const maxx = s32(std::ceil(curbounds.x1 * float(dest.width()))) - 1; + float x1 = (float(minx) - xcenter) / xradius; + u32 *dst = &dest.pix(miny, minx); + for (s32 x = minx; maxx >= x; ++x, ++dst) { - u32 finalr = r; - u32 finalg = g; - u32 finalb = b; + float const x0 = x1; + x1 = (float(x + 1) - xcenter) / xradius; + float const val = integral((std::max)(x0, -1.0F), (std::min)(x1, 1.0F)) * scale; + alpha_blend(*dst, c, val); + } + } + else + { + float const scale = xradius * yradius * 0.25F; + float const ooyradius2 = 1.0F / (yradius * yradius); + auto const draw_edge_row = + [&dest, &c, &curbounds, xcenter, xradius, scale, ooyradius2] (s32 row, float ycoord, bool cross_axis) + { + float const xval = xradius * std::sqrt((std::max)(1.0F - (ycoord * ycoord) * ooyradius2, 0.0F)); + float const l = xcenter - xval; + float const r = xcenter + xval; + if (!cross_axis) + { + s32 minx = s32(l); + s32 maxx = s32(std::ceil(r)) - 1; + float x1 = float(minx) - xcenter; + u32 *dst = &dest.pix(row, minx); + for (s32 x = minx; maxx >= x; ++x, ++dst) + { + float const x0 = x1; + x1 = float(x + 1) - xcenter; + float val = integral((std::max)(x0, -xval) / xradius, (std::min)(x1, xval) / xradius) * scale; + val -= ((std::min)(float(x + 1), r) - (std::max)(float(x), l)) * ycoord; + alpha_blend(*dst, c, val); + } + } + else + { + s32 const minx = s32(curbounds.x0 * float(dest.width())); + s32 const maxx = s32(std::ceil(curbounds.x1 * float(dest.width()))) - 1; + float x1 = (float(minx) - xcenter) / xradius; + u32 *dst = &dest.pix(row, minx); + for (s32 x = minx; maxx >= x; ++x, ++dst) + { + float const x0 = x1; + x1 = (float(x + 1) - xcenter) / xradius; + float val = integral((std::max)(x0, -1.0F), (std::min)(x1, 1.0F)); + if (float(x + 1) <= l) + val += integral((std::max)(x0, -1.0F), x1); + else if (float(x) <= l) + val += integral((std::max)(x0, -1.0F), -xval / xradius); + if (float(x) >= r) + val += integral(x0, (std::min)(x1, 1.0F)); + else if (float(x + 1) >= r) + val += integral(xval / xradius, (std::min)(x1, 1.0F)); + val *= scale; + val -= (std::max)(((std::min)(float(x + 1), r) - (std::max)(float(x), l)), 0.0F) * ycoord; + alpha_blend(*dst, c, val); + } + } + }; + + // draw the top row - in a thin ellipse it may extend below the axis + draw_edge_row(miny, ycenter - float(miny + 1), float(miny + 1) > ycenter); + + // draw rows above the axis + s32 y = miny + 1; + float ycoord1 = ycenter - float(y); + float xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F)); + float l1 = xcenter - xval1; + float r1 = xcenter + xval1; + for ( ; (maxy > y) && (float(y + 1) <= ycenter); ++y) + { + float const l0 = l1; + float const r0 = r1; + ycoord1 = ycenter - float(y + 1); + xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F)); + l1 = xcenter - xval1; + r1 = xcenter + xval1; + s32 minx = int(l1); + s32 maxx = int(std::ceil(r1)) - 1; + u32 *dst = &dest.pix(y, minx); + for (s32 x = minx; maxx >= x; ++x, ++dst) + { + if ((float(x) >= l0) && (float(x + 1) <= r0)) + { + if (255 <= a) + *dst = f; + else + alpha_blend(*dst, a, r, g, b, inva); + } + else + { + float val = 0.0F; + if (float(x + 1) <= l0) + val += integral((xcenter - float(x + 1)) / xradius, (xcenter - (std::max)(float(x), l1)) / xradius); + else if (float(x) <= l0) + val += integral((xcenter - l0) / xradius, (xcenter - (std::max)(float(x), l1)) / xradius); + else if (float(x) >= r0) + val += integral((float(x) - xcenter) / xradius, ((std::min)(float(x + 1), r1) - xcenter) / xradius); + else if (float(x + 1) >= r0) + val += integral((r0 - xcenter) / xradius, ((std::min)(float(x + 1), r1) - xcenter) / xradius); + val *= scale; + if (float(x) <= l0) + val -= ((std::min)(float(x + 1), l0) - (std::max)(float(x), l1)) * ycoord1; + else if (float(x + 1) >= r0) + val -= ((std::min)(float(x + 1), r1) - (std::max)(float(x), r0)) * ycoord1; + val += (std::max)((std::min)(float(x + 1), r0) - (std::max)(float(x), l0), 0.0F); + alpha_blend(*dst, c, val); + } + } + } - // if we're translucent, add in the destination pixel contribution - if (inva > 0) + // row spanning the axis + if ((maxy > y) && (float(y) < ycenter)) + { + float const l0 = l1; + float const r0 = r1; + ycoord1 = float(y + 1) - ycenter; + xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F)); + l1 = xcenter - xval1; + r1 = xcenter + xval1; + s32 const minx = int(curbounds.x0 * float(dest.width())); + s32 const maxx = int(std::ceil(curbounds.x1 * float(dest.width()))) - 1; + u32 *dst = &dest.pix(y, minx); + for (s32 x = minx; maxx >= x; ++x, ++dst) { - rgb_t dpix = dest.pix32(y, x); - finalr += (dpix.r() * inva) >> 8; - finalg += (dpix.g() * inva) >> 8; - finalb += (dpix.b() * inva) >> 8; + if ((float(x) >= (std::max)(l0, l1)) && (float(x + 1) <= (std::min)(r0, r1))) + { + if (255 <= a) + *dst = f; + else + alpha_blend(*dst, a, r, g, b, inva); + } + else + { + float val = 0.0F; + if (float(x + 1) <= l0) + val += integral((xcenter - float(x + 1)) / xradius, (std::min)((xcenter - float(x)) / xradius, 1.0F)); + else if (float(x) <= l0) + val += integral((xcenter - l0) / xradius, (std::min)((xcenter - float(x)) / xradius, 1.0F)); + else if (float(x) >= r0) + val += integral((float(x) - xcenter) / xradius, (std::min)((float(x + 1) - xcenter) / xradius, 1.0F)); + else if (float(x + 1) >= r0) + val += integral((r0 - xcenter) / xradius, (std::min)((float(x + 1) - xcenter) / xradius, 1.0F)); + if (float(x + 1) <= l1) + val += integral((xcenter - float(x + 1)) / xradius, (std::min)((xcenter - float(x)) / xradius, 1.0F)); + else if (float(x) <= l1) + val += integral((xcenter - l1) / xradius, (std::min)((xcenter - float(x)) / xradius, 1.0F)); + else if (float(x) >= r1) + val += integral((float(x) - xcenter) / xradius, (std::min)((float(x + 1) - xcenter) / xradius, 1.0F)); + else if (float(x + 1) >= r1) + val += integral((r1 - xcenter) / xradius, (std::min)((float(x + 1) - xcenter) / xradius, 1.0F)); + val *= scale; + val += (std::max)(((std::min)(float(x + 1), r0) - (std::max)(float(x), l0)), 0.0F) * (ycenter - float(y)); + val += (std::max)(((std::min)(float(x + 1), r1) - (std::max)(float(x), l1)), 0.0F) * (float(y + 1) - ycenter); + alpha_blend(*dst, c, val); + } } + ++y; + } - // store the target pixel, dividing the RGBA values by the overall scale factor - dest.pix32(y, x) = rgb_t(finalr, finalg, finalb); + // draw rows below the axis + for ( ; maxy > y; ++y) + { + float const ycoord0 = ycoord1; + float const l0 = l1; + float const r0 = r1; + ycoord1 = float(y + 1) - ycenter; + xval1 = xradius * std::sqrt((std::max)(1.0F - (ycoord1 * ycoord1) * ooyradius2, 0.0F)); + l1 = xcenter - xval1; + r1 = xcenter + xval1; + s32 minx = int(l0); + s32 maxx = int(std::ceil(r0)) - 1; + u32 *dst = &dest.pix(y, minx); + for (s32 x = minx; maxx >= x; ++x, ++dst) + { + if ((float(x) >= l1) && (float(x + 1) <= r1)) + { + if (255 <= a) + *dst = f; + else + alpha_blend(*dst, a, r, g, b, inva); + } + else + { + float val = 0.0F; + if (float(x + 1) <= l1) + val += integral((xcenter - float(x + 1)) / xradius, (xcenter - (std::max)(float(x), l0)) / xradius); + else if (float(x) <= l1) + val += integral((xcenter - l1) / xradius, (xcenter - (std::max)(float(x), l0)) / xradius); + else if (float(x) >= r1) + val += integral((float(x) - xcenter) / xradius, ((std::min)(float(x + 1), r0) - xcenter) / xradius); + else if (float(x + 1) >= r1) + val += integral((r1 - xcenter) / xradius, ((std::min)(float(x + 1), r0) - xcenter) / xradius); + val *= scale; + if (float(x) <= l1) + val -= ((std::min)(float(x + 1), l1) - (std::max)(float(x), l0)) * ycoord0; + else if (float(x + 1) >= r1) + val -= ((std::min)(float(x + 1), r0) - (std::max)(float(x), r1)) * ycoord0; + val += (std::max)((std::min)(float(x + 1), r1) - (std::max)(float(x), l1), 0.0F); + alpha_blend(*dst, c, val); + } + } } + + // last row is an inversion of the first + draw_edge_row(maxy, float(maxy) - ycenter, float(maxy) < ycenter); } } + +private: + static float integral(float x0, float x1) + { + return integral(x1) - integral(x0); + } + + static float integral(float x) + { + float const u(2.0F * std::asin(x)); + return u + std::sin(u); + }; }; @@ -1561,8 +2277,8 @@ class layout_element::text_component : public component { public: // construction/destruction - text_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + text_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { m_string = env.get_attribute_string(compnode, "string", ""); m_textalign = env.get_attribute_int(compnode, "align", 0); @@ -1570,11 +2286,10 @@ public: protected: // overrides - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { - render_font *font = machine.render().font_alloc("default"); + auto font = machine.render().font_alloc("default"); draw_text(*font, dest, bounds, m_string.c_str(), m_textalign, color(state)); - machine.render().font_free(font); } private: @@ -1589,8 +2304,8 @@ class layout_element::led7seg_component : public component { public: // construction/destruction - led7seg_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + led7seg_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } @@ -1598,7 +2313,7 @@ protected: // overrides virtual int maxstate() const override { return 255; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); @@ -1651,8 +2366,8 @@ class layout_element::led8seg_gts1_component : public component { public: // construction/destruction - led8seg_gts1_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + led8seg_gts1_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } @@ -1660,7 +2375,7 @@ protected: // overrides virtual int maxstate() const override { return 255; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); @@ -1719,8 +2434,8 @@ class layout_element::led14seg_component : public component { public: // construction/destruction - led14seg_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + led14seg_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } @@ -1728,7 +2443,7 @@ protected: // overrides virtual int maxstate() const override { return 16383; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); @@ -1831,8 +2546,8 @@ class layout_element::led16seg_component : public component { public: // construction/destruction - led16seg_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + led16seg_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } @@ -1840,7 +2555,7 @@ protected: // overrides virtual int maxstate() const override { return 65535; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); const rgb_t offpen = rgb_t(0x20, 0xff, 0xff, 0xff); @@ -1953,8 +2668,8 @@ class layout_element::led14segsc_component : public component { public: // construction/destruction - led14segsc_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + led14segsc_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } @@ -1962,7 +2677,7 @@ protected: // overrides virtual int maxstate() const override { return 65535; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); @@ -2076,8 +2791,8 @@ class layout_element::led16segsc_component : public component { public: // construction/destruction - led16segsc_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + led16segsc_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) { } @@ -2085,7 +2800,7 @@ protected: // overrides virtual int maxstate() const override { return 262143; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { rgb_t const onpen = rgb_t(0xff, 0xff, 0xff, 0xff); rgb_t const offpen = rgb_t(0x20, 0xff, 0xff, 0xff); @@ -2208,8 +2923,8 @@ class layout_element::dotmatrix_component : public component { public: // construction/destruction - dotmatrix_component(int dots, environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + dotmatrix_component(int dots, environment &env, util::xml::data_node const &compnode) + : component(env, compnode) , m_dots(dots) { } @@ -2218,7 +2933,7 @@ protected: // overrides virtual int maxstate() const override { return (1 << m_dots) - 1; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); @@ -2249,8 +2964,8 @@ class layout_element::simplecounter_component : public component { public: // construction/destruction - simplecounter_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + simplecounter_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) , m_digits(env.get_attribute_int(compnode, "digits", 2)) , m_textalign(env.get_attribute_int(compnode, "align", 0)) , m_maxstate(env.get_attribute_int(compnode, "maxstate", 999)) @@ -2261,11 +2976,10 @@ protected: // overrides virtual int maxstate() const override { return m_maxstate; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { - render_font *const font = machine.render().font_alloc("default"); + auto font = machine.render().font_alloc("default"); draw_text(*font, dest, bounds, string_format("%0*d", m_digits, state).c_str(), m_textalign, color(state)); - machine.render().font_free(font); } private: @@ -2283,49 +2997,30 @@ class layout_element::reel_component : public component public: // construction/destruction - reel_component(environment &env, util::xml::data_node const &compnode, const char *dirname) - : component(env, compnode, dirname) + reel_component(environment &env, util::xml::data_node const &compnode) + : component(env, compnode) + , m_searchpath(env.search_path() ? env.search_path() : "") + , m_dirname(env.directory_name() ? env.directory_name() : "") { - for (auto & elem : m_hasalpha) - elem = false; - std::string symbollist = env.get_attribute_string(compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"); // split out position names from string and figure out our number of symbols - int location; m_numstops = 0; - location=symbollist.find(','); - while (location!=-1) + for (std::string::size_type location = symbollist.find(','); std::string::npos != location; location = symbollist.find(',')) { - m_stopnames[m_numstops] = symbollist; - m_stopnames[m_numstops] = m_stopnames[m_numstops].substr(0, location); - symbollist = symbollist.substr(location+1, symbollist.length()-(location-1)); + m_stopnames[m_numstops] = symbollist.substr(0, location); + symbollist.erase(0, location + 1); m_numstops++; - location=symbollist.find(','); } m_stopnames[m_numstops++] = symbollist; - // careful, dirname is nullptr if we're coming from internal layout, and our string assignment doesn't like that - if (dirname != nullptr) - m_dirname = dirname; - - for (int i=0;i<m_numstops;i++) + for (int i = 0; i < m_numstops; i++) { - location=m_stopnames[i].find(':'); - if (location!=-1) + std::string::size_type const location = m_stopnames[i].find(':'); + if (location != std::string::npos) { - m_imagefile[i] = m_stopnames[i]; - m_stopnames[i] = m_stopnames[i].substr(0, location); - m_imagefile[i] = m_imagefile[i].substr(location+1, m_imagefile[i].length()-(location-1)); - - //m_alphafile[i] = - m_file[i] = std::make_unique<emu_file>(env.machine().options().art_path(), OPEN_FLAG_READ); - } - else - { - //m_imagefile[i] = 0; - //m_alphafile[i] = 0; - m_file[i].reset(); + m_imagefile[i] = m_stopnames[i].substr(location + 1); + m_stopnames[i].erase(location); } } @@ -2335,10 +3030,21 @@ public: m_beltreel = env.get_attribute_int(compnode, "beltreel", 0); } -protected: // overrides + virtual void preload(running_machine &machine) override + { + for (int i = 0; i < m_numstops; i++) + { + if (!m_imagefile[i].empty() && !m_bitmap[i].valid()) + load_reel_bitmap(i); + } + + } + +protected: virtual int maxstate() const override { return 65535; } - virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override + + virtual void draw_aligned(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { if (m_beltreel) { @@ -2359,16 +3065,12 @@ protected: u32 const b = c.b * 255.0f; u32 const a = c.a * 255.0f; - // get the width of the string - render_font *font = machine.render().font_alloc("default"); - float aspect = 1.0f; - s32 width; - int curry = 0; int num_shown = m_numsymbolsvisible; int ourheight = bounds.height(); + auto font = machine.render().font_alloc("default"); for (int fruit = 0;fruit<m_numstops;fruit++) { int basey; @@ -2393,47 +3095,31 @@ protected: // only render the symbol / text if it's actually in view because the code is SLOW if ((endpos >= bounds.top()) && (basey <= bounds.bottom())) { - while (1) - { - width = font->string_width(ourheight / num_shown, aspect, m_stopnames[fruit].c_str()); - if (width < bounds.width()) - break; - aspect *= 0.9f; - } + if (!m_imagefile[fruit].empty() && !m_bitmap[fruit].valid()) + load_reel_bitmap(fruit); - s32 curx; - curx = bounds.left() + (bounds.width() - width) / 2; - - if (m_file[fruit]) - if (!m_bitmap[fruit].valid()) - load_reel_bitmap(fruit); - - if (m_file[fruit]) // render gfx + if (m_bitmap[fruit].valid()) // render gfx { bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown); + render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], c); - if (m_bitmap[fruit].valid()) + for (int y = 0; y < ourheight/num_shown; y++) { - render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], c); + int effy = basey + y; - for (int y = 0; y < ourheight/num_shown; y++) + if (effy >= bounds.top() && effy <= bounds.bottom()) { - int effy = basey + y; - - if (effy >= bounds.top() && effy <= bounds.bottom()) + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); + for (int x = 0; x < dest.width(); x++) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); - for (int x = 0; x < dest.width(); x++) + int effx = x; + if (effx >= bounds.left() && effx <= bounds.right()) { - int effx = x; - if (effx >= bounds.left() && effx <= bounds.right()) + u32 spix = rgb_t(src[x]).a(); + if (spix != 0) { - u32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - d[effx] = src[x]; - } + d[effx] = src[x]; } } } @@ -2450,6 +3136,20 @@ protected: const char *s = origs; char32_t schar; + // get the width of the string + float aspect = 1.0f; + s32 width; + + while (1) + { + width = font->string_width(ourheight / num_shown, aspect, m_stopnames[fruit].c_str()); + if (width < bounds.width()) + break; + aspect *= 0.9f; + } + + s32 curx = bounds.left() + (bounds.width() - width) / 2; + // loop over characters while (*s != 0) { @@ -2469,8 +3169,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -2502,7 +3202,6 @@ protected: } // free the temporary bitmap and font - machine.render().font_free(font); } private: @@ -2521,15 +3220,12 @@ private: u32 const b = c.b * 255.0f; u32 const a = c.a * 255.0f; - // get the width of the string - render_font *font = machine.render().font_alloc("default"); - float aspect = 1.0f; - s32 width; int currx = 0; int num_shown = m_numsymbolsvisible; int ourwidth = bounds.width(); + auto font = machine.render().font_alloc("default"); for (int fruit = 0;fruit<m_numstops;fruit++) { int basex; @@ -2553,56 +3249,53 @@ private: // only render the symbol / text if it's actually in view because the code is SLOW if ((endpos >= bounds.left()) && (basex <= bounds.right())) { - while (1) - { - width = font->string_width(dest.height(), aspect, m_stopnames[fruit].c_str()); - if (width < bounds.width()) - break; - aspect *= 0.9f; - } - - s32 curx; - curx = bounds.left(); + if (!m_imagefile[fruit].empty() && !m_bitmap[fruit].valid()) + load_reel_bitmap(fruit); - if (m_file[fruit]) - if (!m_bitmap[fruit].valid()) - load_reel_bitmap(fruit); - - if (m_file[fruit]) // render gfx + if (m_bitmap[fruit].valid()) // render gfx { bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height()); + render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], c); - if (m_bitmap[fruit].valid()) + for (int y = 0; y < dest.height(); y++) { - render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], c); + int effy = y; - for (int y = 0; y < dest.height(); y++) + if (effy >= bounds.top() && effy <= bounds.bottom()) { - int effy = y; - - if (effy >= bounds.top() && effy <= bounds.bottom()) + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); + for (int x = 0; x < ourwidth/num_shown; x++) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); - for (int x = 0; x < ourwidth/num_shown; x++) + int effx = basex + x; + if (effx >= bounds.left() && effx <= bounds.right()) { - int effx = basex + x; - if (effx >= bounds.left() && effx <= bounds.right()) + u32 spix = rgb_t(src[x]).a(); + if (spix != 0) { - u32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - d[effx] = src[x]; - } + d[effx] = src[x]; } } } - } + } } else // render text (fallback) { + // get the width of the string + float aspect = 1.0f; + s32 width; + while (1) + { + width = font->string_width(dest.height(), aspect, m_stopnames[fruit].c_str()); + if (width < bounds.width()) + break; + aspect *= 0.9f; + } + + s32 curx = bounds.left(); + // allocate a temporary bitmap bitmap_argb32 tempbitmap(dest.width(), dest.height()); @@ -2630,8 +3323,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = basex + curx + x; @@ -2663,35 +3356,33 @@ private: } // free the temporary bitmap and font - machine.render().font_free(font); } void load_reel_bitmap(int number) { - // load the basic bitmap - assert(m_file != nullptr); - /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname.c_str(), m_imagefile[number].c_str()); + emu_file file(m_searchpath.empty() ? m_dirname : m_searchpath, OPEN_FLAG_READ); + std::string filename; + if (!m_searchpath.empty()) + filename = m_dirname; + if (!filename.empty() && !util::is_directory_separator(filename[filename.size() - 1])) + filename.append(PATH_SEPARATOR); + filename.append(m_imagefile[number]); - // load the alpha bitmap if specified - //if (m_bitmap[number].valid() && m_alphafile[number]) - // render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true); + // load the basic bitmap + if (file.open(filename) == osd_file::error::NONE) + render_load_png(m_bitmap[number], file); // if we can't load the bitmap just use text rendering if (!m_bitmap[number].valid()) - { - // fallback to text rendering - m_file[number].reset(); - } + m_imagefile[number].clear(); } // internal state bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images + std::string m_searchpath; // asset search path (for lazy loading) std::string m_dirname; // directory name of image file (for lazy loading) - std::unique_ptr<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files std::string m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) - std::string m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) - bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? // basically made up of multiple text strings / gfx int m_numstops; @@ -2708,9 +3399,9 @@ private: //------------------------------------------------- template <typename T> -layout_element::component::ptr layout_element::make_component(environment &env, util::xml::data_node const &compnode, const char *dirname) +layout_element::component::ptr layout_element::make_component(environment &env, util::xml::data_node const &compnode) { - return std::make_unique<T>(env, compnode, dirname); + return std::make_unique<T>(env, compnode); } @@ -2720,9 +3411,9 @@ layout_element::component::ptr layout_element::make_component(environment &env, //------------------------------------------------- template <int D> -layout_element::component::ptr layout_element::make_dotmatrix_component(environment &env, util::xml::data_node const &compnode, const char *dirname) +layout_element::component::ptr layout_element::make_dotmatrix_component(environment &env, util::xml::data_node const &compnode) { - return std::make_unique<dotmatrix_component>(D, env, compnode, dirname); + return std::make_unique<dotmatrix_component>(D, env, compnode); } @@ -2783,7 +3474,7 @@ layout_element::texture &layout_element::texture::operator=(texture &&that) // component - constructor //------------------------------------------------- -layout_element::component::component(environment &env, util::xml::data_node const &compnode, const char *dirname) +layout_element::component::component(environment &env, util::xml::data_node const &compnode) : m_statemask(env.get_attribute_int(compnode, "statemask", env.get_attribute_string(compnode, "state", "")[0] ? ~0 : 0)) , m_stateval(env.get_attribute_int(compnode, "state", m_statemask) & m_statemask) { @@ -2791,84 +3482,37 @@ layout_element::component::component(environment &env, util::xml::data_node cons { if (!strcmp(child->get_name(), "bounds")) { - int const state(env.get_attribute_int(*child, "state", 0)); - auto const pos( - std::lower_bound( - m_bounds.begin(), - m_bounds.end(), - state, - [] (bounds_step const &lhs, int rhs) { return lhs.state < rhs; })); - if ((m_bounds.end() != pos) && (state == pos->state)) + if (!add_bounds_step(env, m_bounds, *child)) { throw layout_syntax_error( util::string_format( - "%s component has duplicate bounds for state %d", - compnode.get_name(), - state)); + "%s component has duplicate bounds for state", + compnode.get_name())); } - bounds_step &ins(*m_bounds.emplace(pos, bounds_step{ state, { 0.0F, 0.0F, 0.0F, 0.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } })); - env.parse_bounds(child, ins.bounds); } else if (!strcmp(child->get_name(), "color")) { - int const state(env.get_attribute_int(*child, "state", 0)); - auto const pos( - std::lower_bound( - m_color.begin(), - m_color.end(), - state, - [] (color_step const &lhs, int rhs) { return lhs.state < rhs; })); - if ((m_color.end() != pos) && (state == pos->state)) + if (!add_color_step(env, m_color, *child)) { throw layout_syntax_error( util::string_format( - "%s component has duplicate color for state %d", - compnode.get_name(), - state)); + "%s component has duplicate color for state", + compnode.get_name())); } - m_color.emplace(pos, color_step{ state, env.parse_color(child), { 0.0F, 0.0F, 0.0F, 0.0F } }); } } - if (m_bounds.empty()) - { - m_bounds.emplace_back(bounds_step{ 0, { 0.0F, 0.0F, 1.0F, 1.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } }); - } - else - { - auto i(m_bounds.begin()); - auto j(i); - while (m_bounds.end() != ++j) - { - assert(j->state > i->state); - - i->delta.x0 = (j->bounds.x0 - i->bounds.x0) / (j->state - i->state); - i->delta.x1 = (j->bounds.x1 - i->bounds.x1) / (j->state - i->state); - i->delta.y0 = (j->bounds.y0 - i->bounds.y0) / (j->state - i->state); - i->delta.y1 = (j->bounds.y1 - i->bounds.y1) / (j->state - i->state); + set_bounds_deltas(m_bounds); + set_color_deltas(m_color); +} - i = j; - } - } - if (m_color.empty()) - { - m_color.emplace_back(color_step{ 0, { 1.0F, 1.0F, 1.0F, 1.0F }, { 0.0F, 0.0F, 0.0F, 0.0F } }); - } - else - { - auto i(m_color.begin()); - auto j(i); - while (m_color.end() != ++j) - { - assert(j->state > i->state); - i->delta.a = (j->color.a - i->color.a) / (j->state - i->state); - i->delta.r = (j->color.r - i->color.r) / (j->state - i->state); - i->delta.g = (j->color.g - i->color.g) / (j->state - i->state); - i->delta.b = (j->color.b - i->color.b) / (j->state - i->state); +//------------------------------------------------- +// normalize_bounds - normalize component bounds +//------------------------------------------------- - i = j; - } - } +void layout_element::component::normalize_bounds(float xoffs, float yoffs, float xscale, float yscale) +{ + ::normalize_bounds(m_bounds, 0.0F, 0.0F, xoffs, yoffs, xscale, yscale); } @@ -2921,11 +3565,7 @@ std::pair<int, bool> layout_element::component::statewrap() const render_bounds layout_element::component::overall_bounds() const { - auto i(m_bounds.begin()); - render_bounds result(i->bounds); - while (m_bounds.end() != ++i) - union_render_bounds(result, i->bounds); - return result; + return accumulate_bounds(m_bounds); } @@ -2935,26 +3575,7 @@ render_bounds layout_element::component::overall_bounds() const render_bounds layout_element::component::bounds(int state) const { - auto pos( - std::lower_bound( - m_bounds.begin(), - m_bounds.end(), - state, - [] (bounds_step const &lhs, int rhs) { return lhs.state < rhs; })); - if (m_bounds.begin() == pos) - { - return pos->bounds; - } - else - { - --pos; - render_bounds result(pos->bounds); - result.x0 += pos->delta.x0 * (state - pos->state); - result.x1 += pos->delta.x1 * (state - pos->state); - result.y0 += pos->delta.y0 * (state - pos->state); - result.y1 += pos->delta.y1 * (state - pos->state); - return result; - } + return interpolate_bounds(m_bounds, state); } @@ -2964,56 +3585,54 @@ render_bounds layout_element::component::bounds(int state) const render_color layout_element::component::color(int state) const { - auto pos( - std::lower_bound( - m_color.begin(), - m_color.end(), - state, - [] (color_step const &lhs, int rhs) { return lhs.state < rhs; })); - if (m_color.begin() == pos) - { - return pos->color; - } - else - { - --pos; - render_color result(pos->color); - result.a += pos->delta.a * (state - pos->state); - result.r += pos->delta.r * (state - pos->state); - result.g += pos->delta.g * (state - pos->state); - result.b += pos->delta.b * (state - pos->state); - return result; - } + return interpolate_color(m_color, state); } //------------------------------------------------- -// normalize_bounds - normalize component bounds +// preload - perform expensive operations upfront //------------------------------------------------- -void layout_element::component::normalize_bounds(float xoffs, float yoffs, float xscale, float yscale) +void layout_element::component::preload(running_machine &machine) { - auto i(m_bounds.begin()); - i->bounds.x0 = (i->bounds.x0 - xoffs) * xscale; - i->bounds.x1 = (i->bounds.x1 - xoffs) * xscale; - i->bounds.y0 = (i->bounds.y0 - yoffs) * yscale; - i->bounds.y1 = (i->bounds.y1 - yoffs) * yscale; +} - auto j(i); - while (m_bounds.end() != ++j) - { - j->bounds.x0 = (j->bounds.x0 - xoffs) * xscale; - j->bounds.x1 = (j->bounds.x1 - xoffs) * xscale; - j->bounds.y0 = (j->bounds.y0 - yoffs) * yscale; - j->bounds.y1 = (j->bounds.y1 - yoffs) * yscale; - i->delta.x0 = (j->bounds.x0 - i->bounds.x0) / (j->state - i->state); - i->delta.x1 = (j->bounds.x1 - i->bounds.x1) / (j->state - i->state); - i->delta.y0 = (j->bounds.y0 - i->bounds.y0) / (j->state - i->state); - i->delta.y1 = (j->bounds.y1 - i->bounds.y1) / (j->state - i->state); +//------------------------------------------------- +// draw - draw element to texture for a given +// state +//------------------------------------------------- - i = j; - } +void layout_element::component::draw(running_machine &machine, bitmap_argb32 &dest, int state) +{ + // get the local scaled bounds + render_bounds const curbounds(bounds(state)); + rectangle pixelbounds( + s32(curbounds.x0 * float(dest.width()) + 0.5F), + s32(floorf(curbounds.x1 * float(dest.width()) - 0.5F)), + s32(curbounds.y0 * float(dest.height()) + 0.5F), + s32(floorf(curbounds.y1 * float(dest.height()) - 0.5F))); + + // based on the component type, add to the texture + if (!pixelbounds.empty()) + draw_aligned(machine, dest, pixelbounds, state); +} + + +void layout_element::component::draw_aligned(running_machine &machine, bitmap_argb32 &dest, rectangle const &bounds, int state) +{ + // derived classes must override one form or other + throw false; +} + + +//------------------------------------------------- +// maxstate - maximum state drawn differently +//------------------------------------------------- + +int layout_element::component::maxstate() const +{ + return -1; } @@ -3094,8 +3713,8 @@ void layout_element::component::draw_text( int effy = bounds.top() + y; if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -3134,8 +3753,8 @@ void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest // loop over the width of the segment for (int y = 0; y < width / 2; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); int ty = (y < width / 8) ? width / 8 : y; // loop over the length of the segment @@ -3167,8 +3786,8 @@ void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, // loop over the width of the segment for (int x = 0; x < width / 2; x++) { - u32 *d0 = &dest.pix32(0, midx - x); - u32 *d1 = &dest.pix32(0, midx + x); + u32 *const d0 = &dest.pix(0, midx - x); + u32 *const d1 = &dest.pix(0, midx + x); int tx = (x < width / 8) ? width / 8 : x; // loop over the length of the segment @@ -3204,7 +3823,7 @@ void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy - width - step; y < maxy - step; y++) @@ -3229,7 +3848,7 @@ void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = miny + step; y < miny + step + width; y++) @@ -3252,8 +3871,8 @@ void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int mi // iterate over y for (u32 y = 0; y <= width; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); s32 left, right; @@ -3281,7 +3900,7 @@ void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx // draw line for (int x = minx; x < maxx; x++) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy; y < maxy - width - step; y--) @@ -3298,7 +3917,7 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) { for (int y = 0; y < dest.height(); y++) { - u32 *destrow = &dest.pix32(y); + u32 *const destrow = &dest.pix(y); int offs = skewwidth * (dest.height() - y) / dest.height(); for (int x = dest.width() - skewwidth - 1; x >= 0; x--) destrow[x + offs] = destrow[x]; @@ -3435,7 +4054,18 @@ layout_view::~layout_view() // the given screen //------------------------------------------------- -bool layout_view::has_screen(screen_device &screen) const +bool layout_view::has_screen(screen_device &screen) +{ + return std::find_if(m_items.begin(), m_items.end(), [&screen] (auto &itm) { return itm.screen() == &screen; }) != m_items.end(); +} + + +//------------------------------------------------- +// has_visible_screen - return true if this view +// has the given screen visble +//------------------------------------------------- + +bool layout_view::has_visible_screen(screen_device &screen) const { return std::find_if(m_screens.begin(), m_screens.end(), [&screen] (auto const &scr) { return &scr.get() == &screen; }) != m_screens.end(); } @@ -3451,6 +4081,7 @@ void layout_view::recompute(u32 visibility_mask, bool zoom_to_screen) // reset the bounds and collected active items render_bounds scrbounds{ 0.0f, 0.0f, 0.0f, 0.0f }; m_bounds = scrbounds; + m_visible_items.clear(); m_screen_items.clear(); m_interactive_items.clear(); m_interactive_edges_x.clear(); @@ -3464,20 +4095,23 @@ void layout_view::recompute(u32 visibility_mask, bool zoom_to_screen) { if ((visibility_mask & curitem.visibility_mask()) == curitem.visibility_mask()) { + render_bounds const rawbounds = accumulate_bounds(curitem.m_rawbounds); + // accumulate bounds + m_visible_items.emplace_back(curitem); if (first) - m_bounds = curitem.m_rawbounds; + m_bounds = rawbounds; else - union_render_bounds(m_bounds, curitem.m_rawbounds); + m_bounds |= rawbounds; first = false; // accumulate visible screens and their bounds bounds if (curitem.screen()) { if (scrfirst) - scrbounds = curitem.m_rawbounds; + scrbounds = rawbounds; else - union_render_bounds(scrbounds, curitem.m_rawbounds); + scrbounds |= rawbounds; scrfirst = false; // accumulate active screens @@ -3522,10 +4156,8 @@ void layout_view::recompute(u32 visibility_mask, bool zoom_to_screen) // normalize all the item bounds for (item &curitem : items()) { - curitem.m_bounds.x0 = target_bounds.x0 + (curitem.m_rawbounds.x0 - xoffs) * xscale; - curitem.m_bounds.x1 = target_bounds.x0 + (curitem.m_rawbounds.x1 - xoffs) * xscale; - curitem.m_bounds.y0 = target_bounds.y0 + (curitem.m_rawbounds.y0 - yoffs) * yscale; - curitem.m_bounds.y1 = target_bounds.y0 + (curitem.m_rawbounds.y1 - yoffs) * yscale; + curitem.m_bounds = curitem.m_rawbounds; + normalize_bounds(curitem.m_bounds, target_bounds.x0, target_bounds.y0, xoffs, yoffs, xscale, yscale); } // sort edges of interactive items @@ -3536,12 +4168,13 @@ void layout_view::recompute(u32 visibility_mask, bool zoom_to_screen) for (unsigned i = 0; m_interactive_items.size() > i; ++i) { item &curitem(m_interactive_items[i]); + render_bounds const curbounds(accumulate_bounds(curitem.m_bounds)); LOGMASKED(LOG_INTERACTIVE_ITEMS, "%u: (%s %s %s %s) hasinput=%s clickthrough=%s\n", - i, curitem.bounds().x0, curitem.bounds().y0, curitem.bounds().x1, curitem.bounds().y1, curitem.has_input(), curitem.clickthrough()); - m_interactive_edges_x.emplace_back(i, curitem.bounds().x0, false); - m_interactive_edges_x.emplace_back(i, curitem.bounds().x1, true); - m_interactive_edges_y.emplace_back(i, curitem.bounds().y0, false); - m_interactive_edges_y.emplace_back(i, curitem.bounds().y1, true); + i, curbounds.x0, curbounds.y0, curbounds.x1, curbounds.y1, curitem.has_input(), curitem.clickthrough()); + m_interactive_edges_x.emplace_back(i, curbounds.x0, false); + m_interactive_edges_x.emplace_back(i, curbounds.x1, true); + m_interactive_edges_y.emplace_back(i, curbounds.y0, false); + m_interactive_edges_y.emplace_back(i, curbounds.y1, true); } std::sort(m_interactive_edges_x.begin(), m_interactive_edges_x.end()); std::sort(m_interactive_edges_y.begin(), m_interactive_edges_y.end()); @@ -3555,6 +4188,20 @@ void layout_view::recompute(u32 visibility_mask, bool zoom_to_screen) } } +//------------------------------------------------- +// preload - perform expensive loading upfront +// for visible elements +//------------------------------------------------- + +void layout_view::preload() +{ + for (item &curitem : m_visible_items) + { + if (curitem.element()) + curitem.element()->preload(); + } +} + //------------------------------------------------- // resolve_tags - resolve tags @@ -3688,7 +4335,7 @@ void layout_view::add_items( groupmap, orientation_add(grouporient, orientation), grouptrans, - render_color_multiply(env.parse_color(itemnode->get_child("color")), color), + env.parse_color(itemnode->get_child("color")) * color, false, false, true); @@ -3771,19 +4418,25 @@ layout_view::item::item( render_color const &color) : m_element(find_element(env, itemnode, elemmap)) , m_output(env.device(), env.get_attribute_string(itemnode, "name", "")) + , m_animoutput(env.device(), make_animoutput_tag(env, itemnode)) , m_have_output(env.get_attribute_string(itemnode, "name", "")[0]) + , m_have_animoutput(!make_animoutput_tag(env, itemnode).empty()) + , m_animinput_port(nullptr) + , m_animmask(make_animmask(env, itemnode)) + , m_animshift(get_state_shift(m_animmask)) , m_input_port(nullptr) , m_input_field(nullptr) , m_input_mask(env.get_attribute_int(itemnode, "inputmask", 0)) - , m_input_shift(get_input_shift(m_input_mask)) + , m_input_shift(get_state_shift(m_input_mask)) , m_input_raw(env.get_attribute_bool(itemnode, "inputraw", 0)) , m_clickthrough(env.get_attribute_bool(itemnode, "clickthrough", "yes")) , m_screen(nullptr) , m_orientation(orientation_add(env.parse_orientation(itemnode.get_child("orientation")), orientation)) - , m_color(render_color_multiply(env.parse_color(itemnode.get_child("color")), color)) + , m_color(make_color(env, itemnode, color)) , m_blend_mode(get_blend_mode(env, itemnode)) , m_visibility_mask(env.visibility_mask()) , m_input_tag(make_input_tag(env, itemnode)) + , m_animinput_tag(make_animinput_tag(env, itemnode)) , m_rawbounds(make_bounds(env, itemnode, trans)) , m_has_clickthrough(env.get_attribute_string(itemnode, "clickthrough", "")[0]) { @@ -3824,13 +4477,28 @@ layout_view::item::~item() //------------------------------------------------- -// screen_container - retrieve screen container +// bounds - get bounds for current state //------------------------------------------------- +render_bounds layout_view::item::bounds() const +{ + if (m_bounds.size() == 1U) + return m_bounds.front().bounds; + else + return interpolate_bounds(m_bounds, animation_state()); +} -render_container *layout_view::item::screen_container(running_machine &machine) const + +//------------------------------------------------- +// color - get color for current state +//------------------------------------------------- + +render_color layout_view::item::color() const { - return (m_screen != nullptr) ? &m_screen->container() : nullptr; + if (m_color.size() == 1U) + return m_color.front().color; + else + return interpolate_color(m_color, animation_state()); } @@ -3880,6 +4548,12 @@ void layout_view::item::resolve_tags() m_output = m_element->default_state(); } + if (m_have_animoutput) + m_animoutput.resolve(); + + if (!m_animinput_tag.empty()) + m_animinput_port = m_element->machine().root_device().ioport(m_animinput_tag); + if (!m_input_tag.empty()) { m_input_port = m_element->machine().root_device().ioport(m_input_tag); @@ -3908,6 +4582,21 @@ void layout_view::item::resolve_tags() // find_element - find element definition //--------------------------------------------- +inline int layout_view::item::animation_state() const +{ + if (m_have_animoutput) + return (s32(m_animoutput) & m_animmask) >> m_animshift; + else if (m_animinput_port) + return (m_animinput_port->read() & m_animmask) >> m_animshift; + else + return state(); +} + + +//--------------------------------------------- +// find_element - find element definition +//--------------------------------------------- + layout_element *layout_view::item::find_element(view_environment &env, util::xml::data_node const &itemnode, element_map &elemmap) { char const *const name(env.get_attribute_string(itemnode, !strcmp(itemnode.get_name(), "element") ? "ref" : "element", nullptr)); @@ -3927,19 +4616,105 @@ layout_element *layout_view::item::find_element(view_environment &env, util::xml // make_bounds - get transformed bounds //--------------------------------------------- -render_bounds layout_view::item::make_bounds( +layout_view::item::bounds_vector layout_view::item::make_bounds( view_environment &env, util::xml::data_node const &itemnode, layout_group::transform const &trans) { - render_bounds bounds; - env.parse_bounds(itemnode.get_child("bounds"), bounds); - render_bounds_transform(bounds, trans); - if (bounds.x0 > bounds.x1) - std::swap(bounds.x0, bounds.x1); - if (bounds.y0 > bounds.y1) - std::swap(bounds.y0, bounds.y1); - return bounds; + bounds_vector result; + for (util::xml::data_node const *bounds = itemnode.get_child("bounds"); bounds; bounds = bounds->get_next_sibling("bounds")) + { + if (!add_bounds_step(env, result, *bounds)) + { + throw layout_syntax_error( + util::string_format( + "%s item has duplicate bounds for state", + itemnode.get_name())); + } + } + for (emu::render::detail::bounds_step &step : result) + { + render_bounds_transform(step.bounds, trans); + if (step.bounds.x0 > step.bounds.x1) + std::swap(step.bounds.x0, step.bounds.x1); + if (step.bounds.y0 > step.bounds.y1) + std::swap(step.bounds.y0, step.bounds.y1); + } + set_bounds_deltas(result); + return result; +} + + +//--------------------------------------------- +// make_color - get color inflection points +//--------------------------------------------- + +layout_view::item::color_vector layout_view::item::make_color( + view_environment &env, + util::xml::data_node const &itemnode, + render_color const &mult) +{ + color_vector result; + for (util::xml::data_node const *color = itemnode.get_child("color"); color; color = color->get_next_sibling("color")) + { + if (!add_color_step(env, result, *color)) + { + throw layout_syntax_error( + util::string_format( + "%s item has duplicate color for state", + itemnode.get_name())); + } + } + if (result.empty()) + { + result.emplace_back(emu::render::detail::color_step{ 0, mult, { 0.0F, 0.0F, 0.0F, 0.0F } }); + } + else + { + for (emu::render::detail::color_step &step : result) + step.color *= mult; + set_color_deltas(result); + } + return result; +} + + +//--------------------------------------------- +// make_animoutput_tag - get animation output +// tag +//--------------------------------------------- + +std::string layout_view::item::make_animoutput_tag(view_environment &env, util::xml::data_node const &itemnode) +{ + util::xml::data_node const *const animate(itemnode.get_child("animate")); + if (animate) + return env.get_attribute_string(*animate, "name", ""); + else + return std::string(); +} + + +//--------------------------------------------- +// make_animmask - get animation state mask +//--------------------------------------------- + +ioport_value layout_view::item::make_animmask(view_environment &env, util::xml::data_node const &itemnode) +{ + util::xml::data_node const *const animate(itemnode.get_child("animate")); + return animate ? env.get_attribute_int(*animate, "mask", ~ioport_value(0)) : ~ioport_value(0); +} + + +//--------------------------------------------- +// make_animinput_tag - get absolute tag for +// animation input +//--------------------------------------------- + +std::string layout_view::item::make_animinput_tag(view_environment &env, util::xml::data_node const &itemnode) +{ + util::xml::data_node const *const animate(itemnode.get_child("animate")); + char const *tag(animate ? env.get_attribute_string(*animate, "inputtag", nullptr) : nullptr); + return tag ? env.device().subtag(tag) : std::string(); } @@ -3987,10 +4762,10 @@ int layout_view::item::get_blend_mode(view_environment &env, util::xml::data_nod //--------------------------------------------- -// get_input_shift - shift to right-align LSB +// get_state_shift - shift to right-align LSB //--------------------------------------------- -unsigned layout_view::item::get_input_shift(ioport_value mask) +unsigned layout_view::item::get_state_shift(ioport_value mask) { unsigned result(0U); while (mask && !BIT(mask, 0)) @@ -4028,13 +4803,17 @@ layout_view::visibility_toggle::visibility_toggle(std::string &&name, u32 mask) // layout_file - constructor //------------------------------------------------- -layout_file::layout_file(device_t &device, util::xml::data_node const &rootnode, char const *dirname) +layout_file::layout_file( + device_t &device, + util::xml::data_node const &rootnode, + char const *searchpath, + char const *dirname) : m_elemmap() , m_viewlist() { try { - environment env(device); + environment env(device, searchpath, dirname); // find the layout node util::xml::data_node const *const mamelayoutnode = rootnode.get_child("mamelayout"); @@ -4048,7 +4827,7 @@ layout_file::layout_file(device_t &device, util::xml::data_node const &rootnode, // parse all the parameters, elements and groups group_map groupmap; - add_elements(dirname, env, *mamelayoutnode, groupmap, false, true); + add_elements(env, *mamelayoutnode, groupmap, false, true); // parse all the views for (util::xml::data_node const *viewnode = mamelayoutnode->get_child("view"); viewnode != nullptr; viewnode = viewnode->get_next_sibling("view")) @@ -4085,7 +4864,6 @@ layout_file::~layout_file() void layout_file::add_elements( - char const *dirname, environment &env, util::xml::data_node const &parentnode, group_map &groupmap, @@ -4106,7 +4884,7 @@ void layout_file::add_elements( char const *const name(env.get_attribute_string(*childnode, "name", nullptr)); if (!name) throw layout_syntax_error("element lacks name attribute"); - if (!m_elemmap.emplace(std::piecewise_construct, std::forward_as_tuple(name), std::forward_as_tuple(env, *childnode, dirname)).second) + if (!m_elemmap.emplace(std::piecewise_construct, std::forward_as_tuple(name), std::forward_as_tuple(env, *childnode)).second) throw layout_syntax_error(util::string_format("duplicate element name %s", name)); } else if (!strcmp(childnode->get_name(), "group")) @@ -4125,7 +4903,7 @@ void layout_file::add_elements( environment local(env); for (int i = 0; count > i; ++i) { - add_elements(dirname, local, *childnode, groupmap, true, !i); + add_elements(local, *childnode, groupmap, true, !i); local.increment_parameters(); } } diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index f3e4950f598..64887d111bd 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -11,9 +11,109 @@ #include "emu.h" #include "rendutil.h" +#include "msdib.h" #include "png.h" #include "jpeglib.h" +#include "jerror.h" + + +namespace { + +struct jpeg_corefile_source : public jpeg_source_mgr +{ + static void source(j_decompress_ptr cinfo, util::core_file &file); + +private: + static constexpr unsigned INPUT_BUF_SIZE = 4096; + + static void do_init(j_decompress_ptr cinfo) + { + jpeg_corefile_source &src = *static_cast<jpeg_corefile_source *>(cinfo->src); + src.start_of_file = true; + } + + static boolean do_fill(j_decompress_ptr cinfo) + { + jpeg_corefile_source &src = *static_cast<jpeg_corefile_source *>(cinfo->src); + + size_t nbytes = src.infile->read(src.buffer, INPUT_BUF_SIZE); + + if (0 >= nbytes) + { + if (src.start_of_file) + ERREXIT(cinfo, JERR_INPUT_EMPTY); + WARNMS(cinfo, JWRN_JPEG_EOF); + src.buffer[0] = JOCTET(0xff); + src.buffer[1] = JOCTET(JPEG_EOI); + nbytes = 2; + } + + src.next_input_byte = src.buffer; + src.bytes_in_buffer = nbytes; + src.start_of_file = false; + + return TRUE; + } + + static void do_skip(j_decompress_ptr cinfo, long num_bytes) + { + jpeg_corefile_source &src = *static_cast<jpeg_corefile_source *>(cinfo->src); + + if (0 < num_bytes) + { + while (long(src.bytes_in_buffer) < num_bytes) + { + num_bytes -= long(src.bytes_in_buffer); + (void)(*src.fill_input_buffer)(cinfo); + } + src.next_input_byte += size_t(num_bytes); + src.bytes_in_buffer -= size_t(num_bytes); + } + } + + static void do_term(j_decompress_ptr cinfo) + { + } + + util::core_file *infile; + JOCTET *buffer; + bool start_of_file; +}; + +void jpeg_corefile_source::source(j_decompress_ptr cinfo, util::core_file &file) +{ + jpeg_corefile_source *src; + if (!cinfo->src) + { + src = reinterpret_cast<jpeg_corefile_source *>( + (*cinfo->mem->alloc_small)( + reinterpret_cast<j_common_ptr>(cinfo), + JPOOL_PERMANENT, + sizeof(jpeg_corefile_source))); + cinfo->src = src; + src->buffer = reinterpret_cast<JOCTET *>( + (*cinfo->mem->alloc_small)( + reinterpret_cast<j_common_ptr>(cinfo), + JPOOL_PERMANENT, + INPUT_BUF_SIZE * sizeof(JOCTET))); + } + else + { + src = static_cast<jpeg_corefile_source *>(cinfo->src); + } + + src->init_source = &jpeg_corefile_source::do_init; + src->fill_input_buffer = &jpeg_corefile_source::do_fill; + src->skip_input_data = &jpeg_corefile_source::do_skip; + src->resync_to_restart = jpeg_resync_to_restart; + src->term_source = &jpeg_corefile_source::do_term; + src->infile = &file; + src->bytes_in_buffer = 0; + src->next_input_byte = nullptr; +} + +} // anonymous namespace /*************************************************************************** @@ -23,7 +123,7 @@ /* utilities */ static void resample_argb_bitmap_average(u32 *dest, u32 drowpixels, u32 dwidth, u32 dheight, const u32 *source, u32 srowpixels, u32 swidth, u32 sheight, const render_color &color, u32 dx, u32 dy); static void resample_argb_bitmap_bilinear(u32 *dest, u32 drowpixels, u32 dwidth, u32 dheight, const u32 *source, u32 srowpixels, u32 swidth, u32 sheight, const render_color &color, u32 dx, u32 dy); -static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png); +static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const util::png_info &png); @@ -42,7 +142,7 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, return; /* adjust the source base */ - const u32 *sbase = &source.pix32(0); + const u32 *sbase = &source.pix(0); /* determine the steppings */ u32 swidth = source.width(); @@ -543,81 +643,103 @@ void render_line_to_quad(const render_bounds *bounds, float width, float length_ /*------------------------------------------------- - render_load_jpeg - load a JPG file into a - bitmap + render_load_msdib - load a Microsoft DIB file + into a bitmap -------------------------------------------------*/ -void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename) +void render_load_msdib(bitmap_argb32 &bitmap, util::core_file &file) { // deallocate previous bitmap bitmap.reset(); - // define file's full name - std::string fname; + // read the DIB data + util::msdib_error const result = util::msdib_read_bitmap(file, bitmap); + if (result != util::msdib_error::NONE) + { + osd_printf_error("Error reading Microsoft DIB file\n"); + bitmap.reset(); + } +} - if (dirname == nullptr) - fname = filename; - else - fname.assign(dirname).append(PATH_SEPARATOR).append(filename); - if (file.open(fname) != osd_file::error::NONE) - return; +/*------------------------------------------------- + render_load_jpeg - load a JPEG file into a + bitmap +-------------------------------------------------*/ + +void render_load_jpeg(bitmap_argb32 &bitmap, util::core_file &file) +{ + // deallocate previous bitmap + bitmap.reset(); - // define standard JPEG structures + // create a JPEG source for the file jpeg_decompress_struct cinfo; jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); - jpeg_create_decompress(&cinfo); - - // allocates a buffer for the image - u32 jpg_size = file.size(); - std::unique_ptr<unsigned char[]> jpg_buffer = std::make_unique<unsigned char[]>(jpg_size); - - // read data from the file and set them in the buffer - file.read(jpg_buffer.get(), jpg_size); - jpeg_mem_src(&cinfo, jpg_buffer.get(), jpg_size); - - // read JPEG header and start decompression - jpeg_read_header(&cinfo, TRUE); - jpeg_start_decompress(&cinfo); - - // allocates the destination bitmap - int w = cinfo.output_width; - int h = cinfo.output_height; - int s = cinfo.output_components; - bitmap.allocate(w, h); - - // allocates a buffer to receive the information and copy them into the bitmap - int row_stride = cinfo.output_width * cinfo.output_components; - JSAMPARRAY buffer = (JSAMPARRAY)malloc(sizeof(JSAMPROW)); - buffer[0] = (JSAMPROW)malloc(sizeof(JSAMPLE) * row_stride); - - while ( cinfo.output_scanline < cinfo.output_height ) + jerr.error_exit = [] (j_common_ptr cinfo) { throw cinfo->err; }; + JSAMPARRAY buffer = nullptr; + try { - int j = cinfo.output_scanline; - jpeg_read_scanlines(&cinfo, buffer, 1); + jpeg_create_decompress(&cinfo); + cinfo.mem->max_memory_to_use = 128 * 1024 * 1024; + jpeg_corefile_source::source(&cinfo, file); + + // read JPEG header and start decompression + jpeg_read_header(&cinfo, TRUE); + jpeg_start_decompress(&cinfo); + + // allocates the destination bitmap + int w = cinfo.output_width; + int h = cinfo.output_height; + int s = cinfo.output_components; + bitmap.allocate(w, h); + + // allocates a buffer to receive the information and copy them into the bitmap + int row_stride = cinfo.output_width * cinfo.output_components; + JSAMPARRAY buffer = reinterpret_cast<JSAMPARRAY>(malloc(sizeof(JSAMPROW))); + buffer[0] = reinterpret_cast<JSAMPROW>(malloc(sizeof(JSAMPLE) * row_stride)); + + while (cinfo.output_scanline < cinfo.output_height) + { + int j = cinfo.output_scanline; + jpeg_read_scanlines(&cinfo, buffer, 1); - if (s == 1) - for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); + if (s == 1) + { + for (int i = 0; i < w; ++i) + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); - else if (s == 3) - for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); - else - { - osd_printf_error("Cannot read JPEG data from %s file.\n", fname); - bitmap.reset(); - break; + } + else if (s == 3) + { + for (int i = 0; i < w; ++i) + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + } + else + { + osd_printf_error("Cannot read JPEG data from file.\n"); + bitmap.reset(); + break; + } } - } - // finish decompression and frees the memory - jpeg_finish_decompress(&cinfo); + // finish decompression and frees the memory + jpeg_finish_decompress(&cinfo); + } + catch (jpeg_error_mgr *) + { + char msg[1024]; + (cinfo.err->format_message)(reinterpret_cast<j_common_ptr>(&cinfo), msg); + osd_printf_error("JPEG error reading data from file: %s\n", msg); + bitmap.reset(); + } jpeg_destroy_decompress(&cinfo); - file.close(); - free(buffer[0]); - free(buffer); + if (buffer) + { + if (buffer[0]) + free(buffer[0]); + free(buffer); + } } @@ -626,36 +748,25 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname bitmap -------------------------------------------------*/ -bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename, bool load_as_alpha_to_existing) +bool render_load_png(bitmap_argb32 &bitmap, util::core_file &file, bool load_as_alpha_to_existing) { // deallocate if we're not overlaying alpha if (!load_as_alpha_to_existing) bitmap.reset(); - // open the file - std::string fname; - if (dirname) - fname.assign(dirname).append(PATH_SEPARATOR).append(filename); - else - fname.assign(filename); - osd_file::error const filerr = file.open(fname); - if (filerr != osd_file::error::NONE) - return false; - // read the PNG data - png_info png; - png_error const result = png.read_file(file); - file.close(); - if (result != PNGERR_NONE) + util::png_info png; + util::png_error const result = png.read_file(file); + if (result != util::png_error::NONE) { - osd_printf_error("%s: Error reading PNG file\n", filename); + osd_printf_error("Error reading PNG file\n"); return false; } // if less than 8 bits, upsample - if (PNGERR_NONE != png.expand_buffer_8bit()) + if (util::png_error::NONE != png.expand_buffer_8bit()) { - osd_printf_error("%s: Error upsampling PNG bitmap\n", filename); + osd_printf_error("Error upsampling PNG bitmap\n"); return false; } @@ -663,9 +774,9 @@ bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, if (!load_as_alpha_to_existing) { // non-alpha case - if (PNGERR_NONE != png.copy_to_bitmap(bitmap, hasalpha)) + if (util::png_error::NONE != png.copy_to_bitmap(bitmap, hasalpha)) { - osd_printf_error("%s: Error copying PNG bitmap to MAME bitmap\n", filename); + osd_printf_error("Error copying PNG bitmap to MAME bitmap\n"); return false; } } @@ -674,7 +785,7 @@ bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, // verify we can handle this PNG if (png.bit_depth > 8) { - osd_printf_error("%s: Unsupported bit depth %d (8 bit max)\n", filename, png.bit_depth); + osd_printf_error("Unsupported bit depth %d (8 bit max)\n", png.bit_depth); return false; } @@ -692,7 +803,7 @@ bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, to the alpha channel of a bitmap -------------------------------------------------*/ -static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) +static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const util::png_info &png) { // FIXME: this function is basically copy/pasted from the PNG code in util, and should be unified with it u8 accumalpha = 0xff; @@ -726,7 +837,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(png.palette[*src * 3], png.palette[*src * 3 + 1], png.palette[*src * 3 + 2]).brightness()); accumalpha &= alpha; @@ -741,7 +852,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -755,7 +866,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 2) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -769,7 +880,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 3) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; @@ -784,7 +895,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 4) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; @@ -803,29 +914,41 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) render_detect_image - detect image format -------------------------------------------------*/ -ru_imgformat render_detect_image(emu_file &file, const char *dirname, const char *filename) +ru_imgformat render_detect_image(util::core_file &file) { - // open the file - std::string fname; - if (dirname) - fname.assign(dirname).append(PATH_SEPARATOR).append(filename); - else - fname.assign(filename); - osd_file::error const filerr = file.open(fname); - if (filerr != osd_file::error::NONE) - return RENDUTIL_IMGFORMAT_ERROR; - // PNG: check for valid header - png_error const result = png_info::verify_header(file); - if (result == PNGERR_NONE) - { - file.close(); + util::png_error const png = util::png_info::verify_header(file); + file.seek(0, SEEK_SET); + if (util::png_error::NONE == png) return RENDUTIL_IMGFORMAT_PNG; - } + // JPEG: attempt to read header with libjpeg + jpeg_decompress_struct cinfo; + jpeg_error_mgr jerr; + cinfo.err = jpeg_std_error(&jerr); + jerr.error_exit = [] (j_common_ptr cinfo) { throw cinfo->err; }; + try + { + jpeg_create_decompress(&cinfo); + cinfo.mem->max_memory_to_use = 128 * 1024 * 1024; + jpeg_corefile_source::source(&cinfo, file); + jpeg_read_header(&cinfo, TRUE); + jpeg_destroy_decompress(&cinfo); + file.seek(0, SEEK_SET); + return RENDUTIL_IMGFORMAT_JPEG; + } + catch (jpeg_error_mgr *) + { + jpeg_destroy_decompress(&cinfo); + file.seek(0, SEEK_SET); + } + + // Microsoft DIB: check for valid header + util::msdib_error const msdib = util::msdib_verify_header(file); file.seek(0, SEEK_SET); - // TODO: add more when needed + if (util::msdib_error::NONE == msdib) + return RENDUTIL_IMGFORMAT_MSDIB; - file.close(); + // TODO: add more as necessary return RENDUTIL_IMGFORMAT_UNKNOWN; } diff --git a/src/emu/rendutil.h b/src/emu/rendutil.h index b5c06d6d0fc..9208d729352 100644 --- a/src/emu/rendutil.h +++ b/src/emu/rendutil.h @@ -13,7 +13,7 @@ #pragma once -#include "render.h" +#include "rendertypes.h" #include <cmath> @@ -23,6 +23,8 @@ enum ru_imgformat { RENDUTIL_IMGFORMAT_PNG, + RENDUTIL_IMGFORMAT_JPEG, + RENDUTIL_IMGFORMAT_MSDIB, RENDUTIL_IMGFORMAT_UNKNOWN, RENDUTIL_IMGFORMAT_ERROR @@ -40,9 +42,10 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, bool render_clip_line(render_bounds *bounds, const render_bounds *clip); bool render_clip_quad(render_bounds *bounds, const render_bounds *clip, render_quad_texuv *texcoords); void render_line_to_quad(const render_bounds *bounds, float width, float length_extension, render_bounds *bounds0, render_bounds *bounds1); -void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename); -bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, const char *filename, bool load_as_alpha_to_existing = false); -ru_imgformat render_detect_image(emu_file &file, const char *dirname, const char *filename); +void render_load_msdib(bitmap_argb32 &bitmap, util::core_file &file); +void render_load_jpeg(bitmap_argb32 &bitmap, util::core_file &file); +bool render_load_png(bitmap_argb32 &bitmap, util::core_file &file, bool load_as_alpha_to_existing = false); +ru_imgformat render_detect_image(util::core_file &file); @@ -57,76 +60,7 @@ ru_imgformat render_detect_image(emu_file &file, const char *dirname, const char static inline float render_round_nearest(float f) { - return floor(f + 0.5f); -} - - -/*------------------------------------------------- - set_render_bounds_xy - cleaner way to set the - bounds --------------------------------------------------*/ - -static inline void set_render_bounds_xy(render_bounds &bounds, float x0, float y0, float x1, float y1) -{ - bounds.x0 = x0; - bounds.y0 = y0; - bounds.x1 = x1; - bounds.y1 = y1; -} - - -/*------------------------------------------------- - set_render_bounds_wh - cleaner way to set the - bounds --------------------------------------------------*/ - -static inline void set_render_bounds_wh(render_bounds &bounds, float x0, float y0, float width, float height) -{ - bounds.x0 = x0; - bounds.y0 = y0; - bounds.x1 = x0 + width; - bounds.y1 = y0 + height; -} - - -/*------------------------------------------------- - sect_render_bounds - compute the intersection - of two render_bounds --------------------------------------------------*/ - -static inline void sect_render_bounds(render_bounds &dest, const render_bounds &src) -{ - dest.x0 = (std::max)(dest.x0, src.x0); - dest.x1 = (std::min)(dest.x1, src.x1); - dest.y0 = (std::max)(dest.y0, src.y0); - dest.y1 = (std::min)(dest.y1, src.y1); -} - - -/*------------------------------------------------- - union_render_bounds - compute the union of two - render_bounds --------------------------------------------------*/ - -static inline void union_render_bounds(render_bounds &dest, const render_bounds &src) -{ - dest.x0 = (std::min)(dest.x0, src.x0); - dest.x1 = (std::max)(dest.x1, src.x1); - dest.y0 = (std::min)(dest.y0, src.y0); - dest.y1 = (std::max)(dest.y1, src.y1); -} - - -/*------------------------------------------------- - set_render_color - cleaner way to set a color --------------------------------------------------*/ - -static inline void set_render_color(render_color *color, float a, float r, float g, float b) -{ - color->a = a; - color->r = r; - color->g = g; - color->b = b; + return floorf(f + 0.5f); } @@ -213,5 +147,4 @@ static inline u8 apply_brightness_contrast_gamma(u8 src, float brightness, float return u8(result * 255.0f); } - #endif // MAME_EMU_RENDUTIL_H diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index ee8cd2feb2a..a728a6a7660 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -192,7 +192,11 @@ chd_error do_open_disk(const emu_options &options, std::initializer_list<std::re const rom_entry *rom_first_region(const device_t &device) { - const rom_entry *romp = &device.rom_region_vector().front(); + return rom_first_region(&device.rom_region_vector().front()); +} + +const rom_entry *rom_first_region(const rom_entry *romp) +{ while (ROMENTRY_ISPARAMETER(romp) || ROMENTRY_ISSYSTEM_BIOS(romp) || ROMENTRY_ISDEFAULT_BIOS(romp)) romp++; return !ROMENTRY_ISEND(romp) ? romp : nullptr; @@ -1418,6 +1422,17 @@ void rom_load_manager::process_region_list() rom_load_manager::rom_load_manager(running_machine &machine) : m_machine(machine) + , m_warnings(0) + , m_knownbad(0) + , m_errors(0) + , m_romsloaded(0) + , m_romstotal(0) + , m_romsloadedsize(0) + , m_romstotalsize(0) + , m_chd_list() + , m_region(nullptr) + , m_errorstring() + , m_softwarningstring() { // figure out which BIOS we are using std::map<std::string, std::string> card_bios; diff --git a/src/emu/romload.h b/src/emu/romload.h index 0a558a790b1..2b9955a1590 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -479,6 +479,7 @@ private: /* return pointer to the first ROM region within a source */ const rom_entry *rom_first_region(const device_t &device); +const rom_entry *rom_first_region(const rom_entry *romp); /* return pointer to the next ROM region within a source */ const rom_entry *rom_next_region(const rom_entry *romp); diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 8c6e69c0059..c265b14e31b 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -9,14 +9,15 @@ ***************************************************************************/ #include "emu.h" +#include "screen.h" + #include "emuopts.h" -#include "png.h" +#include "render.h" #include "rendutil.h" -#include <nanosvg/src/nanosvg.h> -#include <nanosvg/src/nanosvgrast.h> +#include "nanosvg.h" +#include "png.h" -#include <clocale> #include <set> @@ -43,7 +44,6 @@ u32 screen_device::m_id_counter = 0; class screen_device::svg_renderer { public: svg_renderer(memory_region *region); - ~svg_renderer(); int width() const; int height() const; @@ -69,8 +69,8 @@ private: int x0, y0, x1, y1; }; - NSVGimage *m_image; - NSVGrasterizer *m_rasterizer; + util::nsvg_image_ptr m_image; + util::nsvg_rasterizer_ptr m_rasterizer; std::vector<bool> m_key_state; std::vector<std::vector<NSVGshape *>> m_keyed_shapes; std::unordered_map<std::string, int> m_key_ids; @@ -94,20 +94,11 @@ private: screen_device::svg_renderer::svg_renderer(memory_region *region) { - // nanosvg makes assumptions about the global locale - { - const std::unique_ptr<char []> s(new char[region->bytes() + 1]); - memcpy(s.get(), region->base(), region->bytes()); - s[region->bytes()] = 0; - const std::string lcctype(std::setlocale(LC_CTYPE, nullptr)); - const std::string lcnumeric(std::setlocale(LC_NUMERIC, nullptr)); - std::setlocale(LC_CTYPE, "C"); - std::setlocale(LC_NUMERIC, "C"); - m_image = nsvgParse(s.get(), "px", 72); - std::setlocale(LC_CTYPE, lcctype.c_str()); - std::setlocale(LC_NUMERIC, lcnumeric.c_str()); - } - m_rasterizer = nsvgCreateRasterizer(); + const std::unique_ptr<char []> s(new char[region->bytes() + 1]); + memcpy(s.get(), region->base(), region->bytes()); + s[region->bytes()] = 0; + m_image.reset(nsvgParse(s.get(), "px", 72)); + m_rasterizer.reset(nsvgCreateRasterizer()); m_key_count = 0; @@ -132,12 +123,6 @@ screen_device::svg_renderer::svg_renderer(memory_region *region) osd_printf_verbose("Parsed SVG '%s', aspect ratio %f\n", region->name(), (m_image->height == 0.0f) ? 0 : m_image->width / m_image->height); } -screen_device::svg_renderer::~svg_renderer() -{ - nsvgDeleteRasterizer(m_rasterizer); - nsvgDelete(m_image); -} - int screen_device::svg_renderer::width() const { return int(m_image->width + 0.5); @@ -159,7 +144,7 @@ void screen_device::svg_renderer::render_state(std::vector<u32> &dest, const std s->flags &= ~NSVG_FLAGS_VISIBLE; } - nsvgRasterize(m_rasterizer, m_image, 0, 0, m_scale, (unsigned char *)&dest[0], m_sx, m_sy, m_sx*4); + nsvgRasterize(m_rasterizer.get(), m_image.get(), 0, 0, m_scale, (unsigned char *)&dest[0], m_sx, m_sy, m_sx*4); // Nanosvg generates non-premultiplied alpha, so remultiply by // alpha to "blend" against a black background. Plus align the @@ -1730,9 +1715,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; - u16 *dst = &curbitmap.as_ind16().pix16(y); - const u16 *src = &srcbitmap.pix16(0); + const bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; + u16 *dst = &curbitmap.as_ind16().pix(y); + const u16 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < m_scan_widths[y]; x += dx) { @@ -1746,9 +1731,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; - u32 *dst = &curbitmap.as_rgb32().pix32(y); - const u32 *src = &srcbitmap.pix32(0); + const bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; + u32 *dst = &curbitmap.as_rgb32().pix(y); + const u32 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < dstwidth << 15; x += dx) { @@ -1837,10 +1822,10 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); - u64 *dst = &m_burnin.pix64(y); - const u16 *src = &srcbitmap.pix16(per_scanline ? 0 : (srcy >> 16)); - const rgb_t *palette = m_palette->palette()->entry_list_adjusted(); + const bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); + u64 *const dst = &m_burnin.pix(y); + u16 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); + rgb_t const *const palette = m_palette->palette()->entry_list_adjusted(); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = palette[src[srcx >> 16]]; @@ -1855,9 +1840,9 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); - u64 *dst = &m_burnin.pix64(y); - const u32 *src = &srcbitmap.pix32(per_scanline ? 0 : (srcy >> 16)); + const bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); + u64 *const dst = &m_burnin.pix(y); + u32 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -1900,7 +1885,7 @@ void screen_device::finalize_burnin() u64 maxval = 0; for (int y = 0; y < srcheight; y++) { - u64 *src = &m_burnin.pix64(y); + u64 const *const src = &m_burnin.pix(y); for (int x = 0; x < srcwidth; x++) { minval = std::min(minval, src[x]); @@ -1914,8 +1899,8 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - u64 *src = &m_burnin.pix64(srcy >> 16); - u32 *dst = &finalmap.pix32(y); + u64 const *const src = &m_burnin.pix(srcy >> 16); + u32 *const dst = &finalmap.pix(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { int brightness = u64(maxval - src[srcx >> 16]) * 255 / (maxval - minval); @@ -1930,14 +1915,14 @@ void screen_device::finalize_burnin() osd_file::error filerr = file.open(util::string_format("%s" PATH_SEPARATOR "burnin-%s.png", machine().basename(), tag() + 1)); if (filerr == osd_file::error::NONE) { - png_info pnginfo; + util::png_info pnginfo; // add two text entries describing the image pnginfo.add_text("Software", util::string_format("%s %s", emulator_info::get_appname(), emulator_info::get_build_version()).c_str()); pnginfo.add_text("System", util::string_format("%s %s", machine().system().manufacturer, machine().system().type.fullname()).c_str()); // now do the actual work - png_write_bitmap(file, &pnginfo, finalmap, 0, nullptr); + util::png_write_bitmap(file, &pnginfo, finalmap, 0, nullptr); } } @@ -1956,8 +1941,13 @@ void screen_device::load_effect_overlay(const char *filename) fullname.append(".png"); // load the file + m_screen_overlay_bitmap.reset(); emu_file file(machine().options().art_path(), OPEN_FLAG_READ); - render_load_png(m_screen_overlay_bitmap, file, nullptr, fullname.c_str()); + if (file.open(fullname) == osd_file::error::NONE) + { + render_load_png(m_screen_overlay_bitmap, file); + file.close(); + } if (m_screen_overlay_bitmap.valid()) m_container->set_overlay(&m_screen_overlay_bitmap); else diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 6b54797de36..8063db03959 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -88,9 +88,9 @@ void stream_buffer::set_sample_rate(u32 rate, bool resample) if (rate == m_sample_rate) return; - // force resampling off if coming to or from an invalid rate + // force resampling off if coming to or from an invalid rate, or if we're at time 0 (startup) sound_assert(rate >= SAMPLE_RATE_MINIMUM - 1); - if (rate < SAMPLE_RATE_MINIMUM || m_sample_rate < SAMPLE_RATE_MINIMUM) + if (rate < SAMPLE_RATE_MINIMUM || m_sample_rate < SAMPLE_RATE_MINIMUM || (m_end_second == 0 && m_end_sample == 0)) resample = false; // note the time and period of the current buffer (end_time is AFTER the final sample) @@ -123,7 +123,14 @@ void stream_buffer::set_sample_rate(u32 rate, bool resample) for (int index = 0; index < buffered_samples; index++) { end = prev_index(end); - buffer[index] = get(end); +#if (SOUND_DEBUG) + // multiple resamples can occur before clearing out old NaNs so + // neuter them for this specific case + if (std::isnan(m_buffer[end])) + buffer[index] = 0; + else +#endif + buffer[index] = get(end); } } } @@ -386,7 +393,7 @@ void sound_stream_output::init(sound_stream &stream, u32 index, char const *tag) #if (LOG_OUTPUT_WAV) std::string filename = stream.device().machine().basename(); - filename += stream.device().tag(); + filename += stream.device().tag(); for (int index = 0; index < filename.size(); index++) if (filename[index] == ':') filename[index] = '_'; @@ -571,12 +578,10 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0), m_sync_timer(nullptr), m_input(inputs), - m_input_array(inputs), m_input_view(inputs), m_empty_buffer(100), m_output_base(output_base), m_output(outputs), - m_output_array(outputs), m_output_view(outputs) { sound_assert(outputs > 0); @@ -621,21 +626,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output //------------------------------------------------- -// sound_stream - constructor with old-style -// callback -//------------------------------------------------- - -sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags) : - sound_stream(device, inputs, outputs, output_base, sample_rate, flags) -{ - m_callback = std::move(callback); - m_callback_ex = stream_update_delegate(&sound_stream::stream_update_legacy, this); -} - - -//------------------------------------------------- -// sound_stream - constructor with new-style -// callback +// sound_stream - constructor //------------------------------------------------- sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) : @@ -840,7 +831,7 @@ void sound_stream::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate) #if (SOUND_DEBUG) void sound_stream::print_graph_recursive(int indent, int index) { - osd_printf_info("%c %*s%s Ch.%d @ %d\n", m_callback.isnull() ? ' ' : '!', indent, "", name().c_str(), index + m_output_base, sample_rate()); + osd_printf_info("%*s%s Ch.%d @ %d\n", indent, "", name().c_str(), index + m_output_base, sample_rate()); for (int index = 0; index < m_input.size(); index++) if (m_input[index].valid()) { @@ -917,57 +908,6 @@ void sound_stream::sync_update(void *, s32) //------------------------------------------------- -// stream_update_legacy - new-style callback which -// forwards on to the old-style traditional -// callback, converting to/from floats -//------------------------------------------------- - -void sound_stream::stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) -{ - // temporary buffer to hold stream_sample_t inputs and outputs - stream_sample_t temp_buffer[1024]; - int chunksize = ARRAY_LENGTH(temp_buffer) / (inputs.size() + outputs.size()); - int chunknum = 0; - - // create the arrays to pass to the callback - stream_sample_t **inputptr = m_input.empty() ? nullptr : &m_input_array[0]; - stream_sample_t **outputptr = &m_output_array[0]; - for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++) - inputptr[inputnum] = &temp_buffer[chunksize * chunknum++]; - for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) - outputptr[outputnum] = &temp_buffer[chunksize * chunknum++]; - - // loop until all chunks done - for (int baseindex = 0; baseindex < outputs[0].samples(); baseindex += chunksize) - { - // determine the number of samples to process this time - int cursamples = outputs[0].samples() - baseindex; - if (cursamples > chunksize) - cursamples = chunksize; - - // copy in the input data - for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++) - { - stream_sample_t *dest = inputptr[inputnum]; - for (int index = 0; index < cursamples; index++) - dest[index] = stream_sample_t(inputs[inputnum].get(baseindex + index) * stream_buffer::sample_t(32768.0)); - } - - // run the callback - m_callback(*this, inputptr, outputptr, cursamples); - - // copy out the output data - for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) - { - stream_sample_t *src = outputptr[outputnum]; - for (int index = 0; index < cursamples; index++) - outputs[outputnum].put(baseindex + index, stream_buffer::sample_t(src[index]) * stream_buffer::sample_t(1.0 / 32768.0)); - } - } -} - - -//------------------------------------------------- // empty_view - return an empty view covering the // given time period as a substitute for invalid // inputs @@ -1074,6 +1014,7 @@ void default_resampler_stream::resampler_sound_update(sound_stream &stream, std: for ( ; dstindex < numsamples; dstindex++) { // if still within the current sample, just replicate + srcpos += step; if (srcpos <= 1.0) output.put(dstindex, cursample); @@ -1086,7 +1027,6 @@ void default_resampler_stream::resampler_sound_update(sound_stream &stream, std: cursample = rebased.get(srcindex++); output.put(dstindex, stepinv * (prevsample * (step - srcpos) + srcpos * cursample)); } - srcpos += step; } sound_assert(srcindex <= rebased.samples()); } @@ -1193,23 +1133,6 @@ sound_manager::~sound_manager() //------------------------------------------------- -// stream_alloc_legacy - allocate a new stream -//------------------------------------------------- - -sound_stream *sound_manager::stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback) -{ - // determine output base - u32 output_base = 0; - for (auto &stream : m_stream_list) - if (&stream->device() == &device) - output_base += stream->output_count(); - - m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback)); - return m_stream_list.back().get(); -} - - -//------------------------------------------------- // stream_alloc - allocate a new stream with the // new-style callback and flags //------------------------------------------------- diff --git a/src/emu/sound.h b/src/emu/sound.h index c3027b28ba6..25944847565 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -8,47 +8,47 @@ **************************************************************************** - In MAME, sound is represented as a graph of sound "streams". Each - stream has a fixed number of inputs and outputs, and is responsible - for producing sound on demand. - - The graph is driven from the outputs, which are speaker devices. - These devices are updated on a regular basis (~50 times per second), - and when an update occurs, the graph is walked from the speaker - through each input, until all connected streams are up to date. - - Individual streams can also be updated manually. This is important - for sound chips and CPU-driven devices, who should force any - affected streams to update prior to making changes. - - Sound streams are *not* part of the device execution model. This is - very important to understand. If the process of producing the ouput - stream affects state that might be consumed by an executing device - (e.g., a CPU), then care must be taken to ensure that the stream is - updated frequently enough - - The model for timing sound samples is very important and explained - here. Each stream source has a clock (aka sample rate). Each clock - edge represents a sample that is held for the duration of one clock - period. This model has interesting effects: - - For example, if you have a 10Hz clock, and call stream.update() at - t=0.91, it will compute 10 samples (for clock edges 0.0, 0.1, 0.2, - ..., 0.7, 0.8, and 0.9). And then if you ask the stream what its - current end time is (via stream.sample_time()), it will say t=1.0, - which is in the future, because it knows it will hold that last - sample until 1.0s. - - Sound generation callbacks are presented with a std::vector of inputs - and outputs. The vectors contain objects of read_stream_view and - write_stream_view respectively, which wrap access to a circular buffer - of samples. Sound generation callbacks are expected to fill all the - samples described by the outputs' write_stream_view objects. At the - moment, all outputs have the same sample rate, so the number of samples - that need to be generated will be consistent across all outputs. - - By default, the inputs will have been resampled to match the output - sample rate, unless otherwise specified. + In MAME, sound is represented as a graph of sound "streams". Each + stream has a fixed number of inputs and outputs, and is responsible + for producing sound on demand. + + The graph is driven from the outputs, which are speaker devices. + These devices are updated on a regular basis (~50 times per second), + and when an update occurs, the graph is walked from the speaker + through each input, until all connected streams are up to date. + + Individual streams can also be updated manually. This is important + for sound chips and CPU-driven devices, who should force any + affected streams to update prior to making changes. + + Sound streams are *not* part of the device execution model. This is + very important to understand. If the process of producing the ouput + stream affects state that might be consumed by an executing device + (e.g., a CPU), then care must be taken to ensure that the stream is + updated frequently enough + + The model for timing sound samples is very important and explained + here. Each stream source has a clock (aka sample rate). Each clock + edge represents a sample that is held for the duration of one clock + period. This model has interesting effects: + + For example, if you have a 10Hz clock, and call stream.update() at + t=0.91, it will compute 10 samples (for clock edges 0.0, 0.1, 0.2, + ..., 0.7, 0.8, and 0.9). And then if you ask the stream what its + current end time is (via stream.sample_time()), it will say t=1.0, + which is in the future, because it knows it will hold that last + sample until 1.0s. + + Sound generation callbacks are presented with a std::vector of inputs + and outputs. The vectors contain objects of read_stream_view and + write_stream_view respectively, which wrap access to a circular buffer + of samples. Sound generation callbacks are expected to fill all the + samples described by the outputs' write_stream_view objects. At the + moment, all outputs have the same sample rate, so the number of samples + that need to be generated will be consistent across all outputs. + + By default, the inputs will have been resampled to match the output + sample rate, unless otherwise specified. ***************************************************************************/ @@ -81,7 +81,11 @@ constexpr u32 SAMPLE_RATE_MINIMUM = 50; //************************************************************************** // turn this on to enable aggressive assertions and other checks +#ifdef MAME_DEBUG #define SOUND_DEBUG (1) +#else +#define SOUND_DEBUG (0) +#endif // if SOUND_DEBUG is on, make assertions fire regardless of MAME_DEBUG #if (SOUND_DEBUG) @@ -346,6 +350,7 @@ protected: class write_stream_view : public read_stream_view { + public: // empty constructor so we can live in an array or vector write_stream_view() @@ -364,7 +369,7 @@ public: { } - // safely write a gain-applied sample to the buffer + // safely write a sample to the buffer void put(s32 index, sample_t sample) { sound_assert(u32(index) < samples()); @@ -374,7 +379,33 @@ public: m_buffer->put(index, sample); } - // safely add a gain-applied sample to the buffer + // write a sample to the buffer, clamping to +/- the clamp value + void put_clamp(s32 index, sample_t sample, sample_t clamp = 1.0) + { + if (sample > clamp) + sample = clamp; + if (sample < -clamp) + sample = -clamp; + put(index, sample); + } + + // write a sample to the buffer, converting from an integer with the given maximum + void put_int(s32 index, s32 sample, s32 max) + { + put(index, sample_t(sample) * (1.0f / sample_t(max))); + } + + // write a sample to the buffer, converting from an integer with the given maximum + void put_int_clamp(s32 index, s32 sample, s32 maxclamp) + { + if (sample > maxclamp) + sample = maxclamp; + else if (sample < -maxclamp) + sample = -maxclamp; + put_int(index, sample, maxclamp); + } + + // safely add a sample to the buffer void add(s32 index, sample_t sample) { sound_assert(u32(index) < samples()); @@ -384,6 +415,12 @@ public: m_buffer->put(index, m_buffer->get(index) + sample); } + // add a sample to the buffer, converting from an integer with the given maximum + void add_int(s32 index, s32 sample, s32 max) + { + add(index, sample_t(sample) * (1.0f / sample_t(max))); + } + // fill part of the view with the given value void fill(sample_t value, s32 start, s32 count) { @@ -539,10 +576,7 @@ private: }; -// ======================> stream_update_legacy_delegate/stream_update_delegate - -// old-style callback; eventually should be deprecated -using stream_update_legacy_delegate = delegate<void (sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)>; +// ======================> stream_update_delegate // new-style callback using stream_update_delegate = delegate<void (sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)>; @@ -577,7 +611,6 @@ class sound_stream public: // construction/destruction - sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS); sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS); virtual ~sound_stream(); @@ -643,9 +676,6 @@ private: // timer callback for synchronous streams void sync_update(void *, s32); - // new callback which wrapps calls through to the old-style callbacks - void stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); - // return a view of 0 data covering the given time period read_stream_view empty_view(attotime start, attotime end); @@ -665,7 +695,6 @@ private: // input information std::vector<sound_stream_input> m_input; // list of streams we directly depend upon - std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback std::vector<read_stream_view> m_input_view; // array of output views for passing to the callback std::vector<std::unique_ptr<sound_stream>> m_resampler_list; // internal list of resamplers stream_buffer m_empty_buffer; // empty buffer for invalid inputs @@ -673,12 +702,10 @@ private: // output information u32 m_output_base; // base index of our outputs, relative to our device std::vector<sound_stream_output> m_output; // list of streams which directly depend upon us - std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback std::vector<write_stream_view> m_output_view; // array of output views for passing to the callback // callback information - stream_update_legacy_delegate m_callback; // callback function - stream_update_delegate m_callback_ex; // extended callback function + stream_update_delegate m_callback_ex; // extended callback function }; @@ -737,9 +764,6 @@ public: int sample_count() const { return m_samples_this_update; } int unique_id() { return m_unique_id++; } - // allocate a new stream with the old-style callback - sound_stream *stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback); - // allocate a new stream with a new-style callback sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags); diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index fab04e8f162..5757f35341f 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -860,8 +860,8 @@ u8 tilemap_t::tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 u8 andmask = ~0, ormask = 0; for (u16 ty = 0; ty < m_tileheight; ty++) { - u16 *pixptr = &m_pixmap.pix16(y0, x0); - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u16 *pixptr = &m_pixmap.pix(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); // pre-advance to the next row y0 += dy0; @@ -913,7 +913,7 @@ u8 tilemap_t::tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category for (u16 ty = 0; ty < m_tileheight; ty++) { // pre-advance to the next row - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); y0 += dy0; // anywhere the bitmask is 0 should be transparent @@ -1182,7 +1182,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // look up priority and destination base addresses for y1 bitmap_ind8 &priority_bitmap = *blit.priority; - u8 *priority_baseaddr = &priority_bitmap.pix8(y1, xpos); + u8 *priority_baseaddr = &priority_bitmap.pix(y1, xpos); typename _BitmapClass::pixel_t *dest_baseaddr = nullptr; int dest_rowpixels = 0; if (dest.valid()) @@ -1198,8 +1198,8 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b y2 -= ypos; // get tilemap pixels - const u16 *source_baseaddr = &m_pixmap.pix16(y1); - const u8 *mask_baseaddr = &m_flagsmap.pix8(y1); + const u16 *source_baseaddr = &m_pixmap.pix(y1); + const u8 *mask_baseaddr = &m_flagsmap.pix(y1); // get start/stop columns, rounding outward int mincol = x1 / m_tilewidth; @@ -1396,9 +1396,9 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c u32 cy = starty >> 16; // get source and priority pointers - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; - const u16 *src = &m_pixmap.pix16(cy); - const u8 *maskptr = &m_flagsmap.pix8(cy); + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; + const u16 *src = &m_pixmap.pix(cy); + const u8 *maskptr = &m_flagsmap.pix(cy); typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); // loop over columns @@ -1440,15 +1440,15 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we match the mask - if ((m_flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((m_flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + ROZ_PLOT_PIXEL(m_pixmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } @@ -1482,16 +1482,16 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we're within the bitmap and we match the mask if (cx < widthshifted && cy < heightshifted) - if ((m_flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((m_flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16(cy >> 16, cx >> 16)); + ROZ_PLOT_PIXEL(m_pixmap.pix(cy >> 16, cx >> 16)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } @@ -1611,14 +1611,14 @@ tilemap_manager::~tilemap_manager() tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows, tilemap_t *allocated) { if (!allocated) - allocated = global_alloc(tilemap_t)(machine().root_device()); + allocated = new tilemap_t(machine().root_device()); return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows)); } tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows, tilemap_t *allocated) { if (!allocated) - allocated = global_alloc(tilemap_t)(machine().root_device()); + allocated = new tilemap_t(machine().root_device()); return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows)); } diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index 99ccc8b536f..a5470505f12 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -37,14 +37,15 @@ ui_input_manager::ui_input_manager(running_machine &machine) : m_machine(machine) , m_presses_enabled(true) , m_current_mouse_target(nullptr) + , m_current_mouse_x(-1) + , m_current_mouse_y(-1) , m_current_mouse_down(false) , m_current_mouse_field(nullptr) , m_events_start(0) , m_events_end(0) { - // create the private data - m_current_mouse_x = -1; - m_current_mouse_y = -1; + std::fill(std::begin(m_next_repeat), std::end(m_next_repeat), 0); + std::fill(std::begin(m_seqpressed), std::end(m_seqpressed), 0); // add a frame callback to poll inputs machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(&ui_input_manager::frame_update, this)); @@ -108,13 +109,13 @@ bool ui_input_manager::push_event(ui_event evt) // some pre-processing (this is an icky place to do this stuff!) switch (evt.event_type) { - case ui_event::MOUSE_MOVE: + case ui_event::type::MOUSE_MOVE: m_current_mouse_target = evt.target; m_current_mouse_x = evt.mouse_x; m_current_mouse_y = evt.mouse_y; break; - case ui_event::MOUSE_LEAVE: + case ui_event::type::MOUSE_LEAVE: if (m_current_mouse_target == evt.target) { m_current_mouse_target = nullptr; @@ -123,11 +124,11 @@ bool ui_input_manager::push_event(ui_event evt) } break; - case ui_event::MOUSE_DOWN: + case ui_event::type::MOUSE_DOWN: m_current_mouse_down = true; break; - case ui_event::MOUSE_UP: + case ui_event::type::MOUSE_UP: m_current_mouse_down = false; break; @@ -300,8 +301,8 @@ g_profiler.stop(); void ui_input_manager::push_mouse_move_event(render_target* target, s32 x, s32 y) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_MOVE; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_MOVE; event.target = target; event.mouse_x = x; event.mouse_y = y; @@ -315,8 +316,8 @@ void ui_input_manager::push_mouse_move_event(render_target* target, s32 x, s32 y void ui_input_manager::push_mouse_leave_event(render_target* target) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_LEAVE; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_LEAVE; event.target = target; push_event(event); } @@ -328,8 +329,8 @@ void ui_input_manager::push_mouse_leave_event(render_target* target) void ui_input_manager::push_mouse_down_event(render_target* target, s32 x, s32 y) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_DOWN; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_DOWN; event.target = target; event.mouse_x = x; event.mouse_y = y; @@ -343,8 +344,8 @@ void ui_input_manager::push_mouse_down_event(render_target* target, s32 x, s32 y void ui_input_manager::push_mouse_up_event(render_target* target, s32 x, s32 y) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_UP; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_UP; event.target = target; event.mouse_x = x; event.mouse_y = y; @@ -358,8 +359,8 @@ down event to the specified render_target void ui_input_manager::push_mouse_rdown_event(render_target* target, s32 x, s32 y) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_RDOWN; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_RDOWN; event.target = target; event.mouse_x = x; event.mouse_y = y; @@ -373,8 +374,8 @@ down event to the specified render_target void ui_input_manager::push_mouse_rup_event(render_target* target, s32 x, s32 y) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_RUP; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_RUP; event.target = target; event.mouse_x = x; event.mouse_y = y; @@ -388,8 +389,8 @@ void ui_input_manager::push_mouse_rup_event(render_target* target, s32 x, s32 y) -------------------------------------------------*/ void ui_input_manager::push_mouse_double_click_event(render_target* target, s32 x, s32 y) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_DOUBLE_CLICK; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_DOUBLE_CLICK; event.target = target; event.mouse_x = x; event.mouse_y = y; @@ -402,8 +403,8 @@ void ui_input_manager::push_mouse_double_click_event(render_target* target, s32 -------------------------------------------------*/ void ui_input_manager::push_char_event(render_target* target, char32_t ch) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::IME_CHAR; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::IME_CHAR; event.target = target; event.ch = ch; push_event(event); @@ -416,8 +417,8 @@ void ui_input_manager::push_char_event(render_target* target, char32_t ch) void ui_input_manager::push_mouse_wheel_event(render_target *target, s32 x, s32 y, short delta, int ucNumLines) { - ui_event event = { ui_event::NONE }; - event.event_type = ui_event::MOUSE_WHEEL; + ui_event event = { ui_event::type::NONE }; + event.event_type = ui_event::type::MOUSE_WHEEL; event.target = target; event.mouse_x = x; event.mouse_y = y; diff --git a/src/emu/uiinput.h b/src/emu/uiinput.h index 85f4eb7cebd..17747fc9f98 100644 --- a/src/emu/uiinput.h +++ b/src/emu/uiinput.h @@ -26,7 +26,7 @@ struct ui_event { - enum type + enum class type { NONE, MOUSE_MOVE, @@ -60,37 +60,36 @@ public: void frame_update(); - /* pushes a single event onto the queue */ + // pushes a single event onto the queue bool push_event(ui_event event); - /* pops an event off of the queue */ + // pops an event off of the queue bool pop_event(ui_event *event); - /* check the next event type without removing it */ - ui_event::type peek_event_type() const { return (m_events_start != m_events_end) ? m_events[m_events_start].event_type : ui_event::NONE; } + // check the next event type without removing it + ui_event::type peek_event_type() const { return (m_events_start != m_events_end) ? m_events[m_events_start].event_type : ui_event::type::NONE; } - /* clears all outstanding events */ + // clears all outstanding events void reset(); - /* retrieves the current location of the mouse */ + // retrieves the current location of the mouse render_target *find_mouse(s32 *x, s32 *y, bool *button) const; ioport_field *find_mouse_field() const; - /* return true if a key down for the given user interface sequence is detected */ + // return true if a key down for the given user interface sequence is detected bool pressed(int code); // enable/disable UI key presses bool presses_enabled() const { return m_presses_enabled; } void set_presses_enabled(bool enabled) { m_presses_enabled = enabled; } - /* return true if a key down for the given user interface sequence is detected, or if - autorepeat at the given speed is triggered */ + // return true if a key down for the given user interface sequence is detected, or if autorepeat at the given speed is triggered bool pressed_repeat(int code, int speed); // getters running_machine &machine() const { return m_machine; } - + // queueing events void push_mouse_move_event(render_target* target, s32 x, s32 y); void push_mouse_leave_event(render_target* target); void push_mouse_down_event(render_target* target, s32 x, s32 y); @@ -108,19 +107,19 @@ private: // internal state running_machine & m_machine; // reference to our machine - /* pressed states; retrieved with ui_input_pressed() */ + // pressed states; retrieved with ui_input_pressed() bool m_presses_enabled; osd_ticks_t m_next_repeat[IPT_COUNT]; u8 m_seqpressed[IPT_COUNT]; - /* mouse position/info */ + // mouse position/info render_target * m_current_mouse_target; s32 m_current_mouse_x; s32 m_current_mouse_y; bool m_current_mouse_down; ioport_field * m_current_mouse_field; - /* popped states; ring buffer of ui_events */ + // popped states; ring buffer of ui_events ui_event m_events[EVENT_QUEUE_SIZE]; int m_events_start; int m_events_end; diff --git a/src/emu/video.cpp b/src/emu/video.cpp index e28e6aa1bae..56d60ba1661 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -329,16 +329,16 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) // add two text entries describing the image std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine().system().manufacturer).append(" ").append(machine().system().type.fullname()); - png_info pnginfo; + util::png_info pnginfo; pnginfo.add_text("Software", text1.c_str()); pnginfo.add_text("System", text2.c_str()); // now do the actual work const rgb_t *palette = (screen != nullptr && screen->has_palette()) ? screen->palette().palette()->entry_list_adjusted() : nullptr; int entries = (screen != nullptr && screen->has_palette()) ? screen->palette().entries() : 0; - png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, entries, palette); - if (error != PNGERR_NONE) - osd_printf_error("Error generating PNG for snapshot: png_error = %d\n", error); + util::png_error error = util::png_write_bitmap(file, &pnginfo, m_snap_bitmap, entries, palette); + if (error != util::png_error::NONE) + osd_printf_error("Error generating PNG for snapshot: png_error = %d\n", std::underlying_type_t<util::png_error>(error)); } @@ -1075,9 +1075,9 @@ void video_manager::create_snapshot_bitmap(screen_device *screen) render_primitive_list &primlist = m_snap_target->get_primitives(); primlist.acquire_lock(); if (machine().options().snap_bilinear()) - snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); else - snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); primlist.release_lock(); } diff --git a/src/frontend/mame/audit.cpp b/src/frontend/mame/audit.cpp index f8d2cbdd9d4..6509b264e49 100644 --- a/src/frontend/mame/audit.cpp +++ b/src/frontend/mame/audit.cpp @@ -22,6 +22,111 @@ #include <algorithm> +//#define VERBOSE 1 +#define LOG_OUTPUT_FUNC osd_printf_verbose +#include "logmacro.h" + + +namespace { + +struct parent_rom +{ + parent_rom(device_type t, rom_entry const *r) : type(t), name(ROM_GETNAME(r)), hashes(ROM_GETHASHDATA(r)), length(rom_file_size(r)) { } + + std::reference_wrapper<std::remove_reference_t<device_type> > type; + std::string name; + util::hash_collection hashes; + uint64_t length; +}; + + +class parent_rom_vector : public std::vector<parent_rom> +{ +public: + using std::vector<parent_rom>::vector; + + std::add_pointer_t<device_type> find_shared_device(device_t ¤t, char const *name, util::hash_collection const &hashes, uint64_t length) const + { + // if we're examining a child device, it will always have a perfect match + if (current.owner()) + return ¤t.type(); + + // scan backwards through parents for a matching definition + bool const dumped(!hashes.flag(util::hash_collection::FLAG_NO_DUMP)); + std::add_pointer_t<device_type> best(nullptr); + for (const_reverse_iterator it = crbegin(); crend() != it; ++it) + { + if (it->length == length) + { + if (dumped) + { + if (it->hashes == hashes) + return &it->type.get(); + } + else if (it->name == name) + { + if (it->hashes.flag(util::hash_collection::FLAG_NO_DUMP)) + return &it->type.get(); + else if (!best) + best = &it->type.get(); + } + } + } + return best; + } + + std::pair<std::add_pointer_t<device_type>, bool> actual_matches_shared(device_t ¤t, media_auditor::audit_record const &record) + { + // no result if no matching file was found + if ((record.status() != media_auditor::audit_status::GOOD) && (record.status() != media_auditor::audit_status::FOUND_INVALID)) + return std::make_pair(nullptr, false); + + // if we're examining a child device, scan it first + bool matches_device_undumped(false); + if (current.owner()) + { + for (const rom_entry *region = rom_first_region(current); region; region = rom_next_region(region)) + { + for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) + { + if (rom_file_size(rom) == record.actual_length()) + { + util::hash_collection const hashes(ROM_GETHASHDATA(rom)); + if (hashes == record.actual_hashes()) + return std::make_pair(¤t.type(), empty()); + else if (hashes.flag(util::hash_collection::FLAG_NO_DUMP) && (rom->name() == record.name())) + matches_device_undumped = true; + } + } + } + } + + // look for a matching parent ROM + std::add_pointer_t<device_type> closest_bad(nullptr); + for (const_reverse_iterator it = crbegin(); crend() != it; ++it) + { + if (it->length == record.actual_length()) + { + if (it->hashes == record.actual_hashes()) + return std::make_pair(&it->type.get(), it->type.get() == front().type.get()); + else if (it->hashes.flag(util::hash_collection::FLAG_NO_DUMP) && (it->name == record.name())) + closest_bad = &it->type.get(); + } + } + + // fall back to the nearest bad dump + if (closest_bad) + return std::make_pair(closest_bad, front().type.get() == *closest_bad); + else if (matches_device_undumped) + return std::make_pair(¤t.type(), empty()); + else + return std::make_pair(nullptr, false); + } +}; + +} // anonymous namespace + + //************************************************************************** // CORE FUNCTIONS @@ -51,10 +156,29 @@ media_auditor::summary media_auditor::audit_media(const char *validation) // store validation for later m_validation = validation; - std::size_t found = 0; - std::size_t required = 0; - std::size_t shared_found = 0; - std::size_t shared_required = 0; + // first walk the parent chain for required ROMs + parent_rom_vector parentroms; + for (auto drvindex = m_enumerator.find(m_enumerator.driver().parent); 0 <= drvindex; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent)) + { + game_driver const &parent(m_enumerator.driver(drvindex)); + LOG("Checking parent %s for ROM files\n", parent.type.shortname()); + std::vector<rom_entry> const roms(rom_build_entries(parent.rom)); + for (rom_entry const *region = rom_first_region(&roms.front()); region; region = rom_next_region(region)) + { + for (rom_entry const *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) + { + LOG("Adding parent ROM %s\n", rom->name()); + parentroms.emplace_back(parent.type, rom); + } + } + } + + // count ROMs required/found + std::size_t found(0); + std::size_t required(0); + std::size_t shared_found(0); + std::size_t shared_required(0); + std::size_t parent_found(0); // iterate over devices and regions std::vector<std::string> searchpath; @@ -68,12 +192,20 @@ media_auditor::summary media_auditor::audit_media(const char *validation) for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) { if (searchpath.empty()) + { + LOG("Audit media for device %s(%s)\n", device.shortname(), device.tag()); searchpath = device.searchpath(); + } + // look for a matching parent or device ROM char const *const name(ROM_GETNAME(rom)); util::hash_collection const hashes(ROM_GETHASHDATA(rom)); - device_t *const shared_device(find_shared_device(device, name, hashes, rom_file_size(rom))); - const auto dumped(!hashes.flag(util::hash_collection::FLAG_NO_DUMP)); + bool const dumped(!hashes.flag(util::hash_collection::FLAG_NO_DUMP)); + std::add_pointer_t<device_type> const shared_device(parentroms.find_shared_device(device, name, hashes, rom_file_size(rom))); + if (shared_device) + LOG("File '%s' %s%sdumped shared with %s\n", name, ROM_ISOPTIONAL(rom) ? "optional " : "", dumped ? "" : "un", shared_device->shortname()); + else + LOG("File '%s' %s%sdumped\n", name, ROM_ISOPTIONAL(rom) ? "optional " : "", dumped ? "" : "un"); // count the number of files with hashes if (dumped && !ROM_ISOPTIONAL(rom)) @@ -83,7 +215,7 @@ media_auditor::summary media_auditor::audit_media(const char *validation) shared_required++; } - audit_record *record = nullptr; + audit_record *record(nullptr); if (ROMREGION_ISROMDATA(region)) record = &audit_one_rom(searchpath, rom); else if (ROMREGION_ISDISKDATA(region)) @@ -91,22 +223,32 @@ media_auditor::summary media_auditor::audit_media(const char *validation) if (record) { + // see if the actual content found belongs to a parent + auto const matchesshared(parentroms.actual_matches_shared(device, *record)); + if (matchesshared.first) + LOG("Actual ROM file shared with %sparent %s\n", matchesshared.second ? "immediate " : "", matchesshared.first->shortname()); + // count the number of files that are found. - if (!device.owner() && ((record->status() == audit_status::GOOD && dumped) || (record->status() == audit_status::FOUND_INVALID && !find_shared_device(device, name, record->actual_hashes(), record->actual_length())))) + if ((record->status() == audit_status::GOOD) || ((record->status() == audit_status::FOUND_INVALID) && !matchesshared.first)) { found++; if (shared_device) shared_found++; + if (matchesshared.second) + parent_found++; } record->set_shared_device(shared_device); } } } + + if (!searchpath.empty()) + LOG("Total required=%u (shared=%u) found=%u (shared=%u parent=%u)\n", required, shared_required, found, shared_found, parent_found); } // if we only find files that are in the parent & either the set has no unique files or the parent is not found, then assume we don't have the set at all - if ((found == shared_found) && (required > 0) && ((required != shared_required) || (shared_found == 0))) + if ((found == shared_found) && required && ((required != shared_required) || !parent_found)) { m_record_list.clear(); return NOTFOUND; @@ -341,7 +483,7 @@ media_auditor::summary media_auditor::summarize(const char *name, std::ostream * case audit_substatus::NOT_FOUND: if (output) { - device_t *const shared_device = record.shared_device(); + std::add_pointer_t<device_type> const shared_device = record.shared_device(); if (shared_device) util::stream_format(*output, "NOT FOUND (%s)\n", shared_device->shortname()); else @@ -500,59 +642,6 @@ void media_auditor::compute_status(audit_record &record, const rom_entry *rom, b //------------------------------------------------- -// find_shared_device - return the source that -// shares a media entry with the same hashes -//------------------------------------------------- - -device_t *media_auditor::find_shared_device(device_t &device, const char *name, const util::hash_collection &romhashes, uint64_t romlength) -{ - bool const dumped = !romhashes.flag(util::hash_collection::FLAG_NO_DUMP); - - // special case for non-root devices - device_t *highest_device = nullptr; - if (device.owner()) - { - for (const rom_entry *region = rom_first_region(device); region; region = rom_next_region(region)) - { - for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) - { - if (rom_file_size(rom) == romlength) - { - util::hash_collection hashes(ROM_GETHASHDATA(rom)); - if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name)) - highest_device = &device; - } - } - } - } - else - { - // iterate up the parent chain - for (auto drvindex = m_enumerator.find(m_enumerator.driver().parent); drvindex >= 0; drvindex = m_enumerator.find(m_enumerator.driver(drvindex).parent)) - { - for (device_t &scandevice : device_iterator(m_enumerator.config(drvindex)->root_device())) - { - for (const rom_entry *region = rom_first_region(scandevice); region; region = rom_next_region(region)) - { - for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) - { - if (rom_file_size(rom) == romlength) - { - util::hash_collection hashes(ROM_GETHASHDATA(rom)); - if ((dumped && hashes == romhashes) || (!dumped && ROM_GETNAME(rom) == name)) - highest_device = &scandevice; - } - } - } - } - } - } - - return highest_device; -} - - -//------------------------------------------------- // audit_record - constructor //------------------------------------------------- diff --git a/src/frontend/mame/audit.h b/src/frontend/mame/audit.h index d336f6e5ae4..d1904820f03 100644 --- a/src/frontend/mame/audit.h +++ b/src/frontend/mame/audit.h @@ -107,7 +107,7 @@ public: uint64_t actual_length() const { return m_length; } const util::hash_collection &expected_hashes() const { return m_exphashes; } const util::hash_collection &actual_hashes() const { return m_hashes; } - device_t *shared_device() const { return m_shared_device; } + std::add_pointer_t<device_type> shared_device() const { return m_shared_device; } // setters void set_status(audit_status status, audit_substatus substatus) @@ -128,22 +128,22 @@ public: m_length = length; } - void set_shared_device(device_t *shared_device) + void set_shared_device(std::add_pointer_t<device_type> shared_device) { m_shared_device = shared_device; } private: // internal state - media_type m_type; // type of item that was audited - audit_status m_status; // status of audit on this item - audit_substatus m_substatus; // finer-detail status - const char * m_name; // name of item - uint64_t m_explength; // expected length of item - uint64_t m_length; // actual length of item - util::hash_collection m_exphashes; // expected hash data - util::hash_collection m_hashes; // actual hash information - device_t * m_shared_device; // device that shares the rom + media_type m_type; // type of item that was audited + audit_status m_status; // status of audit on this item + audit_substatus m_substatus; // finer-detail status + const char * m_name; // name of item + uint64_t m_explength; // expected length of item + uint64_t m_length; // actual length of item + util::hash_collection m_exphashes; // expected hash data + util::hash_collection m_hashes; // actual hash information + std::add_pointer_t<device_type> m_shared_device; // device that shares the ROM }; using record_list = std::list<audit_record>; @@ -166,7 +166,6 @@ private: audit_record &audit_one_rom(const std::vector<std::string> &searchpath, const rom_entry *rom); template <typename... T> audit_record &audit_one_disk(const rom_entry *rom, T &&... args); void compute_status(audit_record &record, const rom_entry *rom, bool found); - device_t *find_shared_device(device_t &device, const char *name, const util::hash_collection &romhashes, uint64_t romlength); // internal state record_list m_record_list; diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 4785b718d68..978227bade0 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -343,7 +343,7 @@ int cli_frontend::execute(std::vector<std::string> &args) } util::archive_file::cache_clear(); - global_free(manager); + delete manager; return m_result; } diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 4f44c3ad9d4..9afe6827cfd 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1570,7 +1570,7 @@ void lua_engine::initialize() * debugger.execution_state - accessor for active cpu run state */ - struct wrap_textbuf { wrap_textbuf(text_buffer *buf) { textbuf = buf; }; text_buffer *textbuf; }; + struct wrap_textbuf { wrap_textbuf(const text_buffer &buf) : textbuf(buf) { } std::reference_wrapper<const text_buffer> textbuf; }; auto debugger_type = sol().registry().create_simple_usertype<debugger_manager>("new", sol::no_constructor); debugger_type.set("command", [](debugger_manager &debug, const std::string &cmd) { debug.console().execute_command(cmd, false); }); diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp index 908da0e2bf6..b996bae1dc0 100644 --- a/src/frontend/mame/mame.cpp +++ b/src/frontend/mame/mame.cpp @@ -10,38 +10,44 @@ #include "emu.h" #include "mame.h" + +#include "ui/inifile.h" +#include "ui/selgame.h" +#include "ui/simpleselgame.h" +#include "ui/ui.h" + +#include "cheat.h" +#include "clifront.h" #include "emuopts.h" +#include "luaengine.h" #include "mameopts.h" #include "pluginopts.h" -#include "osdepend.h" #include "validity.h" -#include "clifront.h" -#include "luaengine.h" -#include <ctime> -#include "ui/ui.h" -#include "ui/selgame.h" -#include "ui/simpleselgame.h" -#include "cheat.h" -#include "ui/inifile.h" + #include "xmlfile.h" +#include "osdepend.h" + +#include <ctime> + + //************************************************************************** // MACHINE MANAGER //************************************************************************** -mame_machine_manager* mame_machine_manager::m_manager = nullptr; +mame_machine_manager *mame_machine_manager::s_manager = nullptr; mame_machine_manager* mame_machine_manager::instance(emu_options &options, osd_interface &osd) { - if (!m_manager) - m_manager = global_alloc(mame_machine_manager(options, osd)); + if (!s_manager) + s_manager = new mame_machine_manager(options, osd); - return m_manager; + return s_manager; } mame_machine_manager* mame_machine_manager::instance() { - return m_manager; + return s_manager; } //------------------------------------------------- @@ -51,7 +57,7 @@ mame_machine_manager* mame_machine_manager::instance() mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &osd) : machine_manager(options, osd), m_plugins(std::make_unique<plugin_options>()), - m_lua(global_alloc(lua_engine)), + m_lua(std::make_unique<lua_engine>()), m_new_driver_pending(nullptr), m_firstrun(true), m_autoboot_timer(nullptr) @@ -65,8 +71,8 @@ mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &o mame_machine_manager::~mame_machine_manager() { - global_free(m_lua); - m_manager = nullptr; + m_lua.reset(); + s_manager = nullptr; } diff --git a/src/frontend/mame/mame.h b/src/frontend/mame/mame.h index 041612de758..037d714b39c 100644 --- a/src/frontend/mame/mame.h +++ b/src/frontend/mame/mame.h @@ -35,7 +35,7 @@ public: ~mame_machine_manager(); plugin_options &plugins() const { return *m_plugins; } - lua_engine *lua() { return m_lua; } + lua_engine *lua() { return m_lua.get(); } virtual void update_machine() override; @@ -72,12 +72,12 @@ private: mame_machine_manager &operator=(mame_machine_manager &&) = delete; std::unique_ptr<plugin_options> m_plugins; // pointer to plugin options - lua_engine * m_lua; + std::unique_ptr<lua_engine> m_lua; const game_driver * m_new_driver_pending; // pointer to the next pending driver bool m_firstrun; - static mame_machine_manager* m_manager; + static mame_machine_manager *s_manager; emu_timer *m_autoboot_timer; // autoboot timer std::unique_ptr<mame_ui_manager> m_ui; // internal data from ui.cpp std::unique_ptr<cheat_manager> m_cheat; // internal data from cheat.cpp diff --git a/src/frontend/mame/ui/icorender.cpp b/src/frontend/mame/ui/icorender.cpp index bea85f9dd60..5bda0836838 100644 --- a/src/frontend/mame/ui/icorender.cpp +++ b/src/frontend/mame/ui/icorender.cpp @@ -19,6 +19,7 @@ #include "emu.h" #include "icorender.h" +#include "util/msdib.h" #include "util/png.h" #include <algorithm> @@ -26,11 +27,10 @@ #include <cstdint> #include <cstring> -// need to set LOG_OUTPUT_STREAM because there's no logerror outside devices -#define LOG_OUTPUT_STREAM std::cerr +// need to set LOG_OUTPUT_FUNC or LOG_OUTPUT_STREAM because there's no logerror outside devices +#define LOG_OUTPUT_FUNC osd_printf_verbose #define LOG_GENERAL (1U << 0) -#define LOG_DIB (1U << 1) //#define VERBOSE (LOG_GENERAL | LOG_DIB) @@ -41,16 +41,6 @@ namespace ui { namespace { -// DIB compression schemes -enum : uint32_t -{ - DIB_COMP_NONE = 0, - DIB_COMP_RLE8 = 1, - DIB_COMP_RLE4 = 2, - DIB_COMP_BITFIELDS = 3 -}; - - // ICO file header struct icon_dir_t { @@ -83,67 +73,6 @@ struct icon_dir_entry_t uint32_t offset; // offset to image data from start of file }; -// old-style DIB header -struct bitmap_core_header_t -{ - uint32_t size; // size of the header (12, 16 or 64) - int16_t width; // width of bitmap in pixels - int16_t height; // height of the image in pixels - uint16_t planes; // number of colour planes (must be 1) - uint16_t bpp; // bits per pixel -}; - -// new-style DIB header -struct bitmap_info_header_t -{ - uint32_t size; // size of the header - int32_t width; // width of bitmap in pixels - int32_t height; // height of bitmap in pixels - uint16_t planes; // number of colour planes (must be 1) - uint16_t bpp; // bits per pixel - uint32_t comp; // compression method - uint32_t rawsize; // size of bitmap data after decompression or 0 if uncompressed - int32_t hres; // horizontal resolution in pixels/metre - int32_t vres; // horizontal resolution in pixels/metre - uint32_t colors; // number of colours or 0 for 1 << bpp - uint32_t important; // number of important colours or 0 if all important - uint32_t red; // red field mask - must be contiguous - uint32_t green; // green field mask - must be contiguous - uint32_t blue; // blue field mask - must be contiguous - uint32_t alpha; // alpha field mask - must be contiguous -}; - - -bool dib_parse_mask(uint32_t mask, unsigned &shift, unsigned &bits) -{ - shift = count_leading_zeros(mask); - mask <<= shift; - bits = count_leading_ones(mask); - mask <<= shift; - shift = 32 - shift - bits; - return !mask; -} - - -void dib_truncate_channel(unsigned &shift, unsigned &bits) -{ - if (8U < bits) - { - unsigned const excess(bits - 8); - shift += excess; - bits -= excess; - } -} - - -uint8_t dib_splat_sample(uint8_t val, unsigned bits) -{ - assert(8U >= bits); - for (val <<= (8U - bits); bits && (8U > bits); bits <<= 1) - val |= val >> bits; - return val; -} - bool load_ico_png(util::core_file &fp, icon_dir_entry_t const &dir, bitmap_argb32 &bitmap) { @@ -151,10 +80,10 @@ bool load_ico_png(util::core_file &fp, icon_dir_entry_t const &dir, bitmap_argb3 if (9U >= dir.size) return false; fp.seek(dir.offset, SEEK_SET); - png_error const err(png_read_bitmap(fp, bitmap)); + util::png_error const err(util::png_read_bitmap(fp, bitmap)); switch (err) { - case PNGERR_NONE: + case util::png_error::NONE: // found valid PNG image assert(bitmap.valid()); if ((dir.get_width() == bitmap.width()) && ((dir.get_height() == bitmap.height()))) @@ -172,7 +101,7 @@ bool load_ico_png(util::core_file &fp, icon_dir_entry_t const &dir, bitmap_argb3 } return true; - case PNGERR_BAD_SIGNATURE: + case util::png_error::BAD_SIGNATURE: // doesn't look like PNG data - just fall back to DIB without the file header return false; @@ -190,426 +119,37 @@ bool load_ico_png(util::core_file &fp, icon_dir_entry_t const &dir, bitmap_argb3 bool load_ico_dib(util::core_file &fp, icon_dir_entry_t const &dir, bitmap_argb32 &bitmap) { - // check that these things haven't been padded somehow - static_assert(sizeof(bitmap_core_header_t) == 12U, "compiler has applied padding to bitmap_core_header_t"); - static_assert(sizeof(bitmap_info_header_t) == 56U, "compiler has applied padding to bitmap_info_header_t"); - - // ensure the header fits in the space for the image data - union { bitmap_core_header_t core; bitmap_info_header_t info; } header; - assert(&header.core.size == &header.info.size); - if (sizeof(header.core) > dir.size) - return false; - std::memset(&header, 0, sizeof(header)); fp.seek(dir.offset, SEEK_SET); - if (fp.read(&header.core.size, sizeof(header.core.size)) != sizeof(header.core.size)) - { - LOG( - "Error reading DIB header size from ICO file at offset %u (directory size %u)\n", - dir.offset, - dir.size); - return false; - } - header.core.size = little_endianize_int32(header.core.size); - if (dir.size < header.core.size) - { - LOG( - "ICO file image data at %u (%u bytes) is too small for DIB header (%u bytes)\n", - dir.offset, - dir.size, - header.core.size); - return false; - } - - // identify and read the header - convert OS/2 headers to Windows 3 format - unsigned palette_bytes(4U); - switch (header.core.size) + util::msdib_error const err(util::msdib_read_bitmap_data(fp, bitmap, dir.size, dir.get_height())); + switch (err) { - case 16U: - case 64U: - // extended OS/2 bitmap header with support for compression - LOG( - "ICO image data at %u (%u bytes) uses unsupported OS/2 DIB header (size %u)\n", - dir.offset, - dir.size, - header.core.size); - return false; - - case 12U: - // introduced in OS/2 and Windows 2.0 + case util::msdib_error::NONE: + // found valid DIB image + assert(bitmap.valid()); + if ((dir.get_width() == bitmap.width()) && ((dir.get_height() == bitmap.height()))) { - palette_bytes = 3U; - uint32_t const header_read(std::min<uint32_t>(header.core.size, sizeof(header.core)) - sizeof(header.core.size)); - if (fp.read(&header.core.width, header_read) != header_read) - { - LOG("Error reading DIB core header from ICO file image data at %u (%u bytes)\n", dir.offset, dir.size); - return false; - } - fp.seek(header.core.size - sizeof(header.core.size) - header_read, SEEK_CUR); - header.core.width = little_endianize_int16(header.core.width); - header.core.height = little_endianize_int16(header.core.height); - header.core.planes = little_endianize_int16(header.core.planes); - header.core.bpp = little_endianize_int16(header.core.bpp); - LOGMASKED( - LOG_DIB, - "Read DIB core header from ICO file image data at %u: %d*%d, %u planes, %u bpp\n", - dir.offset, - header.core.width, - header.core.height, - header.core.planes, - header.core.bpp); - - // this works because the core header only aliases the width/height of the info header - header.info.bpp = header.core.bpp; - header.info.planes = header.core.planes; - header.info.height = header.core.height; - header.info.width = header.core.width; - header.info.size = 40U; + LOG("Loaded %d*%d pixel DIB image from ICO file\n", bitmap.width(), bitmap.height()); } - break; - - default: - // the next version will be longer - if (124U >= header.core.size) + else { LOG( - "ICO image data at %u (%u bytes) uses unsupported DIB header format (size %u)\n", - dir.offset, - dir.size, - header.core.size); - return false; - } - // fall through - case 40U: - case 52U: - case 56U: - case 108U: - case 124U: - // the Windows 3 bitmap header with optional extensions - { - palette_bytes = 4U; - uint32_t const header_read(std::min<uint32_t>(header.info.size, sizeof(header.info)) - sizeof(header.info.size)); - if (fp.read(&header.info.width, header_read) != header_read) - { - LOG("Error reading DIB info header from ICO file image data at %u (%u bytes)\n", dir.offset, dir.size); - return false; - } - fp.seek(header.info.size - sizeof(header.info.size) - header_read, SEEK_CUR); - header.info.width = little_endianize_int32(header.info.width); - header.info.height = little_endianize_int32(header.info.height); - header.info.planes = little_endianize_int16(header.info.planes); - header.info.bpp = little_endianize_int16(header.info.bpp); - header.info.comp = little_endianize_int32(header.info.comp); - header.info.rawsize = little_endianize_int32(header.info.rawsize); - header.info.hres = little_endianize_int32(header.info.hres); - header.info.vres = little_endianize_int32(header.info.vres); - header.info.colors = little_endianize_int32(header.info.colors); - header.info.important = little_endianize_int32(header.info.important); - header.info.red = little_endianize_int32(header.info.red); - header.info.green = little_endianize_int32(header.info.green); - header.info.blue = little_endianize_int32(header.info.blue); - header.info.alpha = little_endianize_int32(header.info.alpha); - LOGMASKED( - LOG_DIB, - "Read DIB info header from ICO file image data at %u: %d*%d (%d*%d ppm), %u planes, %u bpp %u/%s%u colors\n", - dir.offset, - header.info.width, - header.info.height, - header.info.hres, - header.info.vres, - header.info.planes, - header.info.bpp, - header.info.important, - header.info.colors ? "" : "2^", - header.info.colors ? header.info.colors : header.info.bpp); - } - break; - } - - // check for unsupported planes/bit depth - if ((1U != header.info.planes) || !header.info.bpp || (32U < header.info.bpp) || ((8U < header.info.bpp) ? (header.info.bpp % 8) : (8 % header.info.bpp))) - { - LOG( - "ICO file DIB image data at %u uses unsupported planes/bits per pixel %u*%u\n", - dir.offset, - header.info.planes, - header.info.bpp); - return false; - } - - // check dimensions - if ((0 >= header.info.width) || (0 == header.info.height)) - { - LOG( - "ICO file DIB image data at %u has invalid dimensions %u*%u\n", - dir.offset, - header.info.width, - header.info.height); - return false; - } - bool const top_down(0 > header.info.height); - if (top_down) - header.info.height = -header.info.height; - bool have_and_mask((2 * dir.get_height()) == header.info.height); - if (!have_and_mask && (dir.get_height() != header.info.height)) - { - osd_printf_verbose( - "ICO file DIB image data at %lu height %ld doesn't match directory height %u with or without AND mask\n", - (unsigned long)dir.offset, - (long)header.info.height, - dir.get_height()); - return false; - } - if (have_and_mask) - header.info.height >>= 1; - - // ensure compression scheme is supported - bool indexed(true), no_palette(false); - switch (header.info.comp) - { - case DIB_COMP_NONE: - // uncompressed - direct colour with implied bitfields if more than eight bits/pixel - indexed = 8U >= header.info.bpp; - if (indexed) - { - if ((1U << header.info.bpp) < header.info.colors) - { - osd_printf_verbose( - "ICO file DIB image data at %lu has oversized palette with %lu entries for %u bits per pixel\n", - (unsigned long)dir.offset, - (unsigned long)header.info.colors, - (unsigned)header.info.bpp); - } - } - if (!indexed) - { - no_palette = true; - switch(header.info.bpp) - { - case 16U: - header.info.red = 0x00007c00; - header.info.green = 0x000003e0; - header.info.blue = 0x0000001f; - header.info.alpha = 0x00000000; - break; - case 24U: - case 32U: - header.info.red = 0x00ff0000; - header.info.green = 0x0000ff00; - header.info.blue = 0x000000ff; - header.info.alpha = 0x00000000; - break; - } - } - break; - - case DIB_COMP_BITFIELDS: - // uncompressed direct colour with explicitly-specified bitfields - indexed = false; - if (offsetof(bitmap_info_header_t, alpha) > header.info.size) - { - osd_printf_verbose( - "ICO file DIB image data at %lu specifies bit masks but is too small (size %lu)\n", - (unsigned long)dir.offset, - (unsigned long)header.info.size); - return false; + "Loaded %d*%d pixel DIB image from ICO file (directory indicated %u*%u)\n", + bitmap.width(), + bitmap.height(), + dir.get_width(), + dir.get_height()); } - break; + return true; default: - LOG("ICO file DIB image data at %u uses unsupported compression scheme %u\n", header.info.comp); - return false; - } - - // we can now calculate the size of the palette and row data - size_t const palette_entries( - indexed - ? ((1U == header.info.bpp) ? 2U : header.info.colors ? header.info.colors : (1U << header.info.bpp)) - : (no_palette ? 0U : header.info.colors)); - size_t const palette_size(palette_bytes * palette_entries); - size_t const row_bytes(((31 + (header.info.width * header.info.bpp)) >> 5) << 2); - size_t const mask_row_bytes(((31 + header.info.width) >> 5) << 2); - size_t const required_size( - header.info.size + - palette_size + - ((row_bytes + (have_and_mask ? mask_row_bytes : 0U)) * header.info.height)); - if (required_size > dir.size) - { + // invalid DIB data or I/O error LOG( - "ICO file image data at %u (%u bytes) smaller than calculated DIB data size (%u bytes)\n", + "Error %u reading DIB image data from ICO file at offset %u (directory size %u)\n", + unsigned(err), dir.offset, - dir.size, - required_size); + dir.size); return false; } - - // load the palette for indexed colour formats or the shifts for direct colour formats - unsigned red_shift(0), green_shift(0), blue_shift(0), alpha_shift(0); - unsigned red_bits(0), green_bits(0), blue_bits(0), alpha_bits(0); - std::unique_ptr<rgb_t []> palette; - if (indexed) - { - // read palette and convert - std::unique_ptr<uint8_t []> palette_data(new uint8_t [palette_size]); - if (fp.read(palette_data.get(), palette_size) != palette_size) - { - LOG("Error reading palette from ICO file DIB image data at %u (%u bytes)\n", dir.offset, dir.size); - return false; - } - size_t const palette_usable(std::min<size_t>(palette_entries, size_t(1) << header.info.bpp)); - palette.reset(new rgb_t [palette_usable]); - uint8_t const *ptr(palette_data.get()); - for (size_t i = 0; palette_usable > i; ++i, ptr += palette_bytes) - palette[i] = rgb_t(ptr[2], ptr[1], ptr[0]); - } - else - { - // skip over the palette if necessary - if (palette_entries) - fp.seek(palette_bytes * palette_entries, SEEK_CUR); - - // convert masks to shifts - bool const masks_contiguous( - dib_parse_mask(header.info.red, red_shift, red_bits) && - dib_parse_mask(header.info.green, green_shift, green_bits) && - dib_parse_mask(header.info.blue, blue_shift, blue_bits) && - dib_parse_mask(header.info.alpha, alpha_shift, alpha_bits)); - if (!masks_contiguous) - { - osd_printf_verbose( - "ICO file DIB image data at %lu specifies non-contiguous channel masks 0x%lx | 0x%lx | 0x%lx | 0x%lx\n", - (unsigned long)dir.offset, - (unsigned long)header.info.red, - (unsigned long)header.info.green, - (unsigned long)header.info.blue, - (unsigned long)header.info.alpha); - } - if ((32U != header.info.bpp) && ((header.info.red | header.info.green | header.info.blue | header.info.alpha) >> header.info.bpp)) - { - LOG( - "ICO file DIB image data at %lu specifies channel masks 0x%x | 0x%x | 0x%x | 0x%x that exceed %u bits per pixel\n", - dir.offset, - header.info.red, - header.info.green, - header.info.blue, - header.info.alpha, - header.info.bpp); - return false; - } - LOGMASKED( - LOG_DIB, - "DIB from ICO file image data at %1$u using channels: R((x >> %3$u) & 0x%4$0*2$x) G((x >> %5$u) & 0x%6$0*2$x) B((x >> %7$u) & 0x%8$0*2$x) A((x >> %9$u) & 0x%10$0*2$x)\n", - dir.offset, - (header.info.bpp + 3) >> 2, - red_shift, - (uint32_t(1) << red_bits) - 1, - green_shift, - (uint32_t(1) << green_bits) - 1, - blue_shift, - (uint32_t(1) << blue_bits) - 1, - alpha_shift, - (uint32_t(1) << alpha_bits) - 1); - - // the MAME bitmap only supports 8 bits/sample maximum - dib_truncate_channel(red_shift, red_bits); - dib_truncate_channel(green_shift, green_bits); - dib_truncate_channel(blue_shift, blue_bits); - dib_truncate_channel(alpha_shift, alpha_bits); - } - - // allocate the bitmap and process row data - std::unique_ptr<uint8_t []> row_data(new uint8_t [row_bytes]); - bitmap.allocate(header.info.width, header.info.height); - int const y_inc(top_down ? 1 : -1); - for (int32_t i = 0, y = top_down ? 0 : (header.info.height - 1); header.info.height > i; ++i, y += y_inc) - { - if (fp.read(row_data.get(), row_bytes) != row_bytes) - { - LOG("Error reading DIB row %d data from ICO image data at %u\n", i, dir.offset); - return false; - } - uint8_t *src(row_data.get()); - uint32_t *dest(&bitmap.pix(y)); - unsigned shift(0U); - for (int32_t x = 0; header.info.width > x; ++x, ++dest) - { - // extract or compose a pixel - uint32_t pix(0U); - if (8U >= header.info.bpp) - { - assert(8U > shift); - pix = *src >> (8U - header.info.bpp); - *src <<= header.info.bpp; - shift += header.info.bpp; - if (8U <= shift) - { - shift = 0U; - ++src; - } - } - else for (shift = 0; header.info.bpp > shift; shift += 8U, ++src) - { - pix |= uint32_t(*src) << shift; - } - - // convert to RGB - if (indexed) - { - if (palette_entries > pix) - { - *dest = palette[pix]; - } - else - { - *dest = rgb_t::transparent(); - osd_printf_verbose( - "ICO file DIB image data at %lu has out-of-range color %lu at (%ld, %ld) with %lu palette entries\n", - (unsigned long)dir.offset, - (unsigned long)pix, - (long)x, - (long)y, - (unsigned long)palette_entries); - } - } - else - { - uint8_t r(dib_splat_sample((pix >> red_shift) & ((uint32_t(1) << red_bits) - 1), red_bits)); - uint8_t g(dib_splat_sample((pix >> green_shift) & ((uint32_t(1) << green_bits) - 1), green_bits)); - uint8_t b(dib_splat_sample((pix >> blue_shift) & ((uint32_t(1) << blue_bits) - 1), blue_bits)); - uint8_t a(dib_splat_sample((pix >> alpha_shift) & ((uint32_t(1) << alpha_bits) - 1), alpha_bits)); - *dest = rgb_t(alpha_bits ? a : 255, r, g, b); - } - } - } - - // process the AND mask if present - if (have_and_mask) - { - for (int32_t i = 0, y = top_down ? 0 : (header.info.height - 1); header.info.height > i; ++i, y += y_inc) - { - if (fp.read(row_data.get(), mask_row_bytes) != mask_row_bytes) - { - LOG("Error reading DIB mask row %d data from ICO image data at %u\n", i, dir.offset); - return false; - } - uint8_t *src(row_data.get()); - uint32_t *dest(&bitmap.pix(y)); - unsigned shift(0U); - for (int32_t x = 0; header.info.width > x; ++x, ++dest) - { - assert(8U > shift); - rgb_t pix(*dest); - *dest = pix.set_a(BIT(*src, 7U - shift) ? 0U : pix.a()); - if (8U <= ++shift) - { - shift = 0U; - ++src; - } - } - } - } - - // we're done! - return true; } diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index 33cbd9223e0..bfb68e40da0 100644 --- a/src/frontend/mame/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -93,7 +93,7 @@ void menu_input_general::populate(float &customtop, float &custombottom) item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item.is_optional = false; item.name = entry.name(); - item.owner_name = nullptr; + item.owner = nullptr; // stop after one, unless we're analog if (item.type == INPUT_TYPE_DIGITAL) @@ -164,7 +164,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom) item.type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; item.is_optional = field.optional(); item.name = field.name(); - item.owner_name = field.device().tag(); + item.owner = &field.device(); // stop after one, unless we're analog if (item.type == INPUT_TYPE_DIGITAL) @@ -180,7 +180,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom) data.end(), [] (const input_item_data &i1, const input_item_data &i2) { - int cmp = strcmp(i1.owner_name, i2.owner_name); + int cmp = strcmp(i1.owner->tag(), i2.owner->tag()); if (cmp < 0) return true; if (cmp > 0) @@ -431,21 +431,24 @@ void menu_input::populate_sorted(float &customtop, float &custombottom) // build the menu std::string text, subtext; - std::string prev_owner; + const device_t *prev_owner = nullptr; bool first_entry = true; for (input_item_data &item : data) { // generate the name of the item itself, based off the base name and the type assert(nameformat[item.type] != nullptr); - if (item.owner_name && strcmp(item.owner_name, prev_owner.c_str()) != 0) + if (item.owner && (item.owner != prev_owner)) { if (first_entry) first_entry = false; else item_append(menu_item_type::SEPARATOR); - item_append(string_format("[root%s]", item.owner_name), "", 0, nullptr); - prev_owner.assign(item.owner_name); + if (item.owner->owner()) + item_append(string_format(_("%1$s [root%2$s]"), item.owner->type().fullname(), item.owner->tag()), "", 0, nullptr); + else + item_append(string_format(_("[root%1$s]"), item.owner->tag()), "", 0, nullptr); + prev_owner = item.owner; } text = string_format(nameformat[item.type], item.name); diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h index d2e41780211..01649b0b1ef 100644 --- a/src/frontend/mame/ui/inputmap.h +++ b/src/frontend/mame/ui/inputmap.h @@ -55,7 +55,7 @@ protected: input_seq seq; // copy of the live sequence const input_seq * defseq = nullptr; // pointer to the default sequence const char * name = nullptr; // pointer to the base name of the item - const char * owner_name = nullptr; // pointer to the name of the owner of the item + const device_t * owner = nullptr; // pointer to the owner of the item ioport_group group = IPG_INVALID; // group type uint8_t type = 0U; // type of port bool is_optional = false; // true if this input is considered optional diff --git a/src/frontend/mame/ui/keyboard.cpp b/src/frontend/mame/ui/keyboard.cpp new file mode 100644 index 00000000000..3d58d28d2d9 --- /dev/null +++ b/src/frontend/mame/ui/keyboard.cpp @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*************************************************************************** + + ui/keyboard.cpp + + Keyboard mode menu. + +***************************************************************************/ + +#include "emu.h" +#include "ui/keyboard.h" + +#include "natkeyboard.h" + + +namespace ui { + +namespace { + +constexpr uintptr_t ITEM_KBMODE = 0x00000100; +constexpr uintptr_t ITEM_KBDEV_FIRST = 0x00000200; + +} // anonymous namespace + + +menu_keyboard_mode::menu_keyboard_mode(mame_ui_manager &mui, render_container &container) : menu(mui, container) +{ +} + +void menu_keyboard_mode::populate(float &customtop, float &custombottom) +{ + natural_keyboard &natkbd(machine().ioport().natkeyboard()); + + if (natkbd.can_post()) + { + bool const natmode(natkbd.in_use()); + item_append( + _("Keyboard Mode"), + natmode ? _("Natural") : _("Emulated"), + natmode ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, + reinterpret_cast<void *>(ITEM_KBMODE)); + item_append(menu_item_type::SEPARATOR); + } + + uintptr_t ref(ITEM_KBDEV_FIRST); + for (size_t i = 0; natkbd.keyboard_count() > i; ++i, ++ref) + { + device_t &kbddev(natkbd.keyboard_device(i)); + bool const enabled(natkbd.keyboard_enabled(i)); + item_append( + util::string_format( + kbddev.owner() ? _("%1$s [root%2$s]") : _("[root%2$s]"), + kbddev.type().fullname(), + kbddev.tag()), + enabled ? _("Enabled") : _("Disabled"), + enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, + reinterpret_cast<void *>(ref)); + } + item_append(menu_item_type::SEPARATOR); +} + +menu_keyboard_mode::~menu_keyboard_mode() +{ +} + +void menu_keyboard_mode::handle() +{ + event const *const menu_event(process(0)); + if (menu_event && uintptr_t(menu_event->itemref)) + { + natural_keyboard &natkbd(machine().ioport().natkeyboard()); + uintptr_t const ref(uintptr_t(menu_event->itemref)); + bool const left(IPT_UI_LEFT == menu_event->iptkey); + bool const right(IPT_UI_RIGHT == menu_event->iptkey); + if (ITEM_KBMODE == ref) + { + if ((left || right) && (natkbd.in_use() != right)) + { + natkbd.set_in_use(right); + reset(reset_options::REMEMBER_REF); + } + } + else if (ITEM_KBDEV_FIRST <= ref) + { + if ((left || right) && (natkbd.keyboard_enabled(ref - ITEM_KBDEV_FIRST) != right)) + { + if (right) + natkbd.enable_keyboard(ref - ITEM_KBDEV_FIRST); + else + natkbd.disable_keyboard(ref - ITEM_KBDEV_FIRST); + reset(reset_options::REMEMBER_REF); + } + } + } +} + +} // namespace ui diff --git a/src/frontend/mame/ui/keyboard.h b/src/frontend/mame/ui/keyboard.h new file mode 100644 index 00000000000..899385e74c2 --- /dev/null +++ b/src/frontend/mame/ui/keyboard.h @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*************************************************************************** + + ui/keyboard.h + + Keyboard mode menu. + +***************************************************************************/ +#ifndef MAME_FRONTEND_UI_KEYBOARD_H +#define MAME_FRONTEND_UI_KEYBOARD_H + +#pragma once + +#include "ui/menu.h" + + +namespace ui { + +class menu_keyboard_mode : public menu +{ +public: + menu_keyboard_mode(mame_ui_manager &mui, render_container &container); + virtual ~menu_keyboard_mode(); + +private: + virtual void populate(float &customtop, float &custombottom) override; + virtual void handle() override; +}; + +} // namespace ui + +#endif // MAME_FRONTEND_UI_KEYBOARD_H diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp index bd7f274da29..b1a0e238935 100644 --- a/src/frontend/mame/ui/mainmenu.cpp +++ b/src/frontend/mame/ui/mainmenu.cpp @@ -22,6 +22,7 @@ #include "ui/info_pty.h" #include "ui/inifile.h" #include "ui/inputmap.h" +#include "ui/keyboard.h" #include "ui/miscmenu.h" #include "ui/pluginopt.h" #include "ui/selgame.h" @@ -108,7 +109,7 @@ void menu_main::populate(float &customtop, float &custombottom) if (network_interface_iterator(machine().root_device()).first() != nullptr) item_append(_("Network Devices"), "", 0, (void*)NETWORK_DEVICES); - if (ui().machine_info().has_keyboard() && machine().ioport().natkeyboard().can_post()) + if (machine().ioport().natkeyboard().keyboard_count()) item_append(_("Keyboard Mode"), "", 0, (void *)KEYBOARD_MODE); item_append(_("Slider Controls"), "", 0, (void *)SLIDERS); diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 7ce0beb0fb1..b0a84d3a95c 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -92,10 +92,17 @@ menu::global_state::global_state(running_machine &machine, ui_options const &opt { m_bgrnd_bitmap = std::make_unique<bitmap_argb32>(0, 0); emu_file backgroundfile(".", OPEN_FLAG_READ); - render_load_jpeg(*m_bgrnd_bitmap, backgroundfile, nullptr, "background.jpg"); + if (backgroundfile.open("background.jpg") == osd_file::error::NONE) + { + render_load_jpeg(*m_bgrnd_bitmap, backgroundfile); + backgroundfile.close(); + } - if (!m_bgrnd_bitmap->valid()) - render_load_png(*m_bgrnd_bitmap, backgroundfile, nullptr, "background.png"); + if (!m_bgrnd_bitmap->valid() && (backgroundfile.open("background.png") == osd_file::error::NONE)) + { + render_load_png(*m_bgrnd_bitmap, backgroundfile); + backgroundfile.close(); + } if (m_bgrnd_bitmap->valid()) m_bgrnd_texture->set_bitmap(*m_bgrnd_bitmap, m_bgrnd_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -904,110 +911,110 @@ void menu::handle_events(uint32_t flags, event &ev) { switch (local_menu_event.event_type) { - // if we are hovering over a valid item, select it with a single click - case ui_event::MOUSE_DOWN: - if (custom_mouse_down()) - return; + // if we are hovering over a valid item, select it with a single click + case ui_event::type::MOUSE_DOWN: + if (custom_mouse_down()) + return; - if ((flags & PROCESS_ONLYCHAR) == 0) + if ((flags & PROCESS_ONLYCHAR) == 0) + { + if (m_hover >= 0 && m_hover < m_items.size()) + m_selected = m_hover; + else if (m_hover == HOVER_ARROW_UP) { - if (m_hover >= 0 && m_hover < m_items.size()) - m_selected = m_hover; - else if (m_hover == HOVER_ARROW_UP) + if ((flags & FLAG_UI_DATS) != 0) { - if ((flags & FLAG_UI_DATS) != 0) - { - top_line -= m_visible_items - (last_item_visible() ? 1 : 0); - return; - } - m_selected -= m_visible_items; - if (m_selected < 0) - m_selected = 0; top_line -= m_visible_items - (last_item_visible() ? 1 : 0); + return; } - else if (m_hover == HOVER_ARROW_DOWN) + m_selected -= m_visible_items; + if (m_selected < 0) + m_selected = 0; + top_line -= m_visible_items - (last_item_visible() ? 1 : 0); + } + else if (m_hover == HOVER_ARROW_DOWN) + { + if ((flags & FLAG_UI_DATS) != 0) { - if ((flags & FLAG_UI_DATS) != 0) - { - top_line += m_visible_lines - 2; - return; - } - m_selected += m_visible_lines - 2 + is_first_selected(); - if (m_selected > m_items.size() - 1) - m_selected = m_items.size() - 1; top_line += m_visible_lines - 2; + return; } + m_selected += m_visible_lines - 2 + is_first_selected(); + if (m_selected > m_items.size() - 1) + m_selected = m_items.size() - 1; + top_line += m_visible_lines - 2; } - break; + } + break; - // if we are hovering over a valid item, fake a UI_SELECT with a double-click - case ui_event::MOUSE_DOUBLE_CLICK: - if (!(flags & PROCESS_ONLYCHAR) && m_hover >= 0 && m_hover < m_items.size()) + // if we are hovering over a valid item, fake a UI_SELECT with a double-click + case ui_event::type::MOUSE_DOUBLE_CLICK: + if (!(flags & PROCESS_ONLYCHAR) && m_hover >= 0 && m_hover < m_items.size()) + { + m_selected = m_hover; + ev.iptkey = IPT_UI_SELECT; + if (is_last_selected()) { - m_selected = m_hover; - ev.iptkey = IPT_UI_SELECT; - if (is_last_selected()) + ev.iptkey = IPT_UI_CANCEL; + stack_pop(); + } + stop = true; + } + break; + + // caught scroll event + case ui_event::type::MOUSE_WHEEL: + if (!(flags & PROCESS_ONLYCHAR)) + { + if (local_menu_event.zdelta > 0) + { + if ((flags & FLAG_UI_DATS) != 0) { - ev.iptkey = IPT_UI_CANCEL; - stack_pop(); + top_line -= local_menu_event.num_lines; + return; } - stop = true; + if (is_first_selected()) + select_last_item(); + else + { + m_selected -= local_menu_event.num_lines; + validate_selection(-1); + } + top_line -= (m_selected <= top_line && top_line != 0); + if (m_selected <= top_line && m_visible_items != m_visible_lines) + top_line -= local_menu_event.num_lines; } - break; - - // caught scroll event - case ui_event::MOUSE_WHEEL: - if (!(flags & PROCESS_ONLYCHAR)) + else { - if (local_menu_event.zdelta > 0) + if ((flags & FLAG_UI_DATS)) { - if ((flags & FLAG_UI_DATS) != 0) - { - top_line -= local_menu_event.num_lines; - return; - } - if (is_first_selected()) - select_last_item(); - else - { - m_selected -= local_menu_event.num_lines; - validate_selection(-1); - } - top_line -= (m_selected <= top_line && top_line != 0); - if (m_selected <= top_line && m_visible_items != m_visible_lines) - top_line -= local_menu_event.num_lines; + top_line += local_menu_event.num_lines; + return; } + if (is_last_selected()) + select_first_item(); else { - if ((flags & FLAG_UI_DATS)) - { - top_line += local_menu_event.num_lines; - return; - } - if (is_last_selected()) - select_first_item(); - else - { - m_selected += local_menu_event.num_lines; - validate_selection(1); - } - top_line += (m_selected >= top_line + m_visible_items + (top_line != 0)); - if (m_selected >= (top_line + m_visible_items + (top_line != 0))) - top_line += local_menu_event.num_lines; + m_selected += local_menu_event.num_lines; + validate_selection(1); } + top_line += (m_selected >= top_line + m_visible_items + (top_line != 0)); + if (m_selected >= (top_line + m_visible_items + (top_line != 0))) + top_line += local_menu_event.num_lines; } - break; + } + break; - // translate CHAR events into specials - case ui_event::IME_CHAR: - ev.iptkey = IPT_SPECIAL; - ev.unichar = local_menu_event.ch; - stop = true; - break; + // translate CHAR events into specials + case ui_event::type::IME_CHAR: + ev.iptkey = IPT_SPECIAL; + ev.unichar = local_menu_event.ch; + stop = true; + break; - // ignore everything else - default: - break; + // ignore everything else + default: + break; } } } @@ -1234,7 +1241,7 @@ uint32_t menu::ui_handler(render_container &container, mame_ui_manager &mui) // if we have no menus stacked up, start with the main menu if (!state->topmost_menu<menu>()) - state->stack_push(std::unique_ptr<menu>(global_alloc_clear<menu_main>(mui, container))); + state->stack_push(std::unique_ptr<menu>(make_unique_clear<menu_main>(mui, container))); // update the menu state if (state->topmost_menu<menu>()) diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 800b0b6ca7b..5a7d4374bf6 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -100,12 +100,12 @@ public: template <typename T, typename... Params> static void stack_push(Params &&... args) { - stack_push(std::unique_ptr<menu>(global_alloc_clear<T>(std::forward<Params>(args)...))); + stack_push(std::unique_ptr<menu>(make_unique_clear<T>(std::forward<Params>(args)...))); } template <typename T, typename... Params> static void stack_push_special_main(Params &&... args) { - std::unique_ptr<menu> ptr(global_alloc_clear<T>(std::forward<Params>(args)...)); + std::unique_ptr<menu> ptr(make_unique_clear<T>(std::forward<Params>(args)...)); ptr->set_special_main_menu(true); stack_push(std::move(ptr)); } diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 82b7916e3a5..f0ab531360e 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -23,7 +23,6 @@ #include "mameopts.h" #include "pluginopts.h" #include "drivenum.h" -#include "natkeyboard.h" #include "romload.h" #include "uiinput.h" @@ -41,42 +40,6 @@ namespace ui { ***************************************************************************/ /*------------------------------------------------- - menu_keyboard_mode - menu that --------------------------------------------------*/ - -menu_keyboard_mode::menu_keyboard_mode(mame_ui_manager &mui, render_container &container) : menu(mui, container) -{ -} - -void menu_keyboard_mode::populate(float &customtop, float &custombottom) -{ - bool natural = machine().ioport().natkeyboard().in_use(); - item_append(_("Keyboard Mode:"), natural ? _("Natural") : _("Emulated"), natural ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, nullptr); -} - -menu_keyboard_mode::~menu_keyboard_mode() -{ -} - -void menu_keyboard_mode::handle() -{ - bool natural = machine().ioport().natkeyboard().in_use(); - - /* process the menu */ - const event *menu_event = process(0); - - if (menu_event != nullptr) - { - if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) - { - machine().ioport().natkeyboard().set_in_use(!natural); - reset(reset_options::REMEMBER_REF); - } - } -} - - -/*------------------------------------------------- menu_bios_selection - populates the main bios selection menu -------------------------------------------------*/ diff --git a/src/frontend/mame/ui/miscmenu.h b/src/frontend/mame/ui/miscmenu.h index acff544dee6..c8d833ae4e2 100644 --- a/src/frontend/mame/ui/miscmenu.h +++ b/src/frontend/mame/ui/miscmenu.h @@ -7,7 +7,6 @@ Internal MAME menus for the user interface. ***************************************************************************/ - #ifndef MAME_FRONTEND_UI_MISCMENU_H #define MAME_FRONTEND_UI_MISCMENU_H @@ -24,17 +23,6 @@ namespace ui { -class menu_keyboard_mode : public menu -{ -public: - menu_keyboard_mode(mame_ui_manager &mui, render_container &container); - virtual ~menu_keyboard_mode(); - -private: - virtual void populate(float &customtop, float &custombottom) override; - virtual void handle() override; -}; - class menu_network_devices : public menu { public: diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 6944031e344..13a63965f65 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -786,32 +786,33 @@ void menu_select_game::inkey_select(const event *menu_event) else { // anything else is a driver - - // audit the game first to see if we're going to work driver_enumerator enumerator(machine().options(), *driver); enumerator.next(); + + // if there are software entries, show a software selection menu + for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device())) + { + if (!swlistdev.get_info().empty()) + { + menu::stack_push<menu_select_software>(ui(), container(), *driver); + return; + } + } + + // audit the system ROMs first to see if we're going to work media_auditor auditor(enumerator); media_auditor::summary const summary = auditor.audit_media(AUDIT_VALIDATE_FAST); // if everything looks good, schedule the new driver if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { - for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device())) - { - if (!swlistdev.get_info().empty()) - { - menu::stack_push<menu_select_software>(ui(), container(), *driver); - return; - } - } - if (!select_bios(*driver, false)) launch_system(*driver); } else { // otherwise, display an error - set_error(reset_options::REMEMBER_REF, make_error_text(media_auditor::NOTFOUND != summary, auditor)); + set_error(reset_options::REMEMBER_REF, make_audit_fail_text(media_auditor::NOTFOUND != summary, auditor)); } } } @@ -858,23 +859,25 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) } else if (ui_swinfo->startempty == 1) { - // audit the game first to see if we're going to work driver_enumerator enumerator(machine().options(), *ui_swinfo->driver); enumerator.next(); - media_auditor auditor(enumerator); - media_auditor::summary const summary = auditor.audit_media(AUDIT_VALIDATE_FAST); - if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + // if there are software entries, show a software selection menu + for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device())) { - for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device())) + if (!swlistdev.get_info().empty()) { - if (!swlistdev.get_info().empty()) - { - menu::stack_push<menu_select_software>(ui(), container(), *ui_swinfo->driver); - return; - } + menu::stack_push<menu_select_software>(ui(), container(), *ui_swinfo->driver); + return; } + } + + // audit the system ROMs first to see if we're going to work + media_auditor auditor(enumerator); + media_auditor::summary const summary = auditor.audit_media(AUDIT_VALIDATE_FAST); + if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + { // if everything looks good, schedule the new driver if (!select_bios(*ui_swinfo->driver, false)) { @@ -885,7 +888,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) else { // otherwise, display an error - set_error(reset_options::REMEMBER_REF, make_error_text(media_auditor::NOTFOUND != summary, auditor)); + set_error(reset_options::REMEMBER_REF, make_audit_fail_text(media_auditor::NOTFOUND != summary, auditor)); } } else @@ -907,7 +910,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) else { // otherwise, display an error - set_error(reset_options::REMEMBER_POSITION, make_error_text(media_auditor::NOTFOUND != summary, auditor)); + set_error(reset_options::REMEMBER_POSITION, make_audit_fail_text(media_auditor::NOTFOUND != summary, auditor)); } } } @@ -1455,18 +1458,4 @@ void menu_select_game::filter_selected() } } - -std::string menu_select_game::make_error_text(bool summary, media_auditor const &auditor) -{ - std::ostringstream str; - str << _("The selected machine is missing one or more required ROM or CHD images. Please select a different machine.\n\n"); - if (summary) - { - auditor.summarize(nullptr, &str); - str << "\n"; - } - str << _("Press any key to continue."); - return str.str(); -} - } // namespace ui diff --git a/src/frontend/mame/ui/selgame.h b/src/frontend/mame/ui/selgame.h index da65fee98ce..13bfd1170ac 100644 --- a/src/frontend/mame/ui/selgame.h +++ b/src/frontend/mame/ui/selgame.h @@ -18,8 +18,6 @@ #include <functional> -class media_auditor; - namespace ui { class menu_select_game : public menu_select_launch @@ -86,8 +84,6 @@ private: bool load_available_machines(); void load_custom_filters(); - static std::string make_error_text(bool summary, media_auditor const &auditor); - // General info virtual void general_info(const game_driver *driver, std::string &buffer) override; diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 92bdd3ada64..9a58691b988 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -20,6 +20,7 @@ #include "ui/starimg.ipp" #include "ui/toolbar.ipp" +#include "audit.h" #include "cheat.h" #include "mame.h" #include "mameopts.h" @@ -94,6 +95,62 @@ char const *const hover_msg[] = { __("Show DATs view"), }; + +void load_image(bitmap_argb32 &bitmap, emu_file &file, std::string const &base) +{ + if (file.open(base + ".png") == osd_file::error::NONE) + { + render_load_png(bitmap, file); + file.close(); + } + + if (!bitmap.valid() && (file.open(base + ".jpg") == osd_file::error::NONE)) + { + render_load_jpeg(bitmap, file); + file.close(); + } + + if (!bitmap.valid() && (file.open(base + ".bmp") == osd_file::error::NONE)) + { + render_load_msdib(bitmap, file); + file.close(); + } +} + + +void load_driver_image(bitmap_argb32 &bitmap, emu_file &file, game_driver const &driver) +{ + // try to load snapshot first from saved "0000.png" file + std::string fullname = driver.name; + load_image(bitmap, file, fullname + PATH_SEPARATOR + "0000"); + + // if fail, attempt to load from standard file + if (!bitmap.valid()) + load_image(bitmap, file, fullname); + + // if fail again, attempt to load from parent file + if (!bitmap.valid()) + { + // ignore BIOS sets + bool isclone = strcmp(driver.parent, "0") != 0; + if (isclone) + { + int const cx = driver_list::find(driver.parent); + if ((0 <= cx) && (driver_list::driver(cx).flags & machine_flags::IS_BIOS_ROOT)) + isclone = false; + } + + if (isclone) + { + fullname = driver.parent; + load_image(bitmap, file, fullname + PATH_SEPARATOR + "0000"); + + if (!bitmap.valid()) + load_image(bitmap, file, fullname); + } + } +} + } // anonymous namespace constexpr std::size_t menu_select_launch::MAX_VISIBLE_SEARCH; // stupid non-inline semantics @@ -392,9 +449,9 @@ menu_select_launch::cache::cache(running_machine &machine) // create a texture for snapshot m_snapx_texture.reset(render.texture_alloc(render_texture::hq_scale)); - std::memcpy(&m_no_avail_bitmap.pix32(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t)); + std::memcpy(&m_no_avail_bitmap.pix(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t)); - std::memcpy(&m_star_bitmap.pix32(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_star_bitmap.pix(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t)); m_star_texture.reset(render.texture_alloc()); m_star_texture->set_bitmap(m_star_bitmap, m_star_bitmap.cliprect(), TEXFORMAT_ARGB32); @@ -410,7 +467,7 @@ menu_select_launch::cache::cache(running_machine &machine) m_toolbar_texture.emplace_back(render.texture_alloc(), render); m_sw_toolbar_texture.emplace_back(render.texture_alloc(), render); - std::memcpy(&m_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_toolbar_bitmap.back().pix(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); if (m_toolbar_bitmap.back().valid()) m_toolbar_texture.back()->set_bitmap(m_toolbar_bitmap.back(), m_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32); else @@ -418,7 +475,7 @@ menu_select_launch::cache::cache(running_machine &machine) if ((i == 0U) || (i == 2U)) { - std::memcpy(&m_sw_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_sw_toolbar_bitmap.back().pix(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); if (m_sw_toolbar_bitmap.back().valid()) m_sw_toolbar_texture.back()->set_bitmap(m_sw_toolbar_bitmap.back(), m_sw_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32); else @@ -1147,7 +1204,7 @@ bool menu_select_launch::scale_icon(bitmap_argb32 &&src, texture_and_bitmap &dst dst.bitmap.allocate(max_width, max_height); for (int y = 0; tmp.height() > y; ++y) for (int x = 0; tmp.width() > x; ++x) - dst.bitmap.pix32(y, x) = tmp.pix32(y, x); + dst.bitmap.pix(y, x) = tmp.pix(y, x); dst.texture->set_bitmap(dst.bitmap, dst.bitmap.cliprect(), TEXFORMAT_ARGB32); return true; } @@ -1604,7 +1661,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) switch (local_menu_event.event_type) { // if we are hovering over a valid item, select it with a single click - case ui_event::MOUSE_DOWN: + case ui_event::type::MOUSE_DOWN: if (m_ui_error) { ev.iptkey = IPT_OTHER; @@ -1704,7 +1761,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) break; // if we are hovering over a valid item, fake a UI_SELECT with a double-click - case ui_event::MOUSE_DOUBLE_CLICK: + case ui_event::type::MOUSE_DOUBLE_CLICK: if (hover() >= 0 && hover() < item_count()) { set_selected_index(hover()); @@ -1720,7 +1777,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) break; // caught scroll event - case ui_event::MOUSE_WHEEL: + case ui_event::type::MOUSE_WHEEL: if (hover() >= 0 && hover() < item_count() - skip_main_items - 1) { if (local_menu_event.zdelta > 0) @@ -1750,7 +1807,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) break; // translate CHAR events into specials - case ui_event::IME_CHAR: + case ui_event::type::IME_CHAR: if (exclusive_input_pressed(ev.iptkey, IPT_UI_FOCUS_NEXT, 0) || exclusive_input_pressed(ev.iptkey, IPT_UI_FOCUS_PREV, 0)) { stop = true; @@ -1767,7 +1824,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) } break; - case ui_event::MOUSE_RDOWN: + case ui_event::type::MOUSE_RDOWN: if (hover() >= 0 && hover() < item_count() - skip_main_items - 1) { set_selected_index(hover()); @@ -1790,18 +1847,18 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) { switch (machine().ui_input().peek_event_type()) { - case ui_event::MOUSE_DOWN: - case ui_event::MOUSE_RDOWN: - case ui_event::MOUSE_DOUBLE_CLICK: - case ui_event::MOUSE_WHEEL: + case ui_event::type::MOUSE_DOWN: + case ui_event::type::MOUSE_RDOWN: + case ui_event::type::MOUSE_DOUBLE_CLICK: + case ui_event::type::MOUSE_WHEEL: stop = true; break; - case ui_event::NONE: - case ui_event::MOUSE_MOVE: - case ui_event::MOUSE_LEAVE: - case ui_event::MOUSE_UP: - case ui_event::MOUSE_RUP: - case ui_event::IME_CHAR: + case ui_event::type::NONE: + case ui_event::type::MOUSE_MOVE: + case ui_event::type::MOUSE_LEAVE: + case ui_event::type::MOUSE_UP: + case ui_event::type::MOUSE_RUP: + case ui_event::type::IME_CHAR: break; } } @@ -2225,41 +2282,16 @@ void menu_select_launch::arts_render(float origx1, float origy1, float origx2, f if (software->startempty == 1) { // Load driver snapshot - std::string fullname = std::string(software->driver->name) + ".png"; - render_load_png(tmp_bitmap, snapfile, nullptr, fullname.c_str()); - - if (!tmp_bitmap.valid()) - { - fullname.assign(software->driver->name).append(".jpg"); - render_load_jpeg(tmp_bitmap, snapfile, nullptr, fullname.c_str()); - } + load_driver_image(tmp_bitmap, snapfile, *software->driver); } else { // First attempt from name list - std::string pathname = software->listname; - std::string fullname = software->shortname + ".png"; - render_load_png(tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); + load_image(tmp_bitmap, snapfile, software->listname + PATH_SEPARATOR + software->shortname); + // Second attempt from driver name + part name if (!tmp_bitmap.valid()) - { - fullname.assign(software->shortname).append(".jpg"); - render_load_jpeg(tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); - } - - if (!tmp_bitmap.valid()) - { - // Second attempt from driver name + part name - pathname.assign(software->driver->name).append(software->part); - fullname.assign(software->shortname).append(".png"); - render_load_png(tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); - - if (!tmp_bitmap.valid()) - { - fullname.assign(software->shortname).append(".jpg"); - render_load_jpeg(tmp_bitmap, snapfile, pathname.c_str(), fullname.c_str()); - } - } + load_image(tmp_bitmap, snapfile, software->driver->name + software->part + PATH_SEPARATOR + software->shortname); } m_cache->set_snapx_software(software); @@ -2284,51 +2316,7 @@ void menu_select_launch::arts_render(float origx1, float origy1, float origx2, f { emu_file snapfile(searchstr, OPEN_FLAG_READ); bitmap_argb32 tmp_bitmap; - - // try to load snapshot first from saved "0000.png" file - std::string fullname(driver->name); - render_load_png(tmp_bitmap, snapfile, fullname.c_str(), "0000.png"); - - if (!tmp_bitmap.valid()) - render_load_jpeg(tmp_bitmap, snapfile, fullname.c_str(), "0000.jpg"); - - // if fail, attemp to load from standard file - if (!tmp_bitmap.valid()) - { - fullname.assign(driver->name).append(".png"); - render_load_png(tmp_bitmap, snapfile, nullptr, fullname.c_str()); - - if (!tmp_bitmap.valid()) - { - fullname.assign(driver->name).append(".jpg"); - render_load_jpeg(tmp_bitmap, snapfile, nullptr, fullname.c_str()); - } - } - - // if fail again, attemp to load from parent file - if (!tmp_bitmap.valid()) - { - // set clone status - bool cloneof = strcmp(driver->parent, "0"); - if (cloneof) - { - int cx = driver_list::find(driver->parent); - if ((cx >= 0) && (driver_list::driver(cx).flags & machine_flags::IS_BIOS_ROOT)) - cloneof = false; - } - - if (cloneof) - { - fullname.assign(driver->parent).append(".png"); - render_load_png(tmp_bitmap, snapfile, nullptr, fullname.c_str()); - - if (!tmp_bitmap.valid()) - { - fullname.assign(driver->parent).append(".jpg"); - render_load_jpeg(tmp_bitmap, snapfile, nullptr, fullname.c_str()); - } - } - } + load_driver_image(tmp_bitmap, snapfile, *driver); m_cache->set_snapx_driver(driver); m_switch_image = false; @@ -2412,7 +2400,7 @@ void menu_select_launch::arts_render_images(bitmap_argb32 &&tmp_bitmap, float or for (int x = 0; x < 256; x++) { for (int y = 0; y < 256; y++) - tmp_bitmap.pix32(y, x) = src.pix32(y, x); + tmp_bitmap.pix(y, x) = src.pix(y, x); } no_available = true; } @@ -2475,7 +2463,7 @@ void menu_select_launch::arts_render_images(bitmap_argb32 &&tmp_bitmap, float or for (int x = 0; x < dest_xPixel; x++) for (int y = 0; y < dest_yPixel; y++) - snapx_bitmap.pix32(y + y1, x + x1) = dest_bitmap.pix32(y, x); + snapx_bitmap.pix(y + y1, x + x1) = dest_bitmap.pix(y, x); // apply bitmap m_cache->snapx_texture()->set_bitmap(snapx_bitmap, snapx_bitmap.cliprect(), TEXFORMAT_ARGB32); @@ -2508,6 +2496,20 @@ void menu_select_launch::draw_snapx(float origx1, float origy1, float origx2, fl } +std::string menu_select_launch::make_audit_fail_text(bool found, media_auditor const &auditor) +{ + std::ostringstream str; + str << _("The selected machine is missing one or more required ROM or CHD images. Please select a different machine.\n\n"); + if (found) + { + auditor.summarize(nullptr, &str); + str << "\n"; + } + str << _("Press any key to continue."); + return str.str(); +} + + //------------------------------------------------- // get bios count //------------------------------------------------- diff --git a/src/frontend/mame/ui/selmenu.h b/src/frontend/mame/ui/selmenu.h index e3d532e9cc3..5a3bee798f7 100644 --- a/src/frontend/mame/ui/selmenu.h +++ b/src/frontend/mame/ui/selmenu.h @@ -20,6 +20,7 @@ #include <vector> +class media_auditor; struct ui_software_info; namespace ui { @@ -155,6 +156,8 @@ protected: return (uintptr_t(selected_ref) > skip_main_items) ? selected_ref : m_prev_selected; } + static std::string make_audit_fail_text(bool found, media_auditor const &auditor); + int m_available_items; int skip_main_items; void *m_prev_selected; diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index 84fa109bea6..5a14e3dac7f 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -468,8 +468,17 @@ void menu_select_software::build_software_list() void menu_select_software::inkey_select(const event *menu_event) { ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref; + driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); + media_auditor auditor(drivlist); + drivlist.next(); - if (ui_swinfo->startempty == 1) + // audit the system ROMs first to see if we're going to work + media_auditor::summary const sysaudit = auditor.audit_media(AUDIT_VALIDATE_FAST); + if (sysaudit != media_auditor::CORRECT && sysaudit != media_auditor::BEST_AVAILABLE && sysaudit != media_auditor::NONE_NEEDED) + { + set_error(reset_options::REMEMBER_REF, make_audit_fail_text(media_auditor::NOTFOUND != sysaudit, auditor)); + } + else if (ui_swinfo->startempty == 1) { if (!select_bios(*ui_swinfo->driver, true)) { @@ -479,16 +488,13 @@ void menu_select_software::inkey_select(const event *menu_event) } else { - // first validate - driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); - media_auditor auditor(drivlist); - drivlist.next(); + // first audit the software software_list_device *swlist = software_list_device::find_by_name(*drivlist.config(), ui_swinfo->listname); const software_info *swinfo = swlist->find(ui_swinfo->shortname); - media_auditor::summary const summary = auditor.audit_software(*swlist, *swinfo, AUDIT_VALIDATE_FAST); + media_auditor::summary const swaudit = auditor.audit_software(*swlist, *swinfo, AUDIT_VALIDATE_FAST); - if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) + if (swaudit == media_auditor::CORRECT || swaudit == media_auditor::BEST_AVAILABLE || swaudit == media_auditor::NONE_NEEDED) { if (!select_bios(*ui_swinfo, false) && !select_part(*swinfo, *ui_swinfo)) { @@ -500,11 +506,11 @@ void menu_select_software::inkey_select(const event *menu_event) { // otherwise, display an error std::ostringstream str; - str << _("The selected software is missing one or more required files. Please select a different software.\n\n"); - if (media_auditor::NOTFOUND != summary) + str << _("The selected software is missing one or more required files. Please select a different software item.\n\n"); + if (media_auditor::NOTFOUND != swaudit) { auditor.summarize(nullptr, &str); - str << "\n"; + str << '\n'; } str << _("Press any key to continue."), set_error(reset_options::REMEMBER_POSITION, str.str()); diff --git a/src/frontend/mame/ui/slider.h b/src/frontend/mame/ui/slider.h index 7785518d093..56da6849e81 100644 --- a/src/frontend/mame/ui/slider.h +++ b/src/frontend/mame/ui/slider.h @@ -25,12 +25,12 @@ typedef std::function<std::int32_t (running_machine &, void *, int, std::string struct slider_state { slider_update update; // callback - void * arg; // argument - std::int32_t minval; // minimum value - std::int32_t defval; // default value - std::int32_t maxval; // maximum value - std::int32_t incval; // increment value - int id; + void * arg = nullptr; // argument + std::int32_t minval = 0; // minimum value + std::int32_t defval = 0; // default value + std::int32_t maxval = 0; // maximum value + std::int32_t incval = 0; // increment value + int id = 0; std::string description; // textual description }; diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp index 6df9ff29049..0e61b1710db 100644 --- a/src/frontend/mame/ui/text.cpp +++ b/src/frontend/mame/ui/text.cpp @@ -295,7 +295,7 @@ float text_layout::actual_height() const void text_layout::start_new_line(text_layout::text_justify justify, float height) { // create a new line - std::unique_ptr<line> new_line(global_alloc_clear<line>(*this, justify, actual_height(), height * yscale())); + std::unique_ptr<line> new_line(std::make_unique<line>(*this, justify, actual_height(), height * yscale())); // update the current line m_current_line = new_line.get(); @@ -303,7 +303,7 @@ void text_layout::start_new_line(text_layout::text_justify justify, float height m_truncating = false; // append it - m_lines.push_back(std::move(new_line)); + m_lines.emplace_back(std::move(new_line)); } diff --git a/src/frontend/mame/ui/text.h b/src/frontend/mame/ui/text.h index c5755c39813..fdf000c850a 100644 --- a/src/frontend/mame/ui/text.h +++ b/src/frontend/mame/ui/text.h @@ -7,16 +7,17 @@ Text functionality for MAME's crude user interface ***************************************************************************/ +#ifndef MAME_FRONTEND_UI_TEXT_H +#define MAME_FRONTEND_UI_TEXT_H #pragma once -#ifndef MAME_FRONTEND_UI_TEXT_H -#define MAME_FRONTEND_UI_TEXT_H class render_font; class render_container; namespace ui { + /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index ff16d117117..90efcb04b7c 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -164,7 +164,7 @@ static uint32_t const mouse_bitmap[32*32] = mame_ui_manager::mame_ui_manager(running_machine &machine) : ui_manager(machine) - , m_font(nullptr) + , m_font() , m_handler_callback(nullptr) , m_handler_callback_type(ui_callback_type::GENERAL) , m_handler_param(0) @@ -216,7 +216,7 @@ void mame_ui_manager::init() config_save_delegate(&mame_ui_manager::config_save, this)); // create mouse bitmap - uint32_t *dst = &m_mouse_bitmap.pix32(0); + uint32_t *dst = &m_mouse_bitmap.pix(0); memcpy(dst,mouse_bitmap,32*32*sizeof(uint32_t)); m_mouse_arrow_texture = machine().render().texture_alloc(); m_mouse_arrow_texture->set_bitmap(m_mouse_bitmap, m_mouse_bitmap.cliprect(), TEXFORMAT_ARGB32); @@ -244,11 +244,7 @@ void mame_ui_manager::exit() m_mouse_arrow_texture = nullptr; // free the font - if (m_font != nullptr) - { - machine().render().font_free(m_font); - m_font = nullptr; - } + m_font.reset(); } @@ -640,9 +636,9 @@ void mame_ui_manager::update_and_render(render_container &container) render_font *mame_ui_manager::get_font() { // allocate the font and messagebox string - if (m_font == nullptr) + if (!m_font) m_font = machine().render().font_alloc(machine().options().ui_font()); - return m_font; + return m_font.get(); } @@ -1008,7 +1004,7 @@ void mame_ui_manager::process_natural_keyboard() while (machine().ui_input().pop_event(&event)) { // if this was a UI_EVENT_CHAR event, post it - if (event.event_type == ui_event::IME_CHAR) + if (event.event_type == ui_event::type::IME_CHAR) machine().ioport().natkeyboard().post_char(event.ch); } @@ -1487,7 +1483,7 @@ std::vector<ui::menu_item>& mame_ui_manager::get_slider_list(void) std::unique_ptr<slider_state> mame_ui_manager::slider_alloc(int id, const char *title, int32_t minval, int32_t defval, int32_t maxval, int32_t incval, void *arg) { - auto state = make_unique_clear<slider_state>(); + auto state = std::make_unique<slider_state>(); state->minval = minval; state->defval = defval; diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h index 8c0504464d3..af9ad03efcc 100644 --- a/src/frontend/mame/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -271,7 +271,7 @@ private: using device_feature_set = std::set<std::pair<std::string, std::string> >; // instance variables - render_font * m_font; + std::unique_ptr<render_font> m_font; handler_callback_func m_handler_callback; ui_callback_type m_handler_callback_type; uint32_t m_handler_param; diff --git a/src/frontend/mame/ui/videoopt.cpp b/src/frontend/mame/ui/videoopt.cpp index 58818328d41..2a876c5a1af 100644 --- a/src/frontend/mame/ui/videoopt.cpp +++ b/src/frontend/mame/ui/videoopt.cpp @@ -141,7 +141,7 @@ void menu_video_options::handle() // process the menu event const *const menu_event(process(0)); - if (menu_event && menu_event->itemref) + if (menu_event && uintptr_t(menu_event->itemref)) { switch (reinterpret_cast<uintptr_t>(menu_event->itemref)) { diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp index 5b4d187bc95..bc6dee9cd47 100644 --- a/src/frontend/mame/ui/viewgfx.cpp +++ b/src/frontend/mame/ui/viewgfx.cpp @@ -994,18 +994,16 @@ static void gfxset_draw_item(running_machine &machine, gfx_element &gfx, int ind { int width = (rotate & ORIENTATION_SWAP_XY) ? gfx.height() : gfx.width(); int height = (rotate & ORIENTATION_SWAP_XY) ? gfx.width() : gfx.height(); - const rgb_t *palette = dpalette->palette()->entry_list_raw() + gfx.colorbase() + color * gfx.granularity(); - - int x, y; + rgb_t const *const palette = dpalette->palette()->entry_list_raw() + gfx.colorbase() + color * gfx.granularity(); // loop over rows in the cell - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { - uint32_t *dest = &bitmap.pix32(dsty + y, dstx); + uint32_t *dest = &bitmap.pix(dsty + y, dstx); const uint8_t *src = gfx.get_data(index); // loop over columns in the cell - for (x = 0; x < width; x++) + for (int x = 0; x < width; x++) { int effx = x, effy = y; const uint8_t *s; diff --git a/src/frontend/mame/ui/widgets.cpp b/src/frontend/mame/ui/widgets.cpp index d8907303b36..59fda0f203c 100644 --- a/src/frontend/mame/ui/widgets.cpp +++ b/src/frontend/mame/ui/widgets.cpp @@ -36,7 +36,7 @@ widgets_manager::widgets_manager(running_machine &machine) for (unsigned x = 0; x < 256; ++x) { unsigned const alpha((x < 25) ? (0xff * x / 25) : (x >(256 - 25)) ? (0xff * (255 - x) / 25) : 0xff); - m_hilight_bitmap->pix32(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); + m_hilight_bitmap->pix(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); } m_hilight_texture.reset(render.texture_alloc()); m_hilight_texture->set_bitmap(*m_hilight_bitmap, m_hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -49,7 +49,7 @@ widgets_manager::widgets_manager(running_machine &machine) unsigned const r = r1 + (y * (r2 - r1) / 128); unsigned const g = g1 + (y * (g2 - g1) / 128); unsigned const b = b1 + (y * (b2 - b1) / 128); - m_hilight_main_bitmap->pix32(y, 0) = rgb_t(r, g, b); + m_hilight_main_bitmap->pix(y, 0) = rgb_t(r, g, b); } m_hilight_main_texture.reset(render.texture_alloc()); m_hilight_main_texture->set_bitmap(*m_hilight_main_bitmap, m_hilight_main_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -67,18 +67,17 @@ widgets_manager::widgets_manager(running_machine &machine) void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) { - int halfwidth = dest.width() / 2; - int height = dest.height(); - int x, y; + int const halfwidth = dest.width() / 2; + int const height = dest.height(); // start with all-transparent dest.fill(rgb_t(0x00, 0x00, 0x00, 0x00)); // render from the tip to the bottom - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height; - uint32_t *target = &dest.pix32(y, halfwidth); + uint32_t *const target = &dest.pix(y, halfwidth); // don't antialias if height < 12 if (dest.height() < 12) @@ -89,25 +88,23 @@ void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source } // loop while we still have data to generate - for (x = 0; linewidth > 0; x++) + for (int x = 0; linewidth > 0; x++) { int dalpha; - - // first column we only consume one pixel if (x == 0) { + // first column we only consume one pixel dalpha = std::min(0xff, linewidth); target[x] = rgb_t(dalpha, 0xff, 0xff, 0xff); } - - // remaining columns consume two pixels, one on each side else { + // remaining columns consume two pixels, one on each side dalpha = std::min(0x1fe, linewidth); target[x] = target[-x] = rgb_t(dalpha / 2, 0xff, 0xff, 0xff); } - // account for the weight we consumed */ + // account for the weight we consumed linewidth -= dalpha; } } diff --git a/src/lib/formats/a26_cas.cpp b/src/lib/formats/a26_cas.cpp index 0074da6aba3..09d7e2479e5 100644 --- a/src/lib/formats/a26_cas.cpp +++ b/src/lib/formats/a26_cas.cpp @@ -6,10 +6,10 @@ Atari 2600 SuperCharger support */ -#include <cassert> - #include "formats/a26_cas.h" +#include <cassert> + #define A26_CAS_SIZE 8448 #define A26_WAV_FREQUENCY 44100 @@ -132,7 +132,7 @@ static int a26_cas_to_wav_size( const uint8_t *casdata, int caslen ) { return a26_cas_do_work( nullptr, casdata ); } -static const struct CassetteLegacyWaveFiller a26_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller a26_legacy_fill_wave = { a26_cas_fill_wave, -1, 0, @@ -142,21 +142,21 @@ static const struct CassetteLegacyWaveFiller a26_legacy_fill_wave = { 0 }; -static cassette_image::error a26_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { +static cassette_image::error a26_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { uint64_t size; - size = cassette_image_size( cassette ); + size = cassette->image_size( ); if ( size == A26_CAS_SIZE ) { - return cassette_legacy_identify( cassette, opts, &a26_legacy_fill_wave ); + return cassette->legacy_identify( opts, &a26_legacy_fill_wave ); } return cassette_image::error::INVALID_IMAGE; } static cassette_image::error a26_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &a26_legacy_fill_wave ); + return cassette->legacy_construct( &a26_legacy_fill_wave ); } -static const struct CassetteFormat a26_cassette_format = { +static const cassette_image::Format a26_cassette_format = { "a26", a26_cassette_identify, a26_cassette_load, diff --git a/src/lib/formats/ace_tap.cpp b/src/lib/formats/ace_tap.cpp index 522050f612a..1619280b66b 100644 --- a/src/lib/formats/ace_tap.cpp +++ b/src/lib/formats/ace_tap.cpp @@ -10,10 +10,10 @@ For more information see: ********************************************************************/ -#include <cassert> - #include "ace_tap.h" +#include <cassert> + #define SMPLO -32768 #define SILENCE 0 @@ -155,7 +155,7 @@ static int ace_tap_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller ace_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller ace_legacy_fill_wave = { ace_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -167,19 +167,19 @@ static const struct CassetteLegacyWaveFiller ace_legacy_fill_wave = }; -static cassette_image::error ace_tap_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error ace_tap_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &ace_legacy_fill_wave); + return cassette->legacy_identify(opts, &ace_legacy_fill_wave); } static cassette_image::error ace_tap_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &ace_legacy_fill_wave); + return cassette->legacy_construct(&ace_legacy_fill_wave); } -static const struct CassetteFormat ace_tap_format = +static const cassette_image::Format ace_tap_format = { "tap", ace_tap_identify, diff --git a/src/lib/formats/adam_cas.cpp b/src/lib/formats/adam_cas.cpp index 5d24eed2543..4c678bb0796 100644 --- a/src/lib/formats/adam_cas.cpp +++ b/src/lib/formats/adam_cas.cpp @@ -1,10 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Curt Coder +#include "adam_cas.h" #include <cassert> -#include "cassimg.h" -#include "adam_cas.h" // This code will reproduce the timing of an adam tape played back on a standard tape deck with a 1 7/8ips speed. #define CASS_AMP 0x1fffffff @@ -50,7 +49,7 @@ Data is phase encoded, with 70us bit cells with a transition at 31us for a 1 and ****************************************************************/ -static cassette_image::error coladam_ddp_identify ( cassette_image *cass, struct CassetteOptions *opts ) +static cassette_image::error coladam_ddp_identify ( cassette_image *cass, cassette_image::Options *opts ) { opts -> bits_per_sample = 16; opts -> channels = 2; @@ -67,14 +66,14 @@ cassette_image::error coladam_put_byte(cassette_image *cass, int channel, double { if(byte & 0x80) { - err = cassette_put_sample( cass, channel, *time_index, COL_ADAM_PERIOD1, -CASS_AMP*(*prev_sign) ); + err = cass->put_sample( channel, *time_index, COL_ADAM_PERIOD1, -CASS_AMP*(*prev_sign) ); (*time_index) += COL_ADAM_PERIOD1; - err = cassette_put_sample( cass, channel, *time_index, COL_ADAM_PERIOD2, CASS_AMP*(*prev_sign) ); + err = cass->put_sample( channel, *time_index, COL_ADAM_PERIOD2, CASS_AMP*(*prev_sign) ); (*time_index) += COL_ADAM_PERIOD2; } else { - err = cassette_put_sample( cass, channel, *time_index, COL_ADAM_PERIOD, -CASS_AMP*(*prev_sign) ); + err = cass->put_sample( channel, *time_index, COL_ADAM_PERIOD, -CASS_AMP*(*prev_sign) ); (*prev_sign) *=-1; (*time_index) += COL_ADAM_PERIOD; } @@ -146,12 +145,12 @@ static cassette_image::error coladam_ddp_load( cassette_image *cass ) for (block = 0; block < 128; block++) { - cassette_image_read( cass, buffer, 0x20000+0x400*block, 0x400 ); + cass->image_read( buffer, 0x20000+0x400*block, 0x400 ); err = coladam_put_block(cass, 0, &time, &prev_sign, block, buffer, layout_type); } for (block = 128; block < 131; block++) { - cassette_image_read( cass, buffer, 0x3f400+0x400*(block-128), 0x400 ); + cass->image_read( buffer, 0x3f400+0x400*(block-128), 0x400 ); err = coladam_put_block(cass, 0, &time, &prev_sign, block, buffer, layout_type); } @@ -165,17 +164,17 @@ static cassette_image::error coladam_ddp_load( cassette_image *cass ) { for (block = 0; block < 64; block++) { - cassette_image_read( cass, buffer, 0x10000+0x400*block, 0x400 ); + cass->image_read( buffer, 0x10000+0x400*block, 0x400 ); err = coladam_put_block(cass, 1, &time, &prev_sign, block, buffer, layout_type); } for (block = 64; block < 128; block++) { - cassette_image_read( cass, buffer, 0x00000+0x400*(block-64), 0x400 ); + cass->image_read( buffer, 0x00000+0x400*(block-64), 0x400 ); err = coladam_put_block(cass, 1, &time, &prev_sign, block, buffer, layout_type); } for (block = 128; block < 131; block++) { - cassette_image_read( cass, buffer, 0x0f400+0x400*(block-128), 0x400 ); + cass->image_read( buffer, 0x0f400+0x400*(block-128), 0x400 ); err = coladam_put_block(cass, 1, &time, &prev_sign, block, buffer, layout_type); } } @@ -188,12 +187,12 @@ static cassette_image::error coladam_ddp_load( cassette_image *cass ) } for (block = 0; block < 128; block++) { - cassette_image_read( cass, buffer, 0x400*block, 0x400 ); + cass->image_read( buffer, 0x400*block, 0x400 ); err = coladam_put_block(cass, 1, &time, &prev_sign, block, buffer, layout_type); } for (block = 128; block < 131; block++) { - cassette_image_read( cass, buffer, 0x1f400+0x400*(block-128), 0x400 ); + cass->image_read( buffer, 0x1f400+0x400*(block-128), 0x400 ); err = coladam_put_block(cass, 1, &time, &prev_sign, block, buffer, layout_type); } } @@ -203,7 +202,7 @@ static cassette_image::error coladam_ddp_load( cassette_image *cass ) -static const struct CassetteFormat coladam_ddp = +static const cassette_image::Format coladam_ddp = { "ddp", coladam_ddp_identify, coladam_ddp_load, nullptr /* no save */ }; CASSETTE_FORMATLIST_START(coleco_adam_cassette_formats) diff --git a/src/lib/formats/apf_apt.cpp b/src/lib/formats/apf_apt.cpp index 28793f0f853..e820090ef04 100644 --- a/src/lib/formats/apf_apt.cpp +++ b/src/lib/formats/apf_apt.cpp @@ -34,10 +34,10 @@ e. A checksum byte (8-bit addition) ********************************************************************/ -#include <cassert> - #include "formats/apf_apt.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -184,7 +184,7 @@ static int apf_cpf_calculate_size_in_samples(const uint8_t *bytes, int length) //********************************************************************************* -static const struct CassetteLegacyWaveFiller apf_cpf_fill_intf = +static const cassette_image::LegacyWaveFiller apf_cpf_fill_intf = { apf_cpf_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -195,17 +195,17 @@ static const struct CassetteLegacyWaveFiller apf_cpf_fill_intf = 0 /* trailer_samples */ }; -static cassette_image::error apf_cpf_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error apf_cpf_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &apf_cpf_fill_intf); + return cassette->legacy_identify(opts, &apf_cpf_fill_intf); } static cassette_image::error apf_cpf_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &apf_cpf_fill_intf); + return cassette->legacy_construct(&apf_cpf_fill_intf); } -static const struct CassetteFormat apf_cpf_format = +static const cassette_image::Format apf_cpf_format = { "cas,cpf", apf_cpf_identify, @@ -215,7 +215,7 @@ static const struct CassetteFormat apf_cpf_format = //********************************************************************************* -static const struct CassetteLegacyWaveFiller apf_apt_fill_intf = +static const cassette_image::LegacyWaveFiller apf_apt_fill_intf = { apf_apt_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -226,17 +226,17 @@ static const struct CassetteLegacyWaveFiller apf_apt_fill_intf = 0 /* trailer_samples */ }; -static cassette_image::error apf_apt_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error apf_apt_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &apf_apt_fill_intf); + return cassette->legacy_identify(opts, &apf_apt_fill_intf); } static cassette_image::error apf_apt_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &apf_apt_fill_intf); + return cassette->legacy_construct(&apf_apt_fill_intf); } -static const struct CassetteFormat apf_apt_format = +static const cassette_image::Format apf_apt_format = { "apt", apf_apt_identify, diff --git a/src/lib/formats/apridisk.cpp b/src/lib/formats/apridisk.cpp index bb53006f188..aad688167cf 100644 --- a/src/lib/formats/apridisk.cpp +++ b/src/lib/formats/apridisk.cpp @@ -48,8 +48,8 @@ int apridisk_format::identify(io_generic *io, uint32_t form_factor) bool apridisk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) { desc_pc_sector sectors[80][2][18]; - uint8_t sector_data[MAX_SECTORS * SECTOR_SIZE]; - uint8_t *data_ptr = sector_data; + std::unique_ptr<uint8_t []> sector_data(new uint8_t [MAX_SECTORS * SECTOR_SIZE]); + uint8_t *data_ptr = sector_data.get(); int track_count = 0, head_count = 0, sector_count = 0; uint64_t file_size = io_generic_size(io); diff --git a/src/lib/formats/atom_tap.cpp b/src/lib/formats/atom_tap.cpp index 212208a6d37..cfe83bc1bae 100644 --- a/src/lib/formats/atom_tap.cpp +++ b/src/lib/formats/atom_tap.cpp @@ -40,11 +40,12 @@ */ -#include <cassert> - #include "atom_tap.h" #include "csw_cas.h" #include "uef_cas.h" + +#include <cassert> + /*************************************************************************** PARAMETERS ***************************************************************************/ @@ -59,9 +60,9 @@ CassetteModulation atom_tap_modulation -------------------------------------------------*/ -static const struct CassetteModulation atom_tap_modulation = +static const cassette_image::Modulation atom_tap_modulation = { - CASSETTE_MODULATION_SINEWAVE, + cassette_image::MODULATION_SINEWAVE, 1200.0 - 300, 1200.0, 1200.0 + 300, 2400.0 - 600, 2400.0, 2400.0 + 600 }; @@ -73,7 +74,7 @@ static const struct CassetteModulation atom_tap_modulation = static uint8_t cassette_image_read_uint8(cassette_image *cassette, uint64_t offset) { uint8_t data; - cassette_image_read(cassette, &data, offset, 1); + cassette->image_read(&data, offset, 1); return data; } @@ -81,9 +82,9 @@ static uint8_t cassette_image_read_uint8(cassette_image *cassette, uint64_t offs atom_tap_identify - identify cassette -------------------------------------------------*/ -static cassette_image::error atom_tap_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error atom_tap_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_modulation_identify( cassette, &atom_tap_modulation, opts); + return cassette->modulation_identify(atom_tap_modulation, opts); } /*------------------------------------------------- @@ -92,7 +93,7 @@ static cassette_image::error atom_tap_identify(cassette_image *cassette, struct #define MODULATE(_value) \ for (int i = 0; i < (_value ? 8 : 4); i++) { \ - err = cassette_put_modulated_data_bit(cassette, 0, time_index, _value, &atom_tap_modulation, &time_displacement);\ + err = cassette->put_modulated_data_bit(0, time_index, _value, atom_tap_modulation, &time_displacement);\ if (err != cassette_image::error::SUCCESS) return err;\ time_index += time_displacement;\ } @@ -102,7 +103,7 @@ static cassette_image::error atom_tap_identify(cassette_image *cassette, struct static cassette_image::error atom_tap_load(cassette_image *cassette) { cassette_image::error err; - uint64_t image_size = cassette_image_size(cassette); + uint64_t image_size = cassette->image_size(); uint64_t image_pos = 0; double time_index = 0.0; double time_displacement; @@ -134,7 +135,7 @@ static cassette_image::error atom_tap_load(cassette_image *cassette) CassetteFormat atom_tap_cassette_format -------------------------------------------------*/ -const struct CassetteFormat atom_tap_format = +const cassette_image::Format atom_tap_format = { "tap", atom_tap_identify, diff --git a/src/lib/formats/camplynx_cas.cpp b/src/lib/formats/camplynx_cas.cpp index e802be4426f..5945650ca0a 100644 --- a/src/lib/formats/camplynx_cas.cpp +++ b/src/lib/formats/camplynx_cas.cpp @@ -191,7 +191,7 @@ static int camplynx_cassette_calculate_size_in_samples(const uint8_t *bytes, int return camplynx_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller lynx48k_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller lynx48k_legacy_fill_wave = { camplynx_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -202,7 +202,7 @@ static const struct CassetteLegacyWaveFiller lynx48k_legacy_fill_wave = 0 /* trailer_samples */ }; -static const struct CassetteLegacyWaveFiller lynx128k_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller lynx128k_legacy_fill_wave = { camplynx_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -213,27 +213,27 @@ static const struct CassetteLegacyWaveFiller lynx128k_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error lynx48k_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error lynx48k_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &lynx48k_legacy_fill_wave); + return cassette->legacy_identify(opts, &lynx48k_legacy_fill_wave); } -static cassette_image::error lynx128k_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error lynx128k_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &lynx128k_legacy_fill_wave); + return cassette->legacy_identify(opts, &lynx128k_legacy_fill_wave); } static cassette_image::error lynx48k_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &lynx48k_legacy_fill_wave); + return cassette->legacy_construct(&lynx48k_legacy_fill_wave); } static cassette_image::error lynx128k_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &lynx128k_legacy_fill_wave); + return cassette->legacy_construct(&lynx128k_legacy_fill_wave); } -static const struct CassetteFormat lynx48k_cassette_image_format = +static const cassette_image::Format lynx48k_cassette_image_format = { "tap", lynx48k_cassette_identify, @@ -241,7 +241,7 @@ static const struct CassetteFormat lynx48k_cassette_image_format = nullptr }; -static const struct CassetteFormat lynx128k_cassette_image_format = +static const cassette_image::Format lynx128k_cassette_image_format = { "tap", lynx128k_cassette_identify, diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp index 4f5d9320754..25b060e0311 100644 --- a/src/lib/formats/cassimg.cpp +++ b/src/lib/formats/cassimg.cpp @@ -8,12 +8,12 @@ *********************************************************************/ -#include <cstring> -#include <cassert> - -#include "imageutl.h" #include "cassimg.h" +#include "imageutl.h" + #include <algorithm> +#include <cassert> +#include <cstring> /* debugging parameters */ @@ -28,21 +28,22 @@ CASSETTE_FORMATLIST_START(cassette_default_formats) CASSETTE_FORMATLIST_END +namespace { /********************************************************************* helper code *********************************************************************/ -static double map_double(double d, uint64_t low, uint64_t high, uint64_t value) +constexpr double map_double(double d, uint64_t low, uint64_t high, uint64_t value) { return d * (value - low) / (high - low); } -static size_t waveform_bytes_per_sample(int waveform_flags) +constexpr size_t waveform_bytes_per_sample(int waveform_flags) { - return (size_t) (1 << ((waveform_flags & 0x06) / 2)); + return size_t(1 << ((waveform_flags & 0x06) / 2)); } @@ -51,361 +52,319 @@ static size_t waveform_bytes_per_sample(int waveform_flags) extrapolation and interpolation *********************************************************************/ -static int32_t extrapolate8(int8_t value) +constexpr int32_t extrapolate8(int8_t value) { - return ((int32_t) value) << 24; + return int32_t(value) << 24; } -static int32_t extrapolate16(int16_t value) +constexpr int32_t extrapolate16(int16_t value) { - return ((int32_t) value) << 16; + return int32_t(value) << 16; } -static int8_t interpolate8(int32_t value) +constexpr int8_t interpolate8(int32_t value) { - return (int8_t) (value >> 24); + return int8_t(value >> 24); } -static int16_t interpolate16(int32_t value) +constexpr int16_t interpolate16(int32_t value) { - return (int16_t) (value >> 16); + return int16_t(value >> 16); } -/********************************************************************* - initialization and termination -*********************************************************************/ - -static cassette_image *cassette_init(const struct CassetteFormat *format, void *file, const struct io_procs *procs, int flags) +constexpr size_t my_round(double d) { - cassette_image *cassette; - - cassette = global_alloc_clear<cassette_image>(); - cassette->format = format; - cassette->io.file = file; - cassette->io.procs = procs; - cassette->flags = flags; - return cassette; + return size_t(d + 0.5); } -static void cassette_finishinit(cassette_image::error err, cassette_image *cassette, cassette_image **outcassette) +/********************************************************************* + waveform accesses to/from the raw image +*********************************************************************/ + +const int8_t *choose_wave(const cassette_image::Modulation &modulation, size_t &wave_bytes_length) { - if (cassette && ((err != cassette_image::error::SUCCESS) || !outcassette)) + static const int8_t square_wave[] = { -128, 127 }; + static const int8_t sine_wave[] = { 0, 48, 89, 117, 127, 117, 89, 48, 0, -48, -89, -117, -127, -117, -89, -48 }; + + if (modulation.flags & cassette_image::MODULATION_SINEWAVE) + { + wave_bytes_length = ARRAY_LENGTH(sine_wave); + return sine_wave; + } + else { - cassette_close(cassette); - cassette = nullptr; + wave_bytes_length = ARRAY_LENGTH(square_wave); + return square_wave; } - if (outcassette) - *outcassette = cassette; } +} // anonymous namespace -static cassette_image::error try_identify_format(const struct CassetteFormat &format, cassette_image *image, const std::string &extension, int flags, struct CassetteOptions &opts) + +/********************************************************************* + initialization and termination +*********************************************************************/ + +cassette_image::error cassette_image::try_identify_format(const Format &format, const std::string &extension, int flags, Options &opts) { // is this the right extension? if (!extension.empty() && !image_find_extension(format.extensions, extension.c_str())) - return cassette_image::error::INVALID_IMAGE; + return error::INVALID_IMAGE; // invoke format->identify - memset(&opts, 0, sizeof(opts)); - cassette_image::error err = format.identify(image, &opts); - if (err != cassette_image::error::SUCCESS) + opts = Options(); + error err = format.identify(this, &opts); + if (err != error::SUCCESS) return err; // is this a read only format, but the cassette was not opened read only? - if (((flags & CASSETTE_FLAG_READONLY) == 0) && (format.save == nullptr)) - return cassette_image::error::READ_WRITE_UNSUPPORTED; + if (((flags & FLAG_READONLY) == 0) && (format.save == nullptr)) + return error::READ_WRITE_UNSUPPORTED; // success! - return cassette_image::error::SUCCESS; + return error::SUCCESS; +} + + +cassette_image::error cassette_image::perform_save() +{ + Info info = get_info(); + return m_format->save(this, &info); } -cassette_image::error cassette_open_choices(void *file, const struct io_procs *procs, const std::string &extension, - const struct CassetteFormat *const *formats, int flags, cassette_image **outcassette) +/********************************************************************* + waveform accesses +*********************************************************************/ + +struct cassette_image::manipulation_ranges { - cassette_image::error err; - cassette_image *cassette; - const struct CassetteFormat *format; - struct CassetteOptions opts = {0, }; - int i; + int channel_first; + int channel_last; + size_t sample_first; + size_t sample_last; +}; - /* if not specified, use the dummy arguments */ - if (!formats) - formats = cassette_default_formats; - /* create the cassette object */ - cassette = cassette_init(nullptr, file, procs, flags); - if (!cassette) - { - err = cassette_image::error::OUT_OF_MEMORY; - goto done; - } - /* identify the image */ - format = nullptr; - for (i = 0; !format && formats[i]; i++) +cassette_image::error cassette_image::compute_manipulation_ranges(int channel, + double time_index, double sample_period, manipulation_ranges &ranges) const +{ + if (channel < 0) { - // try this format - err = try_identify_format(*formats[i], cassette, extension, flags, opts); - if (err != cassette_image::error::SUCCESS && err != cassette_image::error::INVALID_IMAGE) - goto done; - - // did we succeed? - if (err == cassette_image::error::SUCCESS) - format = formats[i]; + ranges.channel_first = 0; + ranges.channel_last = m_channels - 1; } - - /* have we found a proper format */ - if (!format) + else { - err = cassette_image::error::INVALID_IMAGE; - goto done; + ranges.channel_first = channel; + ranges.channel_last = channel; } - cassette->format = format; - - /* read the options */ - cassette->channels = opts.channels; - cassette->sample_frequency = opts.sample_frequency; - /* load the image */ - err = format->load(cassette); - if (err != cassette_image::error::SUCCESS) - goto done; + ranges.sample_first = my_round(time_index * m_sample_frequency); + ranges.sample_last = my_round((time_index + sample_period) * m_sample_frequency); - /* success */ - cassette->flags &= ~CASSETTE_FLAG_DIRTY; - err = cassette_image::error::SUCCESS; + if (ranges.sample_last > ranges.sample_first) + ranges.sample_last--; -done: - cassette_finishinit(err, cassette, outcassette); - return err; + return error::SUCCESS; } -cassette_image::error cassette_open(void *file, const struct io_procs *procs, - const struct CassetteFormat *format, int flags, cassette_image **outcassette) +cassette_image::error cassette_image::lookup_sample(int channel, size_t sample, int32_t *&ptr) { - const struct CassetteFormat *formats[2]; - formats[0] = format; - formats[1] = nullptr; - return cassette_open_choices(file, procs, nullptr, formats, flags, outcassette); -} - + ptr = nullptr; + size_t sample_blocknum = (sample / SAMPLES_PER_BLOCK) * m_channels + channel; + size_t sample_index = sample % SAMPLES_PER_BLOCK; + // is this block beyond the edge of our waveform? + if (sample_blocknum >= m_blocks.size()) + m_blocks.resize(sample_blocknum + 1); -cassette_image::error cassette_create(void *file, const struct io_procs *procs, const struct CassetteFormat *format, - const struct CassetteOptions *opts, int flags, cassette_image **outcassette) -{ - cassette_image::error err; - cassette_image *cassette; - static const struct CassetteOptions default_options = { 1, 16, 44100 }; + if (!m_blocks[sample_blocknum]) + m_blocks[sample_blocknum] = make_unique_clear<int32_t []>(SAMPLES_PER_BLOCK); - /* cannot create to a read only image */ - if (flags & CASSETTE_FLAG_READONLY) - return cassette_image::error::INVALID_IMAGE; + ptr = &m_blocks[sample_blocknum][sample_index]; + return error::SUCCESS; +} - /* is this a good format? */ - if (format->save == nullptr) - return cassette_image::error::INVALID_IMAGE; - /* normalize arguments */ - if (!opts) - opts = &default_options; - /* create the cassette object */ - cassette = cassette_init(format, file, procs, flags); - if (!cassette) - { - err = cassette_image::error::OUT_OF_MEMORY; - goto done; - } +cassette_image::cassette_image(const Format *format, void *file, const io_procs *procs, int flags) +{ + m_format = format; + m_io.file = file; + m_io.procs = procs; + m_flags = flags; +} - /* read the options */ - cassette->channels = opts->channels; - cassette->sample_frequency = opts->sample_frequency; - err = cassette_image::error::SUCCESS; -done: - cassette_finishinit(err, cassette, outcassette); - return err; +cassette_image::~cassette_image() +{ + if ((m_flags & CASSETTE_FLAG_DIRTY) && (m_flags & FLAG_SAVEONEXIT)) + save(); } -static cassette_image::error cassette_perform_save(cassette_image *cassette) +cassette_image::error cassette_image::open(void *file, const io_procs *procs, + const Format *format, int flags, ptr &outcassette) { - struct CassetteInfo info; - cassette_get_info(cassette, &info); - return cassette->format->save(cassette, &info); + const Format *const formats[2] = { format, nullptr }; + return open_choices(file, procs, nullptr, formats, flags, outcassette); } -cassette_image::error cassette_save(cassette_image *cassette) +cassette_image::error cassette_image::open_choices(void *file, const io_procs *procs, const std::string &extension, + const Format *const *formats, int flags, ptr &outcassette) { - cassette_image::error err; + // if not specified, use the dummy arguments + if (!formats) + formats = cassette_default_formats; - if (!cassette->format || !cassette->format->save) - return cassette_image::error::UNSUPPORTED; + // create the cassette object + ptr cassette; + try { cassette.reset(new cassette_image(nullptr, file, procs, flags)); } + catch (std::bad_alloc const &) { return error::OUT_OF_MEMORY; } - err = cassette_perform_save(cassette); - if (err != cassette_image::error::SUCCESS) + // identify the image + const Format *format = nullptr; + Options opts; + for (int i = 0; !format && formats[i]; i++) + { + // try this format + error err = cassette->try_identify_format(*formats[i], extension, flags, opts); + if (err != error::SUCCESS && err != error::INVALID_IMAGE) + return err; + + // did we succeed? + if (err == error::SUCCESS) + format = formats[i]; + } + + // have we found a proper format + if (!format) + return error::INVALID_IMAGE; + cassette->m_format = format; + + // read the options + cassette->m_channels = opts.channels; + cassette->m_sample_frequency = opts.sample_frequency; + + // load the image + error err = format->load(cassette.get()); + if (err != error::SUCCESS) return err; - cassette->flags &= ~CASSETTE_FLAG_DIRTY; - return cassette_image::error::SUCCESS; + /* success */ + cassette->m_flags &= ~CASSETTE_FLAG_DIRTY; + outcassette = std::move(cassette); + return error::SUCCESS; } -void cassette_get_info(cassette_image *cassette, struct CassetteInfo *info) +cassette_image::error cassette_image::create(void *file, const io_procs *procs, const Format *format, + const Options *opts, int flags, ptr &outcassette) { - memset(info, 0, sizeof(*info)); - info->channels = cassette->channels; - info->sample_count = cassette->sample_count; - info->sample_frequency = cassette->sample_frequency; - info->bits_per_sample = (int) waveform_bytes_per_sample(cassette->flags) * 8; -} + static const Options default_options = { 1, 16, 44100 }; + // cannot create to a read only image + if (flags & FLAG_READONLY) + return error::INVALID_IMAGE; + // is this a good format? + if (format->save == nullptr) + return error::INVALID_IMAGE; -void cassette_close(cassette_image *cassette) -{ - if (cassette) - { - if ((cassette->flags & CASSETTE_FLAG_DIRTY) && (cassette->flags & CASSETTE_FLAG_SAVEONEXIT)) - cassette_save(cassette); - for (auto & elem : cassette->blocks) - { - global_free(elem); - } - global_free(cassette); - } -} + // normalize arguments + if (!opts) + opts = &default_options; + // create the cassette object + ptr cassette; + try { cassette.reset(new cassette_image(format, file, procs, flags)); } + catch (std::bad_alloc const &) { return error::OUT_OF_MEMORY; } + // read the options + cassette->m_channels = opts->channels; + cassette->m_sample_frequency = opts->sample_frequency; -void cassette_change(cassette_image *cassette, void *file, const struct io_procs *procs, const struct CassetteFormat *format, int flags) -{ - if ((flags & CASSETTE_FLAG_READONLY) == 0) - flags |= CASSETTE_FLAG_DIRTY; - cassette->io.file = file; - cassette->io.procs = procs; - cassette->format = format; - cassette->flags = flags; + outcassette = std::move(cassette); + return error::SUCCESS; } -/********************************************************************* - calls for accessing the raw cassette image -*********************************************************************/ - -void cassette_image_read(cassette_image *cassette, void *buffer, uint64_t offset, size_t length) +cassette_image::error cassette_image::save() { - io_generic_read(&cassette->io, buffer, offset, length); + if (!m_format || !m_format->save) + return error::UNSUPPORTED; + + error err = perform_save(); + if (err != error::SUCCESS) + return err; + + m_flags &= ~CASSETTE_FLAG_DIRTY; + return error::SUCCESS; } -void cassette_image_write(cassette_image *cassette, const void *buffer, uint64_t offset, size_t length) +cassette_image::Info cassette_image::get_info() const { - io_generic_write(&cassette->io, buffer, offset, length); + Info result; + result.channels = m_channels; + result.sample_count = m_sample_count; + result.sample_frequency = m_sample_frequency; + result.bits_per_sample = (int)waveform_bytes_per_sample(m_flags) * 8; + return result; } -uint64_t cassette_image_size(cassette_image *cassette) +void cassette_image::change(void *file, const io_procs *procs, const Format *format, int flags) { - return io_generic_size(&cassette->io); + if ((flags & FLAG_READONLY) == 0) + flags |= CASSETTE_FLAG_DIRTY; + m_io.file = file; + m_io.procs = procs; + m_format = format; + m_flags = flags; } /********************************************************************* - waveform accesses + calls for accessing the raw cassette image *********************************************************************/ -struct manipulation_ranges +void cassette_image::image_read(void *buffer, uint64_t offset, size_t length) { - int channel_first; - int channel_last; - size_t sample_first; - size_t sample_last; -}; - - - -static size_t my_round(double d) -{ - size_t result; - d += 0.5; - result = (size_t) d; - return result; + io_generic_read(&m_io, buffer, offset, length); } -static cassette_image::error compute_manipulation_ranges(cassette_image *cassette, int channel, - double time_index, double sample_period, struct manipulation_ranges *ranges) +void cassette_image::image_write(const void *buffer, uint64_t offset, size_t length) { - if (channel < 0) - { - ranges->channel_first = 0; - ranges->channel_last = cassette->channels - 1; - } - else - { - ranges->channel_first = channel; - ranges->channel_last = channel; - } - - ranges->sample_first = my_round(time_index * cassette->sample_frequency); - ranges->sample_last = my_round((time_index + sample_period) * cassette->sample_frequency); - - if (ranges->sample_last > ranges->sample_first) - ranges->sample_last--; - - return cassette_image::error::SUCCESS; + io_generic_write(&m_io, buffer, offset, length); } -static cassette_image::error lookup_sample(cassette_image *cassette, int channel, size_t sample, int32_t **ptr) +uint64_t cassette_image::image_size() { - *ptr = nullptr; - size_t sample_blocknum = (sample / SAMPLES_PER_BLOCK) * cassette->channels + channel; - size_t sample_index = sample % SAMPLES_PER_BLOCK; - - /* is this block beyond the edge of our waveform? */ - if (sample_blocknum >= cassette->blocks.size()) { - size_t osize = cassette->blocks.size(); - cassette->blocks.resize(sample_blocknum + 1); - memset(&cassette->blocks[osize], 0, (cassette->blocks.size()-osize)*sizeof(cassette->blocks[0])); - } - - if (cassette->blocks[sample_blocknum] == nullptr) - cassette->blocks[sample_blocknum] = global_alloc(sample_block); - - sample_block &block = *cassette->blocks[sample_blocknum]; - - /* is this sample access off the current block? */ - if (sample_index >= block.size()) { - size_t osize = block.size(); - block.resize(SAMPLES_PER_BLOCK); - memset(&block[osize], 0, (SAMPLES_PER_BLOCK-osize)*sizeof(block[0])); - } - - *ptr = &block[sample_index]; - return cassette_image::error::SUCCESS; + return io_generic_size(&m_io); } @@ -417,38 +376,29 @@ static cassette_image::error lookup_sample(cassette_image *cassette, int channel // Note: In normal use, the sample_spacing is the same as the sample size (in bytes) // But it can be larger to help do an interleaved write to samples // (see cassette_write_samples) -cassette_image::error cassette_get_samples(cassette_image *cassette, int channel, +cassette_image::error cassette_image::get_samples(int channel, double time_index, double sample_period, size_t sample_count, size_t sample_spacing, void *samples, int waveform_flags) { - cassette_image::error err; - struct manipulation_ranges ranges; - size_t sample_index; - size_t cassette_sample_index; - uint8_t *dest_ptr; - const int32_t *source_ptr; - double d; - int16_t word; - int32_t dword; - int64_t sum; - - assert(cassette); - - err = compute_manipulation_ranges(cassette, channel, time_index, sample_period, &ranges); - if (err != cassette_image::error::SUCCESS) + error err; + manipulation_ranges ranges; + int32_t *source_ptr; + + err = compute_manipulation_ranges(channel, time_index, sample_period, ranges); + if (err != error::SUCCESS) return err; - for (sample_index = 0; sample_index < sample_count; sample_index++) + for (size_t sample_index = 0; sample_index < sample_count; sample_index++) { - sum = 0; + int64_t sum = 0; for (channel = ranges.channel_first; channel <= ranges.channel_last; channel++) { /* find the sample that we are putting */ - d = map_double(ranges.sample_last + 1 - ranges.sample_first, 0, sample_count, sample_index) + ranges.sample_first; - cassette_sample_index = (size_t) d; - err = lookup_sample(cassette, channel, cassette_sample_index, (int32_t **) &source_ptr); - if (err != cassette_image::error::SUCCESS) + double d = map_double(ranges.sample_last + 1 - ranges.sample_first, 0, sample_count, sample_index) + ranges.sample_first; + size_t cassette_sample_index = (size_t) d; + err = lookup_sample(channel, cassette_sample_index, source_ptr); + if (err != error::SUCCESS) return err; sum += *source_ptr; @@ -458,61 +408,54 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel sum /= (ranges.channel_last + 1 - ranges.channel_first); /* and write out the result */ - dest_ptr = (uint8_t*)samples; + uint8_t *dest_ptr = (uint8_t*)samples; dest_ptr += sample_index * sample_spacing; - switch(waveform_bytes_per_sample(waveform_flags)) + int16_t word; + int32_t dword; + switch (waveform_bytes_per_sample(waveform_flags)) { - case 1: - *((int8_t *) dest_ptr) = interpolate8(sum); - break; - case 2: - word = interpolate16(sum); - if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP) - word = swapendian_int16(word); - *((int16_t *) dest_ptr) = word; - break; - case 4: - dword = sum; - if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP) - dword = swapendian_int32(dword); - *((int32_t *) dest_ptr) = dword; - break; + case 1: + *((int8_t *) dest_ptr) = interpolate8(sum); + break; + case 2: + word = interpolate16(sum); + if (waveform_flags & WAVEFORM_ENDIAN_FLIP) + word = swapendian_int16(word); + *((int16_t *) dest_ptr) = word; + break; + case 4: + dword = sum; + if (waveform_flags & WAVEFORM_ENDIAN_FLIP) + dword = swapendian_int32(dword); + *((int32_t *) dest_ptr) = dword; + break; } } - return cassette_image::error::SUCCESS; + return error::SUCCESS; } // Note: In normal use, the sample_spacing is the same as the sample size (in bytes) // But it can be larger to help do an interleaved read from samples // (see cassette_read_samples) -cassette_image::error cassette_put_samples(cassette_image *cassette, int channel, +cassette_image::error cassette_image::put_samples(int channel, double time_index, double sample_period, size_t sample_count, size_t sample_spacing, const void *samples, int waveform_flags) { - cassette_image::error err; - struct manipulation_ranges ranges; - size_t sample_index; + error err; + manipulation_ranges ranges; int32_t *dest_ptr; - int32_t dest_value; - int16_t word; - int32_t dword; - const uint8_t *source_ptr; - double d; - - if (!cassette) - return cassette_image::error::SUCCESS; if (sample_period == 0) - return cassette_image::error::SUCCESS; + return error::SUCCESS; - err = compute_manipulation_ranges(cassette, channel, time_index, sample_period, &ranges); - if (err != cassette_image::error::SUCCESS) + err = compute_manipulation_ranges(channel, time_index, sample_period, ranges); + if (err != error::SUCCESS) return err; - if (cassette->sample_count < ranges.sample_last+1) - cassette->sample_count = ranges.sample_last + 1; - cassette->flags |= CASSETTE_FLAG_DIRTY; + if (m_sample_count < ranges.sample_last+1) + m_sample_count = ranges.sample_last + 1; + m_flags |= CASSETTE_FLAG_DIRTY; if (LOG_PUT_SAMPLES) { @@ -521,65 +464,68 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel (int)ranges.sample_first, (int)ranges.sample_last); } - for (sample_index = ranges.sample_first; sample_index <= ranges.sample_last; sample_index++) + for (size_t sample_index = ranges.sample_first; sample_index <= ranges.sample_last; sample_index++) { /* figure out the source pointer */ - d = map_double(sample_count, ranges.sample_first, ranges.sample_last + 1, sample_index); - source_ptr = (const uint8_t*)samples; + double d = map_double(sample_count, ranges.sample_first, ranges.sample_last + 1, sample_index); + const uint8_t *source_ptr = (const uint8_t*)samples; source_ptr += ((size_t) d) * sample_spacing; /* compute the value that we are writing */ + int32_t dest_value; + int16_t word; + int32_t dword; switch(waveform_bytes_per_sample(waveform_flags)) { case 1: - if (waveform_flags & CASSETTE_WAVEFORM_UNSIGNED) + if (waveform_flags & WAVEFORM_UNSIGNED) dest_value = extrapolate8((int8_t)(*source_ptr - 128)); else dest_value = extrapolate8(*((int8_t *) source_ptr)); break; case 2: word = *((int16_t *) source_ptr); - if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP) + if (waveform_flags & WAVEFORM_ENDIAN_FLIP) word = swapendian_int16(word); dest_value = extrapolate16(word); break; case 4: dword = *((int32_t *) source_ptr); - if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP) + if (waveform_flags & WAVEFORM_ENDIAN_FLIP) dword = swapendian_int32(dword); dest_value = dword; break; default: - return cassette_image::error::INTERNAL; + return error::INTERNAL; } for (channel = ranges.channel_first; channel <= ranges.channel_last; channel++) { /* find the sample that we are putting */ - err = lookup_sample(cassette, channel, sample_index, &dest_ptr); - if (err != cassette_image::error::SUCCESS) + err = lookup_sample(channel, sample_index, dest_ptr); + if (err != error::SUCCESS) return err; *dest_ptr = dest_value; } } - return cassette_image::error::SUCCESS; + return error::SUCCESS; } -cassette_image::error cassette_get_sample(cassette_image *cassette, int channel, +cassette_image::error cassette_image::get_sample(int channel, double time_index, double sample_period, int32_t *sample) { - return cassette_get_samples(cassette, channel, time_index, - sample_period, 1, 0, sample, CASSETTE_WAVEFORM_32BIT); + return get_samples(channel, time_index, + sample_period, 1, 0, sample, WAVEFORM_32BIT); } -cassette_image::error cassette_put_sample(cassette_image *cassette, int channel, +cassette_image::error cassette_image::put_sample(int channel, double time_index, double sample_period, int32_t sample) { - return cassette_put_samples(cassette, channel, time_index, - sample_period, 1, 0, &sample, CASSETTE_WAVEFORM_32BIT); + return put_samples(channel, time_index, + sample_period, 1, 0, &sample, WAVEFORM_32BIT); } @@ -588,153 +534,112 @@ cassette_image::error cassette_put_sample(cassette_image *cassette, int channel, waveform accesses to/from the raw image *********************************************************************/ -cassette_image::error cassette_read_samples(cassette_image *cassette, int channels, double time_index, +cassette_image::error cassette_image::read_samples(int channels, double time_index, double sample_period, size_t sample_count, uint64_t offset, int waveform_flags) { - cassette_image::error err; - size_t chunk_sample_count; - size_t bytes_per_sample; - size_t sample_spacing; + error err; size_t samples_loaded = 0; - double chunk_time_index; - double chunk_sample_period; - int channel; uint8_t buffer[8192]; - bytes_per_sample = waveform_bytes_per_sample(waveform_flags); - sample_spacing = bytes_per_sample * channels; + size_t bytes_per_sample = waveform_bytes_per_sample(waveform_flags); + size_t sample_spacing = bytes_per_sample * channels; - while(samples_loaded < sample_count) + while (samples_loaded < sample_count) { - chunk_sample_count = std::min(sizeof(buffer) / sample_spacing, (sample_count - samples_loaded)); - chunk_sample_period = map_double(sample_period, 0, sample_count, chunk_sample_count); - chunk_time_index = time_index + map_double(sample_period, 0, sample_count, samples_loaded); + size_t chunk_sample_count = std::min(sizeof(buffer) / sample_spacing, (sample_count - samples_loaded)); + double chunk_sample_period = map_double(sample_period, 0, sample_count, chunk_sample_count); + double chunk_time_index = time_index + map_double(sample_period, 0, sample_count, samples_loaded); - cassette_image_read(cassette, buffer, offset, chunk_sample_count * sample_spacing); + image_read(buffer, offset, chunk_sample_count * sample_spacing); - for (channel = 0; channel < channels; channel++) + for (int channel = 0; channel < channels; channel++) { - err = cassette_put_samples(cassette, channel, chunk_time_index, chunk_sample_period, + err = put_samples(channel, chunk_time_index, chunk_sample_period, chunk_sample_count, sample_spacing, &buffer[channel * bytes_per_sample], waveform_flags); - if (err != cassette_image::error::SUCCESS) + if (err != error::SUCCESS) return err; } offset += chunk_sample_count * sample_spacing; samples_loaded += chunk_sample_count; } - return cassette_image::error::SUCCESS; + return error::SUCCESS; } -cassette_image::error cassette_write_samples(cassette_image *cassette, int channels, double time_index, +cassette_image::error cassette_image::write_samples(int channels, double time_index, double sample_period, size_t sample_count, uint64_t offset, int waveform_flags) { - cassette_image::error err; - size_t chunk_sample_count; - size_t bytes_per_sample; - size_t sample_spacing; + error err; size_t samples_saved = 0; - double chunk_time_index; - double chunk_sample_period; - int channel; uint8_t buffer[8192]; - bytes_per_sample = waveform_bytes_per_sample(waveform_flags); - sample_spacing = bytes_per_sample * channels; + size_t bytes_per_sample = waveform_bytes_per_sample(waveform_flags); + size_t sample_spacing = bytes_per_sample * channels; - while(samples_saved < sample_count) + while (samples_saved < sample_count) { - chunk_sample_count = std::min(sizeof(buffer) / sample_spacing, (sample_count - samples_saved)); - chunk_sample_period = map_double(sample_period, 0, sample_count, chunk_sample_count); - chunk_time_index = time_index + map_double(sample_period, 0, sample_count, samples_saved); + size_t chunk_sample_count = std::min(sizeof(buffer) / sample_spacing, (sample_count - samples_saved)); + double chunk_sample_period = map_double(sample_period, 0, sample_count, chunk_sample_count); + double chunk_time_index = time_index + map_double(sample_period, 0, sample_count, samples_saved); - for (channel = 0; channel < channels; channel++) + for (int channel = 0; channel < channels; channel++) { - err = cassette_get_samples(cassette, channel, chunk_time_index, chunk_sample_period, + err = get_samples(channel, chunk_time_index, chunk_sample_period, chunk_sample_count, sample_spacing, &buffer[channel * bytes_per_sample], waveform_flags); - if (err != cassette_image::error::SUCCESS) + if (err != error::SUCCESS) return err; } - cassette_image_write(cassette, buffer, offset, chunk_sample_count * sample_spacing); + image_write(buffer, offset, chunk_sample_count * sample_spacing); offset += chunk_sample_count * sample_spacing; samples_saved += chunk_sample_count; } - return cassette_image::error::SUCCESS; + return error::SUCCESS; } -/********************************************************************* - waveform accesses to/from the raw image -*********************************************************************/ - -static const int8_t *choose_wave(const struct CassetteModulation *modulation, size_t *wave_bytes_length) -{ - static const int8_t square_wave[] = { -128, 127 }; - static const int8_t sine_wave[] = { 0, 48, 89, 117, 127, 117, 89, 48, 0, -48, -89, -117, -127, -117, -89, -48 }; - - if (modulation->flags & CASSETTE_MODULATION_SINEWAVE) - { - *wave_bytes_length = ARRAY_LENGTH(sine_wave); - return sine_wave; - } - else - { - *wave_bytes_length = ARRAY_LENGTH(square_wave); - return square_wave; - } -} - - - -cassette_image::error cassette_modulation_identify(cassette_image *cassette, const struct CassetteModulation *modulation, - struct CassetteOptions *opts) +cassette_image::error cassette_image::modulation_identify(const Modulation &modulation, Options *opts) { size_t wave_bytes_length; - choose_wave(modulation, &wave_bytes_length); + choose_wave(modulation, wave_bytes_length); opts->bits_per_sample = 8; opts->channels = 1; - opts->sample_frequency = (uint32_t) (std::max(modulation->zero_frequency_high, modulation->one_frequency_high) * wave_bytes_length * 2); - return cassette_image::error::SUCCESS; + opts->sample_frequency = uint32_t(std::max(modulation.zero_frequency_high, modulation.one_frequency_high) * wave_bytes_length * 2); + return error::SUCCESS; } -cassette_image::error cassette_put_modulated_data(cassette_image *cassette, int channel, double time_index, - const void *data, size_t data_length, const struct CassetteModulation *modulation, +cassette_image::error cassette_image::put_modulated_data(int channel, double time_index, + const void *data, size_t data_length, const Modulation &modulation, double *time_displacement) { - cassette_image::error err; + error err; const uint8_t *data_bytes = (const uint8_t *)data; - const int8_t *wave_bytes; size_t wave_bytes_length; double total_displacement = 0.0; - double pulse_period; - double pulse_frequency; - uint8_t b; - int i; - wave_bytes = choose_wave(modulation, &wave_bytes_length); + const int8_t *wave_bytes = choose_wave(modulation, wave_bytes_length); - while(data_length--) + while (data_length--) { - b = *(data_bytes++); - for (i = 0; i < 8; i++) + uint8_t b = *(data_bytes++); + for (int i = 0; i < 8; i++) { - pulse_frequency = (b & (1 << i)) ? modulation->one_frequency_canonical : modulation->zero_frequency_canonical; - pulse_period = 1 / pulse_frequency; - err = cassette_put_samples(cassette, 0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, CASSETTE_WAVEFORM_8BIT); - if (err != cassette_image::error::SUCCESS) + double pulse_frequency = (b & (1 << i)) ? modulation.one_frequency_canonical : modulation.zero_frequency_canonical; + double pulse_period = 1 / pulse_frequency; + err = put_samples(0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, WAVEFORM_8BIT); + if (err != error::SUCCESS) goto done; time_index += pulse_period; total_displacement += pulse_period; } } - err = cassette_image::error::SUCCESS; + err = error::SUCCESS; done: if (time_displacement) @@ -744,18 +649,18 @@ done: -cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, int channel, double time_index, - uint8_t filler, size_t filler_length, const struct CassetteModulation *modulation, +cassette_image::error cassette_image::put_modulated_filler(int channel, double time_index, + uint8_t filler, size_t filler_length, const Modulation &modulation, double *time_displacement) { - cassette_image::error err; + error err; double delta; double total_displacement = 0.0; - while(filler_length--) + while (filler_length--) { - err = cassette_put_modulated_data(cassette, channel, time_index, &filler, 1, modulation, &delta); - if (err != cassette_image::error::SUCCESS) + err = put_modulated_data(channel, time_index, &filler, 1, modulation, &delta); + if (err != error::SUCCESS) return err; total_displacement += delta; time_index += delta; @@ -763,24 +668,19 @@ cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, in if (time_displacement) *time_displacement = total_displacement; - return cassette_image::error::SUCCESS; + return error::SUCCESS; } -cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int channel, double time_index, - uint64_t offset, uint64_t length, const struct CassetteModulation *modulation, +cassette_image::error cassette_image::read_modulated_data(int channel, double time_index, + uint64_t offset, uint64_t length, const Modulation &modulation, double *time_displacement) { - cassette_image::error err; - uint8_t buffer_stack[1024]; uint8_t *buffer; - uint8_t *alloc_buffer = nullptr; - double delta; - double total_displacement = 0.0; - size_t this_length; + uint8_t buffer_stack[1024]; + std::unique_ptr<uint8_t []> alloc_buffer; size_t buffer_length; - if (length <= sizeof(buffer_stack)) { buffer = buffer_stack; @@ -789,23 +689,21 @@ cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int else { buffer_length = std::min<uint64_t>(length, 100000); - alloc_buffer = (uint8_t*)malloc(buffer_length); - if (!alloc_buffer) - { - err = cassette_image::error::OUT_OF_MEMORY; - goto done; - } - buffer = alloc_buffer; + try { alloc_buffer = std::make_unique<uint8_t []>(buffer_length); } + catch (std::bad_alloc const &) { return error::OUT_OF_MEMORY; } + buffer = alloc_buffer.get(); } - while(length > 0) + double delta; + double total_displacement = 0.0; + while (length > 0) { - this_length = (std::min<uint64_t>)(length, buffer_length); - cassette_image_read(cassette, buffer, offset, this_length); + size_t this_length = std::min<uint64_t>(length, buffer_length); + image_read(buffer, offset, this_length); - err = cassette_put_modulated_data(cassette, channel, time_index, buffer, this_length, modulation, &delta); - if (err != cassette_image::error::SUCCESS) - goto done; + error err = put_modulated_data(channel, time_index, buffer, this_length, modulation, &delta); + if (err != error::SUCCESS) + return err; total_displacement += delta; time_index += delta; length -= this_length; @@ -813,38 +711,30 @@ cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int if (time_displacement) *time_displacement = total_displacement; - err = cassette_image::error::SUCCESS; - -done: - if (alloc_buffer) - free(alloc_buffer); - return err; + return error::SUCCESS; } -cassette_image::error cassette_put_modulated_data_bit(cassette_image *cassette, int channel, double time_index, - uint8_t data, const struct CassetteModulation *modulation, +cassette_image::error cassette_image::put_modulated_data_bit(int channel, double time_index, + uint8_t data, const Modulation &modulation, double *time_displacement) { - cassette_image::error err; - const int8_t *wave_bytes; + error err; size_t wave_bytes_length; double total_displacement = 0.0; - double pulse_period; - double pulse_frequency; - wave_bytes = choose_wave(modulation, &wave_bytes_length); + const int8_t *wave_bytes = choose_wave(modulation, wave_bytes_length); - pulse_frequency = (data) ? modulation->one_frequency_canonical : modulation->zero_frequency_canonical; - pulse_period = 1 / pulse_frequency; - err = cassette_put_samples(cassette, 0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, CASSETTE_WAVEFORM_8BIT); - if (err != cassette_image::error::SUCCESS) + double pulse_frequency = (data) ? modulation.one_frequency_canonical : modulation.zero_frequency_canonical; + double pulse_period = 1 / pulse_frequency; + err = put_samples(0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, WAVEFORM_8BIT); + if (err != error::SUCCESS) goto done; time_index += pulse_period; total_displacement += pulse_period; - err = cassette_image::error::SUCCESS; + err = error::SUCCESS; done: if (time_displacement) @@ -858,67 +748,63 @@ done: waveform accesses to/from the raw image *********************************************************************/ -cassette_image::error cassette_legacy_identify(cassette_image *cassette, struct CassetteOptions *opts, - const struct CassetteLegacyWaveFiller *legacy_args) +cassette_image::error cassette_image::legacy_identify(Options *opts, + const LegacyWaveFiller *legacy_args) { opts->channels = 1; opts->bits_per_sample = 16; opts->sample_frequency = legacy_args->sample_frequency; - return cassette_image::error::SUCCESS; + return error::SUCCESS; } -cassette_image::error cassette_legacy_construct(cassette_image *cassette, - const struct CassetteLegacyWaveFiller *legacy_args) +cassette_image::error cassette_image::legacy_construct(const LegacyWaveFiller *legacy_args) { - cassette_image::error err; + error err; int length; int sample_count; std::vector<uint8_t> bytes; - std::vector<uint8_t> chunk; std::vector<int16_t> samples; int pos = 0; uint64_t offset = 0; - uint64_t size; - struct CassetteLegacyWaveFiller args; /* sanity check the args */ assert(legacy_args->header_samples >= -1); assert(legacy_args->trailer_samples >= 0); assert(legacy_args->fill_wave); - size = cassette_image_size(cassette); + uint64_t size = image_size(); /* normalize the args */ - args = *legacy_args; + LegacyWaveFiller args = *legacy_args; if (args.chunk_size == 0) args.chunk_size = 1; else if (args.chunk_size < 0) - args.chunk_size = cassette_image_size(cassette); + args.chunk_size = image_size(); if (args.sample_frequency == 0) args.sample_frequency = 11025; /* allocate a buffer for the binary data */ - chunk.resize(args.chunk_size); + std::vector<uint8_t> chunk(args.chunk_size); /* determine number of samples */ if (args.chunk_sample_calc != nullptr) { if (size > 0x7FFFFFFF) { - err = cassette_image::error::OUT_OF_MEMORY; + err = error::OUT_OF_MEMORY; goto done; } bytes.resize(size); - cassette_image_read(cassette, &bytes[0], 0, size); + image_read(&bytes[0], 0, size); sample_count = args.chunk_sample_calc(&bytes[0], (int)size); // chunk_sample_calc functions report errors by returning negative numbers if (sample_count < 0) { - err = cassette_image::error::INVALID_IMAGE; + err = error::INVALID_IMAGE; goto done; } @@ -941,22 +827,22 @@ cassette_image::error cassette_legacy_construct(cassette_image *cassette, length = args.fill_wave(&samples[pos], sample_count - pos, CODE_HEADER); if (length < 0) { - err = cassette_image::error::INVALID_IMAGE; + err = error::INVALID_IMAGE; goto done; } pos += length; } /* convert the file data to samples */ - while((pos < sample_count) && (offset < size)) + while ((pos < sample_count) && (offset < size)) { - cassette_image_read(cassette, &chunk[0], offset, args.chunk_size); + image_read(&chunk[0], offset, args.chunk_size); offset += args.chunk_size; length = args.fill_wave(&samples[pos], sample_count - pos, &chunk[0]); if (length < 0) { - err = cassette_image::error::INVALID_IMAGE; + err = error::INVALID_IMAGE; goto done; } pos += length; @@ -970,23 +856,23 @@ cassette_image::error cassette_legacy_construct(cassette_image *cassette, length = args.fill_wave(&samples[pos], sample_count - pos, CODE_TRAILER); if (length < 0) { - err = cassette_image::error::INVALID_IMAGE; + err = error::INVALID_IMAGE; goto done; } pos += length; } /* specify the wave */ - err = cassette_put_samples(cassette, 0, 0.0, ((double) pos) / args.sample_frequency, - pos, 2, &samples[0], CASSETTE_WAVEFORM_16BIT); - if (err != cassette_image::error::SUCCESS) + err = put_samples(0, 0.0, ((double) pos) / args.sample_frequency, + pos, 2, &samples[0], WAVEFORM_16BIT); + if (err != error::SUCCESS) goto done; /* success! */ - err = cassette_image::error::SUCCESS; + err = error::SUCCESS; #if DUMP_CASSETTES - cassette_dump(cassette, "C:\\TEMP\\CASDUMP.WAV"); + dump("C:\\TEMP\\CASDUMP.WAV"); #endif done: @@ -1001,26 +887,22 @@ done: A debugging call to dump a cassette image to a disk based wave file *********************************************************************/ -void cassette_dump(cassette_image *image, const char *filename) +void cassette_image::dump(const char *filename) { - FILE *f; - struct io_generic saved_io; - const struct CassetteFormat *saved_format; - - f = fopen(filename, "wb"); + FILE *f = fopen(filename, "wb"); if (!f) return; - memcpy(&saved_io, &image->io, sizeof(saved_io)); - saved_format = image->format; + io_generic saved_io = m_io; + const Format *saved_format = m_format; - image->io.file = f; - image->io.procs = &stdio_ioprocs_noclose; - image->format = &wavfile_format; - cassette_perform_save(image); + m_io.file = f; + m_io.procs = &stdio_ioprocs_noclose; + m_format = &wavfile_format; + perform_save(); - memcpy(&image->io, &saved_io, sizeof(saved_io)); - image->format = saved_format; + m_io = saved_io; + m_format = saved_format; fclose(f); } diff --git a/src/lib/formats/cassimg.h b/src/lib/formats/cassimg.h index 5199c0e4a04..ed71c49cbf5 100644 --- a/src/lib/formats/cassimg.h +++ b/src/lib/formats/cassimg.h @@ -14,14 +14,15 @@ #include "ioprocs.h" -#include "osdcore.h" #include "coretmpl.h" +#include "osdcore.h" +#include <memory> #include <string> #include <vector> #ifndef LOG_FORMATS -#define LOG_FORMATS if (0) printf +#define LOG_FORMATS(...) do { if (0) osd_printf_info(__VA_ARGS__); } while (false) #endif // hack to get around rogues that define this @@ -31,65 +32,51 @@ /*************************************************************************** - Constants + Type definitions ***************************************************************************/ -#define CASSETTE_FLAG_READWRITE 0 -#define CASSETTE_FLAG_READONLY 1 -#define CASSETTE_FLAG_NOSAVEONEXIT 0 -#define CASSETTE_FLAG_SAVEONEXIT 2 - -#define CASSETTE_WAVEFORM_8BIT 0 -#define CASSETTE_WAVEFORM_16BIT 2 -#define CASSETTE_WAVEFORM_16BIT_FLIP 3 -#define CASSETTE_WAVEFORM_32BIT 4 -#define CASSETTE_WAVEFORM_32BIT_FLIP 5 -#define CASSETTE_WAVEFORM_ENDIAN_FLIP 1 -#define CASSETTE_WAVEFORM_UNSIGNED 8 - -#define CASSETTE_MODULATION_SQUAREWAVE 0 -#define CASSETTE_MODULATION_SINEWAVE 1 +class cassette_image +{ +public: + enum : int + { + FLAG_READWRITE = 0, + FLAG_READONLY = 1, + FLAG_NOSAVEONEXIT = 0, + FLAG_SAVEONEXIT = 2 + }; + enum : int + { + WAVEFORM_8BIT = 0, + WAVEFORM_16BIT = 2, + WAVEFORM_16BIT_FLIP = 3, + WAVEFORM_32BIT = 4, + WAVEFORM_32BIT_FLIP = 5, + WAVEFORM_ENDIAN_FLIP = 1, + WAVEFORM_UNSIGNED = 8, #ifdef LSB_FIRST -#define CASSETTE_WAVEFORM_16BITBE CASSETTE_WAVEFORM_16BIT_FLIP -#define CASSETTE_WAVEFORM_16BITLE CASSETTE_WAVEFORM_16BIT -#define CASSETTE_WAVEFORM_32BITBE CASSETTE_WAVEFORM_32BIT_FLIP -#define CASSETTE_WAVEFORM_32BITLE CASSETTE_WAVEFORM_32BIT + WAVEFORM_16BITBE = WAVEFORM_16BIT_FLIP, + WAVEFORM_16BITLE = WAVEFORM_16BIT, + WAVEFORM_32BITBE = WAVEFORM_32BIT_FLIP, + WAVEFORM_32BITLE = WAVEFORM_32BIT #else -#define CASSETTE_WAVEFORM_16BITBE CASSETTE_WAVEFORM_16BIT -#define CASSETTE_WAVEFORM_16BITLE CASSETTE_WAVEFORM_16BIT_FLIP -#define CASSETTE_WAVEFORM_32BITBE CASSETTE_WAVEFORM_32BIT -#define CASSETTE_WAVEFORM_32BITLE CASSETTE_WAVEFORM_32BIT_FLIP + WAVEFORM_16BITBE = WAVEFORM_16BIT, + WAVEFORM_16BITLE = WAVEFORM_16BIT_FLIP, + WAVEFORM_32BITBE = WAVEFORM_32BIT, + WAVEFORM_32BITLE = WAVEFORM_32BIT_FLIP #endif + }; + enum : int + { + MODULATION_SQUAREWAVE = 0, + MODULATION_SINEWAVE = 1 + }; -/*************************************************************************** - - Type definitions - -***************************************************************************/ - -typedef std::vector<int32_t> sample_block; - -struct CassetteOptions -{ - int channels; - int bits_per_sample; - uint32_t sample_frequency; -}; - -struct CassetteInfo -{ - int channels; - int bits_per_sample; - uint32_t sample_frequency; - size_t sample_count; -}; -struct cassette_image -{ enum class error { SUCCESS, // no error @@ -100,133 +87,156 @@ struct cassette_image READ_WRITE_UNSUPPORTED // read/write is not supported by this image format }; - const struct CassetteFormat *format; - struct io_generic io; + using ptr = std::unique_ptr<cassette_image>; - int channels; - int flags; - uint32_t sample_frequency; + struct Options + { + int channels = 0; + int bits_per_sample = 0; + uint32_t sample_frequency = 0; + }; - std::vector<sample_block *> blocks; - size_t sample_count; -}; + struct Info + { + int channels = 0; + int bits_per_sample = 0; + uint32_t sample_frequency = 0; + size_t sample_count = 0; + }; -struct CassetteFormat -{ - const char *extensions; - cassette_image::error (*identify)(cassette_image *cassette, struct CassetteOptions *opts); - cassette_image::error (*load)(cassette_image *cassette); - cassette_image::error (*save)(cassette_image *cassette, const struct CassetteInfo *info); -}; + struct Format + { + const char *extensions = nullptr; + error (*identify)(cassette_image *cassette, Options *opts) = nullptr; + error (*load)(cassette_image *cassette) = nullptr; + error (*save)(cassette_image *cassette, const Info *info) = nullptr; + }; -/* used for the core modulation code */ -struct CassetteModulation -{ - int flags; - double zero_frequency_low; - double zero_frequency_canonical; - double zero_frequency_high; - double one_frequency_low; - double one_frequency_canonical; - double one_frequency_high; -}; + /* used for the core modulation code */ + struct Modulation + { + int flags = 0; + double zero_frequency_low = 0; + double zero_frequency_canonical = 0; + double zero_frequency_high = 0; + double one_frequency_low = 0; + double one_frequency_canonical = 0; + double one_frequency_high = 0; + }; -/* code to adapt existing legacy fill_wave functions */ -struct CassetteLegacyWaveFiller -{ - int (*fill_wave)(int16_t *, int, uint8_t *); - int chunk_size; - int chunk_samples; - int (*chunk_sample_calc)(const uint8_t *bytes, int length); - uint32_t sample_frequency; - int header_samples; - int trailer_samples; -}; + /* code to adapt existing legacy fill_wave functions */ + struct LegacyWaveFiller + { + int (*fill_wave)(int16_t *, int, uint8_t *) = nullptr; + int chunk_size = 0; + int chunk_samples = 0; + int (*chunk_sample_calc)(const uint8_t *bytes, int length) = nullptr; + uint32_t sample_frequency = 0; + int header_samples = 0; + int trailer_samples = 0; + }; + + ~cassette_image(); + + // calls for accessing the raw cassette image + void image_read(void *buffer, uint64_t offset, size_t length); + void image_write(const void *buffer, uint64_t offset, size_t length); + uint64_t image_size(); + + // waveform accesses + error get_samples(int channel, + double time_index, double sample_period, size_t sample_count, size_t sample_spacing, + void *samples, int waveform_flags); + error put_samples(int channel, + double time_index, double sample_period, size_t sample_count, size_t sample_spacing, + const void *samples, int waveform_flags); + error get_sample(int channel, double time_index, double sample_period, int32_t *sample); + error put_sample(int channel, double time_index, double sample_period, int32_t sample); + + // waveform accesses to/from the raw image - these are only used by lib\formats\wavfile.cpp + error read_samples(int channels, double time_index, + double sample_period, size_t sample_count, uint64_t offset, int waveform_flags); + error write_samples(int channels, double time_index, + double sample_period, size_t sample_count, uint64_t offset, int waveform_flags); + + // modulation support + error modulation_identify(const Modulation &modulation, + Options *opts); + error put_modulated_data(int channel, double time_index, + const void *data, size_t data_length, const Modulation &modulation, + double *time_displacement); + error put_modulated_filler(int channel, double time_index, + uint8_t filler, size_t filler_length, const Modulation &modulation, + double *time_displacement); + error read_modulated_data(int channel, double time_index, + uint64_t offset, uint64_t length, const Modulation &modulation, + double *time_displacement); + error put_modulated_data_bit(int channel, double time_index, + uint8_t data, const Modulation &modulation, + double *time_displacement); + + /* legacy code support */ +#define CODE_HEADER ((uint8_t*)-1) +#define CODE_TRAILER ((uint8_t*)-2) + error legacy_identify(Options *opts, const LegacyWaveFiller *legacy_args); + error legacy_construct(const LegacyWaveFiller *legacy_args); + + /* debug calls */ + void dump(const char *filename); + + error save(); + void change(void *file, const io_procs *procs, const Format *format, int flags); + Info get_info() const; + + static error open(void *file, const io_procs *procs, + const Format *format, int flags, ptr &outcassette); + static error open_choices(void *file, const io_procs *procs, const std::string &extension, + const Format *const *formats, int flags, ptr &outcassette); + static error create(void *file, const io_procs *procs, const cassette_image::Format *format, + const cassette_image::Options *opts, int flags, ptr &outcassette); -/* builtin formats */ -extern const struct CassetteFormat wavfile_format; + // builtin formats + static const Format wavfile_format; + +private: + struct manipulation_ranges; + + cassette_image(const Format *format, void *file, const io_procs *procs, int flags); + cassette_image(const cassette_image &) = delete; + cassette_image(cassette_image &&) = delete; + cassette_image &operator=(const cassette_image &) = delete; + cassette_image &operator=(cassette_image &&) = delete; + + error try_identify_format(const Format &format, const std::string &extension, int flags, Options &opts); + error perform_save(); + error compute_manipulation_ranges(int channel, double time_index, double sample_period, manipulation_ranges &ranges) const; + error lookup_sample(int channel, size_t sample, int32_t *&ptr); + + const Format *m_format = nullptr; + io_generic m_io; + + int m_channels = 0; + int m_flags = 0; + uint32_t m_sample_frequency = 0; + + std::vector<std::unique_ptr<int32_t []> > m_blocks; + size_t m_sample_count = 0; +}; /* macros for specifying format lists */ #define CASSETTE_FORMATLIST_EXTERN(name) \ - extern const struct CassetteFormat *const name[] + extern const cassette_image::Format *const name[] #define CASSETTE_FORMATLIST_START(name) \ - const struct CassetteFormat *const name[] = \ + const cassette_image::Format *const name[] = \ { \ - &wavfile_format, + &cassette_image::wavfile_format, #define CASSETTE_FORMAT(name) \ &(name), #define CASSETTE_FORMATLIST_END \ - nullptr \ + nullptr \ }; CASSETTE_FORMATLIST_EXTERN(cassette_default_formats); -/*************************************************************************** - - Prototypes - -***************************************************************************/ - -cassette_image::error cassette_open(void *file, const struct io_procs *procs, - const struct CassetteFormat *format, int flags, cassette_image **outcassette); -cassette_image::error cassette_open_choices(void *file, const struct io_procs *procs, const std::string &extension, - const struct CassetteFormat *const *formats, int flags, cassette_image **outcassette); -cassette_image::error cassette_create(void *file, const struct io_procs *procs, const struct CassetteFormat *format, - const struct CassetteOptions *opts, int flags, cassette_image **outcassette); -cassette_image::error cassette_save(cassette_image *cassette); -void cassette_close(cassette_image *cassette); -void cassette_change(cassette_image *cassette, void *file, const struct io_procs *procs, const struct CassetteFormat *format, int flags); -void cassette_get_info(cassette_image *cassette, struct CassetteInfo *info); - -/* calls for accessing the raw cassette image */ -void cassette_image_read(cassette_image *cassette, void *buffer, uint64_t offset, size_t length); -void cassette_image_write(cassette_image *cassette, const void *buffer, uint64_t offset, size_t length); -uint64_t cassette_image_size(cassette_image *cassette); - -/* waveform accesses */ -cassette_image::error cassette_get_samples(cassette_image *cassette, int channel, - double time_index, double sample_period, size_t sample_count, size_t sample_spacing, - void *samples, int waveform_flags); -cassette_image::error cassette_put_samples(cassette_image *cassette, int channel, - double time_index, double sample_period, size_t sample_count, size_t sample_spacing, - const void *samples, int waveform_flags); -cassette_image::error cassette_get_sample(cassette_image *cassette, int channel, - double time_index, double sample_period, int32_t *sample); -cassette_image::error cassette_put_sample(cassette_image *cassette, int channel, - double time_index, double sample_period, int32_t sample); - -/* waveform accesses to/from the raw image - these are only used by lib\formats\wavfile.cpp */ -cassette_image::error cassette_read_samples(cassette_image *cassette, int channels, double time_index, - double sample_period, size_t sample_count, uint64_t offset, int waveform_flags); -cassette_image::error cassette_write_samples(cassette_image *cassette, int channels, double time_index, - double sample_period, size_t sample_count, uint64_t offset, int waveform_flags); - -/* modulation support */ -cassette_image::error cassette_modulation_identify(cassette_image *cassette, const struct CassetteModulation *modulation, - struct CassetteOptions *opts); -cassette_image::error cassette_put_modulated_data(cassette_image *cassette, int channel, double time_index, - const void *data, size_t data_length, const struct CassetteModulation *modulation, - double *time_displacement); -cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, int channel, double time_index, - uint8_t filler, size_t filler_length, const struct CassetteModulation *modulation, - double *time_displacement); -cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int channel, double time_index, - uint64_t offset, uint64_t length, const struct CassetteModulation *modulation, - double *time_displacement); -cassette_image::error cassette_put_modulated_data_bit(cassette_image *cassette, int channel, double time_index, - uint8_t data, const struct CassetteModulation *modulation, - double *time_displacement); - -/* debug calls */ -void cassette_dump(cassette_image *image, const char *filename); - -/* legacy code support */ -#define CODE_HEADER ((uint8_t*)-1) -#define CODE_TRAILER ((uint8_t*)-2) -cassette_image::error cassette_legacy_identify(cassette_image *cassette, struct CassetteOptions *opts, - const struct CassetteLegacyWaveFiller *legacy_args); -cassette_image::error cassette_legacy_construct(cassette_image *cassette, - const struct CassetteLegacyWaveFiller *legacy_args); - #endif // MAME_FORMATS_CASSIMG_H diff --git a/src/lib/formats/cbm_tap.cpp b/src/lib/formats/cbm_tap.cpp index 7ef8015c6f9..542c0c3ea87 100644 --- a/src/lib/formats/cbm_tap.cpp +++ b/src/lib/formats/cbm_tap.cpp @@ -339,7 +339,7 @@ static int cbm_tap_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) -static const struct CassetteLegacyWaveFiller cbm_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller cbm_legacy_fill_wave = { cbm_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -350,19 +350,19 @@ static const struct CassetteLegacyWaveFiller cbm_legacy_fill_wave = { }; -static cassette_image::error cbm_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) +static cassette_image::error cbm_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { - return cassette_legacy_identify( cassette, opts, &cbm_legacy_fill_wave ); + return cassette->legacy_identify( opts, &cbm_legacy_fill_wave ); } static cassette_image::error cbm_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &cbm_legacy_fill_wave ); + return cassette->legacy_construct( &cbm_legacy_fill_wave ); } -static const struct CassetteFormat cbm_tap_cassette_format = { +static const cassette_image::Format cbm_tap_cassette_format = { "tap", cbm_cassette_identify, cbm_cassette_load, diff --git a/src/lib/formats/cgen_cas.cpp b/src/lib/formats/cgen_cas.cpp index de47a45375d..8a208044960 100644 --- a/src/lib/formats/cgen_cas.cpp +++ b/src/lib/formats/cgen_cas.cpp @@ -18,10 +18,10 @@ NOTE: There exist multiples type of .cas files for Colour Genie We now support these three types below... ********************************************************************/ +#include "formats/cgen_cas.h" #include <cassert> -#include "formats/cgen_cas.h" #define TAPE_HEADER "Colour Genie - Virtual Tape File" @@ -124,7 +124,7 @@ static int cgenie_cas_to_wav_size(const uint8_t *casdata, int caslen) return cgenie_handle_cas(nullptr, casdata); } -static const struct CassetteLegacyWaveFiller cgenie_cas_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller cgenie_cas_legacy_fill_wave = { cgenie_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -136,19 +136,19 @@ static const struct CassetteLegacyWaveFiller cgenie_cas_legacy_fill_wave = }; -static cassette_image::error cgenie_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error cgenie_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &cgenie_cas_legacy_fill_wave); + return cassette->legacy_identify(opts, &cgenie_cas_legacy_fill_wave); } static cassette_image::error cgenie_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &cgenie_cas_legacy_fill_wave); + return cassette->legacy_construct(&cgenie_cas_legacy_fill_wave); } -static const struct CassetteFormat cgenie_cas_format = +static const cassette_image::Format cgenie_cas_format = { "cas", cgenie_cas_identify, diff --git a/src/lib/formats/coco_cas.cpp b/src/lib/formats/coco_cas.cpp index f3df09266b0..c0ed5d616ff 100644 --- a/src/lib/formats/coco_cas.cpp +++ b/src/lib/formats/coco_cas.cpp @@ -47,18 +47,18 @@ static int synccount; -const struct CassetteModulation coco_cas_modulation = +const cassette_image::Modulation coco_cas_modulation = { - CASSETTE_MODULATION_SINEWAVE, + cassette_image::MODULATION_SINEWAVE, 600.0, 1200.0, 1500.0, 1500.0, 2400.0, 3000.0 }; -static cassette_image::error coco_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error coco_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_modulation_identify(cassette, &coco_cas_modulation, opts); + return cassette->modulation_identify(coco_cas_modulation, opts); } @@ -76,12 +76,12 @@ static bool get_cas_block(cassette_image *cassette, uint64_t *offset, uint8_t *b synccount = 0; p.w.l = 0; - image_size = cassette_image_size(cassette); + image_size = cassette->image_size(); current_offset = *offset; while(current_offset < image_size) { - cassette_image_read(cassette, &p.b.h, current_offset, 1); + cassette->image_read(&p.b.h, current_offset, 1); current_offset++; for (i = 0; i < 8; i++) @@ -192,18 +192,18 @@ static cassette_image::error cas_load(cassette_image *cassette, uint8_t silence) 0x3C, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A }; time_index = 10.0; - return cassette_put_modulated_data(cassette, 0, time_index, dummy_bytes, sizeof(dummy_bytes), &coco_cas_modulation, &time_displacement); + return cassette_put_modulated_data(cassette, 0, time_index, dummy_bytes, sizeof(dummy_bytes), coco_cas_modulation, &time_displacement); } #endif - err = cassette_put_sample(cassette, 0, time_index, COCO_WAVESAMPLES_HEADER, 0); + err = cassette->put_sample(0, time_index, COCO_WAVESAMPLES_HEADER, 0); if (err != cassette_image::error::SUCCESS) return err; time_index += COCO_WAVESAMPLES_HEADER; offset = 0; last_blocktype = 0; - image_size = cassette_image_size(cassette); + image_size = cassette->image_size(); /* try to find a block that we can untangle */ while(get_cas_block(cassette, &offset, block, &block_length)) @@ -214,13 +214,13 @@ static cassette_image::error cas_load(cassette_image *cassette, uint8_t silence) if ((last_blocktype == 0) || (last_blocktype == 0xFF) || (block[0] == 0)) { /* silence */ - err = cassette_put_sample(cassette, 0, time_index, silence, 0); + err = cassette->put_sample(0, time_index, silence, 0); if (err != cassette_image::error::SUCCESS) return err; time_index += silence; /* sync data */ - err = cassette_put_modulated_filler(cassette, 0, time_index, 0x55, 128, &coco_cas_modulation, &time_displacement); + err = cassette->put_modulated_filler(0, time_index, 0x55, 128, coco_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; @@ -228,26 +228,26 @@ static cassette_image::error cas_load(cassette_image *cassette, uint8_t silence) else if (synccount != 0) /* If we have multiple sync bytes in cas file, make sure they */ { /* are passed through */ /* sync data */ - err = cassette_put_modulated_filler(cassette, 0, time_index, 0x55, synccount, &coco_cas_modulation, &time_displacement); + err = cassette->put_modulated_filler(0, time_index, 0x55, synccount, coco_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; } /* now fill in the magic bytes */ - err = cassette_put_modulated_data(cassette, 0, time_index, magic_bytes, sizeof(magic_bytes), &coco_cas_modulation, &time_displacement); + err = cassette->put_modulated_data(0, time_index, magic_bytes, sizeof(magic_bytes), coco_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; /* now fill in the block */ - err = cassette_put_modulated_data(cassette, 0, time_index, block, block_length, &coco_cas_modulation, &time_displacement); + err = cassette->put_modulated_data(0, time_index, block, block_length, coco_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; /* and the last magic byte */ - err = cassette_put_modulated_filler(cassette, 0, time_index, 0x55, 1, &coco_cas_modulation, &time_displacement); + err = cassette->put_modulated_filler(0, time_index, 0x55, 1, coco_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; @@ -256,7 +256,7 @@ static cassette_image::error cas_load(cassette_image *cassette, uint8_t silence) } /* all futher data is undecipherable, so output it verbatim */ - err = cassette_read_modulated_data(cassette, 0, time_index, offset, image_size - offset, &coco_cas_modulation, &time_displacement); + err = cassette->read_modulated_data(0, time_index, offset, image_size - offset, coco_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; @@ -274,7 +274,7 @@ static cassette_image::error alice32_cas_load(cassette_image *cassette) return cas_load(cassette, ALICE32_WAVESAMPLES_HEADER); } -const struct CassetteFormat coco_cas_format = +const cassette_image::Format coco_cas_format = { "cas", coco_cas_identify, @@ -282,7 +282,7 @@ const struct CassetteFormat coco_cas_format = nullptr }; -const struct CassetteFormat alice32_cas_format = +const cassette_image::Format alice32_cas_format = { "cas,c10,k7", coco_cas_identify, diff --git a/src/lib/formats/csw_cas.cpp b/src/lib/formats/csw_cas.cpp index 9edea5c3ff7..3db3eb70c34 100644 --- a/src/lib/formats/csw_cas.cpp +++ b/src/lib/formats/csw_cas.cpp @@ -1,294 +1,218 @@ // license:BSD-3-Clause -// copyright-holders:Gordon Jefferyes +// copyright-holders:Nigel Barnes /* -CSW format ----------- -Header Description - -Offset Value Type Description -0x00 (note) ASCII 22 bytes "Compressed Square Wave" signature -0x16 0x1A BYTE Terminator code -0x17 0x02 BYTE CSW major revision number -0x18 0x00 BYTE CSW minor revision number -0x19 DWORD Sample rate -0x1D DWORD Total number of pulses (after decompression) -0x21 BYTE Compression type 0x01: RLE 0x02: Z-RLE -0x22 BYTE Flags b0: initial polarity: if set, the signal starts at logical high -0x23 HDR BYTE Header extension length in bytes (0x00) -0x24 ASCII 16 bytes free use -0x34 BYTE Start of Header is HDR>0 - - - + CSW format + ---------- + Header Description + + Offset Value Type Description + 0x00 (note) ASCII 22 bytes "Compressed Square Wave" signature + 0x16 0x1A BYTE Terminator code + 0x17 0x02 BYTE CSW major revision number + 0x18 0x00 BYTE CSW minor revision number + 0x19 DWORD Sample rate + 0x1D DWORD Total number of pulses (after decompression) + 0x21 BYTE Compression type 0x01: RLE 0x02: Z-RLE + 0x22 BYTE Flags b0: initial polarity; if set, the signal starts at logical high + 0x23 HDR BYTE Header extension length in bytes (0x00) + 0x24 ASCII Encoding application description + 0x34 BYTE Header extension data (if present HDR>0) + 0x34+HDR CSW data */ -#include <cstring> +#include "csw_cas.h" +#include "uef_cas.h" #include <zlib.h> -#include <cassert> -#include "uef_cas.h" -#include "csw_cas.h" +#include <cassert> +#include <cstring> -#define CSW_WAV_FREQUENCY 44100 static const uint8_t CSW_HEADER[] = { "Compressed Square Wave" }; -static uint32_t get_leuint32(const void *ptr) -{ - uint32_t value; - memcpy(&value, ptr, sizeof(value)); - return little_endianize_int32(value); -} -static int mycaslen; +/*------------------------------------------------- + csw_cassette_identify - identify cassette +-------------------------------------------------*/ -static int csw_cas_to_wav_size( const uint8_t *casdata, int caslen ) +static cassette_image::error csw_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - uint8_t MajorRevision; - uint8_t MinorRevision; - uint8_t HeaderExtensionLength; - std::vector<uint8_t> gz_ptr; - - int total_size; - z_stream d_stream; - int err; - uint8_t *in_ptr; - int bsize=0; - - if ( memcmp( casdata, CSW_HEADER, sizeof(CSW_HEADER)-1 ) ) - { - LOG_FORMATS( "csw_cas_to_wav_size: cassette image has incompatible header\n" ); - goto cleanup; - } + uint8_t header[0x34]; - if (casdata[0x16]!=0x1a) - { - LOG_FORMATS( "csw_cas_to_wav_size: Terminator Code Not Found\n" ); - goto cleanup; + cassette->image_read(header, 0, sizeof(header)); + if (memcmp(&header[0], CSW_HEADER, sizeof(CSW_HEADER) - 1)) { + return cassette_image::error::INVALID_IMAGE; } - MajorRevision=casdata[0x17]; - MinorRevision=casdata[0x18]; + opts->bits_per_sample = 8; + opts->channels = 1; + opts->sample_frequency = little_endianize_int16(*(uint32_t*)(header + 0x19)); + return cassette_image::error::SUCCESS; +} + - LOG_FORMATS("Version %d : %d\n",MajorRevision,MinorRevision); +/*------------------------------------------------- + csw_cassette_load - load cassette +-------------------------------------------------*/ - if (casdata[0x17]!=2) +static cassette_image::error csw_cassette_load(cassette_image *cassette) +{ + uint8_t header[0x34]; + uint64_t image_size = cassette->image_size(); + std::vector<uint8_t> image_data(image_size); + + int8_t bit; + uint8_t compression; + int bsize = 0; + size_t csw_data = 0; + size_t sample_count = 0; + uint32_t sample_rate; + std::vector<int8_t> samples; + + /* csw header */ + cassette->image_read(header, 0, sizeof(header)); + + if (header[0x16] != 0x1a) { - LOG_FORMATS( "csw_cas_to_wav_size: Unsuported Major Version\n" ); - goto cleanup; + LOG_FORMATS("csw_cassette_load: Terminator Code Not Found\n"); + return cassette_image::error::INVALID_IMAGE; } - HeaderExtensionLength=casdata[0x23]; - - mycaslen=caslen; - //from here on down for now I am assuming it is compressed csw file. - in_ptr = (uint8_t*) casdata+0x34+HeaderExtensionLength; - - gz_ptr.resize( 8 ); - - d_stream.next_in = (unsigned char *)in_ptr; - d_stream.avail_in = caslen - ( in_ptr - casdata ); - d_stream.total_in=0; - - d_stream.next_out = &gz_ptr[0]; - d_stream.avail_out = 1; - d_stream.total_out=0; - - d_stream.zalloc = nullptr; - d_stream.zfree = nullptr; - d_stream.opaque = nullptr; - d_stream.data_type=0; - - err = inflateInit( &d_stream ); - if ( err != Z_OK ) + LOG_FORMATS("CSW Version %d.%d\n", header[0x17], header[0x18]); + switch (header[0x17]) { - LOG_FORMATS( "inflateInit2 error: %d\n", err ); - goto cleanup; + case 1: + sample_rate = little_endianize_int16(*(uint32_t*)(header + 0x19)); + compression = header[0x1b]; + bit = (header[0x1c] & 1) ? 127 : -128; + csw_data = 0x20; + + LOG_FORMATS("Sample Rate: %u\n", sample_rate); + LOG_FORMATS("CompressionType: %u Flags: %u\n", header[0x1b], header[0x1c]); + break; + + case 2: + sample_rate = little_endianize_int32(*(uint32_t*)(header + 0x19)); + compression = header[0x21]; + bit = (header[0x22] & 1) ? 127 : -128; + csw_data = (size_t) header[0x23] + 0x34; + + LOG_FORMATS("Sample Rate: %u\n", sample_rate); + LOG_FORMATS("Number of Pulses: %u\n", little_endianize_int32(*(uint32_t *)(header + 0x1d))); + LOG_FORMATS("CompressionType: %u Flags: %u\n", header[0x21], header[0x22]); + LOG_FORMATS("Encoder: "); + for (int i = 0; i < 16; i++) + LOG_FORMATS("%c", header[0x24 + i]); + LOG_FORMATS("\n"); + break; + + default: + LOG_FORMATS("Unsupported Major Version\n"); + return cassette_image::error::INVALID_IMAGE; } - - - total_size=1; - do + + /* csw data */ + switch (compression) { - d_stream.next_out = &gz_ptr[0]; - d_stream.avail_out=1; - err=inflate( &d_stream, Z_SYNC_FLUSH ); - if (err==Z_OK) + case 0x01: + /* RLE (Run Length Encoding) */ + for (size_t pos = csw_data; pos < image_size; pos++) { - bsize=gz_ptr[0]; - if (bsize==0) + bsize = image_data[pos]; + if (bsize == 0) + { + bsize = little_endianize_int32(*(uint32_t *)(&image_data[pos + 1])); + pos += 4; + } + for (int i = 0; i < bsize; i++) { - d_stream.avail_out=4; - d_stream.next_out = &gz_ptr[0]; - err=inflate( &d_stream, Z_SYNC_FLUSH ); - bsize=get_leuint32(&gz_ptr[0]); + samples.resize(sample_count + 1); + samples[sample_count++] = bit; } - total_size=total_size+bsize; + bit ^= 0xff; } - } - while (err==Z_OK); - - if ( err != Z_STREAM_END ) - { - LOG_FORMATS( "inflate error: %d\n", err ); - goto cleanup; - } - - err = inflateEnd( &d_stream ); - if ( err != Z_OK ) - { - LOG_FORMATS( "inflateEnd error: %d\n", err ); - goto cleanup; - } - - return total_size; - -cleanup: - return -1; -} - -static int csw_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) -{ - uint32_t SampleRate; - uint32_t NumberOfPulses; - uint8_t CompressionType; - uint8_t Flags; - uint8_t HeaderExtensionLength; - int8_t Bit; - - std::vector<uint8_t> gz_ptr; - int total_size; - z_stream d_stream; - int err; - uint8_t *in_ptr; - int bsize=0; - int i; - - LOG_FORMATS("Length %d\n",length); - - SampleRate=get_leuint32(bytes+0x19); - LOG_FORMATS("Sample rate %u\n",SampleRate); - - NumberOfPulses=get_leuint32(bytes+0x1d); - LOG_FORMATS("Number Of Pulses %u\n",NumberOfPulses); - - CompressionType=bytes[0x21]; - Flags=bytes[0x22]; - HeaderExtensionLength=bytes[0x23]; - - Bit = (Flags & 1) ? 100 : -100; - - LOG_FORMATS("CompressionType %u Flags %u HeaderExtensionLength %u\n",CompressionType,Flags,HeaderExtensionLength); - - LOG_FORMATS("Encoder: "); - for (i = 0; i < 16; i++) - LOG_FORMATS("%c", bytes[0x24 + i]); - LOG_FORMATS("\n"); - - LOG_FORMATS("Header: "); - for (i = 0; i < HeaderExtensionLength; i++) - LOG_FORMATS("%c", bytes[0x34 + i]); - LOG_FORMATS("\n"); - - //from here on down for now I am assuming it is compressed csw file. - in_ptr = (uint8_t*) bytes+0x34+HeaderExtensionLength; - - gz_ptr.resize( 8 ); - - d_stream.next_in = (unsigned char *)in_ptr; - d_stream.avail_in = mycaslen - ( in_ptr - bytes ); - d_stream.total_in=0; - - d_stream.next_out = &gz_ptr[0]; - d_stream.avail_out = 1; - d_stream.total_out=0; - - d_stream.zalloc = nullptr; - d_stream.zfree = nullptr; - d_stream.opaque = nullptr; - d_stream.data_type=0; + break; + + case 0x02: + /* Z-RLE (CSW v2.xx only) */ + cassette->image_read(&image_data[0], 0, image_size); + + std::vector<uint8_t> gz_ptr; + z_stream d_stream; + int err; + + gz_ptr.resize(8); + + d_stream.next_in = (unsigned char *) &image_data[csw_data]; + d_stream.avail_in = image_size - 0x34 - header[0x23]; + d_stream.total_in = 0; + + d_stream.next_out = &gz_ptr[0]; + d_stream.avail_out = 1; + d_stream.total_out = 0; - err = inflateInit( &d_stream ); - if ( err != Z_OK ) - { - LOG_FORMATS( "inflateInit2 error: %d\n", err ); - goto cleanup; - } + d_stream.zalloc = nullptr; + d_stream.zfree = nullptr; + d_stream.opaque = nullptr; + d_stream.data_type = 0; - total_size=0; + err = inflateInit(&d_stream); + if (err != Z_OK) + { + LOG_FORMATS("inflateInit error: %d\n", err); + return cassette_image::error::INVALID_IMAGE; + } - do - { - d_stream.next_out = &gz_ptr[0]; - d_stream.avail_out=1; - err=inflate( &d_stream, Z_SYNC_FLUSH ); - if (err==Z_OK) + do { - bsize=gz_ptr[0]; - if (bsize==0) + d_stream.next_out = &gz_ptr[0]; + d_stream.avail_out = 1; + err = inflate(&d_stream, Z_SYNC_FLUSH); + if (err == Z_OK) { - d_stream.avail_out=4; - d_stream.next_out = &gz_ptr[0]; - err=inflate( &d_stream, Z_SYNC_FLUSH ); - bsize=get_leuint32(&gz_ptr[0]); + bsize = gz_ptr[0]; + if (bsize == 0) + { + d_stream.avail_out = 4; + d_stream.next_out = &gz_ptr[0]; + err = inflate(&d_stream, Z_SYNC_FLUSH); + bsize = little_endianize_int32(*(uint32_t *)(&gz_ptr[0])); + } + for (int i = 0; i < bsize; i++) + { + samples.resize(sample_count + 1); + samples[sample_count++] = bit; + } + bit ^= 0xff; } - for (i=0;i<bsize;i++) - { - buffer[total_size++]=Bit; - } - Bit=-Bit; - } - } - while (err==Z_OK); + } + while (err == Z_OK); - if ( err != Z_STREAM_END ) - { - LOG_FORMATS( "inflate error: %d\n", err ); - goto cleanup; - } + if (err != Z_STREAM_END) + { + LOG_FORMATS("inflate error: %d\n", err); + return cassette_image::error::INVALID_IMAGE; + } - err = inflateEnd( &d_stream ); - if ( err != Z_OK ) - { - LOG_FORMATS( "inflateEnd error: %d\n", err ); - goto cleanup; + err = inflateEnd(&d_stream); + if (err != Z_OK) + { + LOG_FORMATS("inflateEnd error: %d\n", err); + return cassette_image::error::INVALID_IMAGE; + } + break; } - return length; - -cleanup: - return -1; + return cassette->put_samples(0, 0.0, (double) sample_count / sample_rate, sample_count, 1, &samples[0], cassette_image::WAVEFORM_8BIT); } -static const struct CassetteLegacyWaveFiller csw_legacy_fill_wave = { - csw_cas_fill_wave, /* fill_wave */ - -1, /* chunk_size */ - 0, /* chunk_samples */ - csw_cas_to_wav_size, /* chunk_sample_calc */ - CSW_WAV_FREQUENCY, /* sample_frequency */ - 0, /* header_samples */ - 0 /* trailer_samples */ -}; - -static cassette_image::error csw_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) -{ - uint8_t header[22]; - - cassette_image_read(cassette, header, 0, sizeof(header)); - if (memcmp(&header[0], CSW_HEADER, sizeof(CSW_HEADER) - 1)) { - return cassette_image::error::INVALID_IMAGE; - } - return cassette_legacy_identify( cassette, opts, &csw_legacy_fill_wave ); -} - -static cassette_image::error csw_cassette_load( cassette_image *cassette ) -{ - return cassette_legacy_construct( cassette, &csw_legacy_fill_wave ); -} +/*------------------------------------------------- + CassetteFormat csw_cassette_format +-------------------------------------------------*/ -const struct CassetteFormat csw_cassette_format = { +const cassette_image::Format csw_cassette_format = { "csw", csw_cassette_identify, csw_cassette_load, diff --git a/src/lib/formats/csw_cas.h b/src/lib/formats/csw_cas.h index e6e5a62d764..270d85bcd37 100644 --- a/src/lib/formats/csw_cas.h +++ b/src/lib/formats/csw_cas.h @@ -12,7 +12,7 @@ #include "cassimg.h" -extern const struct CassetteFormat csw_cassette_format; +extern const cassette_image::Format csw_cassette_format; CASSETTE_FORMATLIST_EXTERN(csw_cassette_formats); CASSETTE_FORMATLIST_EXTERN(bbc_cassette_formats); diff --git a/src/lib/formats/fc100_cas.cpp b/src/lib/formats/fc100_cas.cpp index 42b99ad3f0e..56c7b8294db 100644 --- a/src/lib/formats/fc100_cas.cpp +++ b/src/lib/formats/fc100_cas.cpp @@ -10,10 +10,10 @@ it's all a guess. ********************************************************************/ -#include <cassert> - #include "fc100_cas.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -21,7 +21,7 @@ it's all a guess. #define FC100_HEADER_BYTES 16 // image size -static int fc100_image_size; +static int fc100_image_size; // FIXME: global variable prevents multiple instances static int fc100_put_samples(int16_t *buffer, int sample_pos, int count, int level) { @@ -122,7 +122,7 @@ static int fc100_cassette_calculate_size_in_samples(const uint8_t *bytes, int le return fc100_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller fc100_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller fc100_legacy_fill_wave = { fc100_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -133,17 +133,17 @@ static const struct CassetteLegacyWaveFiller fc100_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error fc100_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error fc100_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &fc100_legacy_fill_wave); + return cassette->legacy_identify(opts, &fc100_legacy_fill_wave); } static cassette_image::error fc100_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &fc100_legacy_fill_wave); + return cassette->legacy_construct(&fc100_legacy_fill_wave); } -static const struct CassetteFormat fc100_cassette_image_format = +static const cassette_image::Format fc100_cassette_image_format = { "cas", fc100_cassette_identify, diff --git a/src/lib/formats/fm7_cas.cpp b/src/lib/formats/fm7_cas.cpp index f275866d31b..a0c0151be7b 100644 --- a/src/lib/formats/fm7_cas.cpp +++ b/src/lib/formats/fm7_cas.cpp @@ -4,14 +4,14 @@ * Fujitsu FM-7 series cassette handling */ -#include <cassert> - #include "fm7_cas.h" +#include <cassert> + #define WAVE_HIGH 0x5a9e #define WAVE_LOW -0x5a9e -static int cas_size; +static int cas_size; // FIXME: global variable prevents multiple instances static int fm7_fill_wave(int16_t* buffer, uint8_t high, uint8_t low, int sample_pos) { @@ -76,7 +76,7 @@ static int fm7_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes) return fm7_handle_t77(buffer,bytes); } -static const struct CassetteLegacyWaveFiller fm7_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller fm7_legacy_fill_wave = { fm7_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -87,20 +87,20 @@ static const struct CassetteLegacyWaveFiller fm7_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error fm7_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error fm7_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &fm7_legacy_fill_wave); + return cassette->legacy_identify(opts, &fm7_legacy_fill_wave); } static cassette_image::error fm7_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &fm7_legacy_fill_wave); + return cassette->legacy_construct(&fm7_legacy_fill_wave); } -static const struct CassetteFormat fm7_cassette_format = { +static const cassette_image::Format fm7_cassette_format = { "t77", fm7_cas_identify, fm7_cas_load, diff --git a/src/lib/formats/fmsx_cas.cpp b/src/lib/formats/fmsx_cas.cpp index 3b00b81dc92..7bda85782b5 100644 --- a/src/lib/formats/fmsx_cas.cpp +++ b/src/lib/formats/fmsx_cas.cpp @@ -104,7 +104,7 @@ static int fmsx_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes) } -static const struct CassetteLegacyWaveFiller fmsx_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller fmsx_legacy_fill_wave = { fmsx_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -117,21 +117,21 @@ static const struct CassetteLegacyWaveFiller fmsx_legacy_fill_wave = -static cassette_image::error fmsx_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error fmsx_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &fmsx_legacy_fill_wave); + return cassette->legacy_identify(opts, &fmsx_legacy_fill_wave); } static cassette_image::error fmsx_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &fmsx_legacy_fill_wave); + return cassette->legacy_construct(&fmsx_legacy_fill_wave); } -static const struct CassetteFormat fmsx_cas_format = +static const cassette_image::Format fmsx_cas_format = { "tap,cas", fmsx_cas_identify, diff --git a/src/lib/formats/gtp_cas.cpp b/src/lib/formats/gtp_cas.cpp index 0a5c34d140c..f8ac6917d64 100644 --- a/src/lib/formats/gtp_cas.cpp +++ b/src/lib/formats/gtp_cas.cpp @@ -6,10 +6,10 @@ Miodrag Milanovic */ -#include <cassert> - #include "gtp_cas.h" +#include <cassert> + #define GTP_WAV_FREQUENCY 44100 #define WAVE_LOW -0x5a9e @@ -20,7 +20,7 @@ #define GTP_BLOCK_TURBO 0x01 #define GTP_BLOCK_NAME 0x10 -static int16_t wave_data; +static int16_t wave_data; // FIXME: global variable prevent multiple instances static int16_t len; #define PULSE_WIDTH 30 @@ -164,7 +164,7 @@ static int gtp_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) { -static const struct CassetteLegacyWaveFiller gtp_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller gtp_legacy_fill_wave = { gtp_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -176,19 +176,19 @@ static const struct CassetteLegacyWaveFiller gtp_legacy_fill_wave = { -static cassette_image::error gtp_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { - return cassette_legacy_identify( cassette, opts, >p_legacy_fill_wave ); +static cassette_image::error gtp_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { + return cassette->legacy_identify( opts, >p_legacy_fill_wave ); } static cassette_image::error gtp_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, >p_legacy_fill_wave ); + return cassette->legacy_construct( >p_legacy_fill_wave ); } -static const struct CassetteFormat gtp_cassette_format = { +static const cassette_image::Format gtp_cassette_format = { "gtp", gtp_cassette_identify, gtp_cassette_load, diff --git a/src/lib/formats/h8_cas.cpp b/src/lib/formats/h8_cas.cpp index ec92a94b10f..80ad3e07f5a 100644 --- a/src/lib/formats/h8_cas.cpp +++ b/src/lib/formats/h8_cas.cpp @@ -11,17 +11,17 @@ We output a leader, followed by the contents of the H8T file. ********************************************************************/ -#include <cassert> - #include "h8_cas.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 #define H8_WAV_FREQUENCY 9600 // image size -static int h8_image_size; +static int h8_image_size; // FIXME: global variable prevents multiple instances static int h8_put_samples(int16_t *buffer, int sample_pos, int count, int level) { @@ -115,7 +115,7 @@ static int h8_cassette_calculate_size_in_samples(const uint8_t *bytes, int lengt return h8_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller h8_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller h8_legacy_fill_wave = { h8_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -126,17 +126,17 @@ static const struct CassetteLegacyWaveFiller h8_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error h8_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error h8_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &h8_legacy_fill_wave); + return cassette->legacy_identify(opts, &h8_legacy_fill_wave); } static cassette_image::error h8_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &h8_legacy_fill_wave); + return cassette->legacy_construct(&h8_legacy_fill_wave); } -static const struct CassetteFormat h8_cassette_image_format = +static const cassette_image::Format h8_cassette_image_format = { "h8t", h8_cassette_identify, diff --git a/src/lib/formats/hect_tap.cpp b/src/lib/formats/hect_tap.cpp index 78f1bad2e42..a450b9507b4 100644 --- a/src/lib/formats/hect_tap.cpp +++ b/src/lib/formats/hect_tap.cpp @@ -24,7 +24,7 @@ Updated 3/1/10 : use real value for timing. #define SMPHI 32767 -static int cas_size; +static int cas_size; // FIXME: global variable prevents multiple instances enum @@ -240,7 +240,7 @@ static int hector_tap_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller hector_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller hector_legacy_fill_wave = { hector_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -251,7 +251,7 @@ static const struct CassetteLegacyWaveFiller hector_legacy_fill_wave = 0 /* trailer_samples */ }; -static const struct CassetteLegacyWaveFiller hector_forth_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller hector_forth_legacy_fill_wave = { hector_tap_forth_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -263,30 +263,30 @@ static const struct CassetteLegacyWaveFiller hector_forth_legacy_fill_wave = }; -static cassette_image::error hector_k7_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error hector_k7_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &hector_legacy_fill_wave); + return cassette->legacy_identify(opts, &hector_legacy_fill_wave); } static cassette_image::error hector_k7_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &hector_legacy_fill_wave); + return cassette->legacy_construct(&hector_legacy_fill_wave); } -static cassette_image::error hector_k7forth_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error hector_k7forth_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &hector_forth_legacy_fill_wave); + return cassette->legacy_identify(opts, &hector_forth_legacy_fill_wave); } static cassette_image::error hector_k7forth_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &hector_forth_legacy_fill_wave); + return cassette->legacy_construct(&hector_forth_legacy_fill_wave); } -static const struct CassetteFormat hector_k7_format = +static const cassette_image::Format hector_k7_format = { "k7,cin", hector_k7_identify, @@ -294,7 +294,7 @@ static const struct CassetteFormat hector_k7_format = nullptr }; -static const struct CassetteFormat hector_k7Forth_format = +static const cassette_image::Format hector_k7Forth_format = { "for", hector_k7forth_identify, diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp index 4a42d1c80c8..631eac9b297 100644 --- a/src/lib/formats/imd_dsk.cpp +++ b/src/lib/formats/imd_dsk.cpp @@ -158,18 +158,18 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , uint64_t offset , return FLOPPY_ERROR_SUCCESS; } - auto buffer = global_alloc_array(uint8_t , size_after_off); + auto buffer = std::make_unique<uint8_t []>(size_after_off); // Read the part of file after offset - floppy_image_read(floppy , buffer , offset , size_after_off); + floppy_image_read(floppy, buffer.get(), offset, size_after_off); // Add zeroes - floppy_image_write_filler(floppy , 0 , offset , amount); + floppy_image_write_filler(floppy, 0, offset, amount); // Write back the part of file after offset - floppy_image_write(floppy, buffer, offset + amount, size_after_off); + floppy_image_write(floppy, buffer.get(), offset + amount, size_after_off); - global_free_array(buffer); + buffer.reset(); // Update track offsets struct imddsk_tag *tag = get_tag(floppy); @@ -439,6 +439,12 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) int tracks, heads; image->get_maximal_geometry(tracks, heads); + m_mode.clear(); + m_track.clear(); + m_head.clear(); + m_sector_count.clear(); + m_ssize.clear(); + while(pos < size) { m_mode.push_back(img[pos++]); m_track.push_back(img[pos++]); @@ -522,7 +528,7 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) sects[i].bad_crc = stype == 5 || stype == 6 || stype == 7 || stype == 8; if(stype == 2 || stype == 4 || stype == 6 || stype == 8) { - sects[i].data = global_alloc_array(uint8_t, actual_size); + sects[i].data = new uint8_t [actual_size]; memset(sects[i].data, img[pos++], actual_size); } else { sects[i].data = &img[pos]; @@ -541,7 +547,7 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) for(int i=0; i< m_sector_count.back(); i++) if(sects[i].data && (sects[i].data < &img[0] || sects[i].data >= (&img[0] + size))) - global_free_array(sects[i].data); + delete [] sects[i].data; } return true; diff --git a/src/lib/formats/ioprocs.h b/src/lib/formats/ioprocs.h index 5b45b4a1450..1244873f14c 100644 --- a/src/lib/formats/ioprocs.h +++ b/src/lib/formats/ioprocs.h @@ -25,20 +25,20 @@ struct io_procs { - void (*closeproc)(void *file); - int (*seekproc)(void *file, int64_t offset, int whence); - size_t (*readproc)(void *file, void *buffer, size_t length); - size_t (*writeproc)(void *file, const void *buffer, size_t length); - uint64_t (*filesizeproc)(void *file); + void (*closeproc)(void *file) = nullptr; + int (*seekproc)(void *file, int64_t offset, int whence) = nullptr; + size_t (*readproc)(void *file, void *buffer, size_t length) = nullptr; + size_t (*writeproc)(void *file, const void *buffer, size_t length) = nullptr; + uint64_t (*filesizeproc)(void *file) = nullptr; }; struct io_generic { - const struct io_procs *procs; - void *file; - uint8_t filler; + const struct io_procs *procs = nullptr; + void *file = nullptr; + uint8_t filler = 0; }; @@ -48,10 +48,10 @@ struct io_generic ***************************************************************************/ -extern const struct io_procs stdio_ioprocs; -extern const struct io_procs stdio_ioprocs_noclose; -extern const struct io_procs corefile_ioprocs; -extern const struct io_procs corefile_ioprocs_noclose; +extern const io_procs stdio_ioprocs; +extern const io_procs stdio_ioprocs_noclose; +extern const io_procs corefile_ioprocs; +extern const io_procs corefile_ioprocs_noclose; diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp index ed6505fd385..fc81ffe66ce 100644 --- a/src/lib/formats/ipf_dsk.cpp +++ b/src/lib/formats/ipf_dsk.cpp @@ -1,12 +1,27 @@ // license:BSD-3-Clause // copyright-holders:Olivier Galibert -#include <cassert> #include "ipf_dsk.h" +#include <cassert> + + const floppy_format_type FLOPPY_IPF_FORMAT = &floppy_image_format_creator<ipf_format>; -ipf_format::ipf_format(): tinfos(nullptr), tcount(0), type(0), release(0), revision(0), encoder_type(0), -encoder_revision(0), origin(0), min_cylinder(0), max_cylinder(0), min_head(0), max_head(0), credit_day(0), credit_time(0) +ipf_format::ipf_format() : + tinfos(), + tcount(0), + type(0), + release(0), + revision(0), + encoder_type(0), + encoder_revision(0), + origin(0), + min_cylinder(0), + max_cylinder(0), + min_head(0), + max_head(0), + credit_day(0), + credit_time(0) { } @@ -84,12 +99,11 @@ bool ipf_format::parse(std::vector<uint8_t> &data, floppy_image *image) { image->set_variant(floppy_image::DSDD); // Not handling anything else yet tcount = 84*2+1; // Usual max - tinfos = global_alloc_array_clear<track_info>(tcount); + tinfos.resize(tcount); bool res = scan_all_tags(data); if(res) res = generate_tracks(image); - global_free_array(tinfos); - tinfos = nullptr; + tinfos.clear(); return res; } @@ -121,14 +135,11 @@ ipf_format::track_info *ipf_format::get_index(uint32_t idx) if(idx > 1000) return nullptr; if(idx >= tcount) { - auto ti1 = global_alloc_array_clear<track_info>(idx+1); - memcpy(ti1, tinfos, tcount*sizeof(tinfos)); - global_free_array(tinfos); + tinfos.resize(idx+1); tcount = idx+1; - tinfos = ti1; } - return tinfos+idx; + return &tinfos[idx]; } bool ipf_format::parse_imge(const uint8_t *imge) @@ -246,7 +257,7 @@ bool ipf_format::scan_all_tags(std::vector<uint8_t> &data) bool ipf_format::generate_tracks(floppy_image *image) { for(uint32_t i = 0; i != tcount; i++) { - track_info *t = tinfos + i; + track_info *t = &tinfos[i]; if(t->info_set && t->data) { if(!generate_track(t, image)) return false; diff --git a/src/lib/formats/ipf_dsk.h b/src/lib/formats/ipf_dsk.h index 7db2415afd4..e026cab2c4c 100644 --- a/src/lib/formats/ipf_dsk.h +++ b/src/lib/formats/ipf_dsk.h @@ -24,22 +24,22 @@ public: private: struct track_info { - uint32_t cylinder, head, type; - uint32_t sigtype, process, reserved[3]; - uint32_t size_bytes, size_cells; - uint32_t index_bytes, index_cells; - uint32_t datasize_cells, gapsize_cells; - uint32_t block_count, weak_bits; + uint32_t cylinder = 0, head = 0, type = 0; + uint32_t sigtype = 0, process = 0, reserved[3] = { 0, 0, 0 }; + uint32_t size_bytes = 0, size_cells = 0; + uint32_t index_bytes = 0, index_cells = 0; + uint32_t datasize_cells = 0, gapsize_cells = 0; + uint32_t block_count = 0, weak_bits = 0; - uint32_t data_size_bits; + uint32_t data_size_bits = 0; - bool info_set; + bool info_set = false; - const uint8_t *data; - uint32_t data_size; + const uint8_t *data = nullptr; + uint32_t data_size = 0; }; - track_info *tinfos; + std::vector<track_info> tinfos; uint32_t tcount; uint32_t type, release, revision; diff --git a/src/lib/formats/kc_cas.cpp b/src/lib/formats/kc_cas.cpp index ee3d392e86f..74397e3f89a 100644 --- a/src/lib/formats/kc_cas.cpp +++ b/src/lib/formats/kc_cas.cpp @@ -13,10 +13,10 @@ ********************************************************************/ -#include <cassert> - #include "kc_cas.h" +#include <cassert> + #define SMPLO -32768 #define SMPHI 32767 #define SILENCE 0 @@ -38,7 +38,7 @@ enum }; // image size -static int kc_image_size; +static int kc_image_size; // FIXME: global variable prevents multiple instances /******************************************************************* Generate one high-low cycle of sample data @@ -249,7 +249,7 @@ static int kc_kcc_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller kc_kcc_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller kc_kcc_legacy_fill_wave = { kc_kcc_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -260,19 +260,19 @@ static const struct CassetteLegacyWaveFiller kc_kcc_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error kc_kcc_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error kc_kcc_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &kc_kcc_legacy_fill_wave); + return cassette->legacy_identify(opts, &kc_kcc_legacy_fill_wave); } static cassette_image::error kc_kcc_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &kc_kcc_legacy_fill_wave); + return cassette->legacy_construct(&kc_kcc_legacy_fill_wave); } -static const struct CassetteFormat kc_kcc_format = +static const cassette_image::Format kc_kcc_format = { "kcc,kcb", kc_kcc_identify, @@ -301,7 +301,7 @@ static int kc_tap_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller kc_tap_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller kc_tap_legacy_fill_wave = { kc_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -312,19 +312,19 @@ static const struct CassetteLegacyWaveFiller kc_tap_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error kc_tap_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error kc_tap_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &kc_tap_legacy_fill_wave); + return cassette->legacy_identify(opts, &kc_tap_legacy_fill_wave); } static cassette_image::error kc_tap_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &kc_tap_legacy_fill_wave); + return cassette->legacy_construct(&kc_tap_legacy_fill_wave); } -static const struct CassetteFormat kc_tap_format = +static const cassette_image::Format kc_tap_format = { "tap,853,854,855,tp2,kcm", kc_tap_identify, @@ -353,7 +353,7 @@ static int kc_sss_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller kc_sss_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller kc_sss_legacy_fill_wave = { kc_sss_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -364,18 +364,18 @@ static const struct CassetteLegacyWaveFiller kc_sss_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error kc_sss_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error kc_sss_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &kc_sss_legacy_fill_wave); + return cassette->legacy_identify(opts, &kc_sss_legacy_fill_wave); } static cassette_image::error kc_sss_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &kc_sss_legacy_fill_wave); + return cassette->legacy_construct(&kc_sss_legacy_fill_wave); } -static const struct CassetteFormat kc_sss_format = +static const cassette_image::Format kc_sss_format = { "sss", kc_sss_identify, diff --git a/src/lib/formats/kim1_cas.cpp b/src/lib/formats/kim1_cas.cpp index b7853ee967e..0ae96280ee3 100644 --- a/src/lib/formats/kim1_cas.cpp +++ b/src/lib/formats/kim1_cas.cpp @@ -1,14 +1,14 @@ // license:BSD-3-Clause // copyright-holders:Wilbert Pol -#include <cassert> - #include "kim1_cas.h" +#include <cassert> + #define SMPLO -32768 #define SMPHI 32767 -static int cas_size; +static int cas_size; // FIXME: global variable prevents multiple instances static inline int kim1_output_signal( int16_t *buffer, int sample_pos, int high ) @@ -159,7 +159,7 @@ static int kim1_kim_to_wav_size(const uint8_t *casdata, int caslen) return kim1_handle_kim( nullptr, casdata ); } -static const struct CassetteLegacyWaveFiller kim1_kim_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller kim1_kim_legacy_fill_wave = { kim1_kim_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -171,19 +171,19 @@ static const struct CassetteLegacyWaveFiller kim1_kim_legacy_fill_wave = }; -static cassette_image::error kim1_kim_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error kim1_kim_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &kim1_kim_legacy_fill_wave); + return cassette->legacy_identify(opts, &kim1_kim_legacy_fill_wave); } static cassette_image::error kim1_kim_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &kim1_kim_legacy_fill_wave); + return cassette->legacy_construct(&kim1_kim_legacy_fill_wave); } -static const struct CassetteFormat kim1_kim_format = +static const cassette_image::Format kim1_kim_format = { "kim,kim1", kim1_kim_identify, diff --git a/src/lib/formats/lviv_lvt.cpp b/src/lib/formats/lviv_lvt.cpp index 3a94114d421..3725c181f3c 100644 --- a/src/lib/formats/lviv_lvt.cpp +++ b/src/lib/formats/lviv_lvt.cpp @@ -1,10 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Krzysztof Strzecha /* .LVT tape images */ -#include <cassert> - #include "lviv_lvt.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -19,9 +19,7 @@ static int16_t *lviv_emit_level(int16_t *p, int count, int level) { - int i; - - for (i=0; i<count; i++) + for (int i=0; i<count; i++) { *(p++) = level; } @@ -47,11 +45,9 @@ static int16_t* lviv_output_bit(int16_t *p, uint8_t b) static int16_t* lviv_output_byte(int16_t *p, uint8_t byte) { - int i; - p = lviv_output_bit (p, 0); - for (i=0; i<8; i++) + for (int i=0; i<8; i++) p = lviv_output_bit(p,(byte>>i) & 0x01); p = lviv_output_bit (p, 1); @@ -78,23 +74,22 @@ static int lviv_cassette_calculate_size_in_samples(const uint8_t *bytes, int len static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) { - int i; int16_t * p = buffer; int data_size; - for (i=0; i<LVIV_LVT_HEADER_PILOT_LENGTH; i++) + for (int i=0; i<LVIV_LVT_HEADER_PILOT_LENGTH; i++) p = lviv_output_bit (p, 1); - for (i=0; i<10; i++) + for (int i=0; i<10; i++) p = lviv_output_byte (p, bytes[0x09]); - for (i=0; i<6; i++) + for (int i=0; i<6; i++) p = lviv_output_byte (p, bytes[0x0a+i]); p = lviv_emit_level (p, LVIV_LVT_PAUSE_SAMPLES, WAVEENTRY_HIGH); - for (i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++) + for (int i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++) p = lviv_output_bit (p, 1); data_size = length - ( LVIV_LVT_HEADER_PILOT_SAMPLES + @@ -103,7 +98,7 @@ static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) LVIV_LVT_BLOCK_PILOT_SAMPLES ); data_size/=660; - for (i=0; i<data_size; i++) + for (int i=0; i<data_size; i++) p = lviv_output_byte (p, bytes[0x10+i]); return p - buffer; @@ -111,7 +106,7 @@ static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) -static const struct CassetteLegacyWaveFiller lviv_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller lviv_legacy_fill_wave = { lviv_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -124,21 +119,21 @@ static const struct CassetteLegacyWaveFiller lviv_legacy_fill_wave = -static cassette_image::error lviv_lvt_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error lviv_lvt_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &lviv_legacy_fill_wave); + return cassette->legacy_identify(opts, &lviv_legacy_fill_wave); } static cassette_image::error lviv_lvt_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &lviv_legacy_fill_wave); + return cassette->legacy_construct(&lviv_legacy_fill_wave); } -static const struct CassetteFormat lviv_lvt_image_format = +static const cassette_image::Format lviv_lvt_image_format = { "lvt,lvr,lv0,lv1,lv2,lv3", lviv_lvt_identify, diff --git a/src/lib/formats/mbee_cas.cpp b/src/lib/formats/mbee_cas.cpp index 181bca6aac0..855b4757581 100644 --- a/src/lib/formats/mbee_cas.cpp +++ b/src/lib/formats/mbee_cas.cpp @@ -227,7 +227,7 @@ static int mbee_tap_calculate_size_in_samples(const uint8_t *bytes, int length) return mbee_handle_tap(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller mbee_tap_config = +static const cassette_image::LegacyWaveFiller mbee_tap_config = { mbee_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -238,17 +238,17 @@ static const struct CassetteLegacyWaveFiller mbee_tap_config = 0 /* trailer_samples */ }; -static cassette_image::error mbee_tap_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error mbee_tap_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &mbee_tap_config); + return cassette->legacy_identify(opts, &mbee_tap_config); } static cassette_image::error mbee_tap_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &mbee_tap_config); + return cassette->legacy_construct(&mbee_tap_config); } -static const struct CassetteFormat mbee_tap_image_format = +static const cassette_image::Format mbee_tap_image_format = { "tap", mbee_tap_identify, diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp index 0f118ce620f..eb86d8d80da 100644 --- a/src/lib/formats/mfi_dsk.cpp +++ b/src/lib/formats/mfi_dsk.cpp @@ -187,8 +187,8 @@ bool mfi_format::save(io_generic *io, floppy_image *image) int pos = sizeof(header) + (tracks << resolution)*heads*sizeof(entry); int epos = 0; - auto precomp = global_alloc_array(uint32_t, max_track_size); - auto postcomp = global_alloc_array(uint8_t, max_track_size*4 + 1000); + auto precomp = std::make_unique<uint32_t []>(max_track_size); + auto postcomp = std::make_unique<uint8_t []>(max_track_size*4 + 1000); for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution) for(int head=0; head<heads; head++) { @@ -199,7 +199,7 @@ bool mfi_format::save(io_generic *io, floppy_image *image) continue; } - memcpy(precomp, &buffer[0], tsize*4); + memcpy(&precomp[0], &buffer[0], tsize*4); for(int j=0; j<tsize-1; j++) precomp[j] = (precomp[j] & floppy_image::MG_MASK) | ((precomp[j+1] & floppy_image::TIME_MASK) - @@ -208,11 +208,8 @@ bool mfi_format::save(io_generic *io, floppy_image *image) (200000000 - (precomp[tsize-1] & floppy_image::TIME_MASK)); uLongf csize = max_track_size*4 + 1000; - if(compress(postcomp, &csize, (const Bytef *)precomp, tsize*4) != Z_OK) { - global_free_array(precomp); - global_free_array(postcomp); + if(compress(postcomp.get(), &csize, (const Bytef *)precomp.get(), tsize*4) != Z_OK) return false; - } entries[epos].offset = pos; entries[epos].uncompressed_size = tsize*4; @@ -220,13 +217,11 @@ bool mfi_format::save(io_generic *io, floppy_image *image) entries[epos].write_splice = image->get_write_splice_position(track >> 2, head, track & 3); epos++; - io_generic_write(io, postcomp, pos, csize); + io_generic_write(io, postcomp.get(), pos, csize); pos += csize; } io_generic_write(io, entries, sizeof(header), (tracks << resolution)*heads*sizeof(entry)); - global_free_array(precomp); - global_free_array(postcomp); return true; } diff --git a/src/lib/formats/mz_cas.cpp b/src/lib/formats/mz_cas.cpp index e7af23aafb4..0ab4cec8e84 100644 --- a/src/lib/formats/mz_cas.cpp +++ b/src/lib/formats/mz_cas.cpp @@ -1,8 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Nathan Woods +#include "mz_cas.h" + #include <cstring> #include <cassert> -#include "mz_cas.h" #ifndef VERBOSE #define VERBOSE 0 @@ -301,7 +302,7 @@ static int fill_wave(int16_t *buffer, int length, uint8_t *code) -static const struct CassetteLegacyWaveFiller mz700_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller mz700_legacy_fill_wave = { fill_wave, /* fill_wave */ 1, /* chunk_size */ @@ -314,21 +315,21 @@ static const struct CassetteLegacyWaveFiller mz700_legacy_fill_wave = -static cassette_image::error mz700_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error mz700_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &mz700_legacy_fill_wave); + return cassette->legacy_identify(opts, &mz700_legacy_fill_wave); } static cassette_image::error mz700_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &mz700_legacy_fill_wave); + return cassette->legacy_construct(&mz700_legacy_fill_wave); } -static const struct CassetteFormat mz700_cas_format = +static const cassette_image::Format mz700_cas_format = { "m12,mzf,mzt", mz700_cas_identify, diff --git a/src/lib/formats/orao_cas.cpp b/src/lib/formats/orao_cas.cpp index 9a2ac05547e..a9c3f7473d4 100644 --- a/src/lib/formats/orao_cas.cpp +++ b/src/lib/formats/orao_cas.cpp @@ -5,10 +5,10 @@ Tape support for Orao TAP format */ -#include <cassert> - #include "orao_cas.h" +#include <cassert> + #define ORAO_WAV_FREQUENCY 44100 #define WAVE_HIGH -32768 @@ -19,7 +19,7 @@ #define ORAO_HEADER_SIZE 360 -static int16_t wave_data; +static int16_t wave_data; // FIXME: global variables prevent multiple instances static int len; static void orao_output_wave( int16_t **buffer, int length ) { @@ -85,7 +85,7 @@ static int orao_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) { -static const struct CassetteLegacyWaveFiller orao_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller orao_legacy_fill_wave = { orao_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -97,19 +97,19 @@ static const struct CassetteLegacyWaveFiller orao_legacy_fill_wave = { -static cassette_image::error orao_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { - return cassette_legacy_identify( cassette, opts, &orao_legacy_fill_wave ); +static cassette_image::error orao_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { + return cassette->legacy_identify( opts, &orao_legacy_fill_wave ); } static cassette_image::error orao_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &orao_legacy_fill_wave ); + return cassette->legacy_construct( &orao_legacy_fill_wave ); } -static const struct CassetteFormat orao_cassette_format = { +static const cassette_image::Format orao_cassette_format = { "tap", orao_cassette_identify, orao_cassette_load, diff --git a/src/lib/formats/oric_tap.cpp b/src/lib/formats/oric_tap.cpp index dcee2f0bd2d..9dc98239fac 100644 --- a/src/lib/formats/oric_tap.cpp +++ b/src/lib/formats/oric_tap.cpp @@ -1,8 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Kevin Thacker +#include "oric_tap.h" + #include <cassert> -#include "oric_tap.h" #define ORIC_WAV_DEBUG 0 #define LOG(x) do { if (ORIC_WAV_DEBUG) printf x; } while (0) @@ -481,7 +482,7 @@ static int oric_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) -static const struct CassetteLegacyWaveFiller oric_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller oric_legacy_fill_wave = { oric_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -494,21 +495,21 @@ static const struct CassetteLegacyWaveFiller oric_legacy_fill_wave = -static cassette_image::error oric_tap_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error oric_tap_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &oric_legacy_fill_wave); + return cassette->legacy_identify(opts, &oric_legacy_fill_wave); } static cassette_image::error oric_tap_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &oric_legacy_fill_wave); + return cassette->legacy_construct(&oric_legacy_fill_wave); } -static const struct CassetteFormat oric_tap_format = +static const cassette_image::Format oric_tap_format = { "tap", oric_tap_identify, diff --git a/src/lib/formats/p2000t_cas.cpp b/src/lib/formats/p2000t_cas.cpp index e3351dc99dc..7bc0c6b21a9 100644 --- a/src/lib/formats/p2000t_cas.cpp +++ b/src/lib/formats/p2000t_cas.cpp @@ -1,12 +1,12 @@ // license:BSD-3-Clause // copyright-holders:Curt Coder -#include <cassert> - -#include "cassimg.h" #include "p2000t_cas.h" + +#include <cassert> #include <ostream> + // This code will reproduce the timing of a P2000 mini cassette tape. constexpr double P2000_CLOCK_PERIOD = 0.000084; constexpr double P2000_BOT_GAP = 1; @@ -153,10 +153,10 @@ struct P2000T_Header std::ostream &operator<<(std::ostream &os, P2000T_Header const &hdr) { return os << "File: " << std::string(hdr.file_name, 8) << '.' - << std::string(hdr.ext, 3) << " " << hdr.file_length; + << std::string(hdr.ext, 3) << " " << hdr.file_length; } -static cassette_image::error p2000t_cas_identify(cassette_image *cass, struct CassetteOptions *opts) +static cassette_image::error p2000t_cas_identify(cassette_image *cass, cassette_image::Options *opts) { opts->bits_per_sample = 32; opts->channels = 1; @@ -189,36 +189,36 @@ void update_chksum(uint16_t *de, bool bit) } /* - A transition on a clock boundary from low to high is a 1. - A transition on a clock boundary from high to low is a 0 - An intermediate transition halfway between the clock boundary - can occur when there are consecutive 0s or 1s. See the example - below where the clock is marked by a | - - - 1 0 1 1 0 0 - RDA: _|----|____|--__|----|__--|__-- - RDC: _|-___|-___|-___|-___|-___|-___ - ^ ^ - |-- clock signal |-- intermediate transition. - - This signal can be written by a simple algorithm where the first bit - is always false (transition to low, half clock). Now only one bit is needed - to determine what the next partial clock should look like. - - This works because we are always guaranteed that a block starts with 0xAA, - and hence will ALWAYS find a signal like this on tape: _-- (low, high, high) - after a gap. This is guaranteed when the tape is moving forward as well as - backwards. + A transition on a clock boundary from low to high is a 1. + A transition on a clock boundary from high to low is a 0 + An intermediate transition halfway between the clock boundary + can occur when there are consecutive 0s or 1s. See the example + below where the clock is marked by a | + + + 1 0 1 1 0 0 + RDA: _|----|____|--__|----|__--|__-- + RDC: _|-___|-___|-___|-___|-___|-___ + ^ ^ + |-- clock signal |-- intermediate transition. + + This signal can be written by a simple algorithm where the first bit + is always false (transition to low, half clock). Now only one bit is needed + to determine what the next partial clock should look like. + + This works because we are always guaranteed that a block starts with 0xAA, + and hence will ALWAYS find a signal like this on tape: _-- (low, high, high) + after a gap. This is guaranteed when the tape is moving forward as well as + backwards. */ cassette_image::error p2000t_put_bit(cassette_image *cass, double *time_index, bool bit) { const int channel = 0; cassette_image::error err = cassette_image::error::SUCCESS; - CHR(cassette_put_sample(cass, channel, *time_index, P2000_CLOCK_PERIOD, bit ? P2000_HIGH : P2000_LOW)); + CHR(cass->put_sample(channel, *time_index, P2000_CLOCK_PERIOD, bit ? P2000_HIGH : P2000_LOW)); *time_index += P2000_CLOCK_PERIOD; - CHR(cassette_put_sample(cass, channel, *time_index, P2000_CLOCK_PERIOD, bit ? P2000_LOW : P2000_HIGH)); + CHR(cass->put_sample(channel, *time_index, P2000_CLOCK_PERIOD, bit ? P2000_LOW : P2000_HIGH)); *time_index += P2000_CLOCK_PERIOD; return err; } @@ -251,7 +251,7 @@ cassette_image::error p2000t_silence(cassette_image *cassette, double *time_index, double time) { - auto err = cassette_put_sample(cassette, 0, *time_index, time, 0); + auto err = cassette->put_sample(0, *time_index, time, 0); *time_index += time; return err; } @@ -259,21 +259,21 @@ double time) static cassette_image::error p2000t_cas_load(cassette_image *cassette) { cassette_image::error err = cassette_image::error::SUCCESS; - uint64_t image_size = cassette_image_size(cassette); + uint64_t image_size = cassette->image_size(); constexpr int CAS_BLOCK = 1280; /* - The cas format is pretty simple. it consists of a sequence of blocks, - where a block consists of the following: + The cas format is pretty simple. it consists of a sequence of blocks, + where a block consists of the following: - [0-256] P2000 memory address 0x6000 - 0x6100 - .... Nonsense (keyboard status etc.) - 0x30 P200T_Header - 0x50 - ... Nonsense.. - [0-1024] Data block + [0-256] P2000 memory address 0x6000 - 0x6100 + .... Nonsense (keyboard status etc.) + 0x30 P200T_Header + 0x50 + ... Nonsense.. + [0-1024] Data block - This means that one block gets stored in 1280 bytes. + This means that one block gets stored in 1280 bytes. */ if (image_size % CAS_BLOCK != 0) { @@ -290,7 +290,7 @@ static cassette_image::error p2000t_cas_load(cassette_image *cassette) for (int i = 0; i < blocks; i++) { uint16_t crc = 0, unused = 0; - cassette_image_read(cassette, &block, CAS_BLOCK * i, CAS_BLOCK); + cassette->image_read(&block, CAS_BLOCK * i, CAS_BLOCK); // Insert sync header.. 0xAA, 0x00, 0x00, 0xAA CHR(p2000t_silence(cassette, &time_idx, P2000_BOB_GAP)); @@ -312,7 +312,7 @@ static cassette_image::error p2000t_cas_load(cassette_image *cassette) return p2000t_silence(cassette, &time_idx, P2000_EOT_GAP); } -static const struct CassetteFormat p2000t_cas = { +static const cassette_image::Format p2000t_cas = { "cas", p2000t_cas_identify, p2000t_cas_load, nullptr /* no save */ }; diff --git a/src/lib/formats/p6001_cas.cpp b/src/lib/formats/p6001_cas.cpp index 3319e377b3d..425a4e8dd2c 100644 --- a/src/lib/formats/p6001_cas.cpp +++ b/src/lib/formats/p6001_cas.cpp @@ -4,22 +4,21 @@ * NEC PC-6001 cassette format handling */ -#include <cassert> - #include "p6001_cas.h" +#include <cassert> + #define WAVE_HIGH 0x5a9e #define WAVE_LOW -0x5a9e -static int cas_size; +static int cas_size; // FIXME: global variable prevents multiple instances static int pc6001_fill_wave(int16_t* buffer, uint8_t data, int sample_pos) { - int x; int sample_count = 0; // one byte = 8 samples - for(x=0;x<8;x++) + for(int x=0;x<8;x++) { if(buffer) buffer[sample_pos+x] = ((data >> (7-x)) & 1) ? WAVE_HIGH : WAVE_LOW; @@ -61,7 +60,7 @@ static int pc6001_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *byte return pc6001_handle_cas(buffer,bytes); } -static const struct CassetteLegacyWaveFiller pc6001_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller pc6001_legacy_fill_wave = { pc6001_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -72,20 +71,20 @@ static const struct CassetteLegacyWaveFiller pc6001_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error pc6001_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error pc6001_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &pc6001_legacy_fill_wave); + return cassette->legacy_identify(opts, &pc6001_legacy_fill_wave); } static cassette_image::error pc6001_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &pc6001_legacy_fill_wave); + return cassette->legacy_construct(&pc6001_legacy_fill_wave); } -static const struct CassetteFormat pc6001_cassette_format = { +static const cassette_image::Format pc6001_cassette_format = { "cas", pc6001_cas_identify, pc6001_cas_load, diff --git a/src/lib/formats/phc25_cas.cpp b/src/lib/formats/phc25_cas.cpp index 197c3db50ae..ee8864adbb5 100644 --- a/src/lib/formats/phc25_cas.cpp +++ b/src/lib/formats/phc25_cas.cpp @@ -29,10 +29,10 @@ enough to make it work. ********************************************************************/ -#include <cassert> - #include "phc25_cas.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -40,7 +40,7 @@ enough to make it work. #define PHC25_HEADER_BYTES 16 // image size -static int phc25_image_size; +static int phc25_image_size; // FIXME: global variable prevents multiple instances static int phc25_put_samples(int16_t *buffer, int sample_pos, int count, int level) { @@ -147,7 +147,7 @@ static int phc25_cassette_calculate_size_in_samples(const uint8_t *bytes, int le return phc25_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller phc25_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller phc25_legacy_fill_wave = { phc25_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -158,17 +158,17 @@ static const struct CassetteLegacyWaveFiller phc25_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error phc25_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error phc25_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &phc25_legacy_fill_wave); + return cassette->legacy_identify(opts, &phc25_legacy_fill_wave); } static cassette_image::error phc25_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &phc25_legacy_fill_wave); + return cassette->legacy_construct(&phc25_legacy_fill_wave); } -static const struct CassetteFormat phc25_cassette_image_format = +static const cassette_image::Format phc25_cassette_image_format = { "phc", phc25_cassette_identify, diff --git a/src/lib/formats/pmd_cas.cpp b/src/lib/formats/pmd_cas.cpp index a046580bc17..20e4a64bbe1 100644 --- a/src/lib/formats/pmd_cas.cpp +++ b/src/lib/formats/pmd_cas.cpp @@ -10,10 +10,10 @@ ********************************************************************/ -#include <cassert> - #include "pmd_cas.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -26,7 +26,7 @@ #define PMD85_BITS_PER_BYTE 11 // image size -static int pmd85_image_size; +static int pmd85_image_size; // FIXME: global variable prevents multiple instances static int pmd85_emit_level(int16_t *buffer, int sample_pos, int count, int level) { @@ -184,7 +184,7 @@ static int pmd85_cassette_calculate_size_in_samples(const uint8_t *bytes, int le return pmd85_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller pmd85_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller pmd85_legacy_fill_wave = { pmd85_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -195,17 +195,17 @@ static const struct CassetteLegacyWaveFiller pmd85_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error pmd85_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error pmd85_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &pmd85_legacy_fill_wave); + return cassette->legacy_identify(opts, &pmd85_legacy_fill_wave); } static cassette_image::error pmd85_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &pmd85_legacy_fill_wave); + return cassette->legacy_construct(&pmd85_legacy_fill_wave); } -static const struct CassetteFormat pmd85_cassette_image_format = +static const cassette_image::Format pmd85_cassette_image_format = { "pmd,tap,ptp", pmd85_cassette_identify, diff --git a/src/lib/formats/primoptp.cpp b/src/lib/formats/primoptp.cpp index 906a08239a6..6e04f01bc62 100644 --- a/src/lib/formats/primoptp.cpp +++ b/src/lib/formats/primoptp.cpp @@ -2,11 +2,10 @@ // copyright-holders:Krzysztof Strzecha /* .PTP Microkey Primo tape images */ +#include "primoptp.h" #include <cassert> -#include "primoptp.h" - #define PRIMO_WAVEENTRY_LOW -32768 #define PRIMO_WAVEENTRY_HIGH 32767 @@ -30,9 +29,7 @@ static uint32_t primo_tape_image_length; static int16_t *primo_emit_level(int16_t *p, int count, int level) { - int i; - - for (i=0; i<count; i++) *(p++) = level; + for (int i=0; i<count; i++) *(p++) = level; return p; } @@ -215,7 +212,7 @@ static int primo_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) return p - buffer; } -static const struct CassetteLegacyWaveFiller primo_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller primo_legacy_fill_wave = { primo_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -226,17 +223,17 @@ static const struct CassetteLegacyWaveFiller primo_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error primo_ptp_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error primo_ptp_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &primo_legacy_fill_wave); + return cassette->legacy_identify(opts, &primo_legacy_fill_wave); } static cassette_image::error primo_ptp_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &primo_legacy_fill_wave); + return cassette->legacy_construct(&primo_legacy_fill_wave); } -static const struct CassetteFormat primo_ptp_image_format = +static const cassette_image::Format primo_ptp_image_format = { "ptp", primo_ptp_identify, diff --git a/src/lib/formats/rk_cas.cpp b/src/lib/formats/rk_cas.cpp index b522fea2f3b..a31c47592db 100644 --- a/src/lib/formats/rk_cas.cpp +++ b/src/lib/formats/rk_cas.cpp @@ -5,10 +5,10 @@ Tape support for RK format */ -#include <cassert> - #include "rk_cas.h" +#include <cassert> + #define RK_WAV_FREQUENCY 44000 #define WAVE_HIGH 32767 @@ -20,13 +20,12 @@ #define RK_SIZE_22 22 #define RK_SIZE_60 60 -static int data_size; +static int data_size; // FIXME: global variable prevents multiple instances static int16_t *rk_emit_level(int16_t *p, int count, int level) { - int i; - for (i=0; i<count; i++) + for (int i=0; i<count; i++) { *(p++) = level; } @@ -141,7 +140,7 @@ static int gam_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) { return p - buffer; } -static const struct CassetteLegacyWaveFiller rk20_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller rk20_legacy_fill_wave = { rk20_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -151,15 +150,15 @@ static const struct CassetteLegacyWaveFiller rk20_legacy_fill_wave = { 0 /* trailer_samples */ }; -static cassette_image::error rk20_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { - return cassette_legacy_identify( cassette, opts, &rk20_legacy_fill_wave ); +static cassette_image::error rk20_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { + return cassette->legacy_identify( opts, &rk20_legacy_fill_wave ); } static cassette_image::error rk20_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &rk20_legacy_fill_wave ); + return cassette->legacy_construct( &rk20_legacy_fill_wave ); } -static const struct CassetteLegacyWaveFiller rk22_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller rk22_legacy_fill_wave = { rk22_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -169,15 +168,15 @@ static const struct CassetteLegacyWaveFiller rk22_legacy_fill_wave = { 0 /* trailer_samples */ }; -static cassette_image::error rk22_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { - return cassette_legacy_identify( cassette, opts, &rk22_legacy_fill_wave ); +static cassette_image::error rk22_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { + return cassette->legacy_identify( opts, &rk22_legacy_fill_wave ); } static cassette_image::error rk22_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &rk22_legacy_fill_wave ); + return cassette->legacy_construct( &rk22_legacy_fill_wave ); } -static const struct CassetteLegacyWaveFiller gam_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller gam_legacy_fill_wave = { gam_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -187,15 +186,15 @@ static const struct CassetteLegacyWaveFiller gam_legacy_fill_wave = { 0 /* trailer_samples */ }; -static cassette_image::error gam_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { - return cassette_legacy_identify( cassette, opts, &gam_legacy_fill_wave ); +static cassette_image::error gam_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { + return cassette->legacy_identify( opts, &gam_legacy_fill_wave ); } static cassette_image::error gam_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &gam_legacy_fill_wave ); + return cassette->legacy_construct( &gam_legacy_fill_wave ); } -static const struct CassetteLegacyWaveFiller rk60_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller rk60_legacy_fill_wave = { rk60_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -205,71 +204,71 @@ static const struct CassetteLegacyWaveFiller rk60_legacy_fill_wave = { 0 /* trailer_samples */ }; -static cassette_image::error rk60_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { - return cassette_legacy_identify( cassette, opts, &rk60_legacy_fill_wave ); +static cassette_image::error rk60_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { + return cassette->legacy_identify( opts, &rk60_legacy_fill_wave ); } static cassette_image::error rk60_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &rk60_legacy_fill_wave ); + return cassette->legacy_construct( &rk60_legacy_fill_wave ); } -static const struct CassetteFormat rku_cassette_format = { +static const cassette_image::Format rku_cassette_format = { "rku", rk20_cassette_identify, rk20_cassette_load, nullptr }; -static const struct CassetteFormat rk8_cassette_format = { +static const cassette_image::Format rk8_cassette_format = { "rk8", rk60_cassette_identify, rk60_cassette_load, nullptr }; -static const struct CassetteFormat rks_cassette_format = { +static const cassette_image::Format rks_cassette_format = { "rks", rk20_cassette_identify, rk20_cassette_load, nullptr }; -static const struct CassetteFormat rko_cassette_format = { +static const cassette_image::Format rko_cassette_format = { "rko", rk20_cassette_identify, rk20_cassette_load, nullptr }; -static const struct CassetteFormat rkr_cassette_format = { +static const cassette_image::Format rkr_cassette_format = { "rk,rkr", rk20_cassette_identify, rk20_cassette_load, nullptr }; -static const struct CassetteFormat rka_cassette_format = { +static const cassette_image::Format rka_cassette_format = { "rka", rk20_cassette_identify, rk20_cassette_load, nullptr }; -static const struct CassetteFormat rkm_cassette_format = { +static const cassette_image::Format rkm_cassette_format = { "rkm", rk22_cassette_identify, rk22_cassette_load, nullptr }; -static const struct CassetteFormat rkp_cassette_format = { +static const cassette_image::Format rkp_cassette_format = { "rkp", rk20_cassette_identify, rk20_cassette_load, nullptr }; -static const struct CassetteFormat gam_cassette_format = { +static const cassette_image::Format gam_cassette_format = { "gam,g16,pki", gam_cassette_identify, gam_cassette_load, diff --git a/src/lib/formats/sc3000_bit.cpp b/src/lib/formats/sc3000_bit.cpp index 6e3600b7aeb..ab0828e709a 100644 --- a/src/lib/formats/sc3000_bit.cpp +++ b/src/lib/formats/sc3000_bit.cpp @@ -7,10 +7,10 @@ Cassette code for Sega SC-3000 *.bit files *********************************************************************/ +#include "sc3000_bit.h" #include <cassert> -#include "sc3000_bit.h" /*************************************************************************** PARAMETERS @@ -26,9 +26,9 @@ CassetteModulation sc3000_bit_modulation -------------------------------------------------*/ -static const struct CassetteModulation sc3000_bit_modulation = +static const cassette_image::Modulation sc3000_bit_modulation = { - CASSETTE_MODULATION_SINEWAVE, + cassette_image::MODULATION_SINEWAVE, 1200.0 - 300, 1200.0, 1200.0 + 300, 2400.0 - 600, 2400.0, 2400.0 + 600 }; @@ -37,9 +37,9 @@ static const struct CassetteModulation sc3000_bit_modulation = sc3000_bit_identify - identify cassette -------------------------------------------------*/ -static cassette_image::error sc3000_bit_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error sc3000_bit_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_modulation_identify( cassette, &sc3000_bit_modulation, opts); + return cassette->modulation_identify(sc3000_bit_modulation, opts); } /*------------------------------------------------- @@ -48,7 +48,7 @@ static cassette_image::error sc3000_bit_identify(cassette_image *cassette, struc #define MODULATE(_value) \ for (int i = 0; i < (_value ? 2 : 1); i++) { \ - err = cassette_put_modulated_data_bit(cassette, 0, time_index, _value, &sc3000_bit_modulation, &time_displacement);\ + err = cassette->put_modulated_data_bit(0, time_index, _value, sc3000_bit_modulation, &time_displacement);\ if (err != cassette_image::error::SUCCESS) return err;\ time_index += time_displacement;\ } @@ -56,7 +56,7 @@ static cassette_image::error sc3000_bit_identify(cassette_image *cassette, struc static cassette_image::error sc3000_bit_load(cassette_image *cassette) { cassette_image::error err; - uint64_t image_size = cassette_image_size(cassette); + uint64_t image_size = cassette->image_size(); uint64_t image_pos = 0; double time_index = 0.0; double time_displacement; @@ -64,7 +64,7 @@ static cassette_image::error sc3000_bit_load(cassette_image *cassette) while (image_pos < image_size) { - cassette_image_read(cassette, &data, image_pos, 1); + cassette->image_read(&data, image_pos, 1); switch (data) { @@ -77,7 +77,7 @@ static cassette_image::error sc3000_bit_load(cassette_image *cassette) break; case ' ': - err = cassette_put_sample( cassette, 0, time_index, 1/1200.0, 0); + err = cassette->put_sample(0, time_index, 1/1200.0, 0); if (err != cassette_image::error::SUCCESS) return err; time_index += 1/1200.0; break; @@ -93,7 +93,7 @@ static cassette_image::error sc3000_bit_load(cassette_image *cassette) CassetteFormat sc3000_bit_cassette_format -------------------------------------------------*/ -const struct CassetteFormat sc3000_bit_format = +const cassette_image::Format sc3000_bit_format = { "bit", sc3000_bit_identify, diff --git a/src/lib/formats/sol_cas.cpp b/src/lib/formats/sol_cas.cpp index 4672ff95080..a48a5b918fd 100644 --- a/src/lib/formats/sol_cas.cpp +++ b/src/lib/formats/sol_cas.cpp @@ -33,10 +33,10 @@ SVT - The full explanation may be found on the Solace web site, escaped characters ********************************************************************/ +#include "sol_cas.h" #include <cassert> -#include "sol_cas.h" #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -44,7 +44,7 @@ SVT - The full explanation may be found on the Solace web site, #define SOL20_WAV_FREQUENCY 4800 // image size -static uint32_t sol20_image_size; +static uint32_t sol20_image_size; // FIXME: global variable prevent multiple instances static bool level; static uint8_t sol20_cksm_byte; static uint32_t sol20_byte_num; @@ -356,7 +356,7 @@ static int sol20_cassette_calculate_size_in_samples(const uint8_t *bytes, int le return sol20_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller sol20_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller sol20_legacy_fill_wave = { sol20_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -367,17 +367,17 @@ static const struct CassetteLegacyWaveFiller sol20_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error sol20_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error sol20_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &sol20_legacy_fill_wave); + return cassette->legacy_identify(opts, &sol20_legacy_fill_wave); } static cassette_image::error sol20_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &sol20_legacy_fill_wave); + return cassette->legacy_construct(&sol20_legacy_fill_wave); } -static const struct CassetteFormat sol20_cassette_image_format = +static const cassette_image::Format sol20_cassette_image_format = { "svt", sol20_cassette_identify, diff --git a/src/lib/formats/sorc_cas.cpp b/src/lib/formats/sorc_cas.cpp index 50585d444c7..21b3f8b5c2c 100644 --- a/src/lib/formats/sorc_cas.cpp +++ b/src/lib/formats/sorc_cas.cpp @@ -24,10 +24,10 @@ header and leader bytes. ********************************************************************/ +#include "sorc_cas.h" #include <cassert> -#include "sorc_cas.h" #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -124,7 +124,7 @@ static int sorcerer_cassette_calculate_size_in_samples(const uint8_t *bytes, int return sorcerer_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller sorcerer_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller sorcerer_legacy_fill_wave = { sorcerer_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -135,17 +135,17 @@ static const struct CassetteLegacyWaveFiller sorcerer_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error sorcerer_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error sorcerer_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &sorcerer_legacy_fill_wave); + return cassette->legacy_identify(opts, &sorcerer_legacy_fill_wave); } static cassette_image::error sorcerer_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &sorcerer_legacy_fill_wave); + return cassette->legacy_construct(&sorcerer_legacy_fill_wave); } -static const struct CassetteFormat sorcerer_cassette_image_format = +static const cassette_image::Format sorcerer_cassette_image_format = { "tape", sorcerer_cassette_identify, diff --git a/src/lib/formats/sord_cas.cpp b/src/lib/formats/sord_cas.cpp index 145cd3c3221..f90daafd248 100644 --- a/src/lib/formats/sord_cas.cpp +++ b/src/lib/formats/sord_cas.cpp @@ -7,10 +7,10 @@ Format code for Sord M5 cassette files **************************************************************************/ +#include "sord_cas.h" #include <cstring> #include <cassert> -#include "sord_cas.h" #define SORDM5_WAVESAMPLES_HEADER 1 #define SORDM5_WAVESAMPLES_TRAILER 1 @@ -18,9 +18,9 @@ static const uint8_t SORDM5_CAS_HEADER[6] = { 'S', 'O', 'R', 'D', 'M', '5'}; -static const struct CassetteModulation sordm5_cas_modulation = +static const cassette_image::Modulation sordm5_cas_modulation = { - CASSETTE_MODULATION_SINEWAVE, + cassette_image::MODULATION_SINEWAVE, 1575.0 - 300, 1575.0, 1575.0 + 300, 3150.0 - 600, 3150.0, 3150.0 + 600 }; @@ -28,13 +28,13 @@ static const struct CassetteModulation sordm5_cas_modulation = static uint8_t cassette_image_read_uint8( cassette_image *cassette, uint64_t offset) { uint8_t data; - cassette_image_read( cassette, &data, offset, 1); + cassette->image_read(&data, offset, 1); return data; } -static cassette_image::error sordm5_tap_identify( cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error sordm5_tap_identify( cassette_image *cassette, cassette_image::Options *opts) { - return cassette_modulation_identify( cassette, &sordm5_cas_modulation, opts); + return cassette->modulation_identify(sordm5_cas_modulation, opts); } static cassette_image::error sordm5_tap_load( cassette_image *cassette) @@ -49,44 +49,44 @@ static cassette_image::error sordm5_tap_load( cassette_image *cassette) uint32_t block_size, i, j; size_t filler_length; // init - image_size = cassette_image_size(cassette); + image_size = cassette->image_size(); image_pos = 0; // read/check header if (image_size < 16) return cassette_image::error::INVALID_IMAGE; - cassette_image_read( cassette, &header, image_pos, 16); + cassette->image_read(&header, image_pos, 16); image_pos += 16; if (memcmp( header, SORDM5_CAS_HEADER, sizeof(SORDM5_CAS_HEADER)) != 0) return cassette_image::error::INVALID_IMAGE; // add silence (header) - err = cassette_put_sample( cassette, 0, time_index, SORDM5_WAVESAMPLES_HEADER, 0); + err = cassette->put_sample(0, time_index, SORDM5_WAVESAMPLES_HEADER, 0); if (err != cassette_image::error::SUCCESS) return err; time_index += SORDM5_WAVESAMPLES_HEADER; // process blocks while (image_pos < image_size) { // read block type - block_type = cassette_image_read_uint8( cassette, image_pos + 0); + block_type = cassette_image_read_uint8(cassette, image_pos + 0); if ((block_type != 'H') && (block_type != 'D')) return cassette_image::error::INVALID_IMAGE; // read block size - block_size = cassette_image_read_uint8( cassette, image_pos + 1); + block_size = cassette_image_read_uint8(cassette, image_pos + 1); if (block_size == 0) block_size = 0x100; block_size += 3; // add silence (header block) if (block_type == 'H') { - err = cassette_put_sample( cassette, 0, time_index, SORDM5_WAVESAMPLES_BLOCK, 0); + err = cassette->put_sample(0, time_index, SORDM5_WAVESAMPLES_BLOCK, 0); if (err != cassette_image::error::SUCCESS) return err; time_index += SORDM5_WAVESAMPLES_BLOCK; } // add sync if (block_type == 'H') filler_length = 2.4 * (3150 / 8); else filler_length = 0.15 * (3150 / 8); - err = cassette_put_modulated_filler(cassette, 0, time_index, 0xFF, filler_length, &sordm5_cas_modulation, &time_displacement); + err = cassette->put_modulated_filler(0, time_index, 0xFF, filler_length, sordm5_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; // process block for (i=0;i<block_size;i++) { // read byte - byte = cassette_image_read_uint8( cassette, image_pos + i); + byte = cassette_image_read_uint8(cassette, image_pos + i); // calc/check checksum #if 0 if (i == block_size) @@ -108,27 +108,27 @@ static cassette_image::error sordm5_tap_load( cassette_image *cassette) bit = (byte >> (j-2)) & 1; } // add bit - err = cassette_put_modulated_data_bit( cassette, 0, time_index, bit, &sordm5_cas_modulation, &time_displacement); + err = cassette->put_modulated_data_bit(0, time_index, bit, sordm5_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; } } // mark end of block - err = cassette_put_modulated_data_bit( cassette, 0, time_index, 1, &sordm5_cas_modulation, &time_displacement); + err = cassette->put_modulated_data_bit(0, time_index, 1, sordm5_cas_modulation, &time_displacement); if (err != cassette_image::error::SUCCESS) return err; time_index += time_displacement; // next block image_pos += block_size; } // add silence (trailer) - err = cassette_put_sample( cassette, 0, time_index, SORDM5_WAVESAMPLES_TRAILER, 0); + err = cassette->put_sample(0, time_index, SORDM5_WAVESAMPLES_TRAILER, 0); if (err != cassette_image::error::SUCCESS) return err; time_index += SORDM5_WAVESAMPLES_TRAILER; // return cassette_image::error::SUCCESS; } -static const struct CassetteFormat sordm5_cas_format = +static const cassette_image::Format sordm5_cas_format = { "cas", sordm5_tap_identify, diff --git a/src/lib/formats/spc1000_cas.cpp b/src/lib/formats/spc1000_cas.cpp index 2e48980da3d..e5d4bc1d0c3 100644 --- a/src/lib/formats/spc1000_cas.cpp +++ b/src/lib/formats/spc1000_cas.cpp @@ -20,10 +20,10 @@ STA: This format has not been investigated yet, but is assumed to IPL: This seems a quickload format containing RAM dump, not a real tape ********************************************************************/ +#include "spc1000_cas.h" #include <cassert> -#include "spc1000_cas.h" #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -31,7 +31,7 @@ IPL: This seems a quickload format containing RAM dump, not a real tape #define SPC1000_WAV_FREQUENCY 17000 // image size -static int spc1000_image_size; +static int spc1000_image_size; // FIXME: global variable prevents multiple instances static int spc1000_put_samples(int16_t *buffer, int sample_pos, int count, int level) { @@ -125,7 +125,7 @@ static int spc1000_cas_calculate_size_in_samples(const uint8_t *bytes, int lengt // TAP -static const struct CassetteLegacyWaveFiller spc1000_tap_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller spc1000_tap_legacy_fill_wave = { spc1000_tap_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -136,17 +136,17 @@ static const struct CassetteLegacyWaveFiller spc1000_tap_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error spc1000_tap_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error spc1000_tap_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &spc1000_tap_legacy_fill_wave); + return cassette->legacy_identify(opts, &spc1000_tap_legacy_fill_wave); } static cassette_image::error spc1000_tap_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &spc1000_tap_legacy_fill_wave); + return cassette->legacy_construct(&spc1000_tap_legacy_fill_wave); } -static const struct CassetteFormat spc1000_tap_cassette_image_format = +static const cassette_image::Format spc1000_tap_cassette_image_format = { "tap", spc1000_tap_cassette_identify, @@ -156,7 +156,7 @@ static const struct CassetteFormat spc1000_tap_cassette_image_format = // CAS -static const struct CassetteLegacyWaveFiller spc1000_cas_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller spc1000_cas_legacy_fill_wave = { spc1000_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -167,17 +167,17 @@ static const struct CassetteLegacyWaveFiller spc1000_cas_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error spc1000_cas_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error spc1000_cas_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &spc1000_cas_legacy_fill_wave); + return cassette->legacy_identify(opts, &spc1000_cas_legacy_fill_wave); } static cassette_image::error spc1000_cas_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &spc1000_cas_legacy_fill_wave); + return cassette->legacy_construct(&spc1000_cas_legacy_fill_wave); } -static const struct CassetteFormat spc1000_cas_cassette_image_format = +static const cassette_image::Format spc1000_cas_cassette_image_format = { "cas", spc1000_cas_cassette_identify, diff --git a/src/lib/formats/svi_cas.cpp b/src/lib/formats/svi_cas.cpp index fcb2142c4e3..dfd695dd5ec 100644 --- a/src/lib/formats/svi_cas.cpp +++ b/src/lib/formats/svi_cas.cpp @@ -1,9 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Sean Young -#include <cassert> - #include "svi_cas.h" +#include <cassert> + #define CAS_PERIOD_0 (37) #define CAS_PERIOD_1 (18) #define CAS_HEADER_PERIODS (1600) @@ -19,7 +19,7 @@ static const uint8_t CasHeader[17] = #define SMPLO -32768 #define SMPHI 32767 -static int cas_size; +static int cas_size; // FIXME: global variable prevents multiple instances /******************************************************************* Generate samples for the tape image @@ -171,7 +171,7 @@ static int svi_cas_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller svi_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller svi_legacy_fill_wave = { svi_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -184,21 +184,21 @@ static const struct CassetteLegacyWaveFiller svi_legacy_fill_wave = -static cassette_image::error svi_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error svi_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &svi_legacy_fill_wave); + return cassette->legacy_identify(opts, &svi_legacy_fill_wave); } static cassette_image::error svi_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &svi_legacy_fill_wave); + return cassette->legacy_construct(&svi_legacy_fill_wave); } -static const struct CassetteFormat svi_cas_format = +static const cassette_image::Format svi_cas_format = { "cas", svi_cas_identify, diff --git a/src/lib/formats/thom_cas.cpp b/src/lib/formats/thom_cas.cpp index a00c2c3234b..0d0cc4fc4eb 100644 --- a/src/lib/formats/thom_cas.cpp +++ b/src/lib/formats/thom_cas.cpp @@ -8,12 +8,11 @@ **********************************************************************/ -#include <cmath> -#include <cassert> - -#include "pool.h" -#include "cassimg.h" #include "thom_cas.h" +#include "pool.h" + +#include <cassert> +#include <cmath> /***************************** configuration **************************/ @@ -86,18 +85,18 @@ static uint8_t* to7_k7_bits; -static const struct CassetteModulation to7_k7_modulation = +static const cassette_image::Modulation to7_k7_modulation = { - CASSETTE_MODULATION_SQUAREWAVE, + cassette_image::MODULATION_SQUAREWAVE, 4000.0, 4500.0, 5000.0, 5500.0, 6300.0, 7500.0 }; -static cassette_image::error to7_k7_identify ( cassette_image *cass, struct CassetteOptions *opts ) +static cassette_image::error to7_k7_identify ( cassette_image *cass, cassette_image::Options *opts ) { - cassette_image::error e = cassette_modulation_identify( cass, &to7_k7_modulation, opts ); + cassette_image::error e = cass->modulation_identify( to7_k7_modulation, opts ); return e; } @@ -109,7 +108,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) static const int8_t square_wave[] = { -128, 127 }; double time = 0.; #endif - size_t size = cassette_image_size( cass ), pos = 0; + size_t size = cass->image_size( ), pos = 0; int i, sz, sz2, bitmax = 1024, invalid = 0; uint8_t in, typ, block[264]; @@ -133,8 +132,8 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) do \ { \ cassette_image::error err; \ - err = cassette_put_samples( cass, 0, time, (PERIOD), 2, 1, \ - square_wave, CASSETTE_WAVEFORM_8BIT ); \ + err = cass->put_samples( 0, time, (PERIOD), 2, 1, \ + square_wave, cassette_image::WAVEFORM_8BIT ); \ if ( err != cassette_image::error::SUCCESS ) \ return err; \ time += (PERIOD); \ @@ -202,7 +201,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) } while (0) /* check format */ - cassette_image_read( cass, block, 0, 64 ); + cass->image_read( block, 0, 64 ); for ( i = 3; ; i++ ) { if ( ( i >= size ) || ( i >= 64 ) ) @@ -227,7 +226,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) /* skip to first 0xff filler */ for ( sz = 0; pos < size; pos++, sz++ ) { - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); if ( in == 0xff ) break; } @@ -241,7 +240,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) /* skip 0xff filler */ for ( sz = 0; pos < size; pos++, sz++ ) { - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); /* actually, we are bit laxist and treat as 0xff bytes with at least 5 bits out of 8 set to 1 */ @@ -257,7 +256,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) pos -= sz; break; } - cassette_image_read( cass, block, pos, 4 ); + cass->image_read( block, pos, 4 ); typ = block[2]; sz2 = block[3]+1; if ( block[0] != 0x01 || block[1] != 0x3c || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) ) @@ -268,7 +267,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) pos += 4; /* get block */ - cassette_image_read( cass, block+4, pos, sz2 ); + cass->image_read( block+4, pos, sz2 ); pos += sz2; /* 1-filler and 0xff-filler */ @@ -323,17 +322,17 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) /* put block */ for (; pos < size; pos++ ) { - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); for ( sz = 0; pos < size && in == 0xff; sz++ ) { pos++; - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); } if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size ) { uint8_t in1,in2; - cassette_image_read( cass, &in1, pos+1, 1 ); - cassette_image_read( cass, &in2, pos+2, 1 ); + cass->image_read( &in1, pos+1, 1 ); + cass->image_read( &in2, pos+2, 1 ); if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) ) { /* seems we have a regular block hidden in raw data => rebounce */ @@ -365,7 +364,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass ) -static const struct CassetteFormat to7_k7 = +static const cassette_image::Format to7_k7 = { "k7", to7_k7_identify, to7_k7_load, nullptr /* no save */ }; @@ -375,9 +374,9 @@ static const struct CassetteFormat to7_k7 = static cassette_image::error to7_wav_identify ( cassette_image *cass, - struct CassetteOptions *opts ) + cassette_image::Options *opts ) { - cassette_image::error e = wavfile_format.identify( cass, opts ); + cassette_image::error e = cassette_image::wavfile_format.identify( cass, opts ); return e; } @@ -385,9 +384,7 @@ static cassette_image::error to7_wav_identify ( cassette_image *cass, static cassette_image::error to7_wav_load ( cassette_image *cass ) { - cassette_image::error e = wavfile_format.load( cass ); - struct CassetteInfo info; - double len; + cassette_image::error e = cassette_image::wavfile_format.load( cass ); if ( to7_k7_bits ) { @@ -398,9 +395,9 @@ static cassette_image::error to7_wav_load ( cassette_image *cass ) if ( e != cassette_image::error::SUCCESS ) return e; - cassette_get_info( cass, &info ); + cassette_image::Info info = cass->get_info( ); - len = (double) info.sample_count / info.sample_frequency; + double len = (double) info.sample_count / info.sample_frequency; PRINT (( "to7_wav_load: loading cassette, length %imn %is, %i Hz, %i bps, %i bits\n", (int) len / 60, (int) len % 60, @@ -412,17 +409,17 @@ static cassette_image::error to7_wav_load ( cassette_image *cass ) -static cassette_image::error to7_wav_save ( cassette_image *cass, const struct CassetteInfo *info ) +static cassette_image::error to7_wav_save ( cassette_image *cass, const cassette_image::Info *info ) { int len = info->sample_count / info->sample_frequency; PRINT (( "to7_wav_save: saving cassette, length %imn %is, %i Hz, %i bps\n", len / 60, len % 60, info->sample_frequency, info->bits_per_sample )); - return wavfile_format.save( cass, info ); + return cassette_image::wavfile_format.save( cass, info ); } /* overloaded wav: dump info */ -static const struct CassetteFormat to7_wav = +static const cassette_image::Format to7_wav = { "wav", to7_wav_identify, to7_wav_load, to7_wav_save }; @@ -432,7 +429,7 @@ static const struct CassetteFormat to7_wav = static cassette_image::error mo5_k5_identify ( cassette_image *cass, - struct CassetteOptions *opts ) + cassette_image::Options *opts ) { opts -> bits_per_sample = 8; opts -> channels = 1; @@ -464,7 +461,7 @@ static cassette_image::error mo5_k5_identify ( cassette_image *cass, static cassette_image::error mo5_k5_load( cassette_image *cass ) { - size_t size = cassette_image_size( cass ), pos = 0; + size_t size = cass->image_size( ), pos = 0; int i, sz, sz2, hbit = 0; uint8_t in, in2, in3, typ, block[264], sum; int invalid = 0, hbitsize = 0, dcmoto = 0; @@ -476,7 +473,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) #define K5_PUT_HBIT \ do \ { \ - cassette_put_sample ( cass, 0, hbitsize * MO5_HBIT_LENGTH, MO5_HBIT_LENGTH, (hbit ? 1 : -1) << 30 ); \ + cass->put_sample ( 0, hbitsize * MO5_HBIT_LENGTH, MO5_HBIT_LENGTH, (hbit ? 1 : -1) << 30 ); \ hbitsize++; \ } while ( 0 ) @@ -534,7 +531,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) } while (0) /* check format */ - cassette_image_read( cass, block, 0, 64 ); + cass->image_read( block, 0, 64 ); for ( i = 3; ; i++ ) { if ( ( i >= size ) || ( i >= 64 ) ) @@ -556,7 +553,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) } } - cassette_image_read( cass, block, pos, 6 ); + cass->image_read( block, pos, 6 ); if ( ! memcmp( block, "DCMOTO", 6 ) || ! memcmp( block, "DCMO5", 5 ) || ! memcmp( block, "DCMO6", 5 ) ) dcmoto = 1; @@ -567,7 +564,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) /* skip DCMOTO header*/ if ( dcmoto ) { - cassette_image_read( cass, block, pos, 6 ); + cass->image_read( block, pos, 6 ); if ( ! memcmp( block, "DCMOTO", 6 ) ) { LOG (( "mo5_k5_load: DCMOTO signature found at off=$%x\n", (int)pos )); @@ -583,7 +580,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) /* skip 0x01 filler */ for ( sz = 0; pos < size; pos++, sz++ ) { - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); if ( in != 0x01 ) break; } @@ -594,7 +591,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) pos -= sz; break; } - cassette_image_read( cass, block, pos, 4 ); + cass->image_read( block, pos, 4 ); typ = block[2]; sz2 = (uint8_t) (block[3]-1); if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) || pos+sz2 > size ) @@ -605,7 +602,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) pos += 4; /* get block */ - cassette_image_read( cass, block+4, pos, sz2 ); + cass->image_read( block+4, pos, sz2 ); pos += sz2; /* 0-fillers and 0x01-fillers */ @@ -665,33 +662,33 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) LOG (( "mo5_k5_load: trailing trash off=$%x size=%i hbitstart=%i\n", (int) pos, (int) (size-pos), hbitsize )); for ( ; pos < size; pos++ ) { - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); if ( dcmoto && in=='D' ) { /* skip DCMOTO header*/ - cassette_image_read( cass, block, pos, 6 ); + cass->image_read( block, pos, 6 ); if ( ! memcmp( block, "DCMOTO", 6 ) ) { LOG (( "mo5_k5_load: DCMOTO signature found at off=$%x\n", (int)pos )); pos += 6; - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); } else if ( ! memcmp( block, "DCMO", 4 ) ) { LOG (( "mo5_k5_load: DCMO* signature found at off=$%x\n", (int)pos )); pos += 5; - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); } } for ( sz = 0; pos < size && in == 0x01; sz++ ) { pos++; - cassette_image_read( cass, &in, pos, 1 ); + cass->image_read( &in, pos, 1 ); } if ( sz > 6 ) { - cassette_image_read( cass, &in2, pos+1, 1 ); - cassette_image_read( cass, &in3, pos+2, 1 ); + cass->image_read( &in2, pos+1, 1 ); + cass->image_read( &in3, pos+2, 1 ); if ( invalid < 10 && in == 0x3c && in2 == 0x5a && (in3 == 0x00 || in3 == 0x01 || in3 == 0xff ) ) { /* regular block found */ @@ -729,7 +726,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass ) -static const struct CassetteFormat mo5_k5 = +static const cassette_image::Format mo5_k5 = { "k5,k7", mo5_k5_identify, mo5_k5_load, nullptr /* no save */ }; @@ -738,9 +735,9 @@ static const struct CassetteFormat mo5_k5 = static cassette_image::error mo5_wav_identify ( cassette_image *cass, - struct CassetteOptions *opts ) + cassette_image::Options *opts ) { - cassette_image::error e = wavfile_format.identify( cass, opts ); + cassette_image::error e = cassette_image::wavfile_format.identify( cass, opts ); return e; } @@ -748,13 +745,11 @@ static cassette_image::error mo5_wav_identify ( cassette_image *cass, static cassette_image::error mo5_wav_load ( cassette_image *cass ) { - cassette_image::error e = wavfile_format.load( cass ); - struct CassetteInfo info; - int len; + cassette_image::error e = cassette_image::wavfile_format.load( cass ); if ( e == cassette_image::error::SUCCESS ) { - cassette_get_info( cass, &info ); - len = info.sample_count / info.sample_frequency; + cassette_image::Info info = cass->get_info( ); + int len = info.sample_count / info.sample_frequency; PRINT (( "mo5_wav_load: loading cassette, length %imn %is, %i Hz, %i bps\n", len / 60, len % 60, info.sample_frequency, info.bits_per_sample )); } return e; @@ -762,17 +757,17 @@ static cassette_image::error mo5_wav_load ( cassette_image *cass ) -static cassette_image::error mo5_wav_save ( cassette_image *cass, const struct CassetteInfo *info ) +static cassette_image::error mo5_wav_save ( cassette_image *cass, const cassette_image::Info *info ) { int len = info->sample_count / info->sample_frequency; PRINT (( "mo5_wav_save: saving cassette, length %imn %is, %i Hz, %i bps\n", len / 60, len % 60, info->sample_frequency, info->bits_per_sample )); - return wavfile_format.save( cass, info ); + return cassette_image::wavfile_format.save( cass, info ); } /* overloaded wav: dump info */ -static const struct CassetteFormat mo5_wav = +static const cassette_image::Format mo5_wav = { "wav", mo5_wav_identify, mo5_wav_load, mo5_wav_save }; @@ -780,9 +775,9 @@ static const struct CassetteFormat mo5_wav = /********************* formats ************************/ -const struct CassetteFormat *const to7_cassette_formats[] = +const cassette_image::Format *const to7_cassette_formats[] = { &to7_wav, &to7_k7, nullptr }; -const struct CassetteFormat *const mo5_cassette_formats[] = +const cassette_image::Format *const mo5_cassette_formats[] = { &mo5_wav, &mo5_k5, nullptr }; diff --git a/src/lib/formats/trs_cas.cpp b/src/lib/formats/trs_cas.cpp index 582abf8869c..7556c392427 100644 --- a/src/lib/formats/trs_cas.cpp +++ b/src/lib/formats/trs_cas.cpp @@ -5,17 +5,17 @@ Support for TRS80 .cas cassette images ********************************************************************/ +#include "formats/trs_cas.h" #include <cassert> -#include "formats/trs_cas.h" #define SILENCE 0 #define SMPLO -32768 #define SMPHI 32767 -static int cas_size; +static int cas_size; // FIXME: global variable prevents mutliple instances /******************************************************************* @@ -99,7 +99,7 @@ static int trs80l2_cas_to_wav_size(const uint8_t *casdata, int caslen) return trs80l2_handle_cas( nullptr, casdata ); } -static const struct CassetteLegacyWaveFiller trs80l2_cas_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller trs80l2_cas_legacy_fill_wave = { trs80l2_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -111,19 +111,19 @@ static const struct CassetteLegacyWaveFiller trs80l2_cas_legacy_fill_wave = }; -static cassette_image::error trs80l2_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error trs80l2_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &trs80l2_cas_legacy_fill_wave); + return cassette->legacy_identify(opts, &trs80l2_cas_legacy_fill_wave); } static cassette_image::error trs80l2_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &trs80l2_cas_legacy_fill_wave); + return cassette->legacy_construct(&trs80l2_cas_legacy_fill_wave); } -static const struct CassetteFormat trs80l2_cas_format = +static const cassette_image::Format trs80l2_cas_format = { "cas", trs80l2_cas_identify, diff --git a/src/lib/formats/tvc_cas.cpp b/src/lib/formats/tvc_cas.cpp index 3cea37cc1bf..e6d05451d9d 100644 --- a/src/lib/formats/tvc_cas.cpp +++ b/src/lib/formats/tvc_cas.cpp @@ -7,10 +7,10 @@ http://tvc.homeserver.hu/html/konvertformatum.html ********************************************************************/ +#include "tvc_cas.h" #include <cassert> -#include "tvc_cas.h" #define TVC64_BIT0_FREQ 1812 #define TVC64_BIT1_FREQ 2577 @@ -24,7 +24,7 @@ static void tvc64_emit_level(cassette_image *cass, double &time, int freq, int level) { double period = 1.0 / freq; - cassette_put_sample(cass, 0, time, period, level * WAVE_AMPLITUDE); + cass->put_sample(0, time, period, level * WAVE_AMPLITUDE); time += period; } @@ -89,7 +89,7 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette) double time = 0.0; uint8_t header[TVC64_HEADER_BYTES]; - cassette_image_read(cassette, header, 0, TVC64_HEADER_BYTES); + cassette->image_read(header, 0, TVC64_HEADER_BYTES); uint16_t cas_size = (header[0x83]<<8) | header[0x82]; // tape header @@ -172,7 +172,7 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette) // sector data int sector_size = (i == sector_num) ? (cas_size % 256) : 256; for (int z=0; z < sector_size; z++) - cassette_image_read(cassette, &tmp_buff[buff_idx++], TVC64_HEADER_BYTES + i*256 + z, 1); + cassette->image_read(&tmp_buff[buff_idx++], TVC64_HEADER_BYTES + i*256 + z, 1); if (i == sector_num || ((i+1) == sector_num && (cas_size % 256 ) == 0)) tmp_buff[buff_idx++] = 0xff; // last sector @@ -200,10 +200,10 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette) return cassette_image::error::SUCCESS; } -static cassette_image::error tvc64_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error tvc64_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { uint8_t byte; - cassette_image_read(cassette, &byte, 0, 1); + cassette->image_read(&byte, 0, 1); if (byte == 0x11) { @@ -216,7 +216,7 @@ static cassette_image::error tvc64_cassette_identify(cassette_image *cassette, s return cassette_image::error::INVALID_IMAGE; } -static const struct CassetteFormat tvc64_cassette_image_format = +static const cassette_image::Format tvc64_cassette_image_format = { "cas", tvc64_cassette_identify, diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp index e1ced8175f0..1804e89b1b6 100644 --- a/src/lib/formats/tzx_cas.cpp +++ b/src/lib/formats/tzx_cas.cpp @@ -52,7 +52,7 @@ static const uint8_t TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a }; Initialized by tzx_cas_get_wave_size, used (and cleaned up) by tzx_cas_fill_wave */ -static int16_t wave_data = 0; +static int16_t wave_data = 0; // FIXME: global variables prevent multiple instances static int block_count = 0; static uint8_t** blocks = nullptr; static float t_scale = 1; /* for scaling T-states to the 4MHz CPC */ @@ -831,7 +831,7 @@ static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) return size; } -static const struct CassetteLegacyWaveFiller tzx_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller tzx_legacy_fill_wave = { tzx_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -842,7 +842,7 @@ static const struct CassetteLegacyWaveFiller tzx_legacy_fill_wave = 0 /* trailer_samples */ }; -static const struct CassetteLegacyWaveFiller tap_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller tap_legacy_fill_wave = { tap_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -853,7 +853,7 @@ static const struct CassetteLegacyWaveFiller tap_legacy_fill_wave = 0 /* trailer_samples */ }; -static const struct CassetteLegacyWaveFiller cdt_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller cdt_legacy_fill_wave = { cdt_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -864,24 +864,24 @@ static const struct CassetteLegacyWaveFiller cdt_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error tzx_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) +static cassette_image::error tzx_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { - return cassette_legacy_identify(cassette, opts, &tzx_legacy_fill_wave); + return cassette->legacy_identify(opts, &tzx_legacy_fill_wave); } -static cassette_image::error tap_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) +static cassette_image::error tap_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { - return cassette_legacy_identify(cassette, opts, &tap_legacy_fill_wave); + return cassette->legacy_identify(opts, &tap_legacy_fill_wave); } -static cassette_image::error cdt_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) +static cassette_image::error cdt_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { - return cassette_legacy_identify(cassette, opts, &cdt_legacy_fill_wave); + return cassette->legacy_identify(opts, &cdt_legacy_fill_wave); } static cassette_image::error tzx_cassette_load( cassette_image *cassette ) { - cassette_image::error err = cassette_legacy_construct(cassette, &tzx_legacy_fill_wave); + cassette_image::error err = cassette->legacy_construct(&tzx_legacy_fill_wave); free(blocks); blocks = nullptr; return err; @@ -889,18 +889,18 @@ static cassette_image::error tzx_cassette_load( cassette_image *cassette ) static cassette_image::error tap_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct(cassette, &tap_legacy_fill_wave); + return cassette->legacy_construct(&tap_legacy_fill_wave); } static cassette_image::error cdt_cassette_load( cassette_image *cassette ) { - cassette_image::error err = cassette_legacy_construct(cassette, &cdt_legacy_fill_wave); + cassette_image::error err = cassette->legacy_construct(&cdt_legacy_fill_wave); free(blocks); blocks = nullptr; return err; } -const struct CassetteFormat tzx_cassette_format = +const cassette_image::Format tzx_cassette_format = { "tzx", tzx_cassette_identify, @@ -908,7 +908,7 @@ const struct CassetteFormat tzx_cassette_format = nullptr }; -static const struct CassetteFormat tap_cassette_format = +static const cassette_image::Format tap_cassette_format = { "tap,blk", tap_cassette_identify, @@ -916,7 +916,7 @@ static const struct CassetteFormat tap_cassette_format = nullptr }; -static const struct CassetteFormat cdt_cassette_format = +static const cassette_image::Format cdt_cassette_format = { "cdt", cdt_cassette_identify, diff --git a/src/lib/formats/tzx_cas.h b/src/lib/formats/tzx_cas.h index 2410ea57523..b7e620b1683 100644 --- a/src/lib/formats/tzx_cas.h +++ b/src/lib/formats/tzx_cas.h @@ -13,7 +13,7 @@ #include "cassimg.h" -extern const struct CassetteFormat tzx_cassette_format; +extern const cassette_image::Format tzx_cassette_format; CASSETTE_FORMATLIST_EXTERN(tzx_cassette_formats); CASSETTE_FORMATLIST_EXTERN(cdt_cassette_formats); diff --git a/src/lib/formats/uef_cas.cpp b/src/lib/formats/uef_cas.cpp index d19eb9b2e47..1b4fb1bc271 100644 --- a/src/lib/formats/uef_cas.cpp +++ b/src/lib/formats/uef_cas.cpp @@ -17,13 +17,13 @@ the size of memory to alloc for the decoding. Not nice, but it works... */ - -#include <cstring> -#include <cmath> -#include <cassert> +#include "uef_cas.h" #include <zlib.h> -#include "uef_cas.h" + +#include <cassert> +#include <cmath> +#include <cstring> #define UEF_WAV_FREQUENCY 4800 @@ -334,7 +334,7 @@ static int uef_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) return p - buffer; } -static const struct CassetteLegacyWaveFiller uef_legacy_fill_wave = { +static const cassette_image::LegacyWaveFiller uef_legacy_fill_wave = { uef_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ 0, /* chunk_samples */ @@ -344,21 +344,21 @@ static const struct CassetteLegacyWaveFiller uef_legacy_fill_wave = { 0 /* trailer_samples */ }; -static cassette_image::error uef_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) { +static cassette_image::error uef_cassette_identify( cassette_image *cassette, cassette_image::Options *opts ) { uint8_t header[10]; - cassette_image_read(cassette, header, 0, sizeof(header)); + cassette->image_read(header, 0, sizeof(header)); if (memcmp(&header[0], GZ_HEADER, sizeof(GZ_HEADER)) && memcmp(&header[0], UEF_HEADER, sizeof(UEF_HEADER))) { return cassette_image::error::INVALID_IMAGE; } - return cassette_legacy_identify( cassette, opts, &uef_legacy_fill_wave ); + return cassette->legacy_identify( opts, &uef_legacy_fill_wave ); } static cassette_image::error uef_cassette_load( cassette_image *cassette ) { - return cassette_legacy_construct( cassette, &uef_legacy_fill_wave ); + return cassette->legacy_construct( &uef_legacy_fill_wave ); } -const struct CassetteFormat uef_cassette_format = { +const cassette_image::Format uef_cassette_format = { "uef", uef_cassette_identify, uef_cassette_load, diff --git a/src/lib/formats/uef_cas.h b/src/lib/formats/uef_cas.h index 73aa2fe8ae2..f6bcff94ca1 100644 --- a/src/lib/formats/uef_cas.h +++ b/src/lib/formats/uef_cas.h @@ -12,7 +12,7 @@ #include "cassimg.h" -extern const struct CassetteFormat uef_cassette_format; +extern const cassette_image::Format uef_cassette_format; CASSETTE_FORMATLIST_EXTERN(uef_cassette_formats); diff --git a/src/lib/formats/vg5k_cas.cpp b/src/lib/formats/vg5k_cas.cpp index 97d7421f622..f73049299b1 100644 --- a/src/lib/formats/vg5k_cas.cpp +++ b/src/lib/formats/vg5k_cas.cpp @@ -5,17 +5,17 @@ Support for VG-5000 .k7 cassette images ********************************************************************/ -#include <cassert> - #include "vg5k_cas.h" +#include <cassert> + #define SMPLO -32768 #define SILENCE 0 #define SMPHI 32767 -static int k7_size; +static int k7_size; // FIXME: global variable prevents multiple instances /******************************************************************* Generate one high-low cycle of sample data @@ -200,7 +200,7 @@ static int vg5k_k7_to_wav_size(const uint8_t *casdata, int caslen) } -static const struct CassetteLegacyWaveFiller vg5k_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller vg5k_legacy_fill_wave = { vg5k_k7_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -211,19 +211,19 @@ static const struct CassetteLegacyWaveFiller vg5k_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error vg5k_k7_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error vg5k_k7_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &vg5k_legacy_fill_wave); + return cassette->legacy_identify(opts, &vg5k_legacy_fill_wave); } static cassette_image::error vg5k_k7_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &vg5k_legacy_fill_wave); + return cassette->legacy_construct(&vg5k_legacy_fill_wave); } -static const struct CassetteFormat vg5k_k7_format = +static const cassette_image::Format vg5k_k7_format = { "k7", vg5k_k7_identify, @@ -234,5 +234,5 @@ static const struct CassetteFormat vg5k_k7_format = CASSETTE_FORMATLIST_START(vg5k_cassette_formats) CASSETTE_FORMAT(vg5k_k7_format) - CASSETTE_FORMAT(wavfile_format) + CASSETTE_FORMAT(cassette_image::wavfile_format) CASSETTE_FORMATLIST_END diff --git a/src/lib/formats/vt_cas.cpp b/src/lib/formats/vt_cas.cpp index a8c30f8d25f..735ec067d7b 100644 --- a/src/lib/formats/vt_cas.cpp +++ b/src/lib/formats/vt_cas.cpp @@ -1,9 +1,9 @@ // license:GPL-2.0+ // copyright-holders:Juergen Buchmueller -#include <cassert> - #include "formats/vt_cas.h" +#include <cassert> + /********************************************************************* vtech 1/2 agnostic *********************************************************************/ @@ -97,28 +97,28 @@ static int vtech1_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code) return generic_fill_wave(buffer, length, code, V1_BITSAMPLES, V1_BYTESAMPLES, V1_LO, vtech1_fill_wave_byte); } -static const struct CassetteLegacyWaveFiller vtech1_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller vtech1_legacy_fill_wave = { - vtech1_cassette_fill_wave, /* fill_wave */ - 1, /* chunk_size */ - V1_BYTESAMPLES, /* chunk_samples */ - nullptr, /* chunk_sample_calc */ - 600*V1_BITSAMPLES, /* sample_frequency */ - 600*V1_BITSAMPLES, /* header_samples */ - 600*V1_BITSAMPLES /* trailer_samples */ + vtech1_cassette_fill_wave, // fill_wave + 1, // chunk_size + V1_BYTESAMPLES, // chunk_samples + nullptr, // chunk_sample_calc + 600*V1_BITSAMPLES, // sample_frequency + 600*V1_BITSAMPLES, // header_samples + 600*V1_BITSAMPLES // trailer_samples }; -static cassette_image::error vtech1_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error vtech1_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &vtech1_legacy_fill_wave); + return cassette->legacy_identify(opts, &vtech1_legacy_fill_wave); } static cassette_image::error vtech1_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &vtech1_legacy_fill_wave); + return cassette->legacy_construct(&vtech1_legacy_fill_wave); } -static const struct CassetteFormat vtech1_cas_format = +static const cassette_image::Format vtech1_cas_format = { "cas", vtech1_cas_identify, @@ -192,7 +192,7 @@ static int vtech2_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code) return generic_fill_wave(buffer, length, code, VT2_BITSAMPLES, VT2_BYTESAMPLES, VT2_LO, vtech2_fill_wave_byte); } -static const struct CassetteLegacyWaveFiller vtech2_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller vtech2_legacy_fill_wave = { vtech2_cassette_fill_wave, /* fill_wave */ 1, /* chunk_size */ @@ -203,17 +203,17 @@ static const struct CassetteLegacyWaveFiller vtech2_legacy_fill_wave = 600*VT2_BITSAMPLES /* trailer_samples */ }; -static cassette_image::error vtech2_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error vtech2_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &vtech2_legacy_fill_wave); + return cassette->legacy_identify(opts, &vtech2_legacy_fill_wave); } static cassette_image::error vtech2_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &vtech2_legacy_fill_wave); + return cassette->legacy_construct(&vtech2_legacy_fill_wave); } -static const struct CassetteFormat vtech2_cas_format = +static const cassette_image::Format vtech2_cas_format = { "cas", vtech2_cas_identify, diff --git a/src/lib/formats/wavfile.cpp b/src/lib/formats/wavfile.cpp index 1408984079c..74976ef997e 100644 --- a/src/lib/formats/wavfile.cpp +++ b/src/lib/formats/wavfile.cpp @@ -8,12 +8,11 @@ *********************************************************************/ +#include "wavfile.h" + #include <cstdio> #include <cassert> -#include "wavfile.h" -#include "cassimg.h" - static const char magic1[4] = { 'R', 'I', 'F', 'F' }; static const char magic2[4] = { 'W', 'A', 'V', 'E' }; static const char format_tag_id[4] = { 'f', 'm', 't', ' ' }; @@ -57,7 +56,7 @@ static void put_leuint16(void *ptr, uint16_t value) -static cassette_image::error wavfile_process(cassette_image *cassette, struct CassetteOptions *opts, +static cassette_image::error wavfile_process(cassette_image *cassette, cassette_image::Options *opts, bool read_waveform) { uint8_t file_header[12]; @@ -76,7 +75,7 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca int waveform_flags = 0; /* read header */ - cassette_image_read(cassette, file_header, 0, sizeof(file_header)); + cassette->image_read(file_header, 0, sizeof(file_header)); offset = sizeof(file_header); /* check magic numbers */ @@ -87,13 +86,13 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca /* read and sanity check size */ stated_size = get_leuint32(&file_header[4]) + 8; - file_size = cassette_image_size(cassette); + file_size = cassette->image_size(); if (stated_size > file_size) stated_size = (uint32_t) file_size; while(offset < stated_size) { - cassette_image_read(cassette, tag_header, offset, sizeof(tag_header)); + cassette->image_read(tag_header, offset, sizeof(tag_header)); tag_size = get_leuint32(&tag_header[4]); offset += sizeof(tag_header); @@ -104,7 +103,7 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca return cassette_image::error::INVALID_IMAGE; format_specified = true; - cassette_image_read(cassette, format_tag, offset, sizeof(format_tag)); + cassette->image_read(format_tag, offset, sizeof(format_tag)); format_type = get_leuint16(&format_tag[0]); opts->channels = get_leuint16(&format_tag[2]); @@ -121,13 +120,13 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca switch(opts->bits_per_sample) { case 8: - waveform_flags = CASSETTE_WAVEFORM_8BIT | CASSETTE_WAVEFORM_UNSIGNED; // 8-bits wav are stored unsigned + waveform_flags = cassette_image::WAVEFORM_8BIT | cassette_image::WAVEFORM_UNSIGNED; // 8-bits wav are stored unsigned break; case 16: - waveform_flags = CASSETTE_WAVEFORM_16BITLE; + waveform_flags = cassette_image::WAVEFORM_16BITLE; break; case 32: - waveform_flags = CASSETTE_WAVEFORM_32BITLE; + waveform_flags = cassette_image::WAVEFORM_32BITLE; break; default: return cassette_image::error::INVALID_IMAGE; @@ -142,7 +141,7 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca if (read_waveform) { tag_samples = tag_size / (opts->bits_per_sample / 8) / opts->channels; - cassette_read_samples(cassette, opts->channels, 0.0, tag_samples / ((double) opts->sample_frequency), + cassette->read_samples(opts->channels, 0.0, tag_samples / ((double) opts->sample_frequency), tag_samples, offset, waveform_flags); } } @@ -158,7 +157,7 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca -static cassette_image::error wavfile_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error wavfile_identify(cassette_image *cassette, cassette_image::Options *opts) { return wavfile_process(cassette, opts, false); } @@ -167,14 +166,14 @@ static cassette_image::error wavfile_identify(cassette_image *cassette, struct C static cassette_image::error wavfile_load(cassette_image *cassette) { - struct CassetteOptions opts; + cassette_image::Options opts; memset(&opts, 0, sizeof(opts)); return wavfile_process(cassette, &opts, true); } -static cassette_image::error wavfile_save(cassette_image *cassette, const struct CassetteInfo *info) +static cassette_image::error wavfile_save(cassette_image *cassette, const cassette_image::Info *info) { cassette_image::error err; uint8_t consolidated_header[12 + 8 + 16 + 8]; @@ -187,7 +186,7 @@ static cassette_image::error wavfile_save(cassette_image *cassette, const struct uint16_t bits_per_sample; uint32_t data_size; size_t bytes_per_sample = 2; - int waveform_flags = CASSETTE_WAVEFORM_16BITLE; + int waveform_flags = cassette_image::WAVEFORM_16BITLE; uint16_t block_align; bits_per_sample = (uint16_t) (bytes_per_sample * 8); @@ -216,10 +215,10 @@ static cassette_image::error wavfile_save(cassette_image *cassette, const struct put_leuint32(&data_tag_header[4], data_size); /* write consolidated header */ - cassette_image_write(cassette, consolidated_header, 0, sizeof(consolidated_header)); + cassette->image_write(consolidated_header, 0, sizeof(consolidated_header)); /* write out the actual data */ - err = cassette_write_samples(cassette, info->channels, 0.0, info->sample_count + err = cassette->write_samples(info->channels, 0.0, info->sample_count / (double) info->sample_frequency, info->sample_count, sizeof(consolidated_header), waveform_flags); if (err != cassette_image::error::SUCCESS) @@ -230,7 +229,7 @@ static cassette_image::error wavfile_save(cassette_image *cassette, const struct -const struct CassetteFormat wavfile_format = +const cassette_image::Format cassette_image::wavfile_format = { "wav", wavfile_identify, @@ -264,7 +263,7 @@ void wavfile_testload(const char *fname) if (!f) return; - if (cassette_open(f, &stdio_ioprocs, &wavfile_format, CASSETTE_FLAG_READONLY, &cassette)) + if (cassette_open(f, &stdio_ioprocs, &wavfile_format, cassette_image::FLAG_READONLY, &cassette)) { fclose(f); return; diff --git a/src/lib/formats/wavfile.h b/src/lib/formats/wavfile.h index 0f48b8378b0..397d502a0ec 100644 --- a/src/lib/formats/wavfile.h +++ b/src/lib/formats/wavfile.h @@ -14,6 +14,4 @@ #include "cassimg.h" -extern const struct CassetteFormat wavfile_format; - #endif // MAME_FORMATS_WAVFILE_H diff --git a/src/lib/formats/x07_cas.cpp b/src/lib/formats/x07_cas.cpp index 131693f2da1..182a1303cd8 100644 --- a/src/lib/formats/x07_cas.cpp +++ b/src/lib/formats/x07_cas.cpp @@ -6,10 +6,10 @@ ********************************************************************/ -#include <cassert> - #include "x07_cas.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -19,7 +19,7 @@ #define X07_HEADER_BYTES 16 // image size -static int x07_image_size; +static int x07_image_size; // FIXME: global variable prevents multiple instances static int x07_put_samples(int16_t *buffer, int sample_pos, int count, int level) { @@ -140,7 +140,7 @@ static int x07_cassette_calculate_size_in_samples(const uint8_t *bytes, int leng return x07_handle_cassette(nullptr, bytes); } -static const struct CassetteLegacyWaveFiller x07_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller x07_legacy_fill_wave = { x07_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -151,17 +151,17 @@ static const struct CassetteLegacyWaveFiller x07_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error x07_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error x07_cassette_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &x07_legacy_fill_wave); + return cassette->legacy_identify(opts, &x07_legacy_fill_wave); } static cassette_image::error x07_cassette_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &x07_legacy_fill_wave); + return cassette->legacy_construct(&x07_legacy_fill_wave); } -static const struct CassetteFormat x07_cassette_image_format = +static const cassette_image::Format x07_cassette_image_format = { "k7,lst,cas", x07_cassette_identify, diff --git a/src/lib/formats/x1_tap.cpp b/src/lib/formats/x1_tap.cpp index 88c962bf53b..cbd261f6610 100644 --- a/src/lib/formats/x1_tap.cpp +++ b/src/lib/formats/x1_tap.cpp @@ -20,15 +20,15 @@ * 0x00: Sampling rate (4 bytes) * */ +#include "x1_tap.h" #include <cassert> -#include "x1_tap.h" #define WAVE_HIGH 0x5a9e #define WAVE_LOW -0x5a9e -static int cas_size; +static int cas_size; // FIXME: global variables prevent multiple instances static int samplerate; static int new_format; @@ -103,7 +103,7 @@ static int x1_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes) return x1_handle_tap(buffer,bytes); } -static const struct CassetteLegacyWaveFiller x1_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller x1_legacy_fill_wave = { x1_cas_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -114,20 +114,20 @@ static const struct CassetteLegacyWaveFiller x1_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error x1_cas_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error x1_cas_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &x1_legacy_fill_wave); + return cassette->legacy_identify(opts, &x1_legacy_fill_wave); } static cassette_image::error x1_cas_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &x1_legacy_fill_wave); + return cassette->legacy_construct(&x1_legacy_fill_wave); } -static const struct CassetteFormat x1_cassette_format = { +static const cassette_image::Format x1_cassette_format = { "tap", x1_cas_identify, x1_cas_load, diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp index 709bdccfc4c..186815507fe 100644 --- a/src/lib/formats/zx81_p.cpp +++ b/src/lib/formats/zx81_p.cpp @@ -31,11 +31,11 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain *****************************************************************************/ -#include <cassert> - #include "zx81_p.h" #include "tzx_cas.h" +#include <cassert> + #define WAVEENTRY_LOW -32768 #define WAVEENTRY_HIGH 32767 @@ -56,7 +56,7 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain #define ZX81_DATA_LENGTH_OFFSET 0x0b #define ZX80_DATA_LENGTH_OFFSET 0x04 -static uint8_t zx_file_name[128]; +static uint8_t zx_file_name[128]; // FIXME: global variables prevent multiple instances static uint16_t real_data_length = 0; static uint8_t zx_file_name_length = 0; @@ -64,9 +64,7 @@ static uint8_t zx_file_name_length = 0; static int16_t *zx81_emit_level(int16_t *p, int count, int level) { - int i; - - for (i=0; i<count; i++) *(p++) = level; + for (int i=0; i<count; i++) *(p++) = level; return p; } @@ -196,7 +194,7 @@ static int zx81_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) return p - buffer; } -static const struct CassetteLegacyWaveFiller zx81_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller zx81_legacy_fill_wave = { zx81_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -207,9 +205,9 @@ static const struct CassetteLegacyWaveFiller zx81_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error zx81_p_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error zx81_p_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &zx81_legacy_fill_wave); + return cassette->legacy_identify(opts, &zx81_legacy_fill_wave); } static cassette_image::error zx81_p_load(cassette_image *cassette) @@ -219,10 +217,10 @@ static cassette_image::error zx81_p_load(cassette_image *cassette) Hardcoding this to "cassette". */ zx81_fill_file_name ("cassette" /*image_basename_noext(device_list_find_by_tag( Machine->config->m_devicelist, CASSETTE, "cassette" ))*/ ); - return cassette_legacy_construct(cassette, &zx81_legacy_fill_wave); + return cassette->legacy_construct(&zx81_legacy_fill_wave); } -static const struct CassetteFormat zx81_p_image_format = +static const cassette_image::Format zx81_p_image_format = { "p,81", zx81_p_identify, @@ -269,7 +267,7 @@ static int zx80_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes) return p - buffer; } -static const struct CassetteLegacyWaveFiller zx80_legacy_fill_wave = +static const cassette_image::LegacyWaveFiller zx80_legacy_fill_wave = { zx80_cassette_fill_wave, /* fill_wave */ -1, /* chunk_size */ @@ -280,17 +278,17 @@ static const struct CassetteLegacyWaveFiller zx80_legacy_fill_wave = 0 /* trailer_samples */ }; -static cassette_image::error zx80_o_identify(cassette_image *cassette, struct CassetteOptions *opts) +static cassette_image::error zx80_o_identify(cassette_image *cassette, cassette_image::Options *opts) { - return cassette_legacy_identify(cassette, opts, &zx80_legacy_fill_wave); + return cassette->legacy_identify(opts, &zx80_legacy_fill_wave); } static cassette_image::error zx80_o_load(cassette_image *cassette) { - return cassette_legacy_construct(cassette, &zx80_legacy_fill_wave); + return cassette->legacy_construct(&zx80_legacy_fill_wave); } -static const struct CassetteFormat zx80_o_image_format = +static const cassette_image::Format zx80_o_image_format = { "o,80", zx80_o_identify, diff --git a/src/lib/netlist/analog/nlid_fourterm.h b/src/lib/netlist/analog/nlid_fourterm.h index 02ca5a9563b..8656cf7e32f 100644 --- a/src/lib/netlist/analog/nlid_fourterm.h +++ b/src/lib/netlist/analog/nlid_fourterm.h @@ -39,16 +39,20 @@ namespace analog { NETLIB_CONSTRUCTOR_EX(VCCS, nl_fptype ri = nlconst::magic(1e9)) , m_G(*this, "G", nlconst::one()) , m_RI(*this, "RI", ri) - , m_OP(*this, "OP", &m_IP, NETLIB_DELEGATE(termhandler)) - , m_ON(*this, "ON", &m_IP, NETLIB_DELEGATE(termhandler)) - , m_IP(*this, "IP", &m_IN, NETLIB_DELEGATE(termhandler)) // <= this should be NULL and terminal be filtered out prior to solving... - , m_IN(*this, "IN", &m_IP, NETLIB_DELEGATE(termhandler)) // <= this should be NULL and terminal be filtered out prior to solving... + , m_OP(*this, "OP", &m_IP, {&m_ON, &m_IN}, NETLIB_DELEGATE(termhandler)) + , m_ON(*this, "ON", &m_IP, {&m_OP, &m_IN}, NETLIB_DELEGATE(termhandler)) + , m_IP(*this, "IP", &m_IN, {&m_OP, &m_ON}, NETLIB_DELEGATE(termhandler)) + , m_IN(*this, "IN", &m_IP, {&m_OP, &m_ON}, NETLIB_DELEGATE(termhandler)) , m_OP1(*this, "_OP1", &m_IN, NETLIB_DELEGATE(termhandler)) , m_ON1(*this, "_ON1", &m_IN, NETLIB_DELEGATE(termhandler)) + //, m_IPx(*this, "_IPx", &m_OP, NETLIB_DELEGATE(termhandler)) // <= this should be NULL and terminal be filtered out prior to solving... + //, m_INx(*this, "_INx", &m_ON, NETLIB_DELEGATE(termhandler)) // <= this should be NULL and terminal be filtered out prior to solving... , m_gfac(nlconst::one()) { connect(m_OP, m_OP1); connect(m_ON, m_ON1); + //connect(m_IP, m_IPx); + //connect(m_IN, m_INx); } NETLIB_RESETI(); @@ -82,6 +86,9 @@ namespace analog { terminal_t m_OP1; terminal_t m_ON1; + //terminal_t m_IPx; + //terminal_t m_INx; + private: nl_fptype m_gfac; }; diff --git a/src/lib/netlist/analog/nlid_twoterm.h b/src/lib/netlist/analog/nlid_twoterm.h index fbf7b24b502..615bb7e19b3 100644 --- a/src/lib/netlist/analog/nlid_twoterm.h +++ b/src/lib/netlist/analog/nlid_twoterm.h @@ -54,7 +54,7 @@ namespace analog // ----------------------------------------------------------------------------- template <class C> - inline core_device_t &bselect(bool b, C &d1, core_device_t &d2) + static inline core_device_t &bselect(bool b, C &d1, core_device_t &d2) { auto *h = dynamic_cast<core_device_t *>(&d1); return b ? *h : d2; diff --git a/src/lib/netlist/buildVS/netlistlib.vcxproj b/src/lib/netlist/buildVS/netlistlib.vcxproj index 543d7680f29..1344d71ba50 100755 --- a/src/lib/netlist/buildVS/netlistlib.vcxproj +++ b/src/lib/netlist/buildVS/netlistlib.vcxproj @@ -114,10 +114,13 @@ <ClCompile Include="..\analog\nlid_fourterm.cpp" /> <ClCompile Include="..\analog\nlid_twoterm.cpp" /> <ClCompile Include="..\devices\net_lib.cpp" /> - <ClCompile Include="..\devices\nld_2102A.cpp" /> + <ClCompile Include="..\devices\nld_2102a.cpp" /> <ClCompile Include="..\devices\nld_4006.cpp" /> <ClCompile Include="..\devices\nld_4017.cpp" /> + <ClCompile Include="..\devices\nld_4029.cpp" /> + <ClCompile Include="..\devices\nld_4042.cpp" /> <ClCompile Include="..\devices\nld_4053.cpp" /> + <ClCompile Include="..\devices\nld_4076.cpp" /> <ClCompile Include="..\devices\nld_74125.cpp" /> <ClCompile Include="..\devices\nld_74163.cpp" /> <ClCompile Include="..\devices\nld_74377.cpp" /> @@ -157,8 +160,8 @@ <ClCompile Include="..\devices\nld_7490.cpp" /> <ClCompile Include="..\devices\nld_7493.cpp" /> <ClCompile Include="..\devices\nld_74ls629.cpp" /> - <ClCompile Include="..\devices\nld_82S115.cpp" /> - <ClCompile Include="..\devices\nld_82S16.cpp" /> + <ClCompile Include="..\devices\nld_82s115.cpp" /> + <ClCompile Include="..\devices\nld_82s16.cpp" /> <ClCompile Include="..\devices\nld_9310.cpp" /> <ClCompile Include="..\devices\nld_9316.cpp" /> <ClCompile Include="..\devices\nld_9322.cpp" /> @@ -176,7 +179,9 @@ <ClCompile Include="..\devices\nlid_truthtable.cpp" /> <ClCompile Include="..\generated\nlm_modules_lib.cpp" /> <ClCompile Include="..\generated\static_solvers.cpp" /> - <ClCompile Include="..\macro\modules\nlmod_RTEST.cpp" /> + <ClCompile Include="..\macro\modules\nlmod_icl8038_dip.cpp" /> + <ClCompile Include="..\macro\modules\nlmod_ne556_dip.cpp" /> + <ClCompile Include="..\macro\modules\nlmod_rtest.cpp" /> <ClCompile Include="..\macro\nlm_base_lib.cpp" /> <ClCompile Include="..\macro\nlm_cd4xxx_lib.cpp" /> <ClCompile Include="..\macro\nlm_opamp_lib.cpp" /> diff --git a/src/lib/netlist/buildVS/netlistlib.vcxproj.filters b/src/lib/netlist/buildVS/netlistlib.vcxproj.filters index f858a2b9932..68df009f9ec 100755 --- a/src/lib/netlist/buildVS/netlistlib.vcxproj.filters +++ b/src/lib/netlist/buildVS/netlistlib.vcxproj.filters @@ -87,9 +87,6 @@ <ClCompile Include="..\devices\nld_7483.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\devices\nld_82S115.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\devices\nld_4013.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -129,9 +126,6 @@ <ClCompile Include="..\devices\nld_74153.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\devices\nld_82S16.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\devices\nld_74123.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -189,9 +183,6 @@ <ClCompile Include="..\devices\nld_74174.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\devices\nld_2102A.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\devices\nld_4316.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -291,7 +282,31 @@ <ClCompile Include="..\generated\nlm_modules_lib.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\macro\modules\nlmod_RTEST.cpp"> + <ClCompile Include="..\devices\nld_4042.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_4076.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_4029.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_2102a.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_82s16.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\devices\nld_82s115.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\macro\modules\nlmod_icl8038_dip.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\macro\modules\nlmod_ne556_dip.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\macro\modules\nlmod_rtest.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/src/lib/netlist/core/analog.h b/src/lib/netlist/core/analog.h index 4bc986f48fc..d6f217210c4 100644 --- a/src/lib/netlist/core/analog.h +++ b/src/lib/netlist/core/analog.h @@ -61,6 +61,9 @@ namespace netlist /// @param otherterm pointer to the sibling terminal terminal_t(core_device_t &dev, const pstring &aname, terminal_t *otherterm, nldelegate delegate); + terminal_t(core_device_t &dev, const pstring &aname, terminal_t *otherterm, + const std::array<terminal_t *, 2> &splitterterms, nldelegate delegate); + /// \brief Returns voltage of connected net /// /// @return voltage of net this terminal is connected to diff --git a/src/lib/netlist/core/base_objects.h b/src/lib/netlist/core/base_objects.h index 140fde1149e..edde9fa0f0f 100644 --- a/src/lib/netlist/core/base_objects.h +++ b/src/lib/netlist/core/base_objects.h @@ -239,7 +239,7 @@ namespace netlist void set_net(net_t *anet) noexcept { m_net = anet; } void clear_net() noexcept { m_net = nullptr; } - bool has_net() const noexcept { return (m_net != nullptr); } + constexpr bool has_net() const noexcept { return (m_net != nullptr); } net_t & net() const noexcept { return *m_net;} @@ -251,8 +251,8 @@ namespace netlist bool is_analog_input() const noexcept; bool is_analog_output() const noexcept; - bool is_state(state_e astate) const noexcept { return (m_state == astate); } - state_e terminal_state() const noexcept { return m_state; } + constexpr bool is_state(state_e astate) const noexcept { return (m_state == astate); } + constexpr const state_e &terminal_state() const noexcept { return m_state; } void set_state(state_e astate) noexcept { m_state = astate; } void reset() noexcept { set_state(is_type(terminal_type::OUTPUT) ? STATE_OUT : STATE_INP_ACTIVE); } @@ -265,12 +265,12 @@ namespace netlist state_var_sig m_Q; #else - void set_copied_input(netlist_sig_t val) const noexcept { plib::unused_var(val); } // NOLINT: static means more message elsewhere + void set_copied_input(const netlist_sig_t &val) const noexcept { plib::unused_var(val); } // NOLINT: static means more message elsewhere #endif void set_delegate(const nldelegate &delegate) noexcept { m_delegate = delegate; } const nldelegate &delegate() const noexcept { return m_delegate; } - inline void run_delegate() noexcept { return m_delegate(); } + void run_delegate() const noexcept { return m_delegate(); } private: nldelegate m_delegate; net_t * m_net; diff --git a/src/lib/netlist/core/core_device.h b/src/lib/netlist/core/core_device.h index 2e511ce6c9b..edfe25b6ec0 100644 --- a/src/lib/netlist/core/core_device.h +++ b/src/lib/netlist/core/core_device.h @@ -31,23 +31,27 @@ namespace netlist void do_inc_active() noexcept { - if (m_hint_deactivate) + gsl_Expects(m_active_outputs >= 0); + + if (m_activate && m_hint_deactivate) { if (++m_active_outputs == 1) { if (m_stats) m_stats->m_stat_inc_active.inc(); - inc_active(); + m_activate(true);//inc_active(); } } } void do_dec_active() noexcept { - if (m_hint_deactivate) + gsl_Expects(m_active_outputs >= 1); + + if (m_activate && m_hint_deactivate) if (--m_active_outputs == 0) { - dec_active(); + m_activate(false); //dec_active(); } } @@ -74,9 +78,9 @@ namespace netlist } protected: + using activate_delegate = plib::pmfp<void, bool>; - virtual void inc_active() noexcept { } - virtual void dec_active() noexcept { } + activate_delegate m_activate; log_type & log(); diff --git a/src/lib/netlist/core/exec.h b/src/lib/netlist/core/exec.h index 307baa6b0f2..50c718e3da6 100644 --- a/src/lib/netlist/core/exec.h +++ b/src/lib/netlist/core/exec.h @@ -33,15 +33,13 @@ namespace netlist // run functions - netlist_time_ext time() const noexcept { return m_time; } + const netlist_time_ext &time() const noexcept { return m_time; } void process_queue(netlist_time_ext delta) noexcept; void abort_current_queue_slice() noexcept { - if (!NL_USE_QUEUE_STATS || !m_use_stats) - m_queue.retime<false>(detail::queue_t::entry_t(m_time, nullptr)); - else - m_queue.retime<true>(detail::queue_t::entry_t(m_time, nullptr)); + qremove(nullptr); + qpush(m_time, nullptr); } const detail::queue_t &queue() const noexcept { return m_queue; } @@ -49,19 +47,27 @@ namespace netlist template<typename... Args> void qpush(Args&&...args) noexcept { - if (!NL_USE_QUEUE_STATS || !m_use_stats) +#if (!NL_USE_QUEUE_STATS) + m_queue.emplace<false>(std::forward<Args>(args)...); // NOLINT(performance-move-const-arg) +#else + if (!m_use_stats) m_queue.emplace<false>(std::forward<Args>(args)...); // NOLINT(performance-move-const-arg) else m_queue.emplace<true>(std::forward<Args>(args)...); // NOLINT(performance-move-const-arg) +#endif } template <class R> void qremove(const R &elem) noexcept { - if (!NL_USE_QUEUE_STATS || !m_use_stats) +#if (!NL_USE_QUEUE_STATS) + m_queue.remove<false>(elem); +#else + if (!m_use_stats) m_queue.remove<false>(elem); else m_queue.remove<true>(elem); +#endif } // Control functions @@ -87,9 +93,8 @@ namespace netlist const log_type &log() const noexcept { return m_state.log(); } void print_stats() const; - bool use_stats() const { return m_use_stats; } - bool stats_enabled() const noexcept { return m_use_stats; } + constexpr bool stats_enabled() const noexcept { return m_use_stats; } void enable_stats(bool val) noexcept { m_use_stats = val; } private: @@ -107,8 +112,8 @@ namespace netlist //PALIGNAS_CACHELINE() //PALIGNAS(16) - detail::queue_t m_queue; bool m_use_stats; + detail::queue_t m_queue; // performance plib::pperftime_t<true> m_stat_mainloop; plib::pperfcount_t<true> m_perf_out_processed; diff --git a/src/lib/netlist/core/logic.h b/src/lib/netlist/core/logic.h index c8ff979cc65..7bbcf5811d7 100644 --- a/src/lib/netlist/core/logic.h +++ b/src/lib/netlist/core/logic.h @@ -36,7 +36,7 @@ namespace netlist { return plib::downcast<logic_net_t &>(core_terminal_t::net()); } - const logic_net_t & net() const noexcept + const logic_net_t & net() const noexcept { return plib::downcast<const logic_net_t &>(core_terminal_t::net()); } @@ -52,9 +52,9 @@ namespace netlist logic_input_t(device_t &dev, const pstring &aname, nldelegate delegate); - inline netlist_sig_t operator()() const noexcept + const netlist_sig_t &operator()() const noexcept { - nl_assert(terminal_state() != STATE_INP_PASSIVE); + gsl_Expects(terminal_state() != STATE_INP_PASSIVE); #if NL_USE_COPY_INSTEAD_OF_REFERENCE return m_Q; #else @@ -120,12 +120,14 @@ namespace netlist void initial(netlist_sig_t val) noexcept; - inline void push(const netlist_sig_t &newQ, const netlist_time &delay) noexcept + void push(const netlist_sig_t &newQ, const netlist_time &delay) noexcept { + gsl_Expects(delay >= netlist_time::zero()); + m_my_net.set_Q_and_push(newQ, delay); // take the shortcut } - inline void set_Q_time(const netlist_sig_t &newQ, const netlist_time_ext &at) noexcept + void set_Q_time(const netlist_sig_t &newQ, const netlist_time_ext &at) noexcept { m_my_net.set_Q_time(newQ, at); // take the shortcut } diff --git a/src/lib/netlist/core/netlist_state.h b/src/lib/netlist/core/netlist_state.h index 137f264ddfd..fd0a1449217 100644 --- a/src/lib/netlist/core/netlist_state.h +++ b/src/lib/netlist/core/netlist_state.h @@ -76,7 +76,7 @@ namespace netlist /// \return vector with pointers to devices template<class C> - inline std::vector<C *> get_device_list() const + std::vector<C *> get_device_list() const { std::vector<C *> tmp; for (const auto &d : m_devices) @@ -112,13 +112,13 @@ namespace netlist template<typename O, typename C> void save(O &owner, C &state, const pstring &module, const pstring &stname) { - this->run_state_manager().save_item(static_cast<void *>(&owner), state, module + "." + stname); + this->run_state_manager().save_item(plib::void_ptr_cast(&owner), state, module + "." + stname); } template<typename O, typename C> void save(O &owner, C *state, const pstring &module, const pstring &stname, const std::size_t count) { - this->run_state_manager().save_state_ptr(static_cast<void *>(&owner), module + "." + stname, plib::state_manager_t::dtype<C>(), count, state); + this->run_state_manager().save_state_ptr(plib::void_ptr_cast(&owner), module + "." + stname, plib::state_manager_t::dtype<C>(), count, state); } // FIXME: only used by queue_t save state @@ -217,24 +217,6 @@ namespace netlist device_arena &pool() noexcept { return m_pool; } const device_arena &pool() const noexcept { return m_pool; } - /// \brief set extended validation mode. - /// - /// The extended validation mode is not intended for running. - /// The intention is to identify power pins which are not properly - /// connected. The downside is that this mode creates a netlist which - /// is different (and not able to run). - /// - /// Extended validation is supported by nltool validate option. - /// - /// \param val Boolean value enabling/disabling extended validation mode - void set_extended_validation(bool val) { m_extended_validation = val; } - - /// \brief State of extended validation mode. - /// - /// \returns boolean value indicating if extended validation mode is - /// turned on. - bool is_extended_validation() const { return m_extended_validation; } - struct stats_info { const detail::queue_t &m_queue;// performance @@ -254,6 +236,11 @@ namespace netlist /// void free_setup_resources(); + std::vector<detail::core_terminal_t *> &core_terms(const detail::net_t &net) noexcept + { + return m_core_terms[&net]; + } + private: device_arena m_pool; // must be deleted last! @@ -263,7 +250,7 @@ namespace netlist plib::state_manager_t m_state; log_type m_log; - // FIXME: should only be available during device construcion + // FIXME: should only be available during device construction host_arena::unique_ptr<setup_t> m_setup; nets_collection_type m_nets; @@ -271,8 +258,8 @@ namespace netlist devices_collection_type m_devices; // sole use is to manage lifetime of family objects family_collection_type m_family_cache; - bool m_extended_validation; - + // all terms for a net + std::unordered_map<const detail::net_t *, std::vector<detail::core_terminal_t *>> m_core_terms; // dummy version int m_dummy_version; }; diff --git a/src/lib/netlist/core/nets.h b/src/lib/netlist/core/nets.h index db28687e5d0..7062f1572aa 100644 --- a/src/lib/netlist/core/nets.h +++ b/src/lib/netlist/core/nets.h @@ -17,6 +17,12 @@ #include "../plib/plists.h" #include "../plib/pstring.h" +// Enable the setting below to avoid queue pushes were at execution +// no action will be taken. This is academically cleaner, but slower than +// allowing this to happen and filter it during during "process". + +#define AVOID_NOOP_QUEUE_PUSHES (0) + namespace netlist { @@ -61,49 +67,80 @@ namespace netlist void push_to_queue(const netlist_time &delay) noexcept { - if (has_connections()) - { - if (!!is_queued()) - exec().qremove(this); - - const auto nst(exec().time() + delay); - m_next_scheduled_time = nst; - - if (!m_list_active.empty()) - { - m_in_queue = queue_status::QUEUED; - exec().qpush(nst, this); - } + if (!!is_queued()) + exec().qremove(this); + + m_next_scheduled_time = exec().time() + delay; +#if (AVOID_NOOP_QUEUE_PUSHES) + m_in_queue = (m_list_active.empty() ? queue_status::DELAYED_DUE_TO_INACTIVE + : (m_new_Q != m_cur_Q ? queue_status::QUEUED : queue_status::DELIVERED)); + if (m_in_queue == queue_status::QUEUED) + exec().qpush(m_next_scheduled_time, this); else - { - m_in_queue = queue_status::DELAYED_DUE_TO_INACTIVE; update_inputs(); - } - } +#else + m_in_queue = m_list_active.empty() ? queue_status::DELAYED_DUE_TO_INACTIVE : queue_status::QUEUED; + if (m_in_queue == queue_status::QUEUED) + exec().qpush(m_next_scheduled_time, this); + else + update_inputs(); +#endif } - NVCC_CONSTEXPR bool is_queued() const noexcept { return m_in_queue == queue_status::QUEUED; } + constexpr bool is_queued() const noexcept { return m_in_queue == queue_status::QUEUED; } + + // ----------------------------------------------------------------------------- + // Very hot + // ----------------------------------------------------------------------------- template <bool KEEP_STATS> - inline void update_devs() noexcept + void update_devs() noexcept { - nl_assert(this->is_rail_net()); + gsl_Expects(this->is_rail_net()); m_in_queue = queue_status::DELIVERED; // mark as taken ... - if (m_new_Q ^ m_cur_Q) + + const netlist_sig_t new_Q(m_new_Q); + const netlist_sig_t cur_Q(m_cur_Q); +#if (!AVOID_NOOP_QUEUE_PUSHES) + if (new_Q ^ cur_Q) +#endif { - process<KEEP_STATS>((m_new_Q << core_terminal_t::INP_LH_SHIFT) - | (m_cur_Q << core_terminal_t::INP_HL_SHIFT), m_new_Q); + const auto mask = (new_Q << core_terminal_t::INP_LH_SHIFT) + | (cur_Q << core_terminal_t::INP_HL_SHIFT); + m_cur_Q = new_Q; + + if (!KEEP_STATS) + { + for (auto &p : m_list_active) + { + p.set_copied_input(new_Q); + if ((p.terminal_state() & mask) != 0) + p.run_delegate(); + } + } + else + { + for (auto & p : m_list_active) + { + p.set_copied_input(new_Q); + auto *stats(p.device().stats()); + stats->m_stat_call_count.inc(); + if ((p.terminal_state() & mask)) + { + auto g(stats->m_stat_total_time.guard()); + p.run_delegate(); + } + } + } } } - netlist_time_ext next_scheduled_time() const noexcept { return m_next_scheduled_time; } + constexpr const netlist_time_ext &next_scheduled_time() const noexcept { return m_next_scheduled_time; } void set_next_scheduled_time(netlist_time_ext ntime) noexcept { m_next_scheduled_time = ntime; } - NVCC_CONSTEXPR bool is_rail_net() const noexcept { return !(m_railterminal == nullptr); } + bool is_rail_net() const noexcept { return !(m_railterminal == nullptr); } core_terminal_t & railterminal() const noexcept { return *m_railterminal; } - bool has_connections() const noexcept { return !m_core_terms.empty(); } - void add_to_active_list(core_terminal_t &term) noexcept { if (!m_list_active.empty()) @@ -117,7 +154,12 @@ namespace netlist railterminal().device().do_inc_active(); if (m_in_queue == queue_status::DELAYED_DUE_TO_INACTIVE) { +#if (AVOID_NOOP_QUEUE_PUSHES) + if (m_next_scheduled_time > exec().time() + && (m_cur_Q != m_new_Q)) +#else if (m_next_scheduled_time > exec().time()) +#endif { m_in_queue = queue_status::QUEUED; // pending exec().qpush(m_next_scheduled_time, this); @@ -139,7 +181,16 @@ namespace netlist gsl_Expects(!m_list_active.empty()); m_list_active.remove(&term); if (m_list_active.empty()) + { +#if (AVOID_NOOP_QUEUE_PUSHES) + if (!!is_queued()) + { + exec().qremove(this); + m_in_queue = queue_status::DELAYED_DUE_TO_INACTIVE; + } +#endif railterminal().device().do_dec_active(); + } } // ----------------------------------------------------------------------------- @@ -151,7 +202,7 @@ namespace netlist void rebuild_list(); // rebuild m_list after a load - std::vector<core_terminal_t *> &core_terms() noexcept { return m_core_terms; } + //std::vector<core_terminal_t *> &core_terms() noexcept { return state().m_core_terms[this]; } void update_inputs() noexcept { @@ -165,7 +216,7 @@ namespace netlist protected: // only used for logic nets - NVCC_CONSTEXPR netlist_sig_t Q() const noexcept { return m_cur_Q; } + constexpr const netlist_sig_t &Q() const noexcept { return m_cur_Q; } // only used for logic nets void initial(netlist_sig_t val) noexcept @@ -175,8 +226,10 @@ namespace netlist } // only used for logic nets - inline void set_Q_and_push(const netlist_sig_t &newQ, const netlist_time &delay) noexcept + void set_Q_and_push(const netlist_sig_t &newQ, const netlist_time &delay) noexcept { + gsl_Expects(delay >= netlist_time::zero()); + if (newQ != m_new_Q) { m_new_Q = newQ; @@ -185,8 +238,10 @@ namespace netlist } // only used for logic nets - inline void set_Q_time(const netlist_sig_t &newQ, const netlist_time_ext &at) noexcept + void set_Q_time(const netlist_sig_t &newQ, const netlist_time_ext &at) noexcept { + gsl_Expects(at >= netlist_time_ext::zero()); + if (newQ != m_new_Q) { m_in_queue = queue_status::DELAYED_DUE_TO_INACTIVE; @@ -205,45 +260,12 @@ namespace netlist state_var<netlist_sig_t> m_new_Q; state_var<netlist_sig_t> m_cur_Q; state_var<queue_status> m_in_queue; + plib::linkedlist_t<core_terminal_t> m_list_active; state_var<netlist_time_ext> m_next_scheduled_time; core_terminal_t * m_railterminal; - plib::linkedlist_t<core_terminal_t> m_list_active; - std::vector<core_terminal_t *> m_core_terms; // save post-start m_list ... - - // ----------------------------------------------------------------------------- - // Very hot - // ----------------------------------------------------------------------------- - - template <bool KEEP_STATS, typename T, typename S> - void process(T mask, const S &sig) noexcept - { - m_cur_Q = sig; + //std::vector<core_terminal_t *> m_core_terms; // save post-start m_list ... - if (KEEP_STATS) - { - for (auto & p : m_list_active) - { - p.set_copied_input(sig); - auto *stats(p.device().stats()); - stats->m_stat_call_count.inc(); - if ((p.terminal_state() & mask)) - { - auto g(stats->m_stat_total_time.guard()); - p.run_delegate(); - } - } - } - else - { - for (auto &p : m_list_active) - { - p.set_copied_input(sig); - if ((p.terminal_state() & mask) != 0) - p.run_delegate(); - } - } - } }; } // namespace detail @@ -255,10 +277,10 @@ namespace netlist void reset() noexcept override; - nl_fptype Q_Analog() const noexcept { return m_cur_Analog; } + const nl_fptype &Q_Analog() const noexcept { return m_cur_Analog; } void set_Q_Analog(nl_fptype v) noexcept { m_cur_Analog = v; } // used by solver code ... - nl_fptype *Q_Analog_state_ptr() noexcept { return &m_cur_Analog(); } + nl_fptype *Q_Analog_state_ptr() noexcept { return *m_cur_Analog; } //FIXME: needed by current solver code solver::matrix_solver_t *solver() const noexcept { return m_solver; } diff --git a/src/lib/netlist/core/object_array.h b/src/lib/netlist/core/object_array.h index 0079d819c3e..f8b811482fc 100644 --- a/src/lib/netlist/core/object_array.h +++ b/src/lib/netlist/core/object_array.h @@ -133,7 +133,7 @@ namespace netlist private: template <std::size_t P> - inline constexpr value_type e() const { return (*this)[P](); } + constexpr const value_type &e() const { return (*this)[P](); } }; template<std::size_t N> @@ -144,7 +144,7 @@ namespace netlist using base_type::base_type; template <typename T> - inline void push(const T &v, const netlist_time &t) + void push(const T &v, const netlist_time &t) { if (N >= 1) (*this)[0].push((v >> 0) & 1, t); if (N >= 2) (*this)[1].push((v >> 1) & 1, t); @@ -197,7 +197,7 @@ namespace netlist using base_type::base_type; template <typename T> - inline void push(const T &v, const netlist_time &t) + void push(const T &v, const netlist_time &t) { if (N >= 1) (*this)[0].push((v >> 0) & 1, t); if (N >= 2) (*this)[1].push((v >> 1) & 1, t); diff --git a/src/lib/netlist/core/param.h b/src/lib/netlist/core/param.h index 2007d1f844d..dbabef073e7 100644 --- a/src/lib/netlist/core/param.h +++ b/src/lib/netlist/core/param.h @@ -79,8 +79,8 @@ namespace netlist param_num_t(core_device_t &device, const pstring &name, T val) noexcept(false); - T operator()() const noexcept { return m_param; } - operator T() const noexcept { return m_param; } + constexpr const T &operator()() const noexcept { return m_param; } + constexpr operator const T& () const noexcept { return m_param; } void set(const T ¶m) noexcept { set_and_update_param(m_param, param); } diff --git a/src/lib/netlist/core/queue.h b/src/lib/netlist/core/queue.h index 7e38c3f0ef9..350329ed3f1 100644 --- a/src/lib/netlist/core/queue.h +++ b/src/lib/netlist/core/queue.h @@ -21,12 +21,13 @@ #include <unordered_map> #include <utility> #include <vector> +#include <queue> namespace netlist { namespace detail { // Use timed_queue_heap to use stdc++ heap functions instead of linear processing. - // This slows down processing by about 25% on a Kaby Lake. + // This slows down processing by about 35% on a Kaby Lake. // template <class T, bool TS> // using timed_queue = plib::timed_queue_heap<T, TS>; diff --git a/src/lib/netlist/core/setup.h b/src/lib/netlist/core/setup.h index 8b8a49dbc34..1c8fc5742f9 100644 --- a/src/lib/netlist/core/setup.h +++ b/src/lib/netlist/core/setup.h @@ -144,13 +144,21 @@ namespace netlist pstring get_initial_param_val(const pstring &name, const pstring &def) const; void register_term(detail::core_terminal_t &term); - void register_term(terminal_t &term, terminal_t &other_term); + void register_term(terminal_t &term, terminal_t *other_term, const std::array<terminal_t *, 2> &splitter_terms); - // called from net_splitter + // called from matrix_solver_t::get_connected_net + // returns the terminal being part of a two terminal device. terminal_t *get_connected_terminal(const terminal_t &term) const noexcept { auto ret(m_connected_terminals.find(&term)); - return (ret != m_connected_terminals.end()) ? ret->second : nullptr; + return (ret != m_connected_terminals.end()) ? ret->second[0] : nullptr; + } + + // called from net_splitter + const std::array<terminal_t *, 4> *get_connected_terminals(const terminal_t &term) const noexcept + { + auto ret(m_connected_terminals.find(&term)); + return (ret != m_connected_terminals.end()) ? &ret->second : nullptr; } // get family -> truthtable @@ -223,7 +231,9 @@ namespace netlist // FIXME: can be cleared before run std::unordered_map<pstring, detail::core_terminal_t *> m_terminals; - std::unordered_map<const terminal_t *, terminal_t *> m_connected_terminals; + // FIXME: Limited to 3 additional terminals + std::unordered_map<const terminal_t *, + std::array<terminal_t *, 4>> m_connected_terminals; std::unordered_map<pstring, param_ref_t> m_params; std::unordered_map<const detail::core_terminal_t *, devices::nld_base_proxy *> m_proxies; @@ -294,8 +304,9 @@ namespace netlist { public: - explicit source_pattern_t(const pstring &pat) + explicit source_pattern_t(const pstring &pat, bool force_lowercase) : m_pattern(pat) + , m_force_lowercase(force_lowercase) { } @@ -304,6 +315,7 @@ namespace netlist private: pstring m_pattern; + bool m_force_lowercase; }; class source_mem_t : public source_netlist_t diff --git a/src/lib/netlist/core/state_var.h b/src/lib/netlist/core/state_var.h index 55db73c1ac2..5839de26748 100644 --- a/src/lib/netlist/core/state_var.h +++ b/src/lib/netlist/core/state_var.h @@ -61,7 +61,8 @@ namespace netlist //! Assignment operator to assign value of type T. constexpr state_var &operator=(const T &rhs) noexcept { m_value = rhs; return *this; } //! Assignment move operator to assign value of type T. - constexpr state_var &operator=(T &&rhs) noexcept { std::swap(m_value, rhs); return *this; } + //constexpr state_var &operator=(T &&rhs) noexcept { std::swap(m_value, rhs); return *this; } + constexpr state_var &operator=(T &&rhs) noexcept { m_value = std::move(rhs); return *this; } //! Return non-const value of state variable. constexpr operator T & () noexcept { return m_value; } //! Return const value of state variable. @@ -78,6 +79,10 @@ namespace netlist constexpr T * operator->() noexcept { return &m_value; } //! Access state variable by const ->. constexpr const T * operator->() const noexcept{ return &m_value; } + //! Access state variable by *. + constexpr T * operator *() noexcept { return &m_value; } + //! Access state variable by const *. + constexpr const T * operator *() const noexcept{ return &m_value; } private: T m_value; diff --git a/src/lib/netlist/devices/nld_2102A.cpp b/src/lib/netlist/devices/nld_2102a.cpp index 91c7c6b7ee0..91c7c6b7ee0 100644..100755 --- a/src/lib/netlist/devices/nld_2102A.cpp +++ b/src/lib/netlist/devices/nld_2102a.cpp diff --git a/src/lib/netlist/devices/nld_4029.cpp b/src/lib/netlist/devices/nld_4029.cpp new file mode 100644 index 00000000000..4582746bf24 --- /dev/null +++ b/src/lib/netlist/devices/nld_4029.cpp @@ -0,0 +1,272 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud, Jonathan Gevaryahu +/* + * nld_4029.cpp + * + * CD4029BM/CD4029BC Presettable Binary/Decade Up/Down Counter + * + * +--------------+ + * PE |1 ++ 16| VDD + * Q4 |2 15| CLK + * J4 |3 14| Q3 + * J1 |4 4029 13| J3 + * CI |5 12| J2 + * Q1 |6 11| Q2 + * CO |7 10| U/D + * VSS |8 9| B/D + * +--------------+ + * + * Counter Sequences: + * + * B/D high (Binary), U/D high (Up) + * +-------++----+----+----+----+----++-------+ + * | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | + * +=======++====+====+====+====+====++=======+ + * | 0 || 0 | 0 | 0 | 0 | 1 || 1 | + * | 1 || 0 | 0 | 0 | 1 | 1 || 2 | + * | 2 || 0 | 0 | 1 | 0 | 1 || 3 | + * | 3 || 0 | 0 | 1 | 1 | 1 || 4 | + * | 4 || 0 | 1 | 0 | 0 | 1 || 5 | + * | 5 || 0 | 1 | 0 | 1 | 1 || 6 | + * | 6 || 0 | 1 | 1 | 0 | 1 || 7 | + * | 7 || 0 | 1 | 1 | 1 | 1 || 8 | + * | 8 || 1 | 0 | 0 | 0 | 1 || 9 | + * | 9 || 1 | 0 | 0 | 1 | 1 || A | + * | A || 1 | 0 | 1 | 0 | 1 || B | + * | B || 1 | 0 | 1 | 1 | 1 || C | + * | C || 1 | 1 | 0 | 0 | 1 || D | + * | D || 1 | 1 | 0 | 1 | 1 || E | + * | E || 1 | 1 | 1 | 0 | 1 || F | + * | F || 1 | 1 | 1 | 1 |0|CI|| 0 | + * | 0 || 0 | 0 | 0 | 0 | 1 || 1 | + * +-------++----+----+----+----+----++-------+ + * + * B/D high (Binary), U/D low (Down) + * +-------++----+----+----+----+----++-------+ + * | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | + * +=======++====+====+====+====+====++=======+ + * | F || 1 | 1 | 1 | 1 | 1 || E | + * | E || 1 | 1 | 1 | 0 | 1 || D | + * | D || 1 | 1 | 0 | 1 | 1 || C | + * | C || 1 | 1 | 0 | 0 | 1 || B | + * | B || 1 | 0 | 1 | 1 | 1 || A | + * | A || 1 | 0 | 1 | 0 | 1 || 9 | + * | 9 || 1 | 0 | 0 | 1 | 1 || 8 | + * | 8 || 1 | 0 | 0 | 0 | 1 || 7 | + * | 7 || 0 | 1 | 1 | 1 | 1 || 6 | + * | 6 || 0 | 1 | 1 | 0 | 1 || 5 | + * | 5 || 0 | 1 | 0 | 1 | 1 || 4 | + * | 4 || 0 | 1 | 0 | 0 | 1 || 3 | + * | 3 || 0 | 0 | 1 | 1 | 1 || 2 | + * | 2 || 0 | 0 | 1 | 0 | 1 || 1 | + * | 1 || 0 | 0 | 0 | 1 | 1 || 0 | + * | 0 || 0 | 0 | 0 | 0 |0|CI|| F | + * | F || 1 | 1 | 1 | 1 | 1 || E | + * +-------++----+----+----+----+----++-------+ + * + * B/D low (Decimal), U/D high (Up) + * +-------++----+----+----+----+----++-------+ + * | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | + * +=======++====+====+====+====+====++=======+ + * | 0 || 0 | 0 | 0 | 0 | 1 || 1 | + * | 1 || 0 | 0 | 0 | 1 | 1 || 2 | + * | 2 || 0 | 0 | 1 | 0 | 1 || 3 | + * | 3 || 0 | 0 | 1 | 1 | 1 || 4 | + * | 4 || 0 | 1 | 0 | 0 | 1 || 5 | + * | 5 || 0 | 1 | 0 | 1 | 1 || 6 | + * | 6 || 0 | 1 | 1 | 0 | 1 || 7 | + * | 7 || 0 | 1 | 1 | 1 | 1 || 8 | + * | 8 || 1 | 0 | 0 | 0 | 1 || 9 | + * | 9 || 1 | 0 | 0 | 1 |0|CI|| 0 | + * | A || 1 | 0 | 1 | 0 | 1 || B | + * | B || 1 | 0 | 1 | 1 |0|CI|| 6 | + * | C || 1 | 1 | 0 | 0 | 1 || D | + * | D || 1 | 1 | 0 | 1 |0|CI|| 4 | + * | E || 1 | 1 | 1 | 0 | 1 || F | + * | F || 1 | 1 | 1 | 1 |0|CI|| 2 | + * | 0 || 0 | 0 | 0 | 0 | 1 || 1 | + * +-------++----+----+----+----+----++-------+ + * + * B/D low (Decimal), U/D low (Down) + * +-------++----+----+----+----+----++-------+ + * | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | + * +=======++====+====+====+====+====++=======+ + * | F || 1 | 1 | 1 | 1 | 1 || E | + * | E || 1 | 1 | 1 | 0 | 1 || D | + * | D || 1 | 1 | 0 | 1 | 1 || C | + * | C || 1 | 1 | 0 | 0 | 1 || B | + * | B || 1 | 0 | 1 | 1 | 1 || A | + * | A || 1 | 0 | 1 | 0 | 1 || 9 | + * | 9 || 1 | 0 | 0 | 1 | 1 || 8 | + * | 8 || 1 | 0 | 0 | 0 | 1 || 7 | + * | 7 || 0 | 1 | 1 | 1 | 1 || 6 | + * | 6 || 0 | 1 | 1 | 0 | 1 || 5 | + * | 5 || 0 | 1 | 0 | 1 | 1 || 4 | + * | 4 || 0 | 1 | 0 | 0 | 1 || 3 | + * | 3 || 0 | 0 | 1 | 1 | 1 || 2 | + * | 2 || 0 | 0 | 1 | 0 | 1 || 1 | + * | 1 || 0 | 0 | 0 | 1 | 1 || 0 | + * | 0 || 0 | 0 | 0 | 0 |0|CI|| 9 | + * | 9 || 1 | 0 | 0 | 1 | 1 || 8 | + * +-------++----+----+----+----+----++-------+ + * + * Note that in all cases where Carry-out is generating a non-1 signal (0 | Carry-in), + * this signal is asynchronous, so if carry-in changes the carry-out value will + * change immediately. + * + * + * Preset/Carry in function table + * +-----+-----+-----++----+----+----+----+ + * | PE | CLK | CI || Q1 | Q2 | Q3 | Q4 | + * +=====+=====+=====++====+====+====+====+ + * | 1 | X | X || J1 | J2 | J3 | J4 | + * | 0 | X | 1 || Q1 | Q2 | Q3 | Q4 | + * | 0 | ./` | 0 || COUNT | + * +-----+-----+-----++----+----+----+----+ + * + * Naming conventions follow National Semiconductor datasheet + * + */ + +#include "nl_base.h" + +namespace netlist +{ +namespace devices +{ + + NETLIB_OBJECT(CD4029) + { + NETLIB_CONSTRUCTOR_MODEL(CD4029, "CD4XXX") + , m_PE(*this, "PE", NETLIB_DELEGATE(inputs)) + , m_J(*this, {"J1", "J2", "J3", "J4"}, NETLIB_DELEGATE(inputs)) + , m_CI(*this, "CI", NETLIB_DELEGATE(inputs)) + , m_UD(*this, "UD", NETLIB_DELEGATE(inputs)) + , m_BD(*this, "BD", NETLIB_DELEGATE(inputs)) + , m_CLK(*this, "CLK", NETLIB_DELEGATE(clk)) + , m_clk_old(*this, "m_clk_old", false) + , m_Q(*this, {"Q1", "Q2", "Q3", "Q4"}) + , m_CO(*this, "CO", false) + , m_cnt(*this, "m_cnt", 0) + , m_power_pins(*this) + { + } + + private: + NETLIB_HANDLERI(inputs) // pe causes an asynchronous counter load on level so has to be handled separately; if pe is high, then J changing will asynchronously change the Q state. changing J in this state does affect CO as well; CI will affect CO asynchronously if there is currently a carry + { + if (m_PE()) + { + m_cnt = m_J()&0xf; + } + m_Q.push(m_cnt, NLTIME_FROM_NS(200)); + // figure out CO + if (!m_UD()) // downward is the same for binary and decimal + { + m_CO.push(m_cnt||m_CI(),NLTIME_FROM_NS(320)); + } + else // upward mode differs + { + if (!m_BD()) // decimal mode + { + m_CO.push((m_cnt<8)||(~m_cnt&1)||m_CI(),NLTIME_FROM_NS(320)); + } + else // binary mode + { + m_CO.push((m_cnt!=0xf)||m_CI(),NLTIME_FROM_NS(320)); + } + } + } + + NETLIB_HANDLERI(clk) + { + // clocking only happens if m_clk_old was low, m_CLK is high, m_PE is NOT high, and m_CI is NOT high. + if (!m_PE() && !m_CI() && !m_clk_old && m_CLK()) + { + if (m_BD()) // binary + { + m_cnt += (m_UD() ? 1 : -1); + m_cnt &= 0xf; + } + else // decimal + { + if (m_UD()) // upward + { + switch(m_cnt) + { + case 0: case 1: case 2: case 3: + case 4: case 5: case 6: case 7: + case 8: case 0xa: case 0xc: case 0xe: + m_cnt++; + break; + case 9: + m_cnt = 0; + break; + case 0xb: + m_cnt = 6; + break; + case 0xd: + m_cnt = 4; + break; + case 0xf: + m_cnt = 2; + break; + } + } + else // downward + { + if (m_cnt>0) + { + m_cnt--; + } + else // m_cnt == 0 + { + m_cnt = 9; + } + } + } + } + m_clk_old = m_CLK(); + m_Q.push(m_cnt, NLTIME_FROM_NS(200)); + // figure out CO + if (!m_UD()) // downward is the same for binary and decimal + { + m_CO.push(m_cnt||m_CI(),NLTIME_FROM_NS(320)); + } + else // upward mode differs + { + if (!m_BD()) // decimal mode + { + m_CO.push((m_cnt<8)||(~m_cnt&1)||m_CI(),NLTIME_FROM_NS(320)); + } + else // binary mode + { + m_CO.push((m_cnt!=0xf)||m_CI(),NLTIME_FROM_NS(320)); + } + } + } + + NETLIB_RESETI() + { + m_cnt = 0; + m_clk_old = false; + } + + logic_input_t m_PE; + object_array_t<logic_input_t, 4> m_J; + logic_input_t m_CI; + logic_input_t m_UD; + logic_input_t m_BD; + logic_input_t m_CLK; + + state_var<netlist_sig_t> m_clk_old; + object_array_t<logic_output_t, 4> m_Q; + logic_output_t m_CO; + state_var_u8 m_cnt; + nld_power_pins m_power_pins; + }; + + NETLIB_DEVICE_IMPL(CD4029, "CD4029", "+PE,+J1,+J2,+J3,+J4,+CI,+UD,+BD,+CLK,@VCC,@GND") + +} // namespace devices +} // namespace netlist diff --git a/src/lib/netlist/devices/nld_4042.cpp b/src/lib/netlist/devices/nld_4042.cpp new file mode 100644 index 00000000000..a000d2e8af8 --- /dev/null +++ b/src/lib/netlist/devices/nld_4042.cpp @@ -0,0 +1,120 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud, Jonathan Gevaryahu +/* + * nld_4042.cpp + * + * CD4042BM/CD4042BC Quad Clocked D Latch + * + * +--------------+ + * Q4 |1 ++ 16| VDD + * Q1 |2 15| Q4Q + * Q1Q |3 14| D4 + * D1 |4 4042 13| D3 + * CLK |5 12| Q3Q + * POL |6 11| Q3 + * D2 |7 10| Q2 + * VSS |8 9| Q2Q + * +--------------+ + * + * + * Function table + * +-----+-----+----++----+-----+ + * | POL | CLK | Dx || Qx | QQx | + * +=====+=====+====++====+=====+ + * | 0 | 0 | X || Qx | /Qx | + * | 0 | 1 | D || D | /D | + * | 1 | 1 | X || Qx | /Qx | + * | 1 | 0 | D || D | /D | + * +-----+-----+----++----+-----+ + * Note that since this is a level triggered transparent latch, + * as long as POL ^ CLK == true, the latch is transparent, and + * if D changes Q and QQ(/Q) will instantly change. + * + * Naming conventions follow National Semiconductor datasheet + * + * National Semiconductor Datasheet: http://pdf.datasheetcatalog.com/datasheet/nationalsemiconductor/DS005966.PDF + * TI Datasheet: https://www.ti.com/lit/ds/symlink/cd4042b.pdf + */ + +#include "nl_base.h" + +namespace netlist +{ +namespace devices +{ + + + NETLIB_OBJECT(CD4042) + { + NETLIB_CONSTRUCTOR_MODEL(CD4042, "CD4XXX") + , m_D(*this, {"D1", "D2", "D3", "D4"}, NETLIB_DELEGATE(inputs)) + , m_POL(*this, "POL", NETLIB_DELEGATE(clk)) + , m_CLK(*this, "CLK", NETLIB_DELEGATE(clk)) + , m_Q(*this, {"Q1", "Q2", "Q3", "Q4"}) + , m_QQ(*this, {"Q1Q", "Q2Q", "Q3Q", "Q4Q"}) + , m_latch(*this, "m_latch", 0) + , m_tpdq(*this, "m_tpd", netlist_time::from_nsec(175)) + , m_tpdqq(*this, "m_tpd", netlist_time::from_nsec(150)) + , m_tpcq(*this, "m_tpc", netlist_time::from_nsec(250)) + , m_tpcqq(*this, "m_tpc", netlist_time::from_nsec(250)) + , m_power_pins(*this, NETLIB_DELEGATE(vdd_vss)) + { + } + + private: + NETLIB_HANDLERI(clk) + { + if (m_POL() ^ m_CLK()) // are we in transparent mode? if so latch the data and push it. + { + m_latch = m_D()&0xf; + m_Q.push(m_latch&0xf, m_tpcq); + m_QQ.push((~m_latch)&0xf, m_tpcqq); + } + // if not, the data inputs are ignored and just do nothing + } + + NETLIB_HANDLERI(inputs) + { + if ((m_POL() ^ m_CLK())&&(m_latch != (m_D()&0xf))) // are we in transparent mode? if so latch the data and push it. only do this if the data actually changed + { + m_latch = m_D()&0xf; + m_Q.push(m_latch&0xf, m_tpdq); + m_QQ.push((~m_latch)&0xf, m_tpdqq); + } + } + + NETLIB_HANDLERI(vdd_vss) + { + auto d = m_power_pins.VCC()() - m_power_pins.GND()(); + if (d > 0.1) // avoid unrealistic values + { + m_tpdq = netlist_time::from_nsec(gsl::narrow_cast<unsigned>(894.0 / d - 6.0)); + m_tpdqq = netlist_time::from_nsec(gsl::narrow_cast<unsigned>(750.0 / d + 0.0)); + m_tpcq = netlist_time::from_nsec(gsl::narrow_cast<unsigned>(1327.0 / d - 18.8)); + m_tpcqq = netlist_time::from_nsec(gsl::narrow_cast<unsigned>(1234.5 / d + 0.8)); + } + } + + NETLIB_RESETI() + { + m_latch = 0; + } + + object_array_t<logic_input_t, 4> m_D; + logic_input_t m_POL; + logic_input_t m_CLK; + + object_array_t<logic_output_t, 4> m_Q; + object_array_t<logic_output_t, 4> m_QQ; + state_var_u8 m_latch; + state_var<netlist_time> m_tpdq; // propagation time for data alone when in transparent mode, Q + state_var<netlist_time> m_tpdqq; // propagation time for data alone when in transparent mode, /Q + state_var<netlist_time> m_tpcq; // propagation time for data vs CLK, Q + state_var<netlist_time> m_tpcqq; // propagation time for data vs CLK, /Q + nld_power_pins m_power_pins; + }; + + NETLIB_DEVICE_IMPL(CD4042, "CD4042", "+D1,+D2,+D3,+D4,+POL,+CLK,@VCC,@GND") + +} // namespace devices +} // namespace netlist diff --git a/src/lib/netlist/devices/nld_4076.cpp b/src/lib/netlist/devices/nld_4076.cpp new file mode 100644 index 00000000000..a69d02e2d54 --- /dev/null +++ b/src/lib/netlist/devices/nld_4076.cpp @@ -0,0 +1,132 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud, Jonathan Gevaryahu +/* + * nld_4076.cpp + * + * CD4076BM/CD4076BC TRI-STATE(R) Quad D Flip-Flop + * + * +--------------+ + * OD1 |1 ++ 16| VDD + * OD2 |2 15| CLR + * OA |3 14| IA + * OB |4 4076 13| IB + * OC |5 12| IC + * OD |6 11| ID + * CLK |7 10| ID2 + * VSS |8 9| ID1 + * +--------------+ + * + * + * Function table for ID1/2 pins + * +-----+-----+-----+----+-----++-----+ + * | ID1 | ID2 | CLR | Ix | CLK || iOx | + * +=====+=====+=====+====+=====++=====+ + * | X | X | 0 | X | 0 || iOx | + * | X | X | 0 | X | 1 || iOx | + * | 1 | X | 0 | X | 0>1 || iOx | + * | X | 1 | 0 | X | 0>1 || iOx | + * | 0 | 0 | 0 | 0 | 0>1 || 0 | + * | 0 | 0 | 0 | 1 | 0>1 || 1 | + * | X | X | 1 | X | X || 0 | + * +-----+-----+-----+----+-----++-----+ + * Note: iOX is an internal signal, the output of each D-latch + * + * Function table for OD1/2 pins vs output of the internal D-latches + * +-----+-----+-----++-----+ + * | OD1 | OD2 | iOx || Ox | + * +=====+=====+=====++=====+ + * | 1 | X | X || Z | + * | X | 1 | X || Z | + * | 0 | 0 | 0 || 0 | + * | 0 | 0 | 1 || 1 | + * +-----+-----+-----++-----+ + * + * Naming conventions follow National Semiconductor datasheet + * http://www.bitsavers.org/components/national/_dataBooks/1981_Natonal_CMOS_Databook.pdf 5-186 (pdf page 567) + * + * TODO: the 74C173 is 100% identical to this CMOS part. + */ + +#include "nl_base.h" + +namespace netlist +{ +namespace devices +{ + + + NETLIB_OBJECT(CD4076) + { + NETLIB_CONSTRUCTOR_MODEL(CD4076, "CD4XXX") + , m_I(*this, {"IA", "IB", "IC", "ID"}, NETLIB_DELEGATE(id)) // if the d-pins change absolutely nothing happens, as they are clock-latched. + , m_ID1(*this, "ID1", NETLIB_DELEGATE(id)) + , m_ID2(*this, "ID2", NETLIB_DELEGATE(id)) + , m_enable_in(*this, "m_enable_in", true) + , m_CLK(*this, "CLK", NETLIB_DELEGATE(clk)) + , m_clk_old(*this, "m_clk_old", 0) + , m_OD1(*this, "OD1", NETLIB_DELEGATE(od)) // if the OD pins change nothing about the internal state changes directly, but the outputs can change from driven to tri-state or vice-versa + , m_OD2(*this, "OD2", NETLIB_DELEGATE(od)) // "" + , m_enable_out(*this, "m_enable_out", true) + , m_O(*this, {"OA", "OB", "OC", "OD"}) + , m_latch(*this, "m_latch", 0) + , m_power_pins(*this) + { + } + + private: + NETLIB_HANDLERI(id) + { + m_enable_in = (!(m_ID1() || m_ID2())); + } + + NETLIB_HANDLERI(clk) + { + if ((!m_clk_old) && m_CLK() && m_enable_in) // clock rising edge and input is enabled; otherwise the latch just re-latches its own value + { + m_latch = m_I()&0xf; + } + m_clk_old = m_CLK(); + // update the pin output state + for (std::size_t i=0; i<4; i++) + { + m_O.set_tristate(m_enable_out, NLTIME_FROM_NS(170), NLTIME_FROM_NS(170)); + m_O[i].push((m_latch >> i) & 1, NLTIME_FROM_NS(220)); + } + } + + NETLIB_HANDLERI(od) + { + m_enable_out = (!(m_OD1() || m_OD2())); + // update the pin output state + for (std::size_t i=0; i<4; i++) + { + m_O.set_tristate(m_enable_out, NLTIME_FROM_NS(170), NLTIME_FROM_NS(170)); + m_O[i].push((m_latch >> i) & 1, NLTIME_FROM_NS(220)); + } + } + + NETLIB_RESETI() + { + m_latch = 0; + m_enable_in = true; + m_enable_out = true; + } + + object_array_t<logic_input_t, 4> m_I; + logic_input_t m_ID1; + logic_input_t m_ID2; + state_var<bool> m_enable_in; + logic_input_t m_CLK; + state_var<netlist_sig_t> m_clk_old; + logic_input_t m_OD1; + logic_input_t m_OD2; + state_var<bool> m_enable_out; + object_array_t<logic_output_t, 4> m_O; + state_var_u8 m_latch; + nld_power_pins m_power_pins; + }; + + NETLIB_DEVICE_IMPL(CD4076, "CD4076", "+I1,+I2,+I3,+I4,+ID1,+ID2,+OD1,+OD2,@VCC,@GND") + +} // namespace devices +} // namespace netlist diff --git a/src/lib/netlist/devices/nld_7448.cpp b/src/lib/netlist/devices/nld_7448.cpp index 992caf9d814..f4acbc432bd 100644 --- a/src/lib/netlist/devices/nld_7448.cpp +++ b/src/lib/netlist/devices/nld_7448.cpp @@ -54,7 +54,7 @@ namespace netlist private: void update_outputs(unsigned v) noexcept { - nl_assert(v<16); + gsl_Expects(v<16); if (v != m_state) { // max transfer time is 100 NS */ diff --git a/src/lib/netlist/devices/nld_7493.cpp b/src/lib/netlist/devices/nld_7493.cpp index c52418f8d2e..54d44dc1fea 100644 --- a/src/lib/netlist/devices/nld_7493.cpp +++ b/src/lib/netlist/devices/nld_7493.cpp @@ -62,22 +62,19 @@ namespace netlist namespace devices { - static constexpr const netlist_time out_delay = NLTIME_FROM_NS(18); - static constexpr const netlist_time out_delay2 = NLTIME_FROM_NS(36); - static constexpr const netlist_time out_delay3 = NLTIME_FROM_NS(54); + static constexpr std::array<netlist_time, 3> out_delay { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54) }; NETLIB_OBJECT(7493) { NETLIB_CONSTRUCTOR(7493) - , m_R1(*this, "R1", NETLIB_DELEGATE(inputs)) - , m_R2(*this, "R2", NETLIB_DELEGATE(inputs)) - , m_a(*this, "_m_a", 0) - , m_bcd(*this, "_m_b", 0) - , m_r(*this, "_m_r", 0) , m_CLKA(*this, "CLKA", NETLIB_DELEGATE(updA)) , m_CLKB(*this, "CLKB", NETLIB_DELEGATE(updB)) , m_QA(*this, "QA") , m_QB(*this, {"QB", "QC", "QD"}) + , m_a(*this, "m_a", 0) + , m_bcd(*this, "m_b", 0) + , m_R1(*this, "R1", NETLIB_DELEGATE(inputs)) + , m_R2(*this, "R2", NETLIB_DELEGATE(inputs)) , m_power_pins(*this) { } @@ -110,30 +107,27 @@ namespace netlist NETLIB_HANDLERI(updA) { m_a ^= 1; - m_QA.push(m_a, out_delay); + m_QA.push(m_a, out_delay[0]); } NETLIB_HANDLERI(updB) { const auto cnt(++m_bcd &= 0x07); - - m_QB[2].push((cnt >> 2) & 1, out_delay3); - m_QB[1].push((cnt >> 1) & 1, out_delay2); - m_QB[0].push(cnt & 1, out_delay); + m_QB.push(cnt, out_delay); } - logic_input_t m_R1; - logic_input_t m_R2; - - state_var_sig m_a; - state_var_sig m_bcd; - state_var_sig m_r; - logic_input_t m_CLKA; logic_input_t m_CLKB; logic_output_t m_QA; object_array_t<logic_output_t, 3> m_QB; + + state_var<unsigned> m_a; + state_var<unsigned> m_bcd; + + logic_input_t m_R1; + logic_input_t m_R2; + nld_power_pins m_power_pins; }; diff --git a/src/lib/netlist/devices/nld_82S115.cpp b/src/lib/netlist/devices/nld_82s115.cpp index f1e49bd9f83..f1e49bd9f83 100644..100755 --- a/src/lib/netlist/devices/nld_82S115.cpp +++ b/src/lib/netlist/devices/nld_82s115.cpp diff --git a/src/lib/netlist/devices/nld_82S16.cpp b/src/lib/netlist/devices/nld_82s16.cpp index 2fc92adfe30..2fc92adfe30 100644..100755 --- a/src/lib/netlist/devices/nld_82S16.cpp +++ b/src/lib/netlist/devices/nld_82s16.cpp diff --git a/src/lib/netlist/devices/nld_9316_base.hxx b/src/lib/netlist/devices/nld_9316_base.hxx index 3e8e977cb87..e0659493cf1 100644 --- a/src/lib/netlist/devices/nld_9316_base.hxx +++ b/src/lib/netlist/devices/nld_9316_base.hxx @@ -14,10 +14,10 @@ namespace netlist { template <unsigned N> - static constexpr unsigned rollover(unsigned v) { return v <= N ? v : 0; } + static constexpr unsigned rollover(unsigned v) noexcept { return v <= N ? v : 0; } template <> - constexpr unsigned rollover<15>(unsigned v) { return v & 15; } + constexpr unsigned rollover<15>(unsigned v) noexcept { return v & 15; } template <typename D> NETLIB_OBJECT(9316_base) @@ -25,11 +25,11 @@ namespace netlist NETLIB_CONSTRUCTOR(9316_base) , m_CLK(*this, "CLK", NETLIB_DELEGATE(clk)) , m_ENT(*this, "ENT", NETLIB_DELEGATE(other)) - , m_RC(*this, "RC") , m_LOADQ(*this, "LOADQ", NETLIB_DELEGATE(other)) , m_ENP(*this, "ENP", NETLIB_DELEGATE(other)) , m_CLRQ(*this, "CLRQ", NETLIB_DELEGATE(other)) , m_ABCD(*this, {"A", "B", "C", "D"}, NETLIB_DELEGATE(abcd)) + , m_RC(*this, "RC") , m_Q(*this, { "QA", "QB", "QC", "QD" }) , m_cnt(*this, "m_cnt", 0) , m_abcd(*this, "m_abcd", 0) @@ -73,15 +73,15 @@ namespace netlist { if (!D::ASYNC::value && !m_CLRQ()) { + m_Q.push(0, D::tCLR::value(0)); m_cnt = 0; - m_Q.push(m_cnt, D::tCLR::value(0)); } else { - const auto cnt = (m_loadq ? rollover<D::MAXCNT::value>(m_cnt + 1) : m_abcd); + const unsigned cnt(m_loadq ? rollover<D::MAXCNT::value>(m_cnt + 1) : m_abcd); m_RC.push(m_ent && (cnt == D::MAXCNT::value), D::tRC::value(0)); m_Q.push(cnt, D::tLDCNT::value(0)); - m_cnt = static_cast<unsigned>(cnt); + m_cnt = cnt; } } @@ -93,22 +93,22 @@ namespace netlist logic_input_t m_CLK; logic_input_t m_ENT; - logic_output_t m_RC; - logic_input_t m_LOADQ; logic_input_t m_ENP; logic_input_t m_CLRQ; object_array_t<logic_input_t, 4> m_ABCD; + + logic_output_t m_RC; object_array_t<logic_output_t, 4> m_Q; /* counter state */ state_var<unsigned> m_cnt; /* cached pins */ state_var<unsigned> m_abcd; - state_var_sig m_loadq; - state_var_sig m_ent; + state_var<unsigned> m_loadq; + state_var<unsigned> m_ent; nld_power_pins m_power_pins; }; diff --git a/src/lib/netlist/devices/nld_9321.cpp b/src/lib/netlist/devices/nld_9321.cpp index 5adffc3a313..29d63b2b3fc 100644 --- a/src/lib/netlist/devices/nld_9321.cpp +++ b/src/lib/netlist/devices/nld_9321.cpp @@ -50,7 +50,7 @@ namespace netlist NETLIB_HANDLERI(e) { - m_enable = m_E() ? 0 : 1; + m_enable = m_E() ? false : true; m_o = (m_A[1]() << 1) | m_A[0](); for (std::size_t i=0; i<4; i++) m_D[i].push((i == m_o && m_enable) ? 0 : 1, NLTIME_FROM_NS(18)); diff --git a/src/lib/netlist/devices/nld_log.cpp b/src/lib/netlist/devices/nld_log.cpp index 75a22ddca32..c2a6523f64a 100644 --- a/src/lib/netlist/devices/nld_log.cpp +++ b/src/lib/netlist/devices/nld_log.cpp @@ -116,8 +116,8 @@ namespace netlist netlist_time_ext t; nl_fptype v; }; - static const std::size_t BUF_SIZE=16384; - static const std::size_t BUFFERS=4; + static constexpr std::size_t BUF_SIZE=16384; + static constexpr std::size_t BUFFERS=4; analog_input_t m_I; plib::ofstream m_strm; plib::putf8_writer m_writer; diff --git a/src/lib/netlist/devices/nld_roms.cpp b/src/lib/netlist/devices/nld_roms.cpp index de440b4a8d2..e2e4ba4eb77 100644 --- a/src/lib/netlist/devices/nld_roms.cpp +++ b/src/lib/netlist/devices/nld_roms.cpp @@ -41,7 +41,7 @@ namespace netlist } private: - inline NETLIB_HANDLERI(oe1) + NETLIB_HANDLERI(oe1) { m_enable_lo = m_OE1(); uint8_t o = m_enable_lo ? m_latched_rom : 0; @@ -52,7 +52,7 @@ namespace netlist } } - inline NETLIB_HANDLERI(oe2) + NETLIB_HANDLERI(oe2) { m_enable_hi = m_OE2(); uint8_t o = m_enable_hi ? m_latched_rom : 0; @@ -63,7 +63,7 @@ namespace netlist } } - inline NETLIB_HANDLERI(addr) + NETLIB_HANDLERI(addr) { if (!m_ARQ()) { @@ -96,6 +96,72 @@ namespace netlist nld_power_pins m_power_pins; }; + NETLIB_OBJECT(mcm14524_rom) + { + NETLIB_CONSTRUCTOR_MODEL(mcm14524_rom, "CD4XXX") + , m_enabled(*this, "m_enabled", true) + , m_latched_rom(*this, "m_latched_rom", 0) + , m_A(*this, 1, "A{}", NETLIB_DELEGATE(addr)) + , m_CLK(*this, "CLK", NETLIB_DELEGATE(addr)) + , m_clk_old(*this, "m_clk_old", true) + , m_EN(*this, "EN", NETLIB_DELEGATE(en)) + , m_B(*this, 1, "B{}", 0) + , m_ROM(*this, "ROM") + , m_taccc(*this, "m_taccc", netlist_time::from_nsec(1350)) + , m_taccen(*this, "m_taccen", netlist_time::from_nsec(245)) + , m_power_pins(*this, NETLIB_DELEGATE(vdd_vss)) + { + } + + private: + NETLIB_HANDLERI(en) + { + m_enabled = m_EN(); + uint8_t o = m_enabled ? m_latched_rom : 0; // outputs are forced to 0 by enable going low; this chip does not have tri-state outputs! + for (std::size_t i=0; i<4; i++) + { + m_B[i].push((o >> i) & 1, m_taccen); + } + } + + NETLIB_HANDLERI(addr) + { + if (!m_CLK() && m_clk_old) // latch on falling edge + { + const auto addr = m_A(); + m_latched_rom = m_ROM[addr]; + } + m_clk_old = m_CLK(); + uint8_t o = m_enabled ? m_latched_rom : 0; // outputs are forced to 0 by enable going low; this chip does not have tri-state outputs! + for (std::size_t i=0; i<4; i++) + { + m_B[i].push((o >> i) & 1, m_taccc); + } + } + + NETLIB_HANDLERI(vdd_vss) + { + auto d = m_power_pins.VCC()() - m_power_pins.GND()(); + if (d > 0.1) // avoid unrealistic values + { + m_taccc = netlist_time::from_nsec(gsl::narrow_cast<unsigned>(7615.5 / d - 181)); + m_taccen = netlist_time::from_nsec(gsl::narrow_cast<unsigned>(1292.5 / d - 14.6)); + } + } + + state_var<bool> m_enabled; + state_var<uint8_t> m_latched_rom; + object_array_t<logic_input_t, 8> m_A; + logic_input_t m_CLK; + state_var<bool> m_clk_old; + logic_input_t m_EN; + object_array_t<tristate_output_t, 4> m_B; + param_rom_t<uint8_t, 8, 4> m_ROM; + state_var<netlist_time> m_taccc; // propagation time for data vs CLK + state_var<netlist_time> m_taccen; // propagation time for data vs /EN + nld_power_pins m_power_pins; + }; + template <typename D> NETLIB_OBJECT(generic_prom) { @@ -119,7 +185,7 @@ namespace netlist private: template <std::size_t N> - inline NETLIB_HANDLERI(ce) + NETLIB_HANDLERI(ce) { using cet = typename D::chip_enable_time; m_enabled = (m_CEQ() == D::chip_enable_mask::value); @@ -148,7 +214,6 @@ namespace netlist } - inline NETLIB_HANDLERI(addr) { if (m_enabled) @@ -230,12 +295,14 @@ namespace netlist using NETLIB_NAME(74S287) = NETLIB_NAME(generic_prom)<desc_74S287>; // 1024 bits, 32x32, used as 256x4 using NETLIB_NAME(2716) = NETLIB_NAME(generic_prom)<desc_2716>; // CE2Q = OE, CE1Q = CE using NETLIB_NAME(MK28000) = NETLIB_NAME(mk28000_prom); // 16384 bits, either 2048x8 or 4096x4, determined by OE1/OE2 use + using NETLIB_NAME(MCM14524) = NETLIB_NAME(mcm14524_rom); // 1024 bits, 256x4, latched address NETLIB_DEVICE_IMPL(82S126, "PROM_82S126", "+CE1Q,+CE2Q,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,@VCC,@GND") NETLIB_DEVICE_IMPL(74S287, "PROM_74S287", "+CE1Q,+CE2Q,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,@VCC,@GND") NETLIB_DEVICE_IMPL(82S123, "PROM_82S123", "+CEQ,+A0,+A1,+A2,+A3,+A4,@VCC,@GND") NETLIB_DEVICE_IMPL(2716, "EPROM_2716", "+CE2Q,+CE1Q,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10,@VCC,@GND") NETLIB_DEVICE_IMPL(MK28000, "PROM_MK28000", "+OE1,+OE2,+ARQ,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10,+A11,@VCC,@GND") + NETLIB_DEVICE_IMPL(MCM14524, "ROM_MCM14524", "+EN,+CLK,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,@VCC,@GND") } //namespace devices } // namespace netlist diff --git a/src/lib/netlist/devices/nld_system.cpp b/src/lib/netlist/devices/nld_system.cpp index c3f4cd5d270..36ae9bc6e35 100644 --- a/src/lib/netlist/devices/nld_system.cpp +++ b/src/lib/netlist/devices/nld_system.cpp @@ -62,7 +62,7 @@ namespace devices NETLIB_RESETI() { m_cnt = 0; - m_off = netlist_time::from_fp<decltype(m_offset())>(m_offset()); + m_off = netlist_time::from_fp<param_fp_t::value_type>(m_offset()); m_feedback.set_delegate(NETLIB_DELEGATE(first)); } //NETLIB_UPDATE_PARAMI(); diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp index 51eb0fbf5cd..e8cc27fc987 100644 --- a/src/lib/netlist/devices/nlid_proxy.cpp +++ b/src/lib/netlist/devices/nlid_proxy.cpp @@ -21,7 +21,7 @@ namespace netlist // nld_base_proxy // ----------------------------------------------------------------------------- - static const std::array<std::pair<const char *, const char *>, 3> power_syms = {{ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}}}; + static constexpr std::array<std::pair<const char *, const char *>, 3> power_syms = {{ {"VCC", "VEE"}, {"VCC", "GND"}, {"VDD", "VSS"}}}; nld_base_proxy::nld_base_proxy(netlist_state_t &anetlist, const pstring &name, const logic_t *inout_proxied) @@ -124,19 +124,9 @@ namespace netlist { register_subalias("Q", "RN.1"); - log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name()); - if (anetlist.is_extended_validation()) - { - // During validation, don't connect to terminals found - // This will cause terminals not connected to a rail net to - // fail connection stage. - connect(m_RN.N(), m_RP.P()); - } - else - { - connect(m_RN.N(), *m_tn); - connect(m_RP.P(), *m_tp); - } + connect(m_RN.N(), *m_tn); + connect(m_RP.P(), *m_tp); + connect(m_RN.P(), m_RP.N()); } diff --git a/src/lib/netlist/devices/nlid_system.h b/src/lib/netlist/devices/nlid_system.h index 0e2857a3508..c1c44e764e1 100644 --- a/src/lib/netlist/devices/nlid_system.h +++ b/src/lib/netlist/devices/nlid_system.h @@ -196,10 +196,10 @@ namespace devices /// Consider the following mixing stage /// /// R1 - /// S1 >-----1RRRR2---------+ + /// I1 >-----1RRRR2---------+ /// | /// R2 | - /// S2 >-----1RRRR2---------+----------> Out + /// I2 >-----1RRRR2---------+----------> Out /// | /// R /// R3 R @@ -207,45 +207,37 @@ namespace devices /// | /// GND /// - /// With OPTIMIZE_FRONTIER(R2.2, R3, R2) this becomes: + /// With OPTIMIZE_FRONTIER(R2.1, R2, RX) where RX is the impedance of the + /// output connected to I2 this becomes: /// /// R1 - /// S1 >-----1RRRR2--------------------------------+ + /// I1 >-----1RRRR2--------------------------------+ /// | - /// ########################## | - /// R2 # R2 # | - /// S2 >-----1RRRR2-----+-->AnIn AnOut>--RRRR------+----------> Out - /// # | # | - /// # R # R - /// # R R3 # R3 R - /// # R # R - /// # | # | - /// # GND Frontier # GND - /// # # - /// ########################## + /// ########################## | + /// # RX # R2 | + /// I2 >----->--+-AnIn AnOut>--RRRR--->---1RRRR2---+----------> Out + /// # | # | + /// # R # R + /// # R R2 # R3 R + /// # R # R + /// # | # | + /// # GND Frontier # GND + /// # # + /// ########################## /// /// As a result, provided there are no other connections between the parts /// generating S1 and S2 the "S2 part" will now have a separate solver. /// - /// The size (aka number of nets) of the solver for S1 will be smaller. - /// The size of the solver for S2 and the rest of the circuit will be smaller + /// The size (aka number of nets) of the solver for I1 will be smaller. + /// The size of the solver for I2 and the rest of the circuit will be smaller /// as well. /// - /// - /// - /// - /// - /// - /// - /// - /// - /// NETLIB_OBJECT(frontier) { NETLIB_CONSTRUCTOR(frontier) - , m_RIN(*this, "m_RIN", NETLIB_DELEGATE(input)) - , m_ROUT(*this, "m_ROUT", NETLIB_DELEGATE(input)) + , m_RIN(*this, "m_RIN", NETLIB_DELEGATE(input)) // FIXME: does not look right + , m_ROUT(*this, "m_ROUT", NETLIB_DELEGATE(input)) // FIXME: does not look right , m_I(*this, "_I", NETLIB_DELEGATE(input)) , m_Q(*this, "_Q") , m_p_RIN(*this, "RIN", nlconst::magic(1.0e6)) @@ -264,6 +256,7 @@ namespace devices private: NETLIB_RESETI() { + //printf("%s: in %f out %f\n", name().c_str(), m_p_RIN(), m_p_ROUT()); m_RIN.set_G_V_I(plib::reciprocal(m_p_RIN()),0,0); m_ROUT.set_G_V_I(plib::reciprocal(m_p_ROUT()),0,0); } @@ -566,7 +559,7 @@ namespace devices private: NETLIB_HANDLERI(input) { - nl_fptype val = m_dis.var()(m_mt.var()); + nl_fptype val = m_dis()(m_mt()); m_T.change_state([this, val]() { m_T.set_G_V_I(plib::reciprocal(m_RI()), val, nlconst::zero()); diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp index 8b5e3a937c2..db2471a704e 100644 --- a/src/lib/netlist/devices/nlid_truthtable.cpp +++ b/src/lib/netlist/devices/nlid_truthtable.cpp @@ -52,6 +52,8 @@ namespace devices /* FIXME: the family should provide the names of the power-terminals! */ , m_power_pins(*this) { + m_activate = activate_delegate(& NETLIB_NAME(truthtable_t) :: incdec_active, this); + set_hint_deactivate(true); init(desc); } @@ -73,7 +75,7 @@ namespace devices #endif } for (auto &q : m_Q) - if (q.has_net() && q.net().has_connections()) + if (q.has_net() && !exec().nlstate().core_terms(q.net()).empty()) active_outputs++; set_active_outputs(active_outputs); } @@ -100,16 +102,18 @@ namespace devices } #endif - void inc_active() noexcept override + void incdec_active(bool a) noexcept { - process<false>(); - } - - void dec_active() noexcept override - { - for (std::size_t i = 0; i< m_NI; i++) - m_I[i].inactivate(); - m_ign = (1<<m_NI)-1; + if (a) + { + process<false>(); + } + else + { + for (std::size_t i = 0; i< m_NI; i++) + m_I[i].inactivate(); + m_ign = (1<<m_NI)-1; + } } template<bool doOUT> @@ -371,8 +375,6 @@ namespace devices template<std::size_t m_NI, std::size_t m_NO> void NETLIB_NAME(truthtable_t)<m_NI, m_NO>::init(const std::vector<pstring> &desc) { - set_hint_deactivate(true); - pstring header = desc[0]; std::vector<pstring> io(plib::psplit(header,'|')); diff --git a/src/lib/netlist/examples/2N6027.cpp b/src/lib/netlist/examples/2n6027.cpp index bfad3c065ec..bfad3c065ec 100644 --- a/src/lib/netlist/examples/2N6027.cpp +++ b/src/lib/netlist/examples/2n6027.cpp diff --git a/src/lib/netlist/examples/LM3900_test.cpp b/src/lib/netlist/examples/lm3900_test.cpp index a48a2cd8a78..a48a2cd8a78 100644 --- a/src/lib/netlist/examples/LM3900_test.cpp +++ b/src/lib/netlist/examples/lm3900_test.cpp diff --git a/src/lib/netlist/generated/lib_entries.hxx b/src/lib/netlist/generated/lib_entries.hxx index da6ad55a0a3..debc626fd47 100755 --- a/src/lib/netlist/generated/lib_entries.hxx +++ b/src/lib/netlist/generated/lib_entries.hxx @@ -60,14 +60,18 @@ LIB_ENTRY(CD4017) LIB_ENTRY(CD4020) LIB_ENTRY(CD4022) LIB_ENTRY(CD4024) +LIB_ENTRY(CD4029) +LIB_ENTRY(CD4042) LIB_ENTRY(CD4053_GATE) LIB_ENTRY(CD4066_GATE) +LIB_ENTRY(CD4076) LIB_ENTRY(CD4316_GATE) LIB_ENTRY(CS) LIB_ENTRY(D) LIB_ENTRY(L) LIB_ENTRY(LVCCS) LIB_ENTRY(MC1455P) +LIB_ENTRY(MCM14524) LIB_ENTRY(MK28000) LIB_ENTRY(MM5837) LIB_ENTRY(MOSFET) diff --git a/src/lib/netlist/generated/nld_devinc.h b/src/lib/netlist/generated/nld_devinc.h index f5b14563db8..53a496be2d8 100755 --- a/src/lib/netlist/generated/nld_devinc.h +++ b/src/lib/netlist/generated/nld_devinc.h @@ -103,7 +103,7 @@ NET_REGISTER_DEVEXT(CS, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: ../devices/nld_2102A.cpp +// Source: ../devices/nld_2102a.cpp // --------------------------------------------------------------------- // usage : RAM_2102A(name, CEQ, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, RWQ, DI) @@ -154,6 +154,24 @@ NET_REGISTER_DEVEXT(CD4024, __VA_ARGS__) // --------------------------------------------------------------------- +// Source: ../devices/nld_4029.cpp +// --------------------------------------------------------------------- + +// usage : CD4029(name, PE, J1, J2, J3, J4, CI, UD, BD, CLK) +// auto connect: VCC, GND +#define CD4029(...) \ + NET_REGISTER_DEVEXT(CD4029, __VA_ARGS__) + +// --------------------------------------------------------------------- +// Source: ../devices/nld_4042.cpp +// --------------------------------------------------------------------- + +// usage : CD4042(name, D1, D2, D3, D4, POL, CLK) +// auto connect: VCC, GND +#define CD4042(...) \ + NET_REGISTER_DEVEXT(CD4042, __VA_ARGS__) + +// --------------------------------------------------------------------- // Source: ../devices/nld_4053.cpp // --------------------------------------------------------------------- @@ -170,6 +188,15 @@ NET_REGISTER_DEVEXT(CD4066_GATE, __VA_ARGS__) // --------------------------------------------------------------------- +// Source: ../devices/nld_4076.cpp +// --------------------------------------------------------------------- + +// usage : CD4076(name, I1, I2, I3, I4, ID1, ID2, OD1, OD2) +// auto connect: VCC, GND +#define CD4076(...) \ + NET_REGISTER_DEVEXT(CD4076, __VA_ARGS__) + +// --------------------------------------------------------------------- // Source: ../devices/nld_4316.cpp // --------------------------------------------------------------------- @@ -493,7 +520,7 @@ NET_REGISTER_DEVEXT(TTL_8277, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: ../devices/nld_82S115.cpp +// Source: ../devices/nld_82s115.cpp // --------------------------------------------------------------------- // usage : PROM_82S115(name, CE1Q, CE2, A0, A1, A2, A3, A4, A5, A6, A7, A8, STROBE) @@ -502,7 +529,7 @@ NET_REGISTER_DEVEXT(PROM_82S115, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: ../devices/nld_82S16.cpp +// Source: ../devices/nld_82s16.cpp // --------------------------------------------------------------------- // usage : TTL_82S16(name, ) @@ -652,6 +679,11 @@ #define PROM_MK28000(...) \ NET_REGISTER_DEVEXT(PROM_MK28000, __VA_ARGS__) +// usage : ROM_MCM14524(name, EN, CLK, A0, A1, A2, A3, A4, A5, A6, A7) +// auto connect: VCC, GND +#define ROM_MCM14524(...) \ + NET_REGISTER_DEVEXT(ROM_MCM14524, __VA_ARGS__) + // --------------------------------------------------------------------- // Source: ../devices/nld_schmitt.cpp // --------------------------------------------------------------------- @@ -769,6 +801,14 @@ #define CD4011_GATE(...) \ NET_REGISTER_DEVEXT(CD4011_GATE, __VA_ARGS__) +// usage : CD4030_GATE(name, ) +#define CD4030_GATE(...) \ + NET_REGISTER_DEVEXT(CD4030_GATE, __VA_ARGS__) + +// usage : CD4049_GATE(name, ) +#define CD4049_GATE(...) \ + NET_REGISTER_DEVEXT(CD4049_GATE, __VA_ARGS__) + // usage : CD4069_GATE(name, ) #define CD4069_GATE(...) \ NET_REGISTER_DEVEXT(CD4069_GATE, __VA_ARGS__) @@ -777,6 +817,14 @@ #define CD4070_GATE(...) \ NET_REGISTER_DEVEXT(CD4070_GATE, __VA_ARGS__) +// usage : CD4071_GATE(name, ) +#define CD4071_GATE(...) \ + NET_REGISTER_DEVEXT(CD4071_GATE, __VA_ARGS__) + +// usage : CD4081_GATE(name, ) +#define CD4081_GATE(...) \ + NET_REGISTER_DEVEXT(CD4081_GATE, __VA_ARGS__) + // usage : CD4001_DIP(name, ) #define CD4001_DIP(...) \ NET_REGISTER_DEVEXT(CD4001_DIP, __VA_ARGS__) @@ -785,6 +833,14 @@ #define CD4011_DIP(...) \ NET_REGISTER_DEVEXT(CD4011_DIP, __VA_ARGS__) +// usage : CD4030_DIP(name, ) +#define CD4030_DIP(...) \ + NET_REGISTER_DEVEXT(CD4030_DIP, __VA_ARGS__) + +// usage : CD4049_DIP(name, ) +#define CD4049_DIP(...) \ + NET_REGISTER_DEVEXT(CD4049_DIP, __VA_ARGS__) + // usage : CD4069_DIP(name, ) #define CD4069_DIP(...) \ NET_REGISTER_DEVEXT(CD4069_DIP, __VA_ARGS__) @@ -793,6 +849,14 @@ #define CD4070_DIP(...) \ NET_REGISTER_DEVEXT(CD4070_DIP, __VA_ARGS__) +// usage : CD4071_DIP(name, ) +#define CD4071_DIP(...) \ + NET_REGISTER_DEVEXT(CD4071_DIP, __VA_ARGS__) + +// usage : CD4081_DIP(name, ) +#define CD4081_DIP(...) \ + NET_REGISTER_DEVEXT(CD4081_DIP, __VA_ARGS__) + // usage : CD4006_DIP(name, ) #define CD4006_DIP(...) \ NET_REGISTER_DEVEXT(CD4006_DIP, __VA_ARGS__) @@ -817,6 +881,14 @@ #define CD4024_DIP(...) \ NET_REGISTER_DEVEXT(CD4024_DIP, __VA_ARGS__) +// usage : CD4029_DIP(name, ) +#define CD4029_DIP(...) \ + NET_REGISTER_DEVEXT(CD4029_DIP, __VA_ARGS__) + +// usage : CD4042_DIP(name, ) +#define CD4042_DIP(...) \ + NET_REGISTER_DEVEXT(CD4042_DIP, __VA_ARGS__) + // usage : CD4053_DIP(name, ) #define CD4053_DIP(...) \ NET_REGISTER_DEVEXT(CD4053_DIP, __VA_ARGS__) @@ -829,6 +901,10 @@ #define CD4016_DIP(...) \ NET_REGISTER_DEVEXT(CD4016_DIP, __VA_ARGS__) +// usage : CD4076_DIP(name, ) +#define CD4076_DIP(...) \ + NET_REGISTER_DEVEXT(CD4076_DIP, __VA_ARGS__) + // usage : CD4316_DIP(name, ) #define CD4316_DIP(...) \ NET_REGISTER_DEVEXT(CD4316_DIP, __VA_ARGS__) @@ -893,6 +969,10 @@ #define LM324_DIP(...) \ NET_REGISTER_DEVEXT(LM324_DIP, __VA_ARGS__) +// usage : LM348_DIP(name, ) +#define LM348_DIP(...) \ + NET_REGISTER_DEVEXT(LM348_DIP, __VA_ARGS__) + // usage : LM358_DIP(name, ) #define LM358_DIP(...) \ NET_REGISTER_DEVEXT(LM358_DIP, __VA_ARGS__) @@ -989,6 +1069,10 @@ #define PROM_MK28000_DIP(...) \ NET_REGISTER_DEVEXT(PROM_MK28000_DIP, __VA_ARGS__) +// usage : ROM_MCM14524_DIP(name, ) +#define ROM_MCM14524_DIP(...) \ + NET_REGISTER_DEVEXT(ROM_MCM14524_DIP, __VA_ARGS__) + // usage : RAM_2102A_DIP(name, ) #define RAM_2102A_DIP(...) \ NET_REGISTER_DEVEXT(RAM_2102A_DIP, __VA_ARGS__) diff --git a/src/lib/netlist/generated/nlm_modules_lib.cpp b/src/lib/netlist/generated/nlm_modules_lib.cpp index 7f91075ac40..7162c84023d 100755 --- a/src/lib/netlist/generated/nlm_modules_lib.cpp +++ b/src/lib/netlist/generated/nlm_modules_lib.cpp @@ -1,7 +1,7 @@ // license:CC0 // copyright-holders:Couriersud -// File programmatically created Sun Sep 13 20:49:39 2020 +// File programmatically created Wed Sep 30 11:02:38 2020 #include "devices/net_lib.h" diff --git a/src/lib/netlist/generated/static_solvers.cpp b/src/lib/netlist/generated/static_solvers.cpp index 367af35bbb9..ce58a075fa7 100644 --- a/src/lib/netlist/generated/static_solvers.cpp +++ b/src/lib/netlist/generated/static_solvers.cpp @@ -393,6 +393,1021 @@ static void nl_gcr_1250f340dea396ae_22_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// astrob +static void nl_gcr_13833bf8c127deaa_154_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + double m_A97(0.0); + double m_A98(0.0); + double m_A99(0.0); + double m_A100(0.0); + double m_A101(0.0); + double m_A102(0.0); + double m_A103(0.0); + double m_A104(0.0); + double m_A105(0.0); + double m_A106(0.0); + double m_A107(0.0); + double m_A108(0.0); + double m_A109(0.0); + double m_A110(0.0); + double m_A111(0.0); + double m_A112(0.0); + double m_A113(0.0); + double m_A114(0.0); + double m_A115(0.0); + double m_A116(0.0); + double m_A117(0.0); + double m_A118(0.0); + double m_A119(0.0); + double m_A120(0.0); + double m_A121(0.0); + double m_A122(0.0); + double m_A123(0.0); + double m_A124(0.0); + double m_A125(0.0); + double m_A126(0.0); + double m_A127(0.0); + double m_A128(0.0); + double m_A129(0.0); + double m_A130(0.0); + double m_A131(0.0); + double m_A132(0.0); + double m_A133(0.0); + double m_A134(0.0); + double m_A135(0.0); + double m_A136(0.0); + double m_A137(0.0); + double m_A138(0.0); + double m_A139(0.0); + double m_A140(0.0); + double m_A141(0.0); + double m_A142(0.0); + double m_A143(0.0); + double m_A144(0.0); + double m_A145(0.0); + double m_A146(0.0); + double m_A147(0.0); + double m_A148(0.0); + double m_A149(0.0); + double m_A150(0.0); + double m_A151(0.0); + double m_A152(0.0); + double m_A153(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A3 += go[2]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 -= go[3] * *cnV[3]; + m_A4 += gt[4]; + m_A4 += gt[5]; + m_A5 += go[4]; + double RHS2 = Idr[4]; + RHS2 += Idr[5]; + RHS2 -= go[5] * *cnV[5]; + m_A6 += gt[6]; + m_A6 += gt[7]; + m_A7 += go[6]; + double RHS3 = Idr[6]; + RHS3 += Idr[7]; + RHS3 -= go[7] * *cnV[7]; + m_A8 += gt[8]; + m_A8 += gt[9]; + m_A9 += go[8]; + m_A10 += go[9]; + double RHS4 = Idr[8]; + RHS4 += Idr[9]; + m_A11 += gt[10]; + m_A11 += gt[11]; + m_A11 += gt[12]; + m_A12 += go[10]; + double RHS5 = Idr[10]; + RHS5 += Idr[11]; + RHS5 += Idr[12]; + RHS5 -= go[11] * *cnV[11]; + RHS5 -= go[12] * *cnV[12]; + m_A13 += gt[13]; + m_A13 += gt[14]; + m_A13 += gt[15]; + m_A13 += gt[16]; + m_A14 += go[13]; + m_A14 += go[14]; + m_A15 += go[15]; + double RHS6 = Idr[13]; + RHS6 += Idr[14]; + RHS6 += Idr[15]; + RHS6 += Idr[16]; + RHS6 -= go[16] * *cnV[16]; + m_A16 += gt[17]; + m_A16 += gt[18]; + m_A16 += gt[19]; + m_A16 += gt[20]; + m_A16 += gt[21]; + m_A16 += gt[22]; + m_A18 += go[17]; + m_A17 += go[18]; + double RHS7 = Idr[17]; + RHS7 += Idr[18]; + RHS7 += Idr[19]; + RHS7 += Idr[20]; + RHS7 += Idr[21]; + RHS7 += Idr[22]; + RHS7 -= go[19] * *cnV[19]; + RHS7 -= go[20] * *cnV[20]; + RHS7 -= go[21] * *cnV[21]; + RHS7 -= go[22] * *cnV[22]; + m_A19 += gt[23]; + m_A19 += gt[24]; + m_A19 += gt[25]; + m_A20 += go[23]; + double RHS8 = Idr[23]; + RHS8 += Idr[24]; + RHS8 += Idr[25]; + RHS8 -= go[24] * *cnV[24]; + RHS8 -= go[25] * *cnV[25]; + m_A21 += gt[26]; + m_A21 += gt[27]; + m_A21 += gt[28]; + m_A22 += go[26]; + double RHS9 = Idr[26]; + RHS9 += Idr[27]; + RHS9 += Idr[28]; + RHS9 -= go[27] * *cnV[27]; + RHS9 -= go[28] * *cnV[28]; + m_A23 += gt[29]; + m_A23 += gt[30]; + m_A23 += gt[31]; + m_A24 += go[29]; + double RHS10 = Idr[29]; + RHS10 += Idr[30]; + RHS10 += Idr[31]; + RHS10 -= go[30] * *cnV[30]; + RHS10 -= go[31] * *cnV[31]; + m_A25 += gt[32]; + m_A25 += gt[33]; + m_A25 += gt[34]; + m_A26 += go[32]; + double RHS11 = Idr[32]; + RHS11 += Idr[33]; + RHS11 += Idr[34]; + RHS11 -= go[33] * *cnV[33]; + RHS11 -= go[34] * *cnV[34]; + m_A27 += gt[35]; + m_A27 += gt[36]; + m_A27 += gt[37]; + m_A28 += go[35]; + double RHS12 = Idr[35]; + RHS12 += Idr[36]; + RHS12 += Idr[37]; + RHS12 -= go[36] * *cnV[36]; + RHS12 -= go[37] * *cnV[37]; + m_A29 += gt[38]; + m_A29 += gt[39]; + m_A30 += go[38]; + double RHS13 = Idr[38]; + RHS13 += Idr[39]; + RHS13 -= go[39] * *cnV[39]; + m_A31 += gt[40]; + m_A31 += gt[41]; + m_A31 += gt[42]; + m_A32 += go[40]; + double RHS14 = Idr[40]; + RHS14 += Idr[41]; + RHS14 += Idr[42]; + RHS14 -= go[41] * *cnV[41]; + RHS14 -= go[42] * *cnV[42]; + m_A33 += gt[43]; + m_A33 += gt[44]; + m_A34 += go[43]; + double RHS15 = Idr[43]; + RHS15 += Idr[44]; + RHS15 -= go[44] * *cnV[44]; + m_A35 += gt[45]; + m_A35 += gt[46]; + m_A36 += go[45]; + double RHS16 = Idr[45]; + RHS16 += Idr[46]; + RHS16 -= go[46] * *cnV[46]; + m_A37 += gt[47]; + m_A37 += gt[48]; + m_A38 += go[47]; + double RHS17 = Idr[47]; + RHS17 += Idr[48]; + RHS17 -= go[48] * *cnV[48]; + m_A39 += gt[49]; + m_A39 += gt[50]; + m_A40 += go[49]; + double RHS18 = Idr[49]; + RHS18 += Idr[50]; + RHS18 -= go[50] * *cnV[50]; + m_A41 += gt[51]; + m_A41 += gt[52]; + m_A42 += go[51]; + double RHS19 = Idr[51]; + RHS19 += Idr[52]; + RHS19 -= go[52] * *cnV[52]; + m_A43 += gt[53]; + m_A43 += gt[54]; + m_A44 += go[53]; + double RHS20 = Idr[53]; + RHS20 += Idr[54]; + RHS20 -= go[54] * *cnV[54]; + m_A45 += gt[55]; + m_A45 += gt[56]; + m_A45 += gt[57]; + m_A45 += gt[58]; + m_A45 += gt[59]; + m_A46 += go[55]; + m_A48 += go[56]; + m_A47 += go[57]; + double RHS21 = Idr[55]; + RHS21 += Idr[56]; + RHS21 += Idr[57]; + RHS21 += Idr[58]; + RHS21 += Idr[59]; + RHS21 -= go[58] * *cnV[58]; + RHS21 -= go[59] * *cnV[59]; + m_A49 += gt[60]; + m_A49 += gt[61]; + m_A49 += gt[62]; + m_A50 += go[60]; + double RHS22 = Idr[60]; + RHS22 += Idr[61]; + RHS22 += Idr[62]; + RHS22 -= go[61] * *cnV[61]; + RHS22 -= go[62] * *cnV[62]; + m_A51 += gt[63]; + m_A51 += gt[64]; + m_A52 += go[63]; + double RHS23 = Idr[63]; + RHS23 += Idr[64]; + RHS23 -= go[64] * *cnV[64]; + m_A55 += gt[65]; + m_A55 += gt[66]; + m_A55 += gt[67]; + m_A55 += gt[68]; + m_A54 += go[65]; + m_A53 += go[66]; + double RHS24 = Idr[65]; + RHS24 += Idr[66]; + RHS24 += Idr[67]; + RHS24 += Idr[68]; + RHS24 -= go[67] * *cnV[67]; + RHS24 -= go[68] * *cnV[68]; + m_A57 += gt[69]; + m_A57 += gt[70]; + m_A58 += go[69]; + double RHS25 = Idr[69]; + RHS25 += Idr[70]; + RHS25 -= go[70] * *cnV[70]; + m_A59 += gt[71]; + m_A59 += gt[72]; + m_A59 += gt[73]; + m_A60 += go[71]; + double RHS26 = Idr[71]; + RHS26 += Idr[72]; + RHS26 += Idr[73]; + RHS26 -= go[72] * *cnV[72]; + RHS26 -= go[73] * *cnV[73]; + m_A61 += gt[74]; + m_A61 += gt[75]; + m_A61 += gt[76]; + m_A62 += go[74]; + double RHS27 = Idr[74]; + RHS27 += Idr[75]; + RHS27 += Idr[76]; + RHS27 -= go[75] * *cnV[75]; + RHS27 -= go[76] * *cnV[76]; + m_A63 += gt[77]; + m_A63 += gt[78]; + m_A63 += gt[79]; + m_A64 += go[77]; + double RHS28 = Idr[77]; + RHS28 += Idr[78]; + RHS28 += Idr[79]; + RHS28 -= go[78] * *cnV[78]; + RHS28 -= go[79] * *cnV[79]; + m_A65 += gt[80]; + m_A65 += gt[81]; + m_A67 += go[80]; + m_A66 += go[81]; + double RHS29 = Idr[80]; + RHS29 += Idr[81]; + m_A68 += gt[82]; + m_A68 += gt[83]; + m_A70 += go[82]; + m_A69 += go[83]; + double RHS30 = Idr[82]; + RHS30 += Idr[83]; + m_A71 += gt[84]; + m_A71 += gt[85]; + m_A73 += go[84]; + m_A72 += go[85]; + double RHS31 = Idr[84]; + RHS31 += Idr[85]; + m_A77 += gt[86]; + m_A77 += gt[87]; + m_A77 += gt[88]; + m_A77 += gt[89]; + m_A77 += gt[90]; + m_A77 += gt[91]; + m_A77 += gt[92]; + m_A74 += go[86]; + m_A75 += go[87]; + m_A75 += go[88]; + m_A78 += go[89]; + m_A78 += go[90]; + double RHS32 = Idr[86]; + RHS32 += Idr[87]; + RHS32 += Idr[88]; + RHS32 += Idr[89]; + RHS32 += Idr[90]; + RHS32 += Idr[91]; + RHS32 += Idr[92]; + RHS32 -= go[91] * *cnV[91]; + RHS32 -= go[92] * *cnV[92]; + m_A83 += gt[93]; + m_A83 += gt[94]; + m_A83 += gt[95]; + m_A83 += gt[96]; + m_A83 += gt[97]; + m_A83 += gt[98]; + m_A83 += gt[99]; + m_A83 += gt[100]; + m_A83 += gt[101]; + m_A85 += go[93]; + m_A85 += go[94]; + m_A84 += go[95]; + m_A84 += go[96]; + m_A82 += go[97]; + m_A81 += go[98]; + m_A80 += go[99]; + m_A79 += go[100]; + double RHS33 = Idr[93]; + RHS33 += Idr[94]; + RHS33 += Idr[95]; + RHS33 += Idr[96]; + RHS33 += Idr[97]; + RHS33 += Idr[98]; + RHS33 += Idr[99]; + RHS33 += Idr[100]; + RHS33 += Idr[101]; + RHS33 -= go[101] * *cnV[101]; + m_A92 += gt[102]; + m_A92 += gt[103]; + m_A92 += gt[104]; + m_A92 += gt[105]; + m_A92 += gt[106]; + m_A92 += gt[107]; + m_A91 += go[102]; + m_A90 += go[103]; + m_A89 += go[104]; + m_A88 += go[105]; + m_A87 += go[106]; + m_A86 += go[107]; + double RHS34 = Idr[102]; + RHS34 += Idr[103]; + RHS34 += Idr[104]; + RHS34 += Idr[105]; + RHS34 += Idr[106]; + RHS34 += Idr[107]; + m_A95 += gt[108]; + m_A95 += gt[109]; + m_A95 += gt[110]; + m_A95 += gt[111]; + m_A95 += gt[112]; + m_A95 += gt[113]; + m_A95 += gt[114]; + m_A97 += go[108]; + m_A94 += go[109]; + double RHS35 = Idr[108]; + RHS35 += Idr[109]; + RHS35 += Idr[110]; + RHS35 += Idr[111]; + RHS35 += Idr[112]; + RHS35 += Idr[113]; + RHS35 += Idr[114]; + RHS35 -= go[110] * *cnV[110]; + RHS35 -= go[111] * *cnV[111]; + RHS35 -= go[112] * *cnV[112]; + RHS35 -= go[113] * *cnV[113]; + RHS35 -= go[114] * *cnV[114]; + m_A99 += gt[115]; + m_A99 += gt[116]; + m_A98 += go[115]; + m_A100 += go[116]; + double RHS36 = Idr[115]; + RHS36 += Idr[116]; + m_A107 += gt[117]; + m_A107 += gt[118]; + m_A107 += gt[119]; + m_A107 += gt[120]; + m_A107 += gt[121]; + m_A107 += gt[122]; + m_A106 += go[117]; + m_A105 += go[118]; + m_A104 += go[119]; + m_A103 += go[120]; + m_A102 += go[121]; + m_A101 += go[122]; + double RHS37 = Idr[117]; + RHS37 += Idr[118]; + RHS37 += Idr[119]; + RHS37 += Idr[120]; + RHS37 += Idr[121]; + RHS37 += Idr[122]; + m_A112 += gt[123]; + m_A112 += gt[124]; + m_A112 += gt[125]; + m_A112 += gt[126]; + m_A112 += gt[127]; + m_A111 += go[123]; + m_A110 += go[124]; + m_A109 += go[125]; + double RHS38 = Idr[123]; + RHS38 += Idr[124]; + RHS38 += Idr[125]; + RHS38 += Idr[126]; + RHS38 += Idr[127]; + RHS38 -= go[126] * *cnV[126]; + RHS38 -= go[127] * *cnV[127]; + m_A118 += gt[128]; + m_A118 += gt[129]; + m_A118 += gt[130]; + m_A118 += gt[131]; + m_A118 += gt[132]; + m_A118 += gt[133]; + m_A118 += gt[134]; + m_A118 += gt[135]; + m_A118 += gt[136]; + m_A119 += go[128]; + m_A115 += go[129]; + m_A114 += go[130]; + m_A116 += go[131]; + m_A116 += go[132]; + m_A117 += go[133]; + m_A117 += go[134]; + double RHS39 = Idr[128]; + RHS39 += Idr[129]; + RHS39 += Idr[130]; + RHS39 += Idr[131]; + RHS39 += Idr[132]; + RHS39 += Idr[133]; + RHS39 += Idr[134]; + RHS39 += Idr[135]; + RHS39 += Idr[136]; + RHS39 -= go[135] * *cnV[135]; + RHS39 -= go[136] * *cnV[136]; + m_A121 += gt[137]; + m_A121 += gt[138]; + m_A120 += go[137]; + m_A122 += go[138]; + double RHS40 = Idr[137]; + RHS40 += Idr[138]; + m_A127 += gt[139]; + m_A127 += gt[140]; + m_A127 += gt[141]; + m_A127 += gt[142]; + m_A127 += gt[143]; + m_A126 += go[139]; + m_A125 += go[140]; + m_A124 += go[141]; + m_A123 += go[142]; + m_A128 += go[143]; + double RHS41 = Idr[139]; + RHS41 += Idr[140]; + RHS41 += Idr[141]; + RHS41 += Idr[142]; + RHS41 += Idr[143]; + m_A134 += gt[144]; + m_A134 += gt[145]; + m_A134 += gt[146]; + m_A134 += gt[147]; + m_A134 += gt[148]; + m_A134 += gt[149]; + m_A130 += go[144]; + m_A129 += go[145]; + m_A133 += go[146]; + m_A131 += go[147]; + m_A131 += go[148]; + double RHS42 = Idr[144]; + RHS42 += Idr[145]; + RHS42 += Idr[146]; + RHS42 += Idr[147]; + RHS42 += Idr[148]; + RHS42 += Idr[149]; + RHS42 -= go[149] * *cnV[149]; + m_A137 += gt[150]; + m_A137 += gt[151]; + m_A136 += go[150]; + m_A138 += go[151]; + double RHS43 = Idr[150]; + RHS43 += Idr[151]; + m_A153 += gt[152]; + m_A153 += gt[153]; + m_A153 += gt[154]; + m_A153 += gt[155]; + m_A153 += gt[156]; + m_A153 += gt[157]; + m_A153 += gt[158]; + m_A153 += gt[159]; + m_A152 += go[152]; + m_A140 += go[153]; + m_A141 += go[154]; + m_A142 += go[155]; + m_A149 += go[156]; + m_A145 += go[157]; + m_A150 += go[158]; + m_A139 += go[159]; + double RHS44 = Idr[152]; + RHS44 += Idr[153]; + RHS44 += Idr[154]; + RHS44 += Idr[155]; + RHS44 += Idr[156]; + RHS44 += Idr[157]; + RHS44 += Idr[158]; + RHS44 += Idr[159]; + const double f0 = 1.0 / m_A0; + const double f0_33 = -f0 * m_A79; + m_A83 += m_A1 * f0_33; + RHS33 += f0_33 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_33 = -f1 * m_A80; + m_A83 += m_A3 * f1_33; + RHS33 += f1_33 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_33 = -f2 * m_A81; + m_A83 += m_A5 * f2_33; + RHS33 += f2_33 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_33 = -f3 * m_A82; + m_A83 += m_A7 * f3_33; + RHS33 += f3_33 * RHS3; + const double f4 = 1.0 / m_A8; + const double f4_24 = -f4 * m_A53; + m_A55 += m_A9 * f4_24; + m_A56 += m_A10 * f4_24; + RHS24 += f4_24 * RHS4; + const double f4_32 = -f4 * m_A74; + m_A76 += m_A9 * f4_32; + m_A77 += m_A10 * f4_32; + RHS32 += f4_32 * RHS4; + const double f5 = 1.0 / m_A11; + const double f5_24 = -f5 * m_A54; + m_A55 += m_A12 * f5_24; + RHS24 += f5_24 * RHS5; + const double f6 = 1.0 / m_A13; + const double f6_32 = -f6 * m_A75; + m_A77 += m_A14 * f6_32; + m_A78 += m_A15 * f6_32; + RHS32 += f6_32 * RHS6; + const double f6_39 = -f6 * m_A114; + m_A116 += m_A14 * f6_39; + m_A118 += m_A15 * f6_39; + RHS39 += f6_39 * RHS6; + const double f7 = 1.0 / m_A16; + const double f7_35 = -f7 * m_A94; + m_A96 += m_A17 * f7_35; + m_A97 += m_A18 * f7_35; + RHS35 += f7_35 * RHS7; + const double f7_39 = -f7 * m_A115; + m_A118 += m_A17 * f7_39; + m_A119 += m_A18 * f7_39; + RHS39 += f7_39 * RHS7; + const double f7_42 = -f7 * m_A129; + m_A133 += m_A17 * f7_42; + m_A134 += m_A18 * f7_42; + RHS42 += f7_42 * RHS7; + const double f8 = 1.0 / m_A19; + const double f8_37 = -f8 * m_A101; + m_A107 += m_A20 * f8_37; + RHS37 += f8_37 * RHS8; + const double f9 = 1.0 / m_A21; + const double f9_37 = -f9 * m_A102; + m_A107 += m_A22 * f9_37; + RHS37 += f9_37 * RHS9; + const double f10 = 1.0 / m_A23; + const double f10_37 = -f10 * m_A103; + m_A107 += m_A24 * f10_37; + RHS37 += f10_37 * RHS10; + const double f11 = 1.0 / m_A25; + const double f11_37 = -f11 * m_A104; + m_A107 += m_A26 * f11_37; + RHS37 += f11_37 * RHS11; + const double f12 = 1.0 / m_A27; + const double f12_37 = -f12 * m_A105; + m_A107 += m_A28 * f12_37; + RHS37 += f12_37 * RHS12; + const double f13 = 1.0 / m_A29; + const double f13_38 = -f13 * m_A109; + m_A112 += m_A30 * f13_38; + RHS38 += f13_38 * RHS13; + const double f14 = 1.0 / m_A31; + const double f14_34 = -f14 * m_A86; + m_A92 += m_A32 * f14_34; + RHS34 += f14_34 * RHS14; + const double f15 = 1.0 / m_A33; + const double f15_41 = -f15 * m_A123; + m_A127 += m_A34 * f15_41; + RHS41 += f15_41 * RHS15; + const double f16 = 1.0 / m_A35; + const double f16_36 = -f16 * m_A98; + m_A99 += m_A36 * f16_36; + RHS36 += f16_36 * RHS16; + const double f17 = 1.0 / m_A37; + const double f17_40 = -f17 * m_A120; + m_A121 += m_A38 * f17_40; + RHS40 += f17_40 * RHS17; + const double f18 = 1.0 / m_A39; + const double f18_41 = -f18 * m_A124; + m_A127 += m_A40 * f18_41; + RHS41 += f18_41 * RHS18; + const double f19 = 1.0 / m_A41; + const double f19_41 = -f19 * m_A125; + m_A127 += m_A42 * f19_41; + RHS41 += f19_41 * RHS19; + const double f20 = 1.0 / m_A43; + const double f20_41 = -f20 * m_A126; + m_A127 += m_A44 * f20_41; + RHS41 += f20_41 * RHS20; + const double f21 = 1.0 / m_A45; + const double f21_42 = -f21 * m_A130; + m_A132 += m_A46 * f21_42; + m_A134 += m_A47 * f21_42; + m_A135 += m_A48 * f21_42; + RHS42 += f21_42 * RHS21; + const double f21_44 = -f21 * m_A139; + m_A144 += m_A46 * f21_44; + m_A151 += m_A47 * f21_44; + m_A153 += m_A48 * f21_44; + RHS44 += f21_44 * RHS21; + const double f22 = 1.0 / m_A49; + const double f22_34 = -f22 * m_A87; + m_A92 += m_A50 * f22_34; + RHS34 += f22_34 * RHS22; + const double f23 = 1.0 / m_A51; + const double f23_43 = -f23 * m_A136; + m_A137 += m_A52 * f23_43; + RHS43 += f23_43 * RHS23; + const double f24 = 1.0 / m_A55; + const double f24_32 = -f24 * m_A76; + m_A77 += m_A56 * f24_32; + RHS32 += f24_32 * RHS24; + const double f25 = 1.0 / m_A57; + const double f25_38 = -f25 * m_A110; + m_A112 += m_A58 * f25_38; + RHS38 += f25_38 * RHS25; + const double f26 = 1.0 / m_A59; + const double f26_34 = -f26 * m_A88; + m_A92 += m_A60 * f26_34; + RHS34 += f26_34 * RHS26; + const double f27 = 1.0 / m_A61; + const double f27_34 = -f27 * m_A89; + m_A92 += m_A62 * f27_34; + RHS34 += f27_34 * RHS27; + const double f28 = 1.0 / m_A63; + const double f28_34 = -f28 * m_A90; + m_A92 += m_A64 * f28_34; + RHS34 += f28_34 * RHS28; + const double f29 = 1.0 / m_A65; + const double f29_34 = -f29 * m_A91; + m_A92 += m_A66 * f29_34; + m_A93 += m_A67 * f29_34; + RHS34 += f29_34 * RHS29; + const double f29_44 = -f29 * m_A140; + m_A143 += m_A66 * f29_44; + m_A153 += m_A67 * f29_44; + RHS44 += f29_44 * RHS29; + const double f30 = 1.0 / m_A68; + const double f30_37 = -f30 * m_A106; + m_A107 += m_A69 * f30_37; + m_A108 += m_A70 * f30_37; + RHS37 += f30_37 * RHS30; + const double f30_44 = -f30 * m_A141; + m_A146 += m_A69 * f30_44; + m_A153 += m_A70 * f30_44; + RHS44 += f30_44 * RHS30; + const double f31 = 1.0 / m_A71; + const double f31_38 = -f31 * m_A111; + m_A112 += m_A72 * f31_38; + m_A113 += m_A73 * f31_38; + RHS38 += f31_38 * RHS31; + const double f31_44 = -f31 * m_A142; + m_A147 += m_A72 * f31_44; + m_A153 += m_A73 * f31_44; + RHS44 += f31_44 * RHS31; + const double f32 = 1.0 / m_A77; + const double f32_39 = -f32 * m_A116; + m_A118 += m_A78 * f32_39; + RHS39 += f32_39 * RHS32; + const double f33 = 1.0 / m_A83; + const double f33_39 = -f33 * m_A117; + m_A118 += m_A84 * f33_39; + m_A119 += m_A85 * f33_39; + RHS39 += f33_39 * RHS33; + const double f33_42 = -f33 * m_A131; + m_A133 += m_A84 * f33_42; + m_A134 += m_A85 * f33_42; + RHS42 += f33_42 * RHS33; + const double f34 = 1.0 / m_A92; + const double f34_44 = -f34 * m_A143; + m_A153 += m_A93 * f34_44; + RHS44 += f34_44 * RHS34; + const double f35 = 1.0 / m_A95; + const double f35_42 = -f35 * m_A132; + m_A133 += m_A96 * f35_42; + m_A134 += m_A97 * f35_42; + RHS42 += f35_42 * RHS35; + const double f35_44 = -f35 * m_A144; + m_A148 += m_A96 * f35_44; + m_A151 += m_A97 * f35_44; + RHS44 += f35_44 * RHS35; + const double f36 = 1.0 / m_A99; + const double f36_44 = -f36 * m_A145; + m_A153 += m_A100 * f36_44; + RHS44 += f36_44 * RHS36; + const double f37 = 1.0 / m_A107; + const double f37_44 = -f37 * m_A146; + m_A153 += m_A108 * f37_44; + RHS44 += f37_44 * RHS37; + const double f38 = 1.0 / m_A112; + const double f38_44 = -f38 * m_A147; + m_A153 += m_A113 * f38_44; + RHS44 += f38_44 * RHS38; + const double f39 = 1.0 / m_A118; + const double f39_42 = -f39 * m_A133; + m_A134 += m_A119 * f39_42; + RHS42 += f39_42 * RHS39; + const double f39_44 = -f39 * m_A148; + m_A151 += m_A119 * f39_44; + RHS44 += f39_44 * RHS39; + const double f40 = 1.0 / m_A121; + const double f40_44 = -f40 * m_A149; + m_A153 += m_A122 * f40_44; + RHS44 += f40_44 * RHS40; + const double f41 = 1.0 / m_A127; + const double f41_44 = -f41 * m_A150; + m_A153 += m_A128 * f41_44; + RHS44 += f41_44 * RHS41; + const double f42 = 1.0 / m_A134; + const double f42_44 = -f42 * m_A151; + m_A153 += m_A135 * f42_44; + RHS44 += f42_44 * RHS42; + const double f43 = 1.0 / m_A137; + const double f43_44 = -f43 * m_A152; + m_A153 += m_A138 * f43_44; + RHS44 += f43_44 * RHS43; + V[44] = RHS44 / m_A153; + double tmp43 = 0.0; + tmp43 += m_A138 * V[44]; + V[43] = (RHS43 - tmp43) / m_A137; + double tmp42 = 0.0; + tmp42 += m_A135 * V[44]; + V[42] = (RHS42 - tmp42) / m_A134; + double tmp41 = 0.0; + tmp41 += m_A128 * V[44]; + V[41] = (RHS41 - tmp41) / m_A127; + double tmp40 = 0.0; + tmp40 += m_A122 * V[44]; + V[40] = (RHS40 - tmp40) / m_A121; + double tmp39 = 0.0; + tmp39 += m_A119 * V[42]; + V[39] = (RHS39 - tmp39) / m_A118; + double tmp38 = 0.0; + tmp38 += m_A113 * V[44]; + V[38] = (RHS38 - tmp38) / m_A112; + double tmp37 = 0.0; + tmp37 += m_A108 * V[44]; + V[37] = (RHS37 - tmp37) / m_A107; + double tmp36 = 0.0; + tmp36 += m_A100 * V[44]; + V[36] = (RHS36 - tmp36) / m_A99; + double tmp35 = 0.0; + tmp35 += m_A96 * V[39]; + tmp35 += m_A97 * V[42]; + V[35] = (RHS35 - tmp35) / m_A95; + double tmp34 = 0.0; + tmp34 += m_A93 * V[44]; + V[34] = (RHS34 - tmp34) / m_A92; + double tmp33 = 0.0; + tmp33 += m_A84 * V[39]; + tmp33 += m_A85 * V[42]; + V[33] = (RHS33 - tmp33) / m_A83; + double tmp32 = 0.0; + tmp32 += m_A78 * V[39]; + V[32] = (RHS32 - tmp32) / m_A77; + double tmp31 = 0.0; + tmp31 += m_A72 * V[38]; + tmp31 += m_A73 * V[44]; + V[31] = (RHS31 - tmp31) / m_A71; + double tmp30 = 0.0; + tmp30 += m_A69 * V[37]; + tmp30 += m_A70 * V[44]; + V[30] = (RHS30 - tmp30) / m_A68; + double tmp29 = 0.0; + tmp29 += m_A66 * V[34]; + tmp29 += m_A67 * V[44]; + V[29] = (RHS29 - tmp29) / m_A65; + double tmp28 = 0.0; + tmp28 += m_A64 * V[34]; + V[28] = (RHS28 - tmp28) / m_A63; + double tmp27 = 0.0; + tmp27 += m_A62 * V[34]; + V[27] = (RHS27 - tmp27) / m_A61; + double tmp26 = 0.0; + tmp26 += m_A60 * V[34]; + V[26] = (RHS26 - tmp26) / m_A59; + double tmp25 = 0.0; + tmp25 += m_A58 * V[38]; + V[25] = (RHS25 - tmp25) / m_A57; + double tmp24 = 0.0; + tmp24 += m_A56 * V[32]; + V[24] = (RHS24 - tmp24) / m_A55; + double tmp23 = 0.0; + tmp23 += m_A52 * V[43]; + V[23] = (RHS23 - tmp23) / m_A51; + double tmp22 = 0.0; + tmp22 += m_A50 * V[34]; + V[22] = (RHS22 - tmp22) / m_A49; + double tmp21 = 0.0; + tmp21 += m_A46 * V[35]; + tmp21 += m_A47 * V[42]; + tmp21 += m_A48 * V[44]; + V[21] = (RHS21 - tmp21) / m_A45; + double tmp20 = 0.0; + tmp20 += m_A44 * V[41]; + V[20] = (RHS20 - tmp20) / m_A43; + double tmp19 = 0.0; + tmp19 += m_A42 * V[41]; + V[19] = (RHS19 - tmp19) / m_A41; + double tmp18 = 0.0; + tmp18 += m_A40 * V[41]; + V[18] = (RHS18 - tmp18) / m_A39; + double tmp17 = 0.0; + tmp17 += m_A38 * V[40]; + V[17] = (RHS17 - tmp17) / m_A37; + double tmp16 = 0.0; + tmp16 += m_A36 * V[36]; + V[16] = (RHS16 - tmp16) / m_A35; + double tmp15 = 0.0; + tmp15 += m_A34 * V[41]; + V[15] = (RHS15 - tmp15) / m_A33; + double tmp14 = 0.0; + tmp14 += m_A32 * V[34]; + V[14] = (RHS14 - tmp14) / m_A31; + double tmp13 = 0.0; + tmp13 += m_A30 * V[38]; + V[13] = (RHS13 - tmp13) / m_A29; + double tmp12 = 0.0; + tmp12 += m_A28 * V[37]; + V[12] = (RHS12 - tmp12) / m_A27; + double tmp11 = 0.0; + tmp11 += m_A26 * V[37]; + V[11] = (RHS11 - tmp11) / m_A25; + double tmp10 = 0.0; + tmp10 += m_A24 * V[37]; + V[10] = (RHS10 - tmp10) / m_A23; + double tmp9 = 0.0; + tmp9 += m_A22 * V[37]; + V[9] = (RHS9 - tmp9) / m_A21; + double tmp8 = 0.0; + tmp8 += m_A20 * V[37]; + V[8] = (RHS8 - tmp8) / m_A19; + double tmp7 = 0.0; + tmp7 += m_A17 * V[39]; + tmp7 += m_A18 * V[42]; + V[7] = (RHS7 - tmp7) / m_A16; + double tmp6 = 0.0; + tmp6 += m_A14 * V[32]; + tmp6 += m_A15 * V[39]; + V[6] = (RHS6 - tmp6) / m_A13; + double tmp5 = 0.0; + tmp5 += m_A12 * V[24]; + V[5] = (RHS5 - tmp5) / m_A11; + double tmp4 = 0.0; + tmp4 += m_A9 * V[24]; + tmp4 += m_A10 * V[32]; + V[4] = (RHS4 - tmp4) / m_A8; + double tmp3 = 0.0; + tmp3 += m_A7 * V[33]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[33]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[33]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[33]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // pongf static void nl_gcr_13e7b5ac1a260dbf_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -1369,74 +2384,6 @@ static void nl_gcr_15e8f6fb021de0f9_28_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// armora -static void nl_gcr_1692de755a535408_9_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - plib::unused_var(cnV); - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A0 += gt[2]; - m_A2 += go[0]; - m_A1 += go[1]; - m_A1 += go[2]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 += Idr[2]; - m_A4 += gt[3]; - m_A4 += gt[4]; - m_A4 += gt[5]; - m_A4 += gt[6]; - m_A5 += go[3]; - m_A5 += go[4]; - m_A3 += go[5]; - m_A3 += go[6]; - double RHS1 = Idr[3]; - RHS1 += Idr[4]; - RHS1 += Idr[5]; - RHS1 += Idr[6]; - m_A8 += gt[7]; - m_A8 += gt[8]; - m_A8 += gt[9]; - m_A7 += go[7]; - m_A7 += go[8]; - m_A6 += go[9]; - double RHS2 = Idr[7]; - RHS2 += Idr[8]; - RHS2 += Idr[9]; - const double f0 = 1.0 / m_A0; - const double f0_1 = -f0 * m_A3; - m_A4 += m_A1 * f0_1; - m_A5 += m_A2 * f0_1; - RHS1 += f0_1 * RHS0; - const double f0_2 = -f0 * m_A6; - m_A7 += m_A1 * f0_2; - m_A8 += m_A2 * f0_2; - RHS2 += f0_2 * RHS0; - const double f1 = 1.0 / m_A4; - const double f1_2 = -f1 * m_A7; - m_A8 += m_A5 * f1_2; - RHS2 += f1_2 * RHS1; - V[2] = RHS2 / m_A8; - double tmp1 = 0.0; - tmp1 += m_A5 * V[2]; - V[1] = (RHS1 - tmp1) / m_A4; - double tmp0 = 0.0; - tmp0 += m_A1 * V[1]; - tmp0 += m_A2 * V[2]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // dpatrol static void nl_gcr_18f4d9160b51d613_20_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -2092,6 +3039,246 @@ static void nl_gcr_1fad5cda2646cf42_30_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_1fec893028a7b809_34_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A3 += go[2]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 -= go[3] * *cnV[3]; + m_A4 += gt[4]; + m_A4 += gt[5]; + m_A5 += go[4]; + double RHS2 = Idr[4]; + RHS2 += Idr[5]; + RHS2 -= go[5] * *cnV[5]; + m_A6 += gt[6]; + m_A6 += gt[7]; + m_A7 += go[6]; + double RHS3 = Idr[6]; + RHS3 += Idr[7]; + RHS3 -= go[7] * *cnV[7]; + m_A8 += gt[8]; + m_A8 += gt[9]; + m_A9 += go[8]; + double RHS4 = Idr[8]; + RHS4 += Idr[9]; + RHS4 -= go[9] * *cnV[9]; + m_A10 += gt[10]; + m_A10 += gt[11]; + m_A11 += go[10]; + double RHS5 = Idr[10]; + RHS5 += Idr[11]; + RHS5 -= go[11] * *cnV[11]; + m_A12 += gt[12]; + m_A12 += gt[13]; + m_A13 += go[12]; + double RHS6 = Idr[12]; + RHS6 += Idr[13]; + RHS6 -= go[13] * *cnV[13]; + m_A14 += gt[14]; + m_A14 += gt[15]; + m_A15 += go[14]; + double RHS7 = Idr[14]; + RHS7 += Idr[15]; + RHS7 -= go[15] * *cnV[15]; + m_A16 += gt[16]; + m_A16 += gt[17]; + m_A17 += go[16]; + double RHS8 = Idr[16]; + RHS8 += Idr[17]; + RHS8 -= go[17] * *cnV[17]; + m_A18 += gt[18]; + m_A18 += gt[19]; + m_A18 += gt[20]; + m_A18 += gt[21]; + m_A18 += gt[22]; + m_A18 += gt[23]; + m_A18 += gt[24]; + m_A19 += go[18]; + double RHS9 = Idr[18]; + RHS9 += Idr[19]; + RHS9 += Idr[20]; + RHS9 += Idr[21]; + RHS9 += Idr[22]; + RHS9 += Idr[23]; + RHS9 += Idr[24]; + RHS9 -= go[19] * *cnV[19]; + RHS9 -= go[20] * *cnV[20]; + RHS9 -= go[21] * *cnV[21]; + RHS9 -= go[22] * *cnV[22]; + RHS9 -= go[23] * *cnV[23]; + RHS9 -= go[24] * *cnV[24]; + m_A28 += gt[25]; + m_A28 += gt[26]; + m_A28 += gt[27]; + m_A28 += gt[28]; + m_A28 += gt[29]; + m_A28 += gt[30]; + m_A28 += gt[31]; + m_A28 += gt[32]; + m_A28 += gt[33]; + m_A28 += gt[34]; + m_A29 += go[25]; + m_A27 += go[26]; + m_A26 += go[27]; + m_A25 += go[28]; + m_A24 += go[29]; + m_A23 += go[30]; + m_A22 += go[31]; + m_A21 += go[32]; + m_A20 += go[33]; + double RHS10 = Idr[25]; + RHS10 += Idr[26]; + RHS10 += Idr[27]; + RHS10 += Idr[28]; + RHS10 += Idr[29]; + RHS10 += Idr[30]; + RHS10 += Idr[31]; + RHS10 += Idr[32]; + RHS10 += Idr[33]; + RHS10 += Idr[34]; + RHS10 -= go[34] * *cnV[34]; + m_A33 += gt[35]; + m_A33 += gt[36]; + m_A33 += gt[37]; + m_A33 += gt[38]; + m_A33 += gt[39]; + m_A31 += go[35]; + m_A30 += go[36]; + m_A32 += go[37]; + double RHS11 = Idr[35]; + RHS11 += Idr[36]; + RHS11 += Idr[37]; + RHS11 += Idr[38]; + RHS11 += Idr[39]; + RHS11 -= go[38] * *cnV[38]; + RHS11 -= go[39] * *cnV[39]; + const double f0 = 1.0 / m_A0; + const double f0_10 = -f0 * m_A20; + m_A28 += m_A1 * f0_10; + RHS10 += f0_10 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_10 = -f1 * m_A21; + m_A28 += m_A3 * f1_10; + RHS10 += f1_10 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_11 = -f2 * m_A30; + m_A33 += m_A5 * f2_11; + RHS11 += f2_11 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_10 = -f3 * m_A22; + m_A28 += m_A7 * f3_10; + RHS10 += f3_10 * RHS3; + const double f4 = 1.0 / m_A8; + const double f4_10 = -f4 * m_A23; + m_A28 += m_A9 * f4_10; + RHS10 += f4_10 * RHS4; + const double f5 = 1.0 / m_A10; + const double f5_10 = -f5 * m_A24; + m_A28 += m_A11 * f5_10; + RHS10 += f5_10 * RHS5; + const double f6 = 1.0 / m_A12; + const double f6_10 = -f6 * m_A25; + m_A28 += m_A13 * f6_10; + RHS10 += f6_10 * RHS6; + const double f7 = 1.0 / m_A14; + const double f7_10 = -f7 * m_A26; + m_A28 += m_A15 * f7_10; + RHS10 += f7_10 * RHS7; + const double f8 = 1.0 / m_A16; + const double f8_10 = -f8 * m_A27; + m_A28 += m_A17 * f8_10; + RHS10 += f8_10 * RHS8; + const double f9 = 1.0 / m_A18; + const double f9_11 = -f9 * m_A31; + m_A32 += m_A19 * f9_11; + RHS11 += f9_11 * RHS9; + const double f10 = 1.0 / m_A28; + const double f10_11 = -f10 * m_A32; + m_A33 += m_A29 * f10_11; + RHS11 += f10_11 * RHS10; + V[11] = RHS11 / m_A33; + double tmp10 = 0.0; + tmp10 += m_A29 * V[11]; + V[10] = (RHS10 - tmp10) / m_A28; + double tmp9 = 0.0; + tmp9 += m_A19 * V[10]; + V[9] = (RHS9 - tmp9) / m_A18; + double tmp8 = 0.0; + tmp8 += m_A17 * V[10]; + V[8] = (RHS8 - tmp8) / m_A16; + double tmp7 = 0.0; + tmp7 += m_A15 * V[10]; + V[7] = (RHS7 - tmp7) / m_A14; + double tmp6 = 0.0; + tmp6 += m_A13 * V[10]; + V[6] = (RHS6 - tmp6) / m_A12; + double tmp5 = 0.0; + tmp5 += m_A11 * V[10]; + V[5] = (RHS5 - tmp5) / m_A10; + double tmp4 = 0.0; + tmp4 += m_A9 * V[10]; + V[4] = (RHS4 - tmp4) / m_A8; + double tmp3 = 0.0; + tmp3 += m_A7 * V[10]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[11]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[10]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[10]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // sspeedr static void nl_gcr_2294220d3c91e762_176_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -3198,6 +4385,718 @@ static void nl_gcr_2294220d3c91e762_176_double_double(double * __restrict V, con V[0] = (RHS0 - tmp0) / m_A0; } +// headon +static void nl_gcr_24023c8529f6bdb3_97_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A2 += gt[7]; + m_A2 += gt[8]; + m_A2 += gt[9]; + m_A3 += go[3]; + m_A3 += go[4]; + m_A3 += go[5]; + m_A4 += go[6]; + m_A4 += go[7]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 += Idr[8]; + RHS1 += Idr[9]; + RHS1 -= go[8] * *cnV[8]; + RHS1 -= go[9] * *cnV[9]; + m_A5 += gt[10]; + m_A5 += gt[11]; + m_A6 += go[10]; + double RHS2 = Idr[10]; + RHS2 += Idr[11]; + RHS2 -= go[11] * *cnV[11]; + m_A7 += gt[12]; + m_A7 += gt[13]; + m_A8 += go[12]; + double RHS3 = Idr[12]; + RHS3 += Idr[13]; + RHS3 -= go[13] * *cnV[13]; + m_A9 += gt[14]; + m_A9 += gt[15]; + m_A9 += gt[16]; + m_A9 += gt[17]; + m_A9 += gt[18]; + m_A11 += go[14]; + m_A10 += go[15]; + m_A12 += go[16]; + m_A12 += go[17]; + double RHS4 = Idr[14]; + RHS4 += Idr[15]; + RHS4 += Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + RHS4 -= go[18] * *cnV[18]; + m_A13 += gt[19]; + m_A13 += gt[20]; + m_A13 += gt[21]; + m_A14 += go[19]; + double RHS5 = Idr[19]; + RHS5 += Idr[20]; + RHS5 += Idr[21]; + RHS5 -= go[20] * *cnV[20]; + RHS5 -= go[21] * *cnV[21]; + m_A15 += gt[22]; + m_A15 += gt[23]; + m_A15 += gt[24]; + m_A15 += gt[25]; + m_A15 += gt[26]; + m_A15 += gt[27]; + m_A15 += gt[28]; + m_A16 += go[22]; + m_A16 += go[23]; + m_A16 += go[24]; + m_A17 += go[25]; + m_A17 += go[26]; + double RHS6 = Idr[22]; + RHS6 += Idr[23]; + RHS6 += Idr[24]; + RHS6 += Idr[25]; + RHS6 += Idr[26]; + RHS6 += Idr[27]; + RHS6 += Idr[28]; + RHS6 -= go[27] * *cnV[27]; + RHS6 -= go[28] * *cnV[28]; + m_A18 += gt[29]; + m_A18 += gt[30]; + m_A19 += go[29]; + double RHS7 = Idr[29]; + RHS7 += Idr[30]; + RHS7 -= go[30] * *cnV[30]; + m_A20 += gt[31]; + m_A20 += gt[32]; + m_A21 += go[31]; + double RHS8 = Idr[31]; + RHS8 += Idr[32]; + RHS8 -= go[32] * *cnV[32]; + m_A22 += gt[33]; + m_A22 += gt[34]; + m_A22 += gt[35]; + m_A23 += go[33]; + double RHS9 = Idr[33]; + RHS9 += Idr[34]; + RHS9 += Idr[35]; + RHS9 -= go[34] * *cnV[34]; + RHS9 -= go[35] * *cnV[35]; + m_A24 += gt[36]; + m_A24 += gt[37]; + m_A24 += gt[38]; + m_A24 += gt[39]; + m_A24 += gt[40]; + m_A25 += go[36]; + m_A26 += go[37]; + m_A27 += go[38]; + m_A27 += go[39]; + double RHS10 = Idr[36]; + RHS10 += Idr[37]; + RHS10 += Idr[38]; + RHS10 += Idr[39]; + RHS10 += Idr[40]; + RHS10 -= go[40] * *cnV[40]; + m_A29 += gt[41]; + m_A29 += gt[42]; + m_A29 += gt[43]; + m_A29 += gt[44]; + m_A29 += gt[45]; + m_A29 += gt[46]; + m_A29 += gt[47]; + m_A30 += go[41]; + m_A30 += go[42]; + m_A30 += go[43]; + m_A28 += go[44]; + double RHS11 = Idr[41]; + RHS11 += Idr[42]; + RHS11 += Idr[43]; + RHS11 += Idr[44]; + RHS11 += Idr[45]; + RHS11 += Idr[46]; + RHS11 += Idr[47]; + RHS11 -= go[45] * *cnV[45]; + RHS11 -= go[46] * *cnV[46]; + RHS11 -= go[47] * *cnV[47]; + m_A31 += gt[48]; + m_A31 += gt[49]; + m_A31 += gt[50]; + m_A31 += gt[51]; + m_A31 += gt[52]; + m_A31 += gt[53]; + m_A32 += go[48]; + m_A32 += go[49]; + m_A32 += go[50]; + m_A33 += go[51]; + m_A34 += go[52]; + double RHS12 = Idr[48]; + RHS12 += Idr[49]; + RHS12 += Idr[50]; + RHS12 += Idr[51]; + RHS12 += Idr[52]; + RHS12 += Idr[53]; + RHS12 -= go[53] * *cnV[53]; + m_A37 += gt[54]; + m_A37 += gt[55]; + m_A37 += gt[56]; + m_A37 += gt[57]; + m_A37 += gt[58]; + m_A36 += go[54]; + m_A35 += go[55]; + m_A35 += go[56]; + m_A35 += go[57]; + m_A39 += go[58]; + double RHS13 = Idr[54]; + RHS13 += Idr[55]; + RHS13 += Idr[56]; + RHS13 += Idr[57]; + RHS13 += Idr[58]; + m_A42 += gt[59]; + m_A42 += gt[60]; + m_A42 += gt[61]; + m_A42 += gt[62]; + m_A42 += gt[63]; + m_A42 += gt[64]; + m_A42 += gt[65]; + m_A43 += go[59]; + m_A43 += go[60]; + m_A43 += go[61]; + m_A41 += go[62]; + double RHS14 = Idr[59]; + RHS14 += Idr[60]; + RHS14 += Idr[61]; + RHS14 += Idr[62]; + RHS14 += Idr[63]; + RHS14 += Idr[64]; + RHS14 += Idr[65]; + RHS14 -= go[63] * *cnV[63]; + RHS14 -= go[64] * *cnV[64]; + RHS14 -= go[65] * *cnV[65]; + m_A47 += gt[66]; + m_A47 += gt[67]; + m_A47 += gt[68]; + m_A47 += gt[69]; + m_A47 += gt[70]; + m_A44 += go[66]; + m_A45 += go[67]; + m_A49 += go[68]; + m_A49 += go[69]; + double RHS15 = Idr[66]; + RHS15 += Idr[67]; + RHS15 += Idr[68]; + RHS15 += Idr[69]; + RHS15 += Idr[70]; + RHS15 -= go[70] * *cnV[70]; + m_A52 += gt[71]; + m_A52 += gt[72]; + m_A52 += gt[73]; + m_A52 += gt[74]; + m_A52 += gt[75]; + m_A52 += gt[76]; + m_A52 += gt[77]; + m_A51 += go[71]; + m_A51 += go[72]; + m_A51 += go[73]; + m_A50 += go[74]; + double RHS16 = Idr[71]; + RHS16 += Idr[72]; + RHS16 += Idr[73]; + RHS16 += Idr[74]; + RHS16 += Idr[75]; + RHS16 += Idr[76]; + RHS16 += Idr[77]; + RHS16 -= go[75] * *cnV[75]; + RHS16 -= go[76] * *cnV[76]; + RHS16 -= go[77] * *cnV[77]; + m_A57 += gt[78]; + m_A57 += gt[79]; + m_A57 += gt[80]; + m_A57 += gt[81]; + m_A57 += gt[82]; + m_A55 += go[78]; + m_A56 += go[79]; + m_A59 += go[80]; + m_A59 += go[81]; + double RHS17 = Idr[78]; + RHS17 += Idr[79]; + RHS17 += Idr[80]; + RHS17 += Idr[81]; + RHS17 += Idr[82]; + RHS17 -= go[82] * *cnV[82]; + m_A64 += gt[83]; + m_A64 += gt[84]; + m_A64 += gt[85]; + m_A64 += gt[86]; + m_A64 += gt[87]; + m_A64 += gt[88]; + m_A64 += gt[89]; + m_A64 += gt[90]; + m_A62 += go[83]; + m_A65 += go[84]; + m_A60 += go[85]; + m_A60 += go[86]; + m_A61 += go[87]; + m_A61 += go[88]; + m_A61 += go[89]; + double RHS18 = Idr[83]; + RHS18 += Idr[84]; + RHS18 += Idr[85]; + RHS18 += Idr[86]; + RHS18 += Idr[87]; + RHS18 += Idr[88]; + RHS18 += Idr[89]; + RHS18 += Idr[90]; + RHS18 -= go[90] * *cnV[90]; + m_A69 += gt[91]; + m_A69 += gt[92]; + m_A69 += gt[93]; + m_A69 += gt[94]; + m_A69 += gt[95]; + m_A67 += go[91]; + m_A66 += go[92]; + m_A66 += go[93]; + m_A66 += go[94]; + m_A71 += go[95]; + double RHS19 = Idr[91]; + RHS19 += Idr[92]; + RHS19 += Idr[93]; + RHS19 += Idr[94]; + RHS19 += Idr[95]; + m_A78 += gt[96]; + m_A78 += gt[97]; + m_A78 += gt[98]; + m_A78 += gt[99]; + m_A78 += gt[100]; + m_A78 += gt[101]; + m_A78 += gt[102]; + m_A74 += go[96]; + m_A76 += go[97]; + m_A76 += go[98]; + m_A73 += go[99]; + m_A73 += go[100]; + m_A72 += go[101]; + m_A80 += go[102]; + double RHS20 = Idr[96]; + RHS20 += Idr[97]; + RHS20 += Idr[98]; + RHS20 += Idr[99]; + RHS20 += Idr[100]; + RHS20 += Idr[101]; + RHS20 += Idr[102]; + m_A89 += gt[103]; + m_A89 += gt[104]; + m_A89 += gt[105]; + m_A89 += gt[106]; + m_A89 += gt[107]; + m_A89 += gt[108]; + m_A89 += gt[109]; + m_A83 += go[103]; + m_A85 += go[104]; + m_A85 += go[105]; + m_A82 += go[106]; + m_A82 += go[107]; + m_A81 += go[108]; + m_A87 += go[109]; + double RHS21 = Idr[103]; + RHS21 += Idr[104]; + RHS21 += Idr[105]; + RHS21 += Idr[106]; + RHS21 += Idr[107]; + RHS21 += Idr[108]; + RHS21 += Idr[109]; + m_A96 += gt[110]; + m_A96 += gt[111]; + m_A96 += gt[112]; + m_A96 += gt[113]; + m_A96 += gt[114]; + m_A96 += gt[115]; + m_A96 += gt[116]; + m_A96 += gt[117]; + m_A93 += go[110]; + m_A94 += go[111]; + m_A91 += go[112]; + m_A91 += go[113]; + m_A92 += go[114]; + m_A92 += go[115]; + m_A92 += go[116]; + double RHS22 = Idr[110]; + RHS22 += Idr[111]; + RHS22 += Idr[112]; + RHS22 += Idr[113]; + RHS22 += Idr[114]; + RHS22 += Idr[115]; + RHS22 += Idr[116]; + RHS22 += Idr[117]; + RHS22 -= go[117] * *cnV[117]; + const double f0 = 1.0 / m_A0; + const double f0_11 = -f0 * m_A28; + m_A29 += m_A1 * f0_11; + RHS11 += f0_11 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_13 = -f1 * m_A35; + m_A37 += m_A3 * f1_13; + m_A39 += m_A4 * f1_13; + RHS13 += f1_13 * RHS1; + const double f1_18 = -f1 * m_A60; + m_A62 += m_A3 * f1_18; + m_A64 += m_A4 * f1_18; + RHS18 += f1_18 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_21 = -f2 * m_A81; + m_A89 += m_A6 * f2_21; + RHS21 += f2_21 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_15 = -f3 * m_A44; + m_A47 += m_A8 * f3_15; + RHS15 += f3_15 * RHS3; + const double f4 = 1.0 / m_A9; + const double f4_13 = -f4 * m_A36; + m_A37 += m_A10 * f4_13; + m_A38 += m_A11 * f4_13; + m_A40 += m_A12 * f4_13; + RHS13 += f4_13 * RHS4; + const double f4_15 = -f4 * m_A45; + m_A46 += m_A10 * f4_15; + m_A47 += m_A11 * f4_15; + m_A49 += m_A12 * f4_15; + RHS15 += f4_15 * RHS4; + const double f4_21 = -f4 * m_A82; + m_A84 += m_A10 * f4_21; + m_A85 += m_A11 * f4_21; + m_A89 += m_A12 * f4_21; + RHS21 += f4_21 * RHS4; + const double f5 = 1.0 / m_A13; + const double f5_14 = -f5 * m_A41; + m_A42 += m_A14 * f5_14; + RHS14 += f5_14 * RHS5; + const double f6 = 1.0 / m_A15; + const double f6_19 = -f6 * m_A66; + m_A69 += m_A16 * f6_19; + m_A71 += m_A17 * f6_19; + RHS19 += f6_19 * RHS6; + const double f6_22 = -f6 * m_A91; + m_A93 += m_A16 * f6_22; + m_A96 += m_A17 * f6_22; + RHS22 += f6_22 * RHS6; + const double f7 = 1.0 / m_A18; + const double f7_17 = -f7 * m_A55; + m_A57 += m_A19 * f7_17; + RHS17 += f7_17 * RHS7; + const double f8 = 1.0 / m_A20; + const double f8_20 = -f8 * m_A72; + m_A78 += m_A21 * f8_20; + RHS20 += f8_20 * RHS8; + const double f9 = 1.0 / m_A22; + const double f9_16 = -f9 * m_A50; + m_A52 += m_A23 * f9_16; + RHS16 += f9_16 * RHS9; + const double f10 = 1.0 / m_A24; + const double f10_17 = -f10 * m_A56; + m_A57 += m_A25 * f10_17; + m_A58 += m_A26 * f10_17; + m_A59 += m_A27 * f10_17; + RHS17 += f10_17 * RHS10; + const double f10_19 = -f10 * m_A67; + m_A68 += m_A25 * f10_19; + m_A69 += m_A26 * f10_19; + m_A70 += m_A27 * f10_19; + RHS19 += f10_19 * RHS10; + const double f10_20 = -f10 * m_A73; + m_A76 += m_A25 * f10_20; + m_A77 += m_A26 * f10_20; + m_A78 += m_A27 * f10_20; + RHS20 += f10_20 * RHS10; + const double f11 = 1.0 / m_A29; + const double f11_18 = -f11 * m_A61; + m_A64 += m_A30 * f11_18; + RHS18 += f11_18 * RHS11; + const double f12 = 1.0 / m_A31; + const double f12_16 = -f12 * m_A51; + m_A52 += m_A32 * f12_16; + m_A53 += m_A33 * f12_16; + m_A54 += m_A34 * f12_16; + RHS16 += f12_16 * RHS12; + const double f12_20 = -f12 * m_A74; + m_A75 += m_A32 * f12_20; + m_A78 += m_A33 * f12_20; + m_A79 += m_A34 * f12_20; + RHS20 += f12_20 * RHS12; + const double f12_21 = -f12 * m_A83; + m_A86 += m_A32 * f12_21; + m_A88 += m_A33 * f12_21; + m_A89 += m_A34 * f12_21; + RHS21 += f12_21 * RHS12; + const double f13 = 1.0 / m_A37; + const double f13_15 = -f13 * m_A46; + m_A47 += m_A38 * f13_15; + m_A48 += m_A39 * f13_15; + m_A49 += m_A40 * f13_15; + RHS15 += f13_15 * RHS13; + const double f13_18 = -f13 * m_A62; + m_A63 += m_A38 * f13_18; + m_A64 += m_A39 * f13_18; + m_A65 += m_A40 * f13_18; + RHS18 += f13_18 * RHS13; + const double f13_21 = -f13 * m_A84; + m_A85 += m_A38 * f13_21; + m_A87 += m_A39 * f13_21; + m_A89 += m_A40 * f13_21; + RHS21 += f13_21 * RHS13; + const double f14 = 1.0 / m_A42; + const double f14_22 = -f14 * m_A92; + m_A96 += m_A43 * f14_22; + RHS22 += f14_22 * RHS14; + const double f15 = 1.0 / m_A47; + const double f15_18 = -f15 * m_A63; + m_A64 += m_A48 * f15_18; + m_A65 += m_A49 * f15_18; + RHS18 += f15_18 * RHS15; + const double f15_21 = -f15 * m_A85; + m_A87 += m_A48 * f15_21; + m_A89 += m_A49 * f15_21; + RHS21 += f15_21 * RHS15; + const double f16 = 1.0 / m_A52; + const double f16_20 = -f16 * m_A75; + m_A78 += m_A53 * f16_20; + m_A79 += m_A54 * f16_20; + RHS20 += f16_20 * RHS16; + const double f16_21 = -f16 * m_A86; + m_A88 += m_A53 * f16_21; + m_A89 += m_A54 * f16_21; + RHS21 += f16_21 * RHS16; + const double f17 = 1.0 / m_A57; + const double f17_19 = -f17 * m_A68; + m_A69 += m_A58 * f17_19; + m_A70 += m_A59 * f17_19; + RHS19 += f17_19 * RHS17; + const double f17_20 = -f17 * m_A76; + m_A77 += m_A58 * f17_20; + m_A78 += m_A59 * f17_20; + RHS20 += f17_20 * RHS17; + const double f18 = 1.0 / m_A64; + const double f18_21 = -f18 * m_A87; + m_A89 += m_A65 * f18_21; + RHS21 += f18_21 * RHS18; + const double f19 = 1.0 / m_A69; + const double f19_20 = -f19 * m_A77; + m_A78 += m_A70 * f19_20; + m_A80 += m_A71 * f19_20; + RHS20 += f19_20 * RHS19; + const double f19_22 = -f19 * m_A93; + m_A94 += m_A70 * f19_22; + m_A96 += m_A71 * f19_22; + RHS22 += f19_22 * RHS19; + const double f20 = 1.0 / m_A78; + const double f20_21 = -f20 * m_A88; + m_A89 += m_A79 * f20_21; + m_A90 += m_A80 * f20_21; + RHS21 += f20_21 * RHS20; + const double f20_22 = -f20 * m_A94; + m_A95 += m_A79 * f20_22; + m_A96 += m_A80 * f20_22; + RHS22 += f20_22 * RHS20; + const double f21 = 1.0 / m_A89; + const double f21_22 = -f21 * m_A95; + m_A96 += m_A90 * f21_22; + RHS22 += f21_22 * RHS21; + V[22] = RHS22 / m_A96; + double tmp21 = 0.0; + tmp21 += m_A90 * V[22]; + V[21] = (RHS21 - tmp21) / m_A89; + double tmp20 = 0.0; + tmp20 += m_A79 * V[21]; + tmp20 += m_A80 * V[22]; + V[20] = (RHS20 - tmp20) / m_A78; + double tmp19 = 0.0; + tmp19 += m_A70 * V[20]; + tmp19 += m_A71 * V[22]; + V[19] = (RHS19 - tmp19) / m_A69; + double tmp18 = 0.0; + tmp18 += m_A65 * V[21]; + V[18] = (RHS18 - tmp18) / m_A64; + double tmp17 = 0.0; + tmp17 += m_A58 * V[19]; + tmp17 += m_A59 * V[20]; + V[17] = (RHS17 - tmp17) / m_A57; + double tmp16 = 0.0; + tmp16 += m_A53 * V[20]; + tmp16 += m_A54 * V[21]; + V[16] = (RHS16 - tmp16) / m_A52; + double tmp15 = 0.0; + tmp15 += m_A48 * V[18]; + tmp15 += m_A49 * V[21]; + V[15] = (RHS15 - tmp15) / m_A47; + double tmp14 = 0.0; + tmp14 += m_A43 * V[22]; + V[14] = (RHS14 - tmp14) / m_A42; + double tmp13 = 0.0; + tmp13 += m_A38 * V[15]; + tmp13 += m_A39 * V[18]; + tmp13 += m_A40 * V[21]; + V[13] = (RHS13 - tmp13) / m_A37; + double tmp12 = 0.0; + tmp12 += m_A32 * V[16]; + tmp12 += m_A33 * V[20]; + tmp12 += m_A34 * V[21]; + V[12] = (RHS12 - tmp12) / m_A31; + double tmp11 = 0.0; + tmp11 += m_A30 * V[18]; + V[11] = (RHS11 - tmp11) / m_A29; + double tmp10 = 0.0; + tmp10 += m_A25 * V[17]; + tmp10 += m_A26 * V[19]; + tmp10 += m_A27 * V[20]; + V[10] = (RHS10 - tmp10) / m_A24; + double tmp9 = 0.0; + tmp9 += m_A23 * V[16]; + V[9] = (RHS9 - tmp9) / m_A22; + double tmp8 = 0.0; + tmp8 += m_A21 * V[20]; + V[8] = (RHS8 - tmp8) / m_A20; + double tmp7 = 0.0; + tmp7 += m_A19 * V[17]; + V[7] = (RHS7 - tmp7) / m_A18; + double tmp6 = 0.0; + tmp6 += m_A16 * V[19]; + tmp6 += m_A17 * V[22]; + V[6] = (RHS6 - tmp6) / m_A15; + double tmp5 = 0.0; + tmp5 += m_A14 * V[14]; + V[5] = (RHS5 - tmp5) / m_A13; + double tmp4 = 0.0; + tmp4 += m_A10 * V[13]; + tmp4 += m_A11 * V[15]; + tmp4 += m_A12 * V[21]; + V[4] = (RHS4 - tmp4) / m_A9; + double tmp3 = 0.0; + tmp3 += m_A8 * V[15]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[21]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[13]; + tmp1 += m_A4 * V[18]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[11]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // 280zzzap static void nl_gcr_24643c159711f292_95_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -3851,6 +5750,438 @@ static void nl_gcr_24643c159711f292_95_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// frogs +static void nl_gcr_263b618097fad01_38_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + m_A2 += go[1]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[2] * *cnV[2]; + m_A3 += gt[3]; + m_A3 += gt[4]; + m_A4 += go[3]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 -= go[4] * *cnV[4]; + m_A5 += gt[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A7 += go[5]; + m_A6 += go[6]; + double RHS2 = Idr[5]; + RHS2 += Idr[6]; + RHS2 += Idr[7]; + RHS2 -= go[7] * *cnV[7]; + m_A8 += gt[8]; + m_A8 += gt[9]; + m_A8 += gt[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A9 += go[8]; + double RHS3 = Idr[8]; + RHS3 += Idr[9]; + RHS3 += Idr[10]; + RHS3 += Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + RHS3 += Idr[14]; + RHS3 -= go[9] * *cnV[9]; + RHS3 -= go[10] * *cnV[10]; + RHS3 -= go[11] * *cnV[11]; + RHS3 -= go[12] * *cnV[12]; + RHS3 -= go[13] * *cnV[13]; + RHS3 -= go[14] * *cnV[14]; + m_A10 += gt[15]; + m_A10 += gt[16]; + m_A10 += gt[17]; + m_A11 += go[15]; + m_A12 += go[16]; + double RHS4 = Idr[15]; + RHS4 += Idr[16]; + RHS4 += Idr[17]; + RHS4 -= go[17] * *cnV[17]; + m_A14 += gt[18]; + m_A14 += gt[19]; + m_A14 += gt[20]; + m_A14 += gt[21]; + m_A16 += go[18]; + m_A13 += go[19]; + double RHS5 = Idr[18]; + RHS5 += Idr[19]; + RHS5 += Idr[20]; + RHS5 += Idr[21]; + RHS5 -= go[20] * *cnV[20]; + RHS5 -= go[21] * *cnV[21]; + m_A19 += gt[22]; + m_A19 += gt[23]; + m_A19 += gt[24]; + m_A21 += go[22]; + m_A17 += go[23]; + double RHS6 = Idr[22]; + RHS6 += Idr[23]; + RHS6 += Idr[24]; + RHS6 -= go[24] * *cnV[24]; + m_A24 += gt[25]; + m_A24 += gt[26]; + m_A24 += gt[27]; + m_A24 += gt[28]; + m_A24 += gt[29]; + m_A22 += go[25]; + m_A23 += go[26]; + m_A25 += go[27]; + double RHS7 = Idr[25]; + RHS7 += Idr[26]; + RHS7 += Idr[27]; + RHS7 += Idr[28]; + RHS7 += Idr[29]; + RHS7 -= go[28] * *cnV[28]; + RHS7 -= go[29] * *cnV[29]; + m_A30 += gt[30]; + m_A30 += gt[31]; + m_A30 += gt[32]; + m_A30 += gt[33]; + m_A30 += gt[34]; + m_A30 += gt[35]; + m_A30 += gt[36]; + m_A27 += go[30]; + m_A31 += go[31]; + m_A26 += go[32]; + m_A28 += go[33]; + double RHS8 = Idr[30]; + RHS8 += Idr[31]; + RHS8 += Idr[32]; + RHS8 += Idr[33]; + RHS8 += Idr[34]; + RHS8 += Idr[35]; + RHS8 += Idr[36]; + RHS8 -= go[34] * *cnV[34]; + RHS8 -= go[35] * *cnV[35]; + RHS8 -= go[36] * *cnV[36]; + m_A37 += gt[37]; + m_A37 += gt[38]; + m_A37 += gt[39]; + m_A37 += gt[40]; + m_A37 += gt[41]; + m_A35 += go[37]; + m_A33 += go[38]; + m_A32 += go[39]; + m_A36 += go[40]; + m_A34 += go[41]; + double RHS9 = Idr[37]; + RHS9 += Idr[38]; + RHS9 += Idr[39]; + RHS9 += Idr[40]; + RHS9 += Idr[41]; + const double f0 = 1.0 / m_A0; + const double f0_5 = -f0 * m_A13; + m_A14 += m_A1 * f0_5; + m_A15 += m_A2 * f0_5; + RHS5 += f0_5 * RHS0; + const double f0_6 = -f0 * m_A17; + m_A18 += m_A1 * f0_6; + m_A19 += m_A2 * f0_6; + RHS6 += f0_6 * RHS0; + const double f1 = 1.0 / m_A3; + const double f1_8 = -f1 * m_A26; + m_A30 += m_A4 * f1_8; + RHS8 += f1_8 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_8 = -f2 * m_A27; + m_A30 += m_A6 * f2_8; + m_A31 += m_A7 * f2_8; + RHS8 += f2_8 * RHS2; + const double f2_9 = -f2 * m_A32; + m_A36 += m_A6 * f2_9; + m_A37 += m_A7 * f2_9; + RHS9 += f2_9 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_7 = -f3 * m_A22; + m_A23 += m_A9 * f3_7; + RHS7 += f3_7 * RHS3; + const double f4 = 1.0 / m_A10; + const double f4_7 = -f4 * m_A23; + m_A24 += m_A11 * f4_7; + m_A25 += m_A12 * f4_7; + RHS7 += f4_7 * RHS4; + const double f4_9 = -f4 * m_A33; + m_A35 += m_A11 * f4_9; + m_A37 += m_A12 * f4_9; + RHS9 += f4_9 * RHS4; + const double f5 = 1.0 / m_A14; + const double f5_6 = -f5 * m_A18; + m_A19 += m_A15 * f5_6; + m_A20 += m_A16 * f5_6; + RHS6 += f5_6 * RHS5; + const double f5_8 = -f5 * m_A28; + m_A29 += m_A15 * f5_8; + m_A30 += m_A16 * f5_8; + RHS8 += f5_8 * RHS5; + const double f6 = 1.0 / m_A19; + const double f6_8 = -f6 * m_A29; + m_A30 += m_A20 * f6_8; + m_A31 += m_A21 * f6_8; + RHS8 += f6_8 * RHS6; + const double f6_9 = -f6 * m_A34; + m_A36 += m_A20 * f6_9; + m_A37 += m_A21 * f6_9; + RHS9 += f6_9 * RHS6; + const double f7 = 1.0 / m_A24; + const double f7_9 = -f7 * m_A35; + m_A37 += m_A25 * f7_9; + RHS9 += f7_9 * RHS7; + const double f8 = 1.0 / m_A30; + const double f8_9 = -f8 * m_A36; + m_A37 += m_A31 * f8_9; + RHS9 += f8_9 * RHS8; + V[9] = RHS9 / m_A37; + double tmp8 = 0.0; + tmp8 += m_A31 * V[9]; + V[8] = (RHS8 - tmp8) / m_A30; + double tmp7 = 0.0; + tmp7 += m_A25 * V[9]; + V[7] = (RHS7 - tmp7) / m_A24; + double tmp6 = 0.0; + tmp6 += m_A20 * V[8]; + tmp6 += m_A21 * V[9]; + V[6] = (RHS6 - tmp6) / m_A19; + double tmp5 = 0.0; + tmp5 += m_A15 * V[6]; + tmp5 += m_A16 * V[8]; + V[5] = (RHS5 - tmp5) / m_A14; + double tmp4 = 0.0; + tmp4 += m_A11 * V[7]; + tmp4 += m_A12 * V[9]; + V[4] = (RHS4 - tmp4) / m_A10; + double tmp3 = 0.0; + tmp3 += m_A9 * V[4]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A6 * V[8]; + tmp2 += m_A7 * V[9]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A4 * V[8]; + V[1] = (RHS1 - tmp1) / m_A3; + double tmp0 = 0.0; + tmp0 += m_A1 * V[5]; + tmp0 += m_A2 * V[6]; + V[0] = (RHS0 - tmp0) / m_A0; +} + +// brdrline +static void nl_gcr_2753fc1815ce0cba_23_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A3 += go[3]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 -= go[4] * *cnV[4]; + RHS1 -= go[5] * *cnV[5]; + RHS1 -= go[6] * *cnV[6]; + m_A4 += gt[7]; + m_A4 += gt[8]; + m_A4 += gt[9]; + m_A4 += gt[10]; + m_A5 += go[7]; + m_A6 += go[8]; + double RHS2 = Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A8 += gt[15]; + m_A8 += gt[16]; + m_A8 += gt[17]; + m_A9 += go[11]; + m_A7 += go[12]; + double RHS3 = Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + RHS3 += Idr[14]; + RHS3 += Idr[15]; + RHS3 += Idr[16]; + RHS3 += Idr[17]; + RHS3 -= go[13] * *cnV[13]; + RHS3 -= go[14] * *cnV[14]; + RHS3 -= go[15] * *cnV[15]; + RHS3 -= go[16] * *cnV[16]; + RHS3 -= go[17] * *cnV[17]; + m_A11 += gt[18]; + m_A11 += gt[19]; + m_A11 += gt[20]; + m_A11 += gt[21]; + m_A13 += go[18]; + m_A12 += go[19]; + m_A10 += go[20]; + double RHS4 = Idr[18]; + RHS4 += Idr[19]; + RHS4 += Idr[20]; + RHS4 += Idr[21]; + RHS4 -= go[21] * *cnV[21]; + m_A16 += gt[22]; + m_A16 += gt[23]; + m_A16 += gt[24]; + m_A14 += go[22]; + m_A15 += go[23]; + double RHS5 = Idr[22]; + RHS5 += Idr[23]; + RHS5 += Idr[24]; + RHS5 -= go[24] * *cnV[24]; + m_A22 += gt[25]; + m_A22 += gt[26]; + m_A18 += go[25]; + m_A20 += go[26]; + double RHS6 = Idr[25]; + RHS6 += Idr[26]; + const double f0 = 1.0 / m_A0; + const double f0_3 = -f0 * m_A7; + m_A9 += m_A1 * f0_3; + RHS3 += f0_3 * RHS0; + const double f0_4 = -f0 * m_A10; + m_A11 += m_A1 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_5 = -f1 * m_A14; + m_A16 += m_A3 * f1_5; + RHS5 += f1_5 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_6 = -f2 * m_A18; + m_A19 += m_A5 * f2_6; + m_A22 += m_A6 * f2_6; + RHS6 += f2_6 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_6 = -f3 * m_A19; + m_A20 += m_A9 * f3_6; + RHS6 += f3_6 * RHS3; + const double f4 = 1.0 / m_A11; + const double f4_5 = -f4 * m_A15; + m_A16 += m_A12 * f4_5; + m_A17 += m_A13 * f4_5; + RHS5 += f4_5 * RHS4; + const double f4_6 = -f4 * m_A20; + m_A21 += m_A12 * f4_6; + m_A22 += m_A13 * f4_6; + RHS6 += f4_6 * RHS4; + const double f5 = 1.0 / m_A16; + const double f5_6 = -f5 * m_A21; + m_A22 += m_A17 * f5_6; + RHS6 += f5_6 * RHS5; + V[6] = RHS6 / m_A22; + double tmp5 = 0.0; + tmp5 += m_A17 * V[6]; + V[5] = (RHS5 - tmp5) / m_A16; + double tmp4 = 0.0; + tmp4 += m_A12 * V[5]; + tmp4 += m_A13 * V[6]; + V[4] = (RHS4 - tmp4) / m_A11; + double tmp3 = 0.0; + tmp3 += m_A9 * V[4]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A5 * V[3]; + tmp2 += m_A6 * V[6]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[5]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[4]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // zac1b11142 static void nl_gcr_287a160e7c36b5b0_96_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -5687,8 +8018,8 @@ static void nl_gcr_2f84bc98d737730b_22_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// astrob -static void nl_gcr_30fc51fe03b164cb_178_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) +// brdrline +static void nl_gcr_30923b54310ae144_8_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) { @@ -5701,1173 +8032,63 @@ static void nl_gcr_30fc51fe03b164cb_178_double_double(double * __restrict V, con double m_A5(0.0); double m_A6(0.0); double m_A7(0.0); - double m_A8(0.0); - double m_A9(0.0); - double m_A10(0.0); - double m_A11(0.0); - double m_A12(0.0); - double m_A13(0.0); - double m_A14(0.0); - double m_A15(0.0); - double m_A16(0.0); - double m_A17(0.0); - double m_A18(0.0); - double m_A19(0.0); - double m_A20(0.0); - double m_A21(0.0); - double m_A22(0.0); - double m_A23(0.0); - double m_A24(0.0); - double m_A25(0.0); - double m_A26(0.0); - double m_A27(0.0); - double m_A28(0.0); - double m_A29(0.0); - double m_A30(0.0); - double m_A31(0.0); - double m_A32(0.0); - double m_A33(0.0); - double m_A34(0.0); - double m_A35(0.0); - double m_A36(0.0); - double m_A37(0.0); - double m_A38(0.0); - double m_A39(0.0); - double m_A40(0.0); - double m_A41(0.0); - double m_A42(0.0); - double m_A43(0.0); - double m_A44(0.0); - double m_A45(0.0); - double m_A46(0.0); - double m_A47(0.0); - double m_A48(0.0); - double m_A49(0.0); - double m_A50(0.0); - double m_A51(0.0); - double m_A52(0.0); - double m_A53(0.0); - double m_A54(0.0); - double m_A55(0.0); - double m_A56(0.0); - double m_A57(0.0); - double m_A58(0.0); - double m_A59(0.0); - double m_A60(0.0); - double m_A61(0.0); - double m_A62(0.0); - double m_A63(0.0); - double m_A64(0.0); - double m_A65(0.0); - double m_A66(0.0); - double m_A67(0.0); - double m_A68(0.0); - double m_A69(0.0); - double m_A70(0.0); - double m_A71(0.0); - double m_A72(0.0); - double m_A73(0.0); - double m_A74(0.0); - double m_A75(0.0); - double m_A76(0.0); - double m_A77(0.0); - double m_A78(0.0); - double m_A79(0.0); - double m_A80(0.0); - double m_A81(0.0); - double m_A82(0.0); - double m_A83(0.0); - double m_A84(0.0); - double m_A85(0.0); - double m_A86(0.0); - double m_A87(0.0); - double m_A88(0.0); - double m_A89(0.0); - double m_A90(0.0); - double m_A91(0.0); - double m_A92(0.0); - double m_A93(0.0); - double m_A94(0.0); - double m_A95(0.0); - double m_A96(0.0); - double m_A97(0.0); - double m_A98(0.0); - double m_A99(0.0); - double m_A100(0.0); - double m_A101(0.0); - double m_A102(0.0); - double m_A103(0.0); - double m_A104(0.0); - double m_A105(0.0); - double m_A106(0.0); - double m_A107(0.0); - double m_A108(0.0); - double m_A109(0.0); - double m_A110(0.0); - double m_A111(0.0); - double m_A112(0.0); - double m_A113(0.0); - double m_A114(0.0); - double m_A115(0.0); - double m_A116(0.0); - double m_A117(0.0); - double m_A118(0.0); - double m_A119(0.0); - double m_A120(0.0); - double m_A121(0.0); - double m_A122(0.0); - double m_A123(0.0); - double m_A124(0.0); - double m_A125(0.0); - double m_A126(0.0); - double m_A127(0.0); - double m_A128(0.0); - double m_A129(0.0); - double m_A130(0.0); - double m_A131(0.0); - double m_A132(0.0); - double m_A133(0.0); - double m_A134(0.0); - double m_A135(0.0); - double m_A136(0.0); - double m_A137(0.0); - double m_A138(0.0); - double m_A139(0.0); - double m_A140(0.0); - double m_A141(0.0); - double m_A142(0.0); - double m_A143(0.0); - double m_A144(0.0); - double m_A145(0.0); - double m_A146(0.0); - double m_A147(0.0); - double m_A148(0.0); - double m_A149(0.0); - double m_A150(0.0); - double m_A151(0.0); - double m_A152(0.0); - double m_A153(0.0); - double m_A154(0.0); - double m_A155(0.0); - double m_A156(0.0); - double m_A157(0.0); - double m_A158(0.0); - double m_A159(0.0); - double m_A160(0.0); - double m_A161(0.0); - double m_A162(0.0); - double m_A163(0.0); - double m_A164(0.0); - double m_A165(0.0); - double m_A166(0.0); - double m_A167(0.0); - double m_A168(0.0); - double m_A169(0.0); - double m_A170(0.0); - double m_A171(0.0); - double m_A172(0.0); - double m_A173(0.0); - double m_A174(0.0); - double m_A175(0.0); - double m_A176(0.0); - double m_A177(0.0); m_A0 += gt[0]; m_A0 += gt[1]; m_A0 += gt[2]; - m_A0 += gt[3]; - m_A0 += gt[4]; - m_A0 += gt[5]; - m_A0 += gt[6]; m_A1 += go[0]; double RHS0 = Idr[0]; RHS0 += Idr[1]; RHS0 += Idr[2]; - RHS0 += Idr[3]; - RHS0 += Idr[4]; - RHS0 += Idr[5]; - RHS0 += Idr[6]; RHS0 -= go[1] * *cnV[1]; RHS0 -= go[2] * *cnV[2]; - RHS0 -= go[3] * *cnV[3]; - RHS0 -= go[4] * *cnV[4]; - RHS0 -= go[5] * *cnV[5]; - RHS0 -= go[6] * *cnV[6]; - m_A2 += gt[7]; - m_A2 += gt[8]; - m_A2 += gt[9]; - m_A4 += go[7]; - m_A3 += go[8]; - double RHS1 = Idr[7]; - RHS1 += Idr[8]; - RHS1 += Idr[9]; - RHS1 -= go[9] * *cnV[9]; - m_A5 += gt[10]; - m_A5 += gt[11]; - m_A5 += gt[12]; - m_A5 += gt[13]; - m_A5 += gt[14]; - m_A5 += gt[15]; - m_A5 += gt[16]; - m_A6 += go[10]; - double RHS2 = Idr[10]; + m_A3 += gt[3]; + m_A3 += gt[4]; + m_A3 += gt[5]; + m_A3 += gt[6]; + m_A4 += go[3]; + m_A2 += go[4]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 -= go[5] * *cnV[5]; + RHS1 -= go[6] * *cnV[6]; + m_A7 += gt[7]; + m_A7 += gt[8]; + m_A7 += gt[9]; + m_A7 += gt[10]; + m_A7 += gt[11]; + m_A7 += gt[12]; + m_A7 += gt[13]; + m_A5 += go[7]; + m_A6 += go[8]; + double RHS2 = Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; RHS2 += Idr[11]; RHS2 += Idr[12]; RHS2 += Idr[13]; - RHS2 += Idr[14]; - RHS2 += Idr[15]; - RHS2 += Idr[16]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; RHS2 -= go[11] * *cnV[11]; RHS2 -= go[12] * *cnV[12]; RHS2 -= go[13] * *cnV[13]; - RHS2 -= go[14] * *cnV[14]; - RHS2 -= go[15] * *cnV[15]; - RHS2 -= go[16] * *cnV[16]; - m_A7 += gt[17]; - m_A7 += gt[18]; - m_A7 += gt[19]; - m_A7 += gt[20]; - m_A9 += go[17]; - m_A10 += go[18]; - m_A8 += go[19]; - double RHS3 = Idr[17]; - RHS3 += Idr[18]; - RHS3 += Idr[19]; - RHS3 += Idr[20]; - RHS3 -= go[20] * *cnV[20]; - m_A11 += gt[21]; - m_A11 += gt[22]; - m_A11 += gt[23]; - m_A11 += gt[24]; - m_A12 += go[21]; - m_A12 += go[22]; - m_A13 += go[23]; - double RHS4 = Idr[21]; - RHS4 += Idr[22]; - RHS4 += Idr[23]; - RHS4 += Idr[24]; - RHS4 -= go[24] * *cnV[24]; - m_A14 += gt[25]; - m_A14 += gt[26]; - m_A15 += go[25]; - m_A16 += go[26]; - double RHS5 = Idr[25]; - RHS5 += Idr[26]; - m_A17 += gt[27]; - m_A17 += gt[28]; - m_A17 += gt[29]; - m_A18 += go[27]; - double RHS6 = Idr[27]; - RHS6 += Idr[28]; - RHS6 += Idr[29]; - RHS6 -= go[28] * *cnV[28]; - RHS6 -= go[29] * *cnV[29]; - m_A19 += gt[30]; - m_A19 += gt[31]; - m_A19 += gt[32]; - m_A19 += gt[33]; - m_A19 += gt[34]; - m_A19 += gt[35]; - m_A20 += go[30]; - m_A20 += go[31]; - m_A22 += go[32]; - m_A22 += go[33]; - m_A21 += go[34]; - double RHS7 = Idr[30]; - RHS7 += Idr[31]; - RHS7 += Idr[32]; - RHS7 += Idr[33]; - RHS7 += Idr[34]; - RHS7 += Idr[35]; - RHS7 -= go[35] * *cnV[35]; - m_A23 += gt[36]; - m_A23 += gt[37]; - m_A23 += gt[38]; - m_A23 += gt[39]; - m_A23 += gt[40]; - m_A23 += gt[41]; - m_A24 += go[36]; - m_A25 += go[37]; - double RHS8 = Idr[36]; - RHS8 += Idr[37]; - RHS8 += Idr[38]; - RHS8 += Idr[39]; - RHS8 += Idr[40]; - RHS8 += Idr[41]; - RHS8 -= go[38] * *cnV[38]; - RHS8 -= go[39] * *cnV[39]; - RHS8 -= go[40] * *cnV[40]; - RHS8 -= go[41] * *cnV[41]; - m_A26 += gt[42]; - m_A26 += gt[43]; - m_A26 += gt[44]; - m_A27 += go[42]; - double RHS9 = Idr[42]; - RHS9 += Idr[43]; - RHS9 += Idr[44]; - RHS9 -= go[43] * *cnV[43]; - RHS9 -= go[44] * *cnV[44]; - m_A28 += gt[45]; - m_A28 += gt[46]; - m_A28 += gt[47]; - m_A29 += go[45]; - double RHS10 = Idr[45]; - RHS10 += Idr[46]; - RHS10 += Idr[47]; - RHS10 -= go[46] * *cnV[46]; - RHS10 -= go[47] * *cnV[47]; - m_A30 += gt[48]; - m_A30 += gt[49]; - m_A30 += gt[50]; - m_A31 += go[48]; - double RHS11 = Idr[48]; - RHS11 += Idr[49]; - RHS11 += Idr[50]; - RHS11 -= go[49] * *cnV[49]; - RHS11 -= go[50] * *cnV[50]; - m_A32 += gt[51]; - m_A32 += gt[52]; - m_A32 += gt[53]; - m_A33 += go[51]; - double RHS12 = Idr[51]; - RHS12 += Idr[52]; - RHS12 += Idr[53]; - RHS12 -= go[52] * *cnV[52]; - RHS12 -= go[53] * *cnV[53]; - m_A34 += gt[54]; - m_A34 += gt[55]; - m_A34 += gt[56]; - m_A35 += go[54]; - double RHS13 = Idr[54]; - RHS13 += Idr[55]; - RHS13 += Idr[56]; - RHS13 -= go[55] * *cnV[55]; - RHS13 -= go[56] * *cnV[56]; - m_A36 += gt[57]; - m_A36 += gt[58]; - m_A37 += go[57]; - double RHS14 = Idr[57]; - RHS14 += Idr[58]; - RHS14 -= go[58] * *cnV[58]; - m_A38 += gt[59]; - m_A38 += gt[60]; - m_A38 += gt[61]; - m_A39 += go[59]; - double RHS15 = Idr[59]; - RHS15 += Idr[60]; - RHS15 += Idr[61]; - RHS15 -= go[60] * *cnV[60]; - RHS15 -= go[61] * *cnV[61]; - m_A40 += gt[62]; - m_A40 += gt[63]; - m_A41 += go[62]; - double RHS16 = Idr[62]; - RHS16 += Idr[63]; - RHS16 -= go[63] * *cnV[63]; - m_A42 += gt[64]; - m_A42 += gt[65]; - m_A43 += go[64]; - double RHS17 = Idr[64]; - RHS17 += Idr[65]; - RHS17 -= go[65] * *cnV[65]; - m_A44 += gt[66]; - m_A44 += gt[67]; - m_A45 += go[66]; - double RHS18 = Idr[66]; - RHS18 += Idr[67]; - RHS18 -= go[67] * *cnV[67]; - m_A46 += gt[68]; - m_A46 += gt[69]; - m_A47 += go[68]; - double RHS19 = Idr[68]; - RHS19 += Idr[69]; - RHS19 -= go[69] * *cnV[69]; - m_A48 += gt[70]; - m_A48 += gt[71]; - m_A49 += go[70]; - double RHS20 = Idr[70]; - RHS20 += Idr[71]; - RHS20 -= go[71] * *cnV[71]; - m_A50 += gt[72]; - m_A50 += gt[73]; - m_A51 += go[72]; - double RHS21 = Idr[72]; - RHS21 += Idr[73]; - RHS21 -= go[73] * *cnV[73]; - m_A52 += gt[74]; - m_A52 += gt[75]; - m_A52 += gt[76]; - m_A52 += gt[77]; - m_A52 += gt[78]; - m_A53 += go[74]; - m_A55 += go[75]; - m_A54 += go[76]; - double RHS22 = Idr[74]; - RHS22 += Idr[75]; - RHS22 += Idr[76]; - RHS22 += Idr[77]; - RHS22 += Idr[78]; - RHS22 -= go[77] * *cnV[77]; - RHS22 -= go[78] * *cnV[78]; - m_A56 += gt[79]; - m_A56 += gt[80]; - m_A58 += go[79]; - m_A57 += go[80]; - double RHS23 = Idr[79]; - RHS23 += Idr[80]; - m_A59 += gt[81]; - m_A59 += gt[82]; - m_A60 += go[81]; - double RHS24 = Idr[81]; - RHS24 += Idr[82]; - RHS24 -= go[82] * *cnV[82]; - m_A61 += gt[83]; - m_A61 += gt[84]; - m_A62 += go[83]; - double RHS25 = Idr[83]; - RHS25 += Idr[84]; - RHS25 -= go[84] * *cnV[84]; - m_A63 += gt[85]; - m_A63 += gt[86]; - m_A63 += gt[87]; - m_A64 += go[85]; - double RHS26 = Idr[85]; - RHS26 += Idr[86]; - RHS26 += Idr[87]; - RHS26 -= go[86] * *cnV[86]; - RHS26 -= go[87] * *cnV[87]; - m_A68 += gt[88]; - m_A68 += gt[89]; - m_A68 += gt[90]; - m_A68 += gt[91]; - m_A68 += gt[92]; - m_A65 += go[88]; - m_A67 += go[89]; - m_A66 += go[90]; - double RHS27 = Idr[88]; - RHS27 += Idr[89]; - RHS27 += Idr[90]; - RHS27 += Idr[91]; - RHS27 += Idr[92]; - RHS27 -= go[91] * *cnV[91]; - RHS27 -= go[92] * *cnV[92]; - m_A71 += gt[93]; - m_A71 += gt[94]; - m_A71 += gt[95]; - m_A72 += go[93]; - double RHS28 = Idr[93]; - RHS28 += Idr[94]; - RHS28 += Idr[95]; - RHS28 -= go[94] * *cnV[94]; - RHS28 -= go[95] * *cnV[95]; - m_A73 += gt[96]; - m_A73 += gt[97]; - m_A73 += gt[98]; - m_A74 += go[96]; - double RHS29 = Idr[96]; - RHS29 += Idr[97]; - RHS29 += Idr[98]; - RHS29 -= go[97] * *cnV[97]; - RHS29 -= go[98] * *cnV[98]; - m_A75 += gt[99]; - m_A75 += gt[100]; - m_A75 += gt[101]; - m_A76 += go[99]; - double RHS30 = Idr[99]; - RHS30 += Idr[100]; - RHS30 += Idr[101]; - RHS30 -= go[100] * *cnV[100]; - RHS30 -= go[101] * *cnV[101]; - m_A77 += gt[102]; - m_A77 += gt[103]; - m_A79 += go[102]; - m_A78 += go[103]; - double RHS31 = Idr[102]; - RHS31 += Idr[103]; - m_A80 += gt[104]; - m_A80 += gt[105]; - m_A82 += go[104]; - m_A81 += go[105]; - double RHS32 = Idr[104]; - RHS32 += Idr[105]; - m_A85 += gt[106]; - m_A85 += gt[107]; - m_A85 += gt[108]; - m_A85 += gt[109]; - m_A84 += go[106]; - m_A83 += go[107]; - double RHS33 = Idr[106]; - RHS33 += Idr[107]; - RHS33 += Idr[108]; - RHS33 += Idr[109]; - RHS33 -= go[108] * *cnV[108]; - RHS33 -= go[109] * *cnV[109]; - m_A93 += gt[110]; - m_A93 += gt[111]; - m_A93 += gt[112]; - m_A93 += gt[113]; - m_A93 += gt[114]; - m_A93 += gt[115]; - m_A92 += go[110]; - m_A91 += go[111]; - m_A90 += go[112]; - m_A89 += go[113]; - m_A88 += go[114]; - m_A87 += go[115]; - double RHS34 = Idr[110]; - RHS34 += Idr[111]; - RHS34 += Idr[112]; - RHS34 += Idr[113]; - RHS34 += Idr[114]; - RHS34 += Idr[115]; - m_A97 += gt[116]; - m_A97 += gt[117]; - m_A97 += gt[118]; - m_A98 += go[116]; - m_A95 += go[117]; - double RHS35 = Idr[116]; - RHS35 += Idr[117]; - RHS35 += Idr[118]; - RHS35 -= go[118] * *cnV[118]; - m_A102 += gt[119]; - m_A102 += gt[120]; - m_A102 += gt[121]; - m_A102 += gt[122]; - m_A102 += gt[123]; - m_A102 += gt[124]; - m_A102 += gt[125]; - m_A100 += go[119]; - m_A99 += go[120]; - m_A99 += go[121]; - m_A103 += go[122]; - m_A103 += go[123]; - double RHS36 = Idr[119]; - RHS36 += Idr[120]; - RHS36 += Idr[121]; - RHS36 += Idr[122]; - RHS36 += Idr[123]; - RHS36 += Idr[124]; - RHS36 += Idr[125]; - RHS36 -= go[124] * *cnV[124]; - RHS36 -= go[125] * *cnV[125]; - m_A105 += gt[126]; - m_A105 += gt[127]; - m_A105 += gt[128]; - m_A105 += gt[129]; - m_A105 += gt[130]; - m_A105 += gt[131]; - m_A105 += gt[132]; - m_A106 += go[126]; - m_A104 += go[127]; - double RHS37 = Idr[126]; - RHS37 += Idr[127]; - RHS37 += Idr[128]; - RHS37 += Idr[129]; - RHS37 += Idr[130]; - RHS37 += Idr[131]; - RHS37 += Idr[132]; - RHS37 -= go[128] * *cnV[128]; - RHS37 -= go[129] * *cnV[129]; - RHS37 -= go[130] * *cnV[130]; - RHS37 -= go[131] * *cnV[131]; - RHS37 -= go[132] * *cnV[132]; - m_A109 += gt[133]; - m_A109 += gt[134]; - m_A108 += go[133]; - m_A110 += go[134]; - double RHS38 = Idr[133]; - RHS38 += Idr[134]; - m_A117 += gt[135]; - m_A117 += gt[136]; - m_A117 += gt[137]; - m_A117 += gt[138]; - m_A117 += gt[139]; - m_A117 += gt[140]; - m_A116 += go[135]; - m_A115 += go[136]; - m_A114 += go[137]; - m_A113 += go[138]; - m_A112 += go[139]; - m_A111 += go[140]; - double RHS39 = Idr[135]; - RHS39 += Idr[136]; - RHS39 += Idr[137]; - RHS39 += Idr[138]; - RHS39 += Idr[139]; - RHS39 += Idr[140]; - m_A120 += gt[141]; - m_A120 += gt[142]; - m_A119 += go[141]; - m_A121 += go[142]; - double RHS40 = Idr[141]; - RHS40 += Idr[142]; - m_A126 += gt[143]; - m_A126 += gt[144]; - m_A126 += gt[145]; - m_A126 += gt[146]; - m_A126 += gt[147]; - m_A125 += go[143]; - m_A124 += go[144]; - m_A123 += go[145]; - m_A122 += go[146]; - m_A127 += go[147]; - double RHS41 = Idr[143]; - RHS41 += Idr[144]; - RHS41 += Idr[145]; - RHS41 += Idr[146]; - RHS41 += Idr[147]; - m_A131 += gt[148]; - m_A131 += gt[149]; - m_A131 += gt[150]; - m_A131 += gt[151]; - m_A131 += gt[152]; - m_A130 += go[148]; - m_A129 += go[149]; - m_A128 += go[150]; - double RHS42 = Idr[148]; - RHS42 += Idr[149]; - RHS42 += Idr[150]; - RHS42 += Idr[151]; - RHS42 += Idr[152]; - RHS42 -= go[151] * *cnV[151]; - RHS42 -= go[152] * *cnV[152]; - m_A137 += gt[153]; - m_A137 += gt[154]; - m_A137 += gt[155]; - m_A137 += gt[156]; - m_A137 += gt[157]; - m_A137 += gt[158]; - m_A135 += go[153]; - m_A134 += go[154]; - m_A139 += go[155]; - m_A133 += go[156]; - m_A133 += go[157]; - double RHS43 = Idr[153]; - RHS43 += Idr[154]; - RHS43 += Idr[155]; - RHS43 += Idr[156]; - RHS43 += Idr[157]; - RHS43 += Idr[158]; - RHS43 -= go[158] * *cnV[158]; - m_A148 += gt[159]; - m_A148 += gt[160]; - m_A148 += gt[161]; - m_A148 += gt[162]; - m_A148 += gt[163]; - m_A148 += gt[164]; - m_A148 += gt[165]; - m_A142 += go[159]; - m_A144 += go[160]; - m_A146 += go[161]; - m_A143 += go[162]; - m_A141 += go[163]; - double RHS44 = Idr[159]; - RHS44 += Idr[160]; - RHS44 += Idr[161]; - RHS44 += Idr[162]; - RHS44 += Idr[163]; - RHS44 += Idr[164]; - RHS44 += Idr[165]; - RHS44 -= go[164] * *cnV[164]; - RHS44 -= go[165] * *cnV[165]; - m_A157 += gt[166]; - m_A157 += gt[167]; - m_A157 += gt[168]; - m_A157 += gt[169]; - m_A157 += gt[170]; - m_A157 += gt[171]; - m_A157 += gt[172]; - m_A157 += gt[173]; - m_A157 += gt[174]; - m_A155 += go[166]; - m_A153 += go[167]; - m_A151 += go[168]; - m_A154 += go[169]; - m_A154 += go[170]; - m_A152 += go[171]; - m_A152 += go[172]; - double RHS45 = Idr[166]; - RHS45 += Idr[167]; - RHS45 += Idr[168]; - RHS45 += Idr[169]; - RHS45 += Idr[170]; - RHS45 += Idr[171]; - RHS45 += Idr[172]; - RHS45 += Idr[173]; - RHS45 += Idr[174]; - RHS45 -= go[173] * *cnV[173]; - RHS45 -= go[174] * *cnV[174]; - m_A160 += gt[175]; - m_A160 += gt[176]; - m_A159 += go[175]; - m_A161 += go[176]; - double RHS46 = Idr[175]; - RHS46 += Idr[176]; - m_A177 += gt[177]; - m_A177 += gt[178]; - m_A177 += gt[179]; - m_A177 += gt[180]; - m_A177 += gt[181]; - m_A177 += gt[182]; - m_A177 += gt[183]; - m_A177 += gt[184]; - m_A176 += go[177]; - m_A164 += go[178]; - m_A163 += go[179]; - m_A165 += go[180]; - m_A170 += go[181]; - m_A168 += go[182]; - m_A171 += go[183]; - m_A162 += go[184]; - double RHS47 = Idr[177]; - RHS47 += Idr[178]; - RHS47 += Idr[179]; - RHS47 += Idr[180]; - RHS47 += Idr[181]; - RHS47 += Idr[182]; - RHS47 += Idr[183]; - RHS47 += Idr[184]; const double f0 = 1.0 / m_A0; - const double f0_27 = -f0 * m_A65; - m_A66 += m_A1 * f0_27; - RHS27 += f0_27 * RHS0; - const double f1 = 1.0 / m_A2; - const double f1_27 = -f1 * m_A66; - m_A68 += m_A3 * f1_27; - m_A70 += m_A4 * f1_27; - RHS27 += f1_27 * RHS1; - const double f1_44 = -f1 * m_A141; - m_A145 += m_A3 * f1_44; - m_A148 += m_A4 * f1_44; - RHS44 += f1_44 * RHS1; - const double f2 = 1.0 / m_A5; - const double f2_44 = -f2 * m_A142; - m_A146 += m_A6 * f2_44; - RHS44 += f2_44 * RHS2; - const double f3 = 1.0 / m_A7; - const double f3_27 = -f3 * m_A67; - m_A68 += m_A8 * f3_27; - m_A69 += m_A9 * f3_27; - m_A70 += m_A10 * f3_27; - RHS27 += f3_27 * RHS3; - const double f3_35 = -f3 * m_A95; - m_A96 += m_A8 * f3_35; - m_A97 += m_A9 * f3_35; - m_A98 += m_A10 * f3_35; - RHS35 += f3_35 * RHS3; - const double f3_44 = -f3 * m_A143; - m_A145 += m_A8 * f3_44; - m_A146 += m_A9 * f3_44; - m_A148 += m_A10 * f3_44; - RHS44 += f3_44 * RHS3; - const double f4 = 1.0 / m_A11; - const double f4_36 = -f4 * m_A99; - m_A102 += m_A12 * f4_36; - m_A103 += m_A13 * f4_36; - RHS36 += f4_36 * RHS4; - const double f4_45 = -f4 * m_A151; - m_A154 += m_A12 * f4_45; - m_A157 += m_A13 * f4_45; - RHS45 += f4_45 * RHS4; - const double f5 = 1.0 / m_A14; - const double f5_33 = -f5 * m_A83; - m_A85 += m_A15 * f5_33; - m_A86 += m_A16 * f5_33; - RHS33 += f5_33 * RHS5; - const double f5_36 = -f5 * m_A100; - m_A101 += m_A15 * f5_36; - m_A102 += m_A16 * f5_36; - RHS36 += f5_36 * RHS5; - const double f6 = 1.0 / m_A17; - const double f6_33 = -f6 * m_A84; - m_A85 += m_A18 * f6_33; - RHS33 += f6_33 * RHS6; - const double f7 = 1.0 / m_A19; - const double f7_43 = -f7 * m_A133; - m_A137 += m_A20 * f7_43; - m_A138 += m_A21 * f7_43; - m_A139 += m_A22 * f7_43; - RHS43 += f7_43 * RHS7; - const double f7_44 = -f7 * m_A144; - m_A147 += m_A20 * f7_44; - m_A148 += m_A21 * f7_44; - m_A149 += m_A22 * f7_44; - RHS44 += f7_44 * RHS7; - const double f7_45 = -f7 * m_A152; - m_A155 += m_A20 * f7_45; - m_A156 += m_A21 * f7_45; - m_A157 += m_A22 * f7_45; - RHS45 += f7_45 * RHS7; - const double f8 = 1.0 / m_A23; - const double f8_37 = -f8 * m_A104; - m_A106 += m_A24 * f8_37; - m_A107 += m_A25 * f8_37; - RHS37 += f8_37 * RHS8; - const double f8_43 = -f8 * m_A134; - m_A137 += m_A24 * f8_43; - m_A139 += m_A25 * f8_43; - RHS43 += f8_43 * RHS8; - const double f8_45 = -f8 * m_A153; - m_A155 += m_A24 * f8_45; - m_A157 += m_A25 * f8_45; - RHS45 += f8_45 * RHS8; - const double f9 = 1.0 / m_A26; - const double f9_34 = -f9 * m_A87; - m_A93 += m_A27 * f9_34; - RHS34 += f9_34 * RHS9; - const double f10 = 1.0 / m_A28; - const double f10_34 = -f10 * m_A88; - m_A93 += m_A29 * f10_34; - RHS34 += f10_34 * RHS10; - const double f11 = 1.0 / m_A30; - const double f11_34 = -f11 * m_A89; - m_A93 += m_A31 * f11_34; - RHS34 += f11_34 * RHS11; - const double f12 = 1.0 / m_A32; - const double f12_34 = -f12 * m_A90; - m_A93 += m_A33 * f12_34; - RHS34 += f12_34 * RHS12; - const double f13 = 1.0 / m_A34; - const double f13_34 = -f13 * m_A91; - m_A93 += m_A35 * f13_34; - RHS34 += f13_34 * RHS13; - const double f14 = 1.0 / m_A36; - const double f14_42 = -f14 * m_A128; - m_A131 += m_A37 * f14_42; - RHS42 += f14_42 * RHS14; - const double f15 = 1.0 / m_A38; - const double f15_39 = -f15 * m_A111; - m_A117 += m_A39 * f15_39; - RHS39 += f15_39 * RHS15; - const double f16 = 1.0 / m_A40; - const double f16_41 = -f16 * m_A122; - m_A126 += m_A41 * f16_41; - RHS41 += f16_41 * RHS16; - const double f17 = 1.0 / m_A42; - const double f17_38 = -f17 * m_A108; - m_A109 += m_A43 * f17_38; - RHS38 += f17_38 * RHS17; - const double f18 = 1.0 / m_A44; - const double f18_40 = -f18 * m_A119; - m_A120 += m_A45 * f18_40; - RHS40 += f18_40 * RHS18; - const double f19 = 1.0 / m_A46; - const double f19_41 = -f19 * m_A123; - m_A126 += m_A47 * f19_41; - RHS41 += f19_41 * RHS19; - const double f20 = 1.0 / m_A48; - const double f20_41 = -f20 * m_A124; - m_A126 += m_A49 * f20_41; - RHS41 += f20_41 * RHS20; - const double f21 = 1.0 / m_A50; - const double f21_41 = -f21 * m_A125; - m_A126 += m_A51 * f21_41; - RHS41 += f21_41 * RHS21; - const double f22 = 1.0 / m_A52; - const double f22_43 = -f22 * m_A135; - m_A136 += m_A53 * f22_43; - m_A137 += m_A54 * f22_43; - m_A140 += m_A55 * f22_43; - RHS43 += f22_43 * RHS22; - const double f22_47 = -f22 * m_A162; - m_A167 += m_A53 * f22_47; - m_A173 += m_A54 * f22_47; - m_A177 += m_A55 * f22_47; - RHS47 += f22_47 * RHS22; - const double f23 = 1.0 / m_A56; - const double f23_34 = -f23 * m_A92; - m_A93 += m_A57 * f23_34; - m_A94 += m_A58 * f23_34; - RHS34 += f23_34 * RHS23; - const double f23_47 = -f23 * m_A163; - m_A166 += m_A57 * f23_47; - m_A177 += m_A58 * f23_47; - RHS47 += f23_47 * RHS23; - const double f24 = 1.0 / m_A59; - const double f24_46 = -f24 * m_A159; - m_A160 += m_A60 * f24_46; - RHS46 += f24_46 * RHS24; - const double f25 = 1.0 / m_A61; - const double f25_42 = -f25 * m_A129; - m_A131 += m_A62 * f25_42; - RHS42 += f25_42 * RHS25; - const double f26 = 1.0 / m_A63; - const double f26_39 = -f26 * m_A112; - m_A117 += m_A64 * f26_39; - RHS39 += f26_39 * RHS26; - const double f27 = 1.0 / m_A68; - const double f27_35 = -f27 * m_A96; - m_A97 += m_A69 * f27_35; - m_A98 += m_A70 * f27_35; - RHS35 += f27_35 * RHS27; - const double f27_44 = -f27 * m_A145; - m_A146 += m_A69 * f27_44; - m_A148 += m_A70 * f27_44; - RHS44 += f27_44 * RHS27; - const double f28 = 1.0 / m_A71; - const double f28_39 = -f28 * m_A113; - m_A117 += m_A72 * f28_39; - RHS39 += f28_39 * RHS28; - const double f29 = 1.0 / m_A73; - const double f29_39 = -f29 * m_A114; - m_A117 += m_A74 * f29_39; - RHS39 += f29_39 * RHS29; - const double f30 = 1.0 / m_A75; - const double f30_39 = -f30 * m_A115; - m_A117 += m_A76 * f30_39; - RHS39 += f30_39 * RHS30; - const double f31 = 1.0 / m_A77; - const double f31_39 = -f31 * m_A116; - m_A117 += m_A78 * f31_39; - m_A118 += m_A79 * f31_39; - RHS39 += f31_39 * RHS31; - const double f31_47 = -f31 * m_A164; - m_A169 += m_A78 * f31_47; - m_A177 += m_A79 * f31_47; - RHS47 += f31_47 * RHS31; - const double f32 = 1.0 / m_A80; - const double f32_42 = -f32 * m_A130; - m_A131 += m_A81 * f32_42; - m_A132 += m_A82 * f32_42; - RHS42 += f32_42 * RHS32; - const double f32_47 = -f32 * m_A165; - m_A172 += m_A81 * f32_47; - m_A177 += m_A82 * f32_47; - RHS47 += f32_47 * RHS32; - const double f33 = 1.0 / m_A85; - const double f33_36 = -f33 * m_A101; - m_A102 += m_A86 * f33_36; - RHS36 += f33_36 * RHS33; - const double f34 = 1.0 / m_A93; - const double f34_47 = -f34 * m_A166; - m_A177 += m_A94 * f34_47; - RHS47 += f34_47 * RHS34; - const double f35 = 1.0 / m_A97; - const double f35_44 = -f35 * m_A146; - m_A148 += m_A98 * f35_44; - RHS44 += f35_44 * RHS35; - const double f36 = 1.0 / m_A102; - const double f36_45 = -f36 * m_A154; - m_A157 += m_A103 * f36_45; - RHS45 += f36_45 * RHS36; - const double f37 = 1.0 / m_A105; - const double f37_43 = -f37 * m_A136; - m_A137 += m_A106 * f37_43; - m_A139 += m_A107 * f37_43; - RHS43 += f37_43 * RHS37; - const double f37_47 = -f37 * m_A167; - m_A173 += m_A106 * f37_47; - m_A175 += m_A107 * f37_47; - RHS47 += f37_47 * RHS37; - const double f38 = 1.0 / m_A109; - const double f38_47 = -f38 * m_A168; - m_A177 += m_A110 * f38_47; - RHS47 += f38_47 * RHS38; - const double f39 = 1.0 / m_A117; - const double f39_47 = -f39 * m_A169; - m_A177 += m_A118 * f39_47; - RHS47 += f39_47 * RHS39; - const double f40 = 1.0 / m_A120; - const double f40_47 = -f40 * m_A170; - m_A177 += m_A121 * f40_47; - RHS47 += f40_47 * RHS40; - const double f41 = 1.0 / m_A126; - const double f41_47 = -f41 * m_A171; - m_A177 += m_A127 * f41_47; - RHS47 += f41_47 * RHS41; - const double f42 = 1.0 / m_A131; - const double f42_47 = -f42 * m_A172; - m_A177 += m_A132 * f42_47; - RHS47 += f42_47 * RHS42; - const double f43 = 1.0 / m_A137; - const double f43_44 = -f43 * m_A147; - m_A148 += m_A138 * f43_44; - m_A149 += m_A139 * f43_44; - m_A150 += m_A140 * f43_44; - RHS44 += f43_44 * RHS43; - const double f43_45 = -f43 * m_A155; - m_A156 += m_A138 * f43_45; - m_A157 += m_A139 * f43_45; - m_A158 += m_A140 * f43_45; - RHS45 += f43_45 * RHS43; - const double f43_47 = -f43 * m_A173; - m_A174 += m_A138 * f43_47; - m_A175 += m_A139 * f43_47; - m_A177 += m_A140 * f43_47; - RHS47 += f43_47 * RHS43; - const double f44 = 1.0 / m_A148; - const double f44_45 = -f44 * m_A156; - m_A157 += m_A149 * f44_45; - m_A158 += m_A150 * f44_45; - RHS45 += f44_45 * RHS44; - const double f44_47 = -f44 * m_A174; - m_A175 += m_A149 * f44_47; - m_A177 += m_A150 * f44_47; - RHS47 += f44_47 * RHS44; - const double f45 = 1.0 / m_A157; - const double f45_47 = -f45 * m_A175; - m_A177 += m_A158 * f45_47; - RHS47 += f45_47 * RHS45; - const double f46 = 1.0 / m_A160; - const double f46_47 = -f46 * m_A176; - m_A177 += m_A161 * f46_47; - RHS47 += f46_47 * RHS46; - V[47] = RHS47 / m_A177; - double tmp46 = 0.0; - tmp46 += m_A161 * V[47]; - V[46] = (RHS46 - tmp46) / m_A160; - double tmp45 = 0.0; - tmp45 += m_A158 * V[47]; - V[45] = (RHS45 - tmp45) / m_A157; - double tmp44 = 0.0; - tmp44 += m_A149 * V[45]; - tmp44 += m_A150 * V[47]; - V[44] = (RHS44 - tmp44) / m_A148; - double tmp43 = 0.0; - tmp43 += m_A138 * V[44]; - tmp43 += m_A139 * V[45]; - tmp43 += m_A140 * V[47]; - V[43] = (RHS43 - tmp43) / m_A137; - double tmp42 = 0.0; - tmp42 += m_A132 * V[47]; - V[42] = (RHS42 - tmp42) / m_A131; - double tmp41 = 0.0; - tmp41 += m_A127 * V[47]; - V[41] = (RHS41 - tmp41) / m_A126; - double tmp40 = 0.0; - tmp40 += m_A121 * V[47]; - V[40] = (RHS40 - tmp40) / m_A120; - double tmp39 = 0.0; - tmp39 += m_A118 * V[47]; - V[39] = (RHS39 - tmp39) / m_A117; - double tmp38 = 0.0; - tmp38 += m_A110 * V[47]; - V[38] = (RHS38 - tmp38) / m_A109; - double tmp37 = 0.0; - tmp37 += m_A106 * V[43]; - tmp37 += m_A107 * V[45]; - V[37] = (RHS37 - tmp37) / m_A105; - double tmp36 = 0.0; - tmp36 += m_A103 * V[45]; - V[36] = (RHS36 - tmp36) / m_A102; - double tmp35 = 0.0; - tmp35 += m_A98 * V[44]; - V[35] = (RHS35 - tmp35) / m_A97; - double tmp34 = 0.0; - tmp34 += m_A94 * V[47]; - V[34] = (RHS34 - tmp34) / m_A93; - double tmp33 = 0.0; - tmp33 += m_A86 * V[36]; - V[33] = (RHS33 - tmp33) / m_A85; - double tmp32 = 0.0; - tmp32 += m_A81 * V[42]; - tmp32 += m_A82 * V[47]; - V[32] = (RHS32 - tmp32) / m_A80; - double tmp31 = 0.0; - tmp31 += m_A78 * V[39]; - tmp31 += m_A79 * V[47]; - V[31] = (RHS31 - tmp31) / m_A77; - double tmp30 = 0.0; - tmp30 += m_A76 * V[39]; - V[30] = (RHS30 - tmp30) / m_A75; - double tmp29 = 0.0; - tmp29 += m_A74 * V[39]; - V[29] = (RHS29 - tmp29) / m_A73; - double tmp28 = 0.0; - tmp28 += m_A72 * V[39]; - V[28] = (RHS28 - tmp28) / m_A71; - double tmp27 = 0.0; - tmp27 += m_A69 * V[35]; - tmp27 += m_A70 * V[44]; - V[27] = (RHS27 - tmp27) / m_A68; - double tmp26 = 0.0; - tmp26 += m_A64 * V[39]; - V[26] = (RHS26 - tmp26) / m_A63; - double tmp25 = 0.0; - tmp25 += m_A62 * V[42]; - V[25] = (RHS25 - tmp25) / m_A61; - double tmp24 = 0.0; - tmp24 += m_A60 * V[46]; - V[24] = (RHS24 - tmp24) / m_A59; - double tmp23 = 0.0; - tmp23 += m_A57 * V[34]; - tmp23 += m_A58 * V[47]; - V[23] = (RHS23 - tmp23) / m_A56; - double tmp22 = 0.0; - tmp22 += m_A53 * V[37]; - tmp22 += m_A54 * V[43]; - tmp22 += m_A55 * V[47]; - V[22] = (RHS22 - tmp22) / m_A52; - double tmp21 = 0.0; - tmp21 += m_A51 * V[41]; - V[21] = (RHS21 - tmp21) / m_A50; - double tmp20 = 0.0; - tmp20 += m_A49 * V[41]; - V[20] = (RHS20 - tmp20) / m_A48; - double tmp19 = 0.0; - tmp19 += m_A47 * V[41]; - V[19] = (RHS19 - tmp19) / m_A46; - double tmp18 = 0.0; - tmp18 += m_A45 * V[40]; - V[18] = (RHS18 - tmp18) / m_A44; - double tmp17 = 0.0; - tmp17 += m_A43 * V[38]; - V[17] = (RHS17 - tmp17) / m_A42; - double tmp16 = 0.0; - tmp16 += m_A41 * V[41]; - V[16] = (RHS16 - tmp16) / m_A40; - double tmp15 = 0.0; - tmp15 += m_A39 * V[39]; - V[15] = (RHS15 - tmp15) / m_A38; - double tmp14 = 0.0; - tmp14 += m_A37 * V[42]; - V[14] = (RHS14 - tmp14) / m_A36; - double tmp13 = 0.0; - tmp13 += m_A35 * V[34]; - V[13] = (RHS13 - tmp13) / m_A34; - double tmp12 = 0.0; - tmp12 += m_A33 * V[34]; - V[12] = (RHS12 - tmp12) / m_A32; - double tmp11 = 0.0; - tmp11 += m_A31 * V[34]; - V[11] = (RHS11 - tmp11) / m_A30; - double tmp10 = 0.0; - tmp10 += m_A29 * V[34]; - V[10] = (RHS10 - tmp10) / m_A28; - double tmp9 = 0.0; - tmp9 += m_A27 * V[34]; - V[9] = (RHS9 - tmp9) / m_A26; - double tmp8 = 0.0; - tmp8 += m_A24 * V[43]; - tmp8 += m_A25 * V[45]; - V[8] = (RHS8 - tmp8) / m_A23; - double tmp7 = 0.0; - tmp7 += m_A20 * V[43]; - tmp7 += m_A21 * V[44]; - tmp7 += m_A22 * V[45]; - V[7] = (RHS7 - tmp7) / m_A19; - double tmp6 = 0.0; - tmp6 += m_A18 * V[33]; - V[6] = (RHS6 - tmp6) / m_A17; - double tmp5 = 0.0; - tmp5 += m_A15 * V[33]; - tmp5 += m_A16 * V[36]; - V[5] = (RHS5 - tmp5) / m_A14; - double tmp4 = 0.0; - tmp4 += m_A12 * V[36]; - tmp4 += m_A13 * V[45]; - V[4] = (RHS4 - tmp4) / m_A11; - double tmp3 = 0.0; - tmp3 += m_A8 * V[27]; - tmp3 += m_A9 * V[35]; - tmp3 += m_A10 * V[44]; - V[3] = (RHS3 - tmp3) / m_A7; - double tmp2 = 0.0; - tmp2 += m_A6 * V[35]; - V[2] = (RHS2 - tmp2) / m_A5; + const double f0_1 = -f0 * m_A2; + m_A3 += m_A1 * f0_1; + RHS1 += f0_1 * RHS0; + const double f0_2 = -f0 * m_A5; + m_A6 += m_A1 * f0_2; + RHS2 += f0_2 * RHS0; + const double f1 = 1.0 / m_A3; + const double f1_2 = -f1 * m_A6; + m_A7 += m_A4 * f1_2; + RHS2 += f1_2 * RHS1; + V[2] = RHS2 / m_A7; double tmp1 = 0.0; - tmp1 += m_A3 * V[27]; - tmp1 += m_A4 * V[44]; - V[1] = (RHS1 - tmp1) / m_A2; + tmp1 += m_A4 * V[2]; + V[1] = (RHS1 - tmp1) / m_A3; double tmp0 = 0.0; tmp0 += m_A1 * V[1]; V[0] = (RHS0 - tmp0) / m_A0; @@ -9295,6 +10516,575 @@ static void nl_gcr_34e910fc1896999f_76_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_3c79fd354e01fa8c_89_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A3 += go[3]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 -= go[4] * *cnV[4]; + RHS1 -= go[5] * *cnV[5]; + RHS1 -= go[6] * *cnV[6]; + m_A4 += gt[7]; + m_A4 += gt[8]; + m_A4 += gt[9]; + m_A4 += gt[10]; + m_A6 += go[7]; + m_A7 += go[8]; + m_A5 += go[9]; + double RHS2 = Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 -= go[10] * *cnV[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A8 += gt[15]; + m_A11 += go[11]; + m_A10 += go[12]; + m_A9 += go[13]; + double RHS3 = Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + RHS3 += Idr[14]; + RHS3 += Idr[15]; + RHS3 -= go[14] * *cnV[14]; + RHS3 -= go[15] * *cnV[15]; + m_A12 += gt[16]; + m_A12 += gt[17]; + m_A12 += gt[18]; + m_A13 += go[16]; + double RHS4 = Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + RHS4 -= go[17] * *cnV[17]; + RHS4 -= go[18] * *cnV[18]; + m_A14 += gt[19]; + m_A14 += gt[20]; + m_A14 += gt[21]; + m_A14 += gt[22]; + m_A15 += go[19]; + double RHS5 = Idr[19]; + RHS5 += Idr[20]; + RHS5 += Idr[21]; + RHS5 += Idr[22]; + RHS5 -= go[20] * *cnV[20]; + RHS5 -= go[21] * *cnV[21]; + RHS5 -= go[22] * *cnV[22]; + m_A16 += gt[23]; + m_A16 += gt[24]; + m_A16 += gt[25]; + m_A16 += gt[26]; + m_A16 += gt[27]; + m_A16 += gt[28]; + m_A17 += go[23]; + m_A19 += go[24]; + m_A20 += go[25]; + m_A18 += go[26]; + double RHS6 = Idr[23]; + RHS6 += Idr[24]; + RHS6 += Idr[25]; + RHS6 += Idr[26]; + RHS6 += Idr[27]; + RHS6 += Idr[28]; + RHS6 -= go[27] * *cnV[27]; + RHS6 -= go[28] * *cnV[28]; + m_A21 += gt[29]; + m_A21 += gt[30]; + m_A21 += gt[31]; + m_A21 += gt[32]; + m_A21 += gt[33]; + m_A22 += go[29]; + m_A24 += go[30]; + m_A23 += go[31]; + double RHS7 = Idr[29]; + RHS7 += Idr[30]; + RHS7 += Idr[31]; + RHS7 += Idr[32]; + RHS7 += Idr[33]; + RHS7 -= go[32] * *cnV[32]; + RHS7 -= go[33] * *cnV[33]; + m_A27 += gt[34]; + m_A27 += gt[35]; + m_A27 += gt[36]; + m_A26 += go[34]; + m_A25 += go[35]; + double RHS8 = Idr[34]; + RHS8 += Idr[35]; + RHS8 += Idr[36]; + RHS8 -= go[36] * *cnV[36]; + m_A32 += gt[37]; + m_A32 += gt[38]; + m_A32 += gt[39]; + m_A30 += go[37]; + double RHS9 = Idr[37]; + RHS9 += Idr[38]; + RHS9 += Idr[39]; + RHS9 -= go[38] * *cnV[38]; + RHS9 -= go[39] * *cnV[39]; + m_A38 += gt[40]; + m_A38 += gt[41]; + m_A34 += go[40]; + m_A35 += go[41]; + double RHS10 = Idr[40]; + RHS10 += Idr[41]; + m_A42 += gt[42]; + m_A42 += gt[43]; + m_A42 += gt[44]; + m_A42 += gt[45]; + m_A42 += gt[46]; + m_A42 += gt[47]; + m_A42 += gt[48]; + m_A41 += go[42]; + m_A43 += go[43]; + double RHS11 = Idr[42]; + RHS11 += Idr[43]; + RHS11 += Idr[44]; + RHS11 += Idr[45]; + RHS11 += Idr[46]; + RHS11 += Idr[47]; + RHS11 += Idr[48]; + RHS11 -= go[44] * *cnV[44]; + RHS11 -= go[45] * *cnV[45]; + RHS11 -= go[46] * *cnV[46]; + RHS11 -= go[47] * *cnV[47]; + RHS11 -= go[48] * *cnV[48]; + m_A49 += gt[49]; + m_A49 += gt[50]; + m_A49 += gt[51]; + m_A45 += go[49]; + m_A46 += go[50]; + m_A44 += go[51]; + double RHS12 = Idr[49]; + RHS12 += Idr[50]; + RHS12 += Idr[51]; + m_A53 += gt[52]; + m_A53 += gt[53]; + m_A53 += gt[54]; + m_A53 += gt[55]; + m_A53 += gt[56]; + m_A53 += gt[57]; + m_A53 += gt[58]; + m_A54 += go[52]; + m_A55 += go[53]; + double RHS13 = Idr[52]; + RHS13 += Idr[53]; + RHS13 += Idr[54]; + RHS13 += Idr[55]; + RHS13 += Idr[56]; + RHS13 += Idr[57]; + RHS13 += Idr[58]; + RHS13 -= go[54] * *cnV[54]; + RHS13 -= go[55] * *cnV[55]; + RHS13 -= go[56] * *cnV[56]; + RHS13 -= go[57] * *cnV[57]; + RHS13 -= go[58] * *cnV[58]; + m_A57 += gt[59]; + m_A57 += gt[60]; + m_A57 += gt[61]; + m_A58 += go[59]; + m_A56 += go[60]; + double RHS14 = Idr[59]; + RHS14 += Idr[60]; + RHS14 += Idr[61]; + RHS14 -= go[61] * *cnV[61]; + m_A62 += gt[62]; + m_A62 += gt[63]; + m_A60 += go[62]; + m_A59 += go[63]; + double RHS15 = Idr[62]; + RHS15 += Idr[63]; + m_A68 += gt[64]; + m_A68 += gt[65]; + m_A68 += gt[66]; + m_A70 += go[64]; + m_A65 += go[65]; + double RHS16 = Idr[64]; + RHS16 += Idr[65]; + RHS16 += Idr[66]; + RHS16 -= go[66] * *cnV[66]; + m_A77 += gt[67]; + m_A77 += gt[68]; + m_A77 += gt[69]; + m_A77 += gt[70]; + m_A77 += gt[71]; + m_A77 += gt[72]; + m_A77 += gt[73]; + m_A73 += go[67]; + m_A71 += go[68]; + double RHS17 = Idr[67]; + RHS17 += Idr[68]; + RHS17 += Idr[69]; + RHS17 += Idr[70]; + RHS17 += Idr[71]; + RHS17 += Idr[72]; + RHS17 += Idr[73]; + RHS17 -= go[69] * *cnV[69]; + RHS17 -= go[70] * *cnV[70]; + RHS17 -= go[71] * *cnV[71]; + RHS17 -= go[72] * *cnV[72]; + RHS17 -= go[73] * *cnV[73]; + m_A88 += gt[74]; + m_A88 += gt[75]; + m_A88 += gt[76]; + m_A88 += gt[77]; + m_A86 += go[74]; + m_A84 += go[75]; + m_A79 += go[76]; + m_A80 += go[77]; + double RHS18 = Idr[74]; + RHS18 += Idr[75]; + RHS18 += Idr[76]; + RHS18 += Idr[77]; + const double f0 = 1.0 / m_A0; + const double f0_15 = -f0 * m_A59; + m_A62 += m_A1 * f0_15; + RHS15 += f0_15 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_8 = -f1 * m_A25; + m_A27 += m_A3 * f1_8; + RHS8 += f1_8 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_8 = -f2 * m_A26; + m_A27 += m_A5 * f2_8; + m_A28 += m_A6 * f2_8; + m_A29 += m_A7 * f2_8; + RHS8 += f2_8 * RHS2; + const double f2_9 = -f2 * m_A30; + m_A31 += m_A5 * f2_9; + m_A32 += m_A6 * f2_9; + m_A33 += m_A7 * f2_9; + RHS9 += f2_9 * RHS2; + const double f2_10 = -f2 * m_A34; + m_A36 += m_A5 * f2_10; + m_A37 += m_A6 * f2_10; + m_A38 += m_A7 * f2_10; + RHS10 += f2_10 * RHS2; + const double f2_17 = -f2 * m_A71; + m_A72 += m_A5 * f2_17; + m_A73 += m_A6 * f2_17; + m_A74 += m_A7 * f2_17; + RHS17 += f2_17 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_10 = -f3 * m_A35; + m_A38 += m_A9 * f3_10; + m_A39 += m_A10 * f3_10; + m_A40 += m_A11 * f3_10; + RHS10 += f3_10 * RHS3; + const double f3_12 = -f3 * m_A44; + m_A47 += m_A9 * f3_12; + m_A49 += m_A10 * f3_12; + m_A51 += m_A11 * f3_12; + RHS12 += f3_12 * RHS3; + const double f4 = 1.0 / m_A12; + const double f4_11 = -f4 * m_A41; + m_A43 += m_A13 * f4_11; + RHS11 += f4_11 * RHS4; + const double f4_12 = -f4 * m_A45; + m_A49 += m_A13 * f4_12; + RHS12 += f4_12 * RHS4; + const double f5 = 1.0 / m_A14; + const double f5_14 = -f5 * m_A56; + m_A57 += m_A15 * f5_14; + RHS14 += f5_14 * RHS5; + const double f6 = 1.0 / m_A16; + const double f6_12 = -f6 * m_A46; + m_A48 += m_A17 * f6_12; + m_A49 += m_A18 * f6_12; + m_A50 += m_A19 * f6_12; + m_A52 += m_A20 * f6_12; + RHS12 += f6_12 * RHS6; + const double f6_16 = -f6 * m_A65; + m_A66 += m_A17 * f6_16; + m_A67 += m_A18 * f6_16; + m_A68 += m_A19 * f6_16; + m_A70 += m_A20 * f6_16; + RHS16 += f6_16 * RHS6; + const double f6_18 = -f6 * m_A79; + m_A81 += m_A17 * f6_18; + m_A82 += m_A18 * f6_18; + m_A86 += m_A19 * f6_18; + m_A88 += m_A20 * f6_18; + RHS18 += f6_18 * RHS6; + const double f7 = 1.0 / m_A21; + const double f7_15 = -f7 * m_A60; + m_A61 += m_A22 * f7_15; + m_A62 += m_A23 * f7_15; + m_A64 += m_A24 * f7_15; + RHS15 += f7_15 * RHS7; + const double f7_18 = -f7 * m_A80; + m_A83 += m_A22 * f7_18; + m_A85 += m_A23 * f7_18; + m_A88 += m_A24 * f7_18; + RHS18 += f7_18 * RHS7; + const double f8 = 1.0 / m_A27; + const double f8_9 = -f8 * m_A31; + m_A32 += m_A28 * f8_9; + m_A33 += m_A29 * f8_9; + RHS9 += f8_9 * RHS8; + const double f8_10 = -f8 * m_A36; + m_A37 += m_A28 * f8_10; + m_A38 += m_A29 * f8_10; + RHS10 += f8_10 * RHS8; + const double f8_17 = -f8 * m_A72; + m_A73 += m_A28 * f8_17; + m_A74 += m_A29 * f8_17; + RHS17 += f8_17 * RHS8; + const double f9 = 1.0 / m_A32; + const double f9_10 = -f9 * m_A37; + m_A38 += m_A33 * f9_10; + RHS10 += f9_10 * RHS9; + const double f9_17 = -f9 * m_A73; + m_A74 += m_A33 * f9_17; + RHS17 += f9_17 * RHS9; + const double f10 = 1.0 / m_A38; + const double f10_12 = -f10 * m_A47; + m_A49 += m_A39 * f10_12; + m_A51 += m_A40 * f10_12; + RHS12 += f10_12 * RHS10; + const double f10_17 = -f10 * m_A74; + m_A75 += m_A39 * f10_17; + m_A77 += m_A40 * f10_17; + RHS17 += f10_17 * RHS10; + const double f11 = 1.0 / m_A42; + const double f11_12 = -f11 * m_A48; + m_A49 += m_A43 * f11_12; + RHS12 += f11_12 * RHS11; + const double f11_16 = -f11 * m_A66; + m_A67 += m_A43 * f11_16; + RHS16 += f11_16 * RHS11; + const double f11_18 = -f11 * m_A81; + m_A82 += m_A43 * f11_18; + RHS18 += f11_18 * RHS11; + const double f12 = 1.0 / m_A49; + const double f12_16 = -f12 * m_A67; + m_A68 += m_A50 * f12_16; + m_A69 += m_A51 * f12_16; + m_A70 += m_A52 * f12_16; + RHS16 += f12_16 * RHS12; + const double f12_17 = -f12 * m_A75; + m_A76 += m_A50 * f12_17; + m_A77 += m_A51 * f12_17; + m_A78 += m_A52 * f12_17; + RHS17 += f12_17 * RHS12; + const double f12_18 = -f12 * m_A82; + m_A86 += m_A50 * f12_18; + m_A87 += m_A51 * f12_18; + m_A88 += m_A52 * f12_18; + RHS18 += f12_18 * RHS12; + const double f13 = 1.0 / m_A53; + const double f13_15 = -f13 * m_A61; + m_A63 += m_A54 * f13_15; + m_A64 += m_A55 * f13_15; + RHS15 += f13_15 * RHS13; + const double f13_18 = -f13 * m_A83; + m_A86 += m_A54 * f13_18; + m_A88 += m_A55 * f13_18; + RHS18 += f13_18 * RHS13; + const double f14 = 1.0 / m_A57; + const double f14_18 = -f14 * m_A84; + m_A88 += m_A58 * f14_18; + RHS18 += f14_18 * RHS14; + const double f15 = 1.0 / m_A62; + const double f15_18 = -f15 * m_A85; + m_A86 += m_A63 * f15_18; + m_A88 += m_A64 * f15_18; + RHS18 += f15_18 * RHS15; + const double f16 = 1.0 / m_A68; + const double f16_17 = -f16 * m_A76; + m_A77 += m_A69 * f16_17; + m_A78 += m_A70 * f16_17; + RHS17 += f16_17 * RHS16; + const double f16_18 = -f16 * m_A86; + m_A87 += m_A69 * f16_18; + m_A88 += m_A70 * f16_18; + RHS18 += f16_18 * RHS16; + const double f17 = 1.0 / m_A77; + const double f17_18 = -f17 * m_A87; + m_A88 += m_A78 * f17_18; + RHS18 += f17_18 * RHS17; + V[18] = RHS18 / m_A88; + double tmp17 = 0.0; + tmp17 += m_A78 * V[18]; + V[17] = (RHS17 - tmp17) / m_A77; + double tmp16 = 0.0; + tmp16 += m_A69 * V[17]; + tmp16 += m_A70 * V[18]; + V[16] = (RHS16 - tmp16) / m_A68; + double tmp15 = 0.0; + tmp15 += m_A63 * V[16]; + tmp15 += m_A64 * V[18]; + V[15] = (RHS15 - tmp15) / m_A62; + double tmp14 = 0.0; + tmp14 += m_A58 * V[18]; + V[14] = (RHS14 - tmp14) / m_A57; + double tmp13 = 0.0; + tmp13 += m_A54 * V[16]; + tmp13 += m_A55 * V[18]; + V[13] = (RHS13 - tmp13) / m_A53; + double tmp12 = 0.0; + tmp12 += m_A50 * V[16]; + tmp12 += m_A51 * V[17]; + tmp12 += m_A52 * V[18]; + V[12] = (RHS12 - tmp12) / m_A49; + double tmp11 = 0.0; + tmp11 += m_A43 * V[12]; + V[11] = (RHS11 - tmp11) / m_A42; + double tmp10 = 0.0; + tmp10 += m_A39 * V[12]; + tmp10 += m_A40 * V[17]; + V[10] = (RHS10 - tmp10) / m_A38; + double tmp9 = 0.0; + tmp9 += m_A33 * V[10]; + V[9] = (RHS9 - tmp9) / m_A32; + double tmp8 = 0.0; + tmp8 += m_A28 * V[9]; + tmp8 += m_A29 * V[10]; + V[8] = (RHS8 - tmp8) / m_A27; + double tmp7 = 0.0; + tmp7 += m_A22 * V[13]; + tmp7 += m_A23 * V[15]; + tmp7 += m_A24 * V[18]; + V[7] = (RHS7 - tmp7) / m_A21; + double tmp6 = 0.0; + tmp6 += m_A17 * V[11]; + tmp6 += m_A18 * V[12]; + tmp6 += m_A19 * V[16]; + tmp6 += m_A20 * V[18]; + V[6] = (RHS6 - tmp6) / m_A16; + double tmp5 = 0.0; + tmp5 += m_A15 * V[14]; + V[5] = (RHS5 - tmp5) / m_A14; + double tmp4 = 0.0; + tmp4 += m_A13 * V[12]; + V[4] = (RHS4 - tmp4) / m_A12; + double tmp3 = 0.0; + tmp3 += m_A9 * V[10]; + tmp3 += m_A10 * V[12]; + tmp3 += m_A11 * V[17]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A5 * V[8]; + tmp2 += m_A6 * V[9]; + tmp2 += m_A7 * V[10]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[8]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[15]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // sspeedr static void nl_gcr_3e833834e5ce5aee_13_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -12934,6 +14724,514 @@ static void nl_gcr_4334c95878d1be92_399_double_double(double * __restrict V, con V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_437326911721091_77_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A4 += go[2]; + m_A5 += go[3]; + m_A3 += go[4]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 -= go[5] * *cnV[5]; + RHS1 -= go[6] * *cnV[6]; + m_A6 += gt[7]; + m_A6 += gt[8]; + m_A6 += gt[9]; + m_A7 += go[7]; + double RHS2 = Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + m_A8 += gt[10]; + m_A8 += gt[11]; + m_A10 += go[10]; + m_A9 += go[11]; + double RHS3 = Idr[10]; + RHS3 += Idr[11]; + m_A11 += gt[12]; + m_A11 += gt[13]; + m_A11 += gt[14]; + m_A11 += gt[15]; + m_A12 += go[12]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + RHS4 += Idr[14]; + RHS4 += Idr[15]; + RHS4 -= go[13] * *cnV[13]; + RHS4 -= go[14] * *cnV[14]; + RHS4 -= go[15] * *cnV[15]; + m_A13 += gt[16]; + m_A13 += gt[17]; + m_A13 += gt[18]; + m_A13 += gt[19]; + m_A13 += gt[20]; + m_A16 += go[16]; + m_A15 += go[17]; + m_A14 += go[18]; + double RHS5 = Idr[16]; + RHS5 += Idr[17]; + RHS5 += Idr[18]; + RHS5 += Idr[19]; + RHS5 += Idr[20]; + RHS5 -= go[19] * *cnV[19]; + RHS5 -= go[20] * *cnV[20]; + m_A17 += gt[21]; + m_A17 += gt[22]; + m_A17 += gt[23]; + m_A18 += go[21]; + double RHS6 = Idr[21]; + RHS6 += Idr[22]; + RHS6 += Idr[23]; + RHS6 -= go[22] * *cnV[22]; + RHS6 -= go[23] * *cnV[23]; + m_A19 += gt[24]; + m_A19 += gt[25]; + m_A19 += gt[26]; + m_A19 += gt[27]; + m_A20 += go[24]; + double RHS7 = Idr[24]; + RHS7 += Idr[25]; + RHS7 += Idr[26]; + RHS7 += Idr[27]; + RHS7 -= go[25] * *cnV[25]; + RHS7 -= go[26] * *cnV[26]; + RHS7 -= go[27] * *cnV[27]; + m_A23 += gt[28]; + m_A23 += gt[29]; + m_A23 += gt[30]; + m_A21 += go[28]; + m_A22 += go[29]; + double RHS8 = Idr[28]; + RHS8 += Idr[29]; + RHS8 += Idr[30]; + RHS8 -= go[30] * *cnV[30]; + m_A28 += gt[31]; + m_A28 += gt[32]; + m_A28 += gt[33]; + m_A28 += gt[34]; + m_A28 += gt[35]; + m_A28 += gt[36]; + m_A28 += gt[37]; + m_A29 += go[31]; + m_A26 += go[32]; + double RHS9 = Idr[31]; + RHS9 += Idr[32]; + RHS9 += Idr[33]; + RHS9 += Idr[34]; + RHS9 += Idr[35]; + RHS9 += Idr[36]; + RHS9 += Idr[37]; + RHS9 -= go[33] * *cnV[33]; + RHS9 -= go[34] * *cnV[34]; + RHS9 -= go[35] * *cnV[35]; + RHS9 -= go[36] * *cnV[36]; + RHS9 -= go[37] * *cnV[37]; + m_A31 += gt[38]; + m_A31 += gt[39]; + m_A31 += gt[40]; + m_A31 += gt[41]; + m_A31 += gt[42]; + m_A31 += gt[43]; + m_A31 += gt[44]; + m_A32 += go[38]; + m_A30 += go[39]; + double RHS10 = Idr[38]; + RHS10 += Idr[39]; + RHS10 += Idr[40]; + RHS10 += Idr[41]; + RHS10 += Idr[42]; + RHS10 += Idr[43]; + RHS10 += Idr[44]; + RHS10 -= go[40] * *cnV[40]; + RHS10 -= go[41] * *cnV[41]; + RHS10 -= go[42] * *cnV[42]; + RHS10 -= go[43] * *cnV[43]; + RHS10 -= go[44] * *cnV[44]; + m_A35 += gt[45]; + m_A35 += gt[46]; + m_A35 += gt[47]; + m_A35 += gt[48]; + m_A36 += go[45]; + m_A34 += go[46]; + m_A33 += go[47]; + double RHS11 = Idr[45]; + RHS11 += Idr[46]; + RHS11 += Idr[47]; + RHS11 += Idr[48]; + RHS11 -= go[48] * *cnV[48]; + m_A42 += gt[49]; + m_A42 += gt[50]; + m_A42 += gt[51]; + m_A39 += go[49]; + m_A45 += go[50]; + m_A38 += go[51]; + double RHS12 = Idr[49]; + RHS12 += Idr[50]; + RHS12 += Idr[51]; + m_A48 += gt[52]; + m_A48 += gt[53]; + m_A46 += go[52]; + m_A51 += go[53]; + double RHS13 = Idr[52]; + RHS13 += Idr[53]; + m_A53 += gt[54]; + m_A53 += gt[55]; + m_A53 += gt[56]; + m_A53 += gt[57]; + m_A53 += gt[58]; + m_A53 += gt[59]; + m_A53 += gt[60]; + m_A54 += go[54]; + m_A52 += go[55]; + double RHS14 = Idr[54]; + RHS14 += Idr[55]; + RHS14 += Idr[56]; + RHS14 += Idr[57]; + RHS14 += Idr[58]; + RHS14 += Idr[59]; + RHS14 += Idr[60]; + RHS14 -= go[56] * *cnV[56]; + RHS14 -= go[57] * *cnV[57]; + RHS14 -= go[58] * *cnV[58]; + RHS14 -= go[59] * *cnV[59]; + RHS14 -= go[60] * *cnV[60]; + m_A56 += gt[61]; + m_A56 += gt[62]; + m_A56 += gt[63]; + m_A55 += go[61]; + m_A57 += go[62]; + double RHS15 = Idr[61]; + RHS15 += Idr[62]; + RHS15 += Idr[63]; + RHS15 -= go[63] * *cnV[63]; + m_A60 += gt[64]; + m_A60 += gt[65]; + m_A60 += gt[66]; + m_A58 += go[64]; + m_A59 += go[65]; + double RHS16 = Idr[64]; + RHS16 += Idr[65]; + RHS16 += Idr[66]; + RHS16 -= go[66] * *cnV[66]; + m_A69 += gt[67]; + m_A69 += gt[68]; + m_A69 += gt[69]; + m_A69 += gt[70]; + m_A69 += gt[71]; + m_A63 += go[67]; + m_A62 += go[68]; + m_A65 += go[69]; + double RHS17 = Idr[67]; + RHS17 += Idr[68]; + RHS17 += Idr[69]; + RHS17 += Idr[70]; + RHS17 += Idr[71]; + RHS17 -= go[70] * *cnV[70]; + RHS17 -= go[71] * *cnV[71]; + m_A76 += gt[72]; + m_A76 += gt[73]; + m_A76 += gt[74]; + m_A76 += gt[75]; + m_A74 += go[72]; + m_A72 += go[73]; + m_A71 += go[74]; + double RHS18 = Idr[72]; + RHS18 += Idr[73]; + RHS18 += Idr[74]; + RHS18 += Idr[75]; + RHS18 -= go[75] * *cnV[75]; + const double f0 = 1.0 / m_A0; + const double f0_8 = -f0 * m_A21; + m_A23 += m_A1 * f0_8; + RHS8 += f0_8 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_8 = -f1 * m_A22; + m_A23 += m_A3 * f1_8; + m_A24 += m_A4 * f1_8; + m_A25 += m_A5 * f1_8; + RHS8 += f1_8 * RHS1; + const double f1_9 = -f1 * m_A26; + m_A27 += m_A3 * f1_9; + m_A28 += m_A4 * f1_9; + m_A29 += m_A5 * f1_9; + RHS9 += f1_9 * RHS1; + const double f1_12 = -f1 * m_A38; + m_A40 += m_A3 * f1_12; + m_A41 += m_A4 * f1_12; + m_A42 += m_A5 * f1_12; + RHS12 += f1_12 * RHS1; + const double f2 = 1.0 / m_A6; + const double f2_10 = -f2 * m_A30; + m_A32 += m_A7 * f2_10; + RHS10 += f2_10 * RHS2; + const double f2_11 = -f2 * m_A33; + m_A35 += m_A7 * f2_11; + RHS11 += f2_11 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_11 = -f3 * m_A34; + m_A35 += m_A9 * f3_11; + m_A37 += m_A10 * f3_11; + RHS11 += f3_11 * RHS3; + const double f3_17 = -f3 * m_A62; + m_A64 += m_A9 * f3_17; + m_A69 += m_A10 * f3_17; + RHS17 += f3_17 * RHS3; + const double f4 = 1.0 / m_A11; + const double f4_16 = -f4 * m_A58; + m_A60 += m_A12 * f4_16; + RHS16 += f4_16 * RHS4; + const double f5 = 1.0 / m_A13; + const double f5_12 = -f5 * m_A39; + m_A42 += m_A14 * f5_12; + m_A43 += m_A15 * f5_12; + m_A44 += m_A16 * f5_12; + RHS12 += f5_12 * RHS5; + const double f5_13 = -f5 * m_A46; + m_A47 += m_A14 * f5_13; + m_A48 += m_A15 * f5_13; + m_A49 += m_A16 * f5_13; + RHS13 += f5_13 * RHS5; + const double f6 = 1.0 / m_A17; + const double f6_14 = -f6 * m_A52; + m_A54 += m_A18 * f6_14; + RHS14 += f6_14 * RHS6; + const double f6_18 = -f6 * m_A71; + m_A76 += m_A18 * f6_18; + RHS18 += f6_18 * RHS6; + const double f7 = 1.0 / m_A19; + const double f7_15 = -f7 * m_A55; + m_A56 += m_A20 * f7_15; + RHS15 += f7_15 * RHS7; + const double f8 = 1.0 / m_A23; + const double f8_9 = -f8 * m_A27; + m_A28 += m_A24 * f8_9; + m_A29 += m_A25 * f8_9; + RHS9 += f8_9 * RHS8; + const double f8_12 = -f8 * m_A40; + m_A41 += m_A24 * f8_12; + m_A42 += m_A25 * f8_12; + RHS12 += f8_12 * RHS8; + const double f9 = 1.0 / m_A28; + const double f9_12 = -f9 * m_A41; + m_A42 += m_A29 * f9_12; + RHS12 += f9_12 * RHS9; + const double f10 = 1.0 / m_A31; + const double f10_17 = -f10 * m_A63; + m_A64 += m_A32 * f10_17; + RHS17 += f10_17 * RHS10; + const double f11 = 1.0 / m_A35; + const double f11_16 = -f11 * m_A59; + m_A60 += m_A36 * f11_16; + m_A61 += m_A37 * f11_16; + RHS16 += f11_16 * RHS11; + const double f11_17 = -f11 * m_A64; + m_A68 += m_A36 * f11_17; + m_A69 += m_A37 * f11_17; + RHS17 += f11_17 * RHS11; + const double f12 = 1.0 / m_A42; + const double f12_13 = -f12 * m_A47; + m_A48 += m_A43 * f12_13; + m_A49 += m_A44 * f12_13; + m_A50 += m_A45 * f12_13; + RHS13 += f12_13 * RHS12; + const double f12_17 = -f12 * m_A65; + m_A66 += m_A43 * f12_17; + m_A67 += m_A44 * f12_17; + m_A69 += m_A45 * f12_17; + RHS17 += f12_17 * RHS12; + const double f13 = 1.0 / m_A48; + const double f13_17 = -f13 * m_A66; + m_A67 += m_A49 * f13_17; + m_A69 += m_A50 * f13_17; + m_A70 += m_A51 * f13_17; + RHS17 += f13_17 * RHS13; + const double f13_18 = -f13 * m_A72; + m_A73 += m_A49 * f13_18; + m_A75 += m_A50 * f13_18; + m_A76 += m_A51 * f13_18; + RHS18 += f13_18 * RHS13; + const double f14 = 1.0 / m_A53; + const double f14_17 = -f14 * m_A67; + m_A70 += m_A54 * f14_17; + RHS17 += f14_17 * RHS14; + const double f14_18 = -f14 * m_A73; + m_A76 += m_A54 * f14_18; + RHS18 += f14_18 * RHS14; + const double f15 = 1.0 / m_A56; + const double f15_18 = -f15 * m_A74; + m_A76 += m_A57 * f15_18; + RHS18 += f15_18 * RHS15; + const double f16 = 1.0 / m_A60; + const double f16_17 = -f16 * m_A68; + m_A69 += m_A61 * f16_17; + RHS17 += f16_17 * RHS16; + const double f17 = 1.0 / m_A69; + const double f17_18 = -f17 * m_A75; + m_A76 += m_A70 * f17_18; + RHS18 += f17_18 * RHS17; + V[18] = RHS18 / m_A76; + double tmp17 = 0.0; + tmp17 += m_A70 * V[18]; + V[17] = (RHS17 - tmp17) / m_A69; + double tmp16 = 0.0; + tmp16 += m_A61 * V[17]; + V[16] = (RHS16 - tmp16) / m_A60; + double tmp15 = 0.0; + tmp15 += m_A57 * V[18]; + V[15] = (RHS15 - tmp15) / m_A56; + double tmp14 = 0.0; + tmp14 += m_A54 * V[18]; + V[14] = (RHS14 - tmp14) / m_A53; + double tmp13 = 0.0; + tmp13 += m_A49 * V[14]; + tmp13 += m_A50 * V[17]; + tmp13 += m_A51 * V[18]; + V[13] = (RHS13 - tmp13) / m_A48; + double tmp12 = 0.0; + tmp12 += m_A43 * V[13]; + tmp12 += m_A44 * V[14]; + tmp12 += m_A45 * V[17]; + V[12] = (RHS12 - tmp12) / m_A42; + double tmp11 = 0.0; + tmp11 += m_A36 * V[16]; + tmp11 += m_A37 * V[17]; + V[11] = (RHS11 - tmp11) / m_A35; + double tmp10 = 0.0; + tmp10 += m_A32 * V[11]; + V[10] = (RHS10 - tmp10) / m_A31; + double tmp9 = 0.0; + tmp9 += m_A29 * V[12]; + V[9] = (RHS9 - tmp9) / m_A28; + double tmp8 = 0.0; + tmp8 += m_A24 * V[9]; + tmp8 += m_A25 * V[12]; + V[8] = (RHS8 - tmp8) / m_A23; + double tmp7 = 0.0; + tmp7 += m_A20 * V[15]; + V[7] = (RHS7 - tmp7) / m_A19; + double tmp6 = 0.0; + tmp6 += m_A18 * V[18]; + V[6] = (RHS6 - tmp6) / m_A17; + double tmp5 = 0.0; + tmp5 += m_A14 * V[12]; + tmp5 += m_A15 * V[13]; + tmp5 += m_A16 * V[14]; + V[5] = (RHS5 - tmp5) / m_A13; + double tmp4 = 0.0; + tmp4 += m_A12 * V[16]; + V[4] = (RHS4 - tmp4) / m_A11; + double tmp3 = 0.0; + tmp3 += m_A9 * V[11]; + tmp3 += m_A10 * V[17]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A7 * V[11]; + V[2] = (RHS2 - tmp2) / m_A6; + double tmp1 = 0.0; + tmp1 += m_A3 * V[8]; + tmp1 += m_A4 * V[9]; + tmp1 += m_A5 * V[12]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[8]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // kidniki static void nl_gcr_43f7ff9bc651cc7a_198_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -14306,6 +16604,550 @@ static void nl_gcr_491f95430bfdfd05_19_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// frogs +static void nl_gcr_494f233b1a947be1_88_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A0 += gt[4]; + m_A1 += go[0]; + m_A1 += go[1]; + m_A2 += go[2]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 += Idr[4]; + RHS0 -= go[3] * *cnV[3]; + RHS0 -= go[4] * *cnV[4]; + m_A3 += gt[5]; + m_A3 += gt[6]; + m_A3 += gt[7]; + m_A3 += gt[8]; + m_A5 += go[5]; + m_A4 += go[6]; + double RHS1 = Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 += Idr[8]; + RHS1 -= go[7] * *cnV[7]; + RHS1 -= go[8] * *cnV[8]; + m_A6 += gt[9]; + m_A6 += gt[10]; + m_A7 += go[9]; + double RHS2 = Idr[9]; + RHS2 += Idr[10]; + RHS2 -= go[10] * *cnV[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A10 += go[11]; + m_A9 += go[12]; + double RHS3 = Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + RHS3 -= go[13] * *cnV[13]; + m_A11 += gt[14]; + m_A11 += gt[15]; + m_A13 += go[14]; + m_A12 += go[15]; + double RHS4 = Idr[14]; + RHS4 += Idr[15]; + m_A14 += gt[16]; + m_A14 += gt[17]; + m_A15 += go[16]; + m_A16 += go[17]; + double RHS5 = Idr[16]; + RHS5 += Idr[17]; + m_A17 += gt[18]; + m_A17 += gt[19]; + m_A17 += gt[20]; + m_A20 += go[18]; + m_A18 += go[19]; + m_A19 += go[20]; + double RHS6 = Idr[18]; + RHS6 += Idr[19]; + RHS6 += Idr[20]; + m_A21 += gt[21]; + m_A21 += gt[22]; + m_A23 += go[21]; + m_A22 += go[22]; + double RHS7 = Idr[21]; + RHS7 += Idr[22]; + m_A24 += gt[23]; + m_A24 += gt[24]; + m_A24 += gt[25]; + m_A24 += gt[26]; + m_A24 += gt[27]; + m_A24 += gt[28]; + m_A24 += gt[29]; + m_A25 += go[23]; + double RHS8 = Idr[23]; + RHS8 += Idr[24]; + RHS8 += Idr[25]; + RHS8 += Idr[26]; + RHS8 += Idr[27]; + RHS8 += Idr[28]; + RHS8 += Idr[29]; + RHS8 -= go[24] * *cnV[24]; + RHS8 -= go[25] * *cnV[25]; + RHS8 -= go[26] * *cnV[26]; + RHS8 -= go[27] * *cnV[27]; + RHS8 -= go[28] * *cnV[28]; + RHS8 -= go[29] * *cnV[29]; + m_A28 += gt[30]; + m_A28 += gt[31]; + m_A28 += gt[32]; + m_A28 += gt[33]; + m_A27 += go[30]; + m_A26 += go[31]; + m_A26 += go[32]; + double RHS9 = Idr[30]; + RHS9 += Idr[31]; + RHS9 += Idr[32]; + RHS9 += Idr[33]; + RHS9 -= go[33] * *cnV[33]; + m_A33 += gt[34]; + m_A33 += gt[35]; + m_A31 += go[34]; + double RHS10 = Idr[34]; + RHS10 += Idr[35]; + RHS10 -= go[35] * *cnV[35]; + m_A39 += gt[36]; + m_A39 += gt[37]; + m_A39 += gt[38]; + m_A36 += go[36]; + m_A35 += go[37]; + double RHS11 = Idr[36]; + RHS11 += Idr[37]; + RHS11 += Idr[38]; + RHS11 -= go[38] * *cnV[38]; + m_A43 += gt[39]; + m_A43 += gt[40]; + m_A43 += gt[41]; + m_A44 += go[39]; + m_A42 += go[40]; + m_A41 += go[41]; + double RHS12 = Idr[39]; + RHS12 += Idr[40]; + RHS12 += Idr[41]; + m_A47 += gt[42]; + m_A47 += gt[43]; + m_A47 += gt[44]; + m_A47 += gt[45]; + m_A47 += gt[46]; + m_A47 += gt[47]; + m_A47 += gt[48]; + m_A48 += go[42]; + m_A45 += go[43]; + double RHS13 = Idr[42]; + RHS13 += Idr[43]; + RHS13 += Idr[44]; + RHS13 += Idr[45]; + RHS13 += Idr[46]; + RHS13 += Idr[47]; + RHS13 += Idr[48]; + RHS13 -= go[44] * *cnV[44]; + RHS13 -= go[45] * *cnV[45]; + RHS13 -= go[46] * *cnV[46]; + RHS13 -= go[47] * *cnV[47]; + RHS13 -= go[48] * *cnV[48]; + m_A51 += gt[49]; + m_A51 += gt[50]; + m_A51 += gt[51]; + m_A50 += go[49]; + m_A49 += go[50]; + double RHS14 = Idr[49]; + RHS14 += Idr[50]; + RHS14 += Idr[51]; + RHS14 -= go[51] * *cnV[51]; + m_A59 += gt[52]; + m_A59 += gt[53]; + m_A59 += gt[54]; + m_A59 += gt[55]; + m_A59 += gt[56]; + m_A56 += go[52]; + m_A55 += go[53]; + double RHS15 = Idr[52]; + RHS15 += Idr[53]; + RHS15 += Idr[54]; + RHS15 += Idr[55]; + RHS15 += Idr[56]; + RHS15 -= go[54] * *cnV[54]; + RHS15 -= go[55] * *cnV[55]; + RHS15 -= go[56] * *cnV[56]; + m_A66 += gt[57]; + m_A66 += gt[58]; + m_A66 += gt[59]; + m_A63 += go[57]; + m_A62 += go[58]; + double RHS16 = Idr[57]; + RHS16 += Idr[58]; + RHS16 += Idr[59]; + RHS16 -= go[59] * *cnV[59]; + m_A71 += gt[60]; + m_A71 += gt[61]; + m_A71 += gt[62]; + m_A73 += go[60]; + m_A69 += go[61]; + double RHS17 = Idr[60]; + RHS17 += Idr[61]; + RHS17 += Idr[62]; + RHS17 -= go[62] * *cnV[62]; + m_A82 += gt[63]; + m_A82 += gt[64]; + m_A82 += gt[65]; + m_A82 += gt[66]; + m_A82 += gt[67]; + m_A82 += gt[68]; + m_A77 += go[63]; + m_A75 += go[64]; + m_A74 += go[65]; + m_A76 += go[66]; + double RHS18 = Idr[63]; + RHS18 += Idr[64]; + RHS18 += Idr[65]; + RHS18 += Idr[66]; + RHS18 += Idr[67]; + RHS18 += Idr[68]; + RHS18 -= go[67] * *cnV[67]; + RHS18 -= go[68] * *cnV[68]; + m_A87 += gt[69]; + m_A87 += gt[70]; + m_A87 += gt[71]; + m_A87 += gt[72]; + m_A84 += go[69]; + m_A85 += go[70]; + double RHS19 = Idr[69]; + RHS19 += Idr[70]; + RHS19 += Idr[71]; + RHS19 += Idr[72]; + RHS19 -= go[71] * *cnV[71]; + RHS19 -= go[72] * *cnV[72]; + const double f0 = 1.0 / m_A0; + const double f0_9 = -f0 * m_A26; + m_A28 += m_A1 * f0_9; + m_A30 += m_A2 * f0_9; + RHS9 += f0_9 * RHS0; + const double f0_11 = -f0 * m_A35; + m_A37 += m_A1 * f0_11; + m_A39 += m_A2 * f0_11; + RHS11 += f0_11 * RHS0; + const double f1 = 1.0 / m_A3; + const double f1_9 = -f1 * m_A27; + m_A28 += m_A4 * f1_9; + m_A29 += m_A5 * f1_9; + RHS9 += f1_9 * RHS1; + const double f1_10 = -f1 * m_A31; + m_A32 += m_A4 * f1_10; + m_A33 += m_A5 * f1_10; + RHS10 += f1_10 * RHS1; + const double f2 = 1.0 / m_A6; + const double f2_12 = -f2 * m_A41; + m_A43 += m_A7 * f2_12; + RHS12 += f2_12 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_12 = -f3 * m_A42; + m_A43 += m_A9 * f3_12; + m_A44 += m_A10 * f3_12; + RHS12 += f3_12 * RHS3; + const double f3_13 = -f3 * m_A45; + m_A46 += m_A9 * f3_13; + m_A48 += m_A10 * f3_13; + RHS13 += f3_13 * RHS3; + const double f3_18 = -f3 * m_A74; + m_A76 += m_A9 * f3_18; + m_A82 += m_A10 * f3_18; + RHS18 += f3_18 * RHS3; + const double f4 = 1.0 / m_A11; + const double f4_11 = -f4 * m_A36; + m_A39 += m_A12 * f4_11; + m_A40 += m_A13 * f4_11; + RHS11 += f4_11 * RHS4; + const double f4_15 = -f4 * m_A55; + m_A57 += m_A12 * f4_15; + m_A59 += m_A13 * f4_15; + RHS15 += f4_15 * RHS4; + const double f5 = 1.0 / m_A14; + const double f5_14 = -f5 * m_A49; + m_A51 += m_A15 * f5_14; + m_A54 += m_A16 * f5_14; + RHS14 += f5_14 * RHS5; + const double f5_18 = -f5 * m_A75; + m_A78 += m_A15 * f5_18; + m_A82 += m_A16 * f5_18; + RHS18 += f5_18 * RHS5; + const double f6 = 1.0 / m_A17; + const double f6_14 = -f6 * m_A50; + m_A51 += m_A18 * f6_14; + m_A52 += m_A19 * f6_14; + m_A53 += m_A20 * f6_14; + RHS14 += f6_14 * RHS6; + const double f6_15 = -f6 * m_A56; + m_A58 += m_A18 * f6_15; + m_A59 += m_A19 * f6_15; + m_A60 += m_A20 * f6_15; + RHS15 += f6_15 * RHS6; + const double f6_16 = -f6 * m_A62; + m_A64 += m_A18 * f6_16; + m_A65 += m_A19 * f6_16; + m_A66 += m_A20 * f6_16; + RHS16 += f6_16 * RHS6; + const double f7 = 1.0 / m_A21; + const double f7_16 = -f7 * m_A63; + m_A66 += m_A22 * f7_16; + m_A67 += m_A23 * f7_16; + RHS16 += f7_16 * RHS7; + const double f7_17 = -f7 * m_A69; + m_A70 += m_A22 * f7_17; + m_A71 += m_A23 * f7_17; + RHS17 += f7_17 * RHS7; + const double f8 = 1.0 / m_A24; + const double f8_19 = -f8 * m_A84; + m_A85 += m_A25 * f8_19; + RHS19 += f8_19 * RHS8; + const double f9 = 1.0 / m_A28; + const double f9_10 = -f9 * m_A32; + m_A33 += m_A29 * f9_10; + m_A34 += m_A30 * f9_10; + RHS10 += f9_10 * RHS9; + const double f9_11 = -f9 * m_A37; + m_A38 += m_A29 * f9_11; + m_A39 += m_A30 * f9_11; + RHS11 += f9_11 * RHS9; + const double f10 = 1.0 / m_A33; + const double f10_11 = -f10 * m_A38; + m_A39 += m_A34 * f10_11; + RHS11 += f10_11 * RHS10; + const double f11 = 1.0 / m_A39; + const double f11_15 = -f11 * m_A57; + m_A59 += m_A40 * f11_15; + RHS15 += f11_15 * RHS11; + const double f12 = 1.0 / m_A43; + const double f12_13 = -f12 * m_A46; + m_A48 += m_A44 * f12_13; + RHS13 += f12_13 * RHS12; + const double f12_18 = -f12 * m_A76; + m_A82 += m_A44 * f12_18; + RHS18 += f12_18 * RHS12; + const double f13 = 1.0 / m_A47; + const double f13_18 = -f13 * m_A77; + m_A82 += m_A48 * f13_18; + RHS18 += f13_18 * RHS13; + const double f14 = 1.0 / m_A51; + const double f14_15 = -f14 * m_A58; + m_A59 += m_A52 * f14_15; + m_A60 += m_A53 * f14_15; + m_A61 += m_A54 * f14_15; + RHS15 += f14_15 * RHS14; + const double f14_16 = -f14 * m_A64; + m_A65 += m_A52 * f14_16; + m_A66 += m_A53 * f14_16; + m_A68 += m_A54 * f14_16; + RHS16 += f14_16 * RHS14; + const double f14_18 = -f14 * m_A78; + m_A79 += m_A52 * f14_18; + m_A80 += m_A53 * f14_18; + m_A82 += m_A54 * f14_18; + RHS18 += f14_18 * RHS14; + const double f15 = 1.0 / m_A59; + const double f15_16 = -f15 * m_A65; + m_A66 += m_A60 * f15_16; + m_A68 += m_A61 * f15_16; + RHS16 += f15_16 * RHS15; + const double f15_18 = -f15 * m_A79; + m_A80 += m_A60 * f15_18; + m_A82 += m_A61 * f15_18; + RHS18 += f15_18 * RHS15; + const double f16 = 1.0 / m_A66; + const double f16_17 = -f16 * m_A70; + m_A71 += m_A67 * f16_17; + m_A72 += m_A68 * f16_17; + RHS17 += f16_17 * RHS16; + const double f16_18 = -f16 * m_A80; + m_A81 += m_A67 * f16_18; + m_A82 += m_A68 * f16_18; + RHS18 += f16_18 * RHS16; + const double f17 = 1.0 / m_A71; + const double f17_18 = -f17 * m_A81; + m_A82 += m_A72 * f17_18; + m_A83 += m_A73 * f17_18; + RHS18 += f17_18 * RHS17; + const double f17_19 = -f17 * m_A85; + m_A86 += m_A72 * f17_19; + m_A87 += m_A73 * f17_19; + RHS19 += f17_19 * RHS17; + const double f18 = 1.0 / m_A82; + const double f18_19 = -f18 * m_A86; + m_A87 += m_A83 * f18_19; + RHS19 += f18_19 * RHS18; + V[19] = RHS19 / m_A87; + double tmp18 = 0.0; + tmp18 += m_A83 * V[19]; + V[18] = (RHS18 - tmp18) / m_A82; + double tmp17 = 0.0; + tmp17 += m_A72 * V[18]; + tmp17 += m_A73 * V[19]; + V[17] = (RHS17 - tmp17) / m_A71; + double tmp16 = 0.0; + tmp16 += m_A67 * V[17]; + tmp16 += m_A68 * V[18]; + V[16] = (RHS16 - tmp16) / m_A66; + double tmp15 = 0.0; + tmp15 += m_A60 * V[16]; + tmp15 += m_A61 * V[18]; + V[15] = (RHS15 - tmp15) / m_A59; + double tmp14 = 0.0; + tmp14 += m_A52 * V[15]; + tmp14 += m_A53 * V[16]; + tmp14 += m_A54 * V[18]; + V[14] = (RHS14 - tmp14) / m_A51; + double tmp13 = 0.0; + tmp13 += m_A48 * V[18]; + V[13] = (RHS13 - tmp13) / m_A47; + double tmp12 = 0.0; + tmp12 += m_A44 * V[18]; + V[12] = (RHS12 - tmp12) / m_A43; + double tmp11 = 0.0; + tmp11 += m_A40 * V[15]; + V[11] = (RHS11 - tmp11) / m_A39; + double tmp10 = 0.0; + tmp10 += m_A34 * V[11]; + V[10] = (RHS10 - tmp10) / m_A33; + double tmp9 = 0.0; + tmp9 += m_A29 * V[10]; + tmp9 += m_A30 * V[11]; + V[9] = (RHS9 - tmp9) / m_A28; + double tmp8 = 0.0; + tmp8 += m_A25 * V[17]; + V[8] = (RHS8 - tmp8) / m_A24; + double tmp7 = 0.0; + tmp7 += m_A22 * V[16]; + tmp7 += m_A23 * V[17]; + V[7] = (RHS7 - tmp7) / m_A21; + double tmp6 = 0.0; + tmp6 += m_A18 * V[14]; + tmp6 += m_A19 * V[15]; + tmp6 += m_A20 * V[16]; + V[6] = (RHS6 - tmp6) / m_A17; + double tmp5 = 0.0; + tmp5 += m_A15 * V[14]; + tmp5 += m_A16 * V[18]; + V[5] = (RHS5 - tmp5) / m_A14; + double tmp4 = 0.0; + tmp4 += m_A12 * V[11]; + tmp4 += m_A13 * V[15]; + V[4] = (RHS4 - tmp4) / m_A11; + double tmp3 = 0.0; + tmp3 += m_A9 * V[12]; + tmp3 += m_A10 * V[18]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A7 * V[12]; + V[2] = (RHS2 - tmp2) / m_A6; + double tmp1 = 0.0; + tmp1 += m_A4 * V[9]; + tmp1 += m_A5 * V[10]; + V[1] = (RHS1 - tmp1) / m_A3; + double tmp0 = 0.0; + tmp0 += m_A1 * V[9]; + tmp0 += m_A2 * V[11]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // sspeedr static void nl_gcr_4a8e2b707bbac8a6_95_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -18279,7 +21121,102 @@ static void nl_gcr_546396f65ce48700_12_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// dpatrol +// brdrline +static void nl_gcr_576f391d0418cb76_13_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A3 += go[3]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[4] * *cnV[4]; + RHS1 -= go[5] * *cnV[5]; + m_A4 += gt[6]; + m_A4 += gt[7]; + m_A4 += gt[8]; + m_A5 += go[6]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 -= go[7] * *cnV[7]; + RHS2 -= go[8] * *cnV[8]; + m_A6 += gt[9]; + m_A7 += go[9]; + double RHS3 = Idr[9]; + m_A12 += gt[10]; + m_A12 += gt[11]; + m_A12 += gt[12]; + m_A12 += gt[13]; + m_A12 += gt[14]; + m_A11 += go[10]; + m_A10 += go[11]; + m_A9 += go[12]; + m_A8 += go[13]; + double RHS4 = Idr[10]; + RHS4 += Idr[11]; + RHS4 += Idr[12]; + RHS4 += Idr[13]; + RHS4 += Idr[14]; + RHS4 -= go[14] * *cnV[14]; + const double f0 = 1.0 / m_A0; + const double f0_4 = -f0 * m_A8; + m_A12 += m_A1 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_4 = -f1 * m_A9; + m_A12 += m_A3 * f1_4; + RHS4 += f1_4 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_4 = -f2 * m_A10; + m_A12 += m_A5 * f2_4; + RHS4 += f2_4 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_4 = -f3 * m_A11; + m_A12 += m_A7 * f3_4; + RHS4 += f3_4 * RHS3; + V[4] = RHS4 / m_A12; + double tmp3 = 0.0; + tmp3 += m_A7 * V[4]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[4]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[4]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[4]; + V[0] = (RHS0 - tmp0) / m_A0; +} + +// brdrline static void nl_gcr_59cb6bf7cb9d17dc_7_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) { @@ -20656,6 +23593,221 @@ static void nl_gcr_6041272373b8603c_178_double_double(double * __restrict V, con V[0] = (RHS0 - tmp0) / m_A0; } +// astrob +static void nl_gcr_62464664b1c5aa1e_27_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A0 += gt[4]; + m_A0 += gt[5]; + m_A0 += gt[6]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 += Idr[4]; + RHS0 += Idr[5]; + RHS0 += Idr[6]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + RHS0 -= go[3] * *cnV[3]; + RHS0 -= go[4] * *cnV[4]; + RHS0 -= go[5] * *cnV[5]; + RHS0 -= go[6] * *cnV[6]; + m_A2 += gt[7]; + m_A2 += gt[8]; + m_A2 += gt[9]; + m_A4 += go[7]; + m_A3 += go[8]; + double RHS1 = Idr[7]; + RHS1 += Idr[8]; + RHS1 += Idr[9]; + RHS1 -= go[9] * *cnV[9]; + m_A5 += gt[10]; + m_A5 += gt[11]; + m_A5 += gt[12]; + m_A5 += gt[13]; + m_A5 += gt[14]; + m_A5 += gt[15]; + m_A5 += gt[16]; + m_A6 += go[10]; + double RHS2 = Idr[10]; + RHS2 += Idr[11]; + RHS2 += Idr[12]; + RHS2 += Idr[13]; + RHS2 += Idr[14]; + RHS2 += Idr[15]; + RHS2 += Idr[16]; + RHS2 -= go[11] * *cnV[11]; + RHS2 -= go[12] * *cnV[12]; + RHS2 -= go[13] * *cnV[13]; + RHS2 -= go[14] * *cnV[14]; + RHS2 -= go[15] * *cnV[15]; + RHS2 -= go[16] * *cnV[16]; + m_A7 += gt[17]; + m_A7 += gt[18]; + m_A7 += gt[19]; + m_A7 += gt[20]; + m_A9 += go[17]; + m_A10 += go[18]; + m_A8 += go[19]; + double RHS3 = Idr[17]; + RHS3 += Idr[18]; + RHS3 += Idr[19]; + RHS3 += Idr[20]; + RHS3 -= go[20] * *cnV[20]; + m_A14 += gt[21]; + m_A14 += gt[22]; + m_A14 += gt[23]; + m_A14 += gt[24]; + m_A14 += gt[25]; + m_A11 += go[21]; + m_A13 += go[22]; + m_A12 += go[23]; + double RHS4 = Idr[21]; + RHS4 += Idr[22]; + RHS4 += Idr[23]; + RHS4 += Idr[24]; + RHS4 += Idr[25]; + RHS4 -= go[24] * *cnV[24]; + RHS4 -= go[25] * *cnV[25]; + m_A19 += gt[26]; + m_A19 += gt[27]; + m_A19 += gt[28]; + m_A20 += go[26]; + m_A17 += go[27]; + double RHS5 = Idr[26]; + RHS5 += Idr[27]; + RHS5 += Idr[28]; + RHS5 -= go[28] * *cnV[28]; + m_A26 += gt[29]; + m_A26 += gt[30]; + m_A26 += gt[31]; + m_A26 += gt[32]; + m_A26 += gt[33]; + m_A26 += gt[34]; + m_A26 += gt[35]; + m_A26 += gt[36]; + m_A22 += go[29]; + m_A25 += go[30]; + m_A23 += go[31]; + m_A21 += go[32]; + double RHS6 = Idr[29]; + RHS6 += Idr[30]; + RHS6 += Idr[31]; + RHS6 += Idr[32]; + RHS6 += Idr[33]; + RHS6 += Idr[34]; + RHS6 += Idr[35]; + RHS6 += Idr[36]; + RHS6 -= go[33] * *cnV[33]; + RHS6 -= go[34] * *cnV[34]; + RHS6 -= go[35] * *cnV[35]; + RHS6 -= go[36] * *cnV[36]; + const double f0 = 1.0 / m_A0; + const double f0_4 = -f0 * m_A11; + m_A12 += m_A1 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_4 = -f1 * m_A12; + m_A14 += m_A3 * f1_4; + m_A16 += m_A4 * f1_4; + RHS4 += f1_4 * RHS1; + const double f1_6 = -f1 * m_A21; + m_A24 += m_A3 * f1_6; + m_A26 += m_A4 * f1_6; + RHS6 += f1_6 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_6 = -f2 * m_A22; + m_A25 += m_A6 * f2_6; + RHS6 += f2_6 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_4 = -f3 * m_A13; + m_A14 += m_A8 * f3_4; + m_A15 += m_A9 * f3_4; + m_A16 += m_A10 * f3_4; + RHS4 += f3_4 * RHS3; + const double f3_5 = -f3 * m_A17; + m_A18 += m_A8 * f3_5; + m_A19 += m_A9 * f3_5; + m_A20 += m_A10 * f3_5; + RHS5 += f3_5 * RHS3; + const double f3_6 = -f3 * m_A23; + m_A24 += m_A8 * f3_6; + m_A25 += m_A9 * f3_6; + m_A26 += m_A10 * f3_6; + RHS6 += f3_6 * RHS3; + const double f4 = 1.0 / m_A14; + const double f4_5 = -f4 * m_A18; + m_A19 += m_A15 * f4_5; + m_A20 += m_A16 * f4_5; + RHS5 += f4_5 * RHS4; + const double f4_6 = -f4 * m_A24; + m_A25 += m_A15 * f4_6; + m_A26 += m_A16 * f4_6; + RHS6 += f4_6 * RHS4; + const double f5 = 1.0 / m_A19; + const double f5_6 = -f5 * m_A25; + m_A26 += m_A20 * f5_6; + RHS6 += f5_6 * RHS5; + V[6] = RHS6 / m_A26; + double tmp5 = 0.0; + tmp5 += m_A20 * V[6]; + V[5] = (RHS5 - tmp5) / m_A19; + double tmp4 = 0.0; + tmp4 += m_A15 * V[5]; + tmp4 += m_A16 * V[6]; + V[4] = (RHS4 - tmp4) / m_A14; + double tmp3 = 0.0; + tmp3 += m_A8 * V[4]; + tmp3 += m_A9 * V[5]; + tmp3 += m_A10 * V[6]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[5]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[4]; + tmp1 += m_A4 * V[6]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[1]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // solarq static void nl_gcr_62612f71055b8fd4_303_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -28820,6 +31972,757 @@ static void nl_gcr_743595e64cee0a5e_112_double_double(double * __restrict V, con V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_75400df5d559a266_75_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A3 += go[3]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[4] * *cnV[4]; + RHS1 -= go[5] * *cnV[5]; + m_A4 += gt[6]; + m_A4 += gt[7]; + m_A4 += gt[8]; + m_A4 += gt[9]; + m_A5 += go[6]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 -= go[7] * *cnV[7]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + m_A6 += gt[10]; + m_A6 += gt[11]; + m_A8 += go[10]; + m_A7 += go[11]; + double RHS3 = Idr[10]; + RHS3 += Idr[11]; + m_A9 += gt[12]; + m_A9 += gt[13]; + m_A9 += gt[14]; + m_A10 += go[12]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + RHS4 += Idr[14]; + RHS4 -= go[13] * *cnV[13]; + RHS4 -= go[14] * *cnV[14]; + m_A11 += gt[15]; + m_A11 += gt[16]; + m_A11 += gt[17]; + m_A11 += gt[18]; + m_A11 += gt[19]; + m_A11 += gt[20]; + m_A12 += go[15]; + m_A15 += go[16]; + m_A14 += go[17]; + m_A13 += go[18]; + double RHS5 = Idr[15]; + RHS5 += Idr[16]; + RHS5 += Idr[17]; + RHS5 += Idr[18]; + RHS5 += Idr[19]; + RHS5 += Idr[20]; + RHS5 -= go[19] * *cnV[19]; + RHS5 -= go[20] * *cnV[20]; + m_A16 += gt[21]; + m_A16 += gt[22]; + m_A16 += gt[23]; + m_A16 += gt[24]; + m_A16 += gt[25]; + m_A16 += gt[26]; + m_A16 += gt[27]; + m_A18 += go[21]; + m_A17 += go[22]; + double RHS6 = Idr[21]; + RHS6 += Idr[22]; + RHS6 += Idr[23]; + RHS6 += Idr[24]; + RHS6 += Idr[25]; + RHS6 += Idr[26]; + RHS6 += Idr[27]; + RHS6 -= go[23] * *cnV[23]; + RHS6 -= go[24] * *cnV[24]; + RHS6 -= go[25] * *cnV[25]; + RHS6 -= go[26] * *cnV[26]; + RHS6 -= go[27] * *cnV[27]; + m_A19 += gt[28]; + m_A19 += gt[29]; + m_A19 += gt[30]; + m_A19 += gt[31]; + m_A20 += go[28]; + double RHS7 = Idr[28]; + RHS7 += Idr[29]; + RHS7 += Idr[30]; + RHS7 += Idr[31]; + RHS7 -= go[29] * *cnV[29]; + RHS7 -= go[30] * *cnV[30]; + RHS7 -= go[31] * *cnV[31]; + m_A22 += gt[32]; + m_A22 += gt[33]; + m_A22 += gt[34]; + m_A22 += gt[35]; + m_A22 += gt[36]; + m_A22 += gt[37]; + m_A22 += gt[38]; + m_A23 += go[32]; + m_A21 += go[33]; + double RHS8 = Idr[32]; + RHS8 += Idr[33]; + RHS8 += Idr[34]; + RHS8 += Idr[35]; + RHS8 += Idr[36]; + RHS8 += Idr[37]; + RHS8 += Idr[38]; + RHS8 -= go[34] * *cnV[34]; + RHS8 -= go[35] * *cnV[35]; + RHS8 -= go[36] * *cnV[36]; + RHS8 -= go[37] * *cnV[37]; + RHS8 -= go[38] * *cnV[38]; + m_A25 += gt[39]; + m_A25 += gt[40]; + m_A25 += gt[41]; + m_A24 += go[39]; + m_A26 += go[40]; + double RHS9 = Idr[39]; + RHS9 += Idr[40]; + RHS9 += Idr[41]; + RHS9 -= go[41] * *cnV[41]; + m_A28 += gt[42]; + m_A28 += gt[43]; + m_A28 += gt[44]; + m_A28 += gt[45]; + m_A28 += gt[46]; + m_A28 += gt[47]; + m_A28 += gt[48]; + m_A29 += go[42]; + m_A27 += go[43]; + double RHS10 = Idr[42]; + RHS10 += Idr[43]; + RHS10 += Idr[44]; + RHS10 += Idr[45]; + RHS10 += Idr[46]; + RHS10 += Idr[47]; + RHS10 += Idr[48]; + RHS10 -= go[44] * *cnV[44]; + RHS10 -= go[45] * *cnV[45]; + RHS10 -= go[46] * *cnV[46]; + RHS10 -= go[47] * *cnV[47]; + RHS10 -= go[48] * *cnV[48]; + m_A33 += gt[49]; + m_A33 += gt[50]; + m_A33 += gt[51]; + m_A31 += go[49]; + m_A30 += go[50]; + m_A35 += go[51]; + double RHS11 = Idr[49]; + RHS11 += Idr[50]; + RHS11 += Idr[51]; + m_A40 += gt[52]; + m_A40 += gt[53]; + m_A40 += gt[54]; + m_A42 += go[52]; + m_A37 += go[53]; + double RHS12 = Idr[52]; + RHS12 += Idr[53]; + RHS12 += Idr[54]; + RHS12 -= go[54] * *cnV[54]; + m_A44 += gt[55]; + m_A44 += gt[56]; + m_A45 += go[55]; + m_A43 += go[56]; + double RHS13 = Idr[55]; + RHS13 += Idr[56]; + m_A47 += gt[57]; + m_A47 += gt[58]; + m_A47 += gt[59]; + m_A46 += go[57]; + m_A48 += go[58]; + double RHS14 = Idr[57]; + RHS14 += Idr[58]; + RHS14 += Idr[59]; + RHS14 -= go[59] * *cnV[59]; + m_A52 += gt[60]; + m_A52 += gt[61]; + m_A52 += gt[62]; + m_A52 += gt[63]; + m_A51 += go[60]; + m_A50 += go[61]; + m_A49 += go[62]; + double RHS15 = Idr[60]; + RHS15 += Idr[61]; + RHS15 += Idr[62]; + RHS15 += Idr[63]; + RHS15 -= go[63] * *cnV[63]; + m_A59 += gt[64]; + m_A59 += gt[65]; + m_A59 += gt[66]; + m_A59 += gt[67]; + m_A59 += gt[68]; + m_A55 += go[64]; + m_A56 += go[65]; + m_A54 += go[66]; + double RHS16 = Idr[64]; + RHS16 += Idr[65]; + RHS16 += Idr[66]; + RHS16 += Idr[67]; + RHS16 += Idr[68]; + RHS16 -= go[67] * *cnV[67]; + RHS16 -= go[68] * *cnV[68]; + m_A65 += gt[69]; + m_A65 += gt[70]; + m_A65 += gt[71]; + m_A65 += gt[72]; + m_A65 += gt[73]; + m_A61 += go[69]; + m_A66 += go[70]; + m_A63 += go[71]; + double RHS17 = Idr[69]; + RHS17 += Idr[70]; + RHS17 += Idr[71]; + RHS17 += Idr[72]; + RHS17 += Idr[73]; + RHS17 -= go[72] * *cnV[72]; + RHS17 -= go[73] * *cnV[73]; + m_A74 += gt[74]; + m_A74 += gt[75]; + m_A74 += gt[76]; + m_A74 += gt[77]; + m_A73 += go[74]; + m_A71 += go[75]; + m_A70 += go[76]; + m_A67 += go[77]; + double RHS18 = Idr[74]; + RHS18 += Idr[75]; + RHS18 += Idr[76]; + RHS18 += Idr[77]; + const double f0 = 1.0 / m_A0; + const double f0_13 = -f0 * m_A43; + m_A44 += m_A1 * f0_13; + RHS13 += f0_13 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_8 = -f1 * m_A21; + m_A23 += m_A3 * f1_8; + RHS8 += f1_8 * RHS1; + const double f1_15 = -f1 * m_A49; + m_A52 += m_A3 * f1_15; + RHS15 += f1_15 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_9 = -f2 * m_A24; + m_A25 += m_A5 * f2_9; + RHS9 += f2_9 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_15 = -f3 * m_A50; + m_A52 += m_A7 * f3_15; + m_A53 += m_A8 * f3_15; + RHS15 += f3_15 * RHS3; + const double f3_16 = -f3 * m_A54; + m_A58 += m_A7 * f3_16; + m_A59 += m_A8 * f3_16; + RHS16 += f3_16 * RHS3; + const double f4 = 1.0 / m_A9; + const double f4_10 = -f4 * m_A27; + m_A29 += m_A10 * f4_10; + RHS10 += f4_10 * RHS4; + const double f4_11 = -f4 * m_A30; + m_A33 += m_A10 * f4_11; + RHS11 += f4_11 * RHS4; + const double f5 = 1.0 / m_A11; + const double f5_11 = -f5 * m_A31; + m_A32 += m_A12 * f5_11; + m_A33 += m_A13 * f5_11; + m_A34 += m_A14 * f5_11; + m_A36 += m_A15 * f5_11; + RHS11 += f5_11 * RHS5; + const double f5_12 = -f5 * m_A37; + m_A38 += m_A12 * f5_12; + m_A39 += m_A13 * f5_12; + m_A40 += m_A14 * f5_12; + m_A42 += m_A15 * f5_12; + RHS12 += f5_12 * RHS5; + const double f5_18 = -f5 * m_A67; + m_A68 += m_A12 * f5_18; + m_A69 += m_A13 * f5_18; + m_A70 += m_A14 * f5_18; + m_A74 += m_A15 * f5_18; + RHS18 += f5_18 * RHS5; + const double f6 = 1.0 / m_A16; + const double f6_17 = -f6 * m_A61; + m_A62 += m_A17 * f6_17; + m_A66 += m_A18 * f6_17; + RHS17 += f6_17 * RHS6; + const double f7 = 1.0 / m_A19; + const double f7_14 = -f7 * m_A46; + m_A47 += m_A20 * f7_14; + RHS14 += f7_14 * RHS7; + const double f8 = 1.0 / m_A22; + const double f8_16 = -f8 * m_A55; + m_A58 += m_A23 * f8_16; + RHS16 += f8_16 * RHS8; + const double f9 = 1.0 / m_A25; + const double f9_15 = -f9 * m_A51; + m_A52 += m_A26 * f9_15; + RHS15 += f9_15 * RHS9; + const double f10 = 1.0 / m_A28; + const double f10_11 = -f10 * m_A32; + m_A33 += m_A29 * f10_11; + RHS11 += f10_11 * RHS10; + const double f10_12 = -f10 * m_A38; + m_A39 += m_A29 * f10_12; + RHS12 += f10_12 * RHS10; + const double f10_18 = -f10 * m_A68; + m_A69 += m_A29 * f10_18; + RHS18 += f10_18 * RHS10; + const double f11 = 1.0 / m_A33; + const double f11_12 = -f11 * m_A39; + m_A40 += m_A34 * f11_12; + m_A41 += m_A35 * f11_12; + m_A42 += m_A36 * f11_12; + RHS12 += f11_12 * RHS11; + const double f11_16 = -f11 * m_A56; + m_A57 += m_A34 * f11_16; + m_A59 += m_A35 * f11_16; + m_A60 += m_A36 * f11_16; + RHS16 += f11_16 * RHS11; + const double f11_18 = -f11 * m_A69; + m_A70 += m_A34 * f11_18; + m_A72 += m_A35 * f11_18; + m_A74 += m_A36 * f11_18; + RHS18 += f11_18 * RHS11; + const double f12 = 1.0 / m_A40; + const double f12_16 = -f12 * m_A57; + m_A59 += m_A41 * f12_16; + m_A60 += m_A42 * f12_16; + RHS16 += f12_16 * RHS12; + const double f12_17 = -f12 * m_A62; + m_A64 += m_A41 * f12_17; + m_A66 += m_A42 * f12_17; + RHS17 += f12_17 * RHS12; + const double f12_18 = -f12 * m_A70; + m_A72 += m_A41 * f12_18; + m_A74 += m_A42 * f12_18; + RHS18 += f12_18 * RHS12; + const double f13 = 1.0 / m_A44; + const double f13_17 = -f13 * m_A63; + m_A65 += m_A45 * f13_17; + RHS17 += f13_17 * RHS13; + const double f14 = 1.0 / m_A47; + const double f14_18 = -f14 * m_A71; + m_A74 += m_A48 * f14_18; + RHS18 += f14_18 * RHS14; + const double f15 = 1.0 / m_A52; + const double f15_16 = -f15 * m_A58; + m_A59 += m_A53 * f15_16; + RHS16 += f15_16 * RHS15; + const double f16 = 1.0 / m_A59; + const double f16_17 = -f16 * m_A64; + m_A66 += m_A60 * f16_17; + RHS17 += f16_17 * RHS16; + const double f16_18 = -f16 * m_A72; + m_A74 += m_A60 * f16_18; + RHS18 += f16_18 * RHS16; + const double f17 = 1.0 / m_A65; + const double f17_18 = -f17 * m_A73; + m_A74 += m_A66 * f17_18; + RHS18 += f17_18 * RHS17; + V[18] = RHS18 / m_A74; + double tmp17 = 0.0; + tmp17 += m_A66 * V[18]; + V[17] = (RHS17 - tmp17) / m_A65; + double tmp16 = 0.0; + tmp16 += m_A60 * V[18]; + V[16] = (RHS16 - tmp16) / m_A59; + double tmp15 = 0.0; + tmp15 += m_A53 * V[16]; + V[15] = (RHS15 - tmp15) / m_A52; + double tmp14 = 0.0; + tmp14 += m_A48 * V[18]; + V[14] = (RHS14 - tmp14) / m_A47; + double tmp13 = 0.0; + tmp13 += m_A45 * V[17]; + V[13] = (RHS13 - tmp13) / m_A44; + double tmp12 = 0.0; + tmp12 += m_A41 * V[16]; + tmp12 += m_A42 * V[18]; + V[12] = (RHS12 - tmp12) / m_A40; + double tmp11 = 0.0; + tmp11 += m_A34 * V[12]; + tmp11 += m_A35 * V[16]; + tmp11 += m_A36 * V[18]; + V[11] = (RHS11 - tmp11) / m_A33; + double tmp10 = 0.0; + tmp10 += m_A29 * V[11]; + V[10] = (RHS10 - tmp10) / m_A28; + double tmp9 = 0.0; + tmp9 += m_A26 * V[15]; + V[9] = (RHS9 - tmp9) / m_A25; + double tmp8 = 0.0; + tmp8 += m_A23 * V[15]; + V[8] = (RHS8 - tmp8) / m_A22; + double tmp7 = 0.0; + tmp7 += m_A20 * V[14]; + V[7] = (RHS7 - tmp7) / m_A19; + double tmp6 = 0.0; + tmp6 += m_A17 * V[12]; + tmp6 += m_A18 * V[18]; + V[6] = (RHS6 - tmp6) / m_A16; + double tmp5 = 0.0; + tmp5 += m_A12 * V[10]; + tmp5 += m_A13 * V[11]; + tmp5 += m_A14 * V[12]; + tmp5 += m_A15 * V[18]; + V[5] = (RHS5 - tmp5) / m_A11; + double tmp4 = 0.0; + tmp4 += m_A10 * V[11]; + V[4] = (RHS4 - tmp4) / m_A9; + double tmp3 = 0.0; + tmp3 += m_A7 * V[15]; + tmp3 += m_A8 * V[16]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[9]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[15]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[13]; + V[0] = (RHS0 - tmp0) / m_A0; +} + +// frogs +static void nl_gcr_75852e71cc632a65_33_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A4 += go[2]; + m_A3 += go[3]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[4] * *cnV[4]; + RHS1 -= go[5] * *cnV[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A5 += gt[8]; + m_A7 += go[6]; + m_A6 += go[7]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 -= go[8] * *cnV[8]; + m_A8 += gt[9]; + m_A8 += gt[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A8 += gt[15]; + m_A9 += go[9]; + double RHS3 = Idr[9]; + RHS3 += Idr[10]; + RHS3 += Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + RHS3 += Idr[14]; + RHS3 += Idr[15]; + RHS3 -= go[10] * *cnV[10]; + RHS3 -= go[11] * *cnV[11]; + RHS3 -= go[12] * *cnV[12]; + RHS3 -= go[13] * *cnV[13]; + RHS3 -= go[14] * *cnV[14]; + RHS3 -= go[15] * *cnV[15]; + m_A10 += gt[16]; + m_A10 += gt[17]; + m_A10 += gt[18]; + m_A11 += go[16]; + m_A12 += go[17]; + double RHS4 = Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + RHS4 -= go[18] * *cnV[18]; + m_A14 += gt[19]; + m_A14 += gt[20]; + m_A14 += gt[21]; + m_A16 += go[19]; + m_A13 += go[20]; + double RHS5 = Idr[19]; + RHS5 += Idr[20]; + RHS5 += Idr[21]; + RHS5 -= go[21] * *cnV[21]; + m_A21 += gt[22]; + m_A21 += gt[23]; + m_A21 += gt[24]; + m_A21 += gt[25]; + m_A21 += gt[26]; + m_A21 += gt[27]; + m_A21 += gt[28]; + m_A21 += gt[29]; + m_A19 += go[22]; + m_A22 += go[23]; + m_A18 += go[24]; + m_A17 += go[25]; + double RHS6 = Idr[22]; + RHS6 += Idr[23]; + RHS6 += Idr[24]; + RHS6 += Idr[25]; + RHS6 += Idr[26]; + RHS6 += Idr[27]; + RHS6 += Idr[28]; + RHS6 += Idr[29]; + RHS6 -= go[26] * *cnV[26]; + RHS6 -= go[27] * *cnV[27]; + RHS6 -= go[28] * *cnV[28]; + RHS6 -= go[29] * *cnV[29]; + m_A25 += gt[30]; + m_A25 += gt[31]; + m_A25 += gt[32]; + m_A25 += gt[33]; + m_A25 += gt[34]; + m_A23 += go[30]; + m_A24 += go[31]; + m_A26 += go[32]; + double RHS7 = Idr[30]; + RHS7 += Idr[31]; + RHS7 += Idr[32]; + RHS7 += Idr[33]; + RHS7 += Idr[34]; + RHS7 -= go[33] * *cnV[33]; + RHS7 -= go[34] * *cnV[34]; + m_A32 += gt[35]; + m_A32 += gt[36]; + m_A32 += gt[37]; + m_A32 += gt[38]; + m_A32 += gt[39]; + m_A31 += go[35]; + m_A28 += go[36]; + m_A27 += go[37]; + m_A30 += go[38]; + m_A29 += go[39]; + double RHS8 = Idr[35]; + RHS8 += Idr[36]; + RHS8 += Idr[37]; + RHS8 += Idr[38]; + RHS8 += Idr[39]; + const double f0 = 1.0 / m_A0; + const double f0_6 = -f0 * m_A17; + m_A21 += m_A1 * f0_6; + RHS6 += f0_6 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_5 = -f1 * m_A13; + m_A14 += m_A3 * f1_5; + m_A15 += m_A4 * f1_5; + RHS5 += f1_5 * RHS1; + const double f1_6 = -f1 * m_A18; + m_A20 += m_A3 * f1_6; + m_A21 += m_A4 * f1_6; + RHS6 += f1_6 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_6 = -f2 * m_A19; + m_A21 += m_A6 * f2_6; + m_A22 += m_A7 * f2_6; + RHS6 += f2_6 * RHS2; + const double f2_8 = -f2 * m_A27; + m_A30 += m_A6 * f2_8; + m_A32 += m_A7 * f2_8; + RHS8 += f2_8 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_7 = -f3 * m_A23; + m_A24 += m_A9 * f3_7; + RHS7 += f3_7 * RHS3; + const double f4 = 1.0 / m_A10; + const double f4_7 = -f4 * m_A24; + m_A25 += m_A11 * f4_7; + m_A26 += m_A12 * f4_7; + RHS7 += f4_7 * RHS4; + const double f4_8 = -f4 * m_A28; + m_A31 += m_A11 * f4_8; + m_A32 += m_A12 * f4_8; + RHS8 += f4_8 * RHS4; + const double f5 = 1.0 / m_A14; + const double f5_6 = -f5 * m_A20; + m_A21 += m_A15 * f5_6; + m_A22 += m_A16 * f5_6; + RHS6 += f5_6 * RHS5; + const double f5_8 = -f5 * m_A29; + m_A30 += m_A15 * f5_8; + m_A32 += m_A16 * f5_8; + RHS8 += f5_8 * RHS5; + const double f6 = 1.0 / m_A21; + const double f6_8 = -f6 * m_A30; + m_A32 += m_A22 * f6_8; + RHS8 += f6_8 * RHS6; + const double f7 = 1.0 / m_A25; + const double f7_8 = -f7 * m_A31; + m_A32 += m_A26 * f7_8; + RHS8 += f7_8 * RHS7; + V[8] = RHS8 / m_A32; + double tmp7 = 0.0; + tmp7 += m_A26 * V[8]; + V[7] = (RHS7 - tmp7) / m_A25; + double tmp6 = 0.0; + tmp6 += m_A22 * V[8]; + V[6] = (RHS6 - tmp6) / m_A21; + double tmp5 = 0.0; + tmp5 += m_A15 * V[6]; + tmp5 += m_A16 * V[8]; + V[5] = (RHS5 - tmp5) / m_A14; + double tmp4 = 0.0; + tmp4 += m_A11 * V[7]; + tmp4 += m_A12 * V[8]; + V[4] = (RHS4 - tmp4) / m_A10; + double tmp3 = 0.0; + tmp3 += m_A9 * V[4]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A6 * V[6]; + tmp2 += m_A7 * V[8]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[5]; + tmp1 += m_A4 * V[6]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[6]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // ripoff static void nl_gcr_76c9e236353caed1_35_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -30817,6 +34720,89 @@ static void nl_gcr_80b4b1e5cc58d303_29_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// frogs +static void nl_gcr_815733e3f2e05029_9_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A0 += gt[4]; + m_A2 += go[0]; + m_A1 += go[1]; + m_A1 += go[2]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 += Idr[4]; + RHS0 -= go[3] * *cnV[3]; + RHS0 -= go[4] * *cnV[4]; + m_A4 += gt[5]; + m_A4 += gt[6]; + m_A4 += gt[7]; + m_A4 += gt[8]; + m_A4 += gt[9]; + m_A4 += gt[10]; + m_A5 += go[5]; + m_A5 += go[6]; + m_A3 += go[7]; + m_A3 += go[8]; + double RHS1 = Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 += Idr[8]; + RHS1 += Idr[9]; + RHS1 += Idr[10]; + RHS1 -= go[9] * *cnV[9]; + RHS1 -= go[10] * *cnV[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A7 += go[11]; + m_A7 += go[12]; + m_A6 += go[13]; + double RHS2 = Idr[11]; + RHS2 += Idr[12]; + RHS2 += Idr[13]; + RHS2 += Idr[14]; + RHS2 -= go[14] * *cnV[14]; + const double f0 = 1.0 / m_A0; + const double f0_1 = -f0 * m_A3; + m_A4 += m_A1 * f0_1; + m_A5 += m_A2 * f0_1; + RHS1 += f0_1 * RHS0; + const double f0_2 = -f0 * m_A6; + m_A7 += m_A1 * f0_2; + m_A8 += m_A2 * f0_2; + RHS2 += f0_2 * RHS0; + const double f1 = 1.0 / m_A4; + const double f1_2 = -f1 * m_A7; + m_A8 += m_A5 * f1_2; + RHS2 += f1_2 * RHS1; + V[2] = RHS2 / m_A8; + double tmp1 = 0.0; + tmp1 += m_A5 * V[2]; + V[1] = (RHS1 - tmp1) / m_A4; + double tmp0 = 0.0; + tmp0 += m_A1 * V[1]; + tmp0 += m_A2 * V[2]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // elim static void nl_gcr_81f40a54af2ca202_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -30902,6 +34888,75 @@ static void nl_gcr_81f40a54af2ca202_10_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// frogs +static void nl_gcr_84425fea9033e75d_7_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A3 += go[3]; + m_A3 += go[4]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 -= go[5] * *cnV[5]; + RHS1 -= go[6] * *cnV[6]; + m_A6 += gt[7]; + m_A6 += gt[8]; + m_A6 += gt[9]; + m_A6 += gt[10]; + m_A6 += gt[11]; + m_A6 += gt[12]; + m_A5 += go[7]; + m_A5 += go[8]; + m_A4 += go[9]; + double RHS2 = Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 += Idr[11]; + RHS2 += Idr[12]; + RHS2 -= go[10] * *cnV[10]; + RHS2 -= go[11] * *cnV[11]; + RHS2 -= go[12] * *cnV[12]; + const double f0 = 1.0 / m_A0; + const double f0_2 = -f0 * m_A4; + m_A6 += m_A1 * f0_2; + RHS2 += f0_2 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_2 = -f1 * m_A5; + m_A6 += m_A3 * f1_2; + RHS2 += f1_2 * RHS1; + V[2] = RHS2 / m_A6; + double tmp1 = 0.0; + tmp1 += m_A3 * V[2]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[2]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // sundance static void nl_gcr_8446e63d7842f6a6_70_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -41554,6 +45609,1130 @@ static void nl_gcr_aa07266ef5d420d1_11_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_aa68b74ffdea9bd8_47_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A2 += gt[7]; + m_A2 += gt[8]; + m_A3 += go[2]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 += Idr[8]; + RHS1 -= go[3] * *cnV[3]; + RHS1 -= go[4] * *cnV[4]; + RHS1 -= go[5] * *cnV[5]; + RHS1 -= go[6] * *cnV[6]; + RHS1 -= go[7] * *cnV[7]; + RHS1 -= go[8] * *cnV[8]; + m_A4 += gt[9]; + m_A4 += gt[10]; + m_A4 += gt[11]; + m_A6 += go[9]; + m_A5 += go[10]; + double RHS2 = Idr[9]; + RHS2 += Idr[10]; + RHS2 += Idr[11]; + RHS2 -= go[11] * *cnV[11]; + m_A7 += gt[12]; + m_A7 += gt[13]; + m_A7 += gt[14]; + m_A8 += go[12]; + m_A9 += go[13]; + double RHS3 = Idr[12]; + RHS3 += Idr[13]; + RHS3 += Idr[14]; + RHS3 -= go[14] * *cnV[14]; + m_A10 += gt[15]; + m_A10 += gt[16]; + m_A10 += gt[17]; + m_A10 += gt[18]; + m_A10 += gt[19]; + m_A10 += gt[20]; + m_A13 += go[15]; + m_A12 += go[16]; + m_A11 += go[17]; + m_A14 += go[18]; + double RHS4 = Idr[15]; + RHS4 += Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + RHS4 += Idr[19]; + RHS4 += Idr[20]; + RHS4 -= go[19] * *cnV[19]; + RHS4 -= go[20] * *cnV[20]; + m_A17 += gt[21]; + m_A17 += gt[22]; + m_A16 += go[21]; + m_A15 += go[22]; + double RHS5 = Idr[21]; + RHS5 += Idr[22]; + m_A21 += gt[23]; + m_A21 += gt[24]; + m_A21 += gt[25]; + m_A20 += go[23]; + m_A19 += go[24]; + double RHS6 = Idr[23]; + RHS6 += Idr[24]; + RHS6 += Idr[25]; + RHS6 -= go[25] * *cnV[25]; + m_A28 += gt[26]; + m_A28 += gt[27]; + m_A28 += gt[28]; + m_A28 += gt[29]; + m_A28 += gt[30]; + m_A25 += go[26]; + m_A29 += go[27]; + m_A26 += go[28]; + double RHS7 = Idr[26]; + RHS7 += Idr[27]; + RHS7 += Idr[28]; + RHS7 += Idr[29]; + RHS7 += Idr[30]; + RHS7 -= go[29] * *cnV[29]; + RHS7 -= go[30] * *cnV[30]; + m_A32 += gt[31]; + m_A32 += gt[32]; + m_A32 += gt[33]; + m_A30 += go[31]; + double RHS8 = Idr[31]; + RHS8 += Idr[32]; + RHS8 += Idr[33]; + RHS8 -= go[32] * *cnV[32]; + RHS8 -= go[33] * *cnV[33]; + m_A38 += gt[34]; + m_A38 += gt[35]; + m_A38 += gt[36]; + m_A38 += gt[37]; + m_A38 += gt[38]; + m_A38 += gt[39]; + m_A38 += gt[40]; + m_A36 += go[34]; + m_A35 += go[35]; + double RHS9 = Idr[34]; + RHS9 += Idr[35]; + RHS9 += Idr[36]; + RHS9 += Idr[37]; + RHS9 += Idr[38]; + RHS9 += Idr[39]; + RHS9 += Idr[40]; + RHS9 -= go[36] * *cnV[36]; + RHS9 -= go[37] * *cnV[37]; + RHS9 -= go[38] * *cnV[38]; + RHS9 -= go[39] * *cnV[39]; + RHS9 -= go[40] * *cnV[40]; + m_A46 += gt[41]; + m_A46 += gt[42]; + m_A46 += gt[43]; + m_A41 += go[41]; + m_A40 += go[42]; + m_A43 += go[43]; + double RHS10 = Idr[41]; + RHS10 += Idr[42]; + RHS10 += Idr[43]; + const double f0 = 1.0 / m_A0; + const double f0_5 = -f0 * m_A15; + m_A17 += m_A1 * f0_5; + RHS5 += f0_5 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_7 = -f1 * m_A25; + m_A26 += m_A3 * f1_7; + RHS7 += f1_7 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_5 = -f2 * m_A16; + m_A17 += m_A5 * f2_5; + m_A18 += m_A6 * f2_5; + RHS5 += f2_5 * RHS2; + const double f2_7 = -f2 * m_A26; + m_A27 += m_A5 * f2_7; + m_A28 += m_A6 * f2_7; + RHS7 += f2_7 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_6 = -f3 * m_A19; + m_A21 += m_A8 * f3_6; + m_A24 += m_A9 * f3_6; + RHS6 += f3_6 * RHS3; + const double f3_9 = -f3 * m_A35; + m_A36 += m_A8 * f3_9; + m_A39 += m_A9 * f3_9; + RHS9 += f3_9 * RHS3; + const double f3_10 = -f3 * m_A40; + m_A42 += m_A8 * f3_10; + m_A46 += m_A9 * f3_10; + RHS10 += f3_10 * RHS3; + const double f4 = 1.0 / m_A10; + const double f4_6 = -f4 * m_A20; + m_A21 += m_A11 * f4_6; + m_A22 += m_A12 * f4_6; + m_A23 += m_A13 * f4_6; + m_A24 += m_A14 * f4_6; + RHS6 += f4_6 * RHS4; + const double f4_8 = -f4 * m_A30; + m_A31 += m_A11 * f4_8; + m_A32 += m_A12 * f4_8; + m_A33 += m_A13 * f4_8; + m_A34 += m_A14 * f4_8; + RHS8 += f4_8 * RHS4; + const double f4_10 = -f4 * m_A41; + m_A42 += m_A11 * f4_10; + m_A44 += m_A12 * f4_10; + m_A45 += m_A13 * f4_10; + m_A46 += m_A14 * f4_10; + RHS10 += f4_10 * RHS4; + const double f5 = 1.0 / m_A17; + const double f5_7 = -f5 * m_A27; + m_A28 += m_A18 * f5_7; + RHS7 += f5_7 * RHS5; + const double f6 = 1.0 / m_A21; + const double f6_8 = -f6 * m_A31; + m_A32 += m_A22 * f6_8; + m_A33 += m_A23 * f6_8; + m_A34 += m_A24 * f6_8; + RHS8 += f6_8 * RHS6; + const double f6_9 = -f6 * m_A36; + m_A37 += m_A22 * f6_9; + m_A38 += m_A23 * f6_9; + m_A39 += m_A24 * f6_9; + RHS9 += f6_9 * RHS6; + const double f6_10 = -f6 * m_A42; + m_A44 += m_A22 * f6_10; + m_A45 += m_A23 * f6_10; + m_A46 += m_A24 * f6_10; + RHS10 += f6_10 * RHS6; + const double f7 = 1.0 / m_A28; + const double f7_10 = -f7 * m_A43; + m_A46 += m_A29 * f7_10; + RHS10 += f7_10 * RHS7; + const double f8 = 1.0 / m_A32; + const double f8_9 = -f8 * m_A37; + m_A38 += m_A33 * f8_9; + m_A39 += m_A34 * f8_9; + RHS9 += f8_9 * RHS8; + const double f8_10 = -f8 * m_A44; + m_A45 += m_A33 * f8_10; + m_A46 += m_A34 * f8_10; + RHS10 += f8_10 * RHS8; + const double f9 = 1.0 / m_A38; + const double f9_10 = -f9 * m_A45; + m_A46 += m_A39 * f9_10; + RHS10 += f9_10 * RHS9; + V[10] = RHS10 / m_A46; + double tmp9 = 0.0; + tmp9 += m_A39 * V[10]; + V[9] = (RHS9 - tmp9) / m_A38; + double tmp8 = 0.0; + tmp8 += m_A33 * V[9]; + tmp8 += m_A34 * V[10]; + V[8] = (RHS8 - tmp8) / m_A32; + double tmp7 = 0.0; + tmp7 += m_A29 * V[10]; + V[7] = (RHS7 - tmp7) / m_A28; + double tmp6 = 0.0; + tmp6 += m_A22 * V[8]; + tmp6 += m_A23 * V[9]; + tmp6 += m_A24 * V[10]; + V[6] = (RHS6 - tmp6) / m_A21; + double tmp5 = 0.0; + tmp5 += m_A18 * V[7]; + V[5] = (RHS5 - tmp5) / m_A17; + double tmp4 = 0.0; + tmp4 += m_A11 * V[6]; + tmp4 += m_A12 * V[8]; + tmp4 += m_A13 * V[9]; + tmp4 += m_A14 * V[10]; + V[4] = (RHS4 - tmp4) / m_A10; + double tmp3 = 0.0; + tmp3 += m_A8 * V[6]; + tmp3 += m_A9 * V[10]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A5 * V[5]; + tmp2 += m_A6 * V[7]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[2]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[5]; + V[0] = (RHS0 - tmp0) / m_A0; +} + +// frogs +static void nl_gcr_ab8d1ff6aa7499d8_119_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + double m_A97(0.0); + double m_A98(0.0); + double m_A99(0.0); + double m_A100(0.0); + double m_A101(0.0); + double m_A102(0.0); + double m_A103(0.0); + double m_A104(0.0); + double m_A105(0.0); + double m_A106(0.0); + double m_A107(0.0); + double m_A108(0.0); + double m_A109(0.0); + double m_A110(0.0); + double m_A111(0.0); + double m_A112(0.0); + double m_A113(0.0); + double m_A114(0.0); + double m_A115(0.0); + double m_A116(0.0); + double m_A117(0.0); + double m_A118(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A2 += go[0]; + m_A1 += go[1]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 -= go[2] * *cnV[2]; + RHS0 -= go[3] * *cnV[3]; + m_A3 += gt[4]; + m_A3 += gt[5]; + m_A4 += go[4]; + double RHS1 = Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[5] * *cnV[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A5 += gt[8]; + m_A5 += gt[9]; + m_A5 += gt[10]; + m_A5 += gt[11]; + m_A5 += gt[12]; + m_A6 += go[6]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 += Idr[11]; + RHS2 += Idr[12]; + RHS2 -= go[7] * *cnV[7]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + RHS2 -= go[11] * *cnV[11]; + RHS2 -= go[12] * *cnV[12]; + m_A7 += gt[13]; + m_A7 += gt[14]; + m_A7 += gt[15]; + m_A7 += gt[16]; + m_A10 += go[13]; + m_A9 += go[14]; + m_A8 += go[15]; + double RHS3 = Idr[13]; + RHS3 += Idr[14]; + RHS3 += Idr[15]; + RHS3 += Idr[16]; + RHS3 -= go[16] * *cnV[16]; + m_A11 += gt[17]; + m_A11 += gt[18]; + m_A11 += gt[19]; + m_A11 += gt[20]; + m_A11 += gt[21]; + m_A11 += gt[22]; + m_A14 += go[17]; + m_A14 += go[18]; + m_A13 += go[19]; + m_A13 += go[20]; + m_A12 += go[21]; + double RHS4 = Idr[17]; + RHS4 += Idr[18]; + RHS4 += Idr[19]; + RHS4 += Idr[20]; + RHS4 += Idr[21]; + RHS4 += Idr[22]; + RHS4 -= go[22] * *cnV[22]; + m_A15 += gt[23]; + m_A15 += gt[24]; + m_A15 += gt[25]; + m_A15 += gt[26]; + m_A15 += gt[27]; + m_A15 += gt[28]; + m_A18 += go[23]; + m_A18 += go[24]; + m_A17 += go[25]; + m_A17 += go[26]; + m_A16 += go[27]; + double RHS5 = Idr[23]; + RHS5 += Idr[24]; + RHS5 += Idr[25]; + RHS5 += Idr[26]; + RHS5 += Idr[27]; + RHS5 += Idr[28]; + RHS5 -= go[28] * *cnV[28]; + m_A19 += gt[29]; + m_A19 += gt[30]; + m_A20 += go[29]; + m_A21 += go[30]; + double RHS6 = Idr[29]; + RHS6 += Idr[30]; + m_A22 += gt[31]; + m_A22 += gt[32]; + m_A22 += gt[33]; + m_A22 += gt[34]; + m_A22 += gt[35]; + m_A22 += gt[36]; + m_A22 += gt[37]; + m_A23 += go[31]; + m_A24 += go[32]; + double RHS7 = Idr[31]; + RHS7 += Idr[32]; + RHS7 += Idr[33]; + RHS7 += Idr[34]; + RHS7 += Idr[35]; + RHS7 += Idr[36]; + RHS7 += Idr[37]; + RHS7 -= go[33] * *cnV[33]; + RHS7 -= go[34] * *cnV[34]; + RHS7 -= go[35] * *cnV[35]; + RHS7 -= go[36] * *cnV[36]; + RHS7 -= go[37] * *cnV[37]; + m_A25 += gt[38]; + m_A25 += gt[39]; + m_A25 += gt[40]; + m_A25 += gt[41]; + m_A25 += gt[42]; + m_A25 += gt[43]; + m_A26 += go[38]; + m_A26 += go[39]; + m_A27 += go[40]; + m_A28 += go[41]; + double RHS8 = Idr[38]; + RHS8 += Idr[39]; + RHS8 += Idr[40]; + RHS8 += Idr[41]; + RHS8 += Idr[42]; + RHS8 += Idr[43]; + RHS8 -= go[42] * *cnV[42]; + RHS8 -= go[43] * *cnV[43]; + m_A29 += gt[44]; + m_A29 += gt[45]; + m_A29 += gt[46]; + m_A29 += gt[47]; + m_A29 += gt[48]; + m_A29 += gt[49]; + m_A29 += gt[50]; + m_A30 += go[44]; + double RHS9 = Idr[44]; + RHS9 += Idr[45]; + RHS9 += Idr[46]; + RHS9 += Idr[47]; + RHS9 += Idr[48]; + RHS9 += Idr[49]; + RHS9 += Idr[50]; + RHS9 -= go[45] * *cnV[45]; + RHS9 -= go[46] * *cnV[46]; + RHS9 -= go[47] * *cnV[47]; + RHS9 -= go[48] * *cnV[48]; + RHS9 -= go[49] * *cnV[49]; + RHS9 -= go[50] * *cnV[50]; + m_A31 += gt[51]; + m_A31 += gt[52]; + m_A31 += gt[53]; + m_A31 += gt[54]; + m_A34 += go[51]; + m_A32 += go[52]; + m_A33 += go[53]; + double RHS10 = Idr[51]; + RHS10 += Idr[52]; + RHS10 += Idr[53]; + RHS10 += Idr[54]; + RHS10 -= go[54] * *cnV[54]; + m_A37 += gt[55]; + m_A37 += gt[56]; + m_A37 += gt[57]; + m_A36 += go[55]; + m_A35 += go[56]; + double RHS11 = Idr[55]; + RHS11 += Idr[56]; + RHS11 += Idr[57]; + RHS11 -= go[57] * *cnV[57]; + m_A43 += gt[58]; + m_A43 += gt[59]; + m_A43 += gt[60]; + m_A45 += go[58]; + m_A41 += go[59]; + double RHS12 = Idr[58]; + RHS12 += Idr[59]; + RHS12 += Idr[60]; + RHS12 -= go[60] * *cnV[60]; + m_A51 += gt[61]; + m_A51 += gt[62]; + m_A51 += gt[63]; + m_A51 += gt[64]; + m_A51 += gt[65]; + m_A48 += go[61]; + m_A47 += go[62]; + m_A46 += go[63]; + double RHS13 = Idr[61]; + RHS13 += Idr[62]; + RHS13 += Idr[63]; + RHS13 += Idr[64]; + RHS13 += Idr[65]; + RHS13 -= go[64] * *cnV[64]; + RHS13 -= go[65] * *cnV[65]; + m_A57 += gt[66]; + m_A57 += gt[67]; + m_A57 += gt[68]; + m_A57 += gt[69]; + m_A59 += go[66]; + m_A55 += go[67]; + m_A55 += go[68]; + double RHS14 = Idr[66]; + RHS14 += Idr[67]; + RHS14 += Idr[68]; + RHS14 += Idr[69]; + RHS14 -= go[69] * *cnV[69]; + m_A61 += gt[70]; + m_A61 += gt[71]; + m_A60 += go[70]; + double RHS15 = Idr[70]; + RHS15 += Idr[71]; + RHS15 -= go[71] * *cnV[71]; + m_A66 += gt[72]; + m_A66 += gt[73]; + m_A66 += gt[74]; + m_A66 += gt[75]; + m_A66 += gt[76]; + m_A66 += gt[77]; + m_A63 += go[72]; + m_A64 += go[73]; + m_A64 += go[74]; + m_A68 += go[75]; + m_A68 += go[76]; + double RHS16 = Idr[72]; + RHS16 += Idr[73]; + RHS16 += Idr[74]; + RHS16 += Idr[75]; + RHS16 += Idr[76]; + RHS16 += Idr[77]; + RHS16 -= go[77] * *cnV[77]; + m_A71 += gt[78]; + m_A71 += gt[79]; + m_A71 += gt[80]; + m_A71 += gt[81]; + m_A71 += gt[82]; + m_A71 += gt[83]; + m_A72 += go[78]; + m_A69 += go[79]; + m_A73 += go[80]; + double RHS17 = Idr[78]; + RHS17 += Idr[79]; + RHS17 += Idr[80]; + RHS17 += Idr[81]; + RHS17 += Idr[82]; + RHS17 += Idr[83]; + RHS17 -= go[81] * *cnV[81]; + RHS17 -= go[82] * *cnV[82]; + RHS17 -= go[83] * *cnV[83]; + m_A75 += gt[84]; + m_A75 += gt[85]; + m_A75 += gt[86]; + m_A77 += go[84]; + m_A74 += go[85]; + double RHS18 = Idr[84]; + RHS18 += Idr[85]; + RHS18 += Idr[86]; + RHS18 -= go[86] * *cnV[86]; + m_A85 += gt[87]; + m_A85 += gt[88]; + m_A85 += gt[89]; + m_A85 += gt[90]; + m_A85 += gt[91]; + m_A85 += gt[92]; + m_A78 += go[87]; + m_A80 += go[88]; + m_A82 += go[89]; + m_A79 += go[90]; + double RHS19 = Idr[87]; + RHS19 += Idr[88]; + RHS19 += Idr[89]; + RHS19 += Idr[90]; + RHS19 += Idr[91]; + RHS19 += Idr[92]; + RHS19 -= go[91] * *cnV[91]; + RHS19 -= go[92] * *cnV[92]; + m_A94 += gt[93]; + m_A94 += gt[94]; + m_A94 += gt[95]; + m_A94 += gt[96]; + m_A94 += gt[97]; + m_A88 += go[93]; + m_A90 += go[94]; + m_A92 += go[95]; + double RHS20 = Idr[93]; + RHS20 += Idr[94]; + RHS20 += Idr[95]; + RHS20 += Idr[96]; + RHS20 += Idr[97]; + RHS20 -= go[96] * *cnV[96]; + RHS20 -= go[97] * *cnV[97]; + m_A102 += gt[98]; + m_A102 += gt[99]; + m_A102 += gt[100]; + m_A102 += gt[101]; + m_A102 += gt[102]; + m_A102 += gt[103]; + m_A102 += gt[104]; + m_A103 += go[98]; + m_A98 += go[99]; + m_A98 += go[100]; + m_A100 += go[101]; + m_A97 += go[102]; + m_A97 += go[103]; + double RHS21 = Idr[98]; + RHS21 += Idr[99]; + RHS21 += Idr[100]; + RHS21 += Idr[101]; + RHS21 += Idr[102]; + RHS21 += Idr[103]; + RHS21 += Idr[104]; + RHS21 -= go[104] * *cnV[104]; + m_A108 += gt[105]; + m_A108 += gt[106]; + m_A108 += gt[107]; + m_A108 += gt[108]; + m_A108 += gt[109]; + m_A108 += gt[110]; + m_A104 += go[105]; + m_A106 += go[106]; + m_A105 += go[107]; + double RHS22 = Idr[105]; + RHS22 += Idr[106]; + RHS22 += Idr[107]; + RHS22 += Idr[108]; + RHS22 += Idr[109]; + RHS22 += Idr[110]; + RHS22 -= go[108] * *cnV[108]; + RHS22 -= go[109] * *cnV[109]; + RHS22 -= go[110] * *cnV[110]; + m_A118 += gt[111]; + m_A118 += gt[112]; + m_A118 += gt[113]; + m_A118 += gt[114]; + m_A118 += gt[115]; + m_A118 += gt[116]; + m_A118 += gt[117]; + m_A118 += gt[118]; + m_A118 += gt[119]; + m_A112 += go[111]; + m_A112 += go[112]; + m_A111 += go[113]; + m_A113 += go[114]; + m_A116 += go[115]; + m_A110 += go[116]; + m_A110 += go[117]; + double RHS23 = Idr[111]; + RHS23 += Idr[112]; + RHS23 += Idr[113]; + RHS23 += Idr[114]; + RHS23 += Idr[115]; + RHS23 += Idr[116]; + RHS23 += Idr[117]; + RHS23 += Idr[118]; + RHS23 += Idr[119]; + RHS23 -= go[118] * *cnV[118]; + RHS23 -= go[119] * *cnV[119]; + const double f0 = 1.0 / m_A0; + const double f0_11 = -f0 * m_A35; + m_A37 += m_A1 * f0_11; + m_A39 += m_A2 * f0_11; + RHS11 += f0_11 * RHS0; + const double f0_13 = -f0 * m_A46; + m_A49 += m_A1 * f0_13; + m_A51 += m_A2 * f0_13; + RHS13 += f0_13 * RHS0; + const double f1 = 1.0 / m_A3; + const double f1_13 = -f1 * m_A47; + m_A51 += m_A4 * f1_13; + RHS13 += f1_13 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_19 = -f2 * m_A78; + m_A82 += m_A6 * f2_19; + RHS19 += f2_19 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_11 = -f3 * m_A36; + m_A37 += m_A8 * f3_11; + m_A38 += m_A9 * f3_11; + m_A40 += m_A10 * f3_11; + RHS11 += f3_11 * RHS3; + const double f3_12 = -f3 * m_A41; + m_A42 += m_A8 * f3_12; + m_A43 += m_A9 * f3_12; + m_A45 += m_A10 * f3_12; + RHS12 += f3_12 * RHS3; + const double f3_19 = -f3 * m_A79; + m_A81 += m_A8 * f3_19; + m_A82 += m_A9 * f3_19; + m_A85 += m_A10 * f3_19; + RHS19 += f3_19 * RHS3; + const double f4 = 1.0 / m_A11; + const double f4_13 = -f4 * m_A48; + m_A51 += m_A12 * f4_13; + m_A52 += m_A13 * f4_13; + m_A54 += m_A14 * f4_13; + RHS13 += f4_13 * RHS4; + const double f4_14 = -f4 * m_A55; + m_A56 += m_A12 * f4_14; + m_A57 += m_A13 * f4_14; + m_A59 += m_A14 * f4_14; + RHS14 += f4_14 * RHS4; + const double f4_21 = -f4 * m_A97; + m_A99 += m_A12 * f4_21; + m_A100 += m_A13 * f4_21; + m_A102 += m_A14 * f4_21; + RHS21 += f4_21 * RHS4; + const double f5 = 1.0 / m_A15; + const double f5_19 = -f5 * m_A80; + m_A85 += m_A16 * f5_19; + m_A86 += m_A17 * f5_19; + m_A87 += m_A18 * f5_19; + RHS19 += f5_19 * RHS5; + const double f5_21 = -f5 * m_A98; + m_A101 += m_A16 * f5_21; + m_A102 += m_A17 * f5_21; + m_A103 += m_A18 * f5_21; + RHS21 += f5_21 * RHS5; + const double f5_23 = -f5 * m_A110; + m_A114 += m_A16 * f5_23; + m_A116 += m_A17 * f5_23; + m_A118 += m_A18 * f5_23; + RHS23 += f5_23 * RHS5; + const double f6 = 1.0 / m_A19; + const double f6_15 = -f6 * m_A60; + m_A61 += m_A20 * f6_15; + m_A62 += m_A21 * f6_15; + RHS15 += f6_15 * RHS6; + const double f6_16 = -f6 * m_A63; + m_A65 += m_A20 * f6_16; + m_A66 += m_A21 * f6_16; + RHS16 += f6_16 * RHS6; + const double f7 = 1.0 / m_A22; + const double f7_20 = -f7 * m_A88; + m_A89 += m_A23 * f7_20; + m_A92 += m_A24 * f7_20; + RHS20 += f7_20 * RHS7; + const double f8 = 1.0 / m_A25; + const double f8_16 = -f8 * m_A64; + m_A66 += m_A26 * f8_16; + m_A67 += m_A27 * f8_16; + m_A68 += m_A28 * f8_16; + RHS16 += f8_16 * RHS8; + const double f8_17 = -f8 * m_A69; + m_A70 += m_A26 * f8_17; + m_A71 += m_A27 * f8_17; + m_A73 += m_A28 * f8_17; + RHS17 += f8_17 * RHS8; + const double f8_20 = -f8 * m_A89; + m_A91 += m_A26 * f8_20; + m_A92 += m_A27 * f8_20; + m_A96 += m_A28 * f8_20; + RHS20 += f8_20 * RHS8; + const double f8_23 = -f8 * m_A111; + m_A112 += m_A26 * f8_23; + m_A113 += m_A27 * f8_23; + m_A118 += m_A28 * f8_23; + RHS23 += f8_23 * RHS8; + const double f9 = 1.0 / m_A29; + const double f9_22 = -f9 * m_A104; + m_A106 += m_A30 * f9_22; + RHS22 += f9_22 * RHS9; + const double f10 = 1.0 / m_A31; + const double f10_18 = -f10 * m_A74; + m_A75 += m_A32 * f10_18; + m_A76 += m_A33 * f10_18; + m_A77 += m_A34 * f10_18; + RHS18 += f10_18 * RHS10; + const double f10_20 = -f10 * m_A90; + m_A93 += m_A32 * f10_20; + m_A94 += m_A33 * f10_20; + m_A95 += m_A34 * f10_20; + RHS20 += f10_20 * RHS10; + const double f10_22 = -f10 * m_A105; + m_A106 += m_A32 * f10_22; + m_A107 += m_A33 * f10_22; + m_A108 += m_A34 * f10_22; + RHS22 += f10_22 * RHS10; + const double f11 = 1.0 / m_A37; + const double f11_12 = -f11 * m_A42; + m_A43 += m_A38 * f11_12; + m_A44 += m_A39 * f11_12; + m_A45 += m_A40 * f11_12; + RHS12 += f11_12 * RHS11; + const double f11_13 = -f11 * m_A49; + m_A50 += m_A38 * f11_13; + m_A51 += m_A39 * f11_13; + m_A53 += m_A40 * f11_13; + RHS13 += f11_13 * RHS11; + const double f11_19 = -f11 * m_A81; + m_A82 += m_A38 * f11_19; + m_A83 += m_A39 * f11_19; + m_A85 += m_A40 * f11_19; + RHS19 += f11_19 * RHS11; + const double f12 = 1.0 / m_A43; + const double f12_13 = -f12 * m_A50; + m_A51 += m_A44 * f12_13; + m_A53 += m_A45 * f12_13; + RHS13 += f12_13 * RHS12; + const double f12_19 = -f12 * m_A82; + m_A83 += m_A44 * f12_19; + m_A85 += m_A45 * f12_19; + RHS19 += f12_19 * RHS12; + const double f13 = 1.0 / m_A51; + const double f13_14 = -f13 * m_A56; + m_A57 += m_A52 * f13_14; + m_A58 += m_A53 * f13_14; + m_A59 += m_A54 * f13_14; + RHS14 += f13_14 * RHS13; + const double f13_19 = -f13 * m_A83; + m_A84 += m_A52 * f13_19; + m_A85 += m_A53 * f13_19; + m_A86 += m_A54 * f13_19; + RHS19 += f13_19 * RHS13; + const double f13_21 = -f13 * m_A99; + m_A100 += m_A52 * f13_21; + m_A101 += m_A53 * f13_21; + m_A102 += m_A54 * f13_21; + RHS21 += f13_21 * RHS13; + const double f14 = 1.0 / m_A57; + const double f14_19 = -f14 * m_A84; + m_A85 += m_A58 * f14_19; + m_A86 += m_A59 * f14_19; + RHS19 += f14_19 * RHS14; + const double f14_21 = -f14 * m_A100; + m_A101 += m_A58 * f14_21; + m_A102 += m_A59 * f14_21; + RHS21 += f14_21 * RHS14; + const double f15 = 1.0 / m_A61; + const double f15_16 = -f15 * m_A65; + m_A66 += m_A62 * f15_16; + RHS16 += f15_16 * RHS15; + const double f16 = 1.0 / m_A66; + const double f16_17 = -f16 * m_A70; + m_A71 += m_A67 * f16_17; + m_A73 += m_A68 * f16_17; + RHS17 += f16_17 * RHS16; + const double f16_20 = -f16 * m_A91; + m_A92 += m_A67 * f16_20; + m_A96 += m_A68 * f16_20; + RHS20 += f16_20 * RHS16; + const double f16_23 = -f16 * m_A112; + m_A113 += m_A67 * f16_23; + m_A118 += m_A68 * f16_23; + RHS23 += f16_23 * RHS16; + const double f17 = 1.0 / m_A71; + const double f17_20 = -f17 * m_A92; + m_A94 += m_A72 * f17_20; + m_A96 += m_A73 * f17_20; + RHS20 += f17_20 * RHS17; + const double f17_23 = -f17 * m_A113; + m_A115 += m_A72 * f17_23; + m_A118 += m_A73 * f17_23; + RHS23 += f17_23 * RHS17; + const double f18 = 1.0 / m_A75; + const double f18_20 = -f18 * m_A93; + m_A94 += m_A76 * f18_20; + m_A95 += m_A77 * f18_20; + RHS20 += f18_20 * RHS18; + const double f18_22 = -f18 * m_A106; + m_A107 += m_A76 * f18_22; + m_A108 += m_A77 * f18_22; + RHS22 += f18_22 * RHS18; + const double f19 = 1.0 / m_A85; + const double f19_21 = -f19 * m_A101; + m_A102 += m_A86 * f19_21; + m_A103 += m_A87 * f19_21; + RHS21 += f19_21 * RHS19; + const double f19_23 = -f19 * m_A114; + m_A116 += m_A86 * f19_23; + m_A118 += m_A87 * f19_23; + RHS23 += f19_23 * RHS19; + const double f20 = 1.0 / m_A94; + const double f20_22 = -f20 * m_A107; + m_A108 += m_A95 * f20_22; + m_A109 += m_A96 * f20_22; + RHS22 += f20_22 * RHS20; + const double f20_23 = -f20 * m_A115; + m_A117 += m_A95 * f20_23; + m_A118 += m_A96 * f20_23; + RHS23 += f20_23 * RHS20; + const double f21 = 1.0 / m_A102; + const double f21_23 = -f21 * m_A116; + m_A118 += m_A103 * f21_23; + RHS23 += f21_23 * RHS21; + const double f22 = 1.0 / m_A108; + const double f22_23 = -f22 * m_A117; + m_A118 += m_A109 * f22_23; + RHS23 += f22_23 * RHS22; + V[23] = RHS23 / m_A118; + double tmp22 = 0.0; + tmp22 += m_A109 * V[23]; + V[22] = (RHS22 - tmp22) / m_A108; + double tmp21 = 0.0; + tmp21 += m_A103 * V[23]; + V[21] = (RHS21 - tmp21) / m_A102; + double tmp20 = 0.0; + tmp20 += m_A95 * V[22]; + tmp20 += m_A96 * V[23]; + V[20] = (RHS20 - tmp20) / m_A94; + double tmp19 = 0.0; + tmp19 += m_A86 * V[21]; + tmp19 += m_A87 * V[23]; + V[19] = (RHS19 - tmp19) / m_A85; + double tmp18 = 0.0; + tmp18 += m_A76 * V[20]; + tmp18 += m_A77 * V[22]; + V[18] = (RHS18 - tmp18) / m_A75; + double tmp17 = 0.0; + tmp17 += m_A72 * V[20]; + tmp17 += m_A73 * V[23]; + V[17] = (RHS17 - tmp17) / m_A71; + double tmp16 = 0.0; + tmp16 += m_A67 * V[17]; + tmp16 += m_A68 * V[23]; + V[16] = (RHS16 - tmp16) / m_A66; + double tmp15 = 0.0; + tmp15 += m_A62 * V[16]; + V[15] = (RHS15 - tmp15) / m_A61; + double tmp14 = 0.0; + tmp14 += m_A58 * V[19]; + tmp14 += m_A59 * V[21]; + V[14] = (RHS14 - tmp14) / m_A57; + double tmp13 = 0.0; + tmp13 += m_A52 * V[14]; + tmp13 += m_A53 * V[19]; + tmp13 += m_A54 * V[21]; + V[13] = (RHS13 - tmp13) / m_A51; + double tmp12 = 0.0; + tmp12 += m_A44 * V[13]; + tmp12 += m_A45 * V[19]; + V[12] = (RHS12 - tmp12) / m_A43; + double tmp11 = 0.0; + tmp11 += m_A38 * V[12]; + tmp11 += m_A39 * V[13]; + tmp11 += m_A40 * V[19]; + V[11] = (RHS11 - tmp11) / m_A37; + double tmp10 = 0.0; + tmp10 += m_A32 * V[18]; + tmp10 += m_A33 * V[20]; + tmp10 += m_A34 * V[22]; + V[10] = (RHS10 - tmp10) / m_A31; + double tmp9 = 0.0; + tmp9 += m_A30 * V[18]; + V[9] = (RHS9 - tmp9) / m_A29; + double tmp8 = 0.0; + tmp8 += m_A26 * V[16]; + tmp8 += m_A27 * V[17]; + tmp8 += m_A28 * V[23]; + V[8] = (RHS8 - tmp8) / m_A25; + double tmp7 = 0.0; + tmp7 += m_A23 * V[8]; + tmp7 += m_A24 * V[17]; + V[7] = (RHS7 - tmp7) / m_A22; + double tmp6 = 0.0; + tmp6 += m_A20 * V[15]; + tmp6 += m_A21 * V[16]; + V[6] = (RHS6 - tmp6) / m_A19; + double tmp5 = 0.0; + tmp5 += m_A16 * V[19]; + tmp5 += m_A17 * V[21]; + tmp5 += m_A18 * V[23]; + V[5] = (RHS5 - tmp5) / m_A15; + double tmp4 = 0.0; + tmp4 += m_A12 * V[13]; + tmp4 += m_A13 * V[14]; + tmp4 += m_A14 * V[21]; + V[4] = (RHS4 - tmp4) / m_A11; + double tmp3 = 0.0; + tmp3 += m_A8 * V[11]; + tmp3 += m_A9 * V[12]; + tmp3 += m_A10 * V[19]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[12]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A4 * V[13]; + V[1] = (RHS1 - tmp1) / m_A3; + double tmp0 = 0.0; + tmp0 += m_A1 * V[11]; + tmp0 += m_A2 * V[13]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // 280zzzap static void nl_gcr_ab9144d965a37e4_113_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -44954,6 +50133,633 @@ static void nl_gcr_b22769fbf3159a8d_21_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_b66df357763b1dce_97_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A2 += gt[7]; + m_A5 += go[3]; + m_A4 += go[4]; + m_A3 += go[5]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 -= go[6] * *cnV[6]; + RHS1 -= go[7] * *cnV[7]; + m_A6 += gt[8]; + m_A6 += gt[9]; + m_A6 += gt[10]; + m_A7 += go[8]; + double RHS2 = Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + m_A8 += gt[11]; + m_A8 += gt[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A8 += gt[15]; + m_A8 += gt[16]; + m_A9 += go[11]; + m_A10 += go[12]; + m_A12 += go[13]; + m_A11 += go[14]; + double RHS3 = Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + RHS3 += Idr[14]; + RHS3 += Idr[15]; + RHS3 += Idr[16]; + RHS3 -= go[15] * *cnV[15]; + RHS3 -= go[16] * *cnV[16]; + m_A13 += gt[17]; + m_A13 += gt[18]; + m_A13 += gt[19]; + m_A14 += go[17]; + double RHS4 = Idr[17]; + RHS4 += Idr[18]; + RHS4 += Idr[19]; + RHS4 -= go[18] * *cnV[18]; + RHS4 -= go[19] * *cnV[19]; + m_A15 += gt[20]; + m_A15 += gt[21]; + m_A15 += gt[22]; + m_A15 += gt[23]; + m_A16 += go[20]; + double RHS5 = Idr[20]; + RHS5 += Idr[21]; + RHS5 += Idr[22]; + RHS5 += Idr[23]; + RHS5 -= go[21] * *cnV[21]; + RHS5 -= go[22] * *cnV[22]; + RHS5 -= go[23] * *cnV[23]; + m_A17 += gt[24]; + m_A17 += gt[25]; + m_A17 += gt[26]; + m_A17 += gt[27]; + m_A17 += gt[28]; + m_A17 += gt[29]; + m_A18 += go[24]; + m_A21 += go[25]; + m_A20 += go[26]; + m_A19 += go[27]; + double RHS6 = Idr[24]; + RHS6 += Idr[25]; + RHS6 += Idr[26]; + RHS6 += Idr[27]; + RHS6 += Idr[28]; + RHS6 += Idr[29]; + RHS6 -= go[28] * *cnV[28]; + RHS6 -= go[29] * *cnV[29]; + m_A22 += gt[30]; + m_A22 += gt[31]; + m_A22 += gt[32]; + m_A22 += gt[33]; + m_A22 += gt[34]; + m_A22 += gt[35]; + m_A22 += gt[36]; + m_A24 += go[30]; + m_A23 += go[31]; + double RHS7 = Idr[30]; + RHS7 += Idr[31]; + RHS7 += Idr[32]; + RHS7 += Idr[33]; + RHS7 += Idr[34]; + RHS7 += Idr[35]; + RHS7 += Idr[36]; + RHS7 -= go[32] * *cnV[32]; + RHS7 -= go[33] * *cnV[33]; + RHS7 -= go[34] * *cnV[34]; + RHS7 -= go[35] * *cnV[35]; + RHS7 -= go[36] * *cnV[36]; + m_A25 += gt[37]; + m_A25 += gt[38]; + m_A26 += go[37]; + m_A27 += go[38]; + double RHS8 = Idr[37]; + RHS8 += Idr[38]; + m_A30 += gt[39]; + m_A30 += gt[40]; + m_A30 += gt[41]; + m_A29 += go[39]; + m_A28 += go[40]; + double RHS9 = Idr[39]; + RHS9 += Idr[40]; + RHS9 += Idr[41]; + RHS9 -= go[41] * *cnV[41]; + m_A34 += gt[42]; + m_A34 += gt[43]; + m_A34 += gt[44]; + m_A34 += gt[45]; + m_A34 += gt[46]; + m_A34 += gt[47]; + m_A34 += gt[48]; + m_A35 += go[42]; + m_A33 += go[43]; + double RHS10 = Idr[42]; + RHS10 += Idr[43]; + RHS10 += Idr[44]; + RHS10 += Idr[45]; + RHS10 += Idr[46]; + RHS10 += Idr[47]; + RHS10 += Idr[48]; + RHS10 -= go[44] * *cnV[44]; + RHS10 -= go[45] * *cnV[45]; + RHS10 -= go[46] * *cnV[46]; + RHS10 -= go[47] * *cnV[47]; + RHS10 -= go[48] * *cnV[48]; + m_A37 += gt[49]; + m_A37 += gt[50]; + m_A37 += gt[51]; + m_A37 += gt[52]; + m_A37 += gt[53]; + m_A37 += gt[54]; + m_A37 += gt[55]; + m_A38 += go[49]; + m_A36 += go[50]; + double RHS11 = Idr[49]; + RHS11 += Idr[50]; + RHS11 += Idr[51]; + RHS11 += Idr[52]; + RHS11 += Idr[53]; + RHS11 += Idr[54]; + RHS11 += Idr[55]; + RHS11 -= go[51] * *cnV[51]; + RHS11 -= go[52] * *cnV[52]; + RHS11 -= go[53] * *cnV[53]; + RHS11 -= go[54] * *cnV[54]; + RHS11 -= go[55] * *cnV[55]; + m_A44 += gt[56]; + m_A44 += gt[57]; + m_A44 += gt[58]; + m_A41 += go[56]; + m_A40 += go[57]; + m_A39 += go[58]; + double RHS12 = Idr[56]; + RHS12 += Idr[57]; + RHS12 += Idr[58]; + m_A54 += gt[59]; + m_A54 += gt[60]; + m_A54 += gt[61]; + m_A56 += go[59]; + m_A50 += go[60]; + m_A49 += go[61]; + double RHS13 = Idr[59]; + RHS13 += Idr[60]; + RHS13 += Idr[61]; + m_A59 += gt[62]; + m_A59 += gt[63]; + m_A59 += gt[64]; + m_A58 += go[62]; + m_A60 += go[63]; + double RHS14 = Idr[62]; + RHS14 += Idr[63]; + RHS14 += Idr[64]; + RHS14 -= go[64] * *cnV[64]; + m_A65 += gt[65]; + m_A65 += gt[66]; + m_A65 += gt[67]; + m_A67 += go[65]; + m_A61 += go[66]; + double RHS15 = Idr[65]; + RHS15 += Idr[66]; + RHS15 += Idr[67]; + RHS15 -= go[67] * *cnV[67]; + m_A69 += gt[68]; + m_A69 += gt[69]; + m_A69 += gt[70]; + m_A68 += go[68]; + double RHS16 = Idr[68]; + RHS16 += Idr[69]; + RHS16 += Idr[70]; + RHS16 -= go[69] * *cnV[69]; + RHS16 -= go[70] * *cnV[70]; + m_A79 += gt[71]; + m_A79 += gt[72]; + m_A79 += gt[73]; + m_A79 += gt[74]; + m_A79 += gt[75]; + m_A72 += go[71]; + m_A73 += go[72]; + m_A77 += go[73]; + m_A71 += go[74]; + double RHS17 = Idr[71]; + RHS17 += Idr[72]; + RHS17 += Idr[73]; + RHS17 += Idr[74]; + RHS17 += Idr[75]; + RHS17 -= go[75] * *cnV[75]; + m_A86 += gt[76]; + m_A86 += gt[77]; + m_A86 += gt[78]; + m_A86 += gt[79]; + m_A86 += gt[80]; + m_A81 += go[76]; + m_A82 += go[77]; + m_A87 += go[78]; + double RHS18 = Idr[76]; + RHS18 += Idr[77]; + RHS18 += Idr[78]; + RHS18 += Idr[79]; + RHS18 += Idr[80]; + RHS18 -= go[79] * *cnV[79]; + RHS18 -= go[80] * *cnV[80]; + m_A96 += gt[81]; + m_A96 += gt[82]; + m_A96 += gt[83]; + m_A96 += gt[84]; + m_A95 += go[81]; + m_A92 += go[82]; + m_A93 += go[83]; + m_A88 += go[84]; + double RHS19 = Idr[81]; + RHS19 += Idr[82]; + RHS19 += Idr[83]; + RHS19 += Idr[84]; + const double f0 = 1.0 / m_A0; + const double f0_9 = -f0 * m_A28; + m_A30 += m_A1 * f0_9; + RHS9 += f0_9 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_9 = -f1 * m_A29; + m_A30 += m_A3 * f1_9; + m_A31 += m_A4 * f1_9; + m_A32 += m_A5 * f1_9; + RHS9 += f1_9 * RHS1; + const double f1_13 = -f1 * m_A49; + m_A51 += m_A3 * f1_13; + m_A54 += m_A4 * f1_13; + m_A56 += m_A5 * f1_13; + RHS13 += f1_13 * RHS1; + const double f1_17 = -f1 * m_A71; + m_A74 += m_A3 * f1_17; + m_A77 += m_A4 * f1_17; + m_A79 += m_A5 * f1_17; + RHS17 += f1_17 * RHS1; + const double f2 = 1.0 / m_A6; + const double f2_11 = -f2 * m_A36; + m_A38 += m_A7 * f2_11; + RHS11 += f2_11 * RHS2; + const double f2_17 = -f2 * m_A72; + m_A79 += m_A7 * f2_17; + RHS17 += f2_17 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_12 = -f3 * m_A39; + m_A43 += m_A9 * f3_12; + m_A44 += m_A10 * f3_12; + m_A45 += m_A11 * f3_12; + m_A47 += m_A12 * f3_12; + RHS12 += f3_12 * RHS3; + const double f3_13 = -f3 * m_A50; + m_A52 += m_A9 * f3_13; + m_A53 += m_A10 * f3_13; + m_A54 += m_A11 * f3_13; + m_A56 += m_A12 * f3_13; + RHS13 += f3_13 * RHS3; + const double f3_17 = -f3 * m_A73; + m_A75 += m_A9 * f3_17; + m_A76 += m_A10 * f3_17; + m_A77 += m_A11 * f3_17; + m_A79 += m_A12 * f3_17; + RHS17 += f3_17 * RHS3; + const double f4 = 1.0 / m_A13; + const double f4_10 = -f4 * m_A33; + m_A35 += m_A14 * f4_10; + RHS10 += f4_10 * RHS4; + const double f4_12 = -f4 * m_A40; + m_A44 += m_A14 * f4_12; + RHS12 += f4_12 * RHS4; + const double f5 = 1.0 / m_A15; + const double f5_14 = -f5 * m_A58; + m_A59 += m_A16 * f5_14; + RHS14 += f5_14 * RHS5; + const double f6 = 1.0 / m_A17; + const double f6_12 = -f6 * m_A41; + m_A42 += m_A18 * f6_12; + m_A44 += m_A19 * f6_12; + m_A46 += m_A20 * f6_12; + m_A48 += m_A21 * f6_12; + RHS12 += f6_12 * RHS6; + const double f6_15 = -f6 * m_A61; + m_A62 += m_A18 * f6_15; + m_A63 += m_A19 * f6_15; + m_A65 += m_A20 * f6_15; + m_A67 += m_A21 * f6_15; + RHS15 += f6_15 * RHS6; + const double f6_19 = -f6 * m_A88; + m_A89 += m_A18 * f6_19; + m_A90 += m_A19 * f6_19; + m_A93 += m_A20 * f6_19; + m_A96 += m_A21 * f6_19; + RHS19 += f6_19 * RHS6; + const double f7 = 1.0 / m_A22; + const double f7_18 = -f7 * m_A81; + m_A83 += m_A23 * f7_18; + m_A87 += m_A24 * f7_18; + RHS18 += f7_18 * RHS7; + const double f8 = 1.0 / m_A25; + const double f8_16 = -f8 * m_A68; + m_A69 += m_A26 * f8_16; + m_A70 += m_A27 * f8_16; + RHS16 += f8_16 * RHS8; + const double f8_18 = -f8 * m_A82; + m_A84 += m_A26 * f8_18; + m_A86 += m_A27 * f8_18; + RHS18 += f8_18 * RHS8; + const double f9 = 1.0 / m_A30; + const double f9_13 = -f9 * m_A51; + m_A54 += m_A31 * f9_13; + m_A56 += m_A32 * f9_13; + RHS13 += f9_13 * RHS9; + const double f9_17 = -f9 * m_A74; + m_A77 += m_A31 * f9_17; + m_A79 += m_A32 * f9_17; + RHS17 += f9_17 * RHS9; + const double f10 = 1.0 / m_A34; + const double f10_12 = -f10 * m_A42; + m_A44 += m_A35 * f10_12; + RHS12 += f10_12 * RHS10; + const double f10_15 = -f10 * m_A62; + m_A63 += m_A35 * f10_15; + RHS15 += f10_15 * RHS10; + const double f10_19 = -f10 * m_A89; + m_A90 += m_A35 * f10_19; + RHS19 += f10_19 * RHS10; + const double f11 = 1.0 / m_A37; + const double f11_12 = -f11 * m_A43; + m_A47 += m_A38 * f11_12; + RHS12 += f11_12 * RHS11; + const double f11_13 = -f11 * m_A52; + m_A56 += m_A38 * f11_13; + RHS13 += f11_13 * RHS11; + const double f11_17 = -f11 * m_A75; + m_A79 += m_A38 * f11_17; + RHS17 += f11_17 * RHS11; + const double f12 = 1.0 / m_A44; + const double f12_13 = -f12 * m_A53; + m_A54 += m_A45 * f12_13; + m_A55 += m_A46 * f12_13; + m_A56 += m_A47 * f12_13; + m_A57 += m_A48 * f12_13; + RHS13 += f12_13 * RHS12; + const double f12_15 = -f12 * m_A63; + m_A64 += m_A45 * f12_15; + m_A65 += m_A46 * f12_15; + m_A66 += m_A47 * f12_15; + m_A67 += m_A48 * f12_15; + RHS15 += f12_15 * RHS12; + const double f12_17 = -f12 * m_A76; + m_A77 += m_A45 * f12_17; + m_A78 += m_A46 * f12_17; + m_A79 += m_A47 * f12_17; + m_A80 += m_A48 * f12_17; + RHS17 += f12_17 * RHS12; + const double f12_19 = -f12 * m_A90; + m_A91 += m_A45 * f12_19; + m_A93 += m_A46 * f12_19; + m_A94 += m_A47 * f12_19; + m_A96 += m_A48 * f12_19; + RHS19 += f12_19 * RHS12; + const double f13 = 1.0 / m_A54; + const double f13_15 = -f13 * m_A64; + m_A65 += m_A55 * f13_15; + m_A66 += m_A56 * f13_15; + m_A67 += m_A57 * f13_15; + RHS15 += f13_15 * RHS13; + const double f13_17 = -f13 * m_A77; + m_A78 += m_A55 * f13_17; + m_A79 += m_A56 * f13_17; + m_A80 += m_A57 * f13_17; + RHS17 += f13_17 * RHS13; + const double f13_19 = -f13 * m_A91; + m_A93 += m_A55 * f13_19; + m_A94 += m_A56 * f13_19; + m_A96 += m_A57 * f13_19; + RHS19 += f13_19 * RHS13; + const double f14 = 1.0 / m_A59; + const double f14_19 = -f14 * m_A92; + m_A96 += m_A60 * f14_19; + RHS19 += f14_19 * RHS14; + const double f15 = 1.0 / m_A65; + const double f15_17 = -f15 * m_A78; + m_A79 += m_A66 * f15_17; + m_A80 += m_A67 * f15_17; + RHS17 += f15_17 * RHS15; + const double f15_18 = -f15 * m_A83; + m_A85 += m_A66 * f15_18; + m_A87 += m_A67 * f15_18; + RHS18 += f15_18 * RHS15; + const double f15_19 = -f15 * m_A93; + m_A94 += m_A66 * f15_19; + m_A96 += m_A67 * f15_19; + RHS19 += f15_19 * RHS15; + const double f16 = 1.0 / m_A69; + const double f16_18 = -f16 * m_A84; + m_A86 += m_A70 * f16_18; + RHS18 += f16_18 * RHS16; + const double f17 = 1.0 / m_A79; + const double f17_18 = -f17 * m_A85; + m_A87 += m_A80 * f17_18; + RHS18 += f17_18 * RHS17; + const double f17_19 = -f17 * m_A94; + m_A96 += m_A80 * f17_19; + RHS19 += f17_19 * RHS17; + const double f18 = 1.0 / m_A86; + const double f18_19 = -f18 * m_A95; + m_A96 += m_A87 * f18_19; + RHS19 += f18_19 * RHS18; + V[19] = RHS19 / m_A96; + double tmp18 = 0.0; + tmp18 += m_A87 * V[19]; + V[18] = (RHS18 - tmp18) / m_A86; + double tmp17 = 0.0; + tmp17 += m_A80 * V[19]; + V[17] = (RHS17 - tmp17) / m_A79; + double tmp16 = 0.0; + tmp16 += m_A70 * V[18]; + V[16] = (RHS16 - tmp16) / m_A69; + double tmp15 = 0.0; + tmp15 += m_A66 * V[17]; + tmp15 += m_A67 * V[19]; + V[15] = (RHS15 - tmp15) / m_A65; + double tmp14 = 0.0; + tmp14 += m_A60 * V[19]; + V[14] = (RHS14 - tmp14) / m_A59; + double tmp13 = 0.0; + tmp13 += m_A55 * V[15]; + tmp13 += m_A56 * V[17]; + tmp13 += m_A57 * V[19]; + V[13] = (RHS13 - tmp13) / m_A54; + double tmp12 = 0.0; + tmp12 += m_A45 * V[13]; + tmp12 += m_A46 * V[15]; + tmp12 += m_A47 * V[17]; + tmp12 += m_A48 * V[19]; + V[12] = (RHS12 - tmp12) / m_A44; + double tmp11 = 0.0; + tmp11 += m_A38 * V[17]; + V[11] = (RHS11 - tmp11) / m_A37; + double tmp10 = 0.0; + tmp10 += m_A35 * V[12]; + V[10] = (RHS10 - tmp10) / m_A34; + double tmp9 = 0.0; + tmp9 += m_A31 * V[13]; + tmp9 += m_A32 * V[17]; + V[9] = (RHS9 - tmp9) / m_A30; + double tmp8 = 0.0; + tmp8 += m_A26 * V[16]; + tmp8 += m_A27 * V[18]; + V[8] = (RHS8 - tmp8) / m_A25; + double tmp7 = 0.0; + tmp7 += m_A23 * V[15]; + tmp7 += m_A24 * V[19]; + V[7] = (RHS7 - tmp7) / m_A22; + double tmp6 = 0.0; + tmp6 += m_A18 * V[10]; + tmp6 += m_A19 * V[12]; + tmp6 += m_A20 * V[15]; + tmp6 += m_A21 * V[19]; + V[6] = (RHS6 - tmp6) / m_A17; + double tmp5 = 0.0; + tmp5 += m_A16 * V[14]; + V[5] = (RHS5 - tmp5) / m_A15; + double tmp4 = 0.0; + tmp4 += m_A14 * V[12]; + V[4] = (RHS4 - tmp4) / m_A13; + double tmp3 = 0.0; + tmp3 += m_A9 * V[11]; + tmp3 += m_A10 * V[12]; + tmp3 += m_A11 * V[13]; + tmp3 += m_A12 * V[17]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A7 * V[17]; + V[2] = (RHS2 - tmp2) / m_A6; + double tmp1 = 0.0; + tmp1 += m_A3 * V[9]; + tmp1 += m_A4 * V[13]; + tmp1 += m_A5 * V[17]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[9]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // breakout static void nl_gcr_b66ff415b228d5f8_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -49110,6 +54916,907 @@ static void nl_gcr_bff07f8d339f7cc4_89_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_c05df522276e65fd_134_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + double m_A97(0.0); + double m_A98(0.0); + double m_A99(0.0); + double m_A100(0.0); + double m_A101(0.0); + double m_A102(0.0); + double m_A103(0.0); + double m_A104(0.0); + double m_A105(0.0); + double m_A106(0.0); + double m_A107(0.0); + double m_A108(0.0); + double m_A109(0.0); + double m_A110(0.0); + double m_A111(0.0); + double m_A112(0.0); + double m_A113(0.0); + double m_A114(0.0); + double m_A115(0.0); + double m_A116(0.0); + double m_A117(0.0); + double m_A118(0.0); + double m_A119(0.0); + double m_A120(0.0); + double m_A121(0.0); + double m_A122(0.0); + double m_A123(0.0); + double m_A124(0.0); + double m_A125(0.0); + double m_A126(0.0); + double m_A127(0.0); + double m_A128(0.0); + double m_A129(0.0); + double m_A130(0.0); + double m_A131(0.0); + double m_A132(0.0); + double m_A133(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A4 += go[3]; + m_A3 += go[4]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[5] * *cnV[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A5 += gt[8]; + m_A5 += gt[9]; + m_A5 += gt[10]; + m_A5 += gt[11]; + m_A5 += gt[12]; + m_A7 += go[6]; + m_A6 += go[7]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 += Idr[11]; + RHS2 += Idr[12]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + RHS2 -= go[11] * *cnV[11]; + RHS2 -= go[12] * *cnV[12]; + m_A8 += gt[13]; + m_A8 += gt[14]; + m_A8 += gt[15]; + m_A9 += go[13]; + double RHS3 = Idr[13]; + RHS3 += Idr[14]; + RHS3 += Idr[15]; + RHS3 -= go[14] * *cnV[14]; + RHS3 -= go[15] * *cnV[15]; + m_A10 += gt[16]; + m_A10 += gt[17]; + m_A10 += gt[18]; + m_A10 += gt[19]; + m_A11 += go[16]; + double RHS4 = Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + RHS4 += Idr[19]; + RHS4 -= go[17] * *cnV[17]; + RHS4 -= go[18] * *cnV[18]; + RHS4 -= go[19] * *cnV[19]; + m_A12 += gt[20]; + m_A12 += gt[21]; + m_A12 += gt[22]; + m_A12 += gt[23]; + m_A12 += gt[24]; + m_A12 += gt[25]; + m_A12 += gt[26]; + m_A14 += go[20]; + m_A13 += go[21]; + double RHS5 = Idr[20]; + RHS5 += Idr[21]; + RHS5 += Idr[22]; + RHS5 += Idr[23]; + RHS5 += Idr[24]; + RHS5 += Idr[25]; + RHS5 += Idr[26]; + RHS5 -= go[22] * *cnV[22]; + RHS5 -= go[23] * *cnV[23]; + RHS5 -= go[24] * *cnV[24]; + RHS5 -= go[25] * *cnV[25]; + RHS5 -= go[26] * *cnV[26]; + m_A15 += gt[27]; + m_A15 += gt[28]; + m_A15 += gt[29]; + m_A16 += go[27]; + m_A17 += go[28]; + double RHS6 = Idr[27]; + RHS6 += Idr[28]; + RHS6 += Idr[29]; + RHS6 -= go[29] * *cnV[29]; + m_A18 += gt[30]; + m_A18 += gt[31]; + m_A18 += gt[32]; + m_A18 += gt[33]; + m_A19 += go[30]; + double RHS7 = Idr[30]; + RHS7 += Idr[31]; + RHS7 += Idr[32]; + RHS7 += Idr[33]; + RHS7 -= go[31] * *cnV[31]; + RHS7 -= go[32] * *cnV[32]; + RHS7 -= go[33] * *cnV[33]; + m_A20 += gt[34]; + m_A20 += gt[35]; + m_A20 += gt[36]; + m_A21 += go[34]; + m_A22 += go[35]; + double RHS8 = Idr[34]; + RHS8 += Idr[35]; + RHS8 += Idr[36]; + RHS8 -= go[36] * *cnV[36]; + m_A23 += gt[37]; + m_A23 += gt[38]; + m_A23 += gt[39]; + m_A23 += gt[40]; + m_A23 += gt[41]; + m_A24 += go[37]; + m_A25 += go[38]; + m_A26 += go[39]; + double RHS9 = Idr[37]; + RHS9 += Idr[38]; + RHS9 += Idr[39]; + RHS9 += Idr[40]; + RHS9 += Idr[41]; + RHS9 -= go[40] * *cnV[40]; + RHS9 -= go[41] * *cnV[41]; + m_A27 += gt[42]; + m_A27 += gt[43]; + m_A27 += gt[44]; + m_A28 += go[42]; + double RHS10 = Idr[42]; + RHS10 += Idr[43]; + RHS10 += Idr[44]; + RHS10 -= go[43] * *cnV[43]; + RHS10 -= go[44] * *cnV[44]; + m_A29 += gt[45]; + m_A29 += gt[46]; + m_A30 += go[45]; + double RHS11 = Idr[45]; + RHS11 += Idr[46]; + RHS11 -= go[46] * *cnV[46]; + m_A31 += gt[47]; + m_A31 += gt[48]; + m_A32 += go[47]; + double RHS12 = Idr[47]; + RHS12 += Idr[48]; + RHS12 -= go[48] * *cnV[48]; + m_A33 += gt[49]; + m_A33 += gt[50]; + m_A33 += gt[51]; + m_A34 += go[49]; + m_A35 += go[50]; + double RHS13 = Idr[49]; + RHS13 += Idr[50]; + RHS13 += Idr[51]; + RHS13 -= go[51] * *cnV[51]; + m_A36 += gt[52]; + m_A36 += gt[53]; + m_A36 += gt[54]; + m_A36 += gt[55]; + m_A36 += gt[56]; + m_A36 += gt[57]; + m_A37 += go[52]; + m_A39 += go[53]; + m_A39 += go[54]; + m_A38 += go[55]; + double RHS14 = Idr[52]; + RHS14 += Idr[53]; + RHS14 += Idr[54]; + RHS14 += Idr[55]; + RHS14 += Idr[56]; + RHS14 += Idr[57]; + RHS14 -= go[56] * *cnV[56]; + RHS14 -= go[57] * *cnV[57]; + m_A40 += gt[58]; + m_A40 += gt[59]; + m_A40 += gt[60]; + m_A40 += gt[61]; + m_A41 += go[58]; + double RHS15 = Idr[58]; + RHS15 += Idr[59]; + RHS15 += Idr[60]; + RHS15 += Idr[61]; + RHS15 -= go[59] * *cnV[59]; + RHS15 -= go[60] * *cnV[60]; + RHS15 -= go[61] * *cnV[61]; + m_A44 += gt[62]; + m_A44 += gt[63]; + m_A43 += go[62]; + m_A42 += go[63]; + double RHS16 = Idr[62]; + RHS16 += Idr[63]; + m_A48 += gt[64]; + m_A48 += gt[65]; + m_A48 += gt[66]; + m_A49 += go[64]; + m_A46 += go[65]; + double RHS17 = Idr[64]; + RHS17 += Idr[65]; + RHS17 += Idr[66]; + RHS17 -= go[66] * *cnV[66]; + m_A51 += gt[67]; + m_A51 += gt[68]; + m_A51 += gt[69]; + m_A51 += gt[70]; + m_A51 += gt[71]; + m_A51 += gt[72]; + m_A51 += gt[73]; + m_A52 += go[67]; + m_A50 += go[68]; + double RHS18 = Idr[67]; + RHS18 += Idr[68]; + RHS18 += Idr[69]; + RHS18 += Idr[70]; + RHS18 += Idr[71]; + RHS18 += Idr[72]; + RHS18 += Idr[73]; + RHS18 -= go[69] * *cnV[69]; + RHS18 -= go[70] * *cnV[70]; + RHS18 -= go[71] * *cnV[71]; + RHS18 -= go[72] * *cnV[72]; + RHS18 -= go[73] * *cnV[73]; + m_A54 += gt[74]; + m_A54 += gt[75]; + m_A54 += gt[76]; + m_A53 += go[74]; + m_A55 += go[75]; + double RHS19 = Idr[74]; + RHS19 += Idr[75]; + RHS19 += Idr[76]; + RHS19 -= go[76] * *cnV[76]; + m_A57 += gt[77]; + m_A57 += gt[78]; + m_A57 += gt[79]; + m_A56 += go[77]; + m_A58 += go[78]; + double RHS20 = Idr[77]; + RHS20 += Idr[78]; + RHS20 += Idr[79]; + RHS20 -= go[79] * *cnV[79]; + m_A61 += gt[80]; + m_A61 += gt[81]; + m_A61 += gt[82]; + m_A61 += gt[83]; + m_A61 += gt[84]; + m_A59 += go[80]; + m_A62 += go[81]; + m_A63 += go[82]; + double RHS21 = Idr[80]; + RHS21 += Idr[81]; + RHS21 += Idr[82]; + RHS21 += Idr[83]; + RHS21 += Idr[84]; + RHS21 -= go[83] * *cnV[83]; + RHS21 -= go[84] * *cnV[84]; + m_A66 += gt[85]; + m_A66 += gt[86]; + m_A66 += gt[87]; + m_A66 += gt[88]; + m_A66 += gt[89]; + m_A66 += gt[90]; + m_A66 += gt[91]; + m_A67 += go[85]; + m_A65 += go[86]; + double RHS22 = Idr[85]; + RHS22 += Idr[86]; + RHS22 += Idr[87]; + RHS22 += Idr[88]; + RHS22 += Idr[89]; + RHS22 += Idr[90]; + RHS22 += Idr[91]; + RHS22 -= go[87] * *cnV[87]; + RHS22 -= go[88] * *cnV[88]; + RHS22 -= go[89] * *cnV[89]; + RHS22 -= go[90] * *cnV[90]; + RHS22 -= go[91] * *cnV[91]; + m_A70 += gt[92]; + m_A70 += gt[93]; + m_A70 += gt[94]; + m_A70 += gt[95]; + m_A70 += gt[96]; + m_A70 += gt[97]; + m_A70 += gt[98]; + m_A71 += go[92]; + m_A69 += go[93]; + double RHS23 = Idr[92]; + RHS23 += Idr[93]; + RHS23 += Idr[94]; + RHS23 += Idr[95]; + RHS23 += Idr[96]; + RHS23 += Idr[97]; + RHS23 += Idr[98]; + RHS23 -= go[94] * *cnV[94]; + RHS23 -= go[95] * *cnV[95]; + RHS23 -= go[96] * *cnV[96]; + RHS23 -= go[97] * *cnV[97]; + RHS23 -= go[98] * *cnV[98]; + m_A77 += gt[99]; + m_A77 += gt[100]; + m_A77 += gt[101]; + m_A77 += gt[102]; + m_A77 += gt[103]; + m_A74 += go[99]; + m_A73 += go[100]; + m_A75 += go[101]; + double RHS24 = Idr[99]; + RHS24 += Idr[100]; + RHS24 += Idr[101]; + RHS24 += Idr[102]; + RHS24 += Idr[103]; + RHS24 -= go[102] * *cnV[102]; + RHS24 -= go[103] * *cnV[103]; + m_A81 += gt[104]; + m_A81 += gt[105]; + m_A81 += gt[106]; + m_A83 += go[104]; + m_A80 += go[105]; + m_A82 += go[106]; + double RHS25 = Idr[104]; + RHS25 += Idr[105]; + RHS25 += Idr[106]; + m_A88 += gt[107]; + m_A88 += gt[108]; + m_A88 += gt[109]; + m_A88 += gt[110]; + m_A88 += gt[111]; + m_A85 += go[107]; + m_A85 += go[108]; + m_A89 += go[109]; + m_A84 += go[110]; + m_A90 += go[111]; + double RHS26 = Idr[107]; + RHS26 += Idr[108]; + RHS26 += Idr[109]; + RHS26 += Idr[110]; + RHS26 += Idr[111]; + m_A95 += gt[112]; + m_A95 += gt[113]; + m_A95 += gt[114]; + m_A92 += go[112]; + m_A91 += go[113]; + m_A93 += go[114]; + double RHS27 = Idr[112]; + RHS27 += Idr[113]; + RHS27 += Idr[114]; + m_A104 += gt[115]; + m_A104 += gt[116]; + m_A104 += gt[117]; + m_A104 += gt[118]; + m_A100 += go[115]; + m_A101 += go[116]; + m_A99 += go[117]; + m_A106 += go[118]; + double RHS28 = Idr[115]; + RHS28 += Idr[116]; + RHS28 += Idr[117]; + RHS28 += Idr[118]; + m_A112 += gt[119]; + m_A112 += gt[120]; + m_A112 += gt[121]; + m_A112 += gt[122]; + m_A109 += go[119]; + m_A108 += go[120]; + m_A107 += go[121]; + m_A113 += go[122]; + double RHS29 = Idr[119]; + RHS29 += Idr[120]; + RHS29 += Idr[121]; + RHS29 += Idr[122]; + m_A117 += gt[123]; + m_A117 += gt[124]; + m_A117 += gt[125]; + m_A117 += gt[126]; + m_A117 += gt[127]; + m_A114 += go[123]; + m_A116 += go[124]; + m_A115 += go[125]; + double RHS30 = Idr[123]; + RHS30 += Idr[124]; + RHS30 += Idr[125]; + RHS30 += Idr[126]; + RHS30 += Idr[127]; + RHS30 -= go[126] * *cnV[126]; + RHS30 -= go[127] * *cnV[127]; + m_A121 += gt[128]; + m_A121 += gt[129]; + m_A121 += gt[130]; + m_A119 += go[128]; + m_A120 += go[129]; + double RHS31 = Idr[128]; + RHS31 += Idr[129]; + RHS31 += Idr[130]; + RHS31 -= go[130] * *cnV[130]; + m_A133 += gt[131]; + m_A133 += gt[132]; + m_A133 += gt[133]; + m_A133 += gt[134]; + m_A133 += gt[135]; + m_A133 += gt[136]; + m_A133 += gt[137]; + m_A133 += gt[138]; + m_A133 += gt[139]; + m_A133 += gt[140]; + m_A126 += go[131]; + m_A128 += go[132]; + m_A125 += go[133]; + m_A129 += go[134]; + m_A124 += go[135]; + m_A130 += go[136]; + m_A123 += go[137]; + m_A127 += go[138]; + double RHS32 = Idr[131]; + RHS32 += Idr[132]; + RHS32 += Idr[133]; + RHS32 += Idr[134]; + RHS32 += Idr[135]; + RHS32 += Idr[136]; + RHS32 += Idr[137]; + RHS32 += Idr[138]; + RHS32 += Idr[139]; + RHS32 += Idr[140]; + RHS32 -= go[139] * *cnV[139]; + RHS32 -= go[140] * *cnV[140]; + const double f0 = 1.0 / m_A0; + const double f0_16 = -f0 * m_A42; + m_A44 += m_A1 * f0_16; + RHS16 += f0_16 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_16 = -f1 * m_A43; + m_A44 += m_A3 * f1_16; + m_A45 += m_A4 * f1_16; + RHS16 += f1_16 * RHS1; + const double f1_17 = -f1 * m_A46; + m_A47 += m_A3 * f1_17; + m_A48 += m_A4 * f1_17; + RHS17 += f1_17 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_30 = -f2 * m_A114; + m_A115 += m_A6 * f2_30; + m_A117 += m_A7 * f2_30; + RHS30 += f2_30 * RHS2; + const double f3 = 1.0 / m_A8; + const double f3_18 = -f3 * m_A50; + m_A52 += m_A9 * f3_18; + RHS18 += f3_18 * RHS3; + const double f3_25 = -f3 * m_A80; + m_A81 += m_A9 * f3_25; + RHS25 += f3_25 * RHS3; + const double f4 = 1.0 / m_A10; + const double f4_19 = -f4 * m_A53; + m_A54 += m_A11 * f4_19; + RHS19 += f4_19 * RHS4; + const double f5 = 1.0 / m_A12; + const double f5_21 = -f5 * m_A59; + m_A60 += m_A13 * f5_21; + m_A63 += m_A14 * f5_21; + RHS21 += f5_21 * RHS5; + const double f6 = 1.0 / m_A15; + const double f6_21 = -f6 * m_A60; + m_A63 += m_A16 * f6_21; + m_A64 += m_A17 * f6_21; + RHS21 += f6_21 * RHS6; + const double f6_29 = -f6 * m_A107; + m_A112 += m_A16 * f6_29; + m_A113 += m_A17 * f6_29; + RHS29 += f6_29 * RHS6; + const double f6_32 = -f6 * m_A123; + m_A130 += m_A16 * f6_32; + m_A133 += m_A17 * f6_32; + RHS32 += f6_32 * RHS6; + const double f7 = 1.0 / m_A18; + const double f7_20 = -f7 * m_A56; + m_A57 += m_A19 * f7_20; + RHS20 += f7_20 * RHS7; + const double f8 = 1.0 / m_A20; + const double f8_22 = -f8 * m_A65; + m_A67 += m_A21 * f8_22; + m_A68 += m_A22 * f8_22; + RHS22 += f8_22 * RHS8; + const double f8_28 = -f8 * m_A99; + m_A104 += m_A21 * f8_28; + m_A106 += m_A22 * f8_28; + RHS28 += f8_28 * RHS8; + const double f8_32 = -f8 * m_A124; + m_A129 += m_A21 * f8_32; + m_A133 += m_A22 * f8_32; + RHS32 += f8_32 * RHS8; + const double f9 = 1.0 / m_A23; + const double f9_27 = -f9 * m_A91; + m_A94 += m_A24 * f9_27; + m_A95 += m_A25 * f9_27; + m_A96 += m_A26 * f9_27; + RHS27 += f9_27 * RHS9; + const double f9_28 = -f9 * m_A100; + m_A102 += m_A24 * f9_28; + m_A103 += m_A25 * f9_28; + m_A104 += m_A26 * f9_28; + RHS28 += f9_28 * RHS9; + const double f10 = 1.0 / m_A27; + const double f10_27 = -f10 * m_A92; + m_A95 += m_A28 * f10_27; + RHS27 += f10_27 * RHS10; + const double f11 = 1.0 / m_A29; + const double f11_24 = -f11 * m_A73; + m_A77 += m_A30 * f11_24; + RHS24 += f11_24 * RHS11; + const double f12 = 1.0 / m_A31; + const double f12_24 = -f12 * m_A74; + m_A77 += m_A32 * f12_24; + RHS24 += f12_24 * RHS12; + const double f13 = 1.0 / m_A33; + const double f13_23 = -f13 * m_A69; + m_A71 += m_A34 * f13_23; + m_A72 += m_A35 * f13_23; + RHS23 += f13_23 * RHS13; + const double f13_26 = -f13 * m_A84; + m_A88 += m_A34 * f13_26; + m_A90 += m_A35 * f13_26; + RHS26 += f13_26 * RHS13; + const double f13_32 = -f13 * m_A125; + m_A128 += m_A34 * f13_32; + m_A133 += m_A35 * f13_32; + RHS32 += f13_32 * RHS13; + const double f14 = 1.0 / m_A36; + const double f14_24 = -f14 * m_A75; + m_A76 += m_A37 * f14_24; + m_A77 += m_A38 * f14_24; + m_A78 += m_A39 * f14_24; + RHS24 += f14_24 * RHS14; + const double f14_26 = -f14 * m_A85; + m_A86 += m_A37 * f14_26; + m_A87 += m_A38 * f14_26; + m_A88 += m_A39 * f14_26; + RHS26 += f14_26 * RHS14; + const double f15 = 1.0 / m_A40; + const double f15_31 = -f15 * m_A119; + m_A121 += m_A41 * f15_31; + RHS31 += f15_31 * RHS15; + const double f16 = 1.0 / m_A44; + const double f16_17 = -f16 * m_A47; + m_A48 += m_A45 * f16_17; + RHS17 += f16_17 * RHS16; + const double f17 = 1.0 / m_A48; + const double f17_30 = -f17 * m_A115; + m_A117 += m_A49 * f17_30; + RHS30 += f17_30 * RHS17; + const double f18 = 1.0 / m_A51; + const double f18_32 = -f18 * m_A126; + m_A127 += m_A52 * f18_32; + RHS32 += f18_32 * RHS18; + const double f19 = 1.0 / m_A54; + const double f19_29 = -f19 * m_A108; + m_A112 += m_A55 * f19_29; + RHS29 += f19_29 * RHS19; + const double f20 = 1.0 / m_A57; + const double f20_28 = -f20 * m_A101; + m_A104 += m_A58 * f20_28; + RHS28 += f20_28 * RHS20; + const double f21 = 1.0 / m_A61; + const double f21_27 = -f21 * m_A93; + m_A95 += m_A62 * f21_27; + m_A97 += m_A63 * f21_27; + m_A98 += m_A64 * f21_27; + RHS27 += f21_27 * RHS21; + const double f21_29 = -f21 * m_A109; + m_A110 += m_A62 * f21_29; + m_A112 += m_A63 * f21_29; + m_A113 += m_A64 * f21_29; + RHS29 += f21_29 * RHS21; + const double f22 = 1.0 / m_A66; + const double f22_27 = -f22 * m_A94; + m_A96 += m_A67 * f22_27; + m_A98 += m_A68 * f22_27; + RHS27 += f22_27 * RHS22; + const double f22_28 = -f22 * m_A102; + m_A104 += m_A67 * f22_28; + m_A106 += m_A68 * f22_28; + RHS28 += f22_28 * RHS22; + const double f23 = 1.0 / m_A70; + const double f23_24 = -f23 * m_A76; + m_A78 += m_A71 * f23_24; + m_A79 += m_A72 * f23_24; + RHS24 += f23_24 * RHS23; + const double f23_26 = -f23 * m_A86; + m_A88 += m_A71 * f23_26; + m_A90 += m_A72 * f23_26; + RHS26 += f23_26 * RHS23; + const double f24 = 1.0 / m_A77; + const double f24_26 = -f24 * m_A87; + m_A88 += m_A78 * f24_26; + m_A90 += m_A79 * f24_26; + RHS26 += f24_26 * RHS24; + const double f25 = 1.0 / m_A81; + const double f25_30 = -f25 * m_A116; + m_A117 += m_A82 * f25_30; + m_A118 += m_A83 * f25_30; + RHS30 += f25_30 * RHS25; + const double f25_32 = -f25 * m_A127; + m_A131 += m_A82 * f25_32; + m_A133 += m_A83 * f25_32; + RHS32 += f25_32 * RHS25; + const double f26 = 1.0 / m_A88; + const double f26_31 = -f26 * m_A120; + m_A121 += m_A89 * f26_31; + m_A122 += m_A90 * f26_31; + RHS31 += f26_31 * RHS26; + const double f26_32 = -f26 * m_A128; + m_A132 += m_A89 * f26_32; + m_A133 += m_A90 * f26_32; + RHS32 += f26_32 * RHS26; + const double f27 = 1.0 / m_A95; + const double f27_28 = -f27 * m_A103; + m_A104 += m_A96 * f27_28; + m_A105 += m_A97 * f27_28; + m_A106 += m_A98 * f27_28; + RHS28 += f27_28 * RHS27; + const double f27_29 = -f27 * m_A110; + m_A111 += m_A96 * f27_29; + m_A112 += m_A97 * f27_29; + m_A113 += m_A98 * f27_29; + RHS29 += f27_29 * RHS27; + const double f28 = 1.0 / m_A104; + const double f28_29 = -f28 * m_A111; + m_A112 += m_A105 * f28_29; + m_A113 += m_A106 * f28_29; + RHS29 += f28_29 * RHS28; + const double f28_32 = -f28 * m_A129; + m_A130 += m_A105 * f28_32; + m_A133 += m_A106 * f28_32; + RHS32 += f28_32 * RHS28; + const double f29 = 1.0 / m_A112; + const double f29_32 = -f29 * m_A130; + m_A133 += m_A113 * f29_32; + RHS32 += f29_32 * RHS29; + const double f30 = 1.0 / m_A117; + const double f30_32 = -f30 * m_A131; + m_A133 += m_A118 * f30_32; + RHS32 += f30_32 * RHS30; + const double f31 = 1.0 / m_A121; + const double f31_32 = -f31 * m_A132; + m_A133 += m_A122 * f31_32; + RHS32 += f31_32 * RHS31; + V[32] = RHS32 / m_A133; + double tmp31 = 0.0; + tmp31 += m_A122 * V[32]; + V[31] = (RHS31 - tmp31) / m_A121; + double tmp30 = 0.0; + tmp30 += m_A118 * V[32]; + V[30] = (RHS30 - tmp30) / m_A117; + double tmp29 = 0.0; + tmp29 += m_A113 * V[32]; + V[29] = (RHS29 - tmp29) / m_A112; + double tmp28 = 0.0; + tmp28 += m_A105 * V[29]; + tmp28 += m_A106 * V[32]; + V[28] = (RHS28 - tmp28) / m_A104; + double tmp27 = 0.0; + tmp27 += m_A96 * V[28]; + tmp27 += m_A97 * V[29]; + tmp27 += m_A98 * V[32]; + V[27] = (RHS27 - tmp27) / m_A95; + double tmp26 = 0.0; + tmp26 += m_A89 * V[31]; + tmp26 += m_A90 * V[32]; + V[26] = (RHS26 - tmp26) / m_A88; + double tmp25 = 0.0; + tmp25 += m_A82 * V[30]; + tmp25 += m_A83 * V[32]; + V[25] = (RHS25 - tmp25) / m_A81; + double tmp24 = 0.0; + tmp24 += m_A78 * V[26]; + tmp24 += m_A79 * V[32]; + V[24] = (RHS24 - tmp24) / m_A77; + double tmp23 = 0.0; + tmp23 += m_A71 * V[26]; + tmp23 += m_A72 * V[32]; + V[23] = (RHS23 - tmp23) / m_A70; + double tmp22 = 0.0; + tmp22 += m_A67 * V[28]; + tmp22 += m_A68 * V[32]; + V[22] = (RHS22 - tmp22) / m_A66; + double tmp21 = 0.0; + tmp21 += m_A62 * V[27]; + tmp21 += m_A63 * V[29]; + tmp21 += m_A64 * V[32]; + V[21] = (RHS21 - tmp21) / m_A61; + double tmp20 = 0.0; + tmp20 += m_A58 * V[28]; + V[20] = (RHS20 - tmp20) / m_A57; + double tmp19 = 0.0; + tmp19 += m_A55 * V[29]; + V[19] = (RHS19 - tmp19) / m_A54; + double tmp18 = 0.0; + tmp18 += m_A52 * V[25]; + V[18] = (RHS18 - tmp18) / m_A51; + double tmp17 = 0.0; + tmp17 += m_A49 * V[30]; + V[17] = (RHS17 - tmp17) / m_A48; + double tmp16 = 0.0; + tmp16 += m_A45 * V[17]; + V[16] = (RHS16 - tmp16) / m_A44; + double tmp15 = 0.0; + tmp15 += m_A41 * V[31]; + V[15] = (RHS15 - tmp15) / m_A40; + double tmp14 = 0.0; + tmp14 += m_A37 * V[23]; + tmp14 += m_A38 * V[24]; + tmp14 += m_A39 * V[26]; + V[14] = (RHS14 - tmp14) / m_A36; + double tmp13 = 0.0; + tmp13 += m_A34 * V[26]; + tmp13 += m_A35 * V[32]; + V[13] = (RHS13 - tmp13) / m_A33; + double tmp12 = 0.0; + tmp12 += m_A32 * V[24]; + V[12] = (RHS12 - tmp12) / m_A31; + double tmp11 = 0.0; + tmp11 += m_A30 * V[24]; + V[11] = (RHS11 - tmp11) / m_A29; + double tmp10 = 0.0; + tmp10 += m_A28 * V[27]; + V[10] = (RHS10 - tmp10) / m_A27; + double tmp9 = 0.0; + tmp9 += m_A24 * V[22]; + tmp9 += m_A25 * V[27]; + tmp9 += m_A26 * V[28]; + V[9] = (RHS9 - tmp9) / m_A23; + double tmp8 = 0.0; + tmp8 += m_A21 * V[28]; + tmp8 += m_A22 * V[32]; + V[8] = (RHS8 - tmp8) / m_A20; + double tmp7 = 0.0; + tmp7 += m_A19 * V[20]; + V[7] = (RHS7 - tmp7) / m_A18; + double tmp6 = 0.0; + tmp6 += m_A16 * V[29]; + tmp6 += m_A17 * V[32]; + V[6] = (RHS6 - tmp6) / m_A15; + double tmp5 = 0.0; + tmp5 += m_A13 * V[6]; + tmp5 += m_A14 * V[29]; + V[5] = (RHS5 - tmp5) / m_A12; + double tmp4 = 0.0; + tmp4 += m_A11 * V[19]; + V[4] = (RHS4 - tmp4) / m_A10; + double tmp3 = 0.0; + tmp3 += m_A9 * V[25]; + V[3] = (RHS3 - tmp3) / m_A8; + double tmp2 = 0.0; + tmp2 += m_A6 * V[17]; + tmp2 += m_A7 * V[30]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[16]; + tmp1 += m_A4 * V[17]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[16]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // fireone static void nl_gcr_c1d22fe6e895255d_79_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -50037,6 +56744,153 @@ static void nl_gcr_c4cec7aed23b7b94_23_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_c5b523ed6a9677e6_21_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A4 += go[2]; + m_A3 += go[3]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + m_A5 += gt[4]; + m_A5 += gt[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A5 += gt[8]; + m_A5 += gt[9]; + m_A5 += gt[10]; + m_A6 += go[4]; + double RHS2 = Idr[4]; + RHS2 += Idr[5]; + RHS2 += Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 -= go[5] * *cnV[5]; + RHS2 -= go[6] * *cnV[6]; + RHS2 -= go[7] * *cnV[7]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + m_A7 += gt[11]; + m_A8 += go[11]; + double RHS3 = Idr[11]; + m_A11 += gt[12]; + m_A11 += gt[13]; + m_A11 += gt[14]; + m_A10 += go[12]; + m_A9 += go[13]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + RHS4 += Idr[14]; + RHS4 -= go[14] * *cnV[14]; + m_A15 += gt[15]; + m_A15 += gt[16]; + m_A15 += gt[17]; + m_A16 += go[15]; + m_A13 += go[16]; + double RHS5 = Idr[15]; + RHS5 += Idr[16]; + RHS5 += Idr[17]; + RHS5 -= go[17] * *cnV[17]; + m_A20 += gt[18]; + m_A20 += gt[19]; + m_A20 += gt[20]; + m_A20 += gt[21]; + m_A20 += gt[22]; + m_A17 += go[18]; + m_A18 += go[19]; + m_A19 += go[20]; + double RHS6 = Idr[18]; + RHS6 += Idr[19]; + RHS6 += Idr[20]; + RHS6 += Idr[21]; + RHS6 += Idr[22]; + RHS6 -= go[21] * *cnV[21]; + RHS6 -= go[22] * *cnV[22]; + const double f0 = 1.0 / m_A0; + const double f0_4 = -f0 * m_A9; + m_A11 += m_A1 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_4 = -f1 * m_A10; + m_A11 += m_A3 * f1_4; + m_A12 += m_A4 * f1_4; + RHS4 += f1_4 * RHS1; + const double f1_5 = -f1 * m_A13; + m_A14 += m_A3 * f1_5; + m_A15 += m_A4 * f1_5; + RHS5 += f1_5 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_6 = -f2 * m_A17; + m_A19 += m_A6 * f2_6; + RHS6 += f2_6 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_6 = -f3 * m_A18; + m_A20 += m_A8 * f3_6; + RHS6 += f3_6 * RHS3; + const double f4 = 1.0 / m_A11; + const double f4_5 = -f4 * m_A14; + m_A15 += m_A12 * f4_5; + RHS5 += f4_5 * RHS4; + const double f5 = 1.0 / m_A15; + const double f5_6 = -f5 * m_A19; + m_A20 += m_A16 * f5_6; + RHS6 += f5_6 * RHS5; + V[6] = RHS6 / m_A20; + double tmp5 = 0.0; + tmp5 += m_A16 * V[6]; + V[5] = (RHS5 - tmp5) / m_A15; + double tmp4 = 0.0; + tmp4 += m_A12 * V[5]; + V[4] = (RHS4 - tmp4) / m_A11; + double tmp3 = 0.0; + tmp3 += m_A8 * V[6]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[5]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[4]; + tmp1 += m_A4 * V[5]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[4]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // segausb static void nl_gcr_c61e08cf5e35918_84_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -50975,6 +57829,2216 @@ static void nl_gcr_c74b1a65978d7121_7_double_double(double * __restrict V, const V[0] = (RHS0 - tmp0) / m_A0; } +// headon +static void nl_gcr_c90daff82be2d052_350_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + double m_A97(0.0); + double m_A98(0.0); + double m_A99(0.0); + double m_A100(0.0); + double m_A101(0.0); + double m_A102(0.0); + double m_A103(0.0); + double m_A104(0.0); + double m_A105(0.0); + double m_A106(0.0); + double m_A107(0.0); + double m_A108(0.0); + double m_A109(0.0); + double m_A110(0.0); + double m_A111(0.0); + double m_A112(0.0); + double m_A113(0.0); + double m_A114(0.0); + double m_A115(0.0); + double m_A116(0.0); + double m_A117(0.0); + double m_A118(0.0); + double m_A119(0.0); + double m_A120(0.0); + double m_A121(0.0); + double m_A122(0.0); + double m_A123(0.0); + double m_A124(0.0); + double m_A125(0.0); + double m_A126(0.0); + double m_A127(0.0); + double m_A128(0.0); + double m_A129(0.0); + double m_A130(0.0); + double m_A131(0.0); + double m_A132(0.0); + double m_A133(0.0); + double m_A134(0.0); + double m_A135(0.0); + double m_A136(0.0); + double m_A137(0.0); + double m_A138(0.0); + double m_A139(0.0); + double m_A140(0.0); + double m_A141(0.0); + double m_A142(0.0); + double m_A143(0.0); + double m_A144(0.0); + double m_A145(0.0); + double m_A146(0.0); + double m_A147(0.0); + double m_A148(0.0); + double m_A149(0.0); + double m_A150(0.0); + double m_A151(0.0); + double m_A152(0.0); + double m_A153(0.0); + double m_A154(0.0); + double m_A155(0.0); + double m_A156(0.0); + double m_A157(0.0); + double m_A158(0.0); + double m_A159(0.0); + double m_A160(0.0); + double m_A161(0.0); + double m_A162(0.0); + double m_A163(0.0); + double m_A164(0.0); + double m_A165(0.0); + double m_A166(0.0); + double m_A167(0.0); + double m_A168(0.0); + double m_A169(0.0); + double m_A170(0.0); + double m_A171(0.0); + double m_A172(0.0); + double m_A173(0.0); + double m_A174(0.0); + double m_A175(0.0); + double m_A176(0.0); + double m_A177(0.0); + double m_A178(0.0); + double m_A179(0.0); + double m_A180(0.0); + double m_A181(0.0); + double m_A182(0.0); + double m_A183(0.0); + double m_A184(0.0); + double m_A185(0.0); + double m_A186(0.0); + double m_A187(0.0); + double m_A188(0.0); + double m_A189(0.0); + double m_A190(0.0); + double m_A191(0.0); + double m_A192(0.0); + double m_A193(0.0); + double m_A194(0.0); + double m_A195(0.0); + double m_A196(0.0); + double m_A197(0.0); + double m_A198(0.0); + double m_A199(0.0); + double m_A200(0.0); + double m_A201(0.0); + double m_A202(0.0); + double m_A203(0.0); + double m_A204(0.0); + double m_A205(0.0); + double m_A206(0.0); + double m_A207(0.0); + double m_A208(0.0); + double m_A209(0.0); + double m_A210(0.0); + double m_A211(0.0); + double m_A212(0.0); + double m_A213(0.0); + double m_A214(0.0); + double m_A215(0.0); + double m_A216(0.0); + double m_A217(0.0); + double m_A218(0.0); + double m_A219(0.0); + double m_A220(0.0); + double m_A221(0.0); + double m_A222(0.0); + double m_A223(0.0); + double m_A224(0.0); + double m_A225(0.0); + double m_A226(0.0); + double m_A227(0.0); + double m_A228(0.0); + double m_A229(0.0); + double m_A230(0.0); + double m_A231(0.0); + double m_A232(0.0); + double m_A233(0.0); + double m_A234(0.0); + double m_A235(0.0); + double m_A236(0.0); + double m_A237(0.0); + double m_A238(0.0); + double m_A239(0.0); + double m_A240(0.0); + double m_A241(0.0); + double m_A242(0.0); + double m_A243(0.0); + double m_A244(0.0); + double m_A245(0.0); + double m_A246(0.0); + double m_A247(0.0); + double m_A248(0.0); + double m_A249(0.0); + double m_A250(0.0); + double m_A251(0.0); + double m_A252(0.0); + double m_A253(0.0); + double m_A254(0.0); + double m_A255(0.0); + double m_A256(0.0); + double m_A257(0.0); + double m_A258(0.0); + double m_A259(0.0); + double m_A260(0.0); + double m_A261(0.0); + double m_A262(0.0); + double m_A263(0.0); + double m_A264(0.0); + double m_A265(0.0); + double m_A266(0.0); + double m_A267(0.0); + double m_A268(0.0); + double m_A269(0.0); + double m_A270(0.0); + double m_A271(0.0); + double m_A272(0.0); + double m_A273(0.0); + double m_A274(0.0); + double m_A275(0.0); + double m_A276(0.0); + double m_A277(0.0); + double m_A278(0.0); + double m_A279(0.0); + double m_A280(0.0); + double m_A281(0.0); + double m_A282(0.0); + double m_A283(0.0); + double m_A284(0.0); + double m_A285(0.0); + double m_A286(0.0); + double m_A287(0.0); + double m_A288(0.0); + double m_A289(0.0); + double m_A290(0.0); + double m_A291(0.0); + double m_A292(0.0); + double m_A293(0.0); + double m_A294(0.0); + double m_A295(0.0); + double m_A296(0.0); + double m_A297(0.0); + double m_A298(0.0); + double m_A299(0.0); + double m_A300(0.0); + double m_A301(0.0); + double m_A302(0.0); + double m_A303(0.0); + double m_A304(0.0); + double m_A305(0.0); + double m_A306(0.0); + double m_A307(0.0); + double m_A308(0.0); + double m_A309(0.0); + double m_A310(0.0); + double m_A311(0.0); + double m_A312(0.0); + double m_A313(0.0); + double m_A314(0.0); + double m_A315(0.0); + double m_A316(0.0); + double m_A317(0.0); + double m_A318(0.0); + double m_A319(0.0); + double m_A320(0.0); + double m_A321(0.0); + double m_A322(0.0); + double m_A323(0.0); + double m_A324(0.0); + double m_A325(0.0); + double m_A326(0.0); + double m_A327(0.0); + double m_A328(0.0); + double m_A329(0.0); + double m_A330(0.0); + double m_A331(0.0); + double m_A332(0.0); + double m_A333(0.0); + double m_A334(0.0); + double m_A335(0.0); + double m_A336(0.0); + double m_A337(0.0); + double m_A338(0.0); + double m_A339(0.0); + double m_A340(0.0); + double m_A341(0.0); + double m_A342(0.0); + double m_A343(0.0); + double m_A344(0.0); + double m_A345(0.0); + double m_A346(0.0); + double m_A347(0.0); + double m_A348(0.0); + double m_A349(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A3 += go[3]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 -= go[4] * *cnV[4]; + m_A4 += gt[5]; + m_A4 += gt[6]; + m_A4 += gt[7]; + m_A4 += gt[8]; + m_A6 += go[5]; + m_A5 += go[6]; + m_A5 += go[7]; + double RHS2 = Idr[5]; + RHS2 += Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 -= go[8] * *cnV[8]; + m_A7 += gt[9]; + m_A7 += gt[10]; + m_A8 += go[9]; + double RHS3 = Idr[9]; + RHS3 += Idr[10]; + RHS3 -= go[10] * *cnV[10]; + m_A9 += gt[11]; + m_A9 += gt[12]; + m_A9 += gt[13]; + m_A10 += go[11]; + m_A11 += go[12]; + double RHS4 = Idr[11]; + RHS4 += Idr[12]; + RHS4 += Idr[13]; + RHS4 -= go[13] * *cnV[13]; + m_A12 += gt[14]; + m_A12 += gt[15]; + m_A13 += go[14]; + double RHS5 = Idr[14]; + RHS5 += Idr[15]; + RHS5 -= go[15] * *cnV[15]; + m_A14 += gt[16]; + m_A14 += gt[17]; + m_A15 += go[16]; + double RHS6 = Idr[16]; + RHS6 += Idr[17]; + RHS6 -= go[17] * *cnV[17]; + m_A16 += gt[18]; + m_A16 += gt[19]; + m_A17 += go[18]; + double RHS7 = Idr[18]; + RHS7 += Idr[19]; + RHS7 -= go[19] * *cnV[19]; + m_A18 += gt[20]; + m_A18 += gt[21]; + m_A19 += go[20]; + double RHS8 = Idr[20]; + RHS8 += Idr[21]; + RHS8 -= go[21] * *cnV[21]; + m_A20 += gt[22]; + m_A20 += gt[23]; + m_A20 += gt[24]; + m_A20 += gt[25]; + m_A21 += go[22]; + m_A22 += go[23]; + m_A23 += go[24]; + double RHS9 = Idr[22]; + RHS9 += Idr[23]; + RHS9 += Idr[24]; + RHS9 += Idr[25]; + RHS9 -= go[25] * *cnV[25]; + m_A24 += gt[26]; + m_A24 += gt[27]; + m_A24 += gt[28]; + m_A24 += gt[29]; + m_A24 += gt[30]; + m_A25 += go[26]; + m_A27 += go[27]; + m_A26 += go[28]; + double RHS10 = Idr[26]; + RHS10 += Idr[27]; + RHS10 += Idr[28]; + RHS10 += Idr[29]; + RHS10 += Idr[30]; + RHS10 -= go[29] * *cnV[29]; + RHS10 -= go[30] * *cnV[30]; + m_A28 += gt[31]; + m_A28 += gt[32]; + m_A28 += gt[33]; + m_A28 += gt[34]; + m_A28 += gt[35]; + m_A28 += gt[36]; + m_A28 += gt[37]; + m_A29 += go[31]; + m_A30 += go[32]; + double RHS11 = Idr[31]; + RHS11 += Idr[32]; + RHS11 += Idr[33]; + RHS11 += Idr[34]; + RHS11 += Idr[35]; + RHS11 += Idr[36]; + RHS11 += Idr[37]; + RHS11 -= go[33] * *cnV[33]; + RHS11 -= go[34] * *cnV[34]; + RHS11 -= go[35] * *cnV[35]; + RHS11 -= go[36] * *cnV[36]; + RHS11 -= go[37] * *cnV[37]; + m_A31 += gt[38]; + m_A31 += gt[39]; + m_A31 += gt[40]; + m_A31 += gt[41]; + m_A33 += go[38]; + m_A34 += go[39]; + m_A32 += go[40]; + double RHS12 = Idr[38]; + RHS12 += Idr[39]; + RHS12 += Idr[40]; + RHS12 += Idr[41]; + RHS12 -= go[41] * *cnV[41]; + m_A35 += gt[42]; + m_A35 += gt[43]; + m_A35 += gt[44]; + m_A37 += go[42]; + m_A36 += go[43]; + double RHS13 = Idr[42]; + RHS13 += Idr[43]; + RHS13 += Idr[44]; + RHS13 -= go[44] * *cnV[44]; + m_A38 += gt[45]; + m_A38 += gt[46]; + m_A38 += gt[47]; + m_A38 += gt[48]; + m_A38 += gt[49]; + m_A38 += gt[50]; + m_A38 += gt[51]; + m_A39 += go[45]; + double RHS14 = Idr[45]; + RHS14 += Idr[46]; + RHS14 += Idr[47]; + RHS14 += Idr[48]; + RHS14 += Idr[49]; + RHS14 += Idr[50]; + RHS14 += Idr[51]; + RHS14 -= go[46] * *cnV[46]; + RHS14 -= go[47] * *cnV[47]; + RHS14 -= go[48] * *cnV[48]; + RHS14 -= go[49] * *cnV[49]; + RHS14 -= go[50] * *cnV[50]; + RHS14 -= go[51] * *cnV[51]; + m_A40 += gt[52]; + m_A40 += gt[53]; + m_A40 += gt[54]; + m_A40 += gt[55]; + m_A43 += go[52]; + m_A42 += go[53]; + m_A41 += go[54]; + double RHS15 = Idr[52]; + RHS15 += Idr[53]; + RHS15 += Idr[54]; + RHS15 += Idr[55]; + RHS15 -= go[55] * *cnV[55]; + m_A44 += gt[56]; + m_A44 += gt[57]; + m_A45 += go[56]; + m_A46 += go[57]; + double RHS16 = Idr[56]; + RHS16 += Idr[57]; + m_A47 += gt[58]; + m_A47 += gt[59]; + m_A48 += go[58]; + m_A49 += go[59]; + double RHS17 = Idr[58]; + RHS17 += Idr[59]; + m_A50 += gt[60]; + m_A50 += gt[61]; + m_A50 += gt[62]; + m_A50 += gt[63]; + m_A50 += gt[64]; + m_A50 += gt[65]; + m_A50 += gt[66]; + m_A51 += go[60]; + double RHS18 = Idr[60]; + RHS18 += Idr[61]; + RHS18 += Idr[62]; + RHS18 += Idr[63]; + RHS18 += Idr[64]; + RHS18 += Idr[65]; + RHS18 += Idr[66]; + RHS18 -= go[61] * *cnV[61]; + RHS18 -= go[62] * *cnV[62]; + RHS18 -= go[63] * *cnV[63]; + RHS18 -= go[64] * *cnV[64]; + RHS18 -= go[65] * *cnV[65]; + RHS18 -= go[66] * *cnV[66]; + m_A52 += gt[67]; + m_A52 += gt[68]; + m_A52 += gt[69]; + m_A53 += go[67]; + double RHS19 = Idr[67]; + RHS19 += Idr[68]; + RHS19 += Idr[69]; + RHS19 -= go[68] * *cnV[68]; + RHS19 -= go[69] * *cnV[69]; + m_A54 += gt[70]; + m_A54 += gt[71]; + m_A54 += gt[72]; + m_A54 += gt[73]; + m_A54 += gt[74]; + m_A56 += go[70]; + m_A55 += go[71]; + m_A55 += go[72]; + double RHS20 = Idr[70]; + RHS20 += Idr[71]; + RHS20 += Idr[72]; + RHS20 += Idr[73]; + RHS20 += Idr[74]; + RHS20 -= go[73] * *cnV[73]; + RHS20 -= go[74] * *cnV[74]; + m_A57 += gt[75]; + m_A57 += gt[76]; + m_A57 += gt[77]; + m_A57 += gt[78]; + m_A57 += gt[79]; + m_A59 += go[75]; + m_A58 += go[76]; + m_A58 += go[77]; + double RHS21 = Idr[75]; + RHS21 += Idr[76]; + RHS21 += Idr[77]; + RHS21 += Idr[78]; + RHS21 += Idr[79]; + RHS21 -= go[78] * *cnV[78]; + RHS21 -= go[79] * *cnV[79]; + m_A60 += gt[80]; + m_A60 += gt[81]; + m_A60 += gt[82]; + m_A60 += gt[83]; + m_A62 += go[80]; + m_A63 += go[81]; + m_A61 += go[82]; + double RHS22 = Idr[80]; + RHS22 += Idr[81]; + RHS22 += Idr[82]; + RHS22 += Idr[83]; + RHS22 -= go[83] * *cnV[83]; + m_A64 += gt[84]; + m_A64 += gt[85]; + m_A64 += gt[86]; + m_A65 += go[84]; + double RHS23 = Idr[84]; + RHS23 += Idr[85]; + RHS23 += Idr[86]; + RHS23 -= go[85] * *cnV[85]; + RHS23 -= go[86] * *cnV[86]; + m_A66 += gt[87]; + m_A66 += gt[88]; + m_A66 += gt[89]; + m_A66 += gt[90]; + m_A66 += gt[91]; + m_A67 += go[87]; + double RHS24 = Idr[87]; + RHS24 += Idr[88]; + RHS24 += Idr[89]; + RHS24 += Idr[90]; + RHS24 += Idr[91]; + RHS24 -= go[88] * *cnV[88]; + RHS24 -= go[89] * *cnV[89]; + RHS24 -= go[90] * *cnV[90]; + RHS24 -= go[91] * *cnV[91]; + m_A68 += gt[92]; + m_A69 += go[92]; + double RHS25 = Idr[92]; + m_A70 += gt[93]; + m_A70 += gt[94]; + m_A70 += gt[95]; + m_A70 += gt[96]; + m_A72 += go[93]; + m_A71 += go[94]; + m_A71 += go[95]; + double RHS26 = Idr[93]; + RHS26 += Idr[94]; + RHS26 += Idr[95]; + RHS26 += Idr[96]; + RHS26 -= go[96] * *cnV[96]; + m_A73 += gt[97]; + m_A73 += gt[98]; + m_A73 += gt[99]; + m_A73 += gt[100]; + m_A75 += go[97]; + m_A76 += go[98]; + m_A74 += go[99]; + double RHS27 = Idr[97]; + RHS27 += Idr[98]; + RHS27 += Idr[99]; + RHS27 += Idr[100]; + RHS27 -= go[100] * *cnV[100]; + m_A77 += gt[101]; + m_A77 += gt[102]; + m_A78 += go[101]; + double RHS28 = Idr[101]; + RHS28 += Idr[102]; + RHS28 -= go[102] * *cnV[102]; + m_A79 += gt[103]; + m_A79 += gt[104]; + m_A79 += gt[105]; + m_A80 += go[103]; + double RHS29 = Idr[103]; + RHS29 += Idr[104]; + RHS29 += Idr[105]; + RHS29 -= go[104] * *cnV[104]; + RHS29 -= go[105] * *cnV[105]; + m_A83 += gt[106]; + m_A83 += gt[107]; + m_A83 += gt[108]; + m_A83 += gt[109]; + m_A83 += gt[110]; + m_A83 += gt[111]; + m_A82 += go[106]; + m_A82 += go[107]; + m_A81 += go[108]; + double RHS30 = Idr[106]; + RHS30 += Idr[107]; + RHS30 += Idr[108]; + RHS30 += Idr[109]; + RHS30 += Idr[110]; + RHS30 += Idr[111]; + RHS30 -= go[109] * *cnV[109]; + RHS30 -= go[110] * *cnV[110]; + RHS30 -= go[111] * *cnV[111]; + m_A86 += gt[112]; + m_A86 += gt[113]; + m_A85 += go[112]; + double RHS31 = Idr[112]; + RHS31 += Idr[113]; + RHS31 -= go[113] * *cnV[113]; + m_A89 += gt[114]; + m_A89 += gt[115]; + m_A89 += gt[116]; + m_A88 += go[114]; + m_A90 += go[115]; + double RHS32 = Idr[114]; + RHS32 += Idr[115]; + RHS32 += Idr[116]; + RHS32 -= go[116] * *cnV[116]; + m_A93 += gt[117]; + m_A93 += gt[118]; + m_A92 += go[117]; + m_A91 += go[118]; + double RHS33 = Idr[117]; + RHS33 += Idr[118]; + m_A98 += gt[119]; + m_A98 += gt[120]; + m_A98 += gt[121]; + m_A97 += go[119]; + m_A99 += go[120]; + double RHS34 = Idr[119]; + RHS34 += Idr[120]; + RHS34 += Idr[121]; + RHS34 -= go[121] * *cnV[121]; + m_A101 += gt[122]; + m_A101 += gt[123]; + m_A101 += gt[124]; + m_A101 += gt[125]; + m_A101 += gt[126]; + m_A103 += go[122]; + m_A100 += go[123]; + m_A102 += go[124]; + double RHS35 = Idr[122]; + RHS35 += Idr[123]; + RHS35 += Idr[124]; + RHS35 += Idr[125]; + RHS35 += Idr[126]; + RHS35 -= go[125] * *cnV[125]; + RHS35 -= go[126] * *cnV[126]; + m_A105 += gt[127]; + m_A105 += gt[128]; + m_A105 += gt[129]; + m_A105 += gt[130]; + m_A105 += gt[131]; + m_A105 += gt[132]; + m_A105 += gt[133]; + m_A106 += go[127]; + m_A104 += go[128]; + double RHS36 = Idr[127]; + RHS36 += Idr[128]; + RHS36 += Idr[129]; + RHS36 += Idr[130]; + RHS36 += Idr[131]; + RHS36 += Idr[132]; + RHS36 += Idr[133]; + RHS36 -= go[129] * *cnV[129]; + RHS36 -= go[130] * *cnV[130]; + RHS36 -= go[131] * *cnV[131]; + RHS36 -= go[132] * *cnV[132]; + RHS36 -= go[133] * *cnV[133]; + m_A112 += gt[134]; + m_A112 += gt[135]; + m_A112 += gt[136]; + m_A110 += go[134]; + m_A109 += go[135]; + m_A115 += go[136]; + double RHS37 = Idr[134]; + RHS37 += Idr[135]; + RHS37 += Idr[136]; + m_A119 += gt[137]; + m_A119 += gt[138]; + m_A119 += gt[139]; + m_A119 += gt[140]; + m_A118 += go[137]; + m_A121 += go[138]; + m_A117 += go[139]; + m_A116 += go[140]; + double RHS38 = Idr[137]; + RHS38 += Idr[138]; + RHS38 += Idr[139]; + RHS38 += Idr[140]; + m_A123 += gt[141]; + m_A123 += gt[142]; + m_A123 += gt[143]; + m_A123 += gt[144]; + m_A123 += gt[145]; + m_A123 += gt[146]; + m_A123 += gt[147]; + m_A125 += go[141]; + m_A122 += go[142]; + double RHS39 = Idr[141]; + RHS39 += Idr[142]; + RHS39 += Idr[143]; + RHS39 += Idr[144]; + RHS39 += Idr[145]; + RHS39 += Idr[146]; + RHS39 += Idr[147]; + RHS39 -= go[143] * *cnV[143]; + RHS39 -= go[144] * *cnV[144]; + RHS39 -= go[145] * *cnV[145]; + RHS39 -= go[146] * *cnV[146]; + RHS39 -= go[147] * *cnV[147]; + m_A130 += gt[148]; + m_A130 += gt[149]; + m_A130 += gt[150]; + m_A133 += go[148]; + m_A127 += go[149]; + m_A126 += go[150]; + double RHS40 = Idr[148]; + RHS40 += Idr[149]; + RHS40 += Idr[150]; + m_A138 += gt[151]; + m_A138 += gt[152]; + m_A138 += gt[153]; + m_A138 += gt[154]; + m_A138 += gt[155]; + m_A134 += go[151]; + m_A136 += go[152]; + m_A141 += go[153]; + double RHS41 = Idr[151]; + RHS41 += Idr[152]; + RHS41 += Idr[153]; + RHS41 += Idr[154]; + RHS41 += Idr[155]; + RHS41 -= go[154] * *cnV[154]; + RHS41 -= go[155] * *cnV[155]; + m_A145 += gt[156]; + m_A145 += gt[157]; + m_A145 += gt[158]; + m_A148 += go[156]; + m_A143 += go[157]; + double RHS42 = Idr[156]; + RHS42 += Idr[157]; + RHS42 += Idr[158]; + RHS42 -= go[158] * *cnV[158]; + m_A150 += gt[159]; + m_A150 += gt[160]; + m_A150 += gt[161]; + m_A150 += gt[162]; + m_A150 += gt[163]; + m_A150 += gt[164]; + m_A151 += go[159]; + m_A151 += go[160]; + m_A149 += go[161]; + m_A149 += go[162]; + double RHS43 = Idr[159]; + RHS43 += Idr[160]; + RHS43 += Idr[161]; + RHS43 += Idr[162]; + RHS43 += Idr[163]; + RHS43 += Idr[164]; + RHS43 -= go[163] * *cnV[163]; + RHS43 -= go[164] * *cnV[164]; + m_A153 += gt[165]; + m_A153 += gt[166]; + m_A153 += gt[167]; + m_A153 += gt[168]; + m_A153 += gt[169]; + m_A153 += gt[170]; + m_A154 += go[165]; + m_A154 += go[166]; + m_A152 += go[167]; + m_A152 += go[168]; + double RHS44 = Idr[165]; + RHS44 += Idr[166]; + RHS44 += Idr[167]; + RHS44 += Idr[168]; + RHS44 += Idr[169]; + RHS44 += Idr[170]; + RHS44 -= go[169] * *cnV[169]; + RHS44 -= go[170] * *cnV[170]; + m_A158 += gt[171]; + m_A158 += gt[172]; + m_A155 += go[171]; + m_A156 += go[172]; + double RHS45 = Idr[171]; + RHS45 += Idr[172]; + m_A164 += gt[173]; + m_A164 += gt[174]; + m_A164 += gt[175]; + m_A164 += gt[176]; + m_A164 += gt[177]; + m_A164 += gt[178]; + m_A163 += go[173]; + m_A163 += go[174]; + m_A162 += go[175]; + double RHS46 = Idr[173]; + RHS46 += Idr[174]; + RHS46 += Idr[175]; + RHS46 += Idr[176]; + RHS46 += Idr[177]; + RHS46 += Idr[178]; + RHS46 -= go[176] * *cnV[176]; + RHS46 -= go[177] * *cnV[177]; + RHS46 -= go[178] * *cnV[178]; + m_A172 += gt[179]; + m_A172 += gt[180]; + m_A172 += gt[181]; + m_A172 += gt[182]; + m_A172 += gt[183]; + m_A166 += go[179]; + m_A167 += go[180]; + m_A168 += go[181]; + double RHS47 = Idr[179]; + RHS47 += Idr[180]; + RHS47 += Idr[181]; + RHS47 += Idr[182]; + RHS47 += Idr[183]; + RHS47 -= go[182] * *cnV[182]; + RHS47 -= go[183] * *cnV[183]; + m_A181 += gt[184]; + m_A181 += gt[185]; + m_A181 += gt[186]; + m_A181 += gt[187]; + m_A181 += gt[188]; + m_A182 += go[184]; + m_A178 += go[185]; + m_A179 += go[186]; + double RHS48 = Idr[184]; + RHS48 += Idr[185]; + RHS48 += Idr[186]; + RHS48 += Idr[187]; + RHS48 += Idr[188]; + RHS48 -= go[187] * *cnV[187]; + RHS48 -= go[188] * *cnV[188]; + m_A183 += gt[189]; + m_A183 += gt[190]; + m_A183 += gt[191]; + m_A184 += go[189]; + double RHS49 = Idr[189]; + RHS49 += Idr[190]; + RHS49 += Idr[191]; + RHS49 -= go[190] * *cnV[190]; + RHS49 -= go[191] * *cnV[191]; + m_A192 += gt[192]; + m_A192 += gt[193]; + m_A192 += gt[194]; + m_A192 += gt[195]; + m_A192 += gt[196]; + m_A191 += go[192]; + m_A186 += go[193]; + m_A190 += go[194]; + m_A189 += go[195]; + m_A185 += go[196]; + double RHS50 = Idr[192]; + RHS50 += Idr[193]; + RHS50 += Idr[194]; + RHS50 += Idr[195]; + RHS50 += Idr[196]; + m_A201 += gt[197]; + m_A201 += gt[198]; + m_A201 += gt[199]; + m_A201 += gt[200]; + m_A197 += go[197]; + m_A195 += go[198]; + m_A194 += go[199]; + m_A196 += go[200]; + double RHS51 = Idr[197]; + RHS51 += Idr[198]; + RHS51 += Idr[199]; + RHS51 += Idr[200]; + m_A214 += gt[201]; + m_A214 += gt[202]; + m_A214 += gt[203]; + m_A214 += gt[204]; + m_A214 += gt[205]; + m_A214 += gt[206]; + m_A209 += go[201]; + m_A207 += go[202]; + m_A206 += go[203]; + m_A210 += go[204]; + double RHS52 = Idr[201]; + RHS52 += Idr[202]; + RHS52 += Idr[203]; + RHS52 += Idr[204]; + RHS52 += Idr[205]; + RHS52 += Idr[206]; + RHS52 -= go[205] * *cnV[205]; + RHS52 -= go[206] * *cnV[206]; + m_A225 += gt[207]; + m_A225 += gt[208]; + m_A225 += gt[209]; + m_A225 += gt[210]; + m_A225 += gt[211]; + m_A231 += go[207]; + m_A231 += go[208]; + m_A220 += go[209]; + m_A229 += go[210]; + m_A221 += go[211]; + double RHS53 = Idr[207]; + RHS53 += Idr[208]; + RHS53 += Idr[209]; + RHS53 += Idr[210]; + RHS53 += Idr[211]; + m_A240 += gt[212]; + m_A240 += gt[213]; + m_A240 += gt[214]; + m_A234 += go[212]; + m_A232 += go[213]; + m_A233 += go[214]; + double RHS54 = Idr[212]; + RHS54 += Idr[213]; + RHS54 += Idr[214]; + m_A257 += gt[215]; + m_A257 += gt[216]; + m_A257 += gt[217]; + m_A257 += gt[218]; + m_A257 += gt[219]; + m_A257 += gt[220]; + m_A246 += go[215]; + m_A248 += go[216]; + m_A250 += go[217]; + m_A247 += go[218]; + double RHS55 = Idr[215]; + RHS55 += Idr[216]; + RHS55 += Idr[217]; + RHS55 += Idr[218]; + RHS55 += Idr[219]; + RHS55 += Idr[220]; + RHS55 -= go[219] * *cnV[219]; + RHS55 -= go[220] * *cnV[220]; + m_A270 += gt[221]; + m_A270 += gt[222]; + m_A270 += gt[223]; + m_A270 += gt[224]; + m_A275 += go[221]; + m_A262 += go[222]; + m_A272 += go[223]; + m_A263 += go[224]; + double RHS56 = Idr[221]; + RHS56 += Idr[222]; + RHS56 += Idr[223]; + RHS56 += Idr[224]; + m_A282 += gt[225]; + m_A282 += gt[226]; + m_A282 += gt[227]; + m_A282 += gt[228]; + m_A282 += gt[229]; + m_A278 += go[225]; + m_A277 += go[226]; + m_A277 += go[227]; + m_A276 += go[228]; + double RHS57 = Idr[225]; + RHS57 += Idr[226]; + RHS57 += Idr[227]; + RHS57 += Idr[228]; + RHS57 += Idr[229]; + RHS57 -= go[229] * *cnV[229]; + m_A287 += gt[230]; + m_A287 += gt[231]; + m_A287 += gt[232]; + m_A288 += go[230]; + double RHS58 = Idr[230]; + RHS58 += Idr[231]; + RHS58 += Idr[232]; + RHS58 -= go[231] * *cnV[231]; + RHS58 -= go[232] * *cnV[232]; + m_A293 += gt[233]; + m_A293 += gt[234]; + m_A293 += gt[235]; + m_A293 += gt[236]; + m_A293 += gt[237]; + m_A291 += go[233]; + m_A290 += go[234]; + m_A290 += go[235]; + m_A289 += go[236]; + double RHS59 = Idr[233]; + RHS59 += Idr[234]; + RHS59 += Idr[235]; + RHS59 += Idr[236]; + RHS59 += Idr[237]; + RHS59 -= go[237] * *cnV[237]; + m_A297 += gt[238]; + m_A297 += gt[239]; + m_A297 += gt[240]; + m_A298 += go[238]; + double RHS60 = Idr[238]; + RHS60 += Idr[239]; + RHS60 += Idr[240]; + RHS60 -= go[239] * *cnV[239]; + RHS60 -= go[240] * *cnV[240]; + m_A299 += gt[241]; + m_A299 += gt[242]; + m_A299 += gt[243]; + m_A300 += go[241]; + double RHS61 = Idr[241]; + RHS61 += Idr[242]; + RHS61 += Idr[243]; + RHS61 -= go[242] * *cnV[242]; + RHS61 -= go[243] * *cnV[243]; + m_A301 += gt[244]; + m_A301 += gt[245]; + m_A301 += gt[246]; + m_A302 += go[244]; + double RHS62 = Idr[244]; + RHS62 += Idr[245]; + RHS62 += Idr[246]; + RHS62 -= go[245] * *cnV[245]; + RHS62 -= go[246] * *cnV[246]; + m_A314 += gt[247]; + m_A314 += gt[248]; + m_A314 += gt[249]; + m_A314 += gt[250]; + m_A314 += gt[251]; + m_A303 += go[247]; + m_A317 += go[248]; + m_A304 += go[249]; + double RHS63 = Idr[247]; + RHS63 += Idr[248]; + RHS63 += Idr[249]; + RHS63 += Idr[250]; + RHS63 += Idr[251]; + RHS63 -= go[250] * *cnV[250]; + RHS63 -= go[251] * *cnV[251]; + m_A320 += gt[252]; + m_A320 += gt[253]; + m_A320 += gt[254]; + m_A321 += go[252]; + m_A318 += go[253]; + m_A319 += go[254]; + double RHS64 = Idr[252]; + RHS64 += Idr[253]; + RHS64 += Idr[254]; + m_A329 += gt[255]; + m_A329 += gt[256]; + m_A329 += gt[257]; + m_A331 += go[255]; + m_A322 += go[256]; + m_A322 += go[257]; + double RHS65 = Idr[255]; + RHS65 += Idr[256]; + RHS65 += Idr[257]; + m_A337 += gt[258]; + m_A337 += gt[259]; + m_A337 += gt[260]; + m_A337 += gt[261]; + m_A338 += go[258]; + m_A332 += go[259]; + double RHS66 = Idr[258]; + RHS66 += Idr[259]; + RHS66 += Idr[260]; + RHS66 += Idr[261]; + RHS66 -= go[260] * *cnV[260]; + RHS66 -= go[261] * *cnV[261]; + m_A349 += gt[262]; + m_A349 += gt[263]; + m_A349 += gt[264]; + m_A349 += gt[265]; + m_A349 += gt[266]; + m_A349 += gt[267]; + m_A349 += gt[268]; + m_A349 += gt[269]; + m_A349 += gt[270]; + m_A349 += gt[271]; + m_A346 += go[262]; + m_A347 += go[263]; + m_A348 += go[264]; + m_A345 += go[265]; + m_A344 += go[266]; + m_A343 += go[267]; + m_A342 += go[268]; + m_A341 += go[269]; + m_A340 += go[270]; + m_A339 += go[271]; + double RHS67 = Idr[262]; + RHS67 += Idr[263]; + RHS67 += Idr[264]; + RHS67 += Idr[265]; + RHS67 += Idr[266]; + RHS67 += Idr[267]; + RHS67 += Idr[268]; + RHS67 += Idr[269]; + RHS67 += Idr[270]; + RHS67 += Idr[271]; + const double f0 = 1.0 / m_A0; + const double f0_30 = -f0 * m_A81; + m_A83 += m_A1 * f0_30; + RHS30 += f0_30 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_32 = -f1 * m_A88; + m_A89 += m_A3 * f1_32; + RHS32 += f1_32 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_30 = -f2 * m_A82; + m_A83 += m_A5 * f2_30; + m_A84 += m_A6 * f2_30; + RHS30 += f2_30 * RHS2; + const double f2_50 = -f2 * m_A185; + m_A187 += m_A5 * f2_50; + m_A192 += m_A6 * f2_50; + RHS50 += f2_50 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_34 = -f3 * m_A97; + m_A98 += m_A8 * f3_34; + RHS34 += f3_34 * RHS3; + const double f4 = 1.0 / m_A9; + const double f4_31 = -f4 * m_A85; + m_A86 += m_A10 * f4_31; + m_A87 += m_A11 * f4_31; + RHS31 += f4_31 * RHS4; + const double f4_50 = -f4 * m_A186; + m_A188 += m_A10 * f4_50; + m_A192 += m_A11 * f4_50; + RHS50 += f4_50 * RHS4; + const double f5 = 1.0 / m_A12; + const double f5_35 = -f5 * m_A100; + m_A101 += m_A13 * f5_35; + RHS35 += f5_35 * RHS5; + const double f6 = 1.0 / m_A14; + const double f6_38 = -f6 * m_A116; + m_A119 += m_A15 * f6_38; + RHS38 += f6_38 * RHS6; + const double f7 = 1.0 / m_A16; + const double f7_51 = -f7 * m_A194; + m_A201 += m_A17 * f7_51; + RHS51 += f7_51 * RHS7; + const double f8 = 1.0 / m_A18; + const double f8_38 = -f8 * m_A117; + m_A119 += m_A19 * f8_38; + RHS38 += f8_38 * RHS8; + const double f9 = 1.0 / m_A20; + const double f9_36 = -f9 * m_A104; + m_A106 += m_A21 * f9_36; + m_A107 += m_A22 * f9_36; + m_A108 += m_A23 * f9_36; + RHS36 += f9_36 * RHS9; + const double f9_37 = -f9 * m_A109; + m_A112 += m_A21 * f9_37; + m_A114 += m_A22 * f9_37; + m_A115 += m_A23 * f9_37; + RHS37 += f9_37 * RHS9; + const double f9_47 = -f9 * m_A166; + m_A169 += m_A21 * f9_47; + m_A172 += m_A22 * f9_47; + m_A173 += m_A23 * f9_47; + RHS47 += f9_47 * RHS9; + const double f9_51 = -f9 * m_A195; + m_A197 += m_A21 * f9_51; + m_A199 += m_A22 * f9_51; + m_A201 += m_A23 * f9_51; + RHS51 += f9_51 * RHS9; + const double f10 = 1.0 / m_A24; + const double f10_37 = -f10 * m_A110; + m_A111 += m_A25 * f10_37; + m_A112 += m_A26 * f10_37; + m_A113 += m_A27 * f10_37; + RHS37 += f10_37 * RHS10; + const double f10_40 = -f10 * m_A126; + m_A128 += m_A25 * f10_40; + m_A129 += m_A26 * f10_40; + m_A130 += m_A27 * f10_40; + RHS40 += f10_40 * RHS10; + const double f11 = 1.0 / m_A28; + const double f11_41 = -f11 * m_A134; + m_A135 += m_A29 * f11_41; + m_A141 += m_A30 * f11_41; + RHS41 += f11_41 * RHS11; + const double f12 = 1.0 / m_A31; + const double f12_38 = -f12 * m_A118; + m_A119 += m_A32 * f12_38; + m_A120 += m_A33 * f12_38; + m_A121 += m_A34 * f12_38; + RHS38 += f12_38 * RHS12; + const double f12_41 = -f12 * m_A135; + m_A137 += m_A32 * f12_41; + m_A140 += m_A33 * f12_41; + m_A141 += m_A34 * f12_41; + RHS41 += f12_41 * RHS12; + const double f12_47 = -f12 * m_A167; + m_A170 += m_A32 * f12_47; + m_A172 += m_A33 * f12_47; + m_A176 += m_A34 * f12_47; + RHS47 += f12_47 * RHS12; + const double f12_54 = -f12 * m_A232; + m_A233 += m_A32 * f12_54; + m_A236 += m_A33 * f12_54; + m_A240 += m_A34 * f12_54; + RHS54 += f12_54 * RHS12; + const double f13 = 1.0 / m_A35; + const double f13_39 = -f13 * m_A122; + m_A124 += m_A36 * f13_39; + m_A125 += m_A37 * f13_39; + RHS39 += f13_39 * RHS13; + const double f13_40 = -f13 * m_A127; + m_A130 += m_A36 * f13_40; + m_A133 += m_A37 * f13_40; + RHS40 += f13_40 * RHS13; + const double f13_52 = -f13 * m_A206; + m_A210 += m_A36 * f13_52; + m_A214 += m_A37 * f13_52; + RHS52 += f13_52 * RHS13; + const double f14 = 1.0 / m_A38; + const double f14_55 = -f14 * m_A246; + m_A250 += m_A39 * f14_55; + RHS55 += f14_55 * RHS14; + const double f15 = 1.0 / m_A40; + const double f15_41 = -f15 * m_A136; + m_A138 += m_A41 * f15_41; + m_A139 += m_A42 * f15_41; + m_A142 += m_A43 * f15_41; + RHS41 += f15_41 * RHS15; + const double f15_42 = -f15 * m_A143; + m_A144 += m_A41 * f15_42; + m_A145 += m_A42 * f15_42; + m_A148 += m_A43 * f15_42; + RHS42 += f15_42 * RHS15; + const double f15_55 = -f15 * m_A247; + m_A249 += m_A41 * f15_55; + m_A250 += m_A42 * f15_55; + m_A257 += m_A43 * f15_55; + RHS55 += f15_55 * RHS15; + const double f16 = 1.0 / m_A44; + const double f16_33 = -f16 * m_A91; + m_A93 += m_A45 * f16_33; + m_A95 += m_A46 * f16_33; + RHS33 += f16_33 * RHS16; + const double f16_52 = -f16 * m_A207; + m_A208 += m_A45 * f16_52; + m_A214 += m_A46 * f16_52; + RHS52 += f16_52 * RHS16; + const double f17 = 1.0 / m_A47; + const double f17_45 = -f17 * m_A155; + m_A158 += m_A48 * f17_45; + m_A160 += m_A49 * f17_45; + RHS45 += f17_45 * RHS17; + const double f17_55 = -f17 * m_A248; + m_A251 += m_A48 * f17_55; + m_A257 += m_A49 * f17_55; + RHS55 += f17_55 * RHS17; + const double f18 = 1.0 / m_A50; + const double f18_63 = -f18 * m_A303; + m_A304 += m_A51 * f18_63; + RHS63 += f18_63 * RHS18; + const double f19 = 1.0 / m_A52; + const double f19_46 = -f19 * m_A162; + m_A164 += m_A53 * f19_46; + RHS46 += f19_46 * RHS19; + const double f20 = 1.0 / m_A54; + const double f20_43 = -f20 * m_A149; + m_A150 += m_A55 * f20_43; + m_A151 += m_A56 * f20_43; + RHS43 += f20_43 * RHS20; + const double f20_59 = -f20 * m_A289; + m_A290 += m_A55 * f20_59; + m_A293 += m_A56 * f20_59; + RHS59 += f20_59 * RHS20; + const double f21 = 1.0 / m_A57; + const double f21_44 = -f21 * m_A152; + m_A153 += m_A58 * f21_44; + m_A154 += m_A59 * f21_44; + RHS44 += f21_44 * RHS21; + const double f21_57 = -f21 * m_A276; + m_A277 += m_A58 * f21_57; + m_A282 += m_A59 * f21_57; + RHS57 += f21_57 * RHS21; + const double f22 = 1.0 / m_A60; + const double f22_33 = -f22 * m_A92; + m_A93 += m_A61 * f22_33; + m_A94 += m_A62 * f22_33; + m_A96 += m_A63 * f22_33; + RHS33 += f22_33 * RHS22; + const double f22_45 = -f22 * m_A156; + m_A157 += m_A61 * f22_45; + m_A158 += m_A62 * f22_45; + m_A161 += m_A63 * f22_45; + RHS45 += f22_45 * RHS22; + const double f22_63 = -f22 * m_A304; + m_A305 += m_A61 * f22_63; + m_A306 += m_A62 * f22_63; + m_A314 += m_A63 * f22_63; + RHS63 += f22_63 * RHS22; + const double f23 = 1.0 / m_A64; + const double f23_56 = -f23 * m_A262; + m_A270 += m_A65 * f23_56; + RHS56 += f23_56 * RHS23; + const double f24 = 1.0 / m_A66; + const double f24_53 = -f24 * m_A220; + m_A225 += m_A67 * f24_53; + RHS53 += f24_53 * RHS24; + const double f25 = 1.0 / m_A68; + const double f25_48 = -f25 * m_A178; + m_A181 += m_A69 * f25_48; + RHS48 += f25_48 * RHS25; + const double f26 = 1.0 / m_A70; + const double f26_46 = -f26 * m_A163; + m_A164 += m_A71 * f26_46; + m_A165 += m_A72 * f26_46; + RHS46 += f26_46 * RHS26; + const double f26_48 = -f26 * m_A179; + m_A180 += m_A71 * f26_48; + m_A181 += m_A72 * f26_48; + RHS48 += f26_48 * RHS26; + const double f27 = 1.0 / m_A73; + const double f27_47 = -f27 * m_A168; + m_A172 += m_A74 * f27_47; + m_A175 += m_A75 * f27_47; + m_A177 += m_A76 * f27_47; + RHS47 += f27_47 * RHS27; + const double f27_53 = -f27 * m_A221; + m_A222 += m_A74 * f27_53; + m_A225 += m_A75 * f27_53; + m_A228 += m_A76 * f27_53; + RHS53 += f27_53 * RHS27; + const double f27_56 = -f27 * m_A263; + m_A264 += m_A74 * f27_56; + m_A267 += m_A75 * f27_56; + m_A270 += m_A76 * f27_56; + RHS56 += f27_56 * RHS27; + const double f28 = 1.0 / m_A77; + const double f28_64 = -f28 * m_A318; + m_A320 += m_A78 * f28_64; + RHS64 += f28_64 * RHS28; + const double f29 = 1.0 / m_A79; + const double f29_67 = -f29 * m_A339; + m_A349 += m_A80 * f29_67; + RHS67 += f29_67 * RHS29; + const double f30 = 1.0 / m_A83; + const double f30_50 = -f30 * m_A187; + m_A192 += m_A84 * f30_50; + RHS50 += f30_50 * RHS30; + const double f31 = 1.0 / m_A86; + const double f31_50 = -f31 * m_A188; + m_A192 += m_A87 * f31_50; + RHS50 += f31_50 * RHS31; + const double f32 = 1.0 / m_A89; + const double f32_50 = -f32 * m_A189; + m_A192 += m_A90 * f32_50; + RHS50 += f32_50 * RHS32; + const double f33 = 1.0 / m_A93; + const double f33_45 = -f33 * m_A157; + m_A158 += m_A94 * f33_45; + m_A159 += m_A95 * f33_45; + m_A161 += m_A96 * f33_45; + RHS45 += f33_45 * RHS33; + const double f33_52 = -f33 * m_A208; + m_A211 += m_A94 * f33_52; + m_A214 += m_A95 * f33_52; + m_A219 += m_A96 * f33_52; + RHS52 += f33_52 * RHS33; + const double f33_63 = -f33 * m_A305; + m_A306 += m_A94 * f33_63; + m_A307 += m_A95 * f33_63; + m_A314 += m_A96 * f33_63; + RHS63 += f33_63 * RHS33; + const double f34 = 1.0 / m_A98; + const double f34_50 = -f34 * m_A190; + m_A192 += m_A99 * f34_50; + RHS50 += f34_50 * RHS34; + const double f35 = 1.0 / m_A101; + const double f35_50 = -f35 * m_A191; + m_A192 += m_A102 * f35_50; + m_A193 += m_A103 * f35_50; + RHS50 += f35_50 * RHS35; + const double f35_51 = -f35 * m_A196; + m_A200 += m_A102 * f35_51; + m_A201 += m_A103 * f35_51; + RHS51 += f35_51 * RHS35; + const double f36 = 1.0 / m_A105; + const double f36_37 = -f36 * m_A111; + m_A112 += m_A106 * f36_37; + m_A114 += m_A107 * f36_37; + m_A115 += m_A108 * f36_37; + RHS37 += f36_37 * RHS36; + const double f36_40 = -f36 * m_A128; + m_A129 += m_A106 * f36_40; + m_A131 += m_A107 * f36_40; + m_A132 += m_A108 * f36_40; + RHS40 += f36_40 * RHS36; + const double f37 = 1.0 / m_A112; + const double f37_40 = -f37 * m_A129; + m_A130 += m_A113 * f37_40; + m_A131 += m_A114 * f37_40; + m_A132 += m_A115 * f37_40; + RHS40 += f37_40 * RHS37; + const double f37_47 = -f37 * m_A169; + m_A171 += m_A113 * f37_47; + m_A172 += m_A114 * f37_47; + m_A173 += m_A115 * f37_47; + RHS47 += f37_47 * RHS37; + const double f37_51 = -f37 * m_A197; + m_A198 += m_A113 * f37_51; + m_A199 += m_A114 * f37_51; + m_A201 += m_A115 * f37_51; + RHS51 += f37_51 * RHS37; + const double f38 = 1.0 / m_A119; + const double f38_41 = -f38 * m_A137; + m_A140 += m_A120 * f38_41; + m_A141 += m_A121 * f38_41; + RHS41 += f38_41 * RHS38; + const double f38_47 = -f38 * m_A170; + m_A172 += m_A120 * f38_47; + m_A176 += m_A121 * f38_47; + RHS47 += f38_47 * RHS38; + const double f38_54 = -f38 * m_A233; + m_A236 += m_A120 * f38_54; + m_A240 += m_A121 * f38_54; + RHS54 += f38_54 * RHS38; + const double f39 = 1.0 / m_A123; + const double f39_52 = -f39 * m_A209; + m_A210 += m_A124 * f39_52; + m_A214 += m_A125 * f39_52; + RHS52 += f39_52 * RHS39; + const double f40 = 1.0 / m_A130; + const double f40_47 = -f40 * m_A171; + m_A172 += m_A131 * f40_47; + m_A173 += m_A132 * f40_47; + m_A174 += m_A133 * f40_47; + RHS47 += f40_47 * RHS40; + const double f40_51 = -f40 * m_A198; + m_A199 += m_A131 * f40_51; + m_A201 += m_A132 * f40_51; + m_A202 += m_A133 * f40_51; + RHS51 += f40_51 * RHS40; + const double f40_52 = -f40 * m_A210; + m_A212 += m_A131 * f40_52; + m_A213 += m_A132 * f40_52; + m_A214 += m_A133 * f40_52; + RHS52 += f40_52 * RHS40; + const double f41 = 1.0 / m_A138; + const double f41_42 = -f41 * m_A144; + m_A145 += m_A139 * f41_42; + m_A146 += m_A140 * f41_42; + m_A147 += m_A141 * f41_42; + m_A148 += m_A142 * f41_42; + RHS42 += f41_42 * RHS41; + const double f41_54 = -f41 * m_A234; + m_A235 += m_A139 * f41_54; + m_A236 += m_A140 * f41_54; + m_A240 += m_A141 * f41_54; + m_A241 += m_A142 * f41_54; + RHS54 += f41_54 * RHS41; + const double f41_55 = -f41 * m_A249; + m_A250 += m_A139 * f41_55; + m_A252 += m_A140 * f41_55; + m_A256 += m_A141 * f41_55; + m_A257 += m_A142 * f41_55; + RHS55 += f41_55 * RHS41; + const double f42 = 1.0 / m_A145; + const double f42_54 = -f42 * m_A235; + m_A236 += m_A146 * f42_54; + m_A240 += m_A147 * f42_54; + m_A241 += m_A148 * f42_54; + RHS54 += f42_54 * RHS42; + const double f42_55 = -f42 * m_A250; + m_A252 += m_A146 * f42_55; + m_A256 += m_A147 * f42_55; + m_A257 += m_A148 * f42_55; + RHS55 += f42_55 * RHS42; + const double f43 = 1.0 / m_A150; + const double f43_59 = -f43 * m_A290; + m_A293 += m_A151 * f43_59; + RHS59 += f43_59 * RHS43; + const double f44 = 1.0 / m_A153; + const double f44_57 = -f44 * m_A277; + m_A282 += m_A154 * f44_57; + RHS57 += f44_57 * RHS44; + const double f45 = 1.0 / m_A158; + const double f45_52 = -f45 * m_A211; + m_A214 += m_A159 * f45_52; + m_A217 += m_A160 * f45_52; + m_A219 += m_A161 * f45_52; + RHS52 += f45_52 * RHS45; + const double f45_55 = -f45 * m_A251; + m_A254 += m_A159 * f45_55; + m_A257 += m_A160 * f45_55; + m_A260 += m_A161 * f45_55; + RHS55 += f45_55 * RHS45; + const double f45_63 = -f45 * m_A306; + m_A307 += m_A159 * f45_63; + m_A310 += m_A160 * f45_63; + m_A314 += m_A161 * f45_63; + RHS63 += f45_63 * RHS45; + const double f46 = 1.0 / m_A164; + const double f46_48 = -f46 * m_A180; + m_A181 += m_A165 * f46_48; + RHS48 += f46_48 * RHS46; + const double f47 = 1.0 / m_A172; + const double f47_51 = -f47 * m_A199; + m_A201 += m_A173 * f47_51; + m_A202 += m_A174 * f47_51; + m_A203 += m_A175 * f47_51; + m_A204 += m_A176 * f47_51; + m_A205 += m_A177 * f47_51; + RHS51 += f47_51 * RHS47; + const double f47_52 = -f47 * m_A212; + m_A213 += m_A173 * f47_52; + m_A214 += m_A174 * f47_52; + m_A215 += m_A175 * f47_52; + m_A216 += m_A176 * f47_52; + m_A218 += m_A177 * f47_52; + RHS52 += f47_52 * RHS47; + const double f47_53 = -f47 * m_A222; + m_A223 += m_A173 * f47_53; + m_A224 += m_A174 * f47_53; + m_A225 += m_A175 * f47_53; + m_A226 += m_A176 * f47_53; + m_A228 += m_A177 * f47_53; + RHS53 += f47_53 * RHS47; + const double f47_54 = -f47 * m_A236; + m_A237 += m_A173 * f47_54; + m_A238 += m_A174 * f47_54; + m_A239 += m_A175 * f47_54; + m_A240 += m_A176 * f47_54; + m_A242 += m_A177 * f47_54; + RHS54 += f47_54 * RHS47; + const double f47_55 = -f47 * m_A252; + m_A253 += m_A173 * f47_55; + m_A254 += m_A174 * f47_55; + m_A255 += m_A175 * f47_55; + m_A256 += m_A176 * f47_55; + m_A258 += m_A177 * f47_55; + RHS55 += f47_55 * RHS47; + const double f47_56 = -f47 * m_A264; + m_A265 += m_A173 * f47_56; + m_A266 += m_A174 * f47_56; + m_A267 += m_A175 * f47_56; + m_A268 += m_A176 * f47_56; + m_A270 += m_A177 * f47_56; + RHS56 += f47_56 * RHS47; + const double f48 = 1.0 / m_A181; + const double f48_64 = -f48 * m_A319; + m_A320 += m_A182 * f48_64; + RHS64 += f48_64 * RHS48; + const double f49 = 1.0 / m_A183; + const double f49_67 = -f49 * m_A340; + m_A349 += m_A184 * f49_67; + RHS67 += f49_67 * RHS49; + const double f50 = 1.0 / m_A192; + const double f50_51 = -f50 * m_A200; + m_A201 += m_A193 * f50_51; + RHS51 += f50_51 * RHS50; + const double f51 = 1.0 / m_A201; + const double f51_52 = -f51 * m_A213; + m_A214 += m_A202 * f51_52; + m_A215 += m_A203 * f51_52; + m_A216 += m_A204 * f51_52; + m_A218 += m_A205 * f51_52; + RHS52 += f51_52 * RHS51; + const double f51_53 = -f51 * m_A223; + m_A224 += m_A202 * f51_53; + m_A225 += m_A203 * f51_53; + m_A226 += m_A204 * f51_53; + m_A228 += m_A205 * f51_53; + RHS53 += f51_53 * RHS51; + const double f51_54 = -f51 * m_A237; + m_A238 += m_A202 * f51_54; + m_A239 += m_A203 * f51_54; + m_A240 += m_A204 * f51_54; + m_A242 += m_A205 * f51_54; + RHS54 += f51_54 * RHS51; + const double f51_55 = -f51 * m_A253; + m_A254 += m_A202 * f51_55; + m_A255 += m_A203 * f51_55; + m_A256 += m_A204 * f51_55; + m_A258 += m_A205 * f51_55; + RHS55 += f51_55 * RHS51; + const double f51_56 = -f51 * m_A265; + m_A266 += m_A202 * f51_56; + m_A267 += m_A203 * f51_56; + m_A268 += m_A204 * f51_56; + m_A270 += m_A205 * f51_56; + RHS56 += f51_56 * RHS51; + const double f52 = 1.0 / m_A214; + const double f52_53 = -f52 * m_A224; + m_A225 += m_A215 * f52_53; + m_A226 += m_A216 * f52_53; + m_A227 += m_A217 * f52_53; + m_A228 += m_A218 * f52_53; + m_A230 += m_A219 * f52_53; + RHS53 += f52_53 * RHS52; + const double f52_54 = -f52 * m_A238; + m_A239 += m_A215 * f52_54; + m_A240 += m_A216 * f52_54; + m_A241 += m_A217 * f52_54; + m_A242 += m_A218 * f52_54; + m_A244 += m_A219 * f52_54; + RHS54 += f52_54 * RHS52; + const double f52_55 = -f52 * m_A254; + m_A255 += m_A215 * f52_55; + m_A256 += m_A216 * f52_55; + m_A257 += m_A217 * f52_55; + m_A258 += m_A218 * f52_55; + m_A260 += m_A219 * f52_55; + RHS55 += f52_55 * RHS52; + const double f52_56 = -f52 * m_A266; + m_A267 += m_A215 * f52_56; + m_A268 += m_A216 * f52_56; + m_A269 += m_A217 * f52_56; + m_A270 += m_A218 * f52_56; + m_A273 += m_A219 * f52_56; + RHS56 += f52_56 * RHS52; + const double f52_63 = -f52 * m_A307; + m_A308 += m_A215 * f52_63; + m_A309 += m_A216 * f52_63; + m_A310 += m_A217 * f52_63; + m_A311 += m_A218 * f52_63; + m_A314 += m_A219 * f52_63; + RHS63 += f52_63 * RHS52; + const double f53 = 1.0 / m_A225; + const double f53_54 = -f53 * m_A239; + m_A240 += m_A226 * f53_54; + m_A241 += m_A227 * f53_54; + m_A242 += m_A228 * f53_54; + m_A243 += m_A229 * f53_54; + m_A244 += m_A230 * f53_54; + m_A245 += m_A231 * f53_54; + RHS54 += f53_54 * RHS53; + const double f53_55 = -f53 * m_A255; + m_A256 += m_A226 * f53_55; + m_A257 += m_A227 * f53_55; + m_A258 += m_A228 * f53_55; + m_A259 += m_A229 * f53_55; + m_A260 += m_A230 * f53_55; + m_A261 += m_A231 * f53_55; + RHS55 += f53_55 * RHS53; + const double f53_56 = -f53 * m_A267; + m_A268 += m_A226 * f53_56; + m_A269 += m_A227 * f53_56; + m_A270 += m_A228 * f53_56; + m_A271 += m_A229 * f53_56; + m_A273 += m_A230 * f53_56; + m_A274 += m_A231 * f53_56; + RHS56 += f53_56 * RHS53; + const double f53_57 = -f53 * m_A278; + m_A279 += m_A226 * f53_57; + m_A280 += m_A227 * f53_57; + m_A281 += m_A228 * f53_57; + m_A282 += m_A229 * f53_57; + m_A284 += m_A230 * f53_57; + m_A285 += m_A231 * f53_57; + RHS57 += f53_57 * RHS53; + const double f53_63 = -f53 * m_A308; + m_A309 += m_A226 * f53_63; + m_A310 += m_A227 * f53_63; + m_A311 += m_A228 * f53_63; + m_A312 += m_A229 * f53_63; + m_A314 += m_A230 * f53_63; + m_A315 += m_A231 * f53_63; + RHS63 += f53_63 * RHS53; + const double f53_65 = -f53 * m_A322; + m_A323 += m_A226 * f53_65; + m_A324 += m_A227 * f53_65; + m_A325 += m_A228 * f53_65; + m_A326 += m_A229 * f53_65; + m_A328 += m_A230 * f53_65; + m_A329 += m_A231 * f53_65; + RHS65 += f53_65 * RHS53; + const double f54 = 1.0 / m_A240; + const double f54_55 = -f54 * m_A256; + m_A257 += m_A241 * f54_55; + m_A258 += m_A242 * f54_55; + m_A259 += m_A243 * f54_55; + m_A260 += m_A244 * f54_55; + m_A261 += m_A245 * f54_55; + RHS55 += f54_55 * RHS54; + const double f54_56 = -f54 * m_A268; + m_A269 += m_A241 * f54_56; + m_A270 += m_A242 * f54_56; + m_A271 += m_A243 * f54_56; + m_A273 += m_A244 * f54_56; + m_A274 += m_A245 * f54_56; + RHS56 += f54_56 * RHS54; + const double f54_57 = -f54 * m_A279; + m_A280 += m_A241 * f54_57; + m_A281 += m_A242 * f54_57; + m_A282 += m_A243 * f54_57; + m_A284 += m_A244 * f54_57; + m_A285 += m_A245 * f54_57; + RHS57 += f54_57 * RHS54; + const double f54_63 = -f54 * m_A309; + m_A310 += m_A241 * f54_63; + m_A311 += m_A242 * f54_63; + m_A312 += m_A243 * f54_63; + m_A314 += m_A244 * f54_63; + m_A315 += m_A245 * f54_63; + RHS63 += f54_63 * RHS54; + const double f54_65 = -f54 * m_A323; + m_A324 += m_A241 * f54_65; + m_A325 += m_A242 * f54_65; + m_A326 += m_A243 * f54_65; + m_A328 += m_A244 * f54_65; + m_A329 += m_A245 * f54_65; + RHS65 += f54_65 * RHS54; + const double f55 = 1.0 / m_A257; + const double f55_56 = -f55 * m_A269; + m_A270 += m_A258 * f55_56; + m_A271 += m_A259 * f55_56; + m_A273 += m_A260 * f55_56; + m_A274 += m_A261 * f55_56; + RHS56 += f55_56 * RHS55; + const double f55_57 = -f55 * m_A280; + m_A281 += m_A258 * f55_57; + m_A282 += m_A259 * f55_57; + m_A284 += m_A260 * f55_57; + m_A285 += m_A261 * f55_57; + RHS57 += f55_57 * RHS55; + const double f55_63 = -f55 * m_A310; + m_A311 += m_A258 * f55_63; + m_A312 += m_A259 * f55_63; + m_A314 += m_A260 * f55_63; + m_A315 += m_A261 * f55_63; + RHS63 += f55_63 * RHS55; + const double f55_65 = -f55 * m_A324; + m_A325 += m_A258 * f55_65; + m_A326 += m_A259 * f55_65; + m_A328 += m_A260 * f55_65; + m_A329 += m_A261 * f55_65; + RHS65 += f55_65 * RHS55; + const double f56 = 1.0 / m_A270; + const double f56_57 = -f56 * m_A281; + m_A282 += m_A271 * f56_57; + m_A283 += m_A272 * f56_57; + m_A284 += m_A273 * f56_57; + m_A285 += m_A274 * f56_57; + m_A286 += m_A275 * f56_57; + RHS57 += f56_57 * RHS56; + const double f56_59 = -f56 * m_A291; + m_A292 += m_A271 * f56_59; + m_A293 += m_A272 * f56_59; + m_A294 += m_A273 * f56_59; + m_A295 += m_A274 * f56_59; + m_A296 += m_A275 * f56_59; + RHS59 += f56_59 * RHS56; + const double f56_63 = -f56 * m_A311; + m_A312 += m_A271 * f56_63; + m_A313 += m_A272 * f56_63; + m_A314 += m_A273 * f56_63; + m_A315 += m_A274 * f56_63; + m_A316 += m_A275 * f56_63; + RHS63 += f56_63 * RHS56; + const double f56_65 = -f56 * m_A325; + m_A326 += m_A271 * f56_65; + m_A327 += m_A272 * f56_65; + m_A328 += m_A273 * f56_65; + m_A329 += m_A274 * f56_65; + m_A330 += m_A275 * f56_65; + RHS65 += f56_65 * RHS56; + const double f56_66 = -f56 * m_A332; + m_A333 += m_A271 * f56_66; + m_A334 += m_A272 * f56_66; + m_A335 += m_A273 * f56_66; + m_A336 += m_A274 * f56_66; + m_A337 += m_A275 * f56_66; + RHS66 += f56_66 * RHS56; + const double f57 = 1.0 / m_A282; + const double f57_59 = -f57 * m_A292; + m_A293 += m_A283 * f57_59; + m_A294 += m_A284 * f57_59; + m_A295 += m_A285 * f57_59; + m_A296 += m_A286 * f57_59; + RHS59 += f57_59 * RHS57; + const double f57_63 = -f57 * m_A312; + m_A313 += m_A283 * f57_63; + m_A314 += m_A284 * f57_63; + m_A315 += m_A285 * f57_63; + m_A316 += m_A286 * f57_63; + RHS63 += f57_63 * RHS57; + const double f57_65 = -f57 * m_A326; + m_A327 += m_A283 * f57_65; + m_A328 += m_A284 * f57_65; + m_A329 += m_A285 * f57_65; + m_A330 += m_A286 * f57_65; + RHS65 += f57_65 * RHS57; + const double f57_66 = -f57 * m_A333; + m_A334 += m_A283 * f57_66; + m_A335 += m_A284 * f57_66; + m_A336 += m_A285 * f57_66; + m_A337 += m_A286 * f57_66; + RHS66 += f57_66 * RHS57; + const double f58 = 1.0 / m_A287; + const double f58_67 = -f58 * m_A341; + m_A349 += m_A288 * f58_67; + RHS67 += f58_67 * RHS58; + const double f59 = 1.0 / m_A293; + const double f59_63 = -f59 * m_A313; + m_A314 += m_A294 * f59_63; + m_A315 += m_A295 * f59_63; + m_A316 += m_A296 * f59_63; + RHS63 += f59_63 * RHS59; + const double f59_65 = -f59 * m_A327; + m_A328 += m_A294 * f59_65; + m_A329 += m_A295 * f59_65; + m_A330 += m_A296 * f59_65; + RHS65 += f59_65 * RHS59; + const double f59_66 = -f59 * m_A334; + m_A335 += m_A294 * f59_66; + m_A336 += m_A295 * f59_66; + m_A337 += m_A296 * f59_66; + RHS66 += f59_66 * RHS59; + const double f60 = 1.0 / m_A297; + const double f60_67 = -f60 * m_A342; + m_A349 += m_A298 * f60_67; + RHS67 += f60_67 * RHS60; + const double f61 = 1.0 / m_A299; + const double f61_67 = -f61 * m_A343; + m_A349 += m_A300 * f61_67; + RHS67 += f61_67 * RHS61; + const double f62 = 1.0 / m_A301; + const double f62_67 = -f62 * m_A344; + m_A349 += m_A302 * f62_67; + RHS67 += f62_67 * RHS62; + const double f63 = 1.0 / m_A314; + const double f63_65 = -f63 * m_A328; + m_A329 += m_A315 * f63_65; + m_A330 += m_A316 * f63_65; + m_A331 += m_A317 * f63_65; + RHS65 += f63_65 * RHS63; + const double f63_66 = -f63 * m_A335; + m_A336 += m_A315 * f63_66; + m_A337 += m_A316 * f63_66; + m_A338 += m_A317 * f63_66; + RHS66 += f63_66 * RHS63; + const double f63_67 = -f63 * m_A345; + m_A347 += m_A315 * f63_67; + m_A348 += m_A316 * f63_67; + m_A349 += m_A317 * f63_67; + RHS67 += f63_67 * RHS63; + const double f64 = 1.0 / m_A320; + const double f64_67 = -f64 * m_A346; + m_A349 += m_A321 * f64_67; + RHS67 += f64_67 * RHS64; + const double f65 = 1.0 / m_A329; + const double f65_66 = -f65 * m_A336; + m_A337 += m_A330 * f65_66; + m_A338 += m_A331 * f65_66; + RHS66 += f65_66 * RHS65; + const double f65_67 = -f65 * m_A347; + m_A348 += m_A330 * f65_67; + m_A349 += m_A331 * f65_67; + RHS67 += f65_67 * RHS65; + const double f66 = 1.0 / m_A337; + const double f66_67 = -f66 * m_A348; + m_A349 += m_A338 * f66_67; + RHS67 += f66_67 * RHS66; + V[67] = RHS67 / m_A349; + double tmp66 = 0.0; + tmp66 += m_A338 * V[67]; + V[66] = (RHS66 - tmp66) / m_A337; + double tmp65 = 0.0; + tmp65 += m_A330 * V[66]; + tmp65 += m_A331 * V[67]; + V[65] = (RHS65 - tmp65) / m_A329; + double tmp64 = 0.0; + tmp64 += m_A321 * V[67]; + V[64] = (RHS64 - tmp64) / m_A320; + double tmp63 = 0.0; + tmp63 += m_A315 * V[65]; + tmp63 += m_A316 * V[66]; + tmp63 += m_A317 * V[67]; + V[63] = (RHS63 - tmp63) / m_A314; + double tmp62 = 0.0; + tmp62 += m_A302 * V[67]; + V[62] = (RHS62 - tmp62) / m_A301; + double tmp61 = 0.0; + tmp61 += m_A300 * V[67]; + V[61] = (RHS61 - tmp61) / m_A299; + double tmp60 = 0.0; + tmp60 += m_A298 * V[67]; + V[60] = (RHS60 - tmp60) / m_A297; + double tmp59 = 0.0; + tmp59 += m_A294 * V[63]; + tmp59 += m_A295 * V[65]; + tmp59 += m_A296 * V[66]; + V[59] = (RHS59 - tmp59) / m_A293; + double tmp58 = 0.0; + tmp58 += m_A288 * V[67]; + V[58] = (RHS58 - tmp58) / m_A287; + double tmp57 = 0.0; + tmp57 += m_A283 * V[59]; + tmp57 += m_A284 * V[63]; + tmp57 += m_A285 * V[65]; + tmp57 += m_A286 * V[66]; + V[57] = (RHS57 - tmp57) / m_A282; + double tmp56 = 0.0; + tmp56 += m_A271 * V[57]; + tmp56 += m_A272 * V[59]; + tmp56 += m_A273 * V[63]; + tmp56 += m_A274 * V[65]; + tmp56 += m_A275 * V[66]; + V[56] = (RHS56 - tmp56) / m_A270; + double tmp55 = 0.0; + tmp55 += m_A258 * V[56]; + tmp55 += m_A259 * V[57]; + tmp55 += m_A260 * V[63]; + tmp55 += m_A261 * V[65]; + V[55] = (RHS55 - tmp55) / m_A257; + double tmp54 = 0.0; + tmp54 += m_A241 * V[55]; + tmp54 += m_A242 * V[56]; + tmp54 += m_A243 * V[57]; + tmp54 += m_A244 * V[63]; + tmp54 += m_A245 * V[65]; + V[54] = (RHS54 - tmp54) / m_A240; + double tmp53 = 0.0; + tmp53 += m_A226 * V[54]; + tmp53 += m_A227 * V[55]; + tmp53 += m_A228 * V[56]; + tmp53 += m_A229 * V[57]; + tmp53 += m_A230 * V[63]; + tmp53 += m_A231 * V[65]; + V[53] = (RHS53 - tmp53) / m_A225; + double tmp52 = 0.0; + tmp52 += m_A215 * V[53]; + tmp52 += m_A216 * V[54]; + tmp52 += m_A217 * V[55]; + tmp52 += m_A218 * V[56]; + tmp52 += m_A219 * V[63]; + V[52] = (RHS52 - tmp52) / m_A214; + double tmp51 = 0.0; + tmp51 += m_A202 * V[52]; + tmp51 += m_A203 * V[53]; + tmp51 += m_A204 * V[54]; + tmp51 += m_A205 * V[56]; + V[51] = (RHS51 - tmp51) / m_A201; + double tmp50 = 0.0; + tmp50 += m_A193 * V[51]; + V[50] = (RHS50 - tmp50) / m_A192; + double tmp49 = 0.0; + tmp49 += m_A184 * V[67]; + V[49] = (RHS49 - tmp49) / m_A183; + double tmp48 = 0.0; + tmp48 += m_A182 * V[64]; + V[48] = (RHS48 - tmp48) / m_A181; + double tmp47 = 0.0; + tmp47 += m_A173 * V[51]; + tmp47 += m_A174 * V[52]; + tmp47 += m_A175 * V[53]; + tmp47 += m_A176 * V[54]; + tmp47 += m_A177 * V[56]; + V[47] = (RHS47 - tmp47) / m_A172; + double tmp46 = 0.0; + tmp46 += m_A165 * V[48]; + V[46] = (RHS46 - tmp46) / m_A164; + double tmp45 = 0.0; + tmp45 += m_A159 * V[52]; + tmp45 += m_A160 * V[55]; + tmp45 += m_A161 * V[63]; + V[45] = (RHS45 - tmp45) / m_A158; + double tmp44 = 0.0; + tmp44 += m_A154 * V[57]; + V[44] = (RHS44 - tmp44) / m_A153; + double tmp43 = 0.0; + tmp43 += m_A151 * V[59]; + V[43] = (RHS43 - tmp43) / m_A150; + double tmp42 = 0.0; + tmp42 += m_A146 * V[47]; + tmp42 += m_A147 * V[54]; + tmp42 += m_A148 * V[55]; + V[42] = (RHS42 - tmp42) / m_A145; + double tmp41 = 0.0; + tmp41 += m_A139 * V[42]; + tmp41 += m_A140 * V[47]; + tmp41 += m_A141 * V[54]; + tmp41 += m_A142 * V[55]; + V[41] = (RHS41 - tmp41) / m_A138; + double tmp40 = 0.0; + tmp40 += m_A131 * V[47]; + tmp40 += m_A132 * V[51]; + tmp40 += m_A133 * V[52]; + V[40] = (RHS40 - tmp40) / m_A130; + double tmp39 = 0.0; + tmp39 += m_A124 * V[40]; + tmp39 += m_A125 * V[52]; + V[39] = (RHS39 - tmp39) / m_A123; + double tmp38 = 0.0; + tmp38 += m_A120 * V[47]; + tmp38 += m_A121 * V[54]; + V[38] = (RHS38 - tmp38) / m_A119; + double tmp37 = 0.0; + tmp37 += m_A113 * V[40]; + tmp37 += m_A114 * V[47]; + tmp37 += m_A115 * V[51]; + V[37] = (RHS37 - tmp37) / m_A112; + double tmp36 = 0.0; + tmp36 += m_A106 * V[37]; + tmp36 += m_A107 * V[47]; + tmp36 += m_A108 * V[51]; + V[36] = (RHS36 - tmp36) / m_A105; + double tmp35 = 0.0; + tmp35 += m_A102 * V[50]; + tmp35 += m_A103 * V[51]; + V[35] = (RHS35 - tmp35) / m_A101; + double tmp34 = 0.0; + tmp34 += m_A99 * V[50]; + V[34] = (RHS34 - tmp34) / m_A98; + double tmp33 = 0.0; + tmp33 += m_A94 * V[45]; + tmp33 += m_A95 * V[52]; + tmp33 += m_A96 * V[63]; + V[33] = (RHS33 - tmp33) / m_A93; + double tmp32 = 0.0; + tmp32 += m_A90 * V[50]; + V[32] = (RHS32 - tmp32) / m_A89; + double tmp31 = 0.0; + tmp31 += m_A87 * V[50]; + V[31] = (RHS31 - tmp31) / m_A86; + double tmp30 = 0.0; + tmp30 += m_A84 * V[50]; + V[30] = (RHS30 - tmp30) / m_A83; + double tmp29 = 0.0; + tmp29 += m_A80 * V[67]; + V[29] = (RHS29 - tmp29) / m_A79; + double tmp28 = 0.0; + tmp28 += m_A78 * V[64]; + V[28] = (RHS28 - tmp28) / m_A77; + double tmp27 = 0.0; + tmp27 += m_A74 * V[47]; + tmp27 += m_A75 * V[53]; + tmp27 += m_A76 * V[56]; + V[27] = (RHS27 - tmp27) / m_A73; + double tmp26 = 0.0; + tmp26 += m_A71 * V[46]; + tmp26 += m_A72 * V[48]; + V[26] = (RHS26 - tmp26) / m_A70; + double tmp25 = 0.0; + tmp25 += m_A69 * V[48]; + V[25] = (RHS25 - tmp25) / m_A68; + double tmp24 = 0.0; + tmp24 += m_A67 * V[53]; + V[24] = (RHS24 - tmp24) / m_A66; + double tmp23 = 0.0; + tmp23 += m_A65 * V[56]; + V[23] = (RHS23 - tmp23) / m_A64; + double tmp22 = 0.0; + tmp22 += m_A61 * V[33]; + tmp22 += m_A62 * V[45]; + tmp22 += m_A63 * V[63]; + V[22] = (RHS22 - tmp22) / m_A60; + double tmp21 = 0.0; + tmp21 += m_A58 * V[44]; + tmp21 += m_A59 * V[57]; + V[21] = (RHS21 - tmp21) / m_A57; + double tmp20 = 0.0; + tmp20 += m_A55 * V[43]; + tmp20 += m_A56 * V[59]; + V[20] = (RHS20 - tmp20) / m_A54; + double tmp19 = 0.0; + tmp19 += m_A53 * V[46]; + V[19] = (RHS19 - tmp19) / m_A52; + double tmp18 = 0.0; + tmp18 += m_A51 * V[22]; + V[18] = (RHS18 - tmp18) / m_A50; + double tmp17 = 0.0; + tmp17 += m_A48 * V[45]; + tmp17 += m_A49 * V[55]; + V[17] = (RHS17 - tmp17) / m_A47; + double tmp16 = 0.0; + tmp16 += m_A45 * V[33]; + tmp16 += m_A46 * V[52]; + V[16] = (RHS16 - tmp16) / m_A44; + double tmp15 = 0.0; + tmp15 += m_A41 * V[41]; + tmp15 += m_A42 * V[42]; + tmp15 += m_A43 * V[55]; + V[15] = (RHS15 - tmp15) / m_A40; + double tmp14 = 0.0; + tmp14 += m_A39 * V[42]; + V[14] = (RHS14 - tmp14) / m_A38; + double tmp13 = 0.0; + tmp13 += m_A36 * V[40]; + tmp13 += m_A37 * V[52]; + V[13] = (RHS13 - tmp13) / m_A35; + double tmp12 = 0.0; + tmp12 += m_A32 * V[38]; + tmp12 += m_A33 * V[47]; + tmp12 += m_A34 * V[54]; + V[12] = (RHS12 - tmp12) / m_A31; + double tmp11 = 0.0; + tmp11 += m_A29 * V[12]; + tmp11 += m_A30 * V[54]; + V[11] = (RHS11 - tmp11) / m_A28; + double tmp10 = 0.0; + tmp10 += m_A25 * V[36]; + tmp10 += m_A26 * V[37]; + tmp10 += m_A27 * V[40]; + V[10] = (RHS10 - tmp10) / m_A24; + double tmp9 = 0.0; + tmp9 += m_A21 * V[37]; + tmp9 += m_A22 * V[47]; + tmp9 += m_A23 * V[51]; + V[9] = (RHS9 - tmp9) / m_A20; + double tmp8 = 0.0; + tmp8 += m_A19 * V[38]; + V[8] = (RHS8 - tmp8) / m_A18; + double tmp7 = 0.0; + tmp7 += m_A17 * V[51]; + V[7] = (RHS7 - tmp7) / m_A16; + double tmp6 = 0.0; + tmp6 += m_A15 * V[38]; + V[6] = (RHS6 - tmp6) / m_A14; + double tmp5 = 0.0; + tmp5 += m_A13 * V[35]; + V[5] = (RHS5 - tmp5) / m_A12; + double tmp4 = 0.0; + tmp4 += m_A10 * V[31]; + tmp4 += m_A11 * V[50]; + V[4] = (RHS4 - tmp4) / m_A9; + double tmp3 = 0.0; + tmp3 += m_A8 * V[34]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A5 * V[30]; + tmp2 += m_A6 * V[50]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[32]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[30]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // stuntcyc static void nl_gcr_c924fe5960b1479e_20_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -57960,6 +67024,215 @@ static void nl_gcr_d4c34516ff6aa139_46_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_d5e1c37cfa2d2853_30_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + RHS0 -= go[3] * *cnV[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A3 += go[4]; + m_A4 += go[5]; + double RHS1 = Idr[4]; + RHS1 += Idr[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A5 += gt[8]; + m_A6 += go[6]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 -= go[7] * *cnV[7]; + RHS2 -= go[8] * *cnV[8]; + m_A7 += gt[9]; + m_A7 += gt[10]; + m_A7 += gt[11]; + m_A8 += go[9]; + m_A9 += go[10]; + double RHS3 = Idr[9]; + RHS3 += Idr[10]; + RHS3 += Idr[11]; + RHS3 -= go[11] * *cnV[11]; + m_A11 += gt[12]; + m_A11 += gt[13]; + m_A10 += go[12]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + RHS4 -= go[13] * *cnV[13]; + m_A14 += gt[14]; + m_A14 += gt[15]; + m_A14 += gt[16]; + m_A15 += go[14]; + m_A13 += go[15]; + double RHS5 = Idr[14]; + RHS5 += Idr[15]; + RHS5 += Idr[16]; + RHS5 -= go[16] * *cnV[16]; + m_A17 += gt[17]; + m_A17 += gt[18]; + m_A17 += gt[19]; + m_A17 += gt[20]; + m_A17 += gt[21]; + m_A17 += gt[22]; + m_A17 += gt[23]; + m_A16 += go[17]; + m_A18 += go[18]; + double RHS6 = Idr[17]; + RHS6 += Idr[18]; + RHS6 += Idr[19]; + RHS6 += Idr[20]; + RHS6 += Idr[21]; + RHS6 += Idr[22]; + RHS6 += Idr[23]; + RHS6 -= go[19] * *cnV[19]; + RHS6 -= go[20] * *cnV[20]; + RHS6 -= go[21] * *cnV[21]; + RHS6 -= go[22] * *cnV[22]; + RHS6 -= go[23] * *cnV[23]; + m_A22 += gt[24]; + m_A22 += gt[25]; + m_A22 += gt[26]; + m_A22 += gt[27]; + m_A20 += go[24]; + m_A19 += go[25]; + m_A21 += go[26]; + double RHS7 = Idr[24]; + RHS7 += Idr[25]; + RHS7 += Idr[26]; + RHS7 += Idr[27]; + RHS7 -= go[27] * *cnV[27]; + m_A29 += gt[28]; + m_A29 += gt[29]; + m_A29 += gt[30]; + m_A29 += gt[31]; + m_A29 += gt[32]; + m_A27 += go[28]; + m_A25 += go[29]; + m_A24 += go[30]; + double RHS8 = Idr[28]; + RHS8 += Idr[29]; + RHS8 += Idr[30]; + RHS8 += Idr[31]; + RHS8 += Idr[32]; + RHS8 -= go[31] * *cnV[31]; + RHS8 -= go[32] * *cnV[32]; + const double f0 = 1.0 / m_A0; + const double f0_5 = -f0 * m_A13; + m_A14 += m_A1 * f0_5; + RHS5 += f0_5 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_7 = -f1 * m_A19; + m_A22 += m_A3 * f1_7; + m_A23 += m_A4 * f1_7; + RHS7 += f1_7 * RHS1; + const double f1_8 = -f1 * m_A24; + m_A28 += m_A3 * f1_8; + m_A29 += m_A4 * f1_8; + RHS8 += f1_8 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_6 = -f2 * m_A16; + m_A18 += m_A6 * f2_6; + RHS6 += f2_6 * RHS2; + const double f2_7 = -f2 * m_A20; + m_A22 += m_A6 * f2_7; + RHS7 += f2_7 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_4 = -f3 * m_A10; + m_A11 += m_A8 * f3_4; + m_A12 += m_A9 * f3_4; + RHS4 += f3_4 * RHS3; + const double f3_8 = -f3 * m_A25; + m_A26 += m_A8 * f3_8; + m_A29 += m_A9 * f3_8; + RHS8 += f3_8 * RHS3; + const double f4 = 1.0 / m_A11; + const double f4_8 = -f4 * m_A26; + m_A29 += m_A12 * f4_8; + RHS8 += f4_8 * RHS4; + const double f5 = 1.0 / m_A14; + const double f5_7 = -f5 * m_A21; + m_A22 += m_A15 * f5_7; + RHS7 += f5_7 * RHS5; + const double f6 = 1.0 / m_A17; + const double f6_8 = -f6 * m_A27; + m_A28 += m_A18 * f6_8; + RHS8 += f6_8 * RHS6; + const double f7 = 1.0 / m_A22; + const double f7_8 = -f7 * m_A28; + m_A29 += m_A23 * f7_8; + RHS8 += f7_8 * RHS7; + V[8] = RHS8 / m_A29; + double tmp7 = 0.0; + tmp7 += m_A23 * V[8]; + V[7] = (RHS7 - tmp7) / m_A22; + double tmp6 = 0.0; + tmp6 += m_A18 * V[7]; + V[6] = (RHS6 - tmp6) / m_A17; + double tmp5 = 0.0; + tmp5 += m_A15 * V[7]; + V[5] = (RHS5 - tmp5) / m_A14; + double tmp4 = 0.0; + tmp4 += m_A12 * V[8]; + V[4] = (RHS4 - tmp4) / m_A11; + double tmp3 = 0.0; + tmp3 += m_A8 * V[4]; + tmp3 += m_A9 * V[8]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[7]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[7]; + tmp1 += m_A4 * V[8]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[5]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // boxingb static void nl_gcr_d7d45dc58b08cab9_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -58279,6 +67552,133 @@ static void nl_gcr_d8c511d38cef5f6f_34_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// frogs +static void nl_gcr_d97fd7ecc1ebba3d_19_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A3 += go[2]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 -= go[3] * *cnV[3]; + m_A4 += gt[4]; + m_A4 += gt[5]; + m_A5 += go[4]; + double RHS2 = Idr[4]; + RHS2 += Idr[5]; + RHS2 -= go[5] * *cnV[5]; + m_A6 += gt[6]; + m_A6 += gt[7]; + m_A7 += go[6]; + double RHS3 = Idr[6]; + RHS3 += Idr[7]; + RHS3 -= go[7] * *cnV[7]; + m_A8 += gt[8]; + m_A8 += gt[9]; + m_A9 += go[8]; + double RHS4 = Idr[8]; + RHS4 += Idr[9]; + RHS4 -= go[9] * *cnV[9]; + m_A10 += gt[10]; + m_A10 += gt[11]; + m_A11 += go[10]; + double RHS5 = Idr[10]; + RHS5 += Idr[11]; + RHS5 -= go[11] * *cnV[11]; + m_A18 += gt[12]; + m_A18 += gt[13]; + m_A18 += gt[14]; + m_A18 += gt[15]; + m_A18 += gt[16]; + m_A18 += gt[17]; + m_A18 += gt[18]; + m_A17 += go[12]; + m_A16 += go[13]; + m_A15 += go[14]; + m_A14 += go[15]; + m_A13 += go[16]; + m_A12 += go[17]; + double RHS6 = Idr[12]; + RHS6 += Idr[13]; + RHS6 += Idr[14]; + RHS6 += Idr[15]; + RHS6 += Idr[16]; + RHS6 += Idr[17]; + RHS6 += Idr[18]; + RHS6 -= go[18] * *cnV[18]; + const double f0 = 1.0 / m_A0; + const double f0_6 = -f0 * m_A12; + m_A18 += m_A1 * f0_6; + RHS6 += f0_6 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_6 = -f1 * m_A13; + m_A18 += m_A3 * f1_6; + RHS6 += f1_6 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_6 = -f2 * m_A14; + m_A18 += m_A5 * f2_6; + RHS6 += f2_6 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_6 = -f3 * m_A15; + m_A18 += m_A7 * f3_6; + RHS6 += f3_6 * RHS3; + const double f4 = 1.0 / m_A8; + const double f4_6 = -f4 * m_A16; + m_A18 += m_A9 * f4_6; + RHS6 += f4_6 * RHS4; + const double f5 = 1.0 / m_A10; + const double f5_6 = -f5 * m_A17; + m_A18 += m_A11 * f5_6; + RHS6 += f5_6 * RHS5; + V[6] = RHS6 / m_A18; + double tmp5 = 0.0; + tmp5 += m_A11 * V[6]; + V[5] = (RHS5 - tmp5) / m_A10; + double tmp4 = 0.0; + tmp4 += m_A9 * V[6]; + V[4] = (RHS4 - tmp4) / m_A8; + double tmp3 = 0.0; + tmp3 += m_A7 * V[6]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[6]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[6]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[6]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // warrior static void nl_gcr_da598f43329e823_27_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -59694,6 +69094,148 @@ static void nl_gcr_e02a162cb515a958_100_double_double(double * __restrict V, con V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_e03f0bc5ac056326_20_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A4 += go[3]; + m_A3 += go[4]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[5] * *cnV[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A5 += gt[8]; + m_A5 += gt[9]; + m_A7 += go[6]; + m_A6 += go[7]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + m_A10 += gt[10]; + m_A10 += gt[11]; + m_A9 += go[10]; + m_A8 += go[11]; + double RHS3 = Idr[10]; + RHS3 += Idr[11]; + m_A15 += gt[12]; + m_A15 += gt[13]; + m_A15 += gt[14]; + m_A13 += go[12]; + m_A12 += go[13]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + RHS4 += Idr[14]; + RHS4 -= go[14] * *cnV[14]; + m_A19 += gt[15]; + m_A19 += gt[16]; + m_A19 += gt[17]; + m_A19 += gt[18]; + m_A19 += gt[19]; + m_A19 += gt[20]; + m_A19 += gt[21]; + m_A17 += go[15]; + m_A18 += go[16]; + double RHS5 = Idr[15]; + RHS5 += Idr[16]; + RHS5 += Idr[17]; + RHS5 += Idr[18]; + RHS5 += Idr[19]; + RHS5 += Idr[20]; + RHS5 += Idr[21]; + RHS5 -= go[17] * *cnV[17]; + RHS5 -= go[18] * *cnV[18]; + RHS5 -= go[19] * *cnV[19]; + RHS5 -= go[20] * *cnV[20]; + RHS5 -= go[21] * *cnV[21]; + const double f0 = 1.0 / m_A0; + const double f0_3 = -f0 * m_A8; + m_A10 += m_A1 * f0_3; + RHS3 += f0_3 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_3 = -f1 * m_A9; + m_A10 += m_A3 * f1_3; + m_A11 += m_A4 * f1_3; + RHS3 += f1_3 * RHS1; + const double f1_4 = -f1 * m_A12; + m_A14 += m_A3 * f1_4; + m_A15 += m_A4 * f1_4; + RHS4 += f1_4 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_4 = -f2 * m_A13; + m_A15 += m_A6 * f2_4; + m_A16 += m_A7 * f2_4; + RHS4 += f2_4 * RHS2; + const double f2_5 = -f2 * m_A17; + m_A18 += m_A6 * f2_5; + m_A19 += m_A7 * f2_5; + RHS5 += f2_5 * RHS2; + const double f3 = 1.0 / m_A10; + const double f3_4 = -f3 * m_A14; + m_A15 += m_A11 * f3_4; + RHS4 += f3_4 * RHS3; + const double f4 = 1.0 / m_A15; + const double f4_5 = -f4 * m_A18; + m_A19 += m_A16 * f4_5; + RHS5 += f4_5 * RHS4; + V[5] = RHS5 / m_A19; + double tmp4 = 0.0; + tmp4 += m_A16 * V[5]; + V[4] = (RHS4 - tmp4) / m_A15; + double tmp3 = 0.0; + tmp3 += m_A11 * V[4]; + V[3] = (RHS3 - tmp3) / m_A10; + double tmp2 = 0.0; + tmp2 += m_A6 * V[4]; + tmp2 += m_A7 * V[5]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[3]; + tmp1 += m_A4 * V[4]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[3]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // speedfrk static void nl_gcr_e07b5b086812756c_7_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -66198,8 +75740,8 @@ static void nl_gcr_ef2f49641f433a74_94_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// astrob -static void nl_gcr_efd052e6829c33e_9_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) +// frogs +static void nl_gcr_f153eda877c6e8ed_30_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) { @@ -66213,44 +75755,568 @@ static void nl_gcr_efd052e6829c33e_9_double_double(double * __restrict V, const double m_A6(0.0); double m_A7(0.0); double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); m_A0 += gt[0]; m_A0 += gt[1]; - m_A2 += go[0]; - m_A1 += go[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A1 += go[0]; double RHS0 = Idr[0]; RHS0 += Idr[1]; - m_A4 += gt[2]; - m_A4 += gt[3]; - m_A5 += go[2]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + RHS0 -= go[3] * *cnV[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A2 += gt[6]; + m_A2 += gt[7]; + m_A2 += gt[8]; + m_A2 += gt[9]; + m_A2 += gt[10]; + m_A5 += go[4]; + m_A5 += go[5]; + m_A4 += go[6]; + m_A4 += go[7]; + m_A3 += go[8]; + m_A3 += go[9]; + double RHS1 = Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 += Idr[8]; + RHS1 += Idr[9]; + RHS1 += Idr[10]; + RHS1 -= go[10] * *cnV[10]; + m_A6 += gt[11]; + m_A6 += gt[12]; + m_A6 += gt[13]; + m_A6 += gt[14]; + m_A7 += go[11]; + m_A8 += go[12]; + m_A8 += go[13]; + double RHS2 = Idr[11]; + RHS2 += Idr[12]; + RHS2 += Idr[13]; + RHS2 += Idr[14]; + RHS2 -= go[14] * *cnV[14]; + m_A9 += gt[15]; + m_A10 += go[15]; + double RHS3 = Idr[15]; + m_A13 += gt[16]; + m_A13 += gt[17]; + m_A13 += gt[18]; + m_A13 += gt[19]; + m_A13 += gt[20]; + m_A12 += go[16]; + m_A12 += go[17]; + m_A11 += go[18]; + double RHS4 = Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + RHS4 += Idr[19]; + RHS4 += Idr[20]; + RHS4 -= go[19] * *cnV[19]; + RHS4 -= go[20] * *cnV[20]; + m_A18 += gt[21]; + m_A18 += gt[22]; + m_A18 += gt[23]; + m_A18 += gt[24]; + m_A19 += go[21]; + m_A16 += go[22]; + m_A16 += go[23]; + double RHS5 = Idr[21]; + RHS5 += Idr[22]; + RHS5 += Idr[23]; + RHS5 += Idr[24]; + RHS5 -= go[24] * *cnV[24]; + m_A22 += gt[25]; + m_A22 += gt[26]; + m_A22 += gt[27]; + m_A22 += gt[28]; + m_A22 += gt[29]; + m_A22 += gt[30]; + m_A21 += go[25]; + m_A20 += go[26]; + m_A23 += go[27]; + m_A23 += go[28]; + double RHS6 = Idr[25]; + RHS6 += Idr[26]; + RHS6 += Idr[27]; + RHS6 += Idr[28]; + RHS6 += Idr[29]; + RHS6 += Idr[30]; + RHS6 -= go[29] * *cnV[29]; + RHS6 -= go[30] * *cnV[30]; + m_A29 += gt[31]; + m_A29 += gt[32]; + m_A29 += gt[33]; + m_A29 += gt[34]; + m_A29 += gt[35]; + m_A29 += gt[36]; + m_A29 += gt[37]; + m_A29 += gt[38]; + m_A28 += go[31]; + m_A28 += go[32]; + m_A25 += go[33]; + m_A25 += go[34]; + m_A27 += go[35]; + m_A24 += go[36]; + m_A24 += go[37]; + double RHS7 = Idr[31]; + RHS7 += Idr[32]; + RHS7 += Idr[33]; + RHS7 += Idr[34]; + RHS7 += Idr[35]; + RHS7 += Idr[36]; + RHS7 += Idr[37]; + RHS7 += Idr[38]; + RHS7 -= go[38] * *cnV[38]; + const double f0 = 1.0 / m_A0; + const double f0_4 = -f0 * m_A11; + m_A13 += m_A1 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_4 = -f1 * m_A12; + m_A13 += m_A3 * f1_4; + m_A14 += m_A4 * f1_4; + m_A15 += m_A5 * f1_4; + RHS4 += f1_4 * RHS1; + const double f1_5 = -f1 * m_A16; + m_A17 += m_A3 * f1_5; + m_A18 += m_A4 * f1_5; + m_A19 += m_A5 * f1_5; + RHS5 += f1_5 * RHS1; + const double f1_7 = -f1 * m_A24; + m_A26 += m_A3 * f1_7; + m_A27 += m_A4 * f1_7; + m_A29 += m_A5 * f1_7; + RHS7 += f1_7 * RHS1; + const double f2 = 1.0 / m_A6; + const double f2_6 = -f2 * m_A20; + m_A22 += m_A7 * f2_6; + m_A23 += m_A8 * f2_6; + RHS6 += f2_6 * RHS2; + const double f2_7 = -f2 * m_A25; + m_A28 += m_A7 * f2_7; + m_A29 += m_A8 * f2_7; + RHS7 += f2_7 * RHS2; + const double f3 = 1.0 / m_A9; + const double f3_6 = -f3 * m_A21; + m_A22 += m_A10 * f3_6; + RHS6 += f3_6 * RHS3; + const double f4 = 1.0 / m_A13; + const double f4_5 = -f4 * m_A17; + m_A18 += m_A14 * f4_5; + m_A19 += m_A15 * f4_5; + RHS5 += f4_5 * RHS4; + const double f4_7 = -f4 * m_A26; + m_A27 += m_A14 * f4_7; + m_A29 += m_A15 * f4_7; + RHS7 += f4_7 * RHS4; + const double f5 = 1.0 / m_A18; + const double f5_7 = -f5 * m_A27; + m_A29 += m_A19 * f5_7; + RHS7 += f5_7 * RHS5; + const double f6 = 1.0 / m_A22; + const double f6_7 = -f6 * m_A28; + m_A29 += m_A23 * f6_7; + RHS7 += f6_7 * RHS6; + V[7] = RHS7 / m_A29; + double tmp6 = 0.0; + tmp6 += m_A23 * V[7]; + V[6] = (RHS6 - tmp6) / m_A22; + double tmp5 = 0.0; + tmp5 += m_A19 * V[7]; + V[5] = (RHS5 - tmp5) / m_A18; + double tmp4 = 0.0; + tmp4 += m_A14 * V[5]; + tmp4 += m_A15 * V[7]; + V[4] = (RHS4 - tmp4) / m_A13; + double tmp3 = 0.0; + tmp3 += m_A10 * V[6]; + V[3] = (RHS3 - tmp3) / m_A9; + double tmp2 = 0.0; + tmp2 += m_A7 * V[6]; + tmp2 += m_A8 * V[7]; + V[2] = (RHS2 - tmp2) / m_A6; + double tmp1 = 0.0; + tmp1 += m_A3 * V[4]; + tmp1 += m_A4 * V[5]; + tmp1 += m_A5 * V[7]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[4]; + V[0] = (RHS0 - tmp0) / m_A0; +} + +// frogs +static void nl_gcr_f2de20e827252602_53_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A4 += go[2]; m_A3 += go[3]; + m_A3 += go[4]; double RHS1 = Idr[2]; RHS1 += Idr[3]; - m_A8 += gt[4]; - m_A8 += gt[5]; - m_A7 += go[4]; - m_A6 += go[5]; - double RHS2 = Idr[4]; - RHS2 += Idr[5]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[5] * *cnV[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A6 += go[6]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 -= go[7] * *cnV[7]; + m_A7 += gt[8]; + m_A7 += gt[9]; + m_A7 += gt[10]; + m_A7 += gt[11]; + m_A8 += go[8]; + m_A8 += go[9]; + double RHS3 = Idr[8]; + RHS3 += Idr[9]; + RHS3 += Idr[10]; + RHS3 += Idr[11]; + RHS3 -= go[10] * *cnV[10]; + RHS3 -= go[11] * *cnV[11]; + m_A9 += gt[12]; + m_A9 += gt[13]; + m_A10 += go[12]; + m_A11 += go[13]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + m_A12 += gt[14]; + m_A12 += gt[15]; + m_A13 += go[14]; + double RHS5 = Idr[14]; + RHS5 += Idr[15]; + RHS5 -= go[15] * *cnV[15]; + m_A14 += gt[16]; + m_A14 += gt[17]; + m_A14 += gt[18]; + m_A15 += go[16]; + m_A16 += go[17]; + double RHS6 = Idr[16]; + RHS6 += Idr[17]; + RHS6 += Idr[18]; + RHS6 -= go[18] * *cnV[18]; + m_A17 += gt[19]; + m_A17 += gt[20]; + m_A17 += gt[21]; + m_A17 += gt[22]; + m_A19 += go[19]; + m_A18 += go[20]; + double RHS7 = Idr[19]; + RHS7 += Idr[20]; + RHS7 += Idr[21]; + RHS7 += Idr[22]; + RHS7 -= go[21] * *cnV[21]; + RHS7 -= go[22] * *cnV[22]; + m_A22 += gt[23]; + m_A22 += gt[24]; + m_A22 += gt[25]; + m_A22 += gt[26]; + m_A22 += gt[27]; + m_A22 += gt[28]; + m_A21 += go[23]; + m_A21 += go[24]; + m_A20 += go[25]; + double RHS8 = Idr[23]; + RHS8 += Idr[24]; + RHS8 += Idr[25]; + RHS8 += Idr[26]; + RHS8 += Idr[27]; + RHS8 += Idr[28]; + RHS8 -= go[26] * *cnV[26]; + RHS8 -= go[27] * *cnV[27]; + RHS8 -= go[28] * *cnV[28]; + m_A27 += gt[29]; + m_A27 += gt[30]; + m_A27 += gt[31]; + m_A27 += gt[32]; + m_A25 += go[29]; + m_A28 += go[30]; + m_A24 += go[31]; + double RHS9 = Idr[29]; + RHS9 += Idr[30]; + RHS9 += Idr[31]; + RHS9 += Idr[32]; + RHS9 -= go[32] * *cnV[32]; + m_A30 += gt[33]; + m_A30 += gt[34]; + m_A30 += gt[35]; + m_A30 += gt[36]; + m_A29 += go[33]; + m_A29 += go[34]; + m_A31 += go[35]; + double RHS10 = Idr[33]; + RHS10 += Idr[34]; + RHS10 += Idr[35]; + RHS10 += Idr[36]; + RHS10 -= go[36] * *cnV[36]; + m_A34 += gt[37]; + m_A34 += gt[38]; + m_A33 += go[37]; + m_A32 += go[38]; + double RHS11 = Idr[37]; + RHS11 += Idr[38]; + m_A38 += gt[39]; + m_A38 += gt[40]; + m_A38 += gt[41]; + m_A37 += go[39]; + m_A36 += go[40]; + double RHS12 = Idr[39]; + RHS12 += Idr[40]; + RHS12 += Idr[41]; + RHS12 -= go[41] * *cnV[41]; + m_A47 += gt[42]; + m_A47 += gt[43]; + m_A47 += gt[44]; + m_A47 += gt[45]; + m_A42 += go[42]; + m_A41 += go[43]; + m_A44 += go[44]; + m_A43 += go[45]; + double RHS13 = Idr[42]; + RHS13 += Idr[43]; + RHS13 += Idr[44]; + RHS13 += Idr[45]; + m_A52 += gt[46]; + m_A52 += gt[47]; + m_A52 += gt[48]; + m_A52 += gt[49]; + m_A52 += gt[50]; + m_A52 += gt[51]; + m_A52 += gt[52]; + m_A50 += go[46]; + m_A49 += go[47]; + double RHS14 = Idr[46]; + RHS14 += Idr[47]; + RHS14 += Idr[48]; + RHS14 += Idr[49]; + RHS14 += Idr[50]; + RHS14 += Idr[51]; + RHS14 += Idr[52]; + RHS14 -= go[48] * *cnV[48]; + RHS14 -= go[49] * *cnV[49]; + RHS14 -= go[50] * *cnV[50]; + RHS14 -= go[51] * *cnV[51]; + RHS14 -= go[52] * *cnV[52]; const double f0 = 1.0 / m_A0; - const double f0_1 = -f0 * m_A3; - m_A4 += m_A1 * f0_1; - m_A5 += m_A2 * f0_1; - RHS1 += f0_1 * RHS0; - const double f0_2 = -f0 * m_A6; - m_A7 += m_A1 * f0_2; - m_A8 += m_A2 * f0_2; - RHS2 += f0_2 * RHS0; - const double f1 = 1.0 / m_A4; - const double f1_2 = -f1 * m_A7; - m_A8 += m_A5 * f1_2; - RHS2 += f1_2 * RHS1; - V[2] = RHS2 / m_A8; + const double f0_8 = -f0 * m_A20; + m_A22 += m_A1 * f0_8; + RHS8 += f0_8 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_8 = -f1 * m_A21; + m_A22 += m_A3 * f1_8; + m_A23 += m_A4 * f1_8; + RHS8 += f1_8 * RHS1; + const double f1_9 = -f1 * m_A24; + m_A26 += m_A3 * f1_9; + m_A27 += m_A4 * f1_9; + RHS9 += f1_9 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_9 = -f2 * m_A25; + m_A27 += m_A6 * f2_9; + RHS9 += f2_9 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_10 = -f3 * m_A29; + m_A30 += m_A8 * f3_10; + RHS10 += f3_10 * RHS3; + const double f4 = 1.0 / m_A9; + const double f4_11 = -f4 * m_A32; + m_A34 += m_A10 * f4_11; + m_A35 += m_A11 * f4_11; + RHS11 += f4_11 * RHS4; + const double f4_13 = -f4 * m_A41; + m_A45 += m_A10 * f4_13; + m_A47 += m_A11 * f4_13; + RHS13 += f4_13 * RHS4; + const double f5 = 1.0 / m_A12; + const double f5_11 = -f5 * m_A33; + m_A34 += m_A13 * f5_11; + RHS11 += f5_11 * RHS5; + const double f6 = 1.0 / m_A14; + const double f6_12 = -f6 * m_A36; + m_A38 += m_A15 * f6_12; + m_A39 += m_A16 * f6_12; + RHS12 += f6_12 * RHS6; + const double f6_13 = -f6 * m_A42; + m_A46 += m_A15 * f6_13; + m_A47 += m_A16 * f6_13; + RHS13 += f6_13 * RHS6; + const double f6_14 = -f6 * m_A49; + m_A50 += m_A15 * f6_14; + m_A51 += m_A16 * f6_14; + RHS14 += f6_14 * RHS6; + const double f7 = 1.0 / m_A17; + const double f7_12 = -f7 * m_A37; + m_A38 += m_A18 * f7_12; + m_A40 += m_A19 * f7_12; + RHS12 += f7_12 * RHS7; + const double f8 = 1.0 / m_A22; + const double f8_9 = -f8 * m_A26; + m_A27 += m_A23 * f8_9; + RHS9 += f8_9 * RHS8; + const double f9 = 1.0 / m_A27; + const double f9_13 = -f9 * m_A43; + m_A47 += m_A28 * f9_13; + RHS13 += f9_13 * RHS9; + const double f10 = 1.0 / m_A30; + const double f10_13 = -f10 * m_A44; + m_A47 += m_A31 * f10_13; + RHS13 += f10_13 * RHS10; + const double f11 = 1.0 / m_A34; + const double f11_13 = -f11 * m_A45; + m_A47 += m_A35 * f11_13; + RHS13 += f11_13 * RHS11; + const double f12 = 1.0 / m_A38; + const double f12_13 = -f12 * m_A46; + m_A47 += m_A39 * f12_13; + m_A48 += m_A40 * f12_13; + RHS13 += f12_13 * RHS12; + const double f12_14 = -f12 * m_A50; + m_A51 += m_A39 * f12_14; + m_A52 += m_A40 * f12_14; + RHS14 += f12_14 * RHS12; + const double f13 = 1.0 / m_A47; + const double f13_14 = -f13 * m_A51; + m_A52 += m_A48 * f13_14; + RHS14 += f13_14 * RHS13; + V[14] = RHS14 / m_A52; + double tmp13 = 0.0; + tmp13 += m_A48 * V[14]; + V[13] = (RHS13 - tmp13) / m_A47; + double tmp12 = 0.0; + tmp12 += m_A39 * V[13]; + tmp12 += m_A40 * V[14]; + V[12] = (RHS12 - tmp12) / m_A38; + double tmp11 = 0.0; + tmp11 += m_A35 * V[13]; + V[11] = (RHS11 - tmp11) / m_A34; + double tmp10 = 0.0; + tmp10 += m_A31 * V[13]; + V[10] = (RHS10 - tmp10) / m_A30; + double tmp9 = 0.0; + tmp9 += m_A28 * V[13]; + V[9] = (RHS9 - tmp9) / m_A27; + double tmp8 = 0.0; + tmp8 += m_A23 * V[9]; + V[8] = (RHS8 - tmp8) / m_A22; + double tmp7 = 0.0; + tmp7 += m_A18 * V[12]; + tmp7 += m_A19 * V[14]; + V[7] = (RHS7 - tmp7) / m_A17; + double tmp6 = 0.0; + tmp6 += m_A15 * V[12]; + tmp6 += m_A16 * V[13]; + V[6] = (RHS6 - tmp6) / m_A14; + double tmp5 = 0.0; + tmp5 += m_A13 * V[11]; + V[5] = (RHS5 - tmp5) / m_A12; + double tmp4 = 0.0; + tmp4 += m_A10 * V[11]; + tmp4 += m_A11 * V[13]; + V[4] = (RHS4 - tmp4) / m_A9; + double tmp3 = 0.0; + tmp3 += m_A8 * V[10]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[9]; + V[2] = (RHS2 - tmp2) / m_A5; double tmp1 = 0.0; - tmp1 += m_A5 * V[2]; - V[1] = (RHS1 - tmp1) / m_A4; + tmp1 += m_A3 * V[8]; + tmp1 += m_A4 * V[9]; + V[1] = (RHS1 - tmp1) / m_A2; double tmp0 = 0.0; - tmp0 += m_A1 * V[1]; - tmp0 += m_A2 * V[2]; + tmp0 += m_A1 * V[8]; V[0] = (RHS0 - tmp0) / m_A0; } @@ -69647,6 +79713,560 @@ static void nl_gcr_f8f6a951fd1af6bc_7_double_double(double * __restrict V, const V[0] = (RHS0 - tmp0) / m_A0; } +// brdrline +static void nl_gcr_f99b1245e708ec85_83_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + m_A2 += gt[3]; + m_A2 += gt[4]; + m_A2 += gt[5]; + m_A4 += go[3]; + m_A3 += go[4]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + RHS1 += Idr[5]; + RHS1 -= go[5] * *cnV[5]; + m_A5 += gt[6]; + m_A5 += gt[7]; + m_A6 += go[6]; + double RHS2 = Idr[6]; + RHS2 += Idr[7]; + RHS2 -= go[7] * *cnV[7]; + m_A7 += gt[8]; + m_A7 += gt[9]; + m_A7 += gt[10]; + m_A7 += gt[11]; + m_A8 += go[8]; + double RHS3 = Idr[8]; + RHS3 += Idr[9]; + RHS3 += Idr[10]; + RHS3 += Idr[11]; + RHS3 -= go[9] * *cnV[9]; + RHS3 -= go[10] * *cnV[10]; + RHS3 -= go[11] * *cnV[11]; + m_A9 += gt[12]; + m_A9 += gt[13]; + m_A9 += gt[14]; + m_A10 += go[12]; + double RHS4 = Idr[12]; + RHS4 += Idr[13]; + RHS4 += Idr[14]; + RHS4 -= go[13] * *cnV[13]; + RHS4 -= go[14] * *cnV[14]; + m_A11 += gt[15]; + m_A11 += gt[16]; + m_A11 += gt[17]; + m_A11 += gt[18]; + m_A11 += gt[19]; + m_A11 += gt[20]; + m_A14 += go[15]; + m_A13 += go[16]; + m_A15 += go[17]; + m_A12 += go[18]; + double RHS5 = Idr[15]; + RHS5 += Idr[16]; + RHS5 += Idr[17]; + RHS5 += Idr[18]; + RHS5 += Idr[19]; + RHS5 += Idr[20]; + RHS5 -= go[19] * *cnV[19]; + RHS5 -= go[20] * *cnV[20]; + m_A16 += gt[21]; + m_A16 += gt[22]; + m_A16 += gt[23]; + m_A17 += go[21]; + double RHS6 = Idr[21]; + RHS6 += Idr[22]; + RHS6 += Idr[23]; + RHS6 -= go[22] * *cnV[22]; + RHS6 -= go[23] * *cnV[23]; + m_A18 += gt[24]; + m_A18 += gt[25]; + m_A18 += gt[26]; + m_A18 += gt[27]; + m_A19 += go[24]; + double RHS7 = Idr[24]; + RHS7 += Idr[25]; + RHS7 += Idr[26]; + RHS7 += Idr[27]; + RHS7 -= go[25] * *cnV[25]; + RHS7 -= go[26] * *cnV[26]; + RHS7 -= go[27] * *cnV[27]; + m_A22 += gt[28]; + m_A22 += gt[29]; + m_A22 += gt[30]; + m_A20 += go[28]; + m_A21 += go[29]; + double RHS8 = Idr[28]; + RHS8 += Idr[29]; + RHS8 += Idr[30]; + RHS8 -= go[30] * *cnV[30]; + m_A27 += gt[31]; + m_A27 += gt[32]; + m_A27 += gt[33]; + m_A27 += gt[34]; + m_A27 += gt[35]; + m_A27 += gt[36]; + m_A28 += go[31]; + m_A29 += go[32]; + m_A29 += go[33]; + m_A26 += go[34]; + double RHS9 = Idr[31]; + RHS9 += Idr[32]; + RHS9 += Idr[33]; + RHS9 += Idr[34]; + RHS9 += Idr[35]; + RHS9 += Idr[36]; + RHS9 -= go[35] * *cnV[35]; + RHS9 -= go[36] * *cnV[36]; + m_A31 += gt[37]; + m_A31 += gt[38]; + m_A31 += gt[39]; + m_A31 += gt[40]; + m_A31 += gt[41]; + m_A31 += gt[42]; + m_A31 += gt[43]; + m_A33 += go[37]; + m_A30 += go[38]; + double RHS10 = Idr[37]; + RHS10 += Idr[38]; + RHS10 += Idr[39]; + RHS10 += Idr[40]; + RHS10 += Idr[41]; + RHS10 += Idr[42]; + RHS10 += Idr[43]; + RHS10 -= go[39] * *cnV[39]; + RHS10 -= go[40] * *cnV[40]; + RHS10 -= go[41] * *cnV[41]; + RHS10 -= go[42] * *cnV[42]; + RHS10 -= go[43] * *cnV[43]; + m_A35 += gt[44]; + m_A35 += gt[45]; + m_A35 += gt[46]; + m_A35 += gt[47]; + m_A35 += gt[48]; + m_A35 += gt[49]; + m_A36 += go[44]; + m_A37 += go[45]; + m_A38 += go[46]; + m_A34 += go[47]; + double RHS11 = Idr[44]; + RHS11 += Idr[45]; + RHS11 += Idr[46]; + RHS11 += Idr[47]; + RHS11 += Idr[48]; + RHS11 += Idr[49]; + RHS11 -= go[48] * *cnV[48]; + RHS11 -= go[49] * *cnV[49]; + m_A40 += gt[50]; + m_A40 += gt[51]; + m_A40 += gt[52]; + m_A39 += go[50]; + m_A41 += go[51]; + double RHS12 = Idr[50]; + RHS12 += Idr[51]; + RHS12 += Idr[52]; + RHS12 -= go[52] * *cnV[52]; + m_A43 += gt[53]; + m_A43 += gt[54]; + m_A43 += gt[55]; + m_A43 += gt[56]; + m_A43 += gt[57]; + m_A43 += gt[58]; + m_A43 += gt[59]; + m_A44 += go[53]; + m_A42 += go[54]; + double RHS13 = Idr[53]; + RHS13 += Idr[54]; + RHS13 += Idr[55]; + RHS13 += Idr[56]; + RHS13 += Idr[57]; + RHS13 += Idr[58]; + RHS13 += Idr[59]; + RHS13 -= go[55] * *cnV[55]; + RHS13 -= go[56] * *cnV[56]; + RHS13 -= go[57] * *cnV[57]; + RHS13 -= go[58] * *cnV[58]; + RHS13 -= go[59] * *cnV[59]; + m_A47 += gt[60]; + m_A47 += gt[61]; + m_A50 += go[60]; + m_A45 += go[61]; + double RHS14 = Idr[60]; + RHS14 += Idr[61]; + m_A52 += gt[62]; + m_A52 += gt[63]; + m_A52 += gt[64]; + m_A52 += gt[65]; + m_A52 += gt[66]; + m_A52 += gt[67]; + m_A52 += gt[68]; + m_A51 += go[62]; + m_A53 += go[63]; + double RHS15 = Idr[62]; + RHS15 += Idr[63]; + RHS15 += Idr[64]; + RHS15 += Idr[65]; + RHS15 += Idr[66]; + RHS15 += Idr[67]; + RHS15 += Idr[68]; + RHS15 -= go[64] * *cnV[64]; + RHS15 -= go[65] * *cnV[65]; + RHS15 -= go[66] * *cnV[66]; + RHS15 -= go[67] * *cnV[67]; + RHS15 -= go[68] * *cnV[68]; + m_A61 += gt[69]; + m_A61 += gt[70]; + m_A61 += gt[71]; + m_A54 += go[69]; + m_A55 += go[70]; + m_A57 += go[71]; + double RHS16 = Idr[69]; + RHS16 += Idr[70]; + RHS16 += Idr[71]; + m_A71 += gt[72]; + m_A71 += gt[73]; + m_A71 += gt[74]; + m_A71 += gt[75]; + m_A71 += gt[76]; + m_A68 += go[72]; + m_A64 += go[73]; + m_A67 += go[74]; + m_A65 += go[75]; + m_A65 += go[76]; + double RHS17 = Idr[72]; + RHS17 += Idr[73]; + RHS17 += Idr[74]; + RHS17 += Idr[75]; + RHS17 += Idr[76]; + m_A74 += gt[77]; + m_A74 += gt[78]; + m_A74 += gt[79]; + m_A73 += go[77]; + m_A75 += go[78]; + double RHS18 = Idr[77]; + RHS18 += Idr[78]; + RHS18 += Idr[79]; + RHS18 -= go[79] * *cnV[79]; + m_A82 += gt[80]; + m_A82 += gt[81]; + m_A82 += gt[82]; + m_A82 += gt[83]; + m_A81 += go[80]; + m_A76 += go[81]; + m_A77 += go[82]; + double RHS19 = Idr[80]; + RHS19 += Idr[81]; + RHS19 += Idr[82]; + RHS19 += Idr[83]; + RHS19 -= go[83] * *cnV[83]; + const double f0 = 1.0 / m_A0; + const double f0_9 = -f0 * m_A26; + m_A27 += m_A1 * f0_9; + RHS9 += f0_9 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_10 = -f1 * m_A30; + m_A32 += m_A3 * f1_10; + m_A33 += m_A4 * f1_10; + RHS10 += f1_10 * RHS1; + const double f1_11 = -f1 * m_A34; + m_A35 += m_A3 * f1_11; + m_A38 += m_A4 * f1_11; + RHS11 += f1_11 * RHS1; + const double f1_17 = -f1 * m_A64; + m_A67 += m_A3 * f1_17; + m_A71 += m_A4 * f1_17; + RHS17 += f1_17 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_8 = -f2 * m_A20; + m_A22 += m_A6 * f2_8; + RHS8 += f2_8 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_12 = -f3 * m_A39; + m_A40 += m_A8 * f3_12; + RHS12 += f3_12 * RHS3; + const double f4 = 1.0 / m_A9; + const double f4_13 = -f4 * m_A42; + m_A44 += m_A10 * f4_13; + RHS13 += f4_13 * RHS4; + const double f4_16 = -f4 * m_A54; + m_A61 += m_A10 * f4_16; + RHS16 += f4_16 * RHS4; + const double f5 = 1.0 / m_A11; + const double f5_8 = -f5 * m_A21; + m_A22 += m_A12 * f5_8; + m_A23 += m_A13 * f5_8; + m_A24 += m_A14 * f5_8; + m_A25 += m_A15 * f5_8; + RHS8 += f5_8 * RHS5; + const double f5_14 = -f5 * m_A45; + m_A46 += m_A12 * f5_14; + m_A47 += m_A13 * f5_14; + m_A48 += m_A14 * f5_14; + m_A49 += m_A15 * f5_14; + RHS14 += f5_14 * RHS5; + const double f5_16 = -f5 * m_A55; + m_A56 += m_A12 * f5_16; + m_A59 += m_A13 * f5_16; + m_A60 += m_A14 * f5_16; + m_A61 += m_A15 * f5_16; + RHS16 += f5_16 * RHS5; + const double f6 = 1.0 / m_A16; + const double f6_15 = -f6 * m_A51; + m_A53 += m_A17 * f6_15; + RHS15 += f6_15 * RHS6; + const double f6_19 = -f6 * m_A76; + m_A82 += m_A17 * f6_19; + RHS19 += f6_19 * RHS6; + const double f7 = 1.0 / m_A18; + const double f7_18 = -f7 * m_A73; + m_A74 += m_A19 * f7_18; + RHS18 += f7_18 * RHS7; + const double f8 = 1.0 / m_A22; + const double f8_14 = -f8 * m_A46; + m_A47 += m_A23 * f8_14; + m_A48 += m_A24 * f8_14; + m_A49 += m_A25 * f8_14; + RHS14 += f8_14 * RHS8; + const double f8_16 = -f8 * m_A56; + m_A59 += m_A23 * f8_16; + m_A60 += m_A24 * f8_16; + m_A61 += m_A25 * f8_16; + RHS16 += f8_16 * RHS8; + const double f9 = 1.0 / m_A27; + const double f9_17 = -f9 * m_A65; + m_A66 += m_A28 * f9_17; + m_A71 += m_A29 * f9_17; + RHS17 += f9_17 * RHS9; + const double f10 = 1.0 / m_A31; + const double f10_17 = -f10 * m_A66; + m_A67 += m_A32 * f10_17; + m_A71 += m_A33 * f10_17; + RHS17 += f10_17 * RHS10; + const double f11 = 1.0 / m_A35; + const double f11_16 = -f11 * m_A57; + m_A58 += m_A36 * f11_16; + m_A61 += m_A37 * f11_16; + m_A62 += m_A38 * f11_16; + RHS16 += f11_16 * RHS11; + const double f11_17 = -f11 * m_A67; + m_A69 += m_A36 * f11_17; + m_A70 += m_A37 * f11_17; + m_A71 += m_A38 * f11_17; + RHS17 += f11_17 * RHS11; + const double f12 = 1.0 / m_A40; + const double f12_17 = -f12 * m_A68; + m_A71 += m_A41 * f12_17; + RHS17 += f12_17 * RHS12; + const double f13 = 1.0 / m_A43; + const double f13_16 = -f13 * m_A58; + m_A61 += m_A44 * f13_16; + RHS16 += f13_16 * RHS13; + const double f13_17 = -f13 * m_A69; + m_A70 += m_A44 * f13_17; + RHS17 += f13_17 * RHS13; + const double f14 = 1.0 / m_A47; + const double f14_16 = -f14 * m_A59; + m_A60 += m_A48 * f14_16; + m_A61 += m_A49 * f14_16; + m_A63 += m_A50 * f14_16; + RHS16 += f14_16 * RHS14; + const double f14_19 = -f14 * m_A77; + m_A78 += m_A48 * f14_19; + m_A79 += m_A49 * f14_19; + m_A82 += m_A50 * f14_19; + RHS19 += f14_19 * RHS14; + const double f15 = 1.0 / m_A52; + const double f15_16 = -f15 * m_A60; + m_A63 += m_A53 * f15_16; + RHS16 += f15_16 * RHS15; + const double f15_19 = -f15 * m_A78; + m_A82 += m_A53 * f15_19; + RHS19 += f15_19 * RHS15; + const double f16 = 1.0 / m_A61; + const double f16_17 = -f16 * m_A70; + m_A71 += m_A62 * f16_17; + m_A72 += m_A63 * f16_17; + RHS17 += f16_17 * RHS16; + const double f16_19 = -f16 * m_A79; + m_A80 += m_A62 * f16_19; + m_A82 += m_A63 * f16_19; + RHS19 += f16_19 * RHS16; + const double f17 = 1.0 / m_A71; + const double f17_19 = -f17 * m_A80; + m_A82 += m_A72 * f17_19; + RHS19 += f17_19 * RHS17; + const double f18 = 1.0 / m_A74; + const double f18_19 = -f18 * m_A81; + m_A82 += m_A75 * f18_19; + RHS19 += f18_19 * RHS18; + V[19] = RHS19 / m_A82; + double tmp18 = 0.0; + tmp18 += m_A75 * V[19]; + V[18] = (RHS18 - tmp18) / m_A74; + double tmp17 = 0.0; + tmp17 += m_A72 * V[19]; + V[17] = (RHS17 - tmp17) / m_A71; + double tmp16 = 0.0; + tmp16 += m_A62 * V[17]; + tmp16 += m_A63 * V[19]; + V[16] = (RHS16 - tmp16) / m_A61; + double tmp15 = 0.0; + tmp15 += m_A53 * V[19]; + V[15] = (RHS15 - tmp15) / m_A52; + double tmp14 = 0.0; + tmp14 += m_A48 * V[15]; + tmp14 += m_A49 * V[16]; + tmp14 += m_A50 * V[19]; + V[14] = (RHS14 - tmp14) / m_A47; + double tmp13 = 0.0; + tmp13 += m_A44 * V[16]; + V[13] = (RHS13 - tmp13) / m_A43; + double tmp12 = 0.0; + tmp12 += m_A41 * V[17]; + V[12] = (RHS12 - tmp12) / m_A40; + double tmp11 = 0.0; + tmp11 += m_A36 * V[13]; + tmp11 += m_A37 * V[16]; + tmp11 += m_A38 * V[17]; + V[11] = (RHS11 - tmp11) / m_A35; + double tmp10 = 0.0; + tmp10 += m_A32 * V[11]; + tmp10 += m_A33 * V[17]; + V[10] = (RHS10 - tmp10) / m_A31; + double tmp9 = 0.0; + tmp9 += m_A28 * V[10]; + tmp9 += m_A29 * V[17]; + V[9] = (RHS9 - tmp9) / m_A27; + double tmp8 = 0.0; + tmp8 += m_A23 * V[14]; + tmp8 += m_A24 * V[15]; + tmp8 += m_A25 * V[16]; + V[8] = (RHS8 - tmp8) / m_A22; + double tmp7 = 0.0; + tmp7 += m_A19 * V[18]; + V[7] = (RHS7 - tmp7) / m_A18; + double tmp6 = 0.0; + tmp6 += m_A17 * V[19]; + V[6] = (RHS6 - tmp6) / m_A16; + double tmp5 = 0.0; + tmp5 += m_A12 * V[8]; + tmp5 += m_A13 * V[14]; + tmp5 += m_A14 * V[15]; + tmp5 += m_A15 * V[16]; + V[5] = (RHS5 - tmp5) / m_A11; + double tmp4 = 0.0; + tmp4 += m_A10 * V[16]; + V[4] = (RHS4 - tmp4) / m_A9; + double tmp3 = 0.0; + tmp3 += m_A8 * V[12]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[8]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[11]; + tmp1 += m_A4 * V[17]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[9]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // zektor static void nl_gcr_fbff020f5f5d5a5_144_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -72420,401 +83040,449 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { #if !defined(__EMSCRIPTEN__) // elim - {"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)}, + {"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)}, // NOLINT // tankbatt - {"nl_gcr_124f7aa10f044582_16_double_double", reinterpret_cast<void *>(&nl_gcr_124f7aa10f044582_16_double_double)}, + {"nl_gcr_124f7aa10f044582_16_double_double", reinterpret_cast<void *>(&nl_gcr_124f7aa10f044582_16_double_double)}, // NOLINT // armora - {"nl_gcr_1250f340dea396ae_22_double_double", reinterpret_cast<void *>(&nl_gcr_1250f340dea396ae_22_double_double)}, + {"nl_gcr_1250f340dea396ae_22_double_double", reinterpret_cast<void *>(&nl_gcr_1250f340dea396ae_22_double_double)}, // NOLINT +// astrob + {"nl_gcr_13833bf8c127deaa_154_double_double", reinterpret_cast<void *>(&nl_gcr_13833bf8c127deaa_154_double_double)}, // NOLINT // pongf - {"nl_gcr_13e7b5ac1a260dbf_10_double_double", reinterpret_cast<void *>(&nl_gcr_13e7b5ac1a260dbf_10_double_double)}, + {"nl_gcr_13e7b5ac1a260dbf_10_double_double", reinterpret_cast<void *>(&nl_gcr_13e7b5ac1a260dbf_10_double_double)}, // NOLINT // tailg - {"nl_gcr_144ed14e6bafdb_119_double_double", reinterpret_cast<void *>(&nl_gcr_144ed14e6bafdb_119_double_double)}, + {"nl_gcr_144ed14e6bafdb_119_double_double", reinterpret_cast<void *>(&nl_gcr_144ed14e6bafdb_119_double_double)}, // NOLINT // spacewar - {"nl_gcr_15e8f6fb021de0f9_28_double_double", reinterpret_cast<void *>(&nl_gcr_15e8f6fb021de0f9_28_double_double)}, -// armora - {"nl_gcr_1692de755a535408_9_double_double", reinterpret_cast<void *>(&nl_gcr_1692de755a535408_9_double_double)}, + {"nl_gcr_15e8f6fb021de0f9_28_double_double", reinterpret_cast<void *>(&nl_gcr_15e8f6fb021de0f9_28_double_double)}, // NOLINT // dpatrol - {"nl_gcr_18f4d9160b51d613_20_double_double", reinterpret_cast<void *>(&nl_gcr_18f4d9160b51d613_20_double_double)}, + {"nl_gcr_18f4d9160b51d613_20_double_double", reinterpret_cast<void *>(&nl_gcr_18f4d9160b51d613_20_double_double)}, // NOLINT // starhawk - {"nl_gcr_1f1086787c94f97c_40_double_double", reinterpret_cast<void *>(&nl_gcr_1f1086787c94f97c_40_double_double)}, + {"nl_gcr_1f1086787c94f97c_40_double_double", reinterpret_cast<void *>(&nl_gcr_1f1086787c94f97c_40_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_1fad5cda2646cf42_30_double_double", reinterpret_cast<void *>(&nl_gcr_1fad5cda2646cf42_30_double_double)}, + {"nl_gcr_1fad5cda2646cf42_30_double_double", reinterpret_cast<void *>(&nl_gcr_1fad5cda2646cf42_30_double_double)}, // NOLINT +// brdrline + {"nl_gcr_1fec893028a7b809_34_double_double", reinterpret_cast<void *>(&nl_gcr_1fec893028a7b809_34_double_double)}, // NOLINT // sspeedr - {"nl_gcr_2294220d3c91e762_176_double_double", reinterpret_cast<void *>(&nl_gcr_2294220d3c91e762_176_double_double)}, + {"nl_gcr_2294220d3c91e762_176_double_double", reinterpret_cast<void *>(&nl_gcr_2294220d3c91e762_176_double_double)}, // NOLINT +// headon + {"nl_gcr_24023c8529f6bdb3_97_double_double", reinterpret_cast<void *>(&nl_gcr_24023c8529f6bdb3_97_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_24643c159711f292_95_double_double", reinterpret_cast<void *>(&nl_gcr_24643c159711f292_95_double_double)}, + {"nl_gcr_24643c159711f292_95_double_double", reinterpret_cast<void *>(&nl_gcr_24643c159711f292_95_double_double)}, // NOLINT +// frogs + {"nl_gcr_263b618097fad01_38_double_double", reinterpret_cast<void *>(&nl_gcr_263b618097fad01_38_double_double)}, // NOLINT +// brdrline + {"nl_gcr_2753fc1815ce0cba_23_double_double", reinterpret_cast<void *>(&nl_gcr_2753fc1815ce0cba_23_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_287a160e7c36b5b0_96_double_double", reinterpret_cast<void *>(&nl_gcr_287a160e7c36b5b0_96_double_double)}, + {"nl_gcr_287a160e7c36b5b0_96_double_double", reinterpret_cast<void *>(&nl_gcr_287a160e7c36b5b0_96_double_double)}, // NOLINT // elim - {"nl_gcr_28b736fe552777a9_45_double_double", reinterpret_cast<void *>(&nl_gcr_28b736fe552777a9_45_double_double)}, + {"nl_gcr_28b736fe552777a9_45_double_double", reinterpret_cast<void *>(&nl_gcr_28b736fe552777a9_45_double_double)}, // NOLINT // kidniki - {"nl_gcr_294dde1e0ecca6d0_37_double_double", reinterpret_cast<void *>(&nl_gcr_294dde1e0ecca6d0_37_double_double)}, + {"nl_gcr_294dde1e0ecca6d0_37_double_double", reinterpret_cast<void *>(&nl_gcr_294dde1e0ecca6d0_37_double_double)}, // NOLINT // ripoff - {"nl_gcr_295cf2e2f3d489bf_12_double_double", reinterpret_cast<void *>(&nl_gcr_295cf2e2f3d489bf_12_double_double)}, + {"nl_gcr_295cf2e2f3d489bf_12_double_double", reinterpret_cast<void *>(&nl_gcr_295cf2e2f3d489bf_12_double_double)}, // NOLINT // spacfury - {"nl_gcr_2a153513d3e8e2cc_53_double_double", reinterpret_cast<void *>(&nl_gcr_2a153513d3e8e2cc_53_double_double)}, + {"nl_gcr_2a153513d3e8e2cc_53_double_double", reinterpret_cast<void *>(&nl_gcr_2a153513d3e8e2cc_53_double_double)}, // NOLINT // boxingb - {"nl_gcr_2f84bc98d737730b_22_double_double", reinterpret_cast<void *>(&nl_gcr_2f84bc98d737730b_22_double_double)}, -// astrob - {"nl_gcr_30fc51fe03b164cb_178_double_double", reinterpret_cast<void *>(&nl_gcr_30fc51fe03b164cb_178_double_double)}, + {"nl_gcr_2f84bc98d737730b_22_double_double", reinterpret_cast<void *>(&nl_gcr_2f84bc98d737730b_22_double_double)}, // NOLINT +// brdrline + {"nl_gcr_30923b54310ae144_8_double_double", reinterpret_cast<void *>(&nl_gcr_30923b54310ae144_8_double_double)}, // NOLINT // tankbatt - {"nl_gcr_328d886b444b586b_137_double_double", reinterpret_cast<void *>(&nl_gcr_328d886b444b586b_137_double_double)}, + {"nl_gcr_328d886b444b586b_137_double_double", reinterpret_cast<void *>(&nl_gcr_328d886b444b586b_137_double_double)}, // NOLINT // astrob - {"nl_gcr_339c6b457f339538_159_double_double", reinterpret_cast<void *>(&nl_gcr_339c6b457f339538_159_double_double)}, + {"nl_gcr_339c6b457f339538_159_double_double", reinterpret_cast<void *>(&nl_gcr_339c6b457f339538_159_double_double)}, // NOLINT // solarq - {"nl_gcr_34e910fc1896999f_76_double_double", reinterpret_cast<void *>(&nl_gcr_34e910fc1896999f_76_double_double)}, + {"nl_gcr_34e910fc1896999f_76_double_double", reinterpret_cast<void *>(&nl_gcr_34e910fc1896999f_76_double_double)}, // NOLINT +// brdrline + {"nl_gcr_3c79fd354e01fa8c_89_double_double", reinterpret_cast<void *>(&nl_gcr_3c79fd354e01fa8c_89_double_double)}, // NOLINT // sspeedr - {"nl_gcr_3e833834e5ce5aee_13_double_double", reinterpret_cast<void *>(&nl_gcr_3e833834e5ce5aee_13_double_double)}, + {"nl_gcr_3e833834e5ce5aee_13_double_double", reinterpret_cast<void *>(&nl_gcr_3e833834e5ce5aee_13_double_double)}, // NOLINT // astrob - {"nl_gcr_41c6441d98369158_20_double_double", reinterpret_cast<void *>(&nl_gcr_41c6441d98369158_20_double_double)}, + {"nl_gcr_41c6441d98369158_20_double_double", reinterpret_cast<void *>(&nl_gcr_41c6441d98369158_20_double_double)}, // NOLINT // warrior - {"nl_gcr_42a31ce5c187b308_12_double_double", reinterpret_cast<void *>(&nl_gcr_42a31ce5c187b308_12_double_double)}, + {"nl_gcr_42a31ce5c187b308_12_double_double", reinterpret_cast<void *>(&nl_gcr_42a31ce5c187b308_12_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_42c57d523cac30d0_122_double_double", reinterpret_cast<void *>(&nl_gcr_42c57d523cac30d0_122_double_double)}, + {"nl_gcr_42c57d523cac30d0_122_double_double", reinterpret_cast<void *>(&nl_gcr_42c57d523cac30d0_122_double_double)}, // NOLINT // ripoff - {"nl_gcr_43188bf576854ae0_10_double_double", reinterpret_cast<void *>(&nl_gcr_43188bf576854ae0_10_double_double)}, + {"nl_gcr_43188bf576854ae0_10_double_double", reinterpret_cast<void *>(&nl_gcr_43188bf576854ae0_10_double_double)}, // NOLINT // destroyr - {"nl_gcr_4334c95878d1be92_399_double_double", reinterpret_cast<void *>(&nl_gcr_4334c95878d1be92_399_double_double)}, + {"nl_gcr_4334c95878d1be92_399_double_double", reinterpret_cast<void *>(&nl_gcr_4334c95878d1be92_399_double_double)}, // NOLINT +// brdrline + {"nl_gcr_437326911721091_77_double_double", reinterpret_cast<void *>(&nl_gcr_437326911721091_77_double_double)}, // NOLINT // kidniki - {"nl_gcr_43f7ff9bc651cc7a_198_double_double", reinterpret_cast<void *>(&nl_gcr_43f7ff9bc651cc7a_198_double_double)}, + {"nl_gcr_43f7ff9bc651cc7a_198_double_double", reinterpret_cast<void *>(&nl_gcr_43f7ff9bc651cc7a_198_double_double)}, // NOLINT // gamemachine - {"nl_gcr_491f95430bfdfd05_19_double_double", reinterpret_cast<void *>(&nl_gcr_491f95430bfdfd05_19_double_double)}, + {"nl_gcr_491f95430bfdfd05_19_double_double", reinterpret_cast<void *>(&nl_gcr_491f95430bfdfd05_19_double_double)}, // NOLINT +// frogs + {"nl_gcr_494f233b1a947be1_88_double_double", reinterpret_cast<void *>(&nl_gcr_494f233b1a947be1_88_double_double)}, // NOLINT // sspeedr - {"nl_gcr_4a8e2b707bbac8a6_95_double_double", reinterpret_cast<void *>(&nl_gcr_4a8e2b707bbac8a6_95_double_double)}, + {"nl_gcr_4a8e2b707bbac8a6_95_double_double", reinterpret_cast<void *>(&nl_gcr_4a8e2b707bbac8a6_95_double_double)}, // NOLINT // ripoff - {"nl_gcr_4b5ecfbb8f9fa97b_29_double_double", reinterpret_cast<void *>(&nl_gcr_4b5ecfbb8f9fa97b_29_double_double)}, + {"nl_gcr_4b5ecfbb8f9fa97b_29_double_double", reinterpret_cast<void *>(&nl_gcr_4b5ecfbb8f9fa97b_29_double_double)}, // NOLINT // gtrak10 - {"nl_gcr_4c46fdf7c0037727_43_double_double", reinterpret_cast<void *>(&nl_gcr_4c46fdf7c0037727_43_double_double)}, + {"nl_gcr_4c46fdf7c0037727_43_double_double", reinterpret_cast<void *>(&nl_gcr_4c46fdf7c0037727_43_double_double)}, // NOLINT // solarq - {"nl_gcr_4cb524006206eb1a_25_double_double", reinterpret_cast<void *>(&nl_gcr_4cb524006206eb1a_25_double_double)}, + {"nl_gcr_4cb524006206eb1a_25_double_double", reinterpret_cast<void *>(&nl_gcr_4cb524006206eb1a_25_double_double)}, // NOLINT // spacfury - {"nl_gcr_4dbd0f2aec7ef707_110_double_double", reinterpret_cast<void *>(&nl_gcr_4dbd0f2aec7ef707_110_double_double)}, + {"nl_gcr_4dbd0f2aec7ef707_110_double_double", reinterpret_cast<void *>(&nl_gcr_4dbd0f2aec7ef707_110_double_double)}, // NOLINT // solarq - {"nl_gcr_4e4931ccbfb7a3c_70_double_double", reinterpret_cast<void *>(&nl_gcr_4e4931ccbfb7a3c_70_double_double)}, + {"nl_gcr_4e4931ccbfb7a3c_70_double_double", reinterpret_cast<void *>(&nl_gcr_4e4931ccbfb7a3c_70_double_double)}, // NOLINT // fireone - {"nl_gcr_4f2b2f3cdc384f75_41_double_double", reinterpret_cast<void *>(&nl_gcr_4f2b2f3cdc384f75_41_double_double)}, + {"nl_gcr_4f2b2f3cdc384f75_41_double_double", reinterpret_cast<void *>(&nl_gcr_4f2b2f3cdc384f75_41_double_double)}, // NOLINT // boxingb - {"nl_gcr_50f5194a994d56ec_16_double_double", reinterpret_cast<void *>(&nl_gcr_50f5194a994d56ec_16_double_double)}, + {"nl_gcr_50f5194a994d56ec_16_double_double", reinterpret_cast<void *>(&nl_gcr_50f5194a994d56ec_16_double_double)}, // NOLINT // starhawk - {"nl_gcr_528a27fe9ed07d67_45_double_double", reinterpret_cast<void *>(&nl_gcr_528a27fe9ed07d67_45_double_double)}, + {"nl_gcr_528a27fe9ed07d67_45_double_double", reinterpret_cast<void *>(&nl_gcr_528a27fe9ed07d67_45_double_double)}, // NOLINT // astrob - {"nl_gcr_536c3652eb3bc075_46_double_double", reinterpret_cast<void *>(&nl_gcr_536c3652eb3bc075_46_double_double)}, + {"nl_gcr_536c3652eb3bc075_46_double_double", reinterpret_cast<void *>(&nl_gcr_536c3652eb3bc075_46_double_double)}, // NOLINT // boxingb - {"nl_gcr_53e1117fdb16f546_23_double_double", reinterpret_cast<void *>(&nl_gcr_53e1117fdb16f546_23_double_double)}, + {"nl_gcr_53e1117fdb16f546_23_double_double", reinterpret_cast<void *>(&nl_gcr_53e1117fdb16f546_23_double_double)}, // NOLINT // cheekyms - {"nl_gcr_546396f65ce48700_12_double_double", reinterpret_cast<void *>(&nl_gcr_546396f65ce48700_12_double_double)}, -// dpatrol - {"nl_gcr_59cb6bf7cb9d17dc_7_double_double", reinterpret_cast<void *>(&nl_gcr_59cb6bf7cb9d17dc_7_double_double)}, + {"nl_gcr_546396f65ce48700_12_double_double", reinterpret_cast<void *>(&nl_gcr_546396f65ce48700_12_double_double)}, // NOLINT +// brdrline + {"nl_gcr_576f391d0418cb76_13_double_double", reinterpret_cast<void *>(&nl_gcr_576f391d0418cb76_13_double_double)}, // NOLINT +// brdrline + {"nl_gcr_59cb6bf7cb9d17dc_7_double_double", reinterpret_cast<void *>(&nl_gcr_59cb6bf7cb9d17dc_7_double_double)}, // NOLINT // breakout - {"nl_gcr_5a3419e2809520de_13_double_double", reinterpret_cast<void *>(&nl_gcr_5a3419e2809520de_13_double_double)}, + {"nl_gcr_5a3419e2809520de_13_double_double", reinterpret_cast<void *>(&nl_gcr_5a3419e2809520de_13_double_double)}, // NOLINT // segausb - {"nl_gcr_5b73834d5f313d38_12_double_double", reinterpret_cast<void *>(&nl_gcr_5b73834d5f313d38_12_double_double)}, + {"nl_gcr_5b73834d5f313d38_12_double_double", reinterpret_cast<void *>(&nl_gcr_5b73834d5f313d38_12_double_double)}, // NOLINT // tailg - {"nl_gcr_5ccf7da1202da2e5_31_double_double", reinterpret_cast<void *>(&nl_gcr_5ccf7da1202da2e5_31_double_double)}, + {"nl_gcr_5ccf7da1202da2e5_31_double_double", reinterpret_cast<void *>(&nl_gcr_5ccf7da1202da2e5_31_double_double)}, // NOLINT // starcas - {"nl_gcr_5d550fc7441617a2_109_double_double", reinterpret_cast<void *>(&nl_gcr_5d550fc7441617a2_109_double_double)}, + {"nl_gcr_5d550fc7441617a2_109_double_double", reinterpret_cast<void *>(&nl_gcr_5d550fc7441617a2_109_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_6041272373b8603c_178_double_double", reinterpret_cast<void *>(&nl_gcr_6041272373b8603c_178_double_double)}, + {"nl_gcr_6041272373b8603c_178_double_double", reinterpret_cast<void *>(&nl_gcr_6041272373b8603c_178_double_double)}, // NOLINT +// astrob + {"nl_gcr_62464664b1c5aa1e_27_double_double", reinterpret_cast<void *>(&nl_gcr_62464664b1c5aa1e_27_double_double)}, // NOLINT // solarq - {"nl_gcr_62612f71055b8fd4_303_double_double", reinterpret_cast<void *>(&nl_gcr_62612f71055b8fd4_303_double_double)}, + {"nl_gcr_62612f71055b8fd4_303_double_double", reinterpret_cast<void *>(&nl_gcr_62612f71055b8fd4_303_double_double)}, // NOLINT // konami1x - {"nl_gcr_62b99b9904a8c804_49_double_double", reinterpret_cast<void *>(&nl_gcr_62b99b9904a8c804_49_double_double)}, + {"nl_gcr_62b99b9904a8c804_49_double_double", reinterpret_cast<void *>(&nl_gcr_62b99b9904a8c804_49_double_double)}, // NOLINT // fireone - {"nl_gcr_643133e86b2b1628_73_double_double", reinterpret_cast<void *>(&nl_gcr_643133e86b2b1628_73_double_double)}, + {"nl_gcr_643133e86b2b1628_73_double_double", reinterpret_cast<void *>(&nl_gcr_643133e86b2b1628_73_double_double)}, // NOLINT // starfire - {"nl_gcr_649ebca7fa6793ed_27_double_double", reinterpret_cast<void *>(&nl_gcr_649ebca7fa6793ed_27_double_double)}, + {"nl_gcr_649ebca7fa6793ed_27_double_double", reinterpret_cast<void *>(&nl_gcr_649ebca7fa6793ed_27_double_double)}, // NOLINT // armora - {"nl_gcr_64e460d8f716cd89_58_double_double", reinterpret_cast<void *>(&nl_gcr_64e460d8f716cd89_58_double_double)}, + {"nl_gcr_64e460d8f716cd89_58_double_double", reinterpret_cast<void *>(&nl_gcr_64e460d8f716cd89_58_double_double)}, // NOLINT // flyball - {"nl_gcr_6622b53554e3776_291_double_double", reinterpret_cast<void *>(&nl_gcr_6622b53554e3776_291_double_double)}, + {"nl_gcr_6622b53554e3776_291_double_double", reinterpret_cast<void *>(&nl_gcr_6622b53554e3776_291_double_double)}, // NOLINT // solarq - {"nl_gcr_66496d6073aca98e_20_double_double", reinterpret_cast<void *>(&nl_gcr_66496d6073aca98e_20_double_double)}, + {"nl_gcr_66496d6073aca98e_20_double_double", reinterpret_cast<void *>(&nl_gcr_66496d6073aca98e_20_double_double)}, // NOLINT // starhawk - {"nl_gcr_67838e11f714c455_12_double_double", reinterpret_cast<void *>(&nl_gcr_67838e11f714c455_12_double_double)}, + {"nl_gcr_67838e11f714c455_12_double_double", reinterpret_cast<void *>(&nl_gcr_67838e11f714c455_12_double_double)}, // NOLINT // ripoff - {"nl_gcr_698d5dd47fb16d5_16_double_double", reinterpret_cast<void *>(&nl_gcr_698d5dd47fb16d5_16_double_double)}, + {"nl_gcr_698d5dd47fb16d5_16_double_double", reinterpret_cast<void *>(&nl_gcr_698d5dd47fb16d5_16_double_double)}, // NOLINT // astrob - {"nl_gcr_6c24726f30e8dc34_15_double_double", reinterpret_cast<void *>(&nl_gcr_6c24726f30e8dc34_15_double_double)}, + {"nl_gcr_6c24726f30e8dc34_15_double_double", reinterpret_cast<void *>(&nl_gcr_6c24726f30e8dc34_15_double_double)}, // NOLINT // spacfury - {"nl_gcr_6eae7b15cd376318_43_double_double", reinterpret_cast<void *>(&nl_gcr_6eae7b15cd376318_43_double_double)}, + {"nl_gcr_6eae7b15cd376318_43_double_double", reinterpret_cast<void *>(&nl_gcr_6eae7b15cd376318_43_double_double)}, // NOLINT // barrier - {"nl_gcr_6ef39a62161d596c_47_double_double", reinterpret_cast<void *>(&nl_gcr_6ef39a62161d596c_47_double_double)}, + {"nl_gcr_6ef39a62161d596c_47_double_double", reinterpret_cast<void *>(&nl_gcr_6ef39a62161d596c_47_double_double)}, // NOLINT // starhawk - {"nl_gcr_723fa454468a93d_7_double_double", reinterpret_cast<void *>(&nl_gcr_723fa454468a93d_7_double_double)}, + {"nl_gcr_723fa454468a93d_7_double_double", reinterpret_cast<void *>(&nl_gcr_723fa454468a93d_7_double_double)}, // NOLINT // cheekyms - {"nl_gcr_733c72a820fdbd1f_7_double_double", reinterpret_cast<void *>(&nl_gcr_733c72a820fdbd1f_7_double_double)}, + {"nl_gcr_733c72a820fdbd1f_7_double_double", reinterpret_cast<void *>(&nl_gcr_733c72a820fdbd1f_7_double_double)}, // NOLINT // tailg - {"nl_gcr_7388106355fb27c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_7388106355fb27c3_12_double_double)}, + {"nl_gcr_7388106355fb27c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_7388106355fb27c3_12_double_double)}, // NOLINT // tp1985 - {"nl_gcr_73f2ba8ad4a45b26_10_double_double", reinterpret_cast<void *>(&nl_gcr_73f2ba8ad4a45b26_10_double_double)}, + {"nl_gcr_73f2ba8ad4a45b26_10_double_double", reinterpret_cast<void *>(&nl_gcr_73f2ba8ad4a45b26_10_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_7425594cec8024ad_30_double_double", reinterpret_cast<void *>(&nl_gcr_7425594cec8024ad_30_double_double)}, + {"nl_gcr_7425594cec8024ad_30_double_double", reinterpret_cast<void *>(&nl_gcr_7425594cec8024ad_30_double_double)}, // NOLINT // tp1985 - {"nl_gcr_74349e9889a2630b_7_double_double", reinterpret_cast<void *>(&nl_gcr_74349e9889a2630b_7_double_double)}, + {"nl_gcr_74349e9889a2630b_7_double_double", reinterpret_cast<void *>(&nl_gcr_74349e9889a2630b_7_double_double)}, // NOLINT // gunfight - {"nl_gcr_743595e64cee0a5e_112_double_double", reinterpret_cast<void *>(&nl_gcr_743595e64cee0a5e_112_double_double)}, + {"nl_gcr_743595e64cee0a5e_112_double_double", reinterpret_cast<void *>(&nl_gcr_743595e64cee0a5e_112_double_double)}, // NOLINT +// brdrline + {"nl_gcr_75400df5d559a266_75_double_double", reinterpret_cast<void *>(&nl_gcr_75400df5d559a266_75_double_double)}, // NOLINT +// frogs + {"nl_gcr_75852e71cc632a65_33_double_double", reinterpret_cast<void *>(&nl_gcr_75852e71cc632a65_33_double_double)}, // NOLINT // ripoff - {"nl_gcr_76c9e236353caed1_35_double_double", reinterpret_cast<void *>(&nl_gcr_76c9e236353caed1_35_double_double)}, + {"nl_gcr_76c9e236353caed1_35_double_double", reinterpret_cast<void *>(&nl_gcr_76c9e236353caed1_35_double_double)}, // NOLINT // gamemachine - {"nl_gcr_782d79b5cbe953b1_7_double_double", reinterpret_cast<void *>(&nl_gcr_782d79b5cbe953b1_7_double_double)}, + {"nl_gcr_782d79b5cbe953b1_7_double_double", reinterpret_cast<void *>(&nl_gcr_782d79b5cbe953b1_7_double_double)}, // NOLINT // barrier - {"nl_gcr_79e756c5892cf87d_31_double_double", reinterpret_cast<void *>(&nl_gcr_79e756c5892cf87d_31_double_double)}, + {"nl_gcr_79e756c5892cf87d_31_double_double", reinterpret_cast<void *>(&nl_gcr_79e756c5892cf87d_31_double_double)}, // NOLINT // breakout - {"nl_gcr_7a42b97d838ca073_7_double_double", reinterpret_cast<void *>(&nl_gcr_7a42b97d838ca073_7_double_double)}, + {"nl_gcr_7a42b97d838ca073_7_double_double", reinterpret_cast<void *>(&nl_gcr_7a42b97d838ca073_7_double_double)}, // NOLINT // fireone - {"nl_gcr_7aee4423e3fdbfda_128_double_double", reinterpret_cast<void *>(&nl_gcr_7aee4423e3fdbfda_128_double_double)}, + {"nl_gcr_7aee4423e3fdbfda_128_double_double", reinterpret_cast<void *>(&nl_gcr_7aee4423e3fdbfda_128_double_double)}, // NOLINT // astrob - {"nl_gcr_7c86a9bc1c6aef4c_7_double_double", reinterpret_cast<void *>(&nl_gcr_7c86a9bc1c6aef4c_7_double_double)}, + {"nl_gcr_7c86a9bc1c6aef4c_7_double_double", reinterpret_cast<void *>(&nl_gcr_7c86a9bc1c6aef4c_7_double_double)}, // NOLINT // solarq - {"nl_gcr_7caaa135bff3d9f3_15_double_double", reinterpret_cast<void *>(&nl_gcr_7caaa135bff3d9f3_15_double_double)}, + {"nl_gcr_7caaa135bff3d9f3_15_double_double", reinterpret_cast<void *>(&nl_gcr_7caaa135bff3d9f3_15_double_double)}, // NOLINT // warrior - {"nl_gcr_8003d4625273fa4d_10_double_double", reinterpret_cast<void *>(&nl_gcr_8003d4625273fa4d_10_double_double)}, + {"nl_gcr_8003d4625273fa4d_10_double_double", reinterpret_cast<void *>(&nl_gcr_8003d4625273fa4d_10_double_double)}, // NOLINT // kidniki - {"nl_gcr_8046625a0fe0959_21_double_double", reinterpret_cast<void *>(&nl_gcr_8046625a0fe0959_21_double_double)}, + {"nl_gcr_8046625a0fe0959_21_double_double", reinterpret_cast<void *>(&nl_gcr_8046625a0fe0959_21_double_double)}, // NOLINT // mario - {"nl_gcr_80b4b1e5cc58d303_29_double_double", reinterpret_cast<void *>(&nl_gcr_80b4b1e5cc58d303_29_double_double)}, + {"nl_gcr_80b4b1e5cc58d303_29_double_double", reinterpret_cast<void *>(&nl_gcr_80b4b1e5cc58d303_29_double_double)}, // NOLINT +// frogs + {"nl_gcr_815733e3f2e05029_9_double_double", reinterpret_cast<void *>(&nl_gcr_815733e3f2e05029_9_double_double)}, // NOLINT // elim - {"nl_gcr_81f40a54af2ca202_10_double_double", reinterpret_cast<void *>(&nl_gcr_81f40a54af2ca202_10_double_double)}, + {"nl_gcr_81f40a54af2ca202_10_double_double", reinterpret_cast<void *>(&nl_gcr_81f40a54af2ca202_10_double_double)}, // NOLINT +// frogs + {"nl_gcr_84425fea9033e75d_7_double_double", reinterpret_cast<void *>(&nl_gcr_84425fea9033e75d_7_double_double)}, // NOLINT // sundance - {"nl_gcr_8446e63d7842f6a6_70_double_double", reinterpret_cast<void *>(&nl_gcr_8446e63d7842f6a6_70_double_double)}, + {"nl_gcr_8446e63d7842f6a6_70_double_double", reinterpret_cast<void *>(&nl_gcr_8446e63d7842f6a6_70_double_double)}, // NOLINT // dpatrol - {"nl_gcr_85652d3e3ada285a_10_double_double", reinterpret_cast<void *>(&nl_gcr_85652d3e3ada285a_10_double_double)}, + {"nl_gcr_85652d3e3ada285a_10_double_double", reinterpret_cast<void *>(&nl_gcr_85652d3e3ada285a_10_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_861d39f81d29d51_12_double_double", reinterpret_cast<void *>(&nl_gcr_861d39f81d29d51_12_double_double)}, + {"nl_gcr_861d39f81d29d51_12_double_double", reinterpret_cast<void *>(&nl_gcr_861d39f81d29d51_12_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_864a61c57bac9c38_123_double_double", reinterpret_cast<void *>(&nl_gcr_864a61c57bac9c38_123_double_double)}, + {"nl_gcr_864a61c57bac9c38_123_double_double", reinterpret_cast<void *>(&nl_gcr_864a61c57bac9c38_123_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_87cb2c78a2628efd_7_double_double", reinterpret_cast<void *>(&nl_gcr_87cb2c78a2628efd_7_double_double)}, + {"nl_gcr_87cb2c78a2628efd_7_double_double", reinterpret_cast<void *>(&nl_gcr_87cb2c78a2628efd_7_double_double)}, // NOLINT // starcas - {"nl_gcr_88a8ef5f6bd43d48_12_double_double", reinterpret_cast<void *>(&nl_gcr_88a8ef5f6bd43d48_12_double_double)}, + {"nl_gcr_88a8ef5f6bd43d48_12_double_double", reinterpret_cast<void *>(&nl_gcr_88a8ef5f6bd43d48_12_double_double)}, // NOLINT // breakout - {"nl_gcr_8a1565d1413f42f7_31_double_double", reinterpret_cast<void *>(&nl_gcr_8a1565d1413f42f7_31_double_double)}, + {"nl_gcr_8a1565d1413f42f7_31_double_double", reinterpret_cast<void *>(&nl_gcr_8a1565d1413f42f7_31_double_double)}, // NOLINT // starhawk - {"nl_gcr_8b1ac1e181eec3fc_40_double_double", reinterpret_cast<void *>(&nl_gcr_8b1ac1e181eec3fc_40_double_double)}, + {"nl_gcr_8b1ac1e181eec3fc_40_double_double", reinterpret_cast<void *>(&nl_gcr_8b1ac1e181eec3fc_40_double_double)}, // NOLINT // rebound - {"nl_gcr_8bec817b324dcc3_28_double_double", reinterpret_cast<void *>(&nl_gcr_8bec817b324dcc3_28_double_double)}, + {"nl_gcr_8bec817b324dcc3_28_double_double", reinterpret_cast<void *>(&nl_gcr_8bec817b324dcc3_28_double_double)}, // NOLINT // cocoloco - {"nl_gcr_8c0f7f2284333de5_16_double_double", reinterpret_cast<void *>(&nl_gcr_8c0f7f2284333de5_16_double_double)}, + {"nl_gcr_8c0f7f2284333de5_16_double_double", reinterpret_cast<void *>(&nl_gcr_8c0f7f2284333de5_16_double_double)}, // NOLINT // spacfury - {"nl_gcr_8c1dd4afcf0f8ea2_15_double_double", reinterpret_cast<void *>(&nl_gcr_8c1dd4afcf0f8ea2_15_double_double)}, + {"nl_gcr_8c1dd4afcf0f8ea2_15_double_double", reinterpret_cast<void *>(&nl_gcr_8c1dd4afcf0f8ea2_15_double_double)}, // NOLINT // fireone - {"nl_gcr_8c512fd6a6dabc50_35_double_double", reinterpret_cast<void *>(&nl_gcr_8c512fd6a6dabc50_35_double_double)}, + {"nl_gcr_8c512fd6a6dabc50_35_double_double", reinterpret_cast<void *>(&nl_gcr_8c512fd6a6dabc50_35_double_double)}, // NOLINT // segausb - {"nl_gcr_8cc4eb213eaeef9b_30_double_double", reinterpret_cast<void *>(&nl_gcr_8cc4eb213eaeef9b_30_double_double)}, + {"nl_gcr_8cc4eb213eaeef9b_30_double_double", reinterpret_cast<void *>(&nl_gcr_8cc4eb213eaeef9b_30_double_double)}, // NOLINT // starcrus - {"nl_gcr_8d7bddf33d942482_129_double_double", reinterpret_cast<void *>(&nl_gcr_8d7bddf33d942482_129_double_double)}, + {"nl_gcr_8d7bddf33d942482_129_double_double", reinterpret_cast<void *>(&nl_gcr_8d7bddf33d942482_129_double_double)}, // NOLINT // tank - {"nl_gcr_930b64361c2cdba8_328_double_double", reinterpret_cast<void *>(&nl_gcr_930b64361c2cdba8_328_double_double)}, + {"nl_gcr_930b64361c2cdba8_328_double_double", reinterpret_cast<void *>(&nl_gcr_930b64361c2cdba8_328_double_double)}, // NOLINT // gamemachine - {"nl_gcr_934712b55bb3b2b2_10_double_double", reinterpret_cast<void *>(&nl_gcr_934712b55bb3b2b2_10_double_double)}, + {"nl_gcr_934712b55bb3b2b2_10_double_double", reinterpret_cast<void *>(&nl_gcr_934712b55bb3b2b2_10_double_double)}, // NOLINT // kidniki - {"nl_gcr_9a5874c8e2da79d2_37_double_double", reinterpret_cast<void *>(&nl_gcr_9a5874c8e2da79d2_37_double_double)}, + {"nl_gcr_9a5874c8e2da79d2_37_double_double", reinterpret_cast<void *>(&nl_gcr_9a5874c8e2da79d2_37_double_double)}, // NOLINT // fireone - {"nl_gcr_9aa159329f86ca8b_70_double_double", reinterpret_cast<void *>(&nl_gcr_9aa159329f86ca8b_70_double_double)}, + {"nl_gcr_9aa159329f86ca8b_70_double_double", reinterpret_cast<void *>(&nl_gcr_9aa159329f86ca8b_70_double_double)}, // NOLINT // warrior - {"nl_gcr_9c975530a1a529d6_7_double_double", reinterpret_cast<void *>(&nl_gcr_9c975530a1a529d6_7_double_double)}, + {"nl_gcr_9c975530a1a529d6_7_double_double", reinterpret_cast<void *>(&nl_gcr_9c975530a1a529d6_7_double_double)}, // NOLINT // kidniki - {"nl_gcr_9f141889c2091efc_24_double_double", reinterpret_cast<void *>(&nl_gcr_9f141889c2091efc_24_double_double)}, + {"nl_gcr_9f141889c2091efc_24_double_double", reinterpret_cast<void *>(&nl_gcr_9f141889c2091efc_24_double_double)}, // NOLINT // segas16b_audio - {"nl_gcr_9f7104c5e25c87dd_111_double_double", reinterpret_cast<void *>(&nl_gcr_9f7104c5e25c87dd_111_double_double)}, + {"nl_gcr_9f7104c5e25c87dd_111_double_double", reinterpret_cast<void *>(&nl_gcr_9f7104c5e25c87dd_111_double_double)}, // NOLINT // boxingb - {"nl_gcr_a0bf548977306172_25_double_double", reinterpret_cast<void *>(&nl_gcr_a0bf548977306172_25_double_double)}, + {"nl_gcr_a0bf548977306172_25_double_double", reinterpret_cast<void *>(&nl_gcr_a0bf548977306172_25_double_double)}, // NOLINT // boxingb - {"nl_gcr_a1132c8737d5d463_96_double_double", reinterpret_cast<void *>(&nl_gcr_a1132c8737d5d463_96_double_double)}, + {"nl_gcr_a1132c8737d5d463_96_double_double", reinterpret_cast<void *>(&nl_gcr_a1132c8737d5d463_96_double_double)}, // NOLINT // astrob - {"nl_gcr_a41a44bd5c424f88_13_double_double", reinterpret_cast<void *>(&nl_gcr_a41a44bd5c424f88_13_double_double)}, + {"nl_gcr_a41a44bd5c424f88_13_double_double", reinterpret_cast<void *>(&nl_gcr_a41a44bd5c424f88_13_double_double)}, // NOLINT // tp1985 - {"nl_gcr_a4540ffea06b4346_26_double_double", reinterpret_cast<void *>(&nl_gcr_a4540ffea06b4346_26_double_double)}, + {"nl_gcr_a4540ffea06b4346_26_double_double", reinterpret_cast<void *>(&nl_gcr_a4540ffea06b4346_26_double_double)}, // NOLINT // tailg - {"nl_gcr_a46301cd3479b8db_15_double_double", reinterpret_cast<void *>(&nl_gcr_a46301cd3479b8db_15_double_double)}, + {"nl_gcr_a46301cd3479b8db_15_double_double", reinterpret_cast<void *>(&nl_gcr_a46301cd3479b8db_15_double_double)}, // NOLINT // barrier - {"nl_gcr_a50a4b733e95414a_10_double_double", reinterpret_cast<void *>(&nl_gcr_a50a4b733e95414a_10_double_double)}, + {"nl_gcr_a50a4b733e95414a_10_double_double", reinterpret_cast<void *>(&nl_gcr_a50a4b733e95414a_10_double_double)}, // NOLINT // starcas - {"nl_gcr_a582a424cb61c678_62_double_double", reinterpret_cast<void *>(&nl_gcr_a582a424cb61c678_62_double_double)}, + {"nl_gcr_a582a424cb61c678_62_double_double", reinterpret_cast<void *>(&nl_gcr_a582a424cb61c678_62_double_double)}, // NOLINT // tank - {"nl_gcr_a63d1344e34bef4b_36_double_double", reinterpret_cast<void *>(&nl_gcr_a63d1344e34bef4b_36_double_double)}, + {"nl_gcr_a63d1344e34bef4b_36_double_double", reinterpret_cast<void *>(&nl_gcr_a63d1344e34bef4b_36_double_double)}, // NOLINT // boxingb - {"nl_gcr_a6b734322b3ea924_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6b734322b3ea924_22_double_double)}, + {"nl_gcr_a6b734322b3ea924_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6b734322b3ea924_22_double_double)}, // NOLINT // armora - {"nl_gcr_a6cfda6668b153c2_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6cfda6668b153c2_22_double_double)}, + {"nl_gcr_a6cfda6668b153c2_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6cfda6668b153c2_22_double_double)}, // NOLINT // boxingb - {"nl_gcr_a6f74be7f61e6db2_29_double_double", reinterpret_cast<void *>(&nl_gcr_a6f74be7f61e6db2_29_double_double)}, + {"nl_gcr_a6f74be7f61e6db2_29_double_double", reinterpret_cast<void *>(&nl_gcr_a6f74be7f61e6db2_29_double_double)}, // NOLINT // carpolo - {"nl_gcr_a8f1d076330f06b7_34_double_double", reinterpret_cast<void *>(&nl_gcr_a8f1d076330f06b7_34_double_double)}, + {"nl_gcr_a8f1d076330f06b7_34_double_double", reinterpret_cast<void *>(&nl_gcr_a8f1d076330f06b7_34_double_double)}, // NOLINT // breakout - {"nl_gcr_a971eeb2ef76f75f_13_double_double", reinterpret_cast<void *>(&nl_gcr_a971eeb2ef76f75f_13_double_double)}, + {"nl_gcr_a971eeb2ef76f75f_13_double_double", reinterpret_cast<void *>(&nl_gcr_a971eeb2ef76f75f_13_double_double)}, // NOLINT // ripoff - {"nl_gcr_aa07266ef5d420d1_11_double_double", reinterpret_cast<void *>(&nl_gcr_aa07266ef5d420d1_11_double_double)}, + {"nl_gcr_aa07266ef5d420d1_11_double_double", reinterpret_cast<void *>(&nl_gcr_aa07266ef5d420d1_11_double_double)}, // NOLINT +// brdrline + {"nl_gcr_aa68b74ffdea9bd8_47_double_double", reinterpret_cast<void *>(&nl_gcr_aa68b74ffdea9bd8_47_double_double)}, // NOLINT +// frogs + {"nl_gcr_ab8d1ff6aa7499d8_119_double_double", reinterpret_cast<void *>(&nl_gcr_ab8d1ff6aa7499d8_119_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_ab9144d965a37e4_113_double_double", reinterpret_cast<void *>(&nl_gcr_ab9144d965a37e4_113_double_double)}, + {"nl_gcr_ab9144d965a37e4_113_double_double", reinterpret_cast<void *>(&nl_gcr_ab9144d965a37e4_113_double_double)}, // NOLINT // sspeedr - {"nl_gcr_ac1e401ddf971e15_10_double_double", reinterpret_cast<void *>(&nl_gcr_ac1e401ddf971e15_10_double_double)}, + {"nl_gcr_ac1e401ddf971e15_10_double_double", reinterpret_cast<void *>(&nl_gcr_ac1e401ddf971e15_10_double_double)}, // NOLINT // starfire - {"nl_gcr_aceb6035dfb557c9_12_double_double", reinterpret_cast<void *>(&nl_gcr_aceb6035dfb557c9_12_double_double)}, + {"nl_gcr_aceb6035dfb557c9_12_double_double", reinterpret_cast<void *>(&nl_gcr_aceb6035dfb557c9_12_double_double)}, // NOLINT // sundance - {"nl_gcr_ad6dba01ff2425c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_ad6dba01ff2425c3_12_double_double)}, + {"nl_gcr_ad6dba01ff2425c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_ad6dba01ff2425c3_12_double_double)}, // NOLINT // rebound - {"nl_gcr_ae15f7f8a55fc96_7_double_double", reinterpret_cast<void *>(&nl_gcr_ae15f7f8a55fc96_7_double_double)}, + {"nl_gcr_ae15f7f8a55fc96_7_double_double", reinterpret_cast<void *>(&nl_gcr_ae15f7f8a55fc96_7_double_double)}, // NOLINT // armora - {"nl_gcr_afcde432efdafb81_56_double_double", reinterpret_cast<void *>(&nl_gcr_afcde432efdafb81_56_double_double)}, + {"nl_gcr_afcde432efdafb81_56_double_double", reinterpret_cast<void *>(&nl_gcr_afcde432efdafb81_56_double_double)}, // NOLINT // mario - {"nl_gcr_afce66fb47d3c5f3_62_double_double", reinterpret_cast<void *>(&nl_gcr_afce66fb47d3c5f3_62_double_double)}, + {"nl_gcr_afce66fb47d3c5f3_62_double_double", reinterpret_cast<void *>(&nl_gcr_afce66fb47d3c5f3_62_double_double)}, // NOLINT // spacewar - {"nl_gcr_b09deef9a25aecaf_24_double_double", reinterpret_cast<void *>(&nl_gcr_b09deef9a25aecaf_24_double_double)}, + {"nl_gcr_b09deef9a25aecaf_24_double_double", reinterpret_cast<void *>(&nl_gcr_b09deef9a25aecaf_24_double_double)}, // NOLINT // spacfury - {"nl_gcr_b1db23287df1da54_175_double_double", reinterpret_cast<void *>(&nl_gcr_b1db23287df1da54_175_double_double)}, + {"nl_gcr_b1db23287df1da54_175_double_double", reinterpret_cast<void *>(&nl_gcr_b1db23287df1da54_175_double_double)}, // NOLINT // segaspeech - {"nl_gcr_b22769fbf3159a8d_21_double_double", reinterpret_cast<void *>(&nl_gcr_b22769fbf3159a8d_21_double_double)}, + {"nl_gcr_b22769fbf3159a8d_21_double_double", reinterpret_cast<void *>(&nl_gcr_b22769fbf3159a8d_21_double_double)}, // NOLINT +// brdrline + {"nl_gcr_b66df357763b1dce_97_double_double", reinterpret_cast<void *>(&nl_gcr_b66df357763b1dce_97_double_double)}, // NOLINT // breakout - {"nl_gcr_b66ff415b228d5f8_10_double_double", reinterpret_cast<void *>(&nl_gcr_b66ff415b228d5f8_10_double_double)}, + {"nl_gcr_b66ff415b228d5f8_10_double_double", reinterpret_cast<void *>(&nl_gcr_b66ff415b228d5f8_10_double_double)}, // NOLINT // starcas - {"nl_gcr_b7344e05aac90017_65_double_double", reinterpret_cast<void *>(&nl_gcr_b7344e05aac90017_65_double_double)}, + {"nl_gcr_b7344e05aac90017_65_double_double", reinterpret_cast<void *>(&nl_gcr_b7344e05aac90017_65_double_double)}, // NOLINT // starfire - {"nl_gcr_b75e0baeb501e907_23_double_double", reinterpret_cast<void *>(&nl_gcr_b75e0baeb501e907_23_double_double)}, + {"nl_gcr_b75e0baeb501e907_23_double_double", reinterpret_cast<void *>(&nl_gcr_b75e0baeb501e907_23_double_double)}, // NOLINT // spacfury - {"nl_gcr_b7b209d222c0a9a6_91_double_double", reinterpret_cast<void *>(&nl_gcr_b7b209d222c0a9a6_91_double_double)}, + {"nl_gcr_b7b209d222c0a9a6_91_double_double", reinterpret_cast<void *>(&nl_gcr_b7b209d222c0a9a6_91_double_double)}, // NOLINT // boxingb - {"nl_gcr_b8d6d148a50bdb8f_55_double_double", reinterpret_cast<void *>(&nl_gcr_b8d6d148a50bdb8f_55_double_double)}, + {"nl_gcr_b8d6d148a50bdb8f_55_double_double", reinterpret_cast<void *>(&nl_gcr_b8d6d148a50bdb8f_55_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_bb501e6a23177009_57_double_double", reinterpret_cast<void *>(&nl_gcr_bb501e6a23177009_57_double_double)}, + {"nl_gcr_bb501e6a23177009_57_double_double", reinterpret_cast<void *>(&nl_gcr_bb501e6a23177009_57_double_double)}, // NOLINT // elim - {"nl_gcr_bb56fa5325163fc3_15_double_double", reinterpret_cast<void *>(&nl_gcr_bb56fa5325163fc3_15_double_double)}, + {"nl_gcr_bb56fa5325163fc3_15_double_double", reinterpret_cast<void *>(&nl_gcr_bb56fa5325163fc3_15_double_double)}, // NOLINT // starfire - {"nl_gcr_bd1514d7defd4062_9_double_double", reinterpret_cast<void *>(&nl_gcr_bd1514d7defd4062_9_double_double)}, + {"nl_gcr_bd1514d7defd4062_9_double_double", reinterpret_cast<void *>(&nl_gcr_bd1514d7defd4062_9_double_double)}, // NOLINT // ripoff - {"nl_gcr_be7c805100c522fd_59_double_double", reinterpret_cast<void *>(&nl_gcr_be7c805100c522fd_59_double_double)}, + {"nl_gcr_be7c805100c522fd_59_double_double", reinterpret_cast<void *>(&nl_gcr_be7c805100c522fd_59_double_double)}, // NOLINT // elim - {"nl_gcr_be831e5faa508573_150_double_double", reinterpret_cast<void *>(&nl_gcr_be831e5faa508573_150_double_double)}, + {"nl_gcr_be831e5faa508573_150_double_double", reinterpret_cast<void *>(&nl_gcr_be831e5faa508573_150_double_double)}, // NOLINT // warrior - {"nl_gcr_bff07f8d339f7cc4_89_double_double", reinterpret_cast<void *>(&nl_gcr_bff07f8d339f7cc4_89_double_double)}, + {"nl_gcr_bff07f8d339f7cc4_89_double_double", reinterpret_cast<void *>(&nl_gcr_bff07f8d339f7cc4_89_double_double)}, // NOLINT +// brdrline + {"nl_gcr_c05df522276e65fd_134_double_double", reinterpret_cast<void *>(&nl_gcr_c05df522276e65fd_134_double_double)}, // NOLINT // fireone - {"nl_gcr_c1d22fe6e895255d_79_double_double", reinterpret_cast<void *>(&nl_gcr_c1d22fe6e895255d_79_double_double)}, + {"nl_gcr_c1d22fe6e895255d_79_double_double", reinterpret_cast<void *>(&nl_gcr_c1d22fe6e895255d_79_double_double)}, // NOLINT // starcrus - {"nl_gcr_c2e616f3de30f15b_31_double_double", reinterpret_cast<void *>(&nl_gcr_c2e616f3de30f15b_31_double_double)}, + {"nl_gcr_c2e616f3de30f15b_31_double_double", reinterpret_cast<void *>(&nl_gcr_c2e616f3de30f15b_31_double_double)}, // NOLINT // tailg - {"nl_gcr_c4cec7aed23b7b94_23_double_double", reinterpret_cast<void *>(&nl_gcr_c4cec7aed23b7b94_23_double_double)}, + {"nl_gcr_c4cec7aed23b7b94_23_double_double", reinterpret_cast<void *>(&nl_gcr_c4cec7aed23b7b94_23_double_double)}, // NOLINT +// brdrline + {"nl_gcr_c5b523ed6a9677e6_21_double_double", reinterpret_cast<void *>(&nl_gcr_c5b523ed6a9677e6_21_double_double)}, // NOLINT // segausb - {"nl_gcr_c61e08cf5e35918_84_double_double", reinterpret_cast<void *>(&nl_gcr_c61e08cf5e35918_84_double_double)}, + {"nl_gcr_c61e08cf5e35918_84_double_double", reinterpret_cast<void *>(&nl_gcr_c61e08cf5e35918_84_double_double)}, // NOLINT // popeye - {"nl_gcr_c6f25bb06e161d1c_50_double_double", reinterpret_cast<void *>(&nl_gcr_c6f25bb06e161d1c_50_double_double)}, + {"nl_gcr_c6f25bb06e161d1c_50_double_double", reinterpret_cast<void *>(&nl_gcr_c6f25bb06e161d1c_50_double_double)}, // NOLINT // flyball - {"nl_gcr_c74b1a65978d7121_7_double_double", reinterpret_cast<void *>(&nl_gcr_c74b1a65978d7121_7_double_double)}, + {"nl_gcr_c74b1a65978d7121_7_double_double", reinterpret_cast<void *>(&nl_gcr_c74b1a65978d7121_7_double_double)}, // NOLINT +// headon + {"nl_gcr_c90daff82be2d052_350_double_double", reinterpret_cast<void *>(&nl_gcr_c90daff82be2d052_350_double_double)}, // NOLINT // stuntcyc - {"nl_gcr_c924fe5960b1479e_20_double_double", reinterpret_cast<void *>(&nl_gcr_c924fe5960b1479e_20_double_double)}, + {"nl_gcr_c924fe5960b1479e_20_double_double", reinterpret_cast<void *>(&nl_gcr_c924fe5960b1479e_20_double_double)}, // NOLINT // dpatrol - {"nl_gcr_ca68d70bd8f2f62e_22_double_double", reinterpret_cast<void *>(&nl_gcr_ca68d70bd8f2f62e_22_double_double)}, + {"nl_gcr_ca68d70bd8f2f62e_22_double_double", reinterpret_cast<void *>(&nl_gcr_ca68d70bd8f2f62e_22_double_double)}, // NOLINT // breakout - {"nl_gcr_cb2aae3366e0ac1c_7_double_double", reinterpret_cast<void *>(&nl_gcr_cb2aae3366e0ac1c_7_double_double)}, + {"nl_gcr_cb2aae3366e0ac1c_7_double_double", reinterpret_cast<void *>(&nl_gcr_cb2aae3366e0ac1c_7_double_double)}, // NOLINT // barrier - {"nl_gcr_cc913f9c3f9293e7_19_double_double", reinterpret_cast<void *>(&nl_gcr_cc913f9c3f9293e7_19_double_double)}, + {"nl_gcr_cc913f9c3f9293e7_19_double_double", reinterpret_cast<void *>(&nl_gcr_cc913f9c3f9293e7_19_double_double)}, // NOLINT // fireone - {"nl_gcr_cca3d1a4219e2ec0_153_double_double", reinterpret_cast<void *>(&nl_gcr_cca3d1a4219e2ec0_153_double_double)}, + {"nl_gcr_cca3d1a4219e2ec0_153_double_double", reinterpret_cast<void *>(&nl_gcr_cca3d1a4219e2ec0_153_double_double)}, // NOLINT // 1942 - {"nl_gcr_ce766957cb26ff3e_90_double_double", reinterpret_cast<void *>(&nl_gcr_ce766957cb26ff3e_90_double_double)}, + {"nl_gcr_ce766957cb26ff3e_90_double_double", reinterpret_cast<void *>(&nl_gcr_ce766957cb26ff3e_90_double_double)}, // NOLINT // astrob - {"nl_gcr_cf1018e7ed626623_43_double_double", reinterpret_cast<void *>(&nl_gcr_cf1018e7ed626623_43_double_double)}, + {"nl_gcr_cf1018e7ed626623_43_double_double", reinterpret_cast<void *>(&nl_gcr_cf1018e7ed626623_43_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_cfd3bbf5fbba4765_71_double_double", reinterpret_cast<void *>(&nl_gcr_cfd3bbf5fbba4765_71_double_double)}, + {"nl_gcr_cfd3bbf5fbba4765_71_double_double", reinterpret_cast<void *>(&nl_gcr_cfd3bbf5fbba4765_71_double_double)}, // NOLINT // gunfight - {"nl_gcr_d05b3dbe370c7904_14_double_double", reinterpret_cast<void *>(&nl_gcr_d05b3dbe370c7904_14_double_double)}, + {"nl_gcr_d05b3dbe370c7904_14_double_double", reinterpret_cast<void *>(&nl_gcr_d05b3dbe370c7904_14_double_double)}, // NOLINT // barrier - {"nl_gcr_d06bd7ddbfd17b5e_15_double_double", reinterpret_cast<void *>(&nl_gcr_d06bd7ddbfd17b5e_15_double_double)}, + {"nl_gcr_d06bd7ddbfd17b5e_15_double_double", reinterpret_cast<void *>(&nl_gcr_d06bd7ddbfd17b5e_15_double_double)}, // NOLINT // elim - {"nl_gcr_d13f9c6838af6aeb_13_double_double", reinterpret_cast<void *>(&nl_gcr_d13f9c6838af6aeb_13_double_double)}, + {"nl_gcr_d13f9c6838af6aeb_13_double_double", reinterpret_cast<void *>(&nl_gcr_d13f9c6838af6aeb_13_double_double)}, // NOLINT // elim - {"nl_gcr_d190a0e3b8e1f4a7_7_double_double", reinterpret_cast<void *>(&nl_gcr_d190a0e3b8e1f4a7_7_double_double)}, + {"nl_gcr_d190a0e3b8e1f4a7_7_double_double", reinterpret_cast<void *>(&nl_gcr_d190a0e3b8e1f4a7_7_double_double)}, // NOLINT // elim - {"nl_gcr_d224211d1af6811d_12_double_double", reinterpret_cast<void *>(&nl_gcr_d224211d1af6811d_12_double_double)}, + {"nl_gcr_d224211d1af6811d_12_double_double", reinterpret_cast<void *>(&nl_gcr_d224211d1af6811d_12_double_double)}, // NOLINT // armora - {"nl_gcr_d27a39bc93616187_45_double_double", reinterpret_cast<void *>(&nl_gcr_d27a39bc93616187_45_double_double)}, + {"nl_gcr_d27a39bc93616187_45_double_double", reinterpret_cast<void *>(&nl_gcr_d27a39bc93616187_45_double_double)}, // NOLINT // elim - {"nl_gcr_d2ea3f267b959e8b_20_double_double", reinterpret_cast<void *>(&nl_gcr_d2ea3f267b959e8b_20_double_double)}, + {"nl_gcr_d2ea3f267b959e8b_20_double_double", reinterpret_cast<void *>(&nl_gcr_d2ea3f267b959e8b_20_double_double)}, // NOLINT // starfire - {"nl_gcr_d32effa2b0ea54a1_438_double_double", reinterpret_cast<void *>(&nl_gcr_d32effa2b0ea54a1_438_double_double)}, + {"nl_gcr_d32effa2b0ea54a1_438_double_double", reinterpret_cast<void *>(&nl_gcr_d32effa2b0ea54a1_438_double_double)}, // NOLINT // spacfury - {"nl_gcr_d4c34516ff6aa139_46_double_double", reinterpret_cast<void *>(&nl_gcr_d4c34516ff6aa139_46_double_double)}, + {"nl_gcr_d4c34516ff6aa139_46_double_double", reinterpret_cast<void *>(&nl_gcr_d4c34516ff6aa139_46_double_double)}, // NOLINT +// brdrline + {"nl_gcr_d5e1c37cfa2d2853_30_double_double", reinterpret_cast<void *>(&nl_gcr_d5e1c37cfa2d2853_30_double_double)}, // NOLINT // boxingb - {"nl_gcr_d7d45dc58b08cab9_10_double_double", reinterpret_cast<void *>(&nl_gcr_d7d45dc58b08cab9_10_double_double)}, + {"nl_gcr_d7d45dc58b08cab9_10_double_double", reinterpret_cast<void *>(&nl_gcr_d7d45dc58b08cab9_10_double_double)}, // NOLINT // kidniki - {"nl_gcr_d8c511d38cef5f6f_34_double_double", reinterpret_cast<void *>(&nl_gcr_d8c511d38cef5f6f_34_double_double)}, + {"nl_gcr_d8c511d38cef5f6f_34_double_double", reinterpret_cast<void *>(&nl_gcr_d8c511d38cef5f6f_34_double_double)}, // NOLINT +// frogs + {"nl_gcr_d97fd7ecc1ebba3d_19_double_double", reinterpret_cast<void *>(&nl_gcr_d97fd7ecc1ebba3d_19_double_double)}, // NOLINT // warrior - {"nl_gcr_da598f43329e823_27_double_double", reinterpret_cast<void *>(&nl_gcr_da598f43329e823_27_double_double)}, + {"nl_gcr_da598f43329e823_27_double_double", reinterpret_cast<void *>(&nl_gcr_da598f43329e823_27_double_double)}, // NOLINT // pongf - {"nl_gcr_dbafc5ddaf7a08f8_35_double_double", reinterpret_cast<void *>(&nl_gcr_dbafc5ddaf7a08f8_35_double_double)}, + {"nl_gcr_dbafc5ddaf7a08f8_35_double_double", reinterpret_cast<void *>(&nl_gcr_dbafc5ddaf7a08f8_35_double_double)}, // NOLINT // fireone - {"nl_gcr_dcbecbc127c5868f_36_double_double", reinterpret_cast<void *>(&nl_gcr_dcbecbc127c5868f_36_double_double)}, + {"nl_gcr_dcbecbc127c5868f_36_double_double", reinterpret_cast<void *>(&nl_gcr_dcbecbc127c5868f_36_double_double)}, // NOLINT // sundance - {"nl_gcr_e02a162cb515a958_100_double_double", reinterpret_cast<void *>(&nl_gcr_e02a162cb515a958_100_double_double)}, + {"nl_gcr_e02a162cb515a958_100_double_double", reinterpret_cast<void *>(&nl_gcr_e02a162cb515a958_100_double_double)}, // NOLINT +// brdrline + {"nl_gcr_e03f0bc5ac056326_20_double_double", reinterpret_cast<void *>(&nl_gcr_e03f0bc5ac056326_20_double_double)}, // NOLINT // speedfrk - {"nl_gcr_e07b5b086812756c_7_double_double", reinterpret_cast<void *>(&nl_gcr_e07b5b086812756c_7_double_double)}, + {"nl_gcr_e07b5b086812756c_7_double_double", reinterpret_cast<void *>(&nl_gcr_e07b5b086812756c_7_double_double)}, // NOLINT // solarq - {"nl_gcr_e081f90c2e0313f6_45_double_double", reinterpret_cast<void *>(&nl_gcr_e081f90c2e0313f6_45_double_double)}, + {"nl_gcr_e081f90c2e0313f6_45_double_double", reinterpret_cast<void *>(&nl_gcr_e081f90c2e0313f6_45_double_double)}, // NOLINT // spacewar - {"nl_gcr_e0b492db40bba291_20_double_double", reinterpret_cast<void *>(&nl_gcr_e0b492db40bba291_20_double_double)}, + {"nl_gcr_e0b492db40bba291_20_double_double", reinterpret_cast<void *>(&nl_gcr_e0b492db40bba291_20_double_double)}, // NOLINT // flyball - {"nl_gcr_e15d9316d59cdad9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e15d9316d59cdad9_7_double_double)}, + {"nl_gcr_e15d9316d59cdad9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e15d9316d59cdad9_7_double_double)}, // NOLINT // speedfrk - {"nl_gcr_e4f2ffbf201a3d0c_37_double_double", reinterpret_cast<void *>(&nl_gcr_e4f2ffbf201a3d0c_37_double_double)}, + {"nl_gcr_e4f2ffbf201a3d0c_37_double_double", reinterpret_cast<void *>(&nl_gcr_e4f2ffbf201a3d0c_37_double_double)}, // NOLINT // pongf - {"nl_gcr_e51b463cd890ef6d_7_double_double", reinterpret_cast<void *>(&nl_gcr_e51b463cd890ef6d_7_double_double)}, + {"nl_gcr_e51b463cd890ef6d_7_double_double", reinterpret_cast<void *>(&nl_gcr_e51b463cd890ef6d_7_double_double)}, // NOLINT // sundance - {"nl_gcr_e5b7711fac1ea80c_8_double_double", reinterpret_cast<void *>(&nl_gcr_e5b7711fac1ea80c_8_double_double)}, + {"nl_gcr_e5b7711fac1ea80c_8_double_double", reinterpret_cast<void *>(&nl_gcr_e5b7711fac1ea80c_8_double_double)}, // NOLINT // ripoff - {"nl_gcr_e60314070a75e121_20_double_double", reinterpret_cast<void *>(&nl_gcr_e60314070a75e121_20_double_double)}, + {"nl_gcr_e60314070a75e121_20_double_double", reinterpret_cast<void *>(&nl_gcr_e60314070a75e121_20_double_double)}, // NOLINT // cheekyms - {"nl_gcr_e75302e17c866419_150_double_double", reinterpret_cast<void *>(&nl_gcr_e75302e17c866419_150_double_double)}, + {"nl_gcr_e75302e17c866419_150_double_double", reinterpret_cast<void *>(&nl_gcr_e75302e17c866419_150_double_double)}, // NOLINT // elim - {"nl_gcr_e76692c10e79997e_36_double_double", reinterpret_cast<void *>(&nl_gcr_e76692c10e79997e_36_double_double)}, + {"nl_gcr_e76692c10e79997e_36_double_double", reinterpret_cast<void *>(&nl_gcr_e76692c10e79997e_36_double_double)}, // NOLINT // fireone - {"nl_gcr_e7fb484f621b3ab9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e7fb484f621b3ab9_7_double_double)}, + {"nl_gcr_e7fb484f621b3ab9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e7fb484f621b3ab9_7_double_double)}, // NOLINT // elim - {"nl_gcr_e8aeb165b69427ec_18_double_double", reinterpret_cast<void *>(&nl_gcr_e8aeb165b69427ec_18_double_double)}, + {"nl_gcr_e8aeb165b69427ec_18_double_double", reinterpret_cast<void *>(&nl_gcr_e8aeb165b69427ec_18_double_double)}, // NOLINT // spacewar - {"nl_gcr_e9e8211f43d8f4b3_22_double_double", reinterpret_cast<void *>(&nl_gcr_e9e8211f43d8f4b3_22_double_double)}, + {"nl_gcr_e9e8211f43d8f4b3_22_double_double", reinterpret_cast<void *>(&nl_gcr_e9e8211f43d8f4b3_22_double_double)}, // NOLINT // boxingb - {"nl_gcr_ea2b6e3a05e6ef0b_23_double_double", reinterpret_cast<void *>(&nl_gcr_ea2b6e3a05e6ef0b_23_double_double)}, + {"nl_gcr_ea2b6e3a05e6ef0b_23_double_double", reinterpret_cast<void *>(&nl_gcr_ea2b6e3a05e6ef0b_23_double_double)}, // NOLINT // starcas - {"nl_gcr_ec4f6d2dad5961b9_64_double_double", reinterpret_cast<void *>(&nl_gcr_ec4f6d2dad5961b9_64_double_double)}, + {"nl_gcr_ec4f6d2dad5961b9_64_double_double", reinterpret_cast<void *>(&nl_gcr_ec4f6d2dad5961b9_64_double_double)}, // NOLINT // barrier - {"nl_gcr_ecf17036ce1c07cf_10_double_double", reinterpret_cast<void *>(&nl_gcr_ecf17036ce1c07cf_10_double_double)}, + {"nl_gcr_ecf17036ce1c07cf_10_double_double", reinterpret_cast<void *>(&nl_gcr_ecf17036ce1c07cf_10_double_double)}, // NOLINT // armora - {"nl_gcr_ee2cacaa15d32491_67_double_double", reinterpret_cast<void *>(&nl_gcr_ee2cacaa15d32491_67_double_double)}, + {"nl_gcr_ee2cacaa15d32491_67_double_double", reinterpret_cast<void *>(&nl_gcr_ee2cacaa15d32491_67_double_double)}, // NOLINT // astrob - {"nl_gcr_ee61dcaa355fc625_285_double_double", reinterpret_cast<void *>(&nl_gcr_ee61dcaa355fc625_285_double_double)}, + {"nl_gcr_ee61dcaa355fc625_285_double_double", reinterpret_cast<void *>(&nl_gcr_ee61dcaa355fc625_285_double_double)}, // NOLINT // starcrus - {"nl_gcr_ef2f49641f433a74_94_double_double", reinterpret_cast<void *>(&nl_gcr_ef2f49641f433a74_94_double_double)}, -// astrob - {"nl_gcr_efd052e6829c33e_9_double_double", reinterpret_cast<void *>(&nl_gcr_efd052e6829c33e_9_double_double)}, + {"nl_gcr_ef2f49641f433a74_94_double_double", reinterpret_cast<void *>(&nl_gcr_ef2f49641f433a74_94_double_double)}, // NOLINT +// frogs + {"nl_gcr_f153eda877c6e8ed_30_double_double", reinterpret_cast<void *>(&nl_gcr_f153eda877c6e8ed_30_double_double)}, // NOLINT +// frogs + {"nl_gcr_f2de20e827252602_53_double_double", reinterpret_cast<void *>(&nl_gcr_f2de20e827252602_53_double_double)}, // NOLINT // spacfury - {"nl_gcr_f365c3863b050e35_45_double_double", reinterpret_cast<void *>(&nl_gcr_f365c3863b050e35_45_double_double)}, + {"nl_gcr_f365c3863b050e35_45_double_double", reinterpret_cast<void *>(&nl_gcr_f365c3863b050e35_45_double_double)}, // NOLINT // spacfury - {"nl_gcr_f3c9a6d53371d709_227_double_double", reinterpret_cast<void *>(&nl_gcr_f3c9a6d53371d709_227_double_double)}, + {"nl_gcr_f3c9a6d53371d709_227_double_double", reinterpret_cast<void *>(&nl_gcr_f3c9a6d53371d709_227_double_double)}, // NOLINT // barrier - {"nl_gcr_f425d4008ae1d2c6_13_double_double", reinterpret_cast<void *>(&nl_gcr_f425d4008ae1d2c6_13_double_double)}, + {"nl_gcr_f425d4008ae1d2c6_13_double_double", reinterpret_cast<void *>(&nl_gcr_f425d4008ae1d2c6_13_double_double)}, // NOLINT // boxingb - {"nl_gcr_f43cf2a28a5a5561_23_double_double", reinterpret_cast<void *>(&nl_gcr_f43cf2a28a5a5561_23_double_double)}, + {"nl_gcr_f43cf2a28a5a5561_23_double_double", reinterpret_cast<void *>(&nl_gcr_f43cf2a28a5a5561_23_double_double)}, // NOLINT // spacfury - {"nl_gcr_f4da1503eabe16cf_16_double_double", reinterpret_cast<void *>(&nl_gcr_f4da1503eabe16cf_16_double_double)}, + {"nl_gcr_f4da1503eabe16cf_16_double_double", reinterpret_cast<void *>(&nl_gcr_f4da1503eabe16cf_16_double_double)}, // NOLINT // elim - {"nl_gcr_f4f4e2ee05cb584e_13_double_double", reinterpret_cast<void *>(&nl_gcr_f4f4e2ee05cb584e_13_double_double)}, + {"nl_gcr_f4f4e2ee05cb584e_13_double_double", reinterpret_cast<void *>(&nl_gcr_f4f4e2ee05cb584e_13_double_double)}, // NOLINT // konami2x - {"nl_gcr_f6900d3f36a91049_85_double_double", reinterpret_cast<void *>(&nl_gcr_f6900d3f36a91049_85_double_double)}, + {"nl_gcr_f6900d3f36a91049_85_double_double", reinterpret_cast<void *>(&nl_gcr_f6900d3f36a91049_85_double_double)}, // NOLINT // breakout - {"nl_gcr_f7dc4f87b5a8ba93_7_double_double", reinterpret_cast<void *>(&nl_gcr_f7dc4f87b5a8ba93_7_double_double)}, + {"nl_gcr_f7dc4f87b5a8ba93_7_double_double", reinterpret_cast<void *>(&nl_gcr_f7dc4f87b5a8ba93_7_double_double)}, // NOLINT // fireone - {"nl_gcr_f8f6a951fd1af6bc_7_double_double", reinterpret_cast<void *>(&nl_gcr_f8f6a951fd1af6bc_7_double_double)}, + {"nl_gcr_f8f6a951fd1af6bc_7_double_double", reinterpret_cast<void *>(&nl_gcr_f8f6a951fd1af6bc_7_double_double)}, // NOLINT +// brdrline + {"nl_gcr_f99b1245e708ec85_83_double_double", reinterpret_cast<void *>(&nl_gcr_f99b1245e708ec85_83_double_double)}, // NOLINT // zektor - {"nl_gcr_fbff020f5f5d5a5_144_double_double", reinterpret_cast<void *>(&nl_gcr_fbff020f5f5d5a5_144_double_double)}, + {"nl_gcr_fbff020f5f5d5a5_144_double_double", reinterpret_cast<void *>(&nl_gcr_fbff020f5f5d5a5_144_double_double)}, // NOLINT // kidniki - {"nl_gcr_fc02559fdbfb0e10_67_double_double", reinterpret_cast<void *>(&nl_gcr_fc02559fdbfb0e10_67_double_double)}, + {"nl_gcr_fc02559fdbfb0e10_67_double_double", reinterpret_cast<void *>(&nl_gcr_fc02559fdbfb0e10_67_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_fc9971724787b82b_149_double_double", reinterpret_cast<void *>(&nl_gcr_fc9971724787b82b_149_double_double)}, + {"nl_gcr_fc9971724787b82b_149_double_double", reinterpret_cast<void *>(&nl_gcr_fc9971724787b82b_149_double_double)}, // NOLINT // elim - {"nl_gcr_fcce97532ad2f49d_18_double_double", reinterpret_cast<void *>(&nl_gcr_fcce97532ad2f49d_18_double_double)}, + {"nl_gcr_fcce97532ad2f49d_18_double_double", reinterpret_cast<void *>(&nl_gcr_fcce97532ad2f49d_18_double_double)}, // NOLINT // fireone - {"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)}, + {"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)}, // NOLINT // starfire - {"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)}, + {"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)}, // NOLINT #endif {"", nullptr} diff --git a/src/lib/netlist/macro/modules/nlmod_ICL8038_DIP.cpp b/src/lib/netlist/macro/modules/nlmod_icl8038_dip.cpp index 05a4d300099..05a4d300099 100644..100755 --- a/src/lib/netlist/macro/modules/nlmod_ICL8038_DIP.cpp +++ b/src/lib/netlist/macro/modules/nlmod_icl8038_dip.cpp diff --git a/src/lib/netlist/macro/modules/nlmod_NE556_DIP.cpp b/src/lib/netlist/macro/modules/nlmod_ne556_dip.cpp index 7f278a18b6d..7f278a18b6d 100644..100755 --- a/src/lib/netlist/macro/modules/nlmod_NE556_DIP.cpp +++ b/src/lib/netlist/macro/modules/nlmod_ne556_dip.cpp diff --git a/src/lib/netlist/macro/modules/nlmod_RTEST.cpp b/src/lib/netlist/macro/modules/nlmod_rtest.cpp index c2ad129c6e3..c2ad129c6e3 100644..100755 --- a/src/lib/netlist/macro/modules/nlmod_RTEST.cpp +++ b/src/lib/netlist/macro/modules/nlmod_rtest.cpp diff --git a/src/lib/netlist/macro/nlm_cd4xxx_lib.cpp b/src/lib/netlist/macro/nlm_cd4xxx_lib.cpp index 13c80aa391b..35f5cae6374 100644 --- a/src/lib/netlist/macro/nlm_cd4xxx_lib.cpp +++ b/src/lib/netlist/macro/nlm_cd4xxx_lib.cpp @@ -268,6 +268,251 @@ static NETLIST_START(CD4024_DIP) /* +--------------+ */) NETLIST_END() +//- Identifier: CD4029_DIP +//- Title: CD4029BM/CD4029BC Presettable Binary/Decade Up/Down Counter +//- Pinalias: PE,Q4,J4,J1,CI,Q1,CO,VSS,BD,UD,Q2,J2,J3,Q3,CLK,VDD +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- Limitations: +//- Voltage-dependent timing is not implemented. +//- FunctionTable: +//- http://pdf.datasheetcatalog.com/datasheets/166/108968_DS.pdf +//- See nld_4029.cpp for tables explaining the counting order for all states +//- +//- Counter Sequences: +//- +//- B/D high (Binary), U/D high (Up) +//- +-------++----+----+----+----+----++-------+ +//- | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | +//- +=======++====+====+====+====+====++=======+ +//- | 0 || 0 | 0 | 0 | 0 | 1 || 1 | +//- | 1 || 0 | 0 | 0 | 1 | 1 || 2 | +//- | 2 || 0 | 0 | 1 | 0 | 1 || 3 | +//- | 3 || 0 | 0 | 1 | 1 | 1 || 4 | +//- | 4 || 0 | 1 | 0 | 0 | 1 || 5 | +//- | 5 || 0 | 1 | 0 | 1 | 1 || 6 | +//- | 6 || 0 | 1 | 1 | 0 | 1 || 7 | +//- | 7 || 0 | 1 | 1 | 1 | 1 || 8 | +//- | 8 || 1 | 0 | 0 | 0 | 1 || 9 | +//- | 9 || 1 | 0 | 0 | 1 | 1 || A | +//- | A || 1 | 0 | 1 | 0 | 1 || B | +//- | B || 1 | 0 | 1 | 1 | 1 || C | +//- | C || 1 | 1 | 0 | 0 | 1 || D | +//- | D || 1 | 1 | 0 | 1 | 1 || E | +//- | E || 1 | 1 | 1 | 0 | 1 || F | +//- | F || 1 | 1 | 1 | 1 |0|CI|| 0 | +//- | 0 || 0 | 0 | 0 | 0 | 1 || 1 | +//- +-------++----+----+----+----+----++-------+ +//- +//- B/D high (Binary), U/D low (Down) +//- +-------++----+----+----+----+----++-------+ +//- | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | +//- +=======++====+====+====+====+====++=======+ +//- | F || 1 | 1 | 1 | 1 | 1 || E | +//- | E || 1 | 1 | 1 | 0 | 1 || D | +//- | D || 1 | 1 | 0 | 1 | 1 || C | +//- | C || 1 | 1 | 0 | 0 | 1 || B | +//- | B || 1 | 0 | 1 | 1 | 1 || A | +//- | A || 1 | 0 | 1 | 0 | 1 || 9 | +//- | 9 || 1 | 0 | 0 | 1 | 1 || 8 | +//- | 8 || 1 | 0 | 0 | 0 | 1 || 7 | +//- | 7 || 0 | 1 | 1 | 1 | 1 || 6 | +//- | 6 || 0 | 1 | 1 | 0 | 1 || 5 | +//- | 5 || 0 | 1 | 0 | 1 | 1 || 4 | +//- | 4 || 0 | 1 | 0 | 0 | 1 || 3 | +//- | 3 || 0 | 0 | 1 | 1 | 1 || 2 | +//- | 2 || 0 | 0 | 1 | 0 | 1 || 1 | +//- | 1 || 0 | 0 | 0 | 1 | 1 || 0 | +//- | 0 || 0 | 0 | 0 | 0 |0|CI|| F | +//- | F || 1 | 1 | 1 | 1 | 1 || E | +//- +-------++----+----+----+----+----++-------+ +//- +//- B/D low (Decimal), U/D high (Up) +//- +-------++----+----+----+----+----++-------+ +//- | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | +//- +=======++====+====+====+====+====++=======+ +//- | 0 || 0 | 0 | 0 | 0 | 1 || 1 | +//- | 1 || 0 | 0 | 0 | 1 | 1 || 2 | +//- | 2 || 0 | 0 | 1 | 0 | 1 || 3 | +//- | 3 || 0 | 0 | 1 | 1 | 1 || 4 | +//- | 4 || 0 | 1 | 0 | 0 | 1 || 5 | +//- | 5 || 0 | 1 | 0 | 1 | 1 || 6 | +//- | 6 || 0 | 1 | 1 | 0 | 1 || 7 | +//- | 7 || 0 | 1 | 1 | 1 | 1 || 8 | +//- | 8 || 1 | 0 | 0 | 0 | 1 || 9 | +//- | 9 || 1 | 0 | 0 | 1 |0|CI|| 0 | +//- | A || 1 | 0 | 1 | 0 | 1 || B | +//- | B || 1 | 0 | 1 | 1 |0|CI|| 6 | +//- | C || 1 | 1 | 0 | 0 | 1 || D | +//- | D || 1 | 1 | 0 | 1 |0|CI|| 4 | +//- | E || 1 | 1 | 1 | 0 | 1 || F | +//- | F || 1 | 1 | 1 | 1 |0|CI|| 2 | +//- | 0 || 0 | 0 | 0 | 0 | 1 || 1 | +//- +-------++----+----+----+----+----++-------+ +//- +//- B/D low (Decimal), U/D low (Down) +//- +-------++----+----+----+----+----++-------+ +//- | COUNT || Q4 | Q3 | Q2 | Q1 | CO || NEXT | +//- +=======++====+====+====+====+====++=======+ +//- | F || 1 | 1 | 1 | 1 | 1 || E | +//- | E || 1 | 1 | 1 | 0 | 1 || D | +//- | D || 1 | 1 | 0 | 1 | 1 || C | +//- | C || 1 | 1 | 0 | 0 | 1 || B | +//- | B || 1 | 0 | 1 | 1 | 1 || A | +//- | A || 1 | 0 | 1 | 0 | 1 || 9 | +//- | 9 || 1 | 0 | 0 | 1 | 1 || 8 | +//- | 8 || 1 | 0 | 0 | 0 | 1 || 7 | +//- | 7 || 0 | 1 | 1 | 1 | 1 || 6 | +//- | 6 || 0 | 1 | 1 | 0 | 1 || 5 | +//- | 5 || 0 | 1 | 0 | 1 | 1 || 4 | +//- | 4 || 0 | 1 | 0 | 0 | 1 || 3 | +//- | 3 || 0 | 0 | 1 | 1 | 1 || 2 | +//- | 2 || 0 | 0 | 1 | 0 | 1 || 1 | +//- | 1 || 0 | 0 | 0 | 1 | 1 || 0 | +//- | 0 || 0 | 0 | 0 | 0 |0|CI|| 9 | +//- | 9 || 1 | 0 | 0 | 1 | 1 || 8 | +//- +-------++----+----+----+----+----++-------+ +//- +//- Note that in all cases where Carry-out is generating a non-1 signal (0 | Carry-in), +//- this signal is asynchronous, so if carry-in changes the carry-out value will +//- change immediately. +//- +//- Preset/Carry in function table +//- +-----+-----+-----++----+----+----+----+ +//- | PE | CLK | CI || Q1 | Q2 | Q3 | Q4 | +//- +=====+=====+=====++====+====+====+====+ +//- | 1 | X | X || J1 | J2 | J3 | J4 | +//- | 0 | X | 1 || Q1 | Q2 | Q3 | Q4 | +//- | 0 | ./` | 0 || COUNT | +//- +-----+-----+-----++----+----+----+----+ +//- +static NETLIST_START(CD4029_DIP) + CD4029(A) + + DIPPINS( /* +--------------+ */ + A.PE, /* PE |1 ++ 16| VDD */ A.VDD, + A.Q4, /* Q4 |2 15| CLK */ A.CLK, + A.J4, /* J4 |3 14| Q3 */ A.Q3, + A.J1, /* J1 |4 4029 13| J3 */ A.J3, + A.CI, /* CI |5 12| J2 */ A.J2, + A.Q1, /* Q1 |6 11| Q2 */ A.Q2, + A.CO, /* CO |7 10| U/D */ A.UD, + A.VSS, /* VSS |8 9| B/D */ A.BD + /* +--------------+ */) +NETLIST_END() + +//- Identifier: CD4030_DIP +//- Title: CD4030M/CD4030C Quad EXCLUSIVE-OR Gate +//- Pinalias: A1,B1,Y1,Y2,A2,B2,VSS,A3,B3,Y3,Y4,A4,B4,VDD +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- Limitations: +//- Voltage-dependent timing is not implemented. +//- FunctionTable: +//- https://www.uni-kl.de/elektronik-lager/418055 +//- +static NETLIST_START(CD4030_DIP) + CD4030_GATE(A) + CD4030_GATE(B) + CD4030_GATE(C) + CD4030_GATE(D) + + DIPPINS( /* +--------------+ */ + A.A, /* A1 |1 ++ 14| VDD */ A.VDD, + A.B, /* B1 |2 13| B4 */ D.B, + A.Q, /* Y1 |3 12| A4 */ D.A, + B.Q, /* Y2 |4 4030 11| Y4 */ D.Q, + B.A, /* A2 |5 10| Y3 */ C.Q, + B.B, /* B2 |6 9| B3 */ C.B, + A.VSS, /* VSS |7 8| A3 */ C.A + /* +--------------+ */ + ) +NETLIST_END() + +//- Identifier: CD4042_DIP +//- Title: CD4042BM/CD4042BC Quad Clocked D Latch +//- Pinalias: Q4,Q1,QQ1,D1,CLK,POL,D2,VSS,QQ2,Q2,Q3,QQ3,D3,D4,QQ4,VDD +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- Limitations: +//- Voltage-dependent timing is partially implemented. +//- FunctionTable: +//- http://pdf.datasheetcatalog.com/datasheet/nationalsemiconductor/DS005966.PDF +//- +//- +-----+-----+----++----+-----+ +//- | POL | CLK | Dx || Qx | QQx | +//- +=====+=====+====++====+=====+ +//- | 0 | 0 | X || Qx | /Qx | +//- | 0 | 1 | D || D | /D | +//- | 1 | 1 | X || Qx | /Qx | +//- | 1 | 0 | D || D | /D | +//- +-----+-----+----++----+-----+ +//- Note that since this is a level triggered transparent latch, +//- as long as POL ^ CLK == true, the latch is transparent, and +//- if D changes Q and QQ(/Q) will instantly change. +//- +static NETLIST_START(CD4042_DIP) + CD4042(A) + + DIPPINS( /* +--------------+ */ + A.Q4, /* Q4 |1 ++ 16| VDD */ A.VDD, + A.Q1, /* Q1 |2 15| Q4Q */ A.Q4Q, + A.Q1Q, /* Q1Q |3 14| D4 */ A.D4, + A.D1, /* D1 |4 4042 13| D3 */ A.D3, + A.CLK, /* CLK |5 12| Q3Q */ A.Q3Q, + A.POL, /* POL |6 11| Q3 */ A.Q3, + A.D2, /* D2 |7 10| Q2 */ A.Q2, + A.VSS, /* VSS |8 9| Q2Q */ A.Q2Q + /* +--------------+ */ + ) +NETLIST_END() + +//- Identifier: CD4049_DIP +//- Title: CD4049UBM/CD4049UBC Hex Inverting Buffer +//- Pinalias: VDD,G,A,H,B,I,C,VSS,D,J,E,K,NC,F,L,NC +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- Limitations: +//- Voltage-dependent timing is not implemented. +//- FunctionTable: +//- http://pdf.datasheetcatalog.com/datasheets/134/109125_DS.pdf +//- +static NETLIST_START(CD4049_DIP) + CD4049_GATE(A) + CD4049_GATE(B) + CD4049_GATE(C) + CD4049_GATE(D) + CD4049_GATE(E) + CD4049_GATE(F) + NC_PIN(NC) + + NET_C(A.VDD, B.VDD, C.VDD, D.VDD, E.VDD, F.VDD) + NET_C(A.VSS, B.VSS, C.VSS, D.VSS, E.VSS, F.VSS) + + //DIPPINS( /* +--------------+ */ + // A.VDD, /* VCC |1 ++ 16| NC */ NC.I, + // A.G, /*G=/A |2 15| L=/F*/ F.L, + // A.A, /* A |3 14| F */ F.F, + // B.H, /*H=/B |4 13| NC */ NC.I, + // B.B, /* B |5 4049 12| K=/E*/ E.K, + // C.I, /*I=/C |6 11| E */ E.E, + // C.C, /* C |7 10| J=/D*/ D.J, + // A.VSS, /* VSS |8 9| D */ D.D + // /* +--------------+ */ + //) + DIPPINS( /* +--------------+ */ + A.VDD, /* VCC |1 ++ 16| NC */ NC.I, + A.Q, /*G=/A |2 15| L=/F*/ F.Q, + A.A, /* A |3 14| F */ F.A, + B.Q, /*H=/B |4 13| NC */ NC.I, + B.A, /* B |5 4049 12| K=/E*/ E.Q, + C.Q, /*I=/C |6 11| E */ E.A, + C.A, /* C |7 10| J=/D*/ D.Q, + A.VSS, /* VSS |8 9| D */ D.A + /* +--------------+ */ + ) +NETLIST_END() + //- Identifier: CD4053_DIP //- Title: CD4053BM/CD4053BC Triple 2-Channel AnalogMultiplexer/Demultiplexer //- Pinalias: INOUTBY,INOUTBX,INOUTCY,OUTINC,INOUTCX,INH,VEE,VSS,C,B,A,INOUTAX,INOUTAY,OUTINA,OUTINB,VDD @@ -397,6 +642,114 @@ static NETLIST_START(CD4070_DIP) ) NETLIST_END() +//- Identifier: CD4071_DIP +//- Title: CD4071BC Quad 2-Input OR Buffered B Series Gate +//- Pinalias: A,B,J,K,C,D,VSS,E,F,L,M,G,H,VDD +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- FunctionTable: +//- pdf.datasheetcatalog.com/datasheets/185/109289_DS.pdf +//- +static NETLIST_START(CD4071_DIP) + CD4071_GATE(A) + CD4071_GATE(B) + CD4071_GATE(C) + CD4071_GATE(D) + + NET_C(A.VDD, B.VDD, C.VDD, D.VDD) + NET_C(A.VSS, B.VSS, C.VSS, D.VSS) + + DIPPINS( /* +--------------+ */ + A.A, /* A |1 ++ 14| VDD */ A.VDD, + A.B, /* B |2 13| H */ D.B, + A.Q, /* J |3 12| G */ D.A, + B.Q, /* K |4 4071 11| M */ D.Q, + B.A, /* C |5 10| L */ C.Q, + B.B, /* D |6 9| F */ C.B, + A.VSS, /* VSS |7 8| E */ C.A + /* +--------------+ */ + ) +NETLIST_END() + +//- Identifier: CD4076_DIP +//- Title: CD4076BM/CD4076BC TRI-STATE(R) Quad D Flip-Flop +//- Pinalias: OD1,OD2,OA,OB,OC,OD,CLK,VSS,ID1,ID2,ID,IC,IB,IA,CLR,VDD +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- Limitations: +//- Voltage-dependent timing is not implemented. +//- FunctionTable: +//- http://www.bitsavers.org/components/national/_dataBooks/1981_Natonal_CMOS_Databook.pdf 5-186 (pdf page 567) +//- +//- Function table for ID1/2 pins +//- +-----+-----+-----+----+-----++-----+ +//- | ID1 | ID2 | CLR | Ix | CLK || iOx | +//- +=====+=====+=====+====+=====++=====+ +//- | X | X | 0 | X | 0 || iOx | +//- | X | X | 0 | X | 1 || iOx | +//- | 1 | X | 0 | X | 0>1 || iOx | +//- | X | 1 | 0 | X | 0>1 || iOx | +//- | 0 | 0 | 0 | 0 | 0>1 || 0 | +//- | 0 | 0 | 0 | 1 | 0>1 || 1 | +//- | X | X | 1 | X | X || 0 | +//- +-----+-----+-----+----+-----++-----+ +//- Note: iOX is an internal signal, the output of each D-latch +//- +//- Function table for OD1/2 pins vs output of the internal D-latches +//- +-----+-----+-----++-----+ +//- | OD1 | OD2 | iOx || Ox | +//- +=====+=====+=====++=====+ +//- | 1 | X | X || Z | +//- | X | 1 | X || Z | +//- | 0 | 0 | 0 || 0 | +//- | 0 | 0 | 1 || 1 | +//- +-----+-----+-----++-----+ +//- +static NETLIST_START(CD4076_DIP) + CD4076(A) + + DIPPINS( /* +--------------+ */ + A.OD1, /* OD1 |1 ++ 16| VDD */ A.VDD, + A.OD2, /* OD2 |2 15| CLR */ A.CLR, + A.OA, /* OA |3 14| IA */ A.IA, + A.OB, /* OB |4 4076 13| IB */ A.IB, + A.OC, /* OC |5 12| IC */ A.IC, + A.OD, /* OD |6 11| ID */ A.ID, + A.CLK, /* CLK |7 10| ID2 */ A.ID2, + A.VSS, /* VSS |8 9| ID1 */ A.ID1 + /* +--------------+ */ + ) +NETLIST_END() + +//- Identifier: CD4081_DIP +//- Title: CD4081BC Quad 2-Input AND Buffered B Series Gate +//- Pinalias: A,B,J,K,C,D,VSS,E,F,L,M,G,H,VDD +//- Package: DIP +//- NamingConvention: Naming conventions follow National Semiconductor datasheet +//- FunctionTable: +//- pdf.datasheetcatalog.com/datasheets/185/109289_DS.pdf +//- +static NETLIST_START(CD4081_DIP) + CD4081_GATE(A) + CD4081_GATE(B) + CD4081_GATE(C) + CD4081_GATE(D) + + NET_C(A.VDD, B.VDD, C.VDD, D.VDD) + NET_C(A.VSS, B.VSS, C.VSS, D.VSS) + + DIPPINS( /* +--------------+ */ + A.A, /* A |1 ++ 14| VDD */ A.VDD, + A.B, /* B |2 13| H */ D.B, + A.Q, /* J |3 12| G */ D.A, + B.Q, /* K |4 4081 11| M */ D.Q, + B.A, /* C |5 10| L */ C.Q, + B.B, /* D |6 9| F */ C.B, + A.VSS, /* VSS |7 8| E */ C.A + /* +--------------+ */ + ) +NETLIST_END() + //- Identifier: CD4316_DIP //- Title: 74HC/HCT4316 Quad bilateral switches //- Pinalias: 1Z,1Y,2Y,2Z,2S,3S,EQ,GND,VEE,3Z,3Y,4Y,4Z,4S,1S,VCC @@ -501,6 +854,22 @@ static TRUTHTABLE_START(CD4011_GATE, 2, 1, "") TT_FAMILY("CD4XXX") TRUTHTABLE_END() +static TRUTHTABLE_START(CD4030_GATE, 2, 1, "") + TT_HEAD("A,B|Q ") + TT_LINE("0,0|0|100") + TT_LINE("0,1|1|100") + TT_LINE("1,0|1|100") + TT_LINE("1,1|0|100") + TT_FAMILY("CD4XXX") +TRUTHTABLE_END() + +static TRUTHTABLE_START(CD4049_GATE, 1, 1, "") + TT_HEAD("A|Q ") + TT_LINE("0|1|45") + TT_LINE("1|0|45") + TT_FAMILY("CD4XXX") +TRUTHTABLE_END() + static TRUTHTABLE_START(CD4069_GATE, 1, 1, "") TT_HEAD("A|Q ") TT_LINE("0|1|55") @@ -517,17 +886,43 @@ static TRUTHTABLE_START(CD4070_GATE, 2, 1, "") TT_FAMILY("CD4XXX") TRUTHTABLE_END() +static TRUTHTABLE_START(CD4071_GATE, 2, 1, "") + TT_HEAD("A,B|Q ") + TT_LINE("0,0|0|200") + TT_LINE("0,1|1|200") + TT_LINE("1,0|1|200") + TT_LINE("1,1|1|200") + TT_FAMILY("CD4XXX") +TRUTHTABLE_END() + +static TRUTHTABLE_START(CD4081_GATE, 2, 1, "") + TT_HEAD("A,B|Q ") + TT_LINE("0,0|0|200") + TT_LINE("0,1|0|200") + TT_LINE("1,0|0|200") + TT_LINE("1,1|1|200") + TT_FAMILY("CD4XXX") +TRUTHTABLE_END() + NETLIST_START(cd4xxx_lib) TRUTHTABLE_ENTRY(CD4001_GATE) TRUTHTABLE_ENTRY(CD4011_GATE) + TRUTHTABLE_ENTRY(CD4030_GATE) + TRUTHTABLE_ENTRY(CD4049_GATE) TRUTHTABLE_ENTRY(CD4069_GATE) TRUTHTABLE_ENTRY(CD4070_GATE) + TRUTHTABLE_ENTRY(CD4071_GATE) + TRUTHTABLE_ENTRY(CD4081_GATE) LOCAL_LIB_ENTRY(CD4001_DIP) LOCAL_LIB_ENTRY(CD4011_DIP) + LOCAL_LIB_ENTRY(CD4030_DIP) + LOCAL_LIB_ENTRY(CD4049_DIP) LOCAL_LIB_ENTRY(CD4069_DIP) LOCAL_LIB_ENTRY(CD4070_DIP) + LOCAL_LIB_ENTRY(CD4071_DIP) + LOCAL_LIB_ENTRY(CD4081_DIP) /* DIP ONLY */ LOCAL_LIB_ENTRY(CD4006_DIP) @@ -536,9 +931,12 @@ NETLIST_START(cd4xxx_lib) LOCAL_LIB_ENTRY(CD4022_DIP) LOCAL_LIB_ENTRY(CD4020_DIP) LOCAL_LIB_ENTRY(CD4024_DIP) + LOCAL_LIB_ENTRY(CD4029_DIP) + LOCAL_LIB_ENTRY(CD4042_DIP) LOCAL_LIB_ENTRY(CD4053_DIP) LOCAL_LIB_ENTRY(CD4066_DIP) LOCAL_LIB_ENTRY(CD4016_DIP) + LOCAL_LIB_ENTRY(CD4076_DIP) LOCAL_LIB_ENTRY(CD4316_DIP) LOCAL_LIB_ENTRY(CD4538_DIP) diff --git a/src/lib/netlist/macro/nlm_opamp_lib.cpp b/src/lib/netlist/macro/nlm_opamp_lib.cpp index 0d1a77a87b8..db5fba1888c 100644 --- a/src/lib/netlist/macro/nlm_opamp_lib.cpp +++ b/src/lib/netlist/macro/nlm_opamp_lib.cpp @@ -353,6 +353,16 @@ static NETLIST_START(LM2902_DIP) NETLIST_END() +static NETLIST_START(LM348_DIP) + OPAMP(A, "UA741") + OPAMP(B, "UA741") + OPAMP(C, "UA741") + OPAMP(D, "UA741") + + INCLUDE(opamp_layout_4_4_11) + +NETLIST_END() + static NETLIST_START(LM358_DIP) OPAMP(A, "LM358") OPAMP(B, "LM358") @@ -632,6 +642,7 @@ NETLIST_START(opamp_lib) LOCAL_LIB_ENTRY(TL082_DIP) LOCAL_LIB_ENTRY(TL084_DIP) LOCAL_LIB_ENTRY(LM324_DIP) + LOCAL_LIB_ENTRY(LM348_DIP) LOCAL_LIB_ENTRY(LM358_DIP) LOCAL_LIB_ENTRY(LM2902_DIP) LOCAL_LIB_ENTRY(UA741_DIP8) diff --git a/src/lib/netlist/macro/nlm_roms_lib.cpp b/src/lib/netlist/macro/nlm_roms_lib.cpp index 4e8ab22a910..d728078c87f 100644 --- a/src/lib/netlist/macro/nlm_roms_lib.cpp +++ b/src/lib/netlist/macro/nlm_roms_lib.cpp @@ -342,6 +342,39 @@ static NETLIST_START(PROM_MK28000_DIP) ALIAS(24, A.OE1) NETLIST_END() +//- Identifier: ROM_MCM14524_DIP +//- Title: MCM14524 1024-BIT READ ONLY MEMORY +//- Pinalias: CLK,EN,B0,B1,B2,B3,A2,GND,A3,A4,A5,A6,A7,A1,A0,VCC +//- Package: DIP +//- Param: ROM +//- The name of the source to load the rom content from +//- NamingConvention: Naming conventions follow Motorola datasheet +//- Limitations: +//- Voltage-dependent timing is partially implemented. +//- FunctionTable: +//- http://www.bitsavers.org/components/motorola/_dataBooks/1978_Motorola_CMOS_Data_Book.pdf 7-439 (pdf page 488) + +static NETLIST_START(ROM_MCM14524_DIP) + + ROM_MCM14524(A) + + DEFPARAM(ROM, "unknown") + PARAM(A.ROM, "$(@.ROM)") + + /* Motorola MCM14524: */ + DIPPINS( /* +-----..-----+ */ + A.CLK, /* /CLK |1 16| VDD */ A.VCC, + A.EN, /* CE |2 15| A0 */ A.A0, + A.B0, /* B0 |3 MCM 14| A1 */ A.A1, + A.B1, /* B1 |4 14524 13| A7 */ A.A7, + A.B2, /* B2 |5 12| A6 */ A.A6, + A.B3, /* B3 |6 11| A5 */ A.A5, + A.A2, /* A2 |7 10| A4 */ A.A4, + A.GND, /* VSS |8 9| A3 */ A.A3 + /* +------------+ */ + ) +NETLIST_END() + /* 2102: 1024 x 1-bit Static RAM * * +--------------+ @@ -402,6 +435,7 @@ NETLIST_START(roms_lib) LOCAL_LIB_ENTRY(TTL_82S16_DIP) LOCAL_LIB_ENTRY(PROM_82S115_DIP) LOCAL_LIB_ENTRY(PROM_MK28000_DIP) + LOCAL_LIB_ENTRY(ROM_MCM14524_DIP) LOCAL_LIB_ENTRY(RAM_2102A_DIP) LOCAL_LIB_ENTRY(ROM_TMS4800_DIP) NETLIST_END() diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index d0a0e707aaf..d92b8e505c5 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -86,14 +86,14 @@ namespace netlist // ---------------------------------------------------------------------------------------- netlist_t::netlist_t(netlist_state_t &state, const pstring &aname) - : m_state(state) - , m_solver(nullptr) - , m_time(netlist_time_ext::zero()) - , m_mainclock(nullptr) - , m_queue(config::MAX_QUEUE_SIZE::value, - detail::queue_t::id_delegate(&netlist_state_t :: find_net_id, &state), - detail::queue_t::obj_delegate(&netlist_state_t :: net_by_id, &state)) - , m_use_stats(false) + : m_state(state) + , m_solver(nullptr) + , m_time(netlist_time_ext::zero()) + , m_mainclock(nullptr) + , m_use_stats(false) + , m_queue(config::MAX_QUEUE_SIZE::value, + detail::queue_t::id_delegate(&netlist_state_t :: find_net_id, &state), + detail::queue_t::obj_delegate(&netlist_state_t :: net_by_id, &state)) { state.save(*this, static_cast<plib::state_manager_t::callback_t &>(m_queue), aname, "m_queue"); state.save(*this, m_time, aname, "m_time"); @@ -106,7 +106,6 @@ namespace netlist netlist_state_t::netlist_state_t(const pstring &name, plib::plog_delegate logger) : m_log(logger) - , m_extended_validation(false) , m_dummy_version(1) { m_setup = plib::make_unique<setup_t, host_arena>(*this); @@ -141,9 +140,9 @@ namespace netlist //m_setup->parser().register_source<source_pattern_t>("../macro/nlm_{1}.cpp"); #else #if 1 - m_setup->parser().register_source<source_pattern_t>("src/lib/netlist/macro/nlm_{1}.cpp"); - m_setup->parser().register_source<source_pattern_t>("src/lib/netlist/generated/nlm_{1}.cpp"); - m_setup->parser().register_source<source_pattern_t>("src/lib/netlist/macro/modules/nlmod_{1}.cpp"); + m_setup->parser().register_source<source_pattern_t>("src/lib/netlist/macro/nlm_{1}.cpp", true); + m_setup->parser().register_source<source_pattern_t>("src/lib/netlist/generated/nlm_{1}.cpp", true); + m_setup->parser().register_source<source_pattern_t>("src/lib/netlist/macro/modules/nlmod_{1}.cpp", true); m_setup->parser().include("base_lib"); #else // FIXME: This is very slow - need optimized parsing scanning @@ -246,6 +245,7 @@ namespace netlist ENTRY_EX(sizeof(base_device_t)) ENTRY_EX(sizeof(device_t)) + ENTRY_EX(sizeof(logic_t)) ENTRY_EX(sizeof(logic_input_t)) ENTRY_EX(sizeof(logic_output_t)) ENTRY_EX(sizeof(param_model_t)) @@ -253,6 +253,7 @@ namespace netlist ENTRY_EX(sizeof(state_var<int>)) ENTRY_EX(sizeof(pstring)) ENTRY_EX(sizeof(core_device_t::stats_t)) + ENTRY_EX(sizeof(std::vector<detail::core_terminal_t *>)) ENTRY_EX(sizeof(plib::plog_level)) ENTRY_EX(sizeof(nldelegate)) @@ -338,7 +339,7 @@ namespace netlist for (auto &n : m_nets) { n->update_inputs(); // only used if USE_COPY_INSTEAD_OF_REFERENCE == 1 - for (auto & term : n->core_terms()) + for (auto & term : core_terms(*n)) { if (!plib::container::contains(t, &term->delegate())) { @@ -432,7 +433,6 @@ namespace netlist log().verbose("Queue Pushes {1:15}", si.m_queue.m_prof_call()); log().verbose("Queue Moves {1:15}", si.m_queue.m_prof_sortmove()); log().verbose("Queue Removes {1:15}", si.m_queue.m_prof_remove()); - log().verbose("Queue Retimes {1:15}", si.m_queue.m_prof_retime()); log().verbose(""); log().verbose("Take the next lines with a grain of salt. They depend on the measurement implementation."); @@ -619,7 +619,7 @@ namespace netlist // rebuild m_list m_list_active.clear(); - for (auto & term : core_terms()) + for (auto & term : exec().nlstate().core_terms(*this)) if (term->terminal_state() != logic_t::STATE_INP_PASSIVE) { m_list_active.push_back(term); @@ -644,7 +644,7 @@ namespace netlist // rebuild m_list and reset terminals to active or analog out state m_list_active.clear(); - for (core_terminal_t *ct : core_terms()) + for (core_terminal_t *ct : exec().nlstate().core_terms(*this)) { ct->reset(); if (ct->terminal_state() != logic_t::STATE_INP_PASSIVE) @@ -704,13 +704,21 @@ namespace netlist // terminal_t // ---------------------------------------------------------------------------------------- - terminal_t::terminal_t(core_device_t &dev, const pstring &aname, terminal_t *otherterm, nldelegate delegate) + terminal_t::terminal_t(core_device_t &dev, const pstring &aname, + terminal_t *otherterm, nldelegate delegate) + : terminal_t(dev, aname, otherterm, { nullptr, nullptr }, delegate) + { + } + + terminal_t::terminal_t(core_device_t &dev, const pstring &aname, + terminal_t *otherterm, const std::array<terminal_t *, 2> &splitterterms, + nldelegate delegate) : analog_t(dev, aname, STATE_BIDIR, delegate) , m_Idr(nullptr) , m_go(nullptr) , m_gt(nullptr) { - state().setup().register_term(*this, *otherterm); + state().setup().register_term(*this, otherterm, splitterterms); } void terminal_t::set_ptrs(nl_fptype *gt, nl_fptype *go, nl_fptype *Idr) noexcept(false) @@ -1029,12 +1037,14 @@ namespace netlist } m_time = top->exec_time(); - auto *const obj(top->object()); + detail::net_t *const obj(top->object()); m_queue.pop(); - if (obj != nullptr) - obj->template update_devs<KEEP_STATS>(); - else + + if (!!(obj == nullptr)) break; + + obj->template update_devs<KEEP_STATS>(); + if (KEEP_STATS) m_perf_out_processed.inc(); } while (true); diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h index 6d4c572eb08..3bd57c2771d 100644 --- a/src/lib/netlist/nl_config.h +++ b/src/lib/netlist/nl_config.h @@ -242,14 +242,14 @@ namespace netlist template <> struct fp_constants<long double> { - static inline constexpr long double DIODE_MAXDIFF() noexcept { return 1e100L; } // NOLINT - static inline constexpr long double DIODE_MAXVOLT() noexcept { return 300.0L; } // NOLINT + static constexpr long double DIODE_MAXDIFF() noexcept { return 1e100L; } // NOLINT + static constexpr long double DIODE_MAXVOLT() noexcept { return 300.0L; } // NOLINT - static inline constexpr long double TIMESTEP_MAXDIFF() noexcept { return 1e100L; } // NOLINT - static inline constexpr long double TIMESTEP_MINDIV() noexcept { return 1e-60L; } // NOLINT + static constexpr long double TIMESTEP_MAXDIFF() noexcept { return 1e100L; } // NOLINT + static constexpr long double TIMESTEP_MINDIV() noexcept { return 1e-60L; } // NOLINT - static inline constexpr const char * name() noexcept { return "long double"; } - static inline constexpr const char * suffix() noexcept { return "L"; } + static constexpr const char * name() noexcept { return "long double"; } + static constexpr const char * suffix() noexcept { return "L"; } }; /// \brief Specific constants for double floating point type @@ -257,14 +257,14 @@ namespace netlist template <> struct fp_constants<double> { - static inline constexpr double DIODE_MAXDIFF() noexcept { return 1e100; } // NOLINT - static inline constexpr double DIODE_MAXVOLT() noexcept { return 300.0; } // NOLINT + static constexpr double DIODE_MAXDIFF() noexcept { return 1e100; } // NOLINT + static constexpr double DIODE_MAXVOLT() noexcept { return 300.0; } // NOLINT - static inline constexpr double TIMESTEP_MAXDIFF() noexcept { return 1e100; } // NOLINT - static inline constexpr double TIMESTEP_MINDIV() noexcept { return 1e-60; } // NOLINT + static constexpr double TIMESTEP_MAXDIFF() noexcept { return 1e100; } // NOLINT + static constexpr double TIMESTEP_MINDIV() noexcept { return 1e-60; } // NOLINT - static inline constexpr const char * name() noexcept { return "double"; } - static inline constexpr const char * suffix() noexcept { return ""; } + static constexpr const char * name() noexcept { return "double"; } + static constexpr const char * suffix() noexcept { return ""; } }; /// \brief Specific constants for float floating point type @@ -272,14 +272,14 @@ namespace netlist template <> struct fp_constants<float> { - static inline constexpr float DIODE_MAXDIFF() noexcept { return 1e20F; } // NOLINT - static inline constexpr float DIODE_MAXVOLT() noexcept { return 90.0F; } // NOLINT + static constexpr float DIODE_MAXDIFF() noexcept { return 1e20F; } // NOLINT + static constexpr float DIODE_MAXVOLT() noexcept { return 90.0F; } // NOLINT - static inline constexpr float TIMESTEP_MAXDIFF() noexcept { return 1e30F; } // NOLINT - static inline constexpr float TIMESTEP_MINDIV() noexcept { return 1e-8F; } // NOLINT + static constexpr float TIMESTEP_MAXDIFF() noexcept { return 1e30F; } // NOLINT + static constexpr float TIMESTEP_MINDIV() noexcept { return 1e-8F; } // NOLINT - static inline constexpr const char * name() noexcept { return "float"; } - static inline constexpr const char * suffix() noexcept { return "f"; } + static constexpr const char * name() noexcept { return "float"; } + static constexpr const char * suffix() noexcept { return "f"; } }; #if (NL_USE_FLOAT128) @@ -290,23 +290,23 @@ namespace netlist { #if 0 // MAME compile doesn't support Q - static inline constexpr FLOAT128 DIODE_MAXDIFF() noexcept { return 1e100Q; } - static inline constexpr FLOAT128 DIODE_MAXVOLT() noexcept { return 300.0Q; } + static constexpr FLOAT128 DIODE_MAXDIFF() noexcept { return 1e100Q; } + static constexpr FLOAT128 DIODE_MAXVOLT() noexcept { return 300.0Q; } - static inline constexpr FLOAT128 TIMESTEP_MAXDIFF() noexcept { return 1e100Q; } - static inline constexpr FLOAT128 TIMESTEP_MINDIV() noexcept { return 1e-60Q; } + static constexpr FLOAT128 TIMESTEP_MAXDIFF() noexcept { return 1e100Q; } + static constexpr FLOAT128 TIMESTEP_MINDIV() noexcept { return 1e-60Q; } - static inline constexpr const char * name() noexcept { return "FLOAT128"; } - static inline constexpr const char * suffix() noexcept { return "Q"; } + static constexpr const char * name() noexcept { return "FLOAT128"; } + static constexpr const char * suffix() noexcept { return "Q"; } #else - static inline constexpr FLOAT128 DIODE_MAXDIFF() noexcept { return static_cast<FLOAT128>(1e100L); } - static inline constexpr FLOAT128 DIODE_MAXVOLT() noexcept { return static_cast<FLOAT128>(300.0L); } + static constexpr FLOAT128 DIODE_MAXDIFF() noexcept { return static_cast<FLOAT128>(1e100L); } + static constexpr FLOAT128 DIODE_MAXVOLT() noexcept { return static_cast<FLOAT128>(300.0L); } - static inline constexpr FLOAT128 TIMESTEP_MAXDIFF() noexcept { return static_cast<FLOAT128>(1e100L); } - static inline constexpr FLOAT128 TIMESTEP_MINDIV() noexcept { return static_cast<FLOAT128>(1e-60L); } + static constexpr FLOAT128 TIMESTEP_MAXDIFF() noexcept { return static_cast<FLOAT128>(1e100L); } + static constexpr FLOAT128 TIMESTEP_MINDIV() noexcept { return static_cast<FLOAT128>(1e-60L); } - static inline constexpr const char * name() noexcept { return "__float128"; } - static inline constexpr const char * suffix() noexcept { return "Q"; } + static constexpr const char * name() noexcept { return "__float128"; } + static constexpr const char * suffix() noexcept { return "Q"; } #endif }; diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h index 4b44fb7b963..f60287e7a2d 100644 --- a/src/lib/netlist/nl_errstr.h +++ b/src/lib/netlist/nl_errstr.h @@ -150,6 +150,17 @@ namespace netlist PERRMSGV(MI_NO_SPECIFIC_SOLVER, 1, "No specific solver found for netlist of size {1}") PERRMSGV(MW_SOLVER_METHOD_NOT_SUPPORTED, 2, "Solver method {1} not supported. Falling back to {2}") + PERRMSGV(ME_SOLVER_CONSISTENCY_NOT_ANALOG_NET, 1, "Solver consistency: {1} is not an analog net") + PERRMSGV(ME_SOLVER_CONSISTENCY_RAIL_NET, 1, "Solver consistency: {1} is a rail net") + PERRMSGV(ME_SOLVER_TERMINAL_NO_NET, 1, "Solver consistency: Terminal {1} has no net") + PERRMSGV(ME_SOLVER_NO_RAIL_TERMINAL, 1, "Solver consistency: No rail terminals in group with nets: {1}\n" + "At least one rail terminal (like ANALOG_INPUT) needs to be part of a group of nets\n" + "solved by a solver. Without a singular matrix would be created\n" + "which has the potential to cause a crash now or in the future.\n" + "A common cause of this error are BJT or FET devices which\n" + "are defined but not used in the netlist.") + PERRMSGV(MF_SOLVER_CONSISTENCY_ERRORS, 1, "Found {1} errors during solver consistency test") + // nld_mm5837.cpp PERRMSGV(MW_FREQUENCY_OUTSIDE_OF_SPECS_1, 1, "MM5837: Frequency outside of specs: {1}") diff --git a/src/lib/netlist/nl_parser.h b/src/lib/netlist/nl_parser.h index cbc757307d5..06bcf4395e7 100644 --- a/src/lib/netlist/nl_parser.h +++ b/src/lib/netlist/nl_parser.h @@ -8,8 +8,8 @@ #ifndef NL_PARSER_H_ #define NL_PARSER_H_ -#include "nltypes.h" // for setup_t #include "core/setup.h" +#include "nltypes.h" // for setup_t #include "plib/ptokenizer.h" #include <unordered_map> diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 9af1ec92d51..ab6626acde1 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -6,6 +6,7 @@ #include "devices/nlid_proxy.h" #include "devices/nlid_truthtable.h" #include "nl_base.h" +#include "nl_errstr.h" #include "nl_factory.h" #include "nl_parser.h" #include "nl_setup.h" @@ -164,7 +165,7 @@ namespace netlist void nlparse_t::register_link(const pstring &sin, const pstring &sout) { - register_link_fqn(build_fqn(sin), build_fqn(sout)); + register_link_fqn(build_fqn(plib::trim(sin)), build_fqn(plib::trim(sout))); } void nlparse_t::register_link_arr(const pstring &terms) @@ -551,10 +552,10 @@ void setup_t::register_term(detail::core_terminal_t &term) } } -void setup_t::register_term(terminal_t &term, terminal_t &other_term) +void setup_t::register_term(terminal_t &term, terminal_t *other_term, const std::array<terminal_t *, 2> &splitter_terms) { this->register_term(term); - m_connected_terminals.insert({&term, &other_term}); + m_connected_terminals.insert({&term, {other_term, splitter_terms[0], splitter_terms[1], nullptr}}); } void setup_t::register_param_t(param_t ¶m) @@ -716,7 +717,7 @@ param_ref_t setup_t::find_param(const pstring ¶m_in) const //NOLINTNEXTLINE(misc-no-recursion) devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &out) { - nl_assert(out.is_logic()); + gsl_Expects(out.is_logic()); const auto &out_cast = dynamic_cast<const logic_output_t &>(out); auto iter_proxy(m_proxies.find(&out)); @@ -731,7 +732,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &o m_proxy_cnt++; // connect all existing terminals to new net - for (auto & p : out.net().core_terms()) + for (auto & p : nlstate().core_terms(out.net())) { p->clear_net(); // de-link from all nets ... if (!connect(new_proxy->proxy_term(), *p)) @@ -742,7 +743,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &o new_proxy->proxy_term().name(), (*p).name())); } } - out.net().core_terms().clear(); + nlstate().core_terms(out.net()).clear(); add_terminal(out.net(), new_proxy->in()); @@ -759,7 +760,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &o //NOLINTNEXTLINE(misc-no-recursion) devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) { - nl_assert(inp.is_logic()); + gsl_Expects(inp.is_logic()); const auto &incast = dynamic_cast<const logic_input_t &>(inp); @@ -783,7 +784,7 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) if (inp.has_net()) { - for (detail::core_terminal_t * p : inp.net().core_terms()) + for (detail::core_terminal_t * p : nlstate().core_terms(inp.net())) { // inp may already belongs to the logic net. Thus skip it here. // It will be removed by the clear further down. @@ -799,7 +800,7 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) } } } - inp.net().core_terms().clear(); // clear the list + nlstate().core_terms(inp.net()).clear(); // clear the list } inp.clear_net(); add_terminal(ret->out().net(), inp); @@ -973,7 +974,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term ret = connect(t2, t1.net().railterminal()); if (!ret) { - for (auto & t : t1.net().core_terms()) + for (auto & t : nlstate().core_terms(t1.net())) { if (t->is_type(detail::terminal_type::TERMINAL)) ret = connect(t2, *t); @@ -988,7 +989,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term ret = connect(t1, t2.net().railterminal()); if (!ret) { - for (auto & t : t2.net().core_terms()) + for (auto & t : nlstate().core_terms(t2.net())) { if (t->is_type(detail::terminal_type::TERMINAL)) ret = connect(t1, *t); @@ -1174,7 +1175,7 @@ void setup_t::resolve_inputs() log().error(ME_TERMINAL_1_WITHOUT_NET(name_da)); err = true; } - else if (!term->net().has_connections()) + else if (nlstate().core_terms(term->net()).empty()) { if (term->is_logic_input()) log().warning(MW_LOGIC_INPUT_1_WITHOUT_CONNECTIONS(name_da)); @@ -1192,6 +1193,7 @@ void setup_t::resolve_inputs() log().warning(MW_TERMINAL_1_WITHOUT_CONNECTIONS(name_da)); } } + log().verbose("checking tristate consistency ..."); for (auto & i : m_terminals) { @@ -1224,7 +1226,7 @@ void setup_t::resolve_inputs() void setup_t::add_terminal(detail::net_t &net, detail::core_terminal_t &terminal) noexcept(false) { - for (auto &t : net.core_terms()) + for (auto &t : nlstate().core_terms(net)) if (t == &terminal) { log().fatal(MF_NET_1_DUPLICATE_TERMINAL_2(net.name(), t->name())); @@ -1233,15 +1235,15 @@ void setup_t::add_terminal(detail::net_t &net, detail::core_terminal_t &terminal terminal.set_net(&net); - net.core_terms().push_back(&terminal); + nlstate().core_terms(net).push_back(&terminal); } void setup_t::remove_terminal(detail::net_t &net, detail::core_terminal_t &terminal) noexcept(false) { - if (plib::container::contains(net.core_terms(), &terminal)) + if (plib::container::contains(nlstate().core_terms(net), &terminal)) { terminal.set_net(nullptr); - plib::container::remove(net.core_terms(), &terminal); + plib::container::remove(nlstate().core_terms(net), &terminal); } else { @@ -1252,9 +1254,9 @@ void setup_t::remove_terminal(detail::net_t &net, detail::core_terminal_t &termi void setup_t::move_connections(detail::net_t &net, detail::net_t &dest_net) { - for (auto &ct : net.core_terms()) + for (auto &ct : nlstate().core_terms(net)) add_terminal(dest_net, *ct); - net.core_terms().clear(); + nlstate().core_terms(net).clear(); } @@ -1305,7 +1307,7 @@ void models_t::model_parse(const pstring &model_in, map_t &map) if (!plib::endsWith(remainder, ")")) throw nl_exception(MF_MODEL_ERROR_1(model)); // FIMXE: Not optimal - remainder = plib::left(remainder, remainder.size() - 1); + remainder = plib::left(remainder, remainder.length() - 1); const auto pairs(plib::psplit(remainder,' ', true)); for (const pstring &pe : pairs) @@ -1353,7 +1355,7 @@ nl_fptype models_t::model_t::value(const pstring &entity) const pstring tmp = value_str(entity); nl_fptype factor = nlconst::one(); - auto p = std::next(tmp.begin(), plib::narrow_cast<pstring::difference_type>(tmp.size() - 1)); + auto p = std::next(tmp.begin(), plib::narrow_cast<pstring::difference_type>(tmp.length() - 1)); switch (*p) { case 'M': factor = nlconst::magic(1e6); break; // NOLINT @@ -1370,7 +1372,7 @@ nl_fptype models_t::model_t::value(const pstring &entity) const throw nl_exception(MF_UNKNOWN_NUMBER_FACTOR_IN_2(m_model, entity)); } if (factor != nlconst::one()) - tmp = plib::left(tmp, tmp.size() - 1); + tmp = plib::left(tmp, tmp.length() - 1); // FIXME: check for errors bool err(false); auto val = plib::pstonum_ne<nl_fptype>(tmp, err); @@ -1529,8 +1531,9 @@ void setup_t::delete_empty_nets() std::remove_if(m_nlstate.nets().begin(), m_nlstate.nets().end(), [](device_arena::owned_ptr<detail::net_t> &net) { - if (!net->has_connections()) + if (net->state().core_terms(*net).empty()) { + // FIXME: need to remove from state->m_core_terms as well. net->state().log().verbose("Deleting net {1} ...", net->name()); net->state().run_state_manager().remove_save_items(net.get()); return true; @@ -1607,13 +1610,10 @@ void setup_t::prepare_to_run() if (p != m_abstract.m_hints.end()) { p->second = true; // mark as used - if (use_deactivate) - d.second->set_hint_deactivate(false); - else - d.second->set_hint_deactivate(true); + d.second->set_hint_deactivate(false); } else - d.second->set_hint_deactivate(true); + d.second->set_hint_deactivate(use_deactivate); } if (errcnt > 0) @@ -1684,7 +1684,7 @@ void setup_t::prepare_to_run() for (auto &n : m_nlstate.nets()) { - for (auto & term : n->core_terms()) + for (auto & term : m_nlstate.core_terms(*n)) if (!term->delegate()) { log().fatal(MF_DELEGATE_NOT_SET_1(term->name())); @@ -1734,7 +1734,7 @@ plib::istream_uptr source_file_t::stream(const pstring &name) plib::istream_uptr source_pattern_t::stream(const pstring &name) { - pstring filename = plib::pfmt(m_pattern)(name); + pstring filename = plib::pfmt(m_pattern)(m_force_lowercase ? plib::lcase(name) : name); auto f = std::make_unique<plib::ifstream>(plib::filesystem::u8path(filename)); if (f->is_open()) { diff --git a/src/lib/netlist/nl_setup.h b/src/lib/netlist/nl_setup.h index fd9cb11afab..81f3e769a1d 100644 --- a/src/lib/netlist/nl_setup.h +++ b/src/lib/netlist/nl_setup.h @@ -23,7 +23,7 @@ #include <vector> //============================================================ -// MACROS / inline netlist definitions +// MACROS - netlist definitions //============================================================ #define NET_STR(x) # x @@ -274,10 +274,6 @@ namespace netlist unsigned m_frontier_cnt; }; - // ----------------------------------------------------------------------------- - // inline implementations - // ----------------------------------------------------------------------------- - } // namespace netlist diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h index 5781619af1a..548d64613f5 100644 --- a/src/lib/netlist/nltypes.h +++ b/src/lib/netlist/nltypes.h @@ -98,10 +98,10 @@ namespace netlist { using BC = plib::constants<T>; - static inline constexpr T np_VT(T n=BC::one(), T temp=BC::T0()) noexcept + static constexpr T np_VT(T n=BC::one(), T temp=BC::T0()) noexcept { return n * temp * BC::k_b() / BC::Q_e(); } - static inline constexpr T np_Is() noexcept { return static_cast<T>(1e-15); } // NOLINT + static constexpr T np_Is() noexcept { return static_cast<T>(1e-15); } // NOLINT /// \brief constant startup gmin /// @@ -109,19 +109,19 @@ namespace netlist /// conductivities with a reasonable value. /// During reset, the object should than make use of exec().gmin() /// to use the actual gmin() value. - static inline constexpr T cgmin() noexcept { return BC::magic(1e-9); } // NOLINT + static constexpr T cgmin() noexcept { return BC::magic(1e-9); } // NOLINT // FIXME: Some objects used 1e-15 for initial gmin. Needs to be // aligned with cgmin - static inline constexpr T cgminalt() noexcept { return BC::magic(1e-15); } // NOLINT + static constexpr T cgminalt() noexcept { return BC::magic(1e-15); } // NOLINT /// \brief Multiplier applied to VT in np diode models to determine range for constant model /// - static inline constexpr T diode_min_cutoff_mult() noexcept { return BC::magic(-5.0); } // NOLINT + static constexpr T diode_min_cutoff_mult() noexcept { return BC::magic(-5.0); } // NOLINT /// \brief Startup voltage used by np diode models /// - static inline constexpr T diode_start_voltage() noexcept { return BC::magic(0.7); } // NOLINT + static constexpr T diode_start_voltage() noexcept { return BC::magic(0.7); } // NOLINT }; @@ -191,9 +191,9 @@ namespace netlist // MACROS //============================================================ - template <typename T> inline constexpr netlist_time NLTIME_FROM_NS(T &&t) noexcept { return netlist_time::from_nsec(t); } - template <typename T> inline constexpr netlist_time NLTIME_FROM_US(T &&t) noexcept { return netlist_time::from_usec(t); } - template <typename T> inline constexpr netlist_time NLTIME_FROM_MS(T &&t) noexcept { return netlist_time::from_msec(t); } + template <typename T> constexpr netlist_time NLTIME_FROM_NS(T &&t) noexcept { return netlist_time::from_nsec(t); } + template <typename T> constexpr netlist_time NLTIME_FROM_US(T &&t) noexcept { return netlist_time::from_usec(t); } + template <typename T> constexpr netlist_time NLTIME_FROM_MS(T &&t) noexcept { return netlist_time::from_msec(t); } struct desc_base { diff --git a/src/lib/netlist/plib/gmres.h b/src/lib/netlist/plib/gmres.h index df0fc787c52..1709d1bb510 100644 --- a/src/lib/netlist/plib/gmres.h +++ b/src/lib/netlist/plib/gmres.h @@ -8,9 +8,9 @@ /// \file gmres.h /// -#include "mat_cr.h" #include "parray.h" #include "pconfig.h" +#include "pmatrix_cr.h" #include "vector_ops.h" #include <algorithm> @@ -33,11 +33,11 @@ namespace plib template <typename FT, int SIZE> struct mat_precondition_ILU { - using mat_type = plib::pmatrix_cr_t<FT, SIZE>; - using matLU_type = plib::pLUmatrix_cr_t<mat_type>; + using mat_type = plib::pmatrix_cr<FT, SIZE>; + using matLU_type = plib::pLUmatrix_cr<mat_type>; mat_precondition_ILU(std::size_t size, std::size_t ilu_scale = 4 - , std::size_t bw = plib::pmatrix_cr_t<FT, SIZE>::FILL_INFINITY) + , std::size_t bw = plib::pmatrix_cr<FT, SIZE>::FILL_INFINITY) : m_mat(narrow_cast<typename mat_type::index_type>(size)) , m_LU(narrow_cast<typename mat_type::index_type>(size)) , m_ILU_scale(narrow_cast<std::size_t>(ilu_scale)) @@ -167,7 +167,7 @@ namespace plib v[i] = v[i] * m_diag[i]; } - plib::pmatrix_cr_t<FT, SIZE> m_mat; + plib::pmatrix_cr<FT, SIZE> m_mat; plib::parray<FT, SIZE> m_diag; plib::parray<std::vector<std::size_t>, SIZE > nzcol; }; @@ -203,19 +203,23 @@ namespace plib plib::unused_var(v); } - plib::pmatrix_cr_t<FT, SIZE> m_mat; + plib::pmatrix_cr<FT, SIZE> m_mat; }; // FIXME: hardcoding RESTART to 20 becomes an issue on very large // systems. - template <typename FT, int SIZE, int RESTART = 16> + template <typename FT, int SIZE, int RESTARTMAX = 16> struct gmres_t { public: using float_type = FT; + //constexpr static int RESTART = RESTARTMAX; + constexpr static const int RESTART = (SIZE > 0) ? ((SIZE < RESTARTMAX) ? SIZE : RESTARTMAX) + : ((SIZE < 0) ? ((-SIZE < RESTARTMAX) ? -SIZE : RESTARTMAX) : RESTARTMAX); + explicit gmres_t(std::size_t size) : residual(size) , Ax(size) @@ -226,83 +230,8 @@ namespace plib { } - void givens_mult( const FT c, const FT s, FT & g0, FT & g1 ) - { - const FT g0_last(g0); - - g0 = c * g0 - s * g1; - g1 = s * g0_last + c * g1; - } - std::size_t size() const { return (SIZE<=0) ? m_size : narrow_cast<std::size_t>(SIZE); } - template <int k, typename OPS, typename VT> - bool do_k(OPS &ops, VT &x, std::size_t &itr_used, FT rho_delta, bool dummy) - { - plib::unused_var(dummy); - if (do_k<k-1, OPS>(ops, x, itr_used, rho_delta, do_khelper<k-1>::value)) - return true; - - const std::size_t kp1 = k + 1; - const std::size_t n = size(); - - ops.calc_rhs(m_v[kp1], m_v[k]); - ops.solve_inplace(m_v[kp1]); - - for (std::size_t j = 0; j <= k; j++) - { - m_ht[j][k] = vec_mult<FT>(n, m_v[kp1], m_v[j]); - vec_add_mult_scalar(n, m_v[kp1], m_v[j], -m_ht[j][k]); - } - m_ht[kp1][k] = plib::sqrt(vec_mult2<FT>(n, m_v[kp1])); - - // FIXME: comparison to zero - if (m_ht[kp1][k] != plib::constants<FT>::zero()) - vec_scale(n, m_v[kp1], reciprocal(m_ht[kp1][k])); - - for (std::size_t j = 0; j < k; j++) - givens_mult(m_c[j], m_s[j], m_ht[j][k], m_ht[j+1][k]); - - const float_type mu = reciprocal(plib::hypot(m_ht[k][k], m_ht[kp1][k])); - - m_c[k] = m_ht[k][k] * mu; - m_s[k] = -m_ht[kp1][k] * mu; - m_ht[k][k] = m_c[k] * m_ht[k][k] - m_s[k] * m_ht[kp1][k]; - m_ht[kp1][k] = plib::constants<FT>::zero(); - - givens_mult(m_c[k], m_s[k], m_g[k], m_g[kp1]); - - FT rho = plib::abs(m_g[kp1]); - - // FIXME .. - itr_used = itr_used + 1; - - if (rho <= rho_delta || k == RESTART-1) - { - // Solve the system H * y = g - // x += m_v[j] * m_y[j] - for (std::size_t i = k + 1; i-- > 0;) - { - auto tmp(m_g[i]); - for (std::size_t j = i + 1; j <= k; j++) - tmp -= m_ht[i][j] * m_y[j]; - m_y[i] = tmp / m_ht[i][i]; - } - - for (std::size_t i = 0; i <= k; i++) - vec_add_mult_scalar(n, x, m_v[i], m_y[i]); - return true; - } - return false; - } - - template <int k, typename OPS, typename VT> - bool do_k(OPS &ops, VT &x, std::size_t &itr_used, FT rho_delta, float dummy) - { - plib::unused_var(ops, x, itr_used, rho_delta, dummy); - return false; - } - template <typename OPS, typename VT, typename VRHS> std::size_t solve(OPS &ops, VT &x, const VRHS & rhs, const std::size_t itr_max, float_type accuracy) { @@ -348,19 +277,23 @@ namespace plib // differently: The invest doesn't pay off. // - vec_set_scalar(n, residual, accuracy); + vec_set_scalar(residual, accuracy); ops.calc_rhs(Ax, residual); ops.solve_inplace(Ax); - const float_type rho_to_accuracy = plib::sqrt(vec_mult2<FT>(n, Ax)) / accuracy; + const float_type rho_to_accuracy = plib::sqrt(vec_mult2<FT>(Ax)) / accuracy; rho_delta = accuracy * rho_to_accuracy; } else + //rho_delta = accuracy * plib::sqrt(vec_mult2<FT>(n, rhs)) + // + 1e-4 * std::sqrt(n); rho_delta = accuracy * plib::sqrt(narrow_cast<FT>(n)); // + // LU x = b; solve for x; + // // Using // // vec_set(n, x, rhs); @@ -368,9 +301,6 @@ namespace plib // // to get a starting point for x degrades convergence speed compared // to using the last solution for x. - // - // LU x = b; solve for x; - // while (itr_used < itr_max) { @@ -378,11 +308,11 @@ namespace plib ops.calc_rhs(Ax, x); - vec_sub(n, residual, rhs, Ax); + vec_sub(residual, rhs, Ax); ops.solve_inplace(residual); - rho = plib::sqrt(vec_mult2<FT>(n, residual)); + rho = plib::sqrt(vec_mult2<FT>(residual)); if (rho < rho_delta) return itr_used + 1; @@ -391,10 +321,10 @@ namespace plib // on some systems / compiler versions. Issue reported by // AJR, no details known yet. - vec_set_scalar(RESTART+1, m_g, +constants<FT>::zero()); + vec_set_scalar(m_g, +constants<FT>::zero()); m_g[0] = rho; - vec_mult_scalar(n, m_v[0], residual, reciprocal(rho)); + vec_mult_scalar(m_v[0], residual, plib::reciprocal(rho)); if (do_k<RESTART-1>(ops, x, itr_used, rho_delta, true)) // converged @@ -405,6 +335,83 @@ namespace plib private: + static void givens_mult(FT c, FT s, FT & g0, FT & g1 ) + { + const FT g0_last(g0); + + g0 = c * g0 - s * g1; + g1 = s * g0_last + c * g1; + } + + template <int k, typename OPS, typename VT> + bool do_k(OPS &ops, VT &x, std::size_t &itr_used, FT rho_delta, bool dummy) + { + plib::unused_var(dummy); + if (do_k<k-1, OPS>(ops, x, itr_used, rho_delta, do_khelper<k-1>::value)) + return true; + + constexpr const std::size_t kp1 = k + 1; + //const std::size_t n = size(); + + ops.calc_rhs(m_v[kp1], m_v[k]); + ops.solve_inplace(m_v[kp1]); + + for (std::size_t j = 0; j <= k; j++) + { + m_ht[j][k] = vec_mult<FT>(m_v[kp1], m_v[j]); + vec_add_mult_scalar(m_v[kp1], m_v[j], -m_ht[j][k]); + } + m_ht[kp1][k] = plib::sqrt(vec_mult2<FT>(m_v[kp1])); + + // FIXME: comparison to zero + if (m_ht[kp1][k] != plib::constants<FT>::zero()) + vec_scale(m_v[kp1], reciprocal(m_ht[kp1][k])); + + for (std::size_t j = 0; j < k; j++) + givens_mult(m_c[j], m_s[j], m_ht[j][k], m_ht[j+1][k]); + + const float_type mu = reciprocal(plib::hypot(m_ht[k][k], m_ht[kp1][k])); + + m_c[k] = m_ht[k][k] * mu; + m_s[k] = -m_ht[kp1][k] * mu; + m_ht[k][k] = m_c[k] * m_ht[k][k] - m_s[k] * m_ht[kp1][k]; + m_ht[kp1][k] = plib::constants<FT>::zero(); + + givens_mult(m_c[k], m_s[k], m_g[k], m_g[kp1]); + + const float_type rho = plib::abs(m_g[kp1]); + + // FIXME .. + itr_used = itr_used + 1; + + if (rho <= rho_delta || k == RESTART-1) + { + // Solve the system H * y = g + // x += m_v[j] * m_y[j] + for (std::size_t i = k + 1; i-- > 0;) + { + auto tmp(m_g[i]); + const auto htii=plib::reciprocal(m_ht[i][i]); + for (std::size_t j = i + 1; j <= k; j++) + tmp -= m_ht[i][j] * m_y[j]; + m_y[i] = tmp * htii; + vec_add_mult_scalar(x, m_v[i], m_y[i]); + } + + //for (std::size_t i = 0; i <= k; i++) + // vec_add_mult_scalar(n, x, m_v[i], m_y[i]); + return true; + } + return false; + } + + template <int k, typename OPS, typename VT> + bool do_k(OPS &ops, VT &x, std::size_t &itr_used, FT rho_delta, float dummy) + { + plib::unused_var(ops, x, itr_used, rho_delta, dummy); + return false; + } + plib::parray<float_type, SIZE> residual; plib::parray<float_type, SIZE> Ax; diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index 50507d10eea..9243645f781 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -256,7 +256,10 @@ namespace plib { ~arena_allocator() noexcept = default; - PCOPYASSIGNMOVE(arena_allocator, default) + arena_allocator(const arena_allocator &) = default; + arena_allocator &operator=(const arena_allocator &) = default; + arena_allocator(arena_allocator &&) noexcept = default; + arena_allocator &operator=(arena_allocator &&) noexcept = default; explicit arena_allocator(arena_type & a) noexcept : m_a(a) { @@ -288,7 +291,7 @@ namespace plib { void construct(U* p, Args&&... args) { // NOLINTNEXTLINE(cppcoreguidelines-owning-memory) - ::new (static_cast<void *>(p)) U(std::forward<Args>(args)...); + ::new (void_ptr_cast(p)) U(std::forward<Args>(args)...); } template<typename U> diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h index 514c231025b..54d72484ac2 100644 --- a/src/lib/netlist/plib/parray.h +++ b/src/lib/netlist/plib/parray.h @@ -105,12 +105,9 @@ namespace plib { { } - // osx clang doesn't like COPYASSIGNMOVE(parray, default) - // it will generate some weird error messages about move assignment - // constructor having a different noexcept status. - parray(const parray &rhs) : m_a(rhs.m_a), m_size(rhs.m_size) {} parray(parray &&rhs) noexcept : m_a(std::move(rhs.m_a)), m_size(std::move(rhs.m_size)) {} + parray &operator=(const parray &rhs) noexcept // NOLINT(bugprone-unhandled-self-assignment, cert-oop54-cpp) { if (this == &rhs) @@ -127,7 +124,7 @@ namespace plib { base_type &as_base() noexcept { return m_a; } - inline size_type size() const noexcept { return SIZE <= 0 ? m_size : SIZEABS(); } + constexpr size_type size() const noexcept { return SIZE <= 0 ? m_size : SIZEABS(); } constexpr size_type max_size() const noexcept { return base_type::max_size(); } @@ -135,11 +132,11 @@ namespace plib { constexpr reference operator[](size_type i) noexcept { - return data()[i]; + return m_a[i]; } constexpr const_reference operator[](size_type i) const noexcept { - return data()[i]; + return m_a[i]; } pointer data() noexcept { return m_a.data(); } @@ -157,6 +154,7 @@ namespace plib { public: using size_type = std::size_t; + using base_type = parray<parray<FT, SIZE2>, SIZE1>; parray2D(size_type size1, size_type size2) : parray<parray<FT, SIZE2>, SIZE1>(size1) @@ -168,7 +166,10 @@ namespace plib { } } - PCOPYASSIGNMOVE(parray2D, default) + parray2D(const parray2D &) = default; + parray2D &operator=(const parray2D &) = default; + parray2D(parray2D &&) noexcept(std::is_nothrow_move_constructible<base_type>::value) = default; + parray2D &operator=(parray2D &&) noexcept(std::is_nothrow_move_assignable<base_type>::value) = default; ~parray2D() noexcept = default; diff --git a/src/lib/netlist/plib/pchrono.h b/src/lib/netlist/plib/pchrono.h index 6695f238290..813c3e651f3 100644..100755 --- a/src/lib/netlist/plib/pchrono.h +++ b/src/lib/netlist/plib/pchrono.h @@ -20,9 +20,9 @@ namespace plib { struct sys_ticks { using type = typename T::rep; - static inline constexpr type start() noexcept { return T::now().time_since_epoch().count(); } - static inline constexpr type stop() noexcept { return T::now().time_since_epoch().count(); } - static inline constexpr type per_second() noexcept { return T::period::den / T::period::num; } + static constexpr type start() noexcept { return T::now().time_since_epoch().count(); } + static constexpr type stop() noexcept { return T::now().time_since_epoch().count(); } + static constexpr type per_second() noexcept { return T::period::den / T::period::num; } }; using hires_ticks = sys_ticks<std::chrono::high_resolution_clock>; @@ -194,29 +194,32 @@ namespace plib { struct guard_t { guard_t() = delete; - explicit guard_t(timer &m) noexcept : m_m(m) { m_m.m_time -= T::start(); } - ~guard_t() noexcept { m_m.m_time += T::stop(); ++m_m.m_count; } + explicit constexpr guard_t(timer &m) noexcept : m_m(&m) { m_m->m_time -= T::start(); } + ~guard_t() noexcept { m_m->m_time += T::stop(); ++m_m->m_count; } - PCOPYASSIGNMOVE(guard_t, default) + constexpr guard_t(const guard_t &) = default; + constexpr guard_t &operator=(const guard_t &) = default; + constexpr guard_t(guard_t &&) noexcept = default; + constexpr guard_t &operator=(guard_t &&) noexcept = default; private: - timer &m_m; + timer *m_m; }; - timer() : m_time(0), m_count(0) { } + constexpr timer() : m_time(0), m_count(0) { } - type operator()() const { return m_time; } + constexpr type operator()() const { return m_time; } void reset() noexcept { m_time = 0; m_count = 0; } - type average() const noexcept { return (m_count == 0) ? 0 : m_time / m_count; } - type total() const noexcept { return m_time; } - ctype count() const noexcept { return m_count; } + constexpr type average() const noexcept { return (m_count == 0) ? 0 : m_time / m_count; } + constexpr type total() const noexcept { return m_time; } + constexpr ctype count() const noexcept { return m_count; } template <typename S> - S as_seconds() const noexcept { return narrow_cast<S>(total()) + constexpr S as_seconds() const noexcept { return narrow_cast<S>(total()) / narrow_cast<S>(T::per_second()); } - guard_t guard() noexcept { return guard_t(*this); } + constexpr guard_t guard() noexcept { return guard_t(*this); } // pause must be followed by cont(inue) void stop() noexcept { m_time += T::stop(); } @@ -236,8 +239,13 @@ namespace plib { struct guard_t { - guard_t() = default; - PCOPYASSIGNMOVE(guard_t, default) + constexpr guard_t() = default; + + constexpr guard_t(const guard_t &) = default; + constexpr guard_t &operator=(const guard_t &) = default; + constexpr guard_t(guard_t &&) noexcept = default; + constexpr guard_t &operator=(guard_t &&) noexcept = default; + // using default constructor will trigger warning on // unused local variable. @@ -251,7 +259,7 @@ namespace plib { constexpr type total() const noexcept { return 0; } constexpr ctype count() const noexcept { return 0; } template <typename S> - S as_seconds() const noexcept { return narrow_cast<S>(0); } + constexpr S as_seconds() const noexcept { return narrow_cast<S>(0); } constexpr static bool enabled = false; guard_t guard() { return guard_t(); } }; diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h index c80f1bbadd6..4253ff355b1 100644 --- a/src/lib/netlist/plib/pconfig.h +++ b/src/lib/netlist/plib/pconfig.h @@ -8,7 +8,7 @@ /// \file pconfig.h /// -/// \brief More accurate measurements if you processor supports RDTSCP. +/// \brief More accurate measurements the processor supports RDTSCP. /// #ifndef PHAS_RDTSCP #define PHAS_RDTSCP (0) @@ -75,8 +75,13 @@ #define PALIGN_MIN_SIZE (16) +#if (PUSE_ALIGNED_OPTIMIZATIONS) #define PALIGNAS_CACHELINE() PALIGNAS(PALIGN_CACHELINE) #define PALIGNAS_VECTOROPT() PALIGNAS(PALIGN_VECTOROPT) +#else +#define PALIGNAS_CACHELINE() +#define PALIGNAS_VECTOROPT() +#endif // FIXME: Breaks mame build on windows mingw due to -Wattribute // also triggers -Wattribute on ARM diff --git a/src/lib/netlist/plib/pexception.cpp b/src/lib/netlist/plib/pexception.cpp index 56ef7f93efb..d974c6b9a4e 100644 --- a/src/lib/netlist/plib/pexception.cpp +++ b/src/lib/netlist/plib/pexception.cpp @@ -102,7 +102,7 @@ namespace plib { } - bool fpsignalenabler::m_enable = false; + bool fpsignalenabler::m_enable = false; // NOLINT //FIXME: mingw needs to be compiled with "-fnon-call-exceptions" @@ -117,7 +117,8 @@ namespace plib { if (fpexceptions & plib::FP_UNDERFLOW) b = b | FE_UNDERFLOW; if (fpexceptions & plib::FP_OVERFLOW) b = b | FE_OVERFLOW; if (fpexceptions & plib::FP_INVALID) b = b | FE_INVALID; - m_last_enabled = feenableexcept(b); + if ((b & m_last_enabled) != b) + m_last_enabled = feenableexcept(b); } #elif defined(_WIN32) && defined(_EM_INEXACT) if (m_enable) @@ -136,7 +137,6 @@ namespace plib { #endif } - fpsignalenabler::~fpsignalenabler() { #if HAS_FEENABLE_EXCEPT diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h index 709f8810b83..efed23d6178 100644 --- a/src/lib/netlist/plib/pexception.h +++ b/src/lib/netlist/plib/pexception.h @@ -39,7 +39,7 @@ namespace plib { public: explicit pexception(const pstring &text); - const pstring &text() const noexcept { return m_text; } + const putf8string &text() const noexcept { return m_text; } const char* what() const noexcept override { return m_text.c_str(); } private: @@ -125,7 +125,7 @@ namespace plib { private: int m_last_enabled; - static bool m_enable; + static bool m_enable; // NOLINT }; diff --git a/src/lib/netlist/plib/pfmtlog.cpp b/src/lib/netlist/plib/pfmtlog.cpp index ddb9b5dd2e5..32468752658 100644 --- a/src/lib/netlist/plib/pfmtlog.cpp +++ b/src/lib/netlist/plib/pfmtlog.cpp @@ -47,7 +47,7 @@ pfmt::rtype pfmt::setfmt(std::stringstream &strm, char32_t cfmt_spec) rtype r; - r.sl = search.size(); + r.sl = search.length(); r.p = m_str.find(search + ':'); r.sl++; // ":" if (r.p == pstring::npos) // no further specifiers @@ -94,11 +94,12 @@ pfmt::rtype pfmt::setfmt(std::stringstream &strm, char32_t cfmt_spec) int width(0); if (!fmt.empty() && pstring("duxofge").find(static_cast<pstring::value_type>(cfmt_spec)) != pstring::npos) { - pend = static_cast<char32_t>(fmt.at(fmt.size() - 1)); + //pend = static_cast<char32_t>(fmt.at(fmt.size() - 1)); + pend = plib::right(fmt, 1).at(0); if (pstring("duxofge").find(static_cast<pstring::value_type>(pend)) == pstring::npos) pend = cfmt_spec; else - fmt = plib::left(fmt, fmt.size() - 1); + fmt = plib::left(fmt, fmt.length() - 1); } else // FIXME: Error diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index 45f7d3e4fc1..fd04f58bc73 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -9,6 +9,7 @@ #define PFMTLOG_H_ #include "penum.h" +#include "pgsl.h" #include "ppmf.h" #include "pstring.h" #include "ptypes.h" @@ -40,7 +41,7 @@ namespace plib { { static constexpr const bool is_signed = std::numeric_limits<T>::is_signed; static char32_t fmt_spec() { return 'u'; } - static inline void streamify(std::ostream &s, const T &v) + static void streamify(std::ostream &s, const T &v) { s << v; } @@ -53,7 +54,7 @@ namespace plib { // FIXME: need native support at some time static constexpr const bool is_signed = true; static char32_t fmt_spec() { return 'f'; } - static inline void streamify(std::ostream &s, const FLOAT128 &v) + static void streamify(std::ostream &s, const FLOAT128 &v) { s << narrow_cast<long double>(v); } @@ -64,6 +65,19 @@ namespace plib { struct ptype_traits; template<> + struct ptype_traits<compile_info::int128_type> + { + // FIXME: need native support at some time + static constexpr const bool is_signed = true; + static char32_t fmt_spec() { return 'd'; } + template <typename T, typename = std::enable_if_t<plib::is_arithmetic<T>::value>> + static void streamify(std::ostream &s, const T &v) + { + s << narrow_cast<long long>(v); + } + }; + + template<> struct ptype_traits<bool> : ptype_traits_base<bool> { }; @@ -160,6 +174,7 @@ namespace plib { }; #endif + template<> struct ptype_traits<char *> : ptype_traits_base<char *> { @@ -176,7 +191,7 @@ namespace plib { struct ptype_traits<const char16_t *> : ptype_traits_base<const char16_t *> { static char32_t fmt_spec() { return 's'; } - static inline void streamify(std::ostream &s, const char16_t *v) + static void streamify(std::ostream &s, const char16_t *v) { const putf16string su16(v); s << putf8string(su16).c_str(); @@ -187,7 +202,7 @@ namespace plib { struct ptype_traits<const char32_t *> : ptype_traits_base<const char32_t *> { static char32_t fmt_spec() { return 's'; } - static inline void streamify(std::ostream &s, const char32_t *v) + static void streamify(std::ostream &s, const char32_t *v) { const putf32string su32(v); s << putf8string(su32).c_str(); @@ -210,7 +225,7 @@ namespace plib { struct ptype_traits<putf16string> : ptype_traits_base<putf16string> { static char32_t fmt_spec() { return 's'; } - static inline void streamify(std::ostream &s, const putf16string &v) + static void streamify(std::ostream &s, const putf16string &v) { s << putf8string(v).c_str(); } @@ -436,7 +451,7 @@ namespace plib { fatal(logger) {} - PCOPYASSIGNMOVE(plog_base, default) + PCOPYASSIGNMOVE(plog_base, delete) virtual ~plog_base() noexcept = default; plog_channel<plog_level::DEBUG, debug_enabled> debug; diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp index 5a00844becc..d592a90d670 100644 --- a/src/lib/netlist/plib/pfunction.cpp +++ b/src/lib/netlist/plib/pfunction.cpp @@ -118,7 +118,7 @@ namespace plib { auto p = pcmds().find(cmd); if (p != pcmds().end()) { - rc.m_cmd = p->second.cmd; + rc = rpn_inst(p->second.cmd); stk -= p->second.adj; } else @@ -127,23 +127,20 @@ namespace plib { { if (inputs[i] == cmd) { - rc.m_cmd = PUSH_INPUT; - rc.m_param.index = i; + rc = rpn_inst(PUSH_INPUT, i); stk += 1; break; } } - if (rc.m_cmd != PUSH_INPUT) + if (rc.cmd() != PUSH_INPUT) { - using fl_t = decltype(rc.m_param.val); - rc.m_cmd = PUSH_CONST; bool err(false); auto rs(plib::right(cmd,1)); - auto r=units_si<fl_t>().find(rs); - if (r == units_si<fl_t>().end()) - rc.m_param.val = plib::pstonum_ne<fl_t>(cmd, err); + auto r=units_si<NT>().find(rs); + if (r == units_si<NT>().end()) + rc = rpn_inst(plib::pstonum_ne<NT>(cmd, err)); else - rc.m_param.val = plib::pstonum_ne<fl_t>(plib::left(cmd, cmd.size()-1), err) * r->second; + rc = rpn_inst(plib::pstonum_ne<NT>(plib::left(cmd, cmd.length()-1), err) * r->second); if (err) throw pexception(plib::pfmt("pfunction: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); stk += 1; @@ -153,10 +150,13 @@ namespace plib { throw pexception(plib::pfmt("pfunction: stack underflow on token <{1}> in <{2}>")(cmd)(expr)); if (stk >= narrow_cast<int>(MAX_STACK)) throw pexception(plib::pfmt("pfunction: stack overflow on token <{1}> in <{2}>")(cmd)(expr)); + if (rc.cmd() == LP || rc.cmd() == RP) + throw pexception(plib::pfmt("pfunction: parenthesis inequality on token <{1}> in <{2}>")(cmd)(expr)); m_precompiled.push_back(rc); } if (stk != 1) throw pexception(plib::pfmt("pfunction: stack count {1} different to one on <{2}>")(stk, expr)); + compress(); } static bool is_number(const pstring &n) @@ -339,27 +339,105 @@ namespace plib { return narrow_cast<NT>(lfsr); } #endif - #define ST0 stack[ptr+1] - #define ST1 stack[ptr] - #define ST2 stack[ptr-1] + #define ST0 *(ptr+1) + #define ST1 *ptr + #define ST2 *(ptr-1) #define OP(OP, ADJ, EXPR) \ case OP: \ ptr-= (ADJ); \ - stack[ptr-1] = (EXPR); \ + *(ptr-1) = (EXPR); \ + break; + + #define OP0(OP, EXPR) \ + case OP: \ + *(ptr++) = (EXPR); \ break; template <typename NT> NT pfunction<NT>::evaluate(const values_container &values) noexcept { - std::array<value_type, MAX_STACK> stack = { plib::constants<value_type>::zero() }; + std::array<value_type, MAX_STACK> stack; // NOLINT + value_type *ptr = stack.data(); + constexpr const auto zero = plib::constants<value_type>::zero(); + constexpr const auto one = plib::constants<value_type>::one(); + for (const auto &rc : m_precompiled) + { + switch (rc.cmd()) + { + OP(ADD, 1, ST2 + ST1) + OP(MULT, 1, ST2 * ST1) + OP(SUB, 1, ST2 - ST1) + OP(DIV, 1, ST2 / ST1) + OP(EQ, 1, ST2 == ST1 ? one : zero) + OP(NE, 1, ST2 != ST1 ? one : zero) + OP(GT, 1, ST2 > ST1 ? one : zero) + OP(LT, 1, ST2 < ST1 ? one : zero) + OP(LE, 1, ST2 <= ST1 ? one : zero) + OP(GE, 1, ST2 >= ST1 ? one : zero) + OP(IF, 2, (ST2 != zero) ? ST1 : ST0) + OP(NEG, 0, -ST2) + OP(POW, 1, plib::pow(ST2, ST1)) + OP(LOG, 0, plib::log(ST2)) + OP(SIN, 0, plib::sin(ST2)) + OP(COS, 0, plib::cos(ST2)) + OP(MAX, 1, std::max(ST2, ST1)) + OP(MIN, 1, std::min(ST2, ST1)) + OP(TRUNC, 0, plib::trunc(ST2)) + OP0(RAND, lfsr_random<value_type>(m_lfsr)) + OP0(PUSH_INPUT, values[rc.index()]) + OP0(PUSH_CONST, rc.value()) + // please compiler + case LP: + case RP: + break; + } + } + return *(ptr-1); + } + +#undef ST0 +#undef ST1 +#undef ST2 +#undef OP +#undef OP0 + +#define ST0 m_precompiled[ptr+0].value() +#define ST1 m_precompiled[ptr-1].value() +#define ST2 m_precompiled[ptr-2].value() + +#define OP(OP, ADJ, EXPR) \ + case OP: \ + if (ADJ == 2) {\ + if (m_precompiled[ptr-3].cmd() == PUSH_CONST && m_precompiled[ptr-2].cmd() == PUSH_CONST && m_precompiled[ptr-1].cmd() == PUSH_CONST) \ + { ptr--; m_precompiled[ptr-2] = rpn_inst(EXPR); n -= 3; ptr++; std::copy(m_precompiled.begin()+(ptr+1), m_precompiled.end(), m_precompiled.begin()+(ptr-2)); ptr-=2;} \ + else { ptr++; } \ + } else if (ADJ == 1) {\ + if (m_precompiled[ptr-2].cmd() == PUSH_CONST && m_precompiled[ptr-1].cmd() == PUSH_CONST) \ + { m_precompiled[ptr-2] = rpn_inst(EXPR); n -= 2; std::copy(m_precompiled.begin()+(ptr+1), m_precompiled.end(), m_precompiled.begin()+(ptr-1)); ptr--;} \ + else { ptr++; } \ + } else if (ADJ == 0) {\ + if (m_precompiled[ptr-1].cmd() == PUSH_CONST) \ + { ptr++; m_precompiled[ptr-2] = rpn_inst(EXPR); n -= 1; ptr--; std::copy(m_precompiled.begin()+(ptr+1), m_precompiled.end(), m_precompiled.begin()+(ptr)); } \ + else { ptr++; } \ + } else ptr++; \ + break; + +#define OP0(OP, EXPR) \ + case OP: \ + ptr++; \ + break; + + template <typename NT> + void pfunction<NT>::compress() + { + constexpr const auto zero = plib::constants<value_type>::zero(); + constexpr const auto one = plib::constants<value_type>::one(); unsigned ptr = 0; - constexpr auto zero = plib::constants<value_type>::zero(); - constexpr auto one = plib::constants<value_type>::one(); - stack[0] = plib::constants<value_type>::zero(); - for (auto &rc : m_precompiled) + auto n = m_precompiled.size(); + for (; ptr < n; ) { - switch (rc.m_cmd) + switch (m_precompiled[ptr].cmd()) { OP(ADD, 1, ST2 + ST1) OP(MULT, 1, ST2 * ST1) @@ -380,22 +458,17 @@ namespace plib { OP(MAX, 1, std::max(ST2, ST1)) OP(MIN, 1, std::min(ST2, ST1)) OP(TRUNC, 0, plib::trunc(ST2)) - case RAND: - stack[ptr++] = lfsr_random<value_type>(m_lfsr); - break; - case PUSH_INPUT: - stack[ptr++] = values[rc.m_param.index]; - break; - case PUSH_CONST: - stack[ptr++] = rc.m_param.val; - break; + OP0(RAND, lfsr_random<value_type>(m_lfsr)) + OP0(PUSH_INPUT, values[rc.index()]) + OP0(PUSH_CONST, rc.value()) // please compiler case LP: case RP: break; } } - return stack[ptr-1]; + //printf("func %lld %lld\n", m_precompiled.size(), n); + m_precompiled.resize(n); } template class pfunction<float>; diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h index 0178e81c04e..9c2450d427c 100644 --- a/src/lib/netlist/plib/pfunction.h +++ b/src/lib/netlist/plib/pfunction.h @@ -58,10 +58,32 @@ namespace plib { { struct rpn_inst { - rpn_inst() : m_cmd(ADD) + constexpr rpn_inst() : m_cmd(ADD) { m_param.val = plib::constants<NT>::zero(); } + constexpr rpn_inst(rpn_cmd cmd, std::size_t index = 0) + : m_cmd(cmd) + { + m_param.index = index; + } + constexpr rpn_inst(NT v) : m_cmd(PUSH_CONST) + { + m_param.val = v; + } + constexpr const rpn_cmd &cmd() const noexcept + { + return m_cmd; + } + constexpr const NT &value() const noexcept + { + return m_param.val; // NOLINT + } + constexpr const std::size_t &index() const noexcept + { + return m_param.index; // NOLINT + } + private: rpn_cmd m_cmd; union { @@ -138,6 +160,7 @@ namespace plib { private: + void compress(); void compile_postfix(const inputs_container &inputs, const std::vector<pstring> &cmds, const pstring &expr); diff --git a/src/lib/netlist/plib/pgsl.h b/src/lib/netlist/plib/pgsl.h index ab7798071a5..cb95ecc334c 100644 --- a/src/lib/netlist/plib/pgsl.h +++ b/src/lib/netlist/plib/pgsl.h @@ -25,6 +25,8 @@ #if defined(__has_builtin) // clang and gcc 10 #if __has_builtin(__builtin_unreachable) #define gsl_Expects(e) ((e) ? static_cast<void>(0) : __builtin_unreachable()) + #else + #define gsl_Expects(e) ((e) ? static_cast<void>(0) : static_cast<void>(0)) #endif #elif defined(__GNUC__) && !(defined( __CUDACC__ ) && defined( __CUDA_ARCH__ )) #define gsl_Expects(e) ((e) ? static_cast<void>(0) : __builtin_unreachable()) @@ -34,8 +36,24 @@ #define gsl_Expects(e) ((e) ? static_cast<void>(0) : static_cast<void>(0)) #endif +#if 1 +// FIXME: __builtin_unreachable contrary to google sources does not seem to be of +// any use and decreases performance slightly. Convert gsl_Expects to a noop +// and revisit in the future. #undef gsl_Expects #define gsl_Expects(e) do {} while (0) + +#if 0 +// Alternative and c++ style implementation. Suffers from the same drawbacks +// like __builtin_unreachable +static constexpr inline void gsl_Expects(const bool &e) +{ + if (!e) + __builtin_unreachable(); +} +#endif +#endif + #define gsl_Ensures(e) gsl_Expects(e) namespace plib { @@ -52,7 +70,7 @@ namespace plib { /// \brief perform a narrowing cast without checks /// template <typename T, typename O> - inline constexpr T narrow_cast(O && v) noexcept + constexpr T narrow_cast(O && v) noexcept { static_assert(plib::is_arithmetic<T>::value && std::is_convertible<std::remove_reference_t<O>, T>::value, "narrow cast expects conversion between arithmetic types"); return static_cast<T>(std::forward<O>(v)); @@ -62,7 +80,7 @@ namespace plib { /// /// The c++ core guidelines require the narrow function to raise an error /// This will make narrow noexcept(false). This has shown to have a - /// measurable impact on performance and thus we deviate we deviate from + /// measurable impact on performance and thus we deviate from /// the standard here. /// template <typename T, typename O> @@ -82,14 +100,14 @@ namespace plib { } // namespace pgsl - /// \brief downcast from base tpye to derived type + /// \brief downcast from base type to derived type /// /// The cpp core guidelines require a very careful use of static cast /// for downcast operations. This template is used to identify these uses /// and later for debug builds use dynamic_cast. /// template <typename D, typename B> - inline constexpr D downcast(B && b) noexcept + constexpr D downcast(B && b) noexcept { static_assert(std::is_pointer<D>::value || std::is_reference<D>::value, "downcast only supports pointers or reference for derived"); static_assert(std::is_pointer<B>::value || std::is_reference<B>::value, "downcast only supports pointers or reference for base"); @@ -97,6 +115,15 @@ namespace plib { } using pgsl::narrow_cast; + + /// \brief cast to void * + /// + /// The purpose here is to help identifiy casts to void in the code. + /// These case usuallyindicate some wizard assumptioms which should be easily + /// be easy to identify. + template <typename T> + constexpr void * void_ptr_cast(T *ptr) noexcept { return static_cast<void *>(ptr); } + } // namespace plib //FIXME: This is the place to use more complete implementations diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h index 328f0b1ad23..41f68d989c2 100755 --- a/src/lib/netlist/plib/plists.h +++ b/src/lib/netlist/plib/plists.h @@ -42,7 +42,11 @@ namespace plib { //uninitialised_array_t() noexcept = default; uninitialised_array() noexcept = default; - PCOPYASSIGNMOVE(uninitialised_array, delete) + uninitialised_array(const uninitialised_array &) = default; + uninitialised_array &operator=(const uninitialised_array &) = default; + uninitialised_array(uninitialised_array &&) noexcept = default; + uninitialised_array &operator=(uninitialised_array &&) noexcept = default; + ~uninitialised_array() noexcept = default; constexpr size_t size() const noexcept { return N; } @@ -111,7 +115,11 @@ namespace plib { { } - PCOPYASSIGNMOVE(static_vector, delete) + static_vector(const static_vector &) = default; + static_vector &operator=(const static_vector &) = default; + static_vector(static_vector &&) noexcept = default; + static_vector &operator=(static_vector &&) noexcept = default; + ~static_vector() noexcept { clear(); @@ -172,7 +180,7 @@ namespace plib { /// \brief a simple linked list. /// - /// The list allows insertions deletions whilst being processed. + /// The list allows insertions and deletions whilst being processed. /// template <class LC> class linkedlist_t @@ -187,10 +195,13 @@ namespace plib { constexpr element_t() : m_next(nullptr), m_prev(nullptr) {} ~element_t() noexcept = default; - PCOPYASSIGNMOVE(element_t, delete) + element_t(const element_t &) = default; \ + element_t &operator=(const element_t &) = default; + element_t(element_t &&) noexcept = default; + element_t &operator=(element_t &&) noexcept = default; - constexpr LC *next() const noexcept { return m_next; } - constexpr LC *prev() const noexcept { return m_prev; } + constexpr LC * &next() noexcept { return m_next; } + constexpr LC * &prev() noexcept { return m_prev; } private: LC * m_next; LC * m_prev; @@ -202,22 +213,14 @@ namespace plib { LC* p; public: explicit constexpr iter_t(LC* x) noexcept : p(x) { } - constexpr iter_t(iter_t &rhs) noexcept : p(rhs.p) { } - iter_t(iter_t &&rhs) noexcept { std::swap(*this, rhs); } - - iter_t& operator=(const iter_t &rhs) noexcept // NOLINT(bugprone-unhandled-self-assignment, cert-oop54-cpp) - { - if (this == &rhs) - return *this; - - p = rhs.p; - return *this; - } + constexpr iter_t(const iter_t &rhs) noexcept = default; + iter_t(iter_t &&rhs) noexcept = default; - iter_t& operator=(iter_t &&rhs) noexcept { std::swap(*this, rhs); return *this; } - ~iter_t() = default; + iter_t& operator=(const iter_t &rhs) noexcept = default; + iter_t& operator=(iter_t &&rhs) noexcept = default; + ~iter_t() noexcept = default; - iter_t& operator++() noexcept { p = p->next();return *this; } + iter_t& operator++() noexcept { p = p->next(); return *this; } // NOLINTNEXTLINE(cert-dcl21-cpp) iter_t operator++(int) & noexcept { const iter_t tmp(*this); operator++(); return tmp; } diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h index 02d634529a0..a59f566a91d 100644 --- a/src/lib/netlist/plib/pmath.h +++ b/src/lib/netlist/plib/pmath.h @@ -30,50 +30,50 @@ namespace plib template <typename T> struct constants { - static inline constexpr T zero() noexcept { return static_cast<T>(0); } // NOLINT - static inline constexpr T half() noexcept { return static_cast<T>(0.5); } // NOLINT - static inline constexpr T one() noexcept { return static_cast<T>(1); } // NOLINT - static inline constexpr T two() noexcept { return static_cast<T>(2); } // NOLINT - static inline constexpr T three() noexcept { return static_cast<T>(3); } // NOLINT - static inline constexpr T four() noexcept { return static_cast<T>(4); } // NOLINT - static inline constexpr T hundred()noexcept { return static_cast<T>(100); } // NOLINT - - static inline constexpr T one_thirds() noexcept { return fraction(one(), three()); } - static inline constexpr T two_thirds() noexcept { return fraction(two(), three()); } - - static inline constexpr T ln2() noexcept { return static_cast<T>(0.6931471805599453094172321214581766L); } // NOLINT - static inline constexpr T sqrt2() noexcept { return static_cast<T>(1.4142135623730950488016887242096982L); } // NOLINT - static inline constexpr T sqrt3() noexcept { return static_cast<T>(1.7320508075688772935274463415058723L); } // NOLINT - static inline constexpr T sqrt3_2() noexcept { return static_cast<T>(0.8660254037844386467637231707529362L); } // NOLINT - static inline constexpr T pi() noexcept { return static_cast<T>(3.1415926535897932384626433832795029L); } // NOLINT + static constexpr T zero() noexcept { return static_cast<T>(0); } // NOLINT + static constexpr T half() noexcept { return static_cast<T>(0.5); } // NOLINT + static constexpr T one() noexcept { return static_cast<T>(1); } // NOLINT + static constexpr T two() noexcept { return static_cast<T>(2); } // NOLINT + static constexpr T three() noexcept { return static_cast<T>(3); } // NOLINT + static constexpr T four() noexcept { return static_cast<T>(4); } // NOLINT + static constexpr T hundred()noexcept { return static_cast<T>(100); } // NOLINT + + static constexpr T one_thirds() noexcept { return fraction(one(), three()); } + static constexpr T two_thirds() noexcept { return fraction(two(), three()); } + + static constexpr T ln2() noexcept { return static_cast<T>(0.6931471805599453094172321214581766L); } // NOLINT + static constexpr T sqrt2() noexcept { return static_cast<T>(1.4142135623730950488016887242096982L); } // NOLINT + static constexpr T sqrt3() noexcept { return static_cast<T>(1.7320508075688772935274463415058723L); } // NOLINT + static constexpr T sqrt3_2() noexcept { return static_cast<T>(0.8660254037844386467637231707529362L); } // NOLINT + static constexpr T pi() noexcept { return static_cast<T>(3.1415926535897932384626433832795029L); } // NOLINT /// \brief Electric constant of vacuum /// - static inline constexpr T eps_0() noexcept { return static_cast<T>(8.854187817e-12); } // NOLINT + static constexpr T eps_0() noexcept { return static_cast<T>(8.854187817e-12); } // NOLINT // \brief Relative permittivity of Silicon dioxide /// - static inline constexpr T eps_SiO2() noexcept { return static_cast<T>(3.9); } // NOLINT + static constexpr T eps_SiO2() noexcept { return static_cast<T>(3.9); } // NOLINT /// \brief Relative permittivity of Silicon /// - static inline constexpr T eps_Si() noexcept { return static_cast<T>(11.7); } // NOLINT + static constexpr T eps_Si() noexcept { return static_cast<T>(11.7); } // NOLINT /// \brief Boltzmann constant /// - static inline constexpr T k_b() noexcept { return static_cast<T>(1.38064852e-23); } // NOLINT + static constexpr T k_b() noexcept { return static_cast<T>(1.38064852e-23); } // NOLINT /// \brief room temperature (gives VT = 0.02585 at T=300) /// - static inline constexpr T T0() noexcept { return static_cast<T>(300); } // NOLINT + static constexpr T T0() noexcept { return static_cast<T>(300); } // NOLINT /// \brief Elementary charge /// - static inline constexpr T Q_e() noexcept { return static_cast<T>(1.6021765314e-19); } // NOLINT + static constexpr T Q_e() noexcept { return static_cast<T>(1.6021765314e-19); } // NOLINT /// \brief Intrinsic carrier concentration in 1/m^3 of Silicon /// - static inline constexpr T NiSi() noexcept { return static_cast<T>(1.45e16); } // NOLINT + static constexpr T NiSi() noexcept { return static_cast<T>(1.45e16); } // NOLINT /// \brief clearly identify magic numbers in code /// @@ -82,10 +82,10 @@ namespace plib /// later. /// template <typename V> - static inline constexpr T magic(V &&v) noexcept { return static_cast<T>(v); } + static constexpr T magic(V &&v) noexcept { return static_cast<T>(v); } template <typename V> - static inline constexpr T fraction(V &&v1, V &&v2) noexcept { return static_cast<T>(v1 / v2); } + static constexpr T fraction(V &&v1, V &&v2) noexcept { return static_cast<T>(v1 / v2); } }; /// \brief typesafe reciprocal function @@ -95,7 +95,7 @@ namespace plib /// \return reciprocal of argument /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> reciprocal(T v) noexcept { return constants<T>::one() / v; @@ -108,7 +108,7 @@ namespace plib /// \return absolute value of argument /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> abs(T v) noexcept { return std::abs(v); @@ -121,7 +121,7 @@ namespace plib /// \return absolute value of argument /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> sqrt(T v) noexcept { return std::sqrt(v); @@ -135,7 +135,7 @@ namespace plib /// \return sqrt(v1*v1+v2*v2) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> hypot(T v1, T v2) noexcept { return std::hypot(v1, v2); @@ -148,7 +148,7 @@ namespace plib /// \return exp(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> exp(T v) noexcept { return std::exp(v); @@ -161,7 +161,7 @@ namespace plib /// \return log(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> log(T v) noexcept { return std::log(v); @@ -174,7 +174,7 @@ namespace plib /// \return tanh(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> tanh(T v) noexcept { return std::tanh(v); @@ -187,7 +187,7 @@ namespace plib /// \return floor(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> floor(T v) noexcept { return std::floor(v); @@ -200,7 +200,7 @@ namespace plib /// \return log(1 + v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> log1p(T v) noexcept { return std::log1p(v); @@ -213,7 +213,7 @@ namespace plib /// \return sin(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> sin(T v) noexcept { return std::sin(v); @@ -226,7 +226,7 @@ namespace plib /// \return cos(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> cos(T v) noexcept { return std::cos(v); @@ -239,7 +239,7 @@ namespace plib /// \return trunc(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> trunc(T v) noexcept { return std::trunc(v); @@ -253,7 +253,7 @@ namespace plib /// \return signum(v) /// template <typename T> - static inline constexpr std::enable_if_t<std::is_floating_point<T>::value, T> + static constexpr std::enable_if_t<std::is_floating_point<T>::value, T> signum(T v, T r = static_cast<T>(1)) { constexpr const auto z(static_cast<T>(0)); @@ -278,73 +278,73 @@ namespace plib } #if (PUSE_FLOAT128) - static inline constexpr FLOAT128 reciprocal(FLOAT128 v) noexcept + static constexpr FLOAT128 reciprocal(FLOAT128 v) noexcept { return constants<FLOAT128>::one() / v; } - static inline FLOAT128 abs(FLOAT128 v) noexcept + static FLOAT128 abs(FLOAT128 v) noexcept { return fabsq(v); } - static inline FLOAT128 sqrt(FLOAT128 v) noexcept + static FLOAT128 sqrt(FLOAT128 v) noexcept { return sqrtq(v); } - static inline FLOAT128 hypot(FLOAT128 v1, FLOAT128 v2) noexcept + static FLOAT128 hypot(FLOAT128 v1, FLOAT128 v2) noexcept { return hypotq(v1, v2); } - static inline FLOAT128 exp(FLOAT128 v) noexcept + static FLOAT128 exp(FLOAT128 v) noexcept { return expq(v); } - static inline FLOAT128 log(FLOAT128 v) noexcept + static FLOAT128 log(FLOAT128 v) noexcept { return logq(v); } - static inline FLOAT128 tanh(FLOAT128 v) noexcept + static FLOAT128 tanh(FLOAT128 v) noexcept { return tanhq(v); } - static inline FLOAT128 floor(FLOAT128 v) noexcept + static FLOAT128 floor(FLOAT128 v) noexcept { return floorq(v); } - static inline FLOAT128 log1p(FLOAT128 v) noexcept + static FLOAT128 log1p(FLOAT128 v) noexcept { return log1pq(v); } - static inline FLOAT128 sin(FLOAT128 v) noexcept + static FLOAT128 sin(FLOAT128 v) noexcept { return sinq(v); } - static inline FLOAT128 cos(FLOAT128 v) noexcept + static FLOAT128 cos(FLOAT128 v) noexcept { return cosq(v); } - static inline FLOAT128 trunc(FLOAT128 v) noexcept + static FLOAT128 trunc(FLOAT128 v) noexcept { return truncq(v); } template <typename T> - static inline FLOAT128 pow(FLOAT128 v, T p) noexcept + static FLOAT128 pow(FLOAT128 v, T p) noexcept { return powq(v, static_cast<FLOAT128>(p)); } - static inline FLOAT128 pow(FLOAT128 v, int p) noexcept + static FLOAT128 pow(FLOAT128 v, int p) noexcept { if (p==2) return v*v; diff --git a/src/lib/netlist/plib/pmatrix2d.h b/src/lib/netlist/plib/pmatrix2d.h index d0fbac26194..d0ce462ebfa 100755 --- a/src/lib/netlist/plib/pmatrix2d.h +++ b/src/lib/netlist/plib/pmatrix2d.h @@ -51,7 +51,10 @@ namespace plib ::new(&m_v[i]) T(); } - PCOPYASSIGNMOVE(pmatrix2d, delete) + pmatrix2d(const pmatrix2d &) = delete; + pmatrix2d &operator=(const pmatrix2d &) = delete; + pmatrix2d(pmatrix2d &&) = delete; + pmatrix2d &operator=(pmatrix2d &&) = delete; ~pmatrix2d() { @@ -157,7 +160,11 @@ namespace plib m_v.resize(N); //FIXME } - PCOPYASSIGNMOVE(pmatrix2d_vrl, default) + pmatrix2d_vrl(const pmatrix2d_vrl &) = default; + pmatrix2d_vrl &operator=(const pmatrix2d_vrl &) = default; + pmatrix2d_vrl(pmatrix2d_vrl &&) = default; + pmatrix2d_vrl &operator=(pmatrix2d_vrl &&) = default; + ~pmatrix2d_vrl() = default; void resize(size_type N, size_type M) diff --git a/src/lib/netlist/plib/mat_cr.h b/src/lib/netlist/plib/pmatrix_cr.h index 17ce140c6e5..05ba82f1b0e 100644 --- a/src/lib/netlist/plib/mat_cr.h +++ b/src/lib/netlist/plib/pmatrix_cr.h @@ -1,11 +1,11 @@ // license:GPL-2.0+ // copyright-holders:Couriersud -#ifndef MAT_CR_H_ -#define MAT_CR_H_ +#ifndef PMATRIX_CR_H_ +#define PMATRIX_CR_H_ /// -/// \file mat_cr.h +/// \file pmatrix_cr.h /// /// Compressed row format matrices /// @@ -16,9 +16,7 @@ #include "pmath.h" #include "pmatrix2d.h" #include "pomp.h" -#include "pstate.h" #include "ptypes.h" -#include "putil.h" #include <algorithm> #include <array> @@ -29,7 +27,7 @@ namespace plib { template<typename T, int N, typename C = uint16_t> - struct pmatrix_cr_t + struct pmatrix_cr { using index_type = C; using value_type = T; @@ -37,7 +35,10 @@ namespace plib static constexpr const int NSQ = (N < 0 ? -N * N : N * N); static constexpr const int Np1 = (N == 0) ? 0 : (N < 0 ? N - 1 : N + 1); - PCOPYASSIGNMOVE(pmatrix_cr_t, default) + pmatrix_cr(const pmatrix_cr &) = default; + pmatrix_cr &operator=(const pmatrix_cr &) = default; + pmatrix_cr(pmatrix_cr &&) noexcept(std::is_nothrow_move_constructible<parray<value_type, NSQ>>::value) = default; + pmatrix_cr &operator=(pmatrix_cr &&) noexcept(std::is_nothrow_move_assignable<parray<value_type, NSQ>>::value && std::is_nothrow_move_assignable<pmatrix2d_vrl<index_type>>::value) = default; enum constants_e { @@ -56,7 +57,7 @@ namespace plib // NOLINTNEXTLINE std::size_t nz_num; - explicit pmatrix_cr_t(std::size_t n) + explicit pmatrix_cr(std::size_t n) : diag(n) , row_idx(n+1) , col_idx(n*n) @@ -72,7 +73,7 @@ namespace plib } } - ~pmatrix_cr_t() = default; + ~pmatrix_cr() = default; constexpr std::size_t size() const noexcept { return (N>0) ? narrow_cast<std::size_t>(N) : m_size; } @@ -149,17 +150,10 @@ namespace plib for (std::size_t k=0; k < size(); k++) { -#if 0 - for (std::size_t j=k + 1; j < size(); j++) - if (f[j][k] < FILL_INFINITY) - m_nzbd[k].push_back(narrow_cast<C>(j)); - m_nzbd[k].push_back(0); // end of sequence -#else for (std::size_t j=k + 1; j < size(); j++) if (f[j][k] < FILL_INFINITY) m_nzbd.set(k, m_nzbd.colcount(k), narrow_cast<C>(j)); m_nzbd.set(k, m_nzbd.colcount(k), 0); // end of sequence -#endif } } @@ -169,17 +163,6 @@ namespace plib { // res = A * x -#if 0 - //plib::omp::set_num_threads(4); - plib::omp::for_static(0, constants<std::size_t>::zero(), m_size, [this, &res, &x](std::size_t row) - { - T tmp(0.0); - const std::size_t e(row_idx[row+1]); - for (std::size_t k = row_idx[row]; k < e; k++) - tmp += A[k] * x[col_idx[k]]; - res[row] = tmp; - }); -#else // this is a bit faster than the version above std::size_t row = 0; std::size_t k = 0; @@ -192,7 +175,6 @@ namespace plib tmp += A[k] * x[col_idx[k]]; res[row++] = tmp; } -#endif } // throws error if P(source)>P(destination) @@ -262,19 +244,22 @@ namespace plib }; template<typename B> - struct pGEmatrix_cr_t : public B + struct pGEmatrix_cr : public B { - using base = B; - using index_type = typename base::index_type; + using base_type = B; + using index_type = typename base_type::index_type; - PCOPYASSIGNMOVE(pGEmatrix_cr_t, default) + pGEmatrix_cr(const pGEmatrix_cr &) = default; + pGEmatrix_cr &operator=(const pGEmatrix_cr &) = default; + pGEmatrix_cr(pGEmatrix_cr &&) noexcept(std::is_nothrow_move_constructible<base_type>::value) = default; + pGEmatrix_cr &operator=(pGEmatrix_cr &&) noexcept(std::is_nothrow_move_assignable<base_type>::value) = default; - explicit pGEmatrix_cr_t(std::size_t n) + explicit pGEmatrix_cr(std::size_t n) : B(n) { } - ~pGEmatrix_cr_t() = default; + ~pGEmatrix_cr() = default; template <typename M> std::pair<std::size_t, std::size_t> gaussian_extend_fill_mat(M &fill) @@ -287,14 +272,14 @@ namespace plib ops++; // 1/A(k,k) for (std::size_t row = k + 1; row < fill.size(); row++) { - if (fill[row][k] < base::FILL_INFINITY) + if (fill[row][k] < base_type::FILL_INFINITY) { ops++; for (std::size_t col = k + 1; col < fill[row].size(); col++) //if (fill[k][col] < FILL_INFINITY) { auto f = std::min(fill[row][col], 1 + fill[row][k] + fill[k][col]); - if (f < base::FILL_INFINITY) + if (f < base_type::FILL_INFINITY) { if (f > fill_max) fill_max = f; @@ -312,37 +297,37 @@ namespace plib template <typename V> void gaussian_elimination(V & RHS) { - const std::size_t iN = base::size(); + const std::size_t iN = base_type::size(); for (std::size_t i = 0; i < iN - 1; i++) { std::size_t nzbdp = 0; - std::size_t pi = base::diag[i]; - auto f = reciprocal(base::A[pi++]); - const std::size_t piie = base::row_idx[i+1]; + std::size_t pi = base_type::diag[i]; + auto f = reciprocal(base_type::A[pi++]); + const std::size_t piie = base_type::row_idx[i+1]; - const auto *nz = base::m_nzbd[i]; + const auto *nz = base_type::m_nzbd[i]; while (auto j = nz[nzbdp++]) // NOLINT(bugprone-infinite-loop) { // proceed to column i - std::size_t pj = base::row_idx[j]; - std::size_t pje = base::row_idx[j+1]; + std::size_t pj = base_type::row_idx[j]; + std::size_t pje = base_type::row_idx[j+1]; - while (base::col_idx[pj] < i) + while (base_type::col_idx[pj] < i) pj++; - const typename base::value_type f1 = - base::A[pj++] * f; + const typename base_type::value_type f1 = - base_type::A[pj++] * f; // subtract row i from j // fill-in available assumed, i.e. matrix was prepared for (std::size_t pii = pi; pii<piie && pj < pje; pii++) { - while (base::col_idx[pj] < base::col_idx[pii]) + while (base_type::col_idx[pj] < base_type::col_idx[pii]) pj++; - if (base::col_idx[pj] == base::col_idx[pii]) - base::A[pj++] += base::A[pii] * f1; + if (base_type::col_idx[pj] == base_type::col_idx[pii]) + base_type::A[pj++] += base_type::A[pii] * f1; } RHS[j] += f1 * RHS[i]; @@ -363,35 +348,35 @@ namespace plib { //printf("omp: %ld %d %d\n", m_ge_par.size(), nz_num, (int)m_ge_par[m_ge_par.size()-2].size()); for (auto l = 0UL; l < m_ge_par.size(); l++) - plib::omp::for_static(base::nz_num, 0UL, m_ge_par[l].size(), [this, &RHS, &l] (unsigned ll) + plib::omp::for_static(base_type::nz_num, 0UL, m_ge_par[l].size(), [this, &RHS, &l] (unsigned ll) { auto &i = m_ge_par[l][ll]; { std::size_t nzbdp = 0; - std::size_t pi = base::diag[i]; - const auto f = reciprocal(base::A[pi++]); - const std::size_t piie = base::row_idx[i+1]; - const auto &nz = base::nzbd[i]; + std::size_t pi = base_type::diag[i]; + const auto f = reciprocal(base_type::A[pi++]); + const std::size_t piie = base_type::row_idx[i+1]; + const auto &nz = base_type::nzbd[i]; while (auto j = nz[nzbdp++]) { // proceed to column i - std::size_t pj = base::row_idx[j]; + std::size_t pj = base_type::row_idx[j]; - while (base::col_idx[pj] < i) + while (base_type::col_idx[pj] < i) pj++; - auto f1 = - base::A[pj++] * f; + auto f1 = - base_type::A[pj++] * f; // subtract row i from j // fill-in available assumed, i.e. matrix was prepared for (std::size_t pii = pi; pii<piie; pii++) { - while (base::col_idx[pj] < base::col_idx[pii]) + while (base_type::col_idx[pj] < base_type::col_idx[pii]) pj++; - if (base::col_idx[pj] == base::col_idx[pii]) - base::A[pj++] += base::A[pii] * f1; + if (base_type::col_idx[pj] == base_type::col_idx[pii]) + base_type::A[pj++] += base_type::A[pii] * f1; } RHS[j] += f1 * RHS[i]; } @@ -402,36 +387,36 @@ namespace plib template <typename V1, typename V2> void gaussian_back_substitution(V1 &V, const V2 &RHS) { - const std::size_t iN = base::size(); + const std::size_t iN = base_type::size(); // row n-1 - V[iN - 1] = RHS[iN - 1] / base::A[base::diag[iN - 1]]; + V[iN - 1] = RHS[iN - 1] / base_type::A[base_type::diag[iN - 1]]; for (std::size_t j = iN - 1; j-- > 0;) { - typename base::value_type tmp = 0; - const auto jdiag = base::diag[j]; - const std::size_t e = base::row_idx[j+1]; + typename base_type::value_type tmp = 0; + const auto jdiag = base_type::diag[j]; + const std::size_t e = base_type::row_idx[j+1]; for (std::size_t pk = jdiag + 1; pk < e; pk++) - tmp += base::A[pk] * V[base::col_idx[pk]]; - V[j] = (RHS[j] - tmp) / base::A[jdiag]; + tmp += base_type::A[pk] * V[base_type::col_idx[pk]]; + V[j] = (RHS[j] - tmp) / base_type::A[jdiag]; } } template <typename V1> void gaussian_back_substitution(V1 &V) { - const std::size_t iN = base::size(); + const std::size_t iN = base_type::size(); // row n-1 - V[iN - 1] = V[iN - 1] / base::A[base::diag[iN - 1]]; + V[iN - 1] = V[iN - 1] / base_type::A[base_type::diag[iN - 1]]; for (std::size_t j = iN - 1; j-- > 0;) { - typename base::value_type tmp = 0; - const auto jdiag = base::diag[j]; - const std::size_t e = base::row_idx[j+1]; + typename base_type::value_type tmp = 0; + const auto jdiag = base_type::diag[j]; + const std::size_t e = base_type::row_idx[j+1]; for (std::size_t pk = jdiag + 1; pk < e; pk++) - tmp += base::A[pk] * V[base::col_idx[pk]]; - V[j] = (V[j] - tmp) / base::A[jdiag]; + tmp += base_type::A[pk] * V[base_type::col_idx[pk]]; + V[j] = (V[j] - tmp) / base_type::A[jdiag]; } } @@ -440,27 +425,27 @@ namespace plib void build_parallel_gaussian_execution_scheme(const M &fill) { // calculate parallel scheme for gaussian elimination - std::vector<std::vector<std::size_t>> rt(base::size()); - for (std::size_t k = 0; k < base::size(); k++) + std::vector<std::vector<std::size_t>> rt(base_type::size()); + for (std::size_t k = 0; k < base_type::size(); k++) { - for (std::size_t j = k+1; j < base::size(); j++) + for (std::size_t j = k+1; j < base_type::size(); j++) { - if (fill[j][k] < base::FILL_INFINITY) + if (fill[j][k] < base_type::FILL_INFINITY) { rt[k].push_back(j); } } } - std::vector<std::size_t> levGE(base::size(), 0); + std::vector<std::size_t> levGE(base_type::size(), 0); std::size_t cl = 0; - for (std::size_t k = 0; k < base::size(); k++ ) + for (std::size_t k = 0; k < base_type::size(); k++ ) { if (levGE[k] >= cl) { std::vector<std::size_t> t = rt[k]; - for (std::size_t j = k+1; j < base::size(); j++ ) + for (std::size_t j = k+1; j < base_type::size(); j++ ) { bool overlap = false; // is there overlap @@ -487,7 +472,7 @@ namespace plib m_ge_par.clear(); m_ge_par.resize(cl+1); - for (std::size_t k = 0; k < base::size(); k++) + for (std::size_t k = 0; k < base_type::size(); k++) m_ge_par[levGE[k]].push_back(k); //for (std::size_t k = 0; k < m_ge_par.size(); k++) // printf("%d %d\n", (int) k, (int) m_ge_par[k].size()); @@ -496,21 +481,24 @@ namespace plib }; template<typename B> - struct pLUmatrix_cr_t : public B + struct pLUmatrix_cr : public B { - using base = B; - using index_type = typename base::index_type; + using base_type = B; + using index_type = typename base_type::index_type; - PCOPYASSIGNMOVE(pLUmatrix_cr_t, default) + pLUmatrix_cr(const pLUmatrix_cr &) = default; + pLUmatrix_cr &operator=(const pLUmatrix_cr &) = default; + pLUmatrix_cr(pLUmatrix_cr &&) noexcept(std::is_nothrow_move_constructible<base_type>::value) = default; + pLUmatrix_cr &operator=(pLUmatrix_cr &&) noexcept(std::is_nothrow_move_assignable<base_type>::value) = default; - explicit pLUmatrix_cr_t(std::size_t n) + explicit pLUmatrix_cr(std::size_t n) : B(n) , ilu_rows(n+1) , m_ILUp(0) { } - ~pLUmatrix_cr_t() = default; + ~pLUmatrix_cr() = default; template <typename M> void build(M &fill, std::size_t ilup) @@ -560,7 +548,7 @@ namespace plib /// k=k+1 /// i=i+1 /// - void incomplete_LU_factorization(const base &mat) + void incomplete_LU_factorization(const base_type &mat) { if (m_ILUp < 1) this->raw_copy_from(mat); @@ -570,27 +558,27 @@ namespace plib std::size_t p(0); while (auto i = ilu_rows[p++]) // NOLINT(bugprone-infinite-loop) { - const auto p_i_end = base::row_idx[i + 1]; + const auto p_i_end = base_type::row_idx[i + 1]; // loop over all columns k left of diag in row i //if (row_idx[i] < diag[i]) // printf("occ %d\n", (int)i); - for (auto i_k = base::row_idx[i]; i_k < base::diag[i]; i_k++) + for (auto i_k = base_type::row_idx[i]; i_k < base_type::diag[i]; i_k++) { - const auto k(base::col_idx[i_k]); - const auto p_k_end(base::row_idx[k + 1]); - const typename base::value_type LUp_i_k = base::A[i_k] = base::A[i_k] / base::A[base::diag[k]]; + const auto k(base_type::col_idx[i_k]); + const auto p_k_end(base_type::row_idx[k + 1]); + const typename base_type::value_type LUp_i_k = base_type::A[i_k] = base_type::A[i_k] / base_type::A[base_type::diag[k]]; - std::size_t k_j(base::diag[k] + 1); + std::size_t k_j(base_type::diag[k] + 1); std::size_t i_j(i_k + 1); while (i_j < p_i_end && k_j < p_k_end ) // pj = (i, j) { // we can assume that within a row ja increases continuously - const std::size_t c_i_j(base::col_idx[i_j]); // row i, column j - const auto c_k_j(base::col_idx[k_j]); // row k, column j + const std::size_t c_i_j(base_type::col_idx[i_j]); // row i, column j + const auto c_k_j(base_type::col_idx[k_j]); // row k, column j if (c_k_j == c_i_j) - base::A[i_j] -= LUp_i_k * base::A[k_j]; + base_type::A[i_j] -= LUp_i_k * base_type::A[k_j]; k_j += (c_k_j <= c_i_j ? 1 : 0); i_j += (c_k_j >= c_i_j ? 1 : 0); @@ -625,32 +613,32 @@ namespace plib template <typename R> void solveLU (R &r) { - for (std::size_t i = 1; i < base::size(); ++i ) + for (std::size_t i = 1; i < base_type::size(); ++i ) { - typename base::value_type tmp(0); - const auto j1(base::row_idx[i]); - const auto j2(base::diag[i]); + typename base_type::value_type tmp(0); + const auto j1(base_type::row_idx[i]); + const auto j2(base_type::diag[i]); for (auto j = j1; j < j2; ++j ) - tmp += base::A[j] * r[base::col_idx[j]]; + tmp += base_type::A[j] * r[base_type::col_idx[j]]; r[i] -= tmp; } // i now is equal to n; - for (std::size_t i = base::size(); i-- > 0; ) + for (std::size_t i = base_type::size(); i-- > 0; ) { - typename base::value_type tmp(0); - const auto di(base::diag[i]); - const auto j2(base::row_idx[i+1]); + typename base_type::value_type tmp(0); + const auto di(base_type::diag[i]); + const auto j2(base_type::row_idx[i+1]); for (std::size_t j = di + 1; j < j2; j++ ) - tmp += base::A[j] * r[base::col_idx[j]]; - r[i] = (r[i] - tmp) / base::A[di]; + tmp += base_type::A[j] * r[base_type::col_idx[j]]; + r[i] = (r[i] - tmp) / base_type::A[di]; } } private: - parray<index_type, base::Np1> ilu_rows; + parray<index_type, base_type::Np1> ilu_rows; std::size_t m_ILUp; }; } // namespace plib -#endif // MAT_CR_H_ +#endif // PMATRIX_CR_H_ diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h index 4e678cb09d6..b83f08e0f49 100644 --- a/src/lib/netlist/plib/pmempool.h +++ b/src/lib/netlist/plib/pmempool.h @@ -168,8 +168,11 @@ namespace plib { struct info { info(block *b, size_type p) : m_block(b), m_pos(p) { } + info(const info &) = default; + info &operator=(const info &) = default; + info(info &&) noexcept = default; + info &operator=(info &&) noexcept = default; ~info() = default; - PCOPYASSIGNMOVE(info, default) block * m_block; size_type m_pos; diff --git a/src/lib/netlist/plib/pmulti_threading.h b/src/lib/netlist/plib/pmulti_threading.h index 9f470054e2d..7c58a936636 100644 --- a/src/lib/netlist/plib/pmulti_threading.h +++ b/src/lib/netlist/plib/pmulti_threading.h @@ -23,9 +23,9 @@ namespace plib { struct pspin_mutex { public: - pspin_mutex() noexcept = default; - void lock() noexcept{ while (m_lock.test_and_set(std::memory_order_acquire)) { } } - void unlock() noexcept { m_lock.clear(std::memory_order_release); } + inline pspin_mutex() noexcept = default; + inline void lock() noexcept{ while (m_lock.test_and_set(std::memory_order_acquire)) { } } + inline void unlock() noexcept { m_lock.clear(std::memory_order_release); } private: PALIGNAS_CACHELINE() std::atomic_flag m_lock = ATOMIC_FLAG_INIT; @@ -35,8 +35,9 @@ namespace plib { struct pspin_mutex<false> { public: - void lock() const noexcept { } - void unlock() const noexcept { } + inline pspin_mutex() noexcept = default; + static inline void lock() /*const*/ noexcept { } + static inline void unlock() /*const*/ noexcept { } }; class psemaphore diff --git a/src/lib/netlist/plib/poptions.h b/src/lib/netlist/plib/poptions.h index 714a357da86..a0368ebdc09 100644 --- a/src/lib/netlist/plib/poptions.h +++ b/src/lib/netlist/plib/poptions.h @@ -261,12 +261,12 @@ namespace plib { return nullptr; } - option *getopt_short(const pstring &arg) const; - option *getopt_long(const pstring &arg) const; + option *getopt_short(const pstring &arg) const; + option *getopt_long(const pstring &arg) const; - std::vector<option_base *> m_opts; - pstring m_app; - option_args * m_other_args; + std::vector<option_base *> m_opts; + pstring m_app; + option_args * m_other_args; }; } // namespace plib diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h index e86c94ff4c9..e37f970cc05 100644 --- a/src/lib/netlist/plib/ppmf.h +++ b/src/lib/netlist/plib/ppmf.h @@ -377,7 +377,7 @@ namespace plib { bind<specific_member_function<O>>(object, &mftp); } - inline R operator()(Targs... args) const noexcept(true) + R operator()(Targs... args) const noexcept(true) { return this->call(std::forward<Targs>(args)...); } diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp index 320cbe23857..c203fea1753 100644 --- a/src/lib/netlist/plib/ppreprocessor.cpp +++ b/src/lib/netlist/plib/ppreprocessor.cpp @@ -245,10 +245,10 @@ namespace plib { else { pstring tok=tmp[pi]; - if (tok.size() >= 2 && pi < tmp.size() - 2 ) + if (tok.length() >= 2 && pi < tmp.size() - 2 ) { auto sc=tok.substr(0,1); - auto ec=tok.substr(tok.size()-1, 1); + auto ec=tok.substr(tok.length()-1, 1); if ((sc == "." || (sc>="0" && sc<="9")) && (ec=="e" || ec=="E")) { // looks like an incomplete float due splitting by - or + @@ -496,7 +496,7 @@ namespace plib { { bool line_cont = plib::right(line_in, 1) == "\\"; - pstring line = line_cont ? plib::left(line_in, line_in.size() - 1) : line_in; + pstring line = line_cont ? plib::left(line_in, line_in.length() - 1) : line_in; if (m_state == LINE_CONTINUATION) m_line += line; diff --git a/src/lib/netlist/plib/prandom.h b/src/lib/netlist/plib/prandom.h index b2f9c89a9cf..669228f23fe 100644 --- a/src/lib/netlist/plib/prandom.h +++ b/src/lib/netlist/plib/prandom.h @@ -101,7 +101,7 @@ namespace plib } private: - void twist() + void twist() noexcept { const T lowest_w(~T(0) >> (sizeof(T)*8 - w)); const T lower_mask((T(1) << r) - 1); // That is, the binary number of r 1's @@ -121,10 +121,10 @@ namespace plib }; template <typename FT, typename T> - FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) + FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) noexcept { - const auto mmin(narrow_cast<FT>(p.min())); - const auto mmax(narrow_cast<FT>(p.max())); + constexpr const auto mmin(narrow_cast<FT>(T::min())); + constexpr const auto mmax(narrow_cast<FT>(T::max())); // -> 0 to a return (narrow_cast<FT>(p())- mmin) / (mmax - mmin) * m - b; } diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h index 65d95293298..bdbcb34b099 100644 --- a/src/lib/netlist/plib/pstream.h +++ b/src/lib/netlist/plib/pstream.h @@ -28,7 +28,7 @@ namespace plib { /// \brief wrapper around isteam read /// template <typename S, typename T> - static inline S & istream_read(S &is, T * data, size_t len) + static S & istream_read(S &is, T * data, size_t len) { using ct = typename S::char_type; static_assert((sizeof(T) % sizeof(ct)) == 0, "istream_read sizeof issue"); @@ -39,7 +39,7 @@ namespace plib { /// \brief wrapper around osteam write /// template <typename S, typename T> - static inline S & ostream_write(S &os, const T * data, size_t len) + static S & ostream_write(S &os, const T * data, size_t len) { using ct = typename S::char_type; static_assert((sizeof(T) % sizeof(ct)) == 0, "ostream_write sizeof issue"); @@ -64,7 +64,7 @@ namespace plib { } istream_uptr(const istream_uptr &) = delete; istream_uptr &operator=(const istream_uptr &) = delete; - istream_uptr(istream_uptr &&rhs) + istream_uptr(istream_uptr &&rhs) noexcept { m_strm = std::move(rhs.m_strm); m_filename = std::move(rhs.m_filename); @@ -228,7 +228,7 @@ public: // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) const putf8string conv_utf8(text); //m_strm->write(conv_utf8.c_str(), static_cast<std::streamsize>(plib::strlen(conv_utf8.c_str() ))); - ostream_write(*m_strm, conv_utf8.c_str(), string_info<putf8string>::mem_size(conv_utf8)); + ostream_write(*m_strm, conv_utf8.c_str(), conv_utf8.size()); } void write(const pstring::value_type c) const @@ -290,7 +290,7 @@ public: { const auto *sm = s.c_str(); //const auto sl(std::char_traits<pstring::mem_t>::length(sm)); - const auto sl(string_info<pstring>::mem_size(s)); + const auto sl(s.size()); write(sl); ostream_write(m_strm, sm, sl); } diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index 9a58e75fbd3..6af155a640c 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -178,11 +178,23 @@ public: const_iterator cend() const noexcept { return const_iterator(m_str.end()); } // C string conversion helpers - const mem_t *c_str() const noexcept { return static_cast<const mem_t *>(m_str.c_str()); } - const mem_t *data() const noexcept { return c_str(); } - + const mem_t *c_str() const noexcept { return static_cast<const mem_t *>(m_str.c_str()); } + const mem_t *data() const noexcept { return c_str(); } + + /// \brief return number of codes in the string + /// + /// This may report a number less than what \ref size reports. pstrings + /// operate on character codes. In the case of utf pstrings thus the physical size + /// may be bigger than the logical size. size_type length() const noexcept { return traits_type::len(m_str); } - size_type size() const noexcept { return traits_type::len(m_str); } + + /// \brief return number of memory units in the string + /// + /// This function returns the number of memory units used by a string. + /// Depending on the string type the size may be reported as bytes, words + /// or quad-words. + size_type size() const noexcept { return m_str.size(); } + bool empty() const noexcept { return m_str.empty(); } void clear() noexcept { m_str.clear(); } @@ -478,14 +490,18 @@ namespace plib struct string_info<pstring_t<T>> { using mem_t = typename T::mem_t; +#if 0 static std::size_t mem_size(const pstring_t<T> &s) { return s.mem_t_size(); } +#endif }; template<typename T> struct string_info<std::basic_string<T>> { using mem_t = T; +#if 0 static std::size_t mem_size(const std::basic_string<T> &s) { return s.size(); } +#endif }; } // namespace plib diff --git a/src/lib/netlist/plib/ptests.h b/src/lib/netlist/plib/ptests.h index 191233f26fa..b72ef38fc5c 100644 --- a/src/lib/netlist/plib/ptests.h +++ b/src/lib/netlist/plib/ptests.h @@ -83,8 +83,8 @@ namespace testing Test(const Test &) = delete; Test &operator=(const Test &) = delete; - Test(Test &&) noexcept = delete; - Test &operator=(Test &&) noexcept = delete; + Test(Test &&) = delete; + Test &operator=(Test &&) = delete; virtual void run() {} virtual void SetUp() {} @@ -102,8 +102,8 @@ namespace testing reg_entry_base(const reg_entry_base &) = delete; reg_entry_base &operator=(const reg_entry_base &) = delete; - reg_entry_base(reg_entry_base &&) noexcept = delete; - reg_entry_base &operator=(reg_entry_base &&) noexcept = delete; + reg_entry_base(reg_entry_base &&) = delete; + reg_entry_base &operator=(reg_entry_base &&) = delete; virtual ~reg_entry_base() = default; diff --git a/src/lib/netlist/plib/ptime.h b/src/lib/netlist/plib/ptime.h index 0f88449500b..528a0bbd503 100644 --- a/src/lib/netlist/plib/ptime.h +++ b/src/lib/netlist/plib/ptime.h @@ -53,12 +53,19 @@ namespace plib constexpr explicit ptime(const internal_type nom, const internal_type den) noexcept : m_time(nom * (RES / den)) { } - template <typename O> - constexpr explicit ptime(const ptime<O, RES> &rhs) noexcept + template <typename O, typename = std::enable_if_t<ptime_le<ptime<O, RES>, ptime>::value>> + constexpr ptime(const ptime<O, RES> &rhs) noexcept : m_time(static_cast<TYPE>(rhs.m_time)) { } + template <typename O, typename T = std::enable_if_t<!ptime_le<ptime<O, RES>, ptime>::value, int>> + constexpr explicit ptime(const ptime<O, RES> &rhs, T dummy = 0) noexcept + : m_time(static_cast<TYPE>(rhs.m_time)) + { + plib::unused_var(dummy); + } + template <typename O> constexpr ptime &operator+=(const ptime<O, RES> &rhs) noexcept { @@ -90,7 +97,7 @@ namespace plib } template <typename O> - constexpr ptime operator+(const ptime<O, RES> &rhs) const noexcept + constexpr ptime operator+(ptime<O, RES> rhs) const noexcept { static_assert(ptime_le<ptime<O, RES>, ptime>::value, "Invalid ptime type"); return ptime(m_time + rhs.m_time); @@ -128,7 +135,8 @@ namespace plib template <typename O> friend constexpr bool operator>(const ptime &lhs, const ptime<O, RES> &rhs) noexcept { - return (rhs < lhs); + static_assert(ptime_le<ptime<O, RES>, ptime>::value, "Invalid ptime type"); + return (lhs.m_time > rhs.as_raw()); } template <typename O> @@ -146,7 +154,7 @@ namespace plib template <typename O> friend constexpr bool operator==(const ptime &lhs, const ptime<O, RES> &rhs) noexcept { - return lhs.m_time == rhs.m_time; + return lhs.m_time == rhs.as_raw(); } template <typename O> @@ -173,9 +181,7 @@ namespace plib constexpr ptime shr(unsigned shift) const noexcept { return ptime(m_time >> shift); } // for save states .... -#if 0 - constexpr internal_type *get_internaltype_ptr() noexcept { return &m_time; } -#endif + template <typename ST> void save_state(ST &&st) { diff --git a/src/lib/netlist/plib/ptimed_queue.h b/src/lib/netlist/plib/ptimed_queue.h index dc8db7c9bcc..33c14f3bdb9 100644 --- a/src/lib/netlist/plib/ptimed_queue.h +++ b/src/lib/netlist/plib/ptimed_queue.h @@ -36,9 +36,12 @@ namespace plib { struct pqentry_t final { constexpr pqentry_t() noexcept : m_exec_time(), m_object(nullptr) { } - constexpr pqentry_t(Time t, Element o) noexcept : m_exec_time(t), m_object(o) { } + constexpr pqentry_t(const Time &t, const Element &o) noexcept : m_exec_time(t), m_object(o) { } - PCOPYASSIGNMOVE(pqentry_t, default) + pqentry_t(const pqentry_t &) = default; + pqentry_t &operator=(const pqentry_t &) = default; + pqentry_t(pqentry_t &&) noexcept = default; + pqentry_t &operator=(pqentry_t &&) noexcept = default; ~pqentry_t() = default; @@ -64,8 +67,8 @@ namespace plib { static constexpr pqentry_t never() noexcept { return pqentry_t(Time::never(), nullptr); } - constexpr Time exec_time() const noexcept { return m_exec_time; } - constexpr Element object() const noexcept { return m_object; } + constexpr const Time &exec_time() const noexcept { return m_exec_time; } + constexpr const Element &object() const noexcept { return m_object; } private: Time m_exec_time; Element m_object; @@ -147,6 +150,7 @@ namespace plib { } void pop() noexcept { --m_end; } + const T &top() const noexcept { return *(m_end-1); } template <bool KEEPSTAT, class R> @@ -165,34 +169,7 @@ namespace plib { return; } } - } - - template <bool KEEPSTAT, class R> - void retime(R && elem) noexcept - { - // Lock - lock_guard_type lck(m_lock); - if (KEEPSTAT) - m_prof_retime.inc(); - - for (R * i = m_end - 1; i > &m_list[0]; --i) - { - if (*i == elem) // partial equal! - { - *i = std::forward<R>(elem); - while (*(i-1) < *i) - { - std::swap(*(i-1), *i); - --i; - } - while (i < m_end && *i < *(i+1)) - { - std::swap(*(i+1), *i); - ++i; - } - return; - } - } + //printf("Element not found in delete %s\n", elem->name().c_str()); } void clear() noexcept @@ -226,7 +203,6 @@ namespace plib { pperfcount_t<true> m_prof_sortmove; // NOLINT pperfcount_t<true> m_prof_call; // NOLINT pperfcount_t<true> m_prof_remove; // NOLINT - pperfcount_t<true> m_prof_retime; // NOLINT }; template <class T, bool TS> @@ -236,7 +212,7 @@ namespace plib { struct compare { - constexpr bool operator()(const T &a, const T &b) const { return b <= a; } + constexpr bool operator()(const T &a, const T &b) const noexcept { return b <= a; } }; explicit timed_queue_heap(const std::size_t list_size) @@ -251,6 +227,17 @@ namespace plib { std::size_t capacity() const noexcept { return m_list.capacity(); } bool empty() const noexcept { return &m_list[0] == m_end; } + template<bool KEEPSTAT, typename... Args> + void emplace(Args&&... args) noexcept + { + // Lock + lock_guard_type lck(m_lock); + *m_end++ = T(std::forward<Args>(args)...); + std::push_heap(&m_list[0], m_end, compare()); + if (KEEPSTAT) + m_prof_call.inc(); + } + template <bool KEEPSTAT> void push(T &&e) noexcept { @@ -262,12 +249,10 @@ namespace plib { m_prof_call.inc(); } - T pop() noexcept + void pop() noexcept { - T ret(m_list[0]); std::pop_heap(&m_list[0], m_end, compare()); m_end--; - return ret; } const T &top() const noexcept { return m_list[0]; } @@ -291,24 +276,6 @@ namespace plib { } } - template <bool KEEPSTAT> - void retime(const T &elem) noexcept - { - // Lock - lock_guard_type lck(m_lock); - if (KEEPSTAT) - m_prof_retime.inc(); - for (T * i = m_end - 1; i >= &m_list[0]; i--) - { - if (*i == elem) // partial equal! - { - *i = elem; - std::make_heap(&m_list[0], m_end, compare()); - return; - } - } - } - void clear() { lock_guard_type lck(m_lock); @@ -325,19 +292,17 @@ namespace plib { using mutex_type = pspin_mutex<TS>; using lock_guard_type = std::lock_guard<mutex_type>; - mutex_type m_lock; - std::vector<T> m_list; - T *m_end; + mutex_type m_lock; + T * m_end; + aligned_vector<T> m_list; public: // profiling pperfcount_t<true> m_prof_sortmove; // NOLINT pperfcount_t<true> m_prof_call; // NOLINT pperfcount_t<true> m_prof_remove; // NOLINT - pperfcount_t<true> m_prof_retime; // NOLINT }; } // namespace plib #endif // PTIMED_QUEUE_H_ -#include <cstdlib> diff --git a/src/lib/netlist/plib/vector_ops.h b/src/lib/netlist/plib/vector_ops.h index 6d20b9213a7..86c860b71cb 100644 --- a/src/lib/netlist/plib/vector_ops.h +++ b/src/lib/netlist/plib/vector_ops.h @@ -11,6 +11,7 @@ /// /// #include "pconfig.h" +#include "pgsl.h" #include "pmath.h" #include <algorithm> @@ -27,75 +28,76 @@ namespace plib { template<typename VT, typename T> - void vec_set_scalar(const std::size_t n, VT &v, T && scalar) noexcept + void vec_set_scalar(VT &v, T && scalar) noexcept { + const std::size_t n(v.size()); const typename std::remove_reference<decltype(v[0])>::type s(std::forward<T>(scalar)); for ( std::size_t i = 0; i < n; i++ ) v[i] = s; } template<typename VT, typename VS> - void vec_set(const std::size_t n, VT &v, const VS & source) noexcept + void vec_set(VT &v, const VS & source) noexcept { + const std::size_t n(v.size()); + gsl_Expects(n <= source.size()); for ( std::size_t i = 0; i < n; i++ ) v[i] = source[i]; } template<typename T, typename V1, typename V2> - T vec_mult(const std::size_t n, const V1 & v1, const V2 & v2 ) noexcept + T vec_mult(const V1 & v1, const V2 & v2 ) noexcept { - using b8 = std::array<T, 8>; // NOLINT - PALIGNAS_VECTOROPT() b8 value = {0}; + const std::size_t n(v1.size()); + gsl_Expects(n <= v2.size()); + T ret(plib::constants<T>::zero()); for (std::size_t i = 0; i < n ; i++ ) { - value[i & 7] += v1[i] * v2[i]; // NOLINT + ret += v1[i] * v2[i]; // NOLINT } - return value[0] + value[1] + value[2] + value[3] + value[4] + value[5] + value[6] + value[7]; // NOLINT + return ret; } template<typename T, typename VT> - T vec_mult2(const std::size_t n, const VT &v) noexcept + T vec_mult2(const VT &v) noexcept { - using b8 = std::array<T, 8>; - PALIGNAS_VECTOROPT() b8 value = {0}; + const std::size_t n(v.size()); + T ret(plib::constants<T>::zero()); for (std::size_t i = 0; i < n ; i++ ) { - value[i & 7] += v[i] * v[i]; + ret += v[i] * v[i]; } - return value[0] + value[1] + value[2] + value[3] + value[4] + value[5] + value[6] + value[7]; + return ret; } template<typename T, typename VT> - T vec_sum(const std::size_t n, const VT &v) noexcept + T vec_sum(const VT &v) noexcept { - if (n<8) + const std::size_t n(v.size()); + T ret(plib::constants<T>::zero()); + for (std::size_t i = 0; i < n ; i++ ) { - T value(0); - for (std::size_t i = 0; i < n ; i++ ) - value += v[i]; - - return value; + ret += v[i]; } - using b8 = std::array<T, 8>; - PALIGNAS_VECTOROPT() b8 value = {0}; - for (std::size_t i = 0; i < n ; i++ ) - value[i & 7] += v[i]; - - return ((value[0] + value[1]) + (value[2] + value[3])) + ((value[4] + value[5]) + (value[6] + value[7])); + return ret; } template<typename VV, typename T, typename VR> - void vec_mult_scalar(const std::size_t n, VR & result, const VV & v, T && scalar) noexcept + void vec_mult_scalar(VR & result, const VV & v, T && scalar) noexcept { + const std::size_t n(result.size()); + gsl_Expects(n <= v.size()); const typename std::remove_reference<decltype(v[0])>::type s(std::forward<T>(scalar)); for ( std::size_t i = 0; i < n; i++ ) result[i] = s * v[i]; } template<typename VR, typename VV, typename T> - void vec_add_mult_scalar(const std::size_t n, VR & result, const VV & v, T && scalar) noexcept + void vec_add_mult_scalar(VR & result, const VV & v, T && scalar) noexcept { + const std::size_t n(result.size()); + gsl_Expects(n <= v.size()); const typename std::remove_reference<decltype(v[0])>::type s(std::forward<T>(scalar)); for ( std::size_t i = 0; i < n; i++ ) result[i] += s * v[i]; @@ -109,31 +111,38 @@ namespace plib } template<typename R, typename V> - void vec_add_ip(const std::size_t n, R & result, const V & v) noexcept + void vec_add_ip(R & result, const V & v) noexcept { + const std::size_t n(result.size()); + gsl_Expects(n <= v.size()); for ( std::size_t i = 0; i < n; i++ ) result[i] += v[i]; } template<typename VR, typename V1, typename V2> - void vec_sub(const std::size_t n, VR & result, const V1 &v1, const V2 & v2) noexcept + void vec_sub(VR & result, const V1 &v1, const V2 & v2) noexcept { + const std::size_t n(result.size()); + gsl_Expects(n <= v1.size()); + gsl_Expects(n <= v2.size()); for ( std::size_t i = 0; i < n; i++ ) result[i] = v1[i] - v2[i]; } template<typename V, typename T> - void vec_scale(const std::size_t n, V & v, T &&scalar) noexcept + void vec_scale(V & v, T &&scalar) noexcept { + const std::size_t n(v.size()); const typename std::remove_reference<decltype(v[0])>::type s(std::forward<T>(scalar)); for ( std::size_t i = 0; i < n; i++ ) v[i] *= s; } template<typename T, typename V> - T vec_maxabs(const std::size_t n, const V & v) noexcept + T vec_maxabs(const V & v) noexcept { - T ret = 0.0; + const std::size_t n(v.size()); + T ret(plib::constants<T>::zero()); for ( std::size_t i = 0; i < n; i++ ) ret = std::max(ret, plib::abs(v[i])); diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 44b96bf0d6d..21f1f0725fa 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -82,7 +82,6 @@ public: opt_type(*this, "y", "type", 0, std::vector<pstring>({"spice","eagle","rinf"}), "type of file to be converted: spice,eagle,rinf"), opt_grp6(*this, "Options for validate command", "These options are only used by the validate command."), - opt_extended_validation(*this, "", "extended", "Identify issues with power terminals."), opt_grp7(*this, "Options for header command", "These options are only used by the header command."), opt_tabwidth(*this, "", "tab-width", 4, "Tab width for output."), @@ -153,7 +152,6 @@ private: plib::option_str_limit<unsigned> opt_type; plib::option_group opt_grp6; - plib::option_bool opt_extended_validation; plib::option_group opt_grp7; plib::option_num<unsigned> opt_tabwidth; plib::option_num<unsigned> opt_linewidth; @@ -548,8 +546,6 @@ void tool_app_t::validate() m_errors = 0; m_warnings = 0; - nt.set_extended_validation(opt_extended_validation()); - try { nt.read_netlist(opt_files()[0], opt_name(), @@ -707,7 +703,7 @@ void tool_app_t::static_compile() for (auto &e : map) { sout << "// " << putf8string(e.second.m_module) << "\n"; - sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")},\n"; + sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")}, // NOLINT\n"; } sout << "#endif\n\n"; sout << "{\"\", nullptr}\n"; @@ -1178,7 +1174,7 @@ void tool_app_t::listmodels() { auto model = nt.setup().models().get_model(e); - elems.push_back({model.type(), e}); + elems.emplace_back(model.type(), e); } std::sort(elems.begin(), elems.end(), comp); diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index 4076de4bd12..944234fa8c8 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -86,15 +86,15 @@ namespace solver for (std::size_t k = 0; k < nets.size(); k++) { - analog_net_t *net = nets[k]; + analog_net_t &net = *nets[k]; - log().debug("adding net with {1} populated connections\n", net->core_terms().size()); + log().debug("adding net with {1} populated connections\n", setup.nlstate().core_terms(net).size()); - net->set_solver(this); + net.set_solver(this); - for (auto &p : net->core_terms()) + for (auto &p : setup.nlstate().core_terms(net)) { - log().debug("{1} {2} {3}\n", p->name(), net->name(), net->is_rail_net()); + log().debug("{1} {2} {3}\n", p->name(), net.name(), net.is_rail_net()); switch (p->type()) { case detail::terminal_type::TERMINAL: @@ -476,7 +476,7 @@ namespace solver resched = solve_nr_base(); // update timestep calculation next_time_step = compute_next_timestep(m_params.m_min_ts_ts(), m_params.m_min_ts_ts(), m_params.m_max_timestep); - delta -= netlist_time_ext::from_fp(m_params.m_min_ts_ts()); + delta -= netlist_time::from_fp(m_params.m_min_ts_ts()); } // try remaining time using compute_next_timestep while (delta > netlist_time::zero()) @@ -507,13 +507,13 @@ namespace solver netlist_time matrix_solver_t::solve(netlist_time_ext now, const char *source) { - netlist_time_ext delta = now - m_last_step(); + netlist_time delta = static_cast<netlist_time>(now - m_last_step()); PFDEBUG(printf("solve %.10f\n", delta.as_double());) plib::unused_var(source); // We are already up to date. Avoid oscillations. // FIXME: Make this a parameter! - if (delta < netlist_time_ext::quantum()) + if (delta < netlist_time::quantum()) { //printf("solve return %s at %f\n", source, now.as_double()); return timestep_device_count() > 0 ? netlist_time::from_fp(m_params.m_min_timestep) : netlist_time::zero(); diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h index 4e392c88770..1ba3b99e012 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.h +++ b/src/lib/netlist/solver/nld_matrix_solver.h @@ -10,10 +10,10 @@ #include "nl_base.h" #include "nl_errstr.h" -#include "plib/mat_cr.h" #include "plib/palloc.h" #include "plib/penum.h" #include "plib/pmatrix2d.h" +#include "plib/pmatrix_cr.h" #include "plib/pmempool.h" #include "plib/putil.h" #include "plib/vector_ops.h" @@ -74,7 +74,7 @@ namespace solver constexpr nl_fptype m_vntol() { return nlconst::magic(1e-7); } constexpr nl_fptype m_accuracy() { return nlconst::magic(1e-7); } constexpr std::size_t m_nr_loops() { return 250; } - constexpr std::size_t m_gs_loops() { return 9; } + constexpr std::size_t m_gs_loops() { return 50; } // general parameters constexpr nl_fptype m_gmin() { return nlconst::magic(1e-9); } diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index 61bfa012fa7..73f9eb83c0d 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -10,12 +10,10 @@ /// Gaussian elimination using compressed row format. /// -#include "plib/mat_cr.h" - -//#include "nld_ms_direct.h" #include "nld_matrix_solver_ext.h" #include "nld_solver.h" #include "plib/pdynlib.h" +#include "plib/pmatrix_cr.h" #include "plib/pstream.h" #include "plib/vector_ops.h" @@ -31,7 +29,7 @@ namespace solver { public: - using mat_type = plib::pGEmatrix_cr_t<plib::pmatrix_cr_t<FT, SIZE>>; + using mat_type = plib::pGEmatrix_cr<plib::pmatrix_cr<FT, SIZE>>; using base_type = matrix_solver_ext_t<FT, SIZE>; using fptype = typename base_type::fptype; @@ -95,10 +93,7 @@ namespace solver // FIXME: Move me // - // During extended validation there is no reason to check for - // differences in the generated code since during - // extended validation this will be different (and non-functional) - if (!this->state().is_extended_validation() && this->state().static_solver_lib().isLoaded()) + if (this->state().static_solver_lib().isLoaded()) { pstring symname = static_compile_name(); m_proc.load(this->state().static_solver_lib(), symname); @@ -119,7 +114,7 @@ namespace solver private: - using mat_index_type = typename plib::pmatrix_cr_t<FT, SIZE>::index_type; + using mat_index_type = typename plib::pmatrix_cr<FT, SIZE>::index_type; void generate_code(plib::putf8_fmt_writer &strm); diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h index c702d2e3ba6..da18050dca8 100644 --- a/src/lib/netlist/solver/nld_ms_gmres.h +++ b/src/lib/netlist/solver/nld_ms_gmres.h @@ -12,8 +12,8 @@ #include "nld_ms_direct.h" #include "nld_solver.h" #include "plib/gmres.h" -#include "plib/mat_cr.h" #include "plib/parray.h" +#include "plib/pmatrix_cr.h" #include "plib/vector_ops.h" #include <algorithm> @@ -83,7 +83,7 @@ namespace solver private: - using mattype = typename plib::pmatrix_cr_t<FT, SIZE>::index_type; + using mattype = typename plib::pmatrix_cr<FT, SIZE>::index_type; //plib::mat_precondition_none<FT, SIZE> m_ops; plib::mat_precondition_ILU<FT, SIZE> m_ops; diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 9ea31925b98..b475b282eb8 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -4,6 +4,7 @@ #include "nl_factory.h" #include "core/setup.h" +#include "nl_errstr.h" #include "nl_setup.h" // FIXME: only needed for splitter code #include "nld_matrix_solver.h" #include "nld_ms_direct.h" @@ -33,7 +34,7 @@ namespace devices NETLIB_RESET(solver) { - if (exec().use_stats()) + if (exec().stats_enabled()) m_fb_step.set_delegate(NETLIB_DELEGATE(fb_step<true>)); for (auto &s : m_mat_solvers) s->reset(); @@ -113,7 +114,7 @@ namespace devices } } if (!m_queue.empty()) - m_Q_step.net().toggle_and_push_to_queue(m_queue.top().exec_time() - now); + m_Q_step.net().toggle_and_push_to_queue(static_cast<netlist_time>(m_queue.top().exec_time() - now)); } void NETLIB_NAME(solver) :: reschedule(solver::matrix_solver_t *solv, netlist_time ts) @@ -277,20 +278,20 @@ namespace devices struct net_splitter { - void run(netlist_state_t &netlist) + void run(netlist_state_t &nlstate) { - for (auto & net : netlist.nets()) + for (auto & net : nlstate.nets()) { - netlist.log().verbose("processing {1}", net->name()); - if (!net->is_rail_net() && net->has_connections()) + nlstate.log().verbose("processing {1}", net->name()); + if (!net->is_rail_net() && !nlstate.core_terms(*net).empty()) { - netlist.log().verbose(" ==> not a rail net"); + nlstate.log().verbose(" ==> not a rail net"); // Must be an analog net auto &n = dynamic_cast<analog_net_t &>(*net); if (!already_processed(n)) { groupspre.emplace_back(NETLIB_NAME(solver)::net_list_t()); - process_net(netlist, n); + process_net(nlstate, n); } } } @@ -343,27 +344,31 @@ namespace devices } // NOLINTNEXTLINE(misc-no-recursion) - void process_net(netlist_state_t &netlist, analog_net_t &n) + void process_net(netlist_state_t &nlstate, analog_net_t &n) { // ignore empty nets. FIXME: print a warning message - netlist.log().verbose("Net {}", n.name()); - if (n.has_connections()) + nlstate.log().verbose("Net {}", n.name()); + if (!nlstate.core_terms(n).empty()) { // add the net groupspre.back().push_back(&n); // process all terminals connected to this net - for (auto &term : n.core_terms()) + for (auto &term : nlstate.core_terms(n)) { - netlist.log().verbose("Term {} {}", term->name(), static_cast<int>(term->type())); + nlstate.log().verbose("Term {} {}", term->name(), static_cast<int>(term->type())); // only process analog terminals if (term->is_type(detail::terminal_type::TERMINAL)) { auto &pt = dynamic_cast<terminal_t &>(*term); // check the connected terminal - analog_net_t &connected_net = netlist.setup().get_connected_terminal(pt)->net(); - netlist.log().verbose(" Connected net {}", connected_net.name()); - if (!check_if_processed_and_join(connected_net)) - process_net(netlist, connected_net); + const auto *const connected_terminals = nlstate.setup().get_connected_terminals(pt); + for (auto ct = connected_terminals->begin(); *ct != nullptr; ct++) + { + analog_net_t &connected_net = (*ct)->net(); + nlstate.log().verbose(" Connected net {}", connected_net.name()); + if (!check_if_processed_and_join(connected_net)) + process_net(nlstate, connected_net); + } } } } @@ -380,9 +385,55 @@ namespace devices net_splitter splitter; splitter.run(state()); + log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), state().nets().size()); + + int num_errors = 0; + + log().verbose("checking net consistency ..."); + for (const auto &grp : splitter.groups) + { + int railterms = 0; + pstring nets_in_grp; + for (const auto &n : grp) + { + nets_in_grp += (n->name() + " "); + if (!n->is_analog()) + { + state().log().error(ME_SOLVER_CONSISTENCY_NOT_ANALOG_NET(n->name())); + num_errors++; + } + if (n->is_rail_net()) + { + state().log().error(ME_SOLVER_CONSISTENCY_RAIL_NET(n->name())); + num_errors++; + } + for (const auto &t : state().core_terms(*n)) + { + if (!t->has_net()) + { + state().log().error(ME_SOLVER_TERMINAL_NO_NET(t->name())); + num_errors++; + } + else + { + auto *otherterm = dynamic_cast<terminal_t *>(t); + if (otherterm != nullptr) + if (state().setup().get_connected_terminal(*otherterm)->net().is_rail_net()) + railterms++; + } + } + } + if (railterms == 0) + { + state().log().error(ME_SOLVER_NO_RAIL_TERMINAL(nets_in_grp)); + num_errors++; + } + } + if (num_errors > 0) + throw nl_exception(MF_SOLVER_CONSISTENCY_ERRORS(num_errors)); + // setup the solvers - log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), state().nets().size()); for (auto & grp : splitter.groups) { solver_ptr ms; @@ -421,9 +472,9 @@ namespace devices for (auto &n : grp) { log().verbose("Net {1}", n->name()); - for (const auto &pcore : n->core_terms()) + for (const auto &t : state().core_terms(*n)) { - log().verbose(" {1}", pcore->name()); + log().verbose(" {1}", t->name()); } } diff --git a/src/lib/netlist/tests/test_pfunction.cpp b/src/lib/netlist/tests/test_pfunction.cpp index 56923be8149..21dc33f28ac 100644 --- a/src/lib/netlist/tests/test_pfunction.cpp +++ b/src/lib/netlist/tests/test_pfunction.cpp @@ -50,6 +50,11 @@ PTEST(pfunction, unary_minus) PFUNCEXPECT("3*-trunc(3.2)", -9.0); PFUNCEXPECT("3*-(3*2)", -18.0); PFUNCEXPECT("3*-(2*1)^2", -12.0); + PEXPECT_NO_THROW(plib::pfunction<double>("(-3)")()); // fail +} +PTEST(pfunction, expect_throw) +{ PEXPECT_THROW(plib::pfunction<double>("(3, 4)")(), plib::pexception); - PEXPECT_NO_THROW(plib::pfunction<double>("(3)")()); // fail + PEXPECT_THROW(plib::pfunction<double>("((3)")(), plib::pexception); + PEXPECT_THROW(plib::pfunction<double>("(3))")(), plib::pexception); } diff --git a/src/lib/util/avhuff.cpp b/src/lib/util/avhuff.cpp index 50eea9f24dc..ac5cea71526 100644 --- a/src/lib/util/avhuff.cpp +++ b/src/lib/util/avhuff.cpp @@ -691,24 +691,19 @@ avhuff_decoder::avhuff_decoder() } /** - * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) + * @fn void avhuff_decoder::configure(const config &cfg) * * @brief ------------------------------------------------- * configure - configure decompression parameters * -------------------------------------------------. * - * @param config The configuration. + * @param cfg The configuration. */ -void avhuff_decoder::configure(const avhuff_decompress_config &config) +void avhuff_decoder::configure(const config &cfg) { - m_config.video.wrap(config.video, config.video.cliprect()); - m_config.maxsamples = config.maxsamples; - m_config.actsamples = config.actsamples; - memcpy(m_config.audio, config.audio, sizeof(m_config.audio)); - m_config.maxmetalength = config.maxmetalength; - m_config.actmetalength = config.actmetalength; - m_config.metadata = config.metadata; + m_video.wrap(*cfg.video, cfg.video->cliprect()); + m_config = cfg; } /** @@ -792,9 +787,9 @@ avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complen // determine the start of each piece of data metastart = m_config.metadata; for (int chnum = 0; chnum < channels; chnum++) - audiostart[chnum] = (uint8_t *)m_config.audio[chnum]; - videostart = (m_config.video.valid()) ? reinterpret_cast<uint8_t *>(&m_config.video.pix(0)) : nullptr; - videostride = (m_config.video.valid()) ? m_config.video.rowpixels() * 2 : 0; + audiostart[chnum] = reinterpret_cast<uint8_t *>(m_config.audio[chnum]); + videostart = m_video.valid() ? reinterpret_cast<uint8_t *>(&m_video.pix(0)) : nullptr; + videostride = m_video.valid() ? m_video.rowpixels() * 2 : 0; // data is assumed to be native-endian uint16_t betest = 0; @@ -802,7 +797,7 @@ avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complen audioxor = videoxor = (betest == 1) ? 1 : 0; // verify against sizes - if (m_config.video.valid() && (m_config.video.width() < width || m_config.video.height() < height)) + if (m_video.valid() && (m_video.width() < width || m_video.height() < height)) return AVHERR_VIDEO_TOO_LARGE; for (int chnum = 0; chnum < channels; chnum++) if (m_config.audio[chnum] != nullptr && m_config.maxsamples < samples) diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h index 90ef43e977f..83b46195d6b 100644 --- a/src/lib/util/avhuff.h +++ b/src/lib/util/avhuff.h @@ -19,6 +19,8 @@ #include "huffman.h" #include "flac.h" +#include <algorithm> + //************************************************************************** // CONSTANTS @@ -49,32 +51,6 @@ enum avhuff_error // TYPE DEFINITIONS //************************************************************************** -// ======================> av_codec_decompress_config - -// decompression configuration -class avhuff_decompress_config -{ -public: - avhuff_decompress_config() - : maxsamples(0), - actsamples(nullptr), - maxmetalength(0), - actmetalength(nullptr), - metadata(nullptr) - { - memset(audio, 0, sizeof(audio)); - } - - bitmap_yuy16 video; // pointer to video bitmap - uint32_t maxsamples; // maximum number of samples per channel - uint32_t * actsamples; // actual number of samples per channel - int16_t * audio[16]; // pointer to individual audio channels - uint32_t maxmetalength; // maximum length of metadata - uint32_t * actmetalength; // actual length of metadata - uint8_t * metadata; // pointer to metadata buffer -}; - - // ======================> avhuff_encoder // core state for the codec @@ -98,8 +74,7 @@ private: { public: // construction/destruction - deltarle_encoder() - : m_rlecount(0) { } + deltarle_encoder() { } // histogramming uint16_t *rle_and_histo_bitmap(const uint8_t *source, uint32_t items_per_row, uint32_t item_advance, uint32_t row_count); @@ -111,7 +86,7 @@ private: private: // internal state - int m_rlecount; + int m_rlecount = 0; huffman_encoder<256 + 16> m_encoder; std::vector<uint16_t> m_rlebuffer; }; @@ -143,11 +118,30 @@ private: class avhuff_decoder { public: + // decompression configuration + class config + { + public: + config() + { + std::fill(std::begin(audio), std::end(audio), nullptr); + } + + bitmap_yuy16 * video = nullptr; // pointer to video bitmap + uint32_t maxsamples = 0; // maximum number of samples per channel + uint32_t * actsamples = nullptr; // actual number of samples per channel + int16_t * audio[16]; // pointer to individual audio channels + uint32_t maxmetalength = 0; // maximum length of metadata + uint32_t * actmetalength = nullptr; // actual length of metadata + uint8_t * metadata = nullptr; // pointer to metadata buffer + }; + + // construction/destruction avhuff_decoder(); // configuration - void configure(const avhuff_decompress_config &config); + void configure(const config &cfg); // encode/decode avhuff_error decode_data(const uint8_t *source, uint32_t complength, uint8_t *dest); @@ -158,8 +152,7 @@ private: { public: // construction/destruction - deltarle_decoder() - : m_rlecount(0), m_prevdata(0) { } + deltarle_decoder() { } // general void reset() { m_rlecount = m_prevdata = 0; } @@ -171,8 +164,8 @@ private: private: // internal state - int m_rlecount; - uint8_t m_prevdata; + int m_rlecount = 0; + uint8_t m_prevdata = 0; huffman_decoder<256 + 16> m_decoder; }; @@ -183,7 +176,8 @@ private: avhuff_error decode_video_lossless(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor); // internal state - avhuff_decompress_config m_config; + bitmap_yuy16 m_video; + config m_config; // video decoding contexts deltarle_decoder m_ycontext; diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 8722017d3e8..7f74920f06b 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -999,7 +999,7 @@ avi_file::error avi_stream::rgb32_compress_to_rgb(const bitmap_rgb32 &bitmap, st /* compressed video */ for (y = 0; y < height; y++) { - const std::uint32_t *source = &bitmap.pix32(y); + const std::uint32_t *source = &bitmap.pix(y); std::uint8_t *dest = data + (m_height - 1 - y) * m_width * 3; for (x = 0; x < width && dest < dataend; x++) @@ -1062,7 +1062,7 @@ avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, st for (y = 0; y < m_height; y++) { const std::uint16_t *source = reinterpret_cast<const std::uint16_t *>(data) + y * m_width; - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *dest = &bitmap.pix(y); /* switch off the compression */ switch (m_format) @@ -1113,7 +1113,7 @@ avi_file::error avi_stream::yuy16_compress_to_yuy(const bitmap_yuy16 &bitmap, st /* compressed video */ for (y = 0; y < m_height; y++) { - const std::uint16_t *source = &bitmap.pix16(y); + const std::uint16_t *source = &bitmap.pix(y); std::uint16_t *dest = reinterpret_cast<std::uint16_t *>(data) + y * m_width; /* switch off the compression */ @@ -1298,7 +1298,7 @@ avi_file::error avi_stream::huffyuv_decompress_to_yuy16(const std::uint8_t *data /* compressed video */ for (y = 0; y < m_height; y++) { - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *dest = &bitmap.pix(y); /* handle the first four bytes independently */ x = 0; @@ -1386,8 +1386,8 @@ avi_file::error avi_stream::huffyuv_decompress_to_yuy16(const std::uint8_t *data lastprevy = lastprevcb = lastprevcr = 0; for (y = 0; y < m_height; y++) { - std::uint16_t *prevrow = &bitmap.pix16(y - prevlines); - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *prevrow = &bitmap.pix(y - prevlines); + std::uint16_t *dest = &bitmap.pix(y); /* handle the first four bytes independently */ x = 0; @@ -1500,7 +1500,7 @@ avi_file::error avi_stream::uncompressed_rgb24_to_argb32(const std::uint8_t *dat /* uncompressed video */ for (int y = 0; y < m_height; y++) { - std::uint32_t *dest = &bitmap.pix32(y); + std::uint32_t *dest = &bitmap.pix(y); /* loop over pixels */ for (int x = 0; x < m_width; x++) @@ -1530,7 +1530,7 @@ avi_file::error avi_stream::uncompressed_yuv420p_to_argb32(const std::uint8_t *d /* uncompressed video */ for (int y = 0; y < m_height; y++) { - std::uint32_t *dest = &bitmap.pix32(y); + std::uint32_t *dest = &bitmap.pix(y); /* loop over pixels */ for (int x = 0; x < m_width; x++) diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp index ed814aae218..fc05b89f1b6 100644 --- a/src/lib/util/bitmap.cpp +++ b/src/lib/util/bitmap.cpp @@ -8,14 +8,12 @@ ***************************************************************************/ -#include <cassert> - #include "bitmap.h" +#include <cassert> #include <new> - //************************************************************************** // INLINE HELPERS //************************************************************************** @@ -361,7 +359,7 @@ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) * @param subrect The subrect. */ -void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) +void bitmap_t::wrap(bitmap_t &source, const rectangle &subrect) { assert(m_format == source.m_format); assert(m_bpp == source.m_bpp); @@ -407,7 +405,7 @@ void bitmap_t::set_palette(palette_t *palette) } /** - * @fn void bitmap_t::fill(uint32_t color, const rectangle &cliprect) + * @fn void bitmap_t::fill(uint64_t color, const rectangle &bounds) * * @brief ------------------------------------------------- * fill -- fill a bitmap with a solid color @@ -417,93 +415,45 @@ void bitmap_t::set_palette(palette_t *palette) * @param cliprect The cliprect. */ -void bitmap_t::fill(uint32_t color, const rectangle &cliprect) +void bitmap_t::fill(uint64_t color, const rectangle &bounds) { // if we have a cliprect, intersect with that - rectangle fill = cliprect; + rectangle fill(bounds); fill &= m_cliprect; - if (fill.empty()) - return; - - // based on the bpp go from there - switch (m_bpp) + if (!fill.empty()) { + // based on the bpp go from there + switch (m_bpp) + { case 8: - // 8bpp always uses memset for (int32_t y = fill.top(); y <= fill.bottom(); y++) - memset(raw_pixptr(y, fill.left()), uint8_t(color), fill.width()); + std::fill_n(&pixt<uint8_t>(y, fill.left()), fill.width(), uint8_t(color)); break; case 16: - // 16bpp can use memset if the bytes are equal - if (uint8_t(color >> 8) == uint8_t(color)) - { - for (int32_t y = fill.top(); y <= fill.bottom(); y++) - memset(raw_pixptr(y, fill.left()), uint8_t(color), fill.width() * 2); - } - else - { - // Fill the first line the hard way - uint16_t *destrow = &pixt<uint16_t>(fill.top()); - for (int32_t x = fill.left(); x <= fill.right(); x++) - destrow[x] = uint16_t(color); - - // For the other lines, just copy the first one - void *destrow0 = &pixt<uint16_t>(fill.top(), fill.left()); - for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++) - { - destrow = &pixt<uint16_t>(y, fill.left()); - memcpy(destrow, destrow0, fill.width() * 2); - } - } + for (int32_t y = fill.top(); y <= fill.bottom(); ++y) + std::fill_n(&pixt<uint16_t>(y, fill.left()), fill.width(), uint16_t(color)); break; case 32: - // 32bpp can use memset if the bytes are equal - if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color) - { - for (int32_t y = fill.top(); y <= fill.bottom(); y++) - memset(&pixt<uint32_t>(y, fill.left()), uint8_t(color), fill.width() * 4); - } - else - { - // Fill the first line the hard way - uint32_t *destrow = &pixt<uint32_t>(fill.top()); - for (int32_t x = fill.left(); x <= fill.right(); x++) - destrow[x] = uint32_t(color); - - // For the other lines, just copy the first one - uint32_t *destrow0 = &pixt<uint32_t>(fill.top(), fill.left()); - for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++) - { - destrow = &pixt<uint32_t>(y, fill.left()); - memcpy(destrow, destrow0, fill.width() * 4); - } - } + for (int32_t y = fill.top(); y <= fill.bottom(); ++y) + std::fill_n(&pixt<uint32_t>(y, fill.left()), fill.width(), uint32_t(color)); break; case 64: - // 64bpp can use memset if the bytes are equal - if (uint8_t(color >> 8) == uint8_t(color) && uint16_t(color >> 16) == uint16_t(color)) // FIXME: really? wat about the upper bits that would be zeroed when done the "hard way"? - { - for (int32_t y = fill.top(); y <= fill.bottom(); y++) - memset(&pixt<uint64_t>(y, fill.left()), uint8_t(color), fill.width() * 8); - } - else - { - // Fill the first line the hard way - uint64_t *destrow = &pixt<uint64_t>(fill.top()); - for (int32_t x = fill.left(); x <= fill.right(); x++) - destrow[x] = uint64_t(color); - - // For the other lines, just copy the first one - uint64_t *destrow0 = &pixt<uint64_t>(fill.top(), fill.left()); - for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++) - { - destrow = &pixt<uint64_t>(y, fill.left()); - memcpy(destrow, destrow0, fill.width() * 8); - } - } + for (int32_t y = fill.top(); y <= fill.bottom(); ++y) + std::fill_n(&pixt<uint64_t>(y, fill.left()), fill.width(), uint64_t(color)); break; + } } } + + +//************************************************************************** +// EXPLICIT TEMPLATE INSTANTIATIONS +//************************************************************************** + +template class bitmap_specific<uint8_t>; +template class bitmap_specific<uint16_t>; +template class bitmap_specific<uint32_t>; +template class bitmap_specific<uint64_t>; diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h index ed6a5382a61..57ed0bc1775 100644 --- a/src/lib/util/bitmap.h +++ b/src/lib/util/bitmap.h @@ -16,6 +16,9 @@ #include "osdcore.h" #include "palette.h" +#include <algorithm> +#include <memory> + //************************************************************************** // TYPE DEFINITIONS @@ -151,23 +154,23 @@ public: // operations void set_palette(palette_t *palette); - void fill(uint32_t color) { fill(color, m_cliprect); } - void fill(uint32_t color, const rectangle &cliprect); - void plot_box(int x, int y, int width, int height, uint32_t color) + void fill(uint64_t color) { fill(color, m_cliprect); } + void fill(uint64_t color, const rectangle &bounds); + void plot_box(int32_t x, int32_t y, int32_t width, int32_t height, uint64_t color) { - rectangle clip(x, x + width - 1, y, y + height - 1); - fill(color, clip); + fill(color, rectangle(x, x + width - 1, y, y + height - 1)); } // pixel access - template<typename PixelType> - PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } - void *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } + void *raw_pixptr(int32_t y, int32_t x = 0) { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } + void const *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } protected: // for use by subclasses only to ensure type correctness + template <typename PixelType> PixelType &pixt(int32_t y, int32_t x = 0) { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } + template <typename PixelType> PixelType const &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } void wrap(void *base, int width, int height, int rowpixels); - void wrap(const bitmap_t &source, const rectangle &subrect); + void wrap(bitmap_t &source, const rectangle &subrect); private: // internal helpers @@ -191,17 +194,17 @@ private: // ======================> bitmap_specific, bitmap8_t, bitmap16_t, bitmap32_t, bitmap64_t -template<typename PixelType> +template <typename PixelType> class bitmap_specific : public bitmap_t { - static constexpr int PixelBits = 8 * sizeof(PixelType); + static constexpr int PIXEL_BITS = 8 * sizeof(PixelType); protected: // construction/destruction -- subclasses only bitmap_specific(bitmap_specific<PixelType> &&) = default; - bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PixelBits, width, height, xslop, yslop) { } - bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PixelBits, base, width, height, rowpixels) { } - bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PixelBits, source, subrect) { } + bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PIXEL_BITS, width, height, xslop, yslop) { } + bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PIXEL_BITS, base, width, height, rowpixels) { } + bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PIXEL_BITS, source, subrect) { } bitmap_specific<PixelType> &operator=(bitmap_specific<PixelType> &&) = default; @@ -209,27 +212,46 @@ public: using pixel_t = PixelType; // getters - uint8_t bpp() const { return PixelBits; } + uint8_t bpp() const { return PIXEL_BITS; } // pixel accessors - PixelType &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } - PixelType &pix8(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 8, "must be 8bpp"); return pixt<PixelType>(y, x); } - PixelType &pix16(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 16, "must be 16bpp"); return pixt<PixelType>(y, x); } - PixelType &pix32(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 32, "must be 32bpp"); return pixt<PixelType>(y, x); } - PixelType &pix64(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 64, "must be 64bpp"); return pixt<PixelType>(y, x); } + PixelType &pix(int32_t y, int32_t x = 0) { return pixt<PixelType>(y, x); } + PixelType const &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } + + // operations + void fill(PixelType color) { fill(color, cliprect()); } + void fill(PixelType color, const rectangle &bounds) + { + // if we have a cliprect, intersect with that + rectangle fill(bounds); + fill &= cliprect(); + if (!fill.empty()) + { + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + std::fill_n(&pix(y, fill.left()), fill.width(), color); + } + } + void plot_box(int32_t x, int32_t y, int32_t width, int32_t height, PixelType color) + { + fill(color, rectangle(x, x + width - 1, y, y + height - 1)); + } }; // 8bpp bitmaps using bitmap8_t = bitmap_specific<uint8_t>; +extern template class bitmap_specific<uint8_t>; // 16bpp bitmaps using bitmap16_t = bitmap_specific<uint16_t>; +extern template class bitmap_specific<uint16_t>; // 32bpp bitmaps using bitmap32_t = bitmap_specific<uint32_t>; +extern template class bitmap_specific<uint32_t>; // 64bpp bitmaps using bitmap64_t = bitmap_specific<uint64_t>; +extern template class bitmap_specific<uint64_t>; // ======================> bitmap_ind8, bitmap_ind16, bitmap_ind32, bitmap_ind64 @@ -246,7 +268,7 @@ public: bitmap_ind8(uint8_t *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind8(bitmap_ind8 &source, const rectangle &subrect) : bitmap8_t(k_bitmap_format, source, subrect) { } void wrap(uint8_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -266,7 +288,7 @@ public: bitmap_ind16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind16(bitmap_ind16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { } void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -286,7 +308,7 @@ public: bitmap_ind32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind32(bitmap_ind32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -306,7 +328,7 @@ public: bitmap_ind64(uint64_t *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind64(bitmap_ind64 &source, const rectangle &subrect) : bitmap64_t(k_bitmap_format, source, subrect) { } void wrap(uint64_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -329,7 +351,7 @@ public: bitmap_yuy16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_yuy16(bitmap_yuy16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { } void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -349,7 +371,7 @@ public: bitmap_rgb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_rgb32(bitmap_rgb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -369,7 +391,7 @@ public: bitmap_argb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_argb32(bitmap_argb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -377,5 +399,4 @@ public: bitmap_argb32 &operator=(bitmap_argb32 &&) = default; }; - -#endif // MAME_UTIL_BITMAP_H +#endif // MAME_UTIL_BITMAP_H diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp index 58f7b4291db..7f6e0f018cd 100644 --- a/src/lib/util/chdcodec.cpp +++ b/src/lib/util/chdcodec.cpp @@ -1786,7 +1786,7 @@ void chd_avhuff_decompressor::configure(int param, void *config) { // if we're getting the decompression configuration, apply it now if (param == AVHUFF_CODEC_DECOMPRESS_CONFIG) - m_decoder.configure(*reinterpret_cast<avhuff_decompress_config *>(config)); + m_decoder.configure(*reinterpret_cast<avhuff_decoder::config const *>(config)); // anything else is invalid else diff --git a/src/lib/util/corealloc.h b/src/lib/util/corealloc.h index 5d1f055e19b..db8aacf6cb2 100644 --- a/src/lib/util/corealloc.h +++ b/src/lib/util/corealloc.h @@ -8,54 +8,24 @@ ***************************************************************************/ -#pragma once - #ifndef MAME_LIB_UTIL_COREALLOC_H #define MAME_LIB_UTIL_COREALLOC_H -#include "osdcore.h" +#pragma once -#include <cstdlib> +#include "osdcore.h" #include <cstddef> +#include <cstdlib> #include <cstring> -#include <new> #include <memory> +#include <new> #include <type_traits> #include <utility> -//************************************************************************** -// MACROS -//************************************************************************** - -// global allocation helpers -- use these instead of new and delete -#define global_alloc(Type) new Type -#define global_alloc_array(Type, Num) new Type[Num] -#define global_free(Ptr) do { delete Ptr; } while (0) -#define global_free_array(Ptr) do { delete[] Ptr; } while (0) - - - -template<typename T, typename... Params> -inline T* global_alloc_clear(Params &&... args) -{ - void *const ptr = ::operator new(sizeof(T)); // allocate memory - std::memset(ptr, 0, sizeof(T)); - return new(ptr) T(std::forward<Params>(args)...); -} - -template<typename T> -inline T* global_alloc_array_clear(std::size_t num) -{ - auto const size = sizeof(T) * num; - void *const ptr = new unsigned char[size]; // allocate memory - std::memset(ptr, 0, size); - return new(ptr) T[num](); -} - - +// global allocation helpers template<typename Tp> struct MakeUniqClearT { typedef std::unique_ptr<Tp> single_object; }; diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index 95d8230f565..a06c4fb8a46 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -202,7 +202,7 @@ public: if (m_tail == &toreplace) m_tail = &object; object.m_next = toreplace.m_next; - global_free(&toreplace); + delete &toreplace; return object; } return append(object); @@ -253,7 +253,7 @@ public: // remove the given object and free its memory void remove(ElementType &object) noexcept { - global_free(&detach(object)); + delete &detach(object); } // find an object by index in the list @@ -305,7 +305,7 @@ public: { ItemType *result = m_freelist.detach_head(); if (result == nullptr) - result = global_alloc(ItemType); + result = new ItemType; return result; } diff --git a/src/lib/util/msdib.cpp b/src/lib/util/msdib.cpp new file mode 100644 index 00000000000..a1ae5eaddf0 --- /dev/null +++ b/src/lib/util/msdib.cpp @@ -0,0 +1,642 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*************************************************************************** + + msdib.h + + Microsoft Device-Independent Bitmap file loading. + +***************************************************************************/ + +#include "msdib.h" + +#include "eminline.h" + +#include <cassert> +#include <cstdlib> +#include <cstring> + + +#define LOG_GENERAL (1U << 0) +#define LOG_DIB (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_DIB) + +#define LOG_OUTPUT_FUNC osd_printf_verbose + +#ifndef VERBOSE +#define VERBOSE 0 +#endif + +#define LOGMASKED(mask, ...) do { if (VERBOSE & (mask)) (LOG_OUTPUT_FUNC)(__VA_ARGS__); } while (false) + +#define LOG(...) LOGMASKED(LOG_GENERAL, __VA_ARGS__) + + +namespace util { + +namespace { + +// DIB compression schemes +enum : std::uint32_t +{ + DIB_COMP_NONE = 0, + DIB_COMP_RLE8 = 1, + DIB_COMP_RLE4 = 2, + DIB_COMP_BITFIELDS = 3 +}; + + +// file header doesn't use natural alignment +using bitmap_file_header = std::uint8_t [14]; + + +// old-style DIB header +struct bitmap_core_header +{ + std::uint32_t size; // size of the header (12, 16 or 64) + std::int16_t width; // width of bitmap in pixels + std::int16_t height; // height of the image in pixels + std::uint16_t planes; // number of colour planes (must be 1) + std::uint16_t bpp; // bits per pixel +}; + +// new-style DIB header +struct bitmap_info_header +{ + std::uint32_t size; // size of the header + std::int32_t width; // width of bitmap in pixels + std::int32_t height; // height of bitmap in pixels + std::uint16_t planes; // number of colour planes (must be 1) + std::uint16_t bpp; // bits per pixel + std::uint32_t comp; // compression method + std::uint32_t rawsize; // size of bitmap data after decompression or 0 if uncompressed + std::int32_t hres; // horizontal resolution in pixels/metre + std::int32_t vres; // horizontal resolution in pixels/metre + std::uint32_t colors; // number of colours or 0 for 1 << bpp + std::uint32_t important; // number of important colours or 0 if all important + std::uint32_t red; // red field mask - must be contiguous + std::uint32_t green; // green field mask - must be contiguous + std::uint32_t blue; // blue field mask - must be contiguous + std::uint32_t alpha; // alpha field mask - must be contiguous +}; + + +union bitmap_headers +{ + bitmap_core_header core; + bitmap_info_header info; +}; + + +bool dib_parse_mask(uint32_t mask, unsigned &shift, unsigned &bits) +{ + shift = count_leading_zeros(mask); + mask <<= shift; + bits = count_leading_ones(mask); + mask <<= shift; + shift = 32 - shift - bits; + return !mask; +} + + +void dib_truncate_channel(unsigned &shift, unsigned &bits) +{ + if (8U < bits) + { + unsigned const excess(bits - 8); + shift += excess; + bits -= excess; + } +} + + +uint8_t dib_splat_sample(uint8_t val, unsigned bits) +{ + assert(8U >= bits); + for (val <<= (8U - bits); bits && (8U > bits); bits <<= 1) + val |= val >> bits; + return val; +} + + +msdib_error dib_read_file_header(core_file &fp, std::uint32_t &filelen) +{ + // the bitmap file header doesn't use natural alignment + bitmap_file_header file_header; + if (fp.read(file_header, sizeof(file_header)) != sizeof(file_header)) + { + LOG("Error reading DIB file header\n"); + return msdib_error::FILE_TRUNCATED; + } + + // only support Windows bitmaps for now + if ((0x42 != file_header[0]) || (0x4d != file_header[1])) + return msdib_error::BAD_SIGNATURE; + + // do a very basic check on the file length + std::uint32_t const file_length( + (std::uint32_t(file_header[2]) << 0) | + (std::uint32_t(file_header[3]) << 8) | + (std::uint32_t(file_header[4]) << 16) | + (std::uint32_t(file_header[5]) << 24)); + if ((sizeof(file_header) + sizeof(bitmap_core_header)) > file_length) + return msdib_error::FILE_CORRUPT; + + // check that the offset to the pixel data looks half sane + std::uint32_t const pixel_offset( + (std::uint32_t(file_header[10]) << 0) | + (std::uint32_t(file_header[11]) << 8) | + (std::uint32_t(file_header[12]) << 16) | + (std::uint32_t(file_header[13]) << 24)); + if (((sizeof(file_header) + sizeof(bitmap_core_header)) > pixel_offset) || (file_length < pixel_offset)) + return msdib_error::FILE_CORRUPT; + + // looks OK enough + filelen = file_length; + return msdib_error::NONE; +} + + +msdib_error dib_read_bitmap_header( + core_file &fp, + bitmap_headers &header, + unsigned &palette_bytes, + bool &indexed, + std::size_t &palette_entries, + std::size_t &palette_size, + std::size_t &row_bytes, + std::uint32_t length) +{ + // check that these things haven't been padded somehow + static_assert(sizeof(bitmap_core_header) == 12U, "compiler has applied padding to bitmap_core_header"); + static_assert(sizeof(bitmap_info_header) == 56U, "compiler has applied padding to bitmap_info_header"); + + // ensure the header fits in the space for the image data + assert(&header.core.size == &header.info.size); + if (sizeof(header.core) > length) + return msdib_error::FILE_TRUNCATED; + std::memset(&header, 0, sizeof(header)); + if (fp.read(&header.core.size, sizeof(header.core.size)) != sizeof(header.core.size)) + { + LOG("Error reading DIB header size (length %u)\n", length); + return msdib_error::FILE_TRUNCATED; + } + header.core.size = little_endianize_int32(header.core.size); + if (length < header.core.size) + { + LOG("DIB image data (%u bytes) is too small for DIB header (%u bytes)\n", length, header.core.size); + return msdib_error::FILE_CORRUPT; + } + + // identify and read the header - convert OS/2 headers to Windows 3 format + palette_bytes = 4U; + switch (header.core.size) + { + case 16U: + case 64U: + // extended OS/2 bitmap header with support for compression + LOG( + "DIB image data (%u bytes) uses unsupported OS/2 DIB header (size %u)\n", + length, + header.core.size); + return msdib_error::UNSUPPORTED_FORMAT; + + case 12U: + // introduced in OS/2 and Windows 2.0 + { + palette_bytes = 3U; + std::uint32_t const header_read(std::min<std::uint32_t>(header.core.size, sizeof(header.core)) - sizeof(header.core.size)); + if (fp.read(&header.core.width, header_read) != header_read) + { + LOG("Error reading DIB core header from image data (%u bytes)\n", length); + return msdib_error::FILE_TRUNCATED; + } + fp.seek(header.core.size - sizeof(header.core.size) - header_read, SEEK_CUR); + header.core.width = little_endianize_int16(header.core.width); + header.core.height = little_endianize_int16(header.core.height); + header.core.planes = little_endianize_int16(header.core.planes); + header.core.bpp = little_endianize_int16(header.core.bpp); + LOGMASKED( + LOG_DIB, + "Read DIB core header from image data : %d*%d, %u planes, %u bpp\n", + header.core.width, + header.core.height, + header.core.planes, + header.core.bpp); + + // this works because the core header only aliases the width/height of the info header + header.info.bpp = header.core.bpp; + header.info.planes = header.core.planes; + header.info.height = header.core.height; + header.info.width = header.core.width; + header.info.size = 40U; + } + break; + + default: + // the next version will be longer + if (124U >= header.core.size) + { + LOG( + "DIB image data (%u bytes) uses unsupported DIB header format (size %u)\n", + length, + header.core.size); + return msdib_error::UNSUPPORTED_FORMAT; + } + // fall through + case 40U: + case 52U: + case 56U: + case 108U: + case 124U: + // the Windows 3 bitmap header with optional extensions + { + palette_bytes = 4U; + std::uint32_t const header_read(std::min<std::uint32_t>(header.info.size, sizeof(header.info)) - sizeof(header.info.size)); + if (fp.read(&header.info.width, header_read) != header_read) + { + LOG("Error reading DIB info header from image data (%u bytes)\n", length); + return msdib_error::FILE_TRUNCATED; + } + fp.seek(header.info.size - sizeof(header.info.size) - header_read, SEEK_CUR); + header.info.width = little_endianize_int32(header.info.width); + header.info.height = little_endianize_int32(header.info.height); + header.info.planes = little_endianize_int16(header.info.planes); + header.info.bpp = little_endianize_int16(header.info.bpp); + header.info.comp = little_endianize_int32(header.info.comp); + header.info.rawsize = little_endianize_int32(header.info.rawsize); + header.info.hres = little_endianize_int32(header.info.hres); + header.info.vres = little_endianize_int32(header.info.vres); + header.info.colors = little_endianize_int32(header.info.colors); + header.info.important = little_endianize_int32(header.info.important); + header.info.red = little_endianize_int32(header.info.red); + header.info.green = little_endianize_int32(header.info.green); + header.info.blue = little_endianize_int32(header.info.blue); + header.info.alpha = little_endianize_int32(header.info.alpha); + LOGMASKED( + LOG_DIB, + "Read DIB info header from image data: %d*%d (%d*%d ppm), %u planes, %u bpp %u/%s%u colors\n", + header.info.width, + header.info.height, + header.info.hres, + header.info.vres, + header.info.planes, + header.info.bpp, + header.info.important, + header.info.colors ? "" : "2^", + header.info.colors ? header.info.colors : header.info.bpp); + } + break; + } + + // check for unsupported planes/bit depth + if ((1U != header.info.planes) || !header.info.bpp || (32U < header.info.bpp) || ((8U < header.info.bpp) ? (header.info.bpp % 8) : (8 % header.info.bpp))) + { + LOG("DIB image data uses unsupported planes/bits per pixel %u*%u\n", header.info.planes, header.info.bpp); + return msdib_error::UNSUPPORTED_FORMAT; + } + + // check dimensions + if ((0 >= header.info.width) || (0 == header.info.height)) + { + LOG("DIB image data has invalid dimensions %u*%u\n", header.info.width, header.info.height); + return msdib_error::FILE_CORRUPT; + } + + // ensure compression scheme is supported + bool no_palette(false); + indexed = true; + switch (header.info.comp) + { + case DIB_COMP_NONE: + // uncompressed - direct colour with implied bitfields if more than eight bits/pixel + indexed = 8U >= header.info.bpp; + if (indexed) + { + if ((1U << header.info.bpp) < header.info.colors) + { + osd_printf_verbose( + "DIB image data has oversized palette with %u entries for %u bits per pixel\n", + header.info.colors, + header.info.bpp); + } + } + if (!indexed) + { + no_palette = true; + switch(header.info.bpp) + { + case 16U: + header.info.red = 0x00007c00; + header.info.green = 0x000003e0; + header.info.blue = 0x0000001f; + header.info.alpha = 0x00000000; + break; + case 24U: + case 32U: + header.info.red = 0x00ff0000; + header.info.green = 0x0000ff00; + header.info.blue = 0x000000ff; + header.info.alpha = 0x00000000; + break; + } + } + break; + + case DIB_COMP_BITFIELDS: + // uncompressed direct colour with explicitly-specified bitfields + indexed = false; + if (offsetof(bitmap_info_header, alpha) > header.info.size) + { + osd_printf_verbose( + "DIB image data specifies bit masks but is too small (size %u)\n", + header.info.size); + return msdib_error::FILE_CORRUPT; + } + break; + + default: + LOG("DIB image data uses unsupported compression scheme %u\n", header.info.comp); + return msdib_error::UNSUPPORTED_FORMAT; + } + + // we can now calculate the size of the palette and row data + palette_entries = + indexed + ? ((1U == header.info.bpp) ? 2U : header.info.colors ? header.info.colors : (1U << header.info.bpp)) + : (no_palette ? 0U : header.info.colors); + palette_size = palette_bytes * palette_entries; + row_bytes = ((31 + (header.info.width * header.info.bpp)) >> 5) << 2; + + // header looks OK + return msdib_error::NONE; +} + +} // anonymous namespace + + + +msdib_error msdib_verify_header(core_file &fp) +{ + msdib_error err; + + // file header + std::uint32_t file_length; + err = dib_read_file_header(fp, file_length); + if (msdib_error::NONE != err) + return err; + + // bitmap header + bitmap_headers header; + unsigned palette_bytes; + bool indexed; + std::size_t palette_entries, palette_size, row_bytes; + err = dib_read_bitmap_header( + fp, + header, + palette_bytes, + indexed, + palette_entries, + palette_size, + row_bytes, + file_length - sizeof(bitmap_file_header)); + if (msdib_error::NONE != err) + return err; + + // check length + std::size_t const required_size( + sizeof(bitmap_file_header) + + header.info.size + + palette_size + + (row_bytes * std::abs(header.info.height))); + if (required_size > file_length) + return msdib_error::FILE_TRUNCATED; + + // good chance this file is supported + return msdib_error::NONE; +} + + +msdib_error msdib_read_bitmap(core_file &fp, bitmap_argb32 &bitmap) +{ + std::uint32_t file_length; + msdib_error const headerr(dib_read_file_header(fp, file_length)); + if (msdib_error::NONE != headerr) + return headerr; + + return msdib_read_bitmap_data(fp, bitmap, file_length - sizeof(bitmap_file_header), 0U); +} + + +msdib_error msdib_read_bitmap_data(core_file &fp, bitmap_argb32 &bitmap, std::uint32_t length, std::uint32_t dirheight) +{ + // read the bitmap header + bitmap_headers header; + unsigned palette_bytes; + bool indexed; + std::size_t palette_entries, palette_size, row_bytes; + msdib_error const head_error(dib_read_bitmap_header(fp, header, palette_bytes, indexed, palette_entries, palette_size, row_bytes, length)); + if (msdib_error::NONE != head_error) + return head_error; + + // check dimensions + bool const top_down(0 > header.info.height); + if (top_down) + header.info.height = -header.info.height; + bool have_and_mask((2 * dirheight) == header.info.height); + if (!have_and_mask && (0 < dirheight) && (dirheight != header.info.height)) + { + osd_printf_verbose( + "DIB image data height %d doesn't match directory height %u with or without AND mask\n", + header.info.height, + dirheight); + return msdib_error::UNSUPPORTED_FORMAT; + } + if (have_and_mask) + header.info.height >>= 1; + + // we can now calculate the size of the image data + std::size_t const mask_row_bytes(((31 + header.info.width) >> 5) << 2); + std::size_t const required_size( + header.info.size + + palette_size + + ((row_bytes + (have_and_mask ? mask_row_bytes : 0U)) * header.info.height)); + if (required_size > length) + { + LOG("DIB image data (%u bytes) smaller than calculated DIB data size (%u bytes)\n", length, required_size); + return msdib_error::FILE_TRUNCATED; + } + + // load the palette for indexed colour formats or the shifts for direct colour formats + unsigned red_shift(0), green_shift(0), blue_shift(0), alpha_shift(0); + unsigned red_bits(0), green_bits(0), blue_bits(0), alpha_bits(0); + std::unique_ptr<rgb_t []> palette; + if (indexed) + { + // read palette and convert + std::unique_ptr<std::uint8_t []> palette_data; + try { palette_data.reset(new std::uint8_t [palette_size]); } + catch (std::bad_alloc const &) { return msdib_error::OUT_OF_MEMORY; } + if (fp.read(palette_data.get(), palette_size) != palette_size) + { + LOG("Error reading palette from DIB image data (%u bytes)\n", length); + return msdib_error::FILE_TRUNCATED; + } + std::size_t const palette_usable(std::min<std::size_t>(palette_entries, std::size_t(1) << header.info.bpp)); + try { palette.reset(new rgb_t [palette_usable]); } + catch (std::bad_alloc const &) { return msdib_error::OUT_OF_MEMORY; } + std::uint8_t const *ptr(palette_data.get()); + for (std::size_t i = 0; palette_usable > i; ++i, ptr += palette_bytes) + palette[i] = rgb_t(ptr[2], ptr[1], ptr[0]); + } + else + { + // skip over the palette if necessary + if (palette_entries) + fp.seek(palette_bytes * palette_entries, SEEK_CUR); + + // convert masks to shifts + bool const masks_contiguous( + dib_parse_mask(header.info.red, red_shift, red_bits) && + dib_parse_mask(header.info.green, green_shift, green_bits) && + dib_parse_mask(header.info.blue, blue_shift, blue_bits) && + dib_parse_mask(header.info.alpha, alpha_shift, alpha_bits)); + if (!masks_contiguous) + { + osd_printf_verbose( + "DIB image data specifies non-contiguous channel masks 0x%x | 0x%x | 0x%x | 0x%x\n", + header.info.red, + header.info.green, + header.info.blue, + header.info.alpha); + } + if ((32U != header.info.bpp) && ((header.info.red | header.info.green | header.info.blue | header.info.alpha) >> header.info.bpp)) + { + LOG( + "DIB image data specifies channel masks 0x%x | 0x%x | 0x%x | 0x%x that exceed %u bits per pixel\n", + header.info.red, + header.info.green, + header.info.blue, + header.info.alpha, + header.info.bpp); + return msdib_error::FILE_CORRUPT; + } + LOGMASKED( + LOG_DIB, + "DIB image data using channels: R((x >> %2$u) & 0x%3$0*1$x) G((x >> %4$u) & 0x%5$0*1$x) B((x >> %6$u) & 0x%7$0*1$x) A((x >> %8$u) & 0x%9$0*1$x)\n", + (header.info.bpp + 3) >> 2, + red_shift, + (std::uint32_t(1) << red_bits) - 1, + green_shift, + (std::uint32_t(1) << green_bits) - 1, + blue_shift, + (std::uint32_t(1) << blue_bits) - 1, + alpha_shift, + (std::uint32_t(1) << alpha_bits) - 1); + + // the MAME bitmap only supports 8 bits/sample maximum + dib_truncate_channel(red_shift, red_bits); + dib_truncate_channel(green_shift, green_bits); + dib_truncate_channel(blue_shift, blue_bits); + dib_truncate_channel(alpha_shift, alpha_bits); + } + + // allocate the bitmap and process row data + std::unique_ptr<std::uint8_t []> row_data; + try {row_data.reset(new std::uint8_t [row_bytes]); } + catch (std::bad_alloc const &) { return msdib_error::OUT_OF_MEMORY; } + bitmap.allocate(header.info.width, header.info.height); + int const y_inc(top_down ? 1 : -1); + for (std::int32_t i = 0, y = top_down ? 0 : (header.info.height - 1); header.info.height > i; ++i, y += y_inc) + { + if (fp.read(row_data.get(), row_bytes) != row_bytes) + { + LOG("Error reading DIB row %d data from image data\n", i); + return msdib_error::FILE_TRUNCATED; + } + std::uint8_t *src(row_data.get()); + std::uint32_t *dest(&bitmap.pix(y)); + unsigned shift(0U); + for (std::int32_t x = 0; header.info.width > x; ++x, ++dest) + { + // extract or compose a pixel + std::uint32_t pix(0U); + if (8U >= header.info.bpp) + { + assert(8U > shift); + pix = *src >> (8U - header.info.bpp); + *src <<= header.info.bpp; + shift += header.info.bpp; + if (8U <= shift) + { + shift = 0U; + ++src; + } + } + else for (shift = 0; header.info.bpp > shift; shift += 8U, ++src) + { + pix |= std::uint32_t(*src) << shift; + } + + // convert to RGB + if (indexed) + { + if (palette_entries > pix) + { + *dest = palette[pix]; + } + else + { + *dest = rgb_t::transparent(); + osd_printf_verbose( + "DIB image data has out-of-range color %u at (%d, %d) with %u palette entries\n", + pix, + x, + y, + palette_entries); + } + } + else + { + std::uint8_t r(dib_splat_sample((pix >> red_shift) & ((std::uint32_t(1) << red_bits) - 1), red_bits)); + std::uint8_t g(dib_splat_sample((pix >> green_shift) & ((std::uint32_t(1) << green_bits) - 1), green_bits)); + std::uint8_t b(dib_splat_sample((pix >> blue_shift) & ((std::uint32_t(1) << blue_bits) - 1), blue_bits)); + std::uint8_t a(dib_splat_sample((pix >> alpha_shift) & ((std::uint32_t(1) << alpha_bits) - 1), alpha_bits)); + *dest = rgb_t(alpha_bits ? a : 255, r, g, b); + } + } + } + + // process the AND mask if present + if (have_and_mask) + { + for (std::int32_t i = 0, y = top_down ? 0 : (header.info.height - 1); header.info.height > i; ++i, y += y_inc) + { + if (fp.read(row_data.get(), mask_row_bytes) != mask_row_bytes) + { + LOG("Error reading DIB mask row %d data from image data\n", i); + return msdib_error::FILE_TRUNCATED; + } + std::uint8_t *src(row_data.get()); + std::uint32_t *dest(&bitmap.pix(y)); + unsigned shift(0U); + for (std::int32_t x = 0; header.info.width > x; ++x, ++dest) + { + assert(8U > shift); + rgb_t pix(*dest); + *dest = pix.set_a(BIT(*src, 7U - shift) ? 0U : pix.a()); + if (8U <= ++shift) + { + shift = 0U; + ++src; + } + } + } + } + + // we're done! + return msdib_error::NONE; +} + +} // namespace util diff --git a/src/lib/util/msdib.h b/src/lib/util/msdib.h new file mode 100644 index 00000000000..54767e216fb --- /dev/null +++ b/src/lib/util/msdib.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*************************************************************************** + + msdib.h + + Microsoft Device-Independent Bitmap file loading. + +***************************************************************************/ +#ifndef MAME_LIB_UTIL_MSDIB_H +#define MAME_LIB_UTIL_MSDIB_H + +#pragma once + +#include "bitmap.h" +#include "corefile.h" +#include "osdcore.h" + +#include <cstdint> + + +namespace util { + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +// Error types +enum class msdib_error +{ + NONE, + OUT_OF_MEMORY, + FILE_ERROR, + BAD_SIGNATURE, + FILE_TRUNCATED, + FILE_CORRUPT, + UNSUPPORTED_FORMAT +}; + +msdib_error msdib_verify_header(core_file &fp); +msdib_error msdib_read_bitmap(core_file &fp, bitmap_argb32 &bitmap); +msdib_error msdib_read_bitmap_data(core_file &fp, bitmap_argb32 &bitmap, std::uint32_t length, std::uint32_t dirheight = 0U); + +} // namespace util + +#endif // MAME_LIB_UTIL_MSDIB_H diff --git a/src/lib/util/nanosvg.cpp b/src/lib/util/nanosvg.cpp index 09973865675..0cb05308d19 100644 --- a/src/lib/util/nanosvg.cpp +++ b/src/lib/util/nanosvg.cpp @@ -1,6 +1,10 @@ +#include <stdio.h> +#include <string.h> +#include <math.h> + +#define NANOSVG_ALL_COLOR_KEYWORDS #define NANOSVG_IMPLEMENTATION #define NANOSVGRAST_IMPLEMENTATION -#define NANOSVG_ALL_COLOR_KEYWORDS #include <nanosvg/src/nanosvg.h> #include <nanosvg/src/nanosvgrast.h> diff --git a/src/lib/util/nanosvg.h b/src/lib/util/nanosvg.h new file mode 100644 index 00000000000..49940f0b9be --- /dev/null +++ b/src/lib/util/nanosvg.h @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*************************************************************************** + + nanosvg.h + + NanoSVG helpers. + +***************************************************************************/ +#ifndef MAME_LIB_UTIL_NANOSVG_H +#define MAME_LIB_UTIL_NANOSVG_H + +#include <nanosvg/src/nanosvg.h> +#include <nanosvg/src/nanosvgrast.h> + +#include <memory> + + +namespace util { + +struct nsvg_deleter +{ + void operator()(NSVGimage *ptr) const { nsvgDelete(ptr); } + void operator()(NSVGrasterizer *ptr) const { nsvgDeleteRasterizer(ptr); } +}; + + +using nsvg_image_ptr = std::unique_ptr<NSVGimage, nsvg_deleter>; +using nsvg_rasterizer_ptr = std::unique_ptr<NSVGrasterizer, nsvg_deleter>; + +} // namespace util + +#endif // MAME_LIB_UTIL_NANOSVG_H diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index 6b59436750c..50aeb28c5fe 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles, Vas Crabb /********************************************************************* - png.c + png.cpp PNG reading functions. @@ -16,34 +16,13 @@ #include <algorithm> #include <cassert> -#include <cstdint> -#include <cstring> -#include <cmath> -#include <new> - #include <cmath> #include <cstdlib> +#include <cstring> +#include <new> - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -static const int samples[] = { 1, 0, 3, 1, 2, 0, 4 }; - - - -/*************************************************************************** - INLINE FUNCTIONS -***************************************************************************/ - -static inline int compute_rowbytes(const png_info &pnginfo) -{ - return (pnginfo.width * samples[pnginfo.color_type] * pnginfo.bit_depth + 7) / 8; -} - - +namespace util { /*************************************************************************** GENERAL FUNCTIONS @@ -66,6 +45,12 @@ void png_info::free_data() namespace { +/*************************************************************************** + GLOBAL VARIABLES +***************************************************************************/ + +constexpr int samples[] = { 1, 0, 3, 1, 2, 0, 4 }; + constexpr std::uint8_t PNG_SIGNATURE[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a }; #define MNG_Signature "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A" @@ -101,6 +86,12 @@ constexpr std::uint8_t PNG_PF_Average = 3; constexpr std::uint8_t PNG_PF_Paeth = 4; +/*************************************************************************** + INLINE FUNCTIONS +***************************************************************************/ + +inline int compute_rowbytes(const png_info &pnginfo) { return (pnginfo.width * samples[pnginfo.color_type] * pnginfo.bit_depth + 7) / 8; } + inline uint8_t fetch_8bit(uint8_t const *v) { return *v; } inline uint16_t fetch_16bit(uint8_t const *v) { return big_endianize_int16(*reinterpret_cast<uint16_t const *>(v)); } inline uint32_t fetch_32bit(uint8_t const *v) { return big_endianize_int32(*reinterpret_cast<uint32_t const *>(v)); } @@ -132,11 +123,11 @@ private: { // do some basic checks for unsupported images if (!pnginfo.bit_depth || (ARRAY_LENGTH(samples) <= pnginfo.color_type) || !samples[pnginfo.color_type]) - return PNGERR_UNSUPPORTED_FORMAT; // unknown colour format + return png_error::UNSUPPORTED_FORMAT; // unknown colour format if ((0 != pnginfo.interlace_method) && (1 != pnginfo.interlace_method)) - return PNGERR_UNSUPPORTED_FORMAT; // unknown interlace method + return png_error::UNSUPPORTED_FORMAT; // unknown interlace method if ((3 == pnginfo.color_type) && (!pnginfo.num_palette || !pnginfo.palette)) - return PNGERR_FILE_CORRUPT; // indexed colour with no palette + return png_error::FILE_CORRUPT; // indexed colour with no palette // calculate the offset for each pass of the interlace unsigned const pass_count(get_pass_count()); @@ -146,13 +137,13 @@ private: // allocate memory for the filtered image try { pnginfo.image.reset(new std::uint8_t [pass_offset[pass_count]]); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } // decompress image data - png_error error = PNGERR_NONE; + png_error error = png_error::NONE; error = decompress(idata, pass_offset[pass_count]); std::uint32_t const bpp(get_bytes_per_pixel()); - for (unsigned pass = 0; (pass_count > pass) && (PNGERR_NONE == error); ++pass) + for (unsigned pass = 0; (pass_count > pass) && (png_error::NONE == error); ++pass) { // compute some basic parameters std::pair<std::uint32_t, std::uint32_t> const dimensions(get_pass_dimensions(pass)); @@ -161,7 +152,7 @@ private: // we de-filter in place, stripping the filter bytes off the rows uint8_t *dst(&pnginfo.image[pass_offset[pass]]); uint8_t const *src(dst); - for (std::uint32_t y = 0; (dimensions.second > y) && (PNGERR_NONE == error); ++y) + for (std::uint32_t y = 0; (dimensions.second > y) && (png_error::NONE == error); ++y) { // first byte of each row is the filter type uint8_t const filter(*src++); @@ -172,7 +163,7 @@ private: } // if we errored, free the image data - if (error != PNGERR_NONE) + if (error != png_error::NONE) pnginfo.image.reset(); return error; @@ -182,7 +173,7 @@ private: { // only deflate is permitted if (0 != pnginfo.compression_method) - return PNGERR_DECOMPRESS_ERROR; + return png_error::DECOMPRESS_ERROR; // allocate zlib stream z_stream stream; @@ -195,7 +186,7 @@ private: stream.next_in = Z_NULL; zerr = inflateInit(&stream); if (Z_OK != zerr) - return PNGERR_DECOMPRESS_ERROR; + return png_error::DECOMPRESS_ERROR; // decompress IDAT blocks stream.next_out = pnginfo.image.get(); @@ -217,28 +208,28 @@ private: // it's all good if we got end-of-stream or we have with no data remaining if ((Z_OK == inflateEnd(&stream)) && ((Z_STREAM_END == zerr) || ((Z_OK == zerr) && (idata.end() == it) && !stream.avail_in))) - return PNGERR_NONE; + return png_error::NONE; else - return PNGERR_DECOMPRESS_ERROR; + return png_error::DECOMPRESS_ERROR; } png_error unfilter_row(std::uint8_t type, uint8_t const *src, uint8_t *dst, uint8_t const *dstprev, int bpp, std::uint32_t rowbytes) { if (0 != pnginfo.filter_method) - return PNGERR_UNKNOWN_FILTER; + return png_error::UNKNOWN_FILTER; switch (type) { case PNG_PF_None: // no filter, just copy std::copy_n(src, rowbytes, dst); - return PNGERR_NONE; + return png_error::NONE; case PNG_PF_Sub: // SUB = previous pixel dst = std::copy_n(src, bpp, dst); src += bpp; for (std::uint32_t x = bpp; rowbytes > x; ++x, ++src, ++dst) *dst = *src + dst[-bpp]; - return PNGERR_NONE; + return png_error::NONE; case PNG_PF_Up: // UP = pixel above if (dstprev) @@ -250,7 +241,7 @@ private: { std::copy_n(src, rowbytes, dst); } - return PNGERR_NONE; + return png_error::NONE; case PNG_PF_Average: // AVERAGE = average of pixel above and previous pixel if (dstprev) @@ -267,7 +258,7 @@ private: for (std::uint32_t x = bpp; rowbytes > x; ++x, ++src, ++dst) *dst = *src + (dst[-bpp] >> 1); } - return PNGERR_NONE; + return png_error::NONE; case PNG_PF_Paeth: // PAETH = special filter for (std::uint32_t x = 0; rowbytes > x; ++x, ++src, ++dst) @@ -281,10 +272,10 @@ private: int32_t const dc(std::abs(prediction - pc)); *dst = ((da <= db) && (da <= dc)) ? (*src + pa) : (db <= dc) ? (*src + pb) : (*src + pc); } - return PNGERR_NONE; + return png_error::NONE; default: // unknown filter type - return PNGERR_UNKNOWN_FILTER; + return png_error::UNKNOWN_FILTER; } } @@ -294,7 +285,7 @@ private: { case PNG_CN_IHDR: // image header if (13 > length) - return PNGERR_FILE_CORRUPT; + return png_error::FILE_CORRUPT; pnginfo.width = fetch_32bit(&data[0]); pnginfo.height = fetch_32bit(&data[4]); pnginfo.bit_depth = fetch_8bit(&data[8]); @@ -307,31 +298,31 @@ private: case PNG_CN_PLTE: // palette pnginfo.num_palette = length / 3; if ((length % 3) || ((3 == pnginfo.color_type) && ((1 << pnginfo.bit_depth) < pnginfo.num_palette))) - return PNGERR_FILE_CORRUPT; + return png_error::FILE_CORRUPT; pnginfo.palette = std::move(data); break; case PNG_CN_tRNS: // transparency information if (((0 == pnginfo.color_type) && (2 > length)) || ((2 == pnginfo.color_type) && (6 > length))) - return PNGERR_FILE_CORRUPT; + return png_error::FILE_CORRUPT; pnginfo.num_trans = length; pnginfo.trans = std::move(data); break; case PNG_CN_IDAT: // image data try { idata.emplace_back(length, std::move(data)); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } break; case PNG_CN_gAMA: // gamma if (4 > length) - return PNGERR_FILE_CORRUPT; + return png_error::FILE_CORRUPT; pnginfo.source_gamma = fetch_32bit(data.get()) / 100000.0; break; case PNG_CN_pHYs: // physical information if (9 > length) - return PNGERR_FILE_CORRUPT; + return png_error::FILE_CORRUPT; pnginfo.xres = fetch_32bit(&data[0]); pnginfo.yres = fetch_32bit(&data[4]); pnginfo.resolution_unit = fetch_8bit(&data[8]); @@ -361,17 +352,17 @@ private: } catch (std::bad_alloc const &) { - return PNGERR_OUT_OF_MEMORY; + return png_error::OUT_OF_MEMORY; } break; /* anything else */ default: if ((type & 0x20000000) == 0) - return PNGERR_UNKNOWN_CHUNK; + return png_error::UNKNOWN_CHUNK; break; } - return PNGERR_NONE; + return png_error::NONE; } unsigned get_pass_count() const @@ -413,23 +404,23 @@ private: return ((samples[pnginfo.color_type] * pnginfo.bit_depth) + 7) >> 3; } - static png_error read_chunk(util::core_file &fp, std::unique_ptr<std::uint8_t []> &data, std::uint32_t &type, std::uint32_t &length) + static png_error read_chunk(core_file &fp, std::unique_ptr<std::uint8_t []> &data, std::uint32_t &type, std::uint32_t &length) { std::uint8_t tempbuff[4]; /* fetch the length of this chunk */ if (fp.read(tempbuff, 4) != 4) - return PNGERR_FILE_TRUNCATED; + return png_error::FILE_TRUNCATED; length = fetch_32bit(tempbuff); /* fetch the type of this chunk */ if (fp.read(tempbuff, 4) != 4) - return PNGERR_FILE_TRUNCATED; + return png_error::FILE_TRUNCATED; type = fetch_32bit(tempbuff); /* stop when we hit an IEND chunk */ if (type == PNG_CN_IEND) - return PNGERR_NONE; + return png_error::NONE; /* start the CRC with the chunk type (but not the length) */ std::uint32_t crc = crc32(0, tempbuff, 4); @@ -439,13 +430,13 @@ private: { /* allocate memory for this chunk */ try { data.reset(new std::uint8_t [length]); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } /* read the data from the file */ if (fp.read(data.get(), length) != length) { data.reset(); - return PNGERR_FILE_TRUNCATED; + return png_error::FILE_TRUNCATED; } /* update the CRC */ @@ -456,7 +447,7 @@ private: if (fp.read(tempbuff, 4) != 4) { data.reset(); - return PNGERR_FILE_TRUNCATED; + return png_error::FILE_TRUNCATED; } std::uint32_t const chunk_crc = fetch_32bit(tempbuff); @@ -464,10 +455,10 @@ private: if (crc != chunk_crc) { data.reset(); - return PNGERR_FILE_CORRUPT; + return png_error::FILE_CORRUPT; } - return PNGERR_NONE; + return png_error::NONE; } png_info & pnginfo; @@ -481,13 +472,13 @@ public: { // do some basic checks for unsupported images if ((8 > pnginfo.bit_depth) || (pnginfo.bit_depth % 8)) - return PNGERR_UNSUPPORTED_FORMAT; // only do multiples of 8bps here - expand lower bit depth first + return png_error::UNSUPPORTED_FORMAT; // only do multiples of 8bps here - expand lower bit depth first if ((ARRAY_LENGTH(samples) <= pnginfo.color_type) || !samples[pnginfo.color_type]) - return PNGERR_UNSUPPORTED_FORMAT; // unknown colour sample format + return png_error::UNSUPPORTED_FORMAT; // unknown colour sample format if ((0 != pnginfo.interlace_method) && (1 != pnginfo.interlace_method)) - return PNGERR_UNSUPPORTED_FORMAT; // unknown interlace method + return png_error::UNSUPPORTED_FORMAT; // unknown interlace method if ((3 == pnginfo.color_type) && (8 != pnginfo.bit_depth)) - return PNGERR_UNSUPPORTED_FORMAT; // indexed colour must be exactly 8bpp + return png_error::UNSUPPORTED_FORMAT; // indexed colour must be exactly 8bpp // everything looks sane, allocate the bitmap and deinterlace into it bitmap.allocate(pnginfo.width, pnginfo.height); @@ -519,7 +510,7 @@ public: accumalpha &= alpha; std::uint16_t const paloffs(std::uint16_t(*src) * 3); rgb_t const pix(alpha, pnginfo.palette[paloffs], pnginfo.palette[paloffs + 1], pnginfo.palette[paloffs + 2]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -537,7 +528,7 @@ public: std::uint8_t const a_val((pnginfo.trans && (transpen == i_val)) ? 0x00 : 0xff); i_val >>= samp_shift; accumalpha &= a_val; - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, i_val, i_val, i_val); + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, i_val, i_val, i_val); } } } @@ -552,7 +543,7 @@ public: { accumalpha &= src[a]; rgb_t const pix(src[a], src[i], src[i], src[i]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -578,7 +569,7 @@ public: g_val >>= samp_shift; b_val >>= samp_shift; accumalpha &= a_val; - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, r_val, g_val, b_val); + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, r_val, g_val, b_val); } } } @@ -595,7 +586,7 @@ public: { accumalpha &= src[a]; rgb_t const pix(src[a], src[r], src[g], src[b]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -603,22 +594,22 @@ public: // set hasalpha flag and return hasalpha = 0xffU != accumalpha; - return PNGERR_NONE; + return png_error::NONE; } png_error expand_buffer_8bit() { // nothing to do if we're at 8 or greater already if (pnginfo.bit_depth >= 8) - return PNGERR_NONE; + return png_error::NONE; // do some basic checks for unsupported images if (!pnginfo.bit_depth || (8 % pnginfo.bit_depth)) - return PNGERR_UNSUPPORTED_FORMAT; // bit depth must be a factor of eight + return png_error::UNSUPPORTED_FORMAT; // bit depth must be a factor of eight if ((0 != pnginfo.color_type) && (3 != pnginfo.color_type)) - return PNGERR_UNSUPPORTED_FORMAT; // only upsample monochrome and indexed colour + return png_error::UNSUPPORTED_FORMAT; // only upsample monochrome and indexed colour if ((0 != pnginfo.interlace_method) && (1 != pnginfo.interlace_method)) - return PNGERR_UNSUPPORTED_FORMAT; // unknown interlace method + return png_error::UNSUPPORTED_FORMAT; // unknown interlace method // calculate the offset for each pass of the interlace on the input and output unsigned const pass_count(get_pass_count()); @@ -633,7 +624,7 @@ public: // allocate a new buffer at 8-bit std::unique_ptr<std::uint8_t []> outbuf; try { outbuf.reset(new std::uint8_t [outp_offset[pass_count]]); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } // upsample bitmap std::uint8_t const bytesamples(8 / pnginfo.bit_depth); @@ -687,13 +678,13 @@ public: pnginfo.image = std::move(outbuf); pnginfo.bit_depth = 8; - return PNGERR_NONE; + return png_error::NONE; } - png_error read_file(util::core_file &fp) + png_error read_file(core_file &fp) { // initialize the data structures - png_error error = PNGERR_NONE; + png_error error = png_error::NONE; pnginfo.reset(); std::list<image_data_chunk> idata; @@ -701,13 +692,13 @@ public: error = verify_header(fp); // loop until we hit an IEND chunk - while (PNGERR_NONE == error) + while (png_error::NONE == error) { // read a chunk std::unique_ptr<std::uint8_t []> chunk_data; std::uint32_t chunk_type = 0, chunk_length; error = read_chunk(fp, chunk_data, chunk_type, chunk_length); - if (PNGERR_NONE == error) + if (png_error::NONE == error) { if (chunk_type == PNG_CN_IEND) break; // stop when we hit an IEND chunk @@ -717,29 +708,29 @@ public: } // finish processing the image - if (PNGERR_NONE == error) + if (png_error::NONE == error) error = process(idata); // if we have an error, free all the output data - if (error != PNGERR_NONE) + if (error != png_error::NONE) pnginfo.reset(); return error; } - static png_error verify_header(util::core_file &fp) + static png_error verify_header(core_file &fp) { EQUIVALENT_ARRAY(PNG_SIGNATURE, std::uint8_t) signature; // read 8 bytes if (fp.read(signature, sizeof(signature)) != sizeof(signature)) - return PNGERR_FILE_TRUNCATED; + return png_error::FILE_TRUNCATED; // return an error if we don't match if (std::memcmp(signature, PNG_SIGNATURE, sizeof(PNG_SIGNATURE))) - return PNGERR_BAD_SIGNATURE; + return png_error::BAD_SIGNATURE; - return PNGERR_NONE; + return png_error::NONE; } }; @@ -760,7 +751,7 @@ constexpr unsigned png_private::ADAM7_Y_OFFS[7]; core stream -------------------------------------------------*/ -png_error png_info::verify_header(util::core_file &fp) +png_error png_info::verify_header(core_file &fp) { return png_private::verify_header(fp); } @@ -770,7 +761,7 @@ png_error png_info::verify_header(util::core_file &fp) read_file - read a PNG from a core stream -------------------------------------------------*/ -png_error png_info::read_file(util::core_file &fp) +png_error png_info::read_file(core_file &fp) { return png_private(*this).read_file(fp); } @@ -781,7 +772,7 @@ png_error png_info::read_file(util::core_file &fp) bitmap -------------------------------------------------*/ -png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap) +png_error png_read_bitmap(core_file &fp, bitmap_argb32 &bitmap) { png_error result; png_info pnginfo; @@ -789,12 +780,12 @@ png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap) // read the PNG data result = png.read_file(fp); - if (PNGERR_NONE != result) + if (png_error::NONE != result) return result; // resample to 8bpp if necessary result = png.expand_buffer_8bit(); - if (PNGERR_NONE != result) + if (png_error::NONE != result) { pnginfo.free_data(); return result; @@ -848,13 +839,13 @@ png_error png_info::add_text(const char *keyword, const char *text) char32_t ch; int const len(uchar_from_utf8(&ch, ptr, kwend - ptr)); if ((0 >= len) || (32 > ch) || (255 < ch) || ((126 < ch) && (161 > ch)) || (((32 == prev) || (keyword == ptr)) && (32 == ch))) - return PNGERR_UNSUPPORTED_FORMAT; + return png_error::UNSUPPORTED_FORMAT; prev = ch; ++cnt; ptr += len; } if ((32 == prev) || (1 > cnt) || (79 < cnt)) - return PNGERR_UNSUPPORTED_FORMAT; + return png_error::UNSUPPORTED_FORMAT; // apply rules to text char const *const textend(text + std::strlen(text)); @@ -863,14 +854,14 @@ png_error png_info::add_text(const char *keyword, const char *text) char32_t ch; int const len(uchar_from_utf8(&ch, ptr, textend - ptr)); if ((0 >= len) || (1 > ch) || (255 < ch)) - return PNGERR_UNSUPPORTED_FORMAT; + return png_error::UNSUPPORTED_FORMAT; ptr += len; } // allocate a new text element try { textlist.emplace_back(std::piecewise_construct, std::forward_as_tuple(keyword, kwend), std::forward_as_tuple(text, textend)); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } - return PNGERR_NONE; + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } + return png_error::NONE; } @@ -879,7 +870,7 @@ png_error png_info::add_text(const char *keyword, const char *text) the given file -------------------------------------------------*/ -static png_error write_chunk(util::core_file &fp, const uint8_t *data, uint32_t type, uint32_t length) +static png_error write_chunk(core_file &fp, const uint8_t *data, uint32_t type, uint32_t length) { uint8_t tempbuff[8]; uint32_t crc; @@ -891,22 +882,22 @@ static png_error write_chunk(util::core_file &fp, const uint8_t *data, uint32_t /* write that data */ if (fp.write(tempbuff, 8) != 8) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; /* append the actual data */ if (length > 0) { if (fp.write(data, length) != length) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; crc = crc32(crc, data, length); } /* write the CRC */ put_32bit(tempbuff, crc); if (fp.write(tempbuff, 4) != 4) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; - return PNGERR_NONE; + return png_error::NONE; } @@ -915,7 +906,7 @@ static png_error write_chunk(util::core_file &fp, const uint8_t *data, uint32_t chunk to the given file by deflating it -------------------------------------------------*/ -static png_error write_deflated_chunk(util::core_file &fp, uint8_t *data, uint32_t type, uint32_t length) +static png_error write_deflated_chunk(core_file &fp, uint8_t *data, uint32_t type, uint32_t length) { uint64_t lengthpos = fp.tell(); uint8_t tempbuff[8192]; @@ -931,7 +922,7 @@ static png_error write_deflated_chunk(util::core_file &fp, uint8_t *data, uint32 /* write that data */ if (fp.write(tempbuff, 8) != 8) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; /* initialize the stream */ memset(&stream, 0, sizeof(stream)); @@ -939,7 +930,7 @@ static png_error write_deflated_chunk(util::core_file &fp, uint8_t *data, uint32 stream.avail_in = length; zerr = deflateInit(&stream, Z_DEFAULT_COMPRESSION); if (zerr != Z_OK) - return PNGERR_COMPRESS_ERROR; + return png_error::COMPRESS_ERROR; /* now loop until we run out of data */ for ( ; ; ) @@ -956,7 +947,7 @@ static png_error write_deflated_chunk(util::core_file &fp, uint8_t *data, uint32 if (fp.write(tempbuff, bytes) != bytes) { deflateEnd(&stream); - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; } crc = crc32(crc, tempbuff, bytes); zlength += bytes; @@ -970,29 +961,29 @@ static png_error write_deflated_chunk(util::core_file &fp, uint8_t *data, uint32 if (zerr != Z_OK) { deflateEnd(&stream); - return PNGERR_COMPRESS_ERROR; + return png_error::COMPRESS_ERROR; } } /* clean up deflater(maus) */ zerr = deflateEnd(&stream); if (zerr != Z_OK) - return PNGERR_COMPRESS_ERROR; + return png_error::COMPRESS_ERROR; /* write the CRC */ put_32bit(tempbuff, crc); if (fp.write(tempbuff, 4) != 4) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; /* seek back and update the length */ fp.seek(lengthpos, SEEK_SET); put_32bit(tempbuff + 0, zlength); if (fp.write(tempbuff, 4) != 4) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; /* return to the end */ fp.seek(lengthpos + 8 + zlength + 4, SEEK_SET); - return PNGERR_NONE; + return png_error::NONE; } @@ -1016,7 +1007,7 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap /* allocate memory for the palette */ try { pnginfo.palette.reset(new std::uint8_t [3 * 256]); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } /* build the palette */ std::fill_n(pnginfo.palette.get(), 3 * 256, 0); @@ -1036,13 +1027,13 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap catch (std::bad_alloc const &) { pnginfo.palette.reset(); - return PNGERR_OUT_OF_MEMORY; + return png_error::OUT_OF_MEMORY; } /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo.height; y++) { - auto *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + uint16_t const *src = reinterpret_cast<uint16_t const *>(bitmap.raw_pixptr(y)); uint8_t *dst = &pnginfo.image[y * (rowbytes + 1)]; /* store the filter byte, then copy the data */ @@ -1051,7 +1042,7 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap *dst++ = *src++; } - return PNGERR_NONE; + return png_error::NONE; } @@ -1075,7 +1066,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* allocate memory for the image */ try { pnginfo.image.reset(new std::uint8_t [pnginfo.height * (rowbytes + 1)]); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo.height; y++) @@ -1088,7 +1079,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 16bpp palettized format */ if (bitmap.format() == BITMAP_FORMAT_IND16) { - auto *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + uint16_t const *src16 = reinterpret_cast<uint16_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t color = palette[*src16++]; @@ -1101,7 +1092,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit RGB direct */ else if (bitmap.format() == BITMAP_FORMAT_RGB32) { - auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + uint32_t const *src32 = reinterpret_cast<uint32_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; @@ -1114,7 +1105,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit ARGB direct */ else if (bitmap.format() == BITMAP_FORMAT_ARGB32) { - auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + uint32_t const *src32 = reinterpret_cast<uint32_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; @@ -1127,10 +1118,10 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* unsupported format */ else - return PNGERR_UNSUPPORTED_FORMAT; + return png_error::UNSUPPORTED_FORMAT; } - return PNGERR_NONE; + return png_error::NONE; } @@ -1139,7 +1130,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & chunks to the given file -------------------------------------------------*/ -static png_error write_png_stream(util::core_file &fp, png_info &pnginfo, const bitmap_t &bitmap, int palette_length, const rgb_t *palette) +static png_error write_png_stream(core_file &fp, png_info &pnginfo, const bitmap_t &bitmap, int palette_length, const rgb_t *palette) { uint8_t tempbuff[16]; png_error error; @@ -1149,7 +1140,7 @@ static png_error write_png_stream(util::core_file &fp, png_info &pnginfo, const error = convert_bitmap_to_image_palette(pnginfo, bitmap, palette_length, palette); else error = convert_bitmap_to_image_rgb(pnginfo, bitmap, palette_length, palette); - if (error != PNGERR_NONE) + if (error != png_error::NONE) return error; // if we wanted to get clever and do filtering, we would do it here @@ -1163,18 +1154,18 @@ static png_error write_png_stream(util::core_file &fp, png_info &pnginfo, const put_8bit(tempbuff + 11, pnginfo.filter_method); put_8bit(tempbuff + 12, pnginfo.interlace_method); error = write_chunk(fp, tempbuff, PNG_CN_IHDR, 13); - if (error != PNGERR_NONE) + if (error != png_error::NONE) return error; // write the PLTE chunk if (pnginfo.num_palette > 0) error = write_chunk(fp, pnginfo.palette.get(), PNG_CN_PLTE, pnginfo.num_palette * 3); - if (error != PNGERR_NONE) + if (error != png_error::NONE) return error; - // write a single IDAT chunk */ + // write a single IDAT chunk error = write_deflated_chunk(fp, pnginfo.image.get(), PNG_CN_IDAT, pnginfo.height * (compute_rowbytes(pnginfo) + 1)); - if (error != PNGERR_NONE) + if (error != png_error::NONE) return error; // write TEXT chunks @@ -1182,7 +1173,7 @@ static png_error write_png_stream(util::core_file &fp, png_info &pnginfo, const for (png_info::png_text const &text : pnginfo.textlist) { try { textbuf.resize(text.first.length() + 1 + text.second.length()); } - catch (std::bad_alloc const &) { return PNGERR_OUT_OF_MEMORY; } + catch (std::bad_alloc const &) { return png_error::OUT_OF_MEMORY; } std::uint8_t *dst(&textbuf[0]); // convert keyword to ISO-8859-1 @@ -1213,7 +1204,7 @@ static png_error write_png_stream(util::core_file &fp, png_info &pnginfo, const } error = write_chunk(fp, &textbuf[0], PNG_CN_tEXt, dst - &textbuf[0]); - if (error != PNGERR_NONE) + if (error != png_error::NONE) return error; } @@ -1222,7 +1213,7 @@ static png_error write_png_stream(util::core_file &fp, png_info &pnginfo, const } -png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette) +png_error png_write_bitmap(core_file &fp, png_info *info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette) { // use a dummy pnginfo if none passed to us png_info pnginfo; @@ -1231,7 +1222,7 @@ png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t const & // write the PNG signature if (fp.write(PNG_SIGNATURE, sizeof(PNG_SIGNATURE)) != sizeof(PNG_SIGNATURE)) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; /* write the rest of the PNG data */ return write_png_stream(fp, *info, bitmap, palette_length, palette); @@ -1246,7 +1237,7 @@ png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t const & ********************************************************************************/ /** - * @fn png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, unsigned rate) + * @fn png_error mng_capture_start(core_file &fp, bitmap_t &bitmap, unsigned rate) * * @brief Mng capture start. * @@ -1257,12 +1248,12 @@ png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t const & * @return A png_error. */ -png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, unsigned rate) +png_error mng_capture_start(core_file &fp, bitmap_t &bitmap, unsigned rate) { uint8_t mhdr[28]; if (fp.write(MNG_Signature, 8) != 8) - return PNGERR_FILE_ERROR; + return png_error::FILE_ERROR; memset(mhdr, 0, 28); put_32bit(mhdr + 0, bitmap.width()); @@ -1273,7 +1264,7 @@ png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, unsigned rate } /** - * @fn png_error mng_capture_frame(util::core_file &fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) + * @fn png_error mng_capture_frame(core_file &fp, png_info *info, bitmap_t &bitmap, int palette_length, const rgb_t *palette) * * @brief Mng capture frame. * @@ -1286,13 +1277,13 @@ png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, unsigned rate * @return A png_error. */ -png_error mng_capture_frame(util::core_file &fp, png_info &info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette) +png_error mng_capture_frame(core_file &fp, png_info &info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette) { return write_png_stream(fp, info, bitmap, palette_length, palette); } /** - * @fn png_error mng_capture_stop(util::core_file &fp) + * @fn png_error mng_capture_stop(core_file &fp) * * @brief Mng capture stop. * @@ -1301,7 +1292,9 @@ png_error mng_capture_frame(util::core_file &fp, png_info &info, bitmap_t const * @return A png_error. */ -png_error mng_capture_stop(util::core_file &fp) +png_error mng_capture_stop(core_file &fp) { return write_chunk(fp, nullptr, MNG_CN_MEND, 0); } + +} // namespace util diff --git a/src/lib/util/png.h b/src/lib/util/png.h index 5f852fd8c16..784c92646e6 100644 --- a/src/lib/util/png.h +++ b/src/lib/util/png.h @@ -17,31 +17,33 @@ #include "corefile.h" #include "osdcore.h" +#include <cstdint> #include <list> #include <memory> #include <string> #include <utility> +namespace util { /*************************************************************************** CONSTANTS ***************************************************************************/ /* Error types */ -enum png_error +enum class png_error { - PNGERR_NONE, - PNGERR_OUT_OF_MEMORY, - PNGERR_UNKNOWN_FILTER, - PNGERR_FILE_ERROR, - PNGERR_BAD_SIGNATURE, - PNGERR_DECOMPRESS_ERROR, - PNGERR_FILE_TRUNCATED, - PNGERR_FILE_CORRUPT, - PNGERR_UNKNOWN_CHUNK, - PNGERR_COMPRESS_ERROR, - PNGERR_UNSUPPORTED_FORMAT + NONE, + OUT_OF_MEMORY, + UNKNOWN_FILTER, + FILE_ERROR, + BAD_SIGNATURE, + DECOMPRESS_ERROR, + FILE_TRUNCATED, + FILE_CORRUPT, + UNKNOWN_CHUNK, + COMPRESS_ERROR, + UNSUPPORTED_FORMAT }; @@ -57,7 +59,7 @@ public: ~png_info() { free_data(); } - png_error read_file(util::core_file &fp); + png_error read_file(core_file &fp); png_error copy_to_bitmap(bitmap_argb32 &bitmap, bool &hasalpha); png_error expand_buffer_8bit(); @@ -66,7 +68,7 @@ public: void free_data(); void reset() { free_data(); operator=(png_info()); } - static png_error verify_header(util::core_file &fp); + static png_error verify_header(core_file &fp); std::unique_ptr<std::uint8_t []> image; std::uint32_t width, height; @@ -99,12 +101,14 @@ private: FUNCTION PROTOTYPES ***************************************************************************/ -png_error png_read_bitmap(util::core_file &fp, bitmap_argb32 &bitmap); +png_error png_read_bitmap(core_file &fp, bitmap_argb32 &bitmap); -png_error png_write_bitmap(util::core_file &fp, png_info *info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette); +png_error png_write_bitmap(core_file &fp, png_info *info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette); -png_error mng_capture_start(util::core_file &fp, bitmap_t &bitmap, unsigned rate); -png_error mng_capture_frame(util::core_file &fp, png_info &info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette); -png_error mng_capture_stop(util::core_file &fp); +png_error mng_capture_start(core_file &fp, bitmap_t &bitmap, unsigned rate); +png_error mng_capture_frame(core_file &fp, png_info &info, bitmap_t const &bitmap, int palette_length, const rgb_t *palette); +png_error mng_capture_stop(core_file &fp); + +} // namespace util #endif // MAME_LIB_UTIL_PNG_H diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index a61c20d2e3c..8ee3c33fe26 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -31,7 +31,6 @@ namespace { ***************************************************************************/ constexpr unsigned TEMP_BUFFER_SIZE(4096U); -std::locale const f_portable_locale("C"); /*************************************************************************** @@ -629,7 +628,7 @@ long long data_node::get_attribute_int(const char *attribute, long long defvalue return defvalue; std::istringstream stream; - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); long long result; if (string[0] == '$') { @@ -694,7 +693,7 @@ float data_node::get_attribute_float(const char *attribute, float defvalue) cons return defvalue; std::istringstream stream(string); - stream.imbue(f_portable_locale); + stream.imbue(std::locale::classic()); float result; return (stream >> result) ? result : defvalue; } @@ -732,7 +731,7 @@ void data_node::set_attribute(const char *name, const char *value) void data_node::set_attribute_int(const char *name, long long value) { - set_attribute(name, string_format(f_portable_locale, "%d", value).c_str()); + set_attribute(name, string_format(std::locale::classic(), "%d", value).c_str()); } @@ -743,7 +742,7 @@ void data_node::set_attribute_int(const char *name, long long value) void data_node::set_attribute_float(const char *name, float value) { - set_attribute(name, string_format(f_portable_locale, "%f", value).c_str()); + set_attribute(name, string_format(std::locale::classic(), "%f", value).c_str()); } diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt index a8440e9cd36..a1bed00117f 100644 --- a/src/mame/arcade.flt +++ b/src/mame/arcade.flt @@ -258,6 +258,7 @@ cops.cpp copsnrob.cpp corona.cpp cosmic.cpp +cowtipping.cpp cps1.cpp cps1bl_5205.cpp cps1bl_pic.cpp diff --git a/src/mame/audio/arcadia.cpp b/src/mame/audio/arcadia.cpp index 19adb9fac4e..46c7c9ee64f 100644 --- a/src/mame/audio/arcadia.cpp +++ b/src/mame/audio/arcadia.cpp @@ -59,7 +59,7 @@ arcadia_sound_device::arcadia_sound_device(const machine_config &mconfig, const //------------------------------------------------- void arcadia_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, UVI_PAL*OSAMP); + m_channel = stream_alloc(0, 1, UVI_PAL*OSAMP); m_lfsr = LFSR_INIT; m_tval = 1; logerror("arcadia_sound start\n"); @@ -76,18 +76,18 @@ void arcadia_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void arcadia_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (i = 0; i < samples; i++, buffer++) + for (i = 0; i < buffer.samples(); i++) { - *buffer = 0; + s32 result = 0; //if minimal pitch ? if (m_reg[1]){ @@ -97,17 +97,17 @@ void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stre //tone only case 1: - *buffer = m_volume * m_tval; + result = m_volume * m_tval; break; //noise only case 2: - *buffer = m_volume * m_nval; + result = m_volume * m_nval; break; //tone AND noise (bitwise and) case 3: - *buffer = m_volume * (m_tval & m_nval); + result = m_volume * (m_tval & m_nval); break; } @@ -132,6 +132,7 @@ void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stre m_pos = 0; } } + buffer.put_int(i, result, 32768); } } diff --git a/src/mame/audio/arcadia.h b/src/mame/audio/arcadia.h index de67b71705d..6eb25f9e970 100644 --- a/src/mame/audio/arcadia.h +++ b/src/mame/audio/arcadia.h @@ -21,7 +21,7 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; sound_stream *m_channel; uint8_t m_reg[3]; diff --git a/src/mame/audio/channelf.cpp b/src/mame/audio/channelf.cpp index 5003f28ae3a..ec4971d35df 100644 --- a/src/mame/audio/channelf.cpp +++ b/src/mame/audio/channelf.cpp @@ -30,7 +30,7 @@ void channelf_sound_device::device_start() { int rate; - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); rate = machine().sample_rate(); /* @@ -67,19 +67,18 @@ void channelf_sound_device::device_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void channelf_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint32_t mask = 0, target = 0; - stream_sample_t *buffer = outputs[0]; - stream_sample_t *sample = buffer; + auto &buffer = outputs[0]; switch( m_sound_mode ) { case 0: /* sound off */ - memset(buffer,0,sizeof(*buffer)*samples); + buffer.fill(0); return; case 1: /* high tone (2V) - 1000Hz */ @@ -96,12 +95,12 @@ void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, str break; } - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { if ((m_forced_ontime > 0) || ((m_sample_counter & mask) == target)) // change made for improved sound - *sample++ = m_envelope; + buffer.put_int(sampindex, m_envelope, 32768); else - *sample++ = 0; + buffer.put(sampindex, 0); m_sample_counter += m_incr; m_envelope *= m_decay_mult; if (m_forced_ontime > 0) // added for improved sound diff --git a/src/mame/audio/channelf.h b/src/mame/audio/channelf.h index 36c98aa47ed..ce1231c3951 100644 --- a/src/mame/audio/channelf.h +++ b/src/mame/audio/channelf.h @@ -20,7 +20,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state sound_stream *m_channel; diff --git a/src/mame/audio/cinemat.cpp b/src/mame/audio/cinemat.cpp index 4b9168aa949..3d9cb981888 100644 --- a/src/mame/audio/cinemat.cpp +++ b/src/mame/audio/cinemat.cpp @@ -45,16 +45,17 @@ * *************************************/ -cinemat_audio_device_base::cinemat_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale) - : device_t(mconfig, type, tag, owner, clock) - , m_out_input(*this, "sound_nl:out_%u", 0) - , m_inputs_mask(inputs_mask) - , m_netlist(netlist) - , m_output_scale(output_scale) +cinemat_audio_device_base::cinemat_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale) : + device_t(mconfig, type, tag, owner, clock), + device_mixer_interface(mconfig, *this), + m_out_input(*this, "sound_nl:out_%u", 0), + m_inputs_mask(inputs_mask), + m_netlist(netlist), + m_output_scale(output_scale) { } -void cinemat_audio_device_base::configure_latch_inputs(ls259_device &latch, u8 mask) +cinemat_audio_device_base &cinemat_audio_device_base::configure_latch_inputs(ls259_device &latch, u8 mask) { if (mask == 0) mask = m_inputs_mask; @@ -70,48 +71,34 @@ void cinemat_audio_device_base::configure_latch_inputs(ls259_device &latch, u8 m latch.q_out_cb<4>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<4>))); if (BIT(mask, 7)) latch.q_out_cb<7>().set(write_line_delegate(*this, FUNC(cinemat_audio_device_base::sound_w<7>))); + return *this; } void cinemat_audio_device_base::device_add_mconfig(machine_config &config) { - SPEAKER(config, "mono").front_center(); + NETLIST_SOUND(config, "sound_nl", 48000) + .set_source(m_netlist) + .add_route(ALL_OUTPUTS, *this, 1.0); - if (m_netlist != nullptr) - { - NETLIST_SOUND(config, "sound_nl", 48000) - .set_source(m_netlist) - .add_route(ALL_OUTPUTS, "mono", 1.0); - - if ((m_inputs_mask & 0x01) != 0) - NETLIST_LOGIC_INPUT(config, m_out_input[0], "I_OUT_0.IN", 0); - if ((m_inputs_mask & 0x02) != 0) - NETLIST_LOGIC_INPUT(config, m_out_input[1], "I_OUT_1.IN", 0); - if ((m_inputs_mask & 0x04) != 0) - NETLIST_LOGIC_INPUT(config, m_out_input[2], "I_OUT_2.IN", 0); - if ((m_inputs_mask & 0x08) != 0) - NETLIST_LOGIC_INPUT(config, m_out_input[3], "I_OUT_3.IN", 0); - if ((m_inputs_mask & 0x10) != 0) - NETLIST_LOGIC_INPUT(config, m_out_input[4], "I_OUT_4.IN", 0); - if ((m_inputs_mask & 0x80) != 0) - NETLIST_LOGIC_INPUT(config, m_out_input[7], "I_OUT_7.IN", 0); - - NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(m_output_scale, 0.0); - } -} + if ((m_inputs_mask & 0x01) != 0) + NETLIST_LOGIC_INPUT(config, m_out_input[0], "I_OUT_0.IN", 0); + if ((m_inputs_mask & 0x02) != 0) + NETLIST_LOGIC_INPUT(config, m_out_input[1], "I_OUT_1.IN", 0); + if ((m_inputs_mask & 0x04) != 0) + NETLIST_LOGIC_INPUT(config, m_out_input[2], "I_OUT_2.IN", 0); + if ((m_inputs_mask & 0x08) != 0) + NETLIST_LOGIC_INPUT(config, m_out_input[3], "I_OUT_3.IN", 0); + if ((m_inputs_mask & 0x10) != 0) + NETLIST_LOGIC_INPUT(config, m_out_input[4], "I_OUT_4.IN", 0); + if ((m_inputs_mask & 0x80) != 0) + NETLIST_LOGIC_INPUT(config, m_out_input[7], "I_OUT_7.IN", 0); -void cinemat_audio_device_base::device_start() -{ -#if ENABLE_NETLIST_LOGGING - m_logfile = fopen("cinemat.csv", "w"); -#endif + NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(m_output_scale, 0.0); } -void cinemat_audio_device_base::device_stop() +void cinemat_audio_device_base::device_start() { -#if ENABLE_NETLIST_LOGGING - if (m_logfile != nullptr) - fclose(m_logfile); -#endif + save_item(NAME(m_inputs)); } void cinemat_audio_device_base::input_set(int bit, int state) @@ -119,18 +106,9 @@ void cinemat_audio_device_base::input_set(int bit, int state) u8 oldvals = m_inputs; m_inputs = (m_inputs & ~(1 << bit)) | ((state & 1) << bit); if (oldvals != m_inputs) - { -#if ENABLE_NETLIST_LOGGING - attotime time = machine().scheduler().time(); - for (int bit = 0; bit < 8; bit++) - if (((m_inputs_mask >> bit) & 1) != 0) - if ((((m_inputs ^ oldvals) >> bit) & 1) != 0) - fprintf(m_logfile, "%s,I_OUT_%u.IN,%d\n", time.as_string(), bit, (m_inputs >> bit) & 1); -#endif for (int index = 0; index < 8; index++) if (m_out_input[index] != nullptr) m_out_input[index]->write_line(BIT(m_inputs, index)); - } } diff --git a/src/mame/audio/cinemat.h b/src/mame/audio/cinemat.h index 6859154850d..dd7791668f9 100644 --- a/src/mame/audio/cinemat.h +++ b/src/mame/audio/cinemat.h @@ -9,21 +9,17 @@ #include "machine/netlist.h" #include "netlist/nl_setup.h" -// log to cinemat.csv for nltool playback/analysis -#define ENABLE_NETLIST_LOGGING (0) - -class cinemat_audio_device_base : public device_t +class cinemat_audio_device_base : public device_t, public device_mixer_interface { public: - void configure_latch_inputs(ls259_device &latch, u8 mask = 0); + cinemat_audio_device_base &configure_latch_inputs(ls259_device &latch, u8 mask = 0); protected: cinemat_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale); virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; - virtual void device_stop() override; template<int _Index> DECLARE_WRITE_LINE_MEMBER(sound_w) { input_set(_Index, state); } void input_set(int bit, int state); @@ -35,11 +31,6 @@ private: u8 const m_inputs_mask; void (*const m_netlist)(netlist::nlparse_t &); double const m_output_scale; - -#if ENABLE_NETLIST_LOGGING - FILE *m_logfile = nullptr; -#endif - }; diff --git a/src/mame/audio/cmi01a.cpp b/src/mame/audio/cmi01a.cpp index dbb180c2247..f99eccb71c9 100644 --- a/src/mame/audio/cmi01a.cpp +++ b/src/mame/audio/cmi01a.cpp @@ -132,7 +132,7 @@ void cmi01a_device::device_add_mconfig(machine_config &config) } -void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cmi01a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { if (m_run) { @@ -140,23 +140,21 @@ void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_samp int addr = m_segment_cnt; uint8_t *wave_ptr = &m_wave_ram[m_segment_cnt & 0x3fff]; - stream_sample_t *buf = outputs[0]; + auto &buf = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < buf.samples(); sampindex++) { const uint8_t sample8 = wave_ptr[addr++ & 0x3fff]; - int32_t sample = (int32_t)(int8_t)(sample8 ^ 0x80) * m_env * m_vol_latch; + s32 sample = (int32_t)(int8_t)(sample8 ^ 0x80) * m_env * m_vol_latch; if (m_channel == 5) printf("%08x:%02x:%02x:%02x", (uint32_t)sample, sample8, m_env, m_vol_latch); - *buf++ = (int16_t)(sample >> 8); + buf.put_int(sampindex, (int16_t)(sample >> 8), 32768); } if (m_channel == 5) printf("\n"); m_segment_cnt = (m_segment_cnt & ~mask) | addr; } else - { - memset(outputs[0], 0, samples * sizeof(stream_sample_t)); - } + outputs[0].fill(0); } void cmi01a_device::device_resolve_objects() @@ -175,7 +173,7 @@ void cmi01a_device::device_start() m_zx_timer->adjust(attotime::never); m_eosi_timer->adjust(attotime::never); - m_stream = stream_alloc_legacy(0, 1, 44100); + m_stream = stream_alloc(0, 1, 44100); m_ptm->set_external_clocks(clock() / 8, clock() / 4, clock() / 4); diff --git a/src/mame/audio/cmi01a.h b/src/mame/audio/cmi01a.h index 7e5da0b56a8..743c50e5829 100644 --- a/src/mame/audio/cmi01a.h +++ b/src/mame/audio/cmi01a.h @@ -34,7 +34,7 @@ public: void write(offs_t offset, uint8_t data); uint8_t read(offs_t offset); - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; protected: virtual void device_resolve_objects() override; diff --git a/src/mame/audio/cps3.cpp b/src/mame/audio/cps3.cpp index aa7eb8340f0..bbefabf4d50 100644 --- a/src/mame/audio/cps3.cpp +++ b/src/mame/audio/cps3.cpp @@ -39,7 +39,7 @@ cps3_sound_device::cps3_sound_device(const machine_config &mconfig, const char * void cps3_sound_device::device_start() { /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, clock() / 384); + m_stream = stream_alloc(0, 2, clock() / 384); save_item(NAME(m_key)); for (int i = 0; i < 16; i++) @@ -52,14 +52,14 @@ void cps3_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cps3_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* Clear the buffers */ - memset(outputs[0], 0, samples*sizeof(*outputs[0])); - memset(outputs[1], 0, samples*sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); for (int i = 0; i < 16; i ++) { @@ -103,7 +103,7 @@ void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_ loop -= 0x400000; /* Go through the buffer and add voice contributions */ - for (int j = 0; j < samples; j++) + for (int j = 0; j < outputs[0].samples(); j++) { int32_t sample; @@ -127,8 +127,8 @@ void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_ sample = m_base[BYTE4_XOR_LE(start + pos)]; frac += step; - outputs[0][j] += ((sample * vol_l) >> 8); - outputs[1][j] += ((sample * vol_r) >> 8); + outputs[0].add_int(j, sample * vol_l, 32768 << 8); + outputs[1].add_int(j, sample * vol_r, 32768 << 8); } vptr->pos = pos; diff --git a/src/mame/audio/cps3.h b/src/mame/audio/cps3.h index 4e3fe471c8d..101fa8903ce 100644 --- a/src/mame/audio/cps3.h +++ b/src/mame/audio/cps3.h @@ -46,7 +46,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/mame/audio/dai_snd.cpp b/src/mame/audio/dai_snd.cpp index 37004da5644..52334c699f8 100644 --- a/src/mame/audio/dai_snd.cpp +++ b/src/mame/audio/dai_snd.cpp @@ -33,7 +33,7 @@ dai_sound_device::dai_sound_device(const machine_config &mconfig, const char *ta void dai_sound_device::device_start() { - m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); } //------------------------------------------------- @@ -115,27 +115,27 @@ WRITE_LINE_MEMBER(dai_sound_device::set_input_ch2) } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void dai_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void dai_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *sample_left = outputs[0]; - stream_sample_t *sample_right = outputs[1]; + auto &sample_left = outputs[0]; + auto &sample_right = outputs[1]; int16_t channel_0_signal = m_dai_input[0] ? s_osc_volume_table[m_osc_volume[0]] : -s_osc_volume_table[m_osc_volume[0]]; int16_t channel_1_signal = m_dai_input[1] ? s_osc_volume_table[m_osc_volume[1]] : -s_osc_volume_table[m_osc_volume[1]]; int16_t channel_2_signal = m_dai_input[2] ? s_osc_volume_table[m_osc_volume[2]] : -s_osc_volume_table[m_osc_volume[2]]; - while (samples--) + for (int sampindex = 0; sampindex < sample_left.samples(); sampindex++) { int16_t noise = machine().rand()&0x01 ? s_noise_volume_table[m_noise_volume] : -s_noise_volume_table[m_noise_volume]; /* channel 0 + channel 1 + noise */ - *sample_left++ = channel_0_signal + channel_1_signal + noise; + sample_left.put_int(sampindex, channel_0_signal + channel_1_signal + noise, 32768); /* channel 1 + channel 2 + noise */ - *sample_right++ = channel_1_signal + channel_2_signal + noise; + sample_right.put_int(sampindex, channel_1_signal + channel_2_signal + noise, 32768); } } diff --git a/src/mame/audio/dai_snd.h b/src/mame/audio/dai_snd.h index cea0e1c6c71..f34bed0199d 100644 --- a/src/mame/audio/dai_snd.h +++ b/src/mame/audio/dai_snd.h @@ -27,7 +27,7 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream * m_mixer_channel; diff --git a/src/mame/audio/dsbz80.cpp b/src/mame/audio/dsbz80.cpp index 7643face54b..ad7f25bbfcd 100644 --- a/src/mame/audio/dsbz80.cpp +++ b/src/mame/audio/dsbz80.cpp @@ -85,7 +85,7 @@ void dsbz80_device::device_start() m_rxd_handler.resolve_safe(); uint8_t *rom_base = machine().root_device().memregion("mpeg")->base(); decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0); - stream_alloc_legacy(0, 2, 32000); + stream_alloc(0, 2, 32000); } //------------------------------------------------- @@ -232,11 +232,13 @@ void dsbz80_device::mpeg_stereo_w(uint8_t data) mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels } -void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *out_l = outputs[0]; - stream_sample_t *out_r = outputs[1]; + auto &out_l = outputs[0]; + auto &out_r = outputs[1]; + int samples = out_l.samples(); + int sampindex = 0; for(;;) { while(samples && audio_pos < audio_avail) @@ -244,18 +246,21 @@ void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_samp switch (mp_pan) { case 0: // stereo - *out_l++ = audio_buf[audio_pos*2]; - *out_r++ = audio_buf[audio_pos*2+1]; + out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); + out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); + sampindex++; break; case 1: // left only - *out_l++ = audio_buf[audio_pos*2]; - *out_r++ = audio_buf[audio_pos*2]; + out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); + out_r.put_int(sampindex, audio_buf[audio_pos*2], 32768); + sampindex++; break; case 2: // right only - *out_l++ = audio_buf[audio_pos*2+1]; - *out_r++ = audio_buf[audio_pos*2+1]; + out_l.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); + out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); + sampindex++; break; } audio_pos++; @@ -269,11 +274,8 @@ void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_samp if(mp_state == 0) { - for(int i=0; i != samples; i++) - { - *out_l++ = 0; - *out_r++ = 0; - } + out_l.fill(0, sampindex); + out_r.fill(0, sampindex); break; } diff --git a/src/mame/audio/dsbz80.h b/src/mame/audio/dsbz80.h index 92e0c4f3f2f..6f135454524 100644 --- a/src/mame/audio/dsbz80.h +++ b/src/mame/audio/dsbz80.h @@ -37,7 +37,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: mpeg_audio *decoder; diff --git a/src/mame/audio/elan_eu3a05.cpp b/src/mame/audio/elan_eu3a05.cpp index 39ab90a08fb..1922ee3b1da 100644 --- a/src/mame/audio/elan_eu3a05.cpp +++ b/src/mame/audio/elan_eu3a05.cpp @@ -54,7 +54,7 @@ void elan_eu3a05_sound_device::map(address_map &map) void elan_eu3a05_sound_device::device_start() { m_space_read_cb.resolve_safe(0); - m_stream = stream_alloc_legacy(0, 1, 8000); + m_stream = stream_alloc(0, 1, 8000); m_sound_end_cb.resolve_all_safe(); @@ -92,18 +92,19 @@ void elan_eu3a05_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // reset the output stream - memset(outputs[0], 0, samples * sizeof(*outputs[0])); + outputs[0].fill(0); int volume = m_volumes[0] | (m_volumes[1] << 8); int outpos = 0; // loop while we still have samples to generate + int samples = outputs[0].samples(); while (samples-- != 0) { int total = 0; @@ -142,7 +143,7 @@ void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream, //LOGMASKED( LOG_AUDIO, "m_isstopped %02x channel %d is NOT active %08x %06x\n", m_isstopped, channel, m_sound_byte_address[channel], m_sound_current_nib_pos[channel]); } } - outputs[0][outpos] = total / 6; + outputs[0].put_int(outpos, total, 32768 * 6); outpos++; } } diff --git a/src/mame/audio/elan_eu3a05.h b/src/mame/audio/elan_eu3a05.h index c9ef2e83ab3..692d685cf64 100644 --- a/src/mame/audio/elan_eu3a05.h +++ b/src/mame/audio/elan_eu3a05.h @@ -30,7 +30,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual space_config_vector memory_space_config() const override; const address_space_config m_space_config; diff --git a/src/mame/audio/exidy.cpp b/src/mame/audio/exidy.cpp index 8220c3e1af7..6c107bf15fe 100644 --- a/src/mame/audio/exidy.cpp +++ b/src/mame/audio/exidy.cpp @@ -180,7 +180,7 @@ void exidy_sound_device::common_sh_start() m_sh6840_clocks_per_sample = (int)(SH6840_CLOCK.dvalue() / (double)sample_rate * (double)(1 << 24)); /* allocate the stream */ - m_stream = stream_alloc_legacy(0, 1, sample_rate); + m_stream = stream_alloc(0, 1, sample_rate); sh6840_register_state_globals(); } @@ -196,6 +196,8 @@ exidy_sh8253_sound_device::exidy_sh8253_sound_device(const machine_config &mconf : exidy_sound_device(mconfig, type, tag, owner, clock), m_riot(*this, "riot"), m_cvsd(*this, "cvsd"), + m_cvsd_filter(*this, "cvsd_filter"), + m_cvsd_filter2(*this, "cvsd_filter2"), m_cvsdcpu(*this, "cvsdcpu"), m_tms(*this, "tms"), m_pia(*this, "pia") @@ -239,23 +241,23 @@ void exidy_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void exidy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { sh6840_timer_channel *sh6840_timer = m_sh6840_timer; /* hack to skip the expensive lfsr noise generation unless at least one of the 3 channels actually depends on it being generated */ int noisy = ((sh6840_timer[0].cr & sh6840_timer[1].cr & sh6840_timer[2].cr & 0x02) == 0); - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* loop over samples */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { sh6840_timer_channel *t; int clocks; - stream_sample_t sample = 0; + s32 sample = 0; /* determine how many 6840 clocks this sample */ m_sh6840_clock_count += m_sh6840_clocks_per_sample; @@ -310,19 +312,19 @@ void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream sample += generate_music_sample(); /* stash */ - *buffer++ = sample; + buffer.put_int(sampindex, sample, 32768); } } -stream_sample_t exidy_sound_device::generate_music_sample() +s32 exidy_sound_device::generate_music_sample() { return 0; } -stream_sample_t exidy_sh8253_sound_device::generate_music_sample() +s32 exidy_sh8253_sound_device::generate_music_sample() { sh8253_timer_channel *c; - stream_sample_t sample = 0; + s32 sample = 0; /* music channel 0 */ c = &m_sh8253_timer[0]; @@ -788,9 +790,33 @@ DEFINE_DEVICE_TYPE(EXIDY_MTRAP, mtrap_sound_device, "mtrap_sound", "Exidy SFX+PS mtrap_sound_device::mtrap_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : venture_sound_device(mconfig, EXIDY_MTRAP, tag, owner, clock) + , m_cvsd_timer(*this,"cvsd_timer") + , m_cvsd_clk(false) { } +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mtrap_sound_device::device_start() +{ + common_sh_start(); + + /* 8253 */ + m_freq_to_step = (1 << 24) / SH8253_CLOCK; + + sh8253_register_state_globals(); + + save_item(NAME(m_cvsd_clk)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(mtrap_sound_device::cvsd_timer) +{ + m_cvsd_clk = !m_cvsd_clk; + m_cvsd->clock_w(m_cvsd_clk); +} + void mtrap_sound_device::voiceio_w(offs_t offset, uint8_t data) { if (!(offset & 0x10)) @@ -803,19 +829,24 @@ void mtrap_sound_device::voiceio_w(offs_t offset, uint8_t data) uint8_t mtrap_sound_device::voiceio_r(offs_t offset) { + uint8_t retval = 0xff; // this should probably be open bus if (!(offset & 0x80)) { + retval &= 0xf0; uint8_t porta = m_riot->porta_out_get(); uint8_t data = (porta & 0x06) >> 1; data |= (porta & 0x01) << 2; data |= (porta & 0x08); - return data; + retval |= data; } if (!(offset & 0x40)) - return m_cvsd->clock_state_r() << 7; + { + retval &= 0x7f; + retval |= (m_cvsd_clk << 7); + } - return 0; + return retval; } @@ -841,8 +872,15 @@ void mtrap_sound_device::device_add_mconfig(machine_config &config) m_cvsdcpu->set_addrmap(AS_PROGRAM, &mtrap_sound_device::cvsd_map); m_cvsdcpu->set_addrmap(AS_IO, &mtrap_sound_device::cvsd_iomap); + TIMER(config, m_cvsd_timer).configure_periodic(FUNC(mtrap_sound_device::cvsd_timer), attotime::from_hz(CVSD_CLOCK*2.0)); // this is a 555 timer with 53% duty cycle, within margin of error of 50% duty cycle; the handler clocks on both clock edges, hence * 2.0 + /* audio hardware */ - MC3417(config, m_cvsd, CVSD_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.80); + FILTER_BIQUAD(config, m_cvsd_filter2).opamp_mfb_lowpass_setup(RES_K(10), RES_K(3.9), RES_K(18), CAP_N(20), CAP_N(2.2)); + m_cvsd_filter2->add_route(ALL_OUTPUTS, "mono", 1.0); + FILTER_BIQUAD(config, m_cvsd_filter).opamp_mfb_lowpass_setup(RES_K(10), RES_K(3.9), RES_K(18), CAP_N(20), CAP_N(2.2)); + m_cvsd_filter->add_route(ALL_OUTPUTS, m_cvsd_filter2, 1.0); + MC3417(config, m_cvsd, 0).add_route(ALL_OUTPUTS, m_cvsd_filter, 0.3086); // each filter has gain of 1.8 for total gain of 3.24, 0.3086 cancels this out. was 0.8 + } diff --git a/src/mame/audio/exidy.h b/src/mame/audio/exidy.h index 86ed7b145cd..8e3ee42916a 100644 --- a/src/mame/audio/exidy.h +++ b/src/mame/audio/exidy.h @@ -7,6 +7,8 @@ #include "machine/6532riot.h" #include "machine/6821pia.h" +#include "machine/timer.h" +#include "sound/flt_biquad.h" #include "sound/hc55516.h" #include "sound/tms5220.h" @@ -54,8 +56,8 @@ protected: void sh6840_register_state_globals(); // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - virtual stream_sample_t generate_music_sample(); + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + virtual s32 generate_music_sample(); static inline void sh6840_apply_clock(sh6840_timer_channel *t, int clocks); @@ -102,7 +104,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual stream_sample_t generate_music_sample() override; + virtual s32 generate_music_sample() override; void r6532_porta_w(uint8_t data); uint8_t r6532_porta_r(); @@ -120,7 +122,9 @@ protected: required_device<riot6532_device> m_riot; /* 5220/CVSD variables */ - optional_device<hc55516_device> m_cvsd; + optional_device<mc3417_device> m_cvsd; + optional_device<filter_biquad_device> m_cvsd_filter; + optional_device<filter_biquad_device> m_cvsd_filter2; optional_device<cpu_device> m_cvsdcpu; optional_device<tms5220_device> m_tms; required_device<pia6821_device> m_pia; @@ -177,11 +181,15 @@ public: protected: // device-level overrides + virtual void device_start() override; virtual void device_add_mconfig(machine_config &config) override; private: + required_device<timer_device> m_cvsd_timer; + TIMER_DEVICE_CALLBACK_MEMBER(cvsd_timer); void voiceio_w(offs_t offset, uint8_t data); uint8_t voiceio_r(offs_t offset); + bool m_cvsd_clk; void cvsd_map(address_map &map); void cvsd_iomap(address_map &map); diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp index a4ca2d10339..a5a40cae628 100644 --- a/src/mame/audio/exidy440.cpp +++ b/src/mame/audio/exidy440.cpp @@ -74,8 +74,6 @@ exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, cons m_samples(*this, "samples"), m_sound_command(0), m_sound_command_ack(0), - m_mixer_buffer_left(nullptr), - m_mixer_buffer_right(nullptr), m_sound_cache(nullptr), m_sound_cache_end(nullptr), m_sound_cache_max(nullptr), @@ -146,7 +144,7 @@ void exidy440_sound_device::device_start() m_channel_frequency[3] = clock()/2; /* get stream channels */ - m_stream = stream_alloc_legacy(0, 2, clock()); + m_stream = stream_alloc(0, 2, clock()); /* allocate the sample cache */ length = m_samples.bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); @@ -157,8 +155,8 @@ void exidy440_sound_device::device_start() reset_sound_cache(); /* allocate the mixer buffer */ - m_mixer_buffer_left = make_unique_clear<int32_t[]>(clock()); - m_mixer_buffer_right = make_unique_clear<int32_t[]>(clock()); + m_mixer_buffer_left.resize(clock()/50); + m_mixer_buffer_right.resize(clock()/50); if (SOUND_LOG) m_debuglog = fopen("sound.log", "w"); @@ -224,24 +222,15 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam * *************************************/ -void exidy440_sound_device::mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right) +void exidy440_sound_device::mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right) { - int32_t *mixer_left = m_mixer_buffer_left.get(); - int32_t *mixer_right = m_mixer_buffer_right.get(); - int i, clippers = 0; + int32_t *mixer_left = &m_mixer_buffer_left[0]; + int32_t *mixer_right = &m_mixer_buffer_right[0]; - for (i = 0; i < length; i++) + for (int i = 0; i < dest_left.samples(); i++) { - int32_t sample_left = *mixer_left++; - int32_t sample_right = *mixer_right++; - - if (sample_left < -32768) { sample_left = -32768; clippers++; } - else if (sample_left > 32767) { sample_left = 32767; clippers++; } - if (sample_right < -32768) { sample_right = -32768; clippers++; } - else if (sample_right > 32767) { sample_right = 32767; clippers++; } - - *dest_left++ = sample_left; - *dest_right++ = sample_right; + dest_left.put_int_clamp(i, *mixer_left++, 32768); + dest_right.put_int_clamp(i, *mixer_right++, 32768); } } @@ -836,22 +825,22 @@ void exidy440_sound_device::sound_banks_w(offs_t offset, uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void exidy440_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int ch; /* reset the mixer buffers */ - memset(m_mixer_buffer_left.get(), 0, samples * sizeof(int32_t)); - memset(m_mixer_buffer_right.get(), 0, samples * sizeof(int32_t)); + std::fill_n(&m_mixer_buffer_left[0], outputs[0].samples(), 0); + std::fill_n(&m_mixer_buffer_right[0], outputs[0].samples(), 0); /* loop over channels */ for (ch = 0; ch < 4; ch++) { sound_channel_data *channel = &m_sound_channel[ch]; - int length, volume, left = samples; + int length, volume, left = outputs[0].samples(); int effective_offset; /* if we're not active, bail */ @@ -864,12 +853,12 @@ void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, str /* get a pointer to the sample data and copy to the left */ volume = m_sound_volume[2 * ch + 0]; if (volume) - add_and_scale_samples(ch, m_mixer_buffer_left.get(), length, volume); + add_and_scale_samples(ch, &m_mixer_buffer_left[0], length, volume); /* get a pointer to the sample data and copy to the left */ volume = m_sound_volume[2 * ch + 1]; if (volume) - add_and_scale_samples(ch, m_mixer_buffer_right.get(), length, volume); + add_and_scale_samples(ch, &m_mixer_buffer_right[0], length, volume); /* update our counters */ channel->offset += length; @@ -889,5 +878,5 @@ void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, str } /* all done, time to mix it */ - mix_to_16(samples, outputs[0], outputs[1]); + mix_to_16(outputs[0], outputs[1]); } diff --git a/src/mame/audio/exidy440.h b/src/mame/audio/exidy440.h index 9f8861bdfe3..e3920be90a2 100644 --- a/src/mame/audio/exidy440.h +++ b/src/mame/audio/exidy440.h @@ -29,7 +29,7 @@ protected: virtual void device_stop() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void exidy440_audio_map(address_map &map); @@ -76,8 +76,8 @@ private: uint8_t m_sound_banks[4]; //uint8_t m_m6844_data[0x20]; uint8_t m_sound_volume[0x10]; - std::unique_ptr<int32_t[]> m_mixer_buffer_left; - std::unique_ptr<int32_t[]> m_mixer_buffer_right; + std::vector<int32_t> m_mixer_buffer_left; + std::vector<int32_t> m_mixer_buffer_right; sound_cache_entry *m_sound_cache; sound_cache_entry *m_sound_cache_end; sound_cache_entry *m_sound_cache_max; @@ -111,7 +111,7 @@ private: void fir_filter(int32_t *input, int16_t *output, int count); void add_and_scale_samples(int ch, int32_t *dest, int samples, int volume); - void mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right); + void mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right); uint8_t sound_command_r(); uint8_t sound_volume_r(offs_t offset); diff --git a/src/mame/audio/flower.cpp b/src/mame/audio/flower.cpp index 4ade0d864a9..99806a0c6b6 100644 --- a/src/mame/audio/flower.cpp +++ b/src/mame/audio/flower.cpp @@ -48,9 +48,7 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch device_memory_interface(mconfig, *this), m_io_space_config("io", ENDIANNESS_LITTLE, 8, 7, 0, address_map_constructor(FUNC(flower_sound_device::regs_map), this)), m_stream(nullptr), - m_mixer_table(nullptr), m_mixer_lookup(nullptr), - m_mixer_buffer(nullptr), m_last_channel(nullptr) { } @@ -63,9 +61,9 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch void flower_sound_device::device_start() { m_iospace = &space(AS_IO); - m_stream = stream_alloc_legacy(0, 1, clock()/2); + m_stream = stream_alloc(0, 1, clock()/2); - m_mixer_buffer = make_unique_clear<short[]>(clock()/2); + m_mixer_buffer.resize(clock()/50); make_mixer_table(MAX_VOICES, defgain); m_last_channel = m_channel_list + MAX_VOICES; @@ -94,10 +92,10 @@ void flower_sound_device::device_start() void flower_sound_device::make_mixer_table(int voices, int gain) { /* allocate memory */ - m_mixer_table = make_unique_clear<int16_t[]>(256 * voices); + m_mixer_table.resize(256 * voices); /* find the middle of the table */ - m_mixer_lookup = m_mixer_table.get() + (128 * voices); + m_mixer_lookup = &m_mixer_table[128 * voices]; /* fill in the table - 16 bit case */ for (int i = 0; i < voices * 128; i++) @@ -127,13 +125,13 @@ void flower_sound_device::device_reset() } } -void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; short *mix; uint8_t raw_sample; - memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); for (fl_sound_channel *voice = m_channel_list; voice < m_last_channel; voice++) { @@ -143,9 +141,9 @@ void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, strea if (voice->enable == false) continue; - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; - for (int i = 0; i < samples; i++) + for (int i = 0; i < buffer.samples(); i++) { if (voice->repeat == true) { @@ -174,9 +172,9 @@ void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } /* mix it down */ - mix = m_mixer_buffer.get(); - for (int i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; + mix = &m_mixer_buffer[0]; + for (int i = 0; i < buffer.samples(); i++) + buffer.put_int(i, m_mixer_lookup[*mix++], 32768); } //------------------------------------------------- diff --git a/src/mame/audio/flower.h b/src/mame/audio/flower.h index 8fad33679c6..44787c6f30d 100644 --- a/src/mame/audio/flower.h +++ b/src/mame/audio/flower.h @@ -39,7 +39,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual space_config_vector memory_space_config() const override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; address_space *m_iospace; private: @@ -50,9 +50,9 @@ private: static constexpr unsigned MAX_VOICES = 8; static constexpr int defgain = 48; - std::unique_ptr<int16_t[]> m_mixer_table; + std::vector<int16_t> m_mixer_table; int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; + std::vector<short> m_mixer_buffer; struct fl_sound_channel { diff --git a/src/mame/audio/geebee.cpp b/src/mame/audio/geebee.cpp index 63859916d7c..01858b5ecad 100644 --- a/src/mame/audio/geebee.cpp +++ b/src/mame/audio/geebee.cpp @@ -42,7 +42,7 @@ void geebee_sound_device::device_start() m_decay[0x7fff - i] = (int16_t) (0x7fff/exp(1.0*i/4096)); /* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */ - m_channel = stream_alloc_legacy(0, 1, clock() / 3 / 2 / 384); + m_channel = stream_alloc(0, 1, clock() / 3 / 2 / 384); m_vcount = 0; m_volume_timer = timer_alloc(TIMER_VOLUME_DECAY); @@ -103,16 +103,16 @@ void geebee_sound_device::sound_w(u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void geebee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) - { - stream_sample_t *buffer = outputs[0]; +void geebee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + auto &buffer = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer++ = m_sound_signal; + buffer.put_int(sampindex, m_sound_signal, 32768); /* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */ { m_vcount++; diff --git a/src/mame/audio/geebee.h b/src/mame/audio/geebee.h index 1cca0fc6dd0..1bbddf36bba 100644 --- a/src/mame/audio/geebee.h +++ b/src/mame/audio/geebee.h @@ -22,7 +22,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/audio/gomoku.cpp b/src/mame/audio/gomoku.cpp index 6aeb288f6db..632b016441e 100644 --- a/src/mame/audio/gomoku.cpp +++ b/src/mame/audio/gomoku.cpp @@ -11,8 +11,6 @@ #include "emu.h" #include "audio/gomoku.h" -constexpr int DEFGAIN = 48; - // device type definition DEFINE_DEVICE_TYPE(GOMOKU_SOUND, gomoku_sound_device, "gomoku_sound", "Gomoku Narabe Renju Custom Sound") @@ -32,10 +30,6 @@ gomoku_sound_device::gomoku_sound_device(const machine_config &mconfig, const ch , m_sound_rom(*this, DEVICE_SELF) , m_sound_enable(0) , m_stream(nullptr) - , m_mixer_table(nullptr) - , m_mixer_lookup(nullptr) - , m_mixer_buffer(nullptr) - , m_mixer_buffer_2(nullptr) { std::fill(std::begin(m_soundregs1), std::end(m_soundregs1), 0); std::fill(std::begin(m_soundregs2), std::end(m_soundregs2), 0); @@ -52,14 +46,10 @@ void gomoku_sound_device::device_start() int ch; // get stream channels - m_stream = stream_alloc_legacy(0, 1, clock()); - - // allocate a pair of buffers to mix into - 1 second's worth should be more than enough - m_mixer_buffer = std::make_unique<short[]>(2 * clock()); - m_mixer_buffer_2 = m_mixer_buffer.get() + clock(); // this is never used? + m_stream = stream_alloc(0, 1, clock()); - // build the mixer table - make_mixer_table(8, DEFGAIN); + // allocate a buffer to mix into - 1 second's worth should be more than enough + m_mixer_buffer.resize(clock()/50); // start with sound enabled, many games don't have a sound enable register m_sound_enable = 1; @@ -76,7 +66,6 @@ void gomoku_sound_device::device_start() save_item(NAME(m_soundregs1)); save_item(NAME(m_soundregs2)); - save_pointer(NAME(m_mixer_buffer), 2 * clock()); // save_item(NAME(m_sound_enable)); // set to 1 at device start and never updated? save_item(STRUCT_MEMBER(m_channel_list, channel)); save_item(STRUCT_MEMBER(m_channel_list, frequency)); @@ -87,12 +76,12 @@ void gomoku_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update in mono +// sound_stream_update - handle a stream update in mono //------------------------------------------------- -void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gomoku_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; sound_channel *voice; short *mix; int ch; @@ -100,12 +89,12 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea // if no sound, we're done if (m_sound_enable == 0) { - memset(buffer, 0, samples * sizeof(*buffer)); + buffer.fill(0); return; } // zap the contents of the mixer buffer - memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); // loop over each voice and add its contribution for (ch = 0, voice = std::begin(m_channel_list); voice < std::end(m_channel_list); ch++, voice++) @@ -124,10 +113,10 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea else w_base = 0x100 * (m_soundregs2[0x1d] & 0x0f); - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; // add our contribution - for (int i = 0; i < samples; i++) + for (int i = 0; i < buffer.samples(); i++) { c += f; @@ -167,31 +156,9 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } // mix it down - mix = m_mixer_buffer.get(); - for (int i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; -} - - -// build a table to divide by the number of voices; gain is specified as gain*16 -void gomoku_sound_device::make_mixer_table(int voices, int gain) -{ - int count = voices * 128; - - // allocate memory - m_mixer_table = std::make_unique<int16_t[]>(256 * voices); - - // find the middle of the table - m_mixer_lookup = m_mixer_table.get() + (128 * voices); - - // fill in the table - 16 bit case - for (int i = 0; i < count; i++) - { - int val = i * gain * 16 / voices; - if (val > 32767) val = 32767; - m_mixer_lookup[ i] = val; - m_mixer_lookup[-i] = -val; - } + mix = &m_mixer_buffer[0]; + for (int i = 0; i < buffer.samples(); i++) + buffer.put_int(i, *mix++, 128 * MAX_VOICES); } diff --git a/src/mame/audio/gomoku.h b/src/mame/audio/gomoku.h index 75de8a2c09c..0c077de96bd 100644 --- a/src/mame/audio/gomoku.h +++ b/src/mame/audio/gomoku.h @@ -23,7 +23,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void make_mixer_table(int voices, int gain); @@ -52,10 +52,7 @@ private: sound_stream *m_stream; // mixer tables and internal buffers - std::unique_ptr<int16_t[]> m_mixer_table; - int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; - short *m_mixer_buffer_2; + std::vector<short> m_mixer_buffer; uint8_t m_soundregs1[0x20]; uint8_t m_soundregs2[0x20]; diff --git a/src/mame/audio/gottlieb.cpp b/src/mame/audio/gottlieb.cpp index db7d34b0ccc..69dbeb41a1d 100644 --- a/src/mame/audio/gottlieb.cpp +++ b/src/mame/audio/gottlieb.cpp @@ -379,7 +379,7 @@ void gottlieb_sound_r1_with_votrax_device::speech_clock_dac_w(uint8_t data) logerror("clock = %02X\n", data); // totally random guesswork; would like to get real measurements on a board - m_votrax->set_unscaled_clock(900000 + (data - 0xa0) * 9000); + m_votrax->set_unscaled_clock(950000 + (data - 0xa0) * 5500); m_last_speech_clock = data; } } diff --git a/src/mame/audio/gridlee.cpp b/src/mame/audio/gridlee.cpp index 429518b39d0..2f6904c4efc 100644 --- a/src/mame/audio/gridlee.cpp +++ b/src/mame/audio/gridlee.cpp @@ -43,26 +43,26 @@ gridlee_sound_device::gridlee_sound_device(const machine_config &mconfig, const void gridlee_sound_device::device_start() { /* allocate the stream */ - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate(); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void gridlee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gridlee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* loop over samples */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { /* tone channel */ m_tone_fraction += m_tone_step; - *buffer++ = (m_tone_fraction & 0x0800000) ? (m_tone_volume << 6) : 0; + buffer.put_int(sampindex, (m_tone_fraction & 0x0800000) ? m_tone_volume : 0, 32768 >> 6); } } diff --git a/src/mame/audio/hyprolyb.cpp b/src/mame/audio/hyprolyb.cpp index 77ff8034ae5..c97d5612d03 100644 --- a/src/mame/audio/hyprolyb.cpp +++ b/src/mame/audio/hyprolyb.cpp @@ -8,7 +8,6 @@ DEFINE_DEVICE_TYPE(HYPROLYB_ADPCM, hyprolyb_adpcm_device, "hyprolyb_adpcm", "Hyp hyprolyb_adpcm_device::hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HYPROLYB_ADPCM, tag, owner, clock) - , device_sound_interface(mconfig, *this) , m_audiocpu(*this, ":audiocpu") , m_soundlatch2(*this, ":soundlatch2") , m_msm(*this, ":msm") @@ -80,13 +79,3 @@ void hyprolyb_adpcm_device::vck_callback( int st ) { m_vck_ready = 0x80; } - -//------------------------------------------------- -// sound_stream_update_legacy - handle a stream update -//------------------------------------------------- - -void hyprolyb_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - // should never get here - fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n"); -} diff --git a/src/mame/audio/hyprolyb.h b/src/mame/audio/hyprolyb.h index ac2687b40e4..5d9ce541551 100644 --- a/src/mame/audio/hyprolyb.h +++ b/src/mame/audio/hyprolyb.h @@ -8,7 +8,7 @@ #include "machine/gen_latch.h" #include "sound/msm5205.h" -class hyprolyb_adpcm_device : public device_t, public device_sound_interface +class hyprolyb_adpcm_device : public device_t { public: hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -27,9 +27,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - private: // internal state required_device<cpu_device> m_audiocpu; diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp index 40369d86d1d..d839a4c1704 100644 --- a/src/mame/audio/lynx.cpp +++ b/src/mame/audio/lynx.cpp @@ -172,7 +172,7 @@ void lynx_sound_device::init() void lynx_sound_device::device_start() { - m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 1, machine().sample_rate()); m_usec_per_sample = 1000000 / machine().sample_rate(); m_timer_delegate.resolve(); init(); @@ -182,7 +182,7 @@ void lynx_sound_device::device_start() void lynx2_sound_device::device_start() { - m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); m_usec_per_sample = 1000000 / machine().sample_rate(); m_timer_delegate.resolve(); init(); @@ -467,39 +467,41 @@ void lynx_sound_device::write(offs_t offset, uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void lynx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void lynx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int v; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (int i = 0; i < samples; i++, buffer++) + for (int i = 0; i < buffer.samples(); i++) { - *buffer = 0; + s32 result = 0; for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) { execute(channel); v = m_audio[channel].reg.output; - *buffer += v * 15; // where does the *15 come from? + result += v * 15; // where does the *15 come from? } + buffer.put_int(i, result, 32768); } } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void lynx2_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left=outputs[0], *right=outputs[1]; + auto &left=outputs[0]; + auto &right=outputs[1]; int v; - for (int i = 0; i < samples; i++, left++, right++) + for (int i = 0; i < left.samples(); i++) { - *left = 0; - *right= 0; + s32 lsum = 0; + s32 rsum = 0; for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) { execute(channel); @@ -507,17 +509,19 @@ void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream if (!(m_master_enable & (0x10 << channel))) { if (m_attenuation_enable & (0x10 << channel)) - *left += v * (m_audio[channel].attenuation >> 4); + lsum += v * (m_audio[channel].attenuation >> 4); else - *left += v * 15; + lsum += v * 15; } if (!(m_master_enable & (1 << channel))) { if (m_attenuation_enable & (1 << channel)) - *right += v * (m_audio[channel].attenuation & 0xf); + rsum += v * (m_audio[channel].attenuation & 0xf); else - *right += v * 15; + rsum += v * 15; } } + left.put_int(i, lsum, 32768); + right.put_int(i, rsum, 32768); } } diff --git a/src/mame/audio/lynx.h b/src/mame/audio/lynx.h index 11b983089a7..07bfef1a98b 100644 --- a/src/mame/audio/lynx.h +++ b/src/mame/audio/lynx.h @@ -45,7 +45,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void reset_channel(LYNX_AUDIO *channel); void shift(int chan_nr); @@ -75,7 +75,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; diff --git a/src/mame/audio/micro3d.cpp b/src/mame/audio/micro3d.cpp index 52f723ef55f..5f38bdad788 100644 --- a/src/mame/audio/micro3d.cpp +++ b/src/mame/audio/micro3d.cpp @@ -68,9 +68,9 @@ void micro3d_sound_device::lp_filter::init(double fsval) proto_coef[1].b1 = 1.847759; proto_coef[1].b2 = 1.0; - coef = make_unique_clear<float[]>(4 * 2 + 1); + std::fill(std::begin(coef), std::end(coef), 0); fs = fsval; - history = make_unique_clear<float[]>(2 * 2); + std::fill(std::begin(history), std::end(history), 0); } static void prewarp(double *a0, double *a1, double *a2,double fc, double fs) @@ -104,7 +104,7 @@ static void bilinear(double a0, double a1, double a2, void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc) { - float *c = coef.get() + 1; + float *c = &coef[1]; for (int nInd = 0; nInd < 2; nInd++) { @@ -182,7 +182,7 @@ micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const void micro3d_sound_device::device_start() { /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_stream = stream_alloc(0, 2, machine().sample_rate()); m_filter.init(machine().sample_rate()); m_noise_filters[0].configure(2.7e3 + 2.7e3, 1.0e-6); @@ -206,20 +206,20 @@ void micro3d_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { lp_filter *iir = &m_filter; float pan_l, pan_r; - stream_sample_t *fl = &outputs[0][0]; - stream_sample_t *fr = &outputs[1][0]; + auto &fl = outputs[0]; + auto &fr = outputs[1]; /* Clear the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + fl.fill(0); + fr.fill(0); if (m_gain == 0) return; @@ -227,7 +227,7 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre pan_l = (float)(255 - m_dac[PAN]) / 255.0f; pan_r = (float)(m_dac[PAN]) / 255.0f; - while (samples--) + for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { unsigned int i; float *hist1_ptr,*hist2_ptr,*coef_ptr; @@ -255,9 +255,9 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre input += white; input *= 200.0f; - coef_ptr = iir->coef.get(); + coef_ptr = &iir->coef[0]; - hist1_ptr = iir->history.get(); + hist1_ptr = &iir->history[0]; hist2_ptr = hist1_ptr + 1; /* 1st number of coefficients array is overall input scale factor, * or filter gain */ @@ -279,15 +279,9 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre hist1_ptr++; hist2_ptr++; } - output *= 3.5f; + output *= 3.5f / 32768.f; - /* Clip */ - if (output > 32767) - output = 32767; - else if (output < -32768) - output = -32768; - - *fl++ = output * pan_l; - *fr++ = output * pan_r; + fl.put_clamp(sampindex, output * pan_l, 1.0); + fr.put_clamp(sampindex, output * pan_r, 1.0); } } diff --git a/src/mame/audio/micro3d.h b/src/mame/audio/micro3d.h index 937d1fbed74..04b2b284deb 100644 --- a/src/mame/audio/micro3d.h +++ b/src/mame/audio/micro3d.h @@ -24,7 +24,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum dac_registers { @@ -45,8 +45,8 @@ private: void init(double fs); void recompute(double k, double q, double fc); - std::unique_ptr<float[]> history; - std::unique_ptr<float[]> coef; + float history[2 * 2]; + float coef[4 * 2 + 1]; double fs; biquad proto_coef[2]; }; diff --git a/src/mame/audio/nl_armora.cpp b/src/mame/audio/nl_armora.cpp index 53b102be96b..05775622295 100644 --- a/src/mame/audio/nl_armora.cpp +++ b/src/mame/audio/nl_armora.cpp @@ -224,7 +224,7 @@ NETLIST_START(armora) D_1N914(D8) - Q_2N3904(Q1) // NPN +// Q_2N3904(Q1) // NPN -- not used Q_2N3906(Q2) // PNP Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP diff --git a/src/mame/audio/nl_astrob.cpp b/src/mame/audio/nl_astrob.cpp index ee158301c29..9633191499a 100644 --- a/src/mame/audio/nl_astrob.cpp +++ b/src/mame/audio/nl_astrob.cpp @@ -30,7 +30,8 @@ #define HLE_LASER_1_VCO (1) #define HLE_LASER_2_VCO (1) -#define SIMPLIFY_SONAR (1) +#define SIMPLIFY_SONAR (0) // only use one oscillator +#define ENABLE_SONAR_ALT (1) // use frontiers to separate oscillators, modify UGF #define ENABLE_FRONTIERS (1) #define UNDERCLOCK_NOISE_GEN (1) @@ -58,7 +59,28 @@ #define TTL_74LS00_DIP TTL_7400_DIP #define TTL_74LS04_DIP TTL_7404_DIP - +// Define some random factors (5%) + +#define FRND1 1.023 +#define FRND2 1.017 +#define FRND3 1.005 +#define FRND4 1.014 +#define FRND5 1.049 +#define FRND6 1.044 +#define FRND7 1.016 +#define FRND8 1.037 +#define FRND9 1.030 +#define FRND10 1.001 +#define FRND11 1.034 +#define FRND12 1.043 +#define FRND13 1.011 +#define FRND14 1.016 +#define FRND15 1.011 +#define FRND16 1.006 +#define FRND17 1.009 +#define FRND18 1.007 +#define FRND19 1.035 +#define FRND20 1.004 // // Main netlist @@ -71,9 +93,11 @@ NETLIST_START(astrob) PARAM(Solver.DYNAMIC_TS, 1) PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 4e-5) #if (SIMPLIFY_SONAR) - PARAM(Solver.Solver_54.DYNAMIC_MIN_TIMESTEP, 7e-6) // gets rid of NR loops failure + PARAM(Solver.Solver_54.DYNAMIC_MIN_TIMESTEP, 4e-6) // gets rid of NR loops failure #else - PARAM(Solver.Solver_40.DYNAMIC_MIN_TIMESTEP, 7e-6) // gets rid of NR loops failure +#if !(ENABLE_SONAR_ALT) + PARAM(Solver.Solver_41.DYNAMIC_MIN_TIMESTEP, 6e-6) // gets rid of NR loops failure +#endif #endif #else SOLVER(Solver, 48000) @@ -145,15 +169,15 @@ NETLIST_START(astrob) ANALOG_INPUT(I_V12, 12) ANALOG_INPUT(I_VM12, -12) - RES(R1, RES_K(100)) - RES(R2, RES_K(1.5)) - RES(R3, RES_K(330)) - RES(R4, RES_K(10)) + RES(R1, RES_K(100) * FRND1) // part of SONAR circuit that relies on subtle part differences + RES(R2, RES_K(1.5) * FRND2) // part of SONAR circuit that relies on subtle part differences + RES(R3, RES_K(330) * FRND3) // part of SONAR circuit that relies on subtle part differences + RES(R4, RES_K(10) * FRND4) // part of SONAR circuit that relies on subtle part differences #if (SIMPLIFY_SONAR) // use less resistance to account for only emulating 1/4 identical circuits - RES(R5, RES_K(17)) + RES(R5, RES_K(17)) // part of SONAR circuit that relies on subtle part differences #else - RES(R5, RES_K(68)) + RES(R5, RES_K(68) * FRND5) // part of SONAR circuit that relies on subtle part differences #endif RES(R6, RES_K(68)) RES(R7, RES_K(22)) @@ -185,11 +209,11 @@ NETLIST_START(astrob) RES(R33, RES_K(39)) RES(R34, RES_K(4.7)) RES(R35, RES_K(4.7)) - RES(R36, RES_K(100.1)) // part of SONAR circuit that relies on subtle part differences - RES(R37, RES_K(1.51)) // part of SONAR circuit that relies on subtle part differences - RES(R38, RES_K(330.1)) // part of SONAR circuit that relies on subtle part differences - RES(R39, RES_K(10.1)) // part of SONAR circuit that relies on subtle part differences - RES(R40, RES_K(68.1)) // part of SONAR circuit that relies on subtle part differences + RES(R36, RES_K(100) * FRND6) // part of SONAR circuit that relies on subtle part differences + RES(R37, RES_K(1.5) * FRND7) // part of SONAR circuit that relies on subtle part differences + RES(R38, RES_K(330) * FRND8) // part of SONAR circuit that relies on subtle part differences + RES(R39, RES_K(10) * FRND9) // part of SONAR circuit that relies on subtle part differences + RES(R40, RES_K(68) * FRND10) // part of SONAR circuit that relies on subtle part differences RES(R41, RES_K(10)) RES(R42, RES_K(100)) RES(R43, RES_K(470)) @@ -211,11 +235,11 @@ NETLIST_START(astrob) RES(R59, RES_K(100)) RES(R60, RES_K(10)) RES(R61, RES_K(100)) - RES(R62, RES_K(99.9)) // part of SONAR circuit that relies on subtle part differences - RES(R63, RES_K(1.49)) // part of SONAR circuit that relies on subtle part differences - RES(R64, RES_K(329.9)) // part of SONAR circuit that relies on subtle part differences - RES(R65, RES_K(9.9)) // part of SONAR circuit that relies on subtle part differences - RES(R66, RES_K(67.9)) // part of SONAR circuit that relies on subtle part differences + RES(R62, RES_K(100) * FRND11) // part of SONAR circuit that relies on subtle part differences + RES(R63, RES_K(1.5) * FRND12) // part of SONAR circuit that relies on subtle part differences + RES(R64, RES_K(330) * FRND13) // part of SONAR circuit that relies on subtle part differences + RES(R65, RES_K(10) * FRND14) // part of SONAR circuit that relies on subtle part differences + RES(R66, RES_K(68) * FRND15) // part of SONAR circuit that relies on subtle part differences RES(R67, RES_K(10)) RES(R68, RES_K(82)) RES(R69, RES_K(470)) @@ -240,11 +264,11 @@ NETLIST_START(astrob) RES(R88, RES_K(100)) RES(R89, RES_K(10)) RES(R90, RES_K(100)) - RES(R91, RES_K(100.2)) // part of SONAR circuit that relies on subtle part differences - RES(R92, RES_K(1.52)) // part of SONAR circuit that relies on subtle part differences - RES(R93, RES_K(330.2)) // part of SONAR circuit that relies on subtle part differences - RES(R94, RES_K(10.2)) // part of SONAR circuit that relies on subtle part differences - RES(R95, RES_K(68.2)) // part of SONAR circuit that relies on subtle part differences + RES(R91, RES_K(100) * FRND16) // part of SONAR circuit that relies on subtle part differences + RES(R92, RES_K(1.5) * FRND17) // part of SONAR circuit that relies on subtle part differences + RES(R93, RES_K(330) * FRND18) // part of SONAR circuit that relies on subtle part differences + RES(R94, RES_K(10) * FRND19) // part of SONAR circuit that relies on subtle part differences + RES(R95, RES_K(68) * FRND20) // part of SONAR circuit that relies on subtle part differences RES(R96, RES_K(10)) RES(R97, RES_K(4.7)) RES(R98, RES_M(1)) @@ -455,7 +479,7 @@ NETLIST_START(astrob) Q_2N4403(Q1) Q_2N4403(Q2) Q_2N4403(Q3) - Q_2N4093(Q4) + //Q_2N4093(Q4) // avoid singular matrix being created Q_2N4093(Q5) Q_2N4093(Q6) Q_2N4403(Q7) @@ -471,6 +495,18 @@ NETLIST_START(astrob) NET_C(U2.4, I_V12) NET_C(U2.11, I_VM12) +#if (ENABLE_SONAR_ALT) + // Oscillators are of order 1kHz. No need to to have UGF in MHz range + PARAM(U1.A.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U1.B.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U1.C.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U1.D.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U2.A.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U2.B.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U2.C.MODEL, "TL084(TYPE=3 UGF=10k)") + PARAM(U2.D.MODEL, "TL084(TYPE=3 UGF=10k)") +#endif + CD4017_DIP(U3) // Decade Counter/Divider NET_C(U3.8, GND) NET_C(U3.16, I_V12) @@ -640,7 +676,7 @@ NETLIST_START(astrob) NET_C(U2.3, GND) NET_C(U2.2, D6.A, R65.1) - NET_C(U2.14, D6.K, R62.1) + NET_C(U2.1, D6.K, R62.1) NET_C(R62.2, R63.2, C24.1, C25.1) NET_C(R63.1, GND) NET_C(R65.2, R64.2, U2.7, C25.2, R66.2) @@ -657,6 +693,29 @@ NETLIST_START(astrob) NET_C(U2.10, GND) NET_C(R5.1, R40.1, R114.1, Q3.B, R95.1, R66.1) + +#if (ENABLE_SONAR_ALT) + // The oscillators need a small offset voltage to start oscillating. + // Without frontiers I assume the offset voltage is created due to the + // slight differences in resistor values in the four (now connected) + // oscillators. + + ANALOG_INPUT(I_VOFF, 0.1) + RES(RDUM1, RES_M(1)) + RES(RDUM2, RES_M(1)) + RES(RDUM3, RES_M(1)) + RES(RDUM4, RES_M(1)) + NET_C(R5.2, RDUM1.1) + NET_C(R40.2, RDUM2.1) + NET_C(R95.2, RDUM3.1) + NET_C(R66.2, RDUM4.1) + NET_C(I_VOFF, RDUM1.2, RDUM2.2, RDUM3.2, RDUM4.2) + + OPTIMIZE_FRONTIER(R5.2, RES_K(68), 192) + OPTIMIZE_FRONTIER(R40.2, RES_K(68), 192) + OPTIMIZE_FRONTIER(R95.2, RES_K(68), 192) + OPTIMIZE_FRONTIER(R66.2, RES_K(68), 192) +#endif #endif NET_C(R114.2, GND) diff --git a/src/mame/audio/nl_barrier.cpp b/src/mame/audio/nl_barrier.cpp index edd7c3d71a3..929e666eb08 100644 --- a/src/mame/audio/nl_barrier.cpp +++ b/src/mame/audio/nl_barrier.cpp @@ -123,11 +123,13 @@ NETLIST_START(barrier) D_1N914(CR5) D_1N914(CR6) +#if !(HLE_NOISE_GEN) Q_2N3906(Q1) // PNP Q_2N3904(Q2) // NPN +#endif Q_2N6426(Q3) // NPN Darlington - Q_2N6292(Q4) // NPN - Q_2N6107(Q5) // PNP +// Q_2N6292(Q4) // NPN -- not used +// Q_2N6107(Q5) // PNP -- not used Q_2N6426(Q6) // NPN Darlington Q_2N3904(Q7) // NPN diff --git a/src/mame/audio/nl_boxingb.cpp b/src/mame/audio/nl_boxingb.cpp index 39be6050b19..6d80f60f1b2 100644 --- a/src/mame/audio/nl_boxingb.cpp +++ b/src/mame/audio/nl_boxingb.cpp @@ -362,31 +362,41 @@ NETLIST_START(boxingb) Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP Q_2N3904(Q5) // NPN +#if !(HLE_CHIRPING_VCO) Q_2N3904(Q6) // NPN +#endif Q_2N3906(Q7) // PNP Q_2N3904(Q8) // NPN +#if !(HLE_DYING_BUG_VCO) Q_2N3904(Q9) // NPN +#endif Q_2N3906(Q10) // PNP Q_2N3904(Q11) // NPN +#if !(HLE_CRACKING_VCO) Q_2N3904(Q12) // NPN +#endif Q_2N3906(Q13) // PNP Q_2N3904(Q14) // NPN +#if !(HLE_BEETLE_VCO) Q_2N3904(Q15) // NPN +#endif Q_2N3906(Q16) // PNP Q_2N3904(Q17) // NPN Q_2N3906(Q18) // PNP Q_2N3906(Q19) // PNP Q_2N3906(Q20) // PNP Q_2N3904(Q21) // NPN +#if !(HLE_CANNON_VCO) Q_2N3904(Q22) // NPN +#endif Q_2N3906(Q23) // PNP Q_2N3906(Q24) // PNP Q_2N3906(Q25) // PNP Q_2N3906(Q26) // PNP // Q_2N6292(Q27) // PNP -- part of final amp (not emulated) // Q_2N6107(Q28) // NPN -- part of final amp (not emulated) - Q_2N5210(Q29) // NPN - Q_2N5210(Q30) // NPN +// Q_2N5210(Q29) // NPN -- not used +// Q_2N5210(Q30) // NPN -- not used Q_2N3906(Q31) // PNP Q_2N3906(Q32) // PNP Q_2N3906(Q33) // PNP @@ -1171,7 +1181,7 @@ NETLIST_START(boxingb) // R2 = 0.97985: HP = (0.0000369937*A0*A0*A0*A0) - (0.000849582*A0*A0*A0) - (0.00300315*A0*A0) + (0.185593*A0) - 1.090973 // R2 = 0.24613: HP = (-0.000199982*A0*A0*A0*A0*A0) + (0.0134882*A0*A0*A0*A0) - (0.362557*A0*A0*A0) + (4.857498*A0*A0) - (32.45284*A0) + 86.5278 // - VARCLOCK(BOUNCECLK, 1, "max(0.000001,min(0.1,((0.00115078*A0*A0*A0) - (0.0435380*A0*A0) + (0.550407*A0) - 2.321385))") + VARCLOCK(BOUNCECLK, 1, "max(0.000001,min(0.1,((0.00115078*A0*A0*A0) - (0.0435380*A0*A0) + (0.550407*A0) - 2.321385)))") NET_C(BOUNCECLK.GND, GND) NET_C(BOUNCECLK.VCC, I_V5) NET_C(BOUNCECLK.A0, C39.2) diff --git a/src/mame/audio/nl_brdrline.cpp b/src/mame/audio/nl_brdrline.cpp new file mode 100644 index 00000000000..e08121f90fa --- /dev/null +++ b/src/mame/audio/nl_brdrline.cpp @@ -0,0 +1,1721 @@ +// license:CC0 +// copyright-holders: beta-tester (https://github.com/beta-tester) + +//NL_CONTAINS brdrline + +// +// Netlist for Borderline (brdrline) +// +// Derived from the schematics in the Borderline Quest Owner's Manual. +// +// Known problems/issues: +// +// * all transistors in schematics of sound genertors were drawn +// in a wrong orientation. +// base and collectors were swaped +// +// * MB4391 is missing. a fake substitution is used +// +// * it takes up to 30seconds to charge C24 to its working point +// in ANIMAL_SOUND +// +// * noise generation with MM5837_DIP eats a lot of CPU power +// + + +// --------------------------------------------------------------------------- +// Borderline +// Owner's Manual +// Sega/Gremlin, Manual Part No. 420-0613 +// +// ........................................................................... +// Page 26 +// Sound Board Assembly +// Drawing No. 834-0055, Rev. A, Sheet 6 of 7 +// () = location in schematics +// ........................................................................... +// GUN_TRG (C8); GUN_SOUND (D6); (C8,D8,C7,D7,C6,D6) +// JEEP_ON (C8); JEEP_SOUND (C6); (C8,B8,C7,B7,C6,B6) +// POINT_TRG (A8); POINT_SOUND (B3); (A8,B8,A7,B7,A6,B6,A5,B5,C5,D5,A4,B4,C5, +// D4,B3) +// HIT_TRG (A8); HIT_SOUND (A4); (A8,A7,A6,A5,A4,B4,C4,D4,A3,B4,C3,D3) +// +// ........................................................................... +// Page 27 +// Sound Board Assembly +// Drawing No. 834-0055, Rev. A, Sheet 7 of 7 +// () = location in schematics +// ........................................................................... +// ANIMAL_TRG (D8); ANIMAL_SOUND (C6); (D8,C8,B8,A8,D7,C7,B7,A8,D6,C6,D5,C5) +// EMAR_TRG (A8); EMAR_SOUND (C5); (A8,A7,B7,C6,B6,B5,C5,B4,C4,D4,D3) +// WALK_TRG (A8); WALK_SOUND (B5); (A8,A7,A6,B6,B5) +// CRY_TRG (A8); CRY_SOUND (C1); (A8,A7,A6,A5,A4,A3,B3,C3,A2,B2,C2,A1, +// B1,C1) +// --------------------------------------------------------------------------- + + +// dry run: +// X=SOUND_OUT; ./nltool -q -c run --progress -t 50 -n brdrline -l $X -i ./src/mame/audio/nl_brdrline.csv ./src/mame/audio/nl_brdrline.cpp && ./nlwav -f tab -i 0.001 -s 1 -n -1 log_$X.log | gnuplot -p -e "reset; plot '-' using 1 with lines" +// X=SOUND_OUT; ./nltool -v -s -c run --progress -t 50 -n brdrline -l $X -i ./src/mame/audio/nl_brdrline.csv ./src/mame/audio/nl_brdrline.cpp | tee ./nl_brdrline.txt && ./nlwav -f tab -i 0.001 -s 1 -n -1 log_$X.log | gnuplot -p -e "reset; plot '-' using 1 with lines" +// +// X=SOUND_OUT; ./nlwav -f wav32f -a 0.5 -o ../$X.wav log_$X.log + + +#include "netlist/devices/net_lib.h" + +#define ENABLE_FRONTIERS (1) + + +/* ---------------------------------------------------------------------------- + * Library section content START + * ---------------------------------------------------------------------------*/ +#if 0 +// +// WARNING: fake implementation for MB4391 based on guesses only +// MB4391_DIP +// MB4391(A) +// +--------------+ +// .1/*IN1*/ |1 ++ 16| .16/*VCC1*/ +// .2/*CON1*/ |2 15| .15/*OUT1*/ +// .3/*GND1*/ |3 14| .14/*RO1*/ +// |4 MB4391 13| +// .5/*IN2*/ |5 12| .12/*VCC2*/ +// .6/*CON2*/ |6 11| .11/*OUT2*/ +// .7/*GND2*/ |7 10| .10/*RO2*/ +// |8 9| +// +--------------+ +/* + * VCC -----+-----------+-------------- VCC + * | | + * +-+ | + * |R| | + * |1| 2| + * +-+ +-------+-+ + * | 0| AFUNC |Q +----+ + * IN -----+---+ +---|Rout|--- OUT + * | | fx | +----+ + * +-+ +-+--+--+-+ + * |R| 1| 4| 3| + * |2| | | | + * +-+ | | | + * | | | | + * GND -----+-----|--|--+-------------- GND + * | | + * CON -----------+ | + * | + * RO --------------+ + * + */ +#endif +static NETLIST_START(_MB4391) + // MB4391 (fake implementation) + // 2020 by beta-tester (https://github.com/beta-tester) + // + // values by guesses + // for brdrline schematics only + // + // Vmix = -(Vcon - 4.759384) / (4.759384 - 2.839579) + // Vmix2 = pow(Vmix, 2) + // Vout = Vin * Vmix2 + // + // Vcon(max) = 4.759384 + // Vcon(min) = 2.839584...2.839579 (@3.002360417e+01)(@3.152360417e+01) + //AFUNC(fx, 5, "(A1)") + // + //AFUNC(fx, 5, "min(1, max(0, -(A1 - 4.759384) / (4.759384 - 2.839579)))") + //AFUNC(fx, 5, "min(1, max(0, -(A1 - (A2-0.24)) / ((A2-0.24) - (A2/2+0.34))))") + // + // Vin(offset)=2.5 (VCC/2) + //AFUNC(fx, 5, "(A0)") + //AFUNC(fx, 5, "(A0-2.5)") + //AFUNC(fx, 5, "(A0-(A2/2))") + // + // vin * mix + //AFUNC(fx, 5, "(A0-(A2/2)) * (min(1, max(0, -(A1 - 4.759384) / (4.759384 - 2.839579))))") + // + // vin * pow(mix, 2) + AFUNC(fx, 5, "(A0-(A2/2)) * pow((min(1, max(0, -(A1 - 4.759384) / (4.759384 - 2.839579))), 2))") + + RES(R1, RES_K(10)) + RES(R2, RES_K(10)) + NET_C(VCC, R1.1) + NET_C(IN, R1.2, R2.1) + NET_C(R2.2, GND) + + RES(Rout, RES_K(1)) + NET_C(fx.Q, Rout.1) // fx(IN, CON, VCC, GND, RO) = OUT + + // INPUT + ALIAS(IN, fx.A0) // IN + ALIAS(CON, fx.A1) // CON + ALIAS(VCC, fx.A2) // VCC + ALIAS(GND, fx.A3) // GND + ALIAS(RO, fx.A4) // RO + + // OUTPUT + ALIAS(OUT, Rout.2) // OUT +NETLIST_END() + + +static NETLIST_START(_MB4391_DIP) + SUBMODEL(_MB4391, A) + SUBMODEL(_MB4391, B) + + NC_PIN(NC) + + DIPPINS( /* +--------------+ */ + A.IN, /* IN1 |1 ++ 16| VCC1 */ A.VCC, + A.CON, /* CON1 |2 15| OUT1 */ A.OUT, + A.GND, /* GND1 |3 14| RO1 */ A.RO, + NC.I, /* |4 MB4391 13| */ NC.I, + B.IN, /* IN2 |5 12| VCC2 */ B.VCC, + B.CON, /* CON2 |6 11| OUT2 */ B.OUT, + B.GND, /* GND2 |7 10| RO2 */ B.RO, + NC.I, /* |8 9| */ NC.I + /* +--------------+ */ + ) +NETLIST_END() +/* ---------------------------------------------------------------------------- + * Library section content END + * ---------------------------------------------------------------------------*/ + + + + +/* + * hack + * + * terminates unused parts of a DIP + * WARNING: eats CPU time + * + * REQUIREMENT: + * - definition of a voltage splitter and a given alias UNUSED_OP_REF as + */ +#define UNUSED_TTL_Q(_name) HINT(_name, NC) +#define UNUSED_TTL_I(_name) NET_C(_name, GND) +#define UNUSED_OP_OUT_MINUS(_name_out, _name_minus) \ + NET_C(_name_out, _name_minus) +#define UNUSED_OP_PLUS(_name_plus) \ + NET_C(UNUSED_OP_REF, _name_plus) + +/* + * hack + */ +#define NC_(_name) HINT(_name, NC) +#define GND_(_name) NET_C(_name, GND) +#define TMP_(_name) NET_C(_name, GND) + +/* + * hack + */ +// diode MA150 (nothing special, only for quick discharging caps) +#define MA150(_name) \ + DIODE(_name, "D") + +// npn transistor 2SC458 +#define C458(_name) \ + QBJT_EB(_name, "NPN") + +// MB4391 one half of +//#define MB4391(_name) NET_REGISTER_DEV_X(MB4391, _name) +#define MB4391(_name) \ + SUBMODEL(_MB4391, _name) + +// MB4391 full dip +//#define MB4391_DIP(_name) NET_REGISTER_DEV_X(MB4391_DIP, _name) +#define MB4391_DIP(_name) \ + SUBMODEL(_MB4391_DIP, _name) + + + + +// --------------------------------------------------------------------------- +// Borderline +// Owner's Manual +// Sega/Gremlin, Manual Part No. 420-0613 +// +// ........................................................................... +// Page 26 +// Sound Board Assembly +// Drawing No. 834-0055, Rev. A, Sheet 6 of 7 +// () = location in schematics +// ........................................................................... +// GUN_TRG (C8); GUN_SOUND (D6); (C8,D8,C7,D7,C6,D6) +// JEEP_ON (C8); JEEP_SOUND (C6); (C8,B8,C7,B7,C6,B6) +// POINT_TRG (A8); POINT_SOUND (B3); (A8,B8,A7,B7,A6,B6,A5,B5,C5,D5,A4,B4,C5, +// D4,B3) +// HIT_TRG (A8); HIT_SOUND (A4); (A8,A7,A6,A5,A4,B4,C4,D4,A3,B4,C3,D3) +// +// ........................................................................... +// Page 27 +// Sound Board Assembly +// Drawing No. 834-0055, Rev. A, Sheet 7 of 7 +// () = location in schematics +// ........................................................................... +// ANIMAL_TRG (D8); ANIMAL_SOUND (C6); (D8,C8,B8,A8,D7,C7,B7,A8,D6,C6,D5,C5) +// EMAR_TRG (A8); EMAR_SOUND (C5); (A8,A7,B7,C6,B6,B5,C5,B4,C4,D4,D3) +// WALK_TRG (A8); WALK_SOUND (B5); (A8,A7,A6,B6,B5) +// CRY_TRG (A8); CRY_SOUND (C1); (A8,A7,A6,A5,A4,A3,B3,C3,A2,B2,C2,A1, +// B1,C1) +// --------------------------------------------------------------------------- +static NETLIST_START(brdrline_schematics) + + /* ------------------------------------------------------------------------ + * UNUSED_OP_REF + * -----------------------------------------------------------------------*/ + // UNUSED_OP_REF + POT(UNUSED_OP_RES, RES_K(20)) + PARAM(UNUSED_OP_RES.DIAL, 0.5) + NET_C(V12, UNUSED_OP_RES.1) + NET_C(GND, UNUSED_OP_RES.3) + ALIAS(UNUSED_OP_REF, UNUSED_OP_RES.2) + + + /* ------------------------------------------------------------------------ + * RST (RESET for sound) + * t(0s) = lo, t(2s) = high, t(infinite) = high + * -----------------------------------------------------------------------*/ + RES(R171, RES_K(47)) + CAP(C78, CAP_U(47)) + + TTL_74123_DIP(IC37) // shared by GUN_SOUND, RST + NET_C(GND, IC37.8/*GND*/) + NET_C(V5, IC37.16/*VCC*/) + + NET_C(GND, IC37.9/*A2*/) + NET_C(V5, IC37.10/*B2*/, IC37.11/*CLRQ2*/, R171.1) + NET_C(IC37.6/*C2*/, C78.1) + NET_C(IC37.7/*RC2*/, C78.2, R171.2) + + // -------------------------------- + // UNUSED PINS + NC_(IC37.5/*Q2*/) + + // -------------------------------- + // OUTPUT + ALIAS(RST, IC37.12/*QQ2*/) + + + /* ------------------------------------------------------------------------ + * GUN_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(GUN_TRG, R156.2) + + // -------------------------------- + // TRG -> CON + MA150(D1) + RES(R156, RES_K(1)) + RES(R155, RES_K(47)) + RES(R89, 470) + RES(R90, RES_K(470)) + RES(R91, RES_K(470)) + CAP(C73, CAP_U(1)) + CAP(C45, CAP_U(1)) + NET_C(GND, C45.2) + NET_C(V5, IC37.2/*B1*/, IC37.3/*CLRQ1*/ + , R156.1, R155.1, R91.1) + NET_C(R156.2, IC37.1/*A1*/) + NET_C(IC37.14/*C1*/, C73.1) + NET_C(IC37.15/*RC1*/, C73.2, R155.2) + NET_C(IC37.4/*QQ1*/, D1.K) + NET_C(D1.A, R89.1) + NET_C(R89.2, C45.1, R90.2) + NET_C(R91.2, R90.1, IC27.12/*PLUS4*/) + NET_C(IC27.14/*OUT4*/, IC27.13/*MINUS4*/, IC20.2/*CON1*/) + + // -------------------------------- + // NOISE + RES(R132, RES_K(220)) + RES(R133, RES_K(22)) + RES(R134, RES_K(15)) + RES(R93, RES_K(15)) + RES(R92, RES_K(150)) + RES(R88, RES_K(100)) + CAP(C62, CAP_U(2.2)) + CAP(C63, CAP_U(0.01)) + CAP(C48, CAP_U(0.01)) + + MM5837(IC26) + PARAM(IC26.FREQ, 24000) + NET_C(GND, IC26.VDD/*1*/, IC26.VGG/*2*/) + NET_C(V12, IC26.VSS/*4*/) // left out decoupling caps (0.1uF & 22uF parallel to GND) + + LM324_DIP(IC27) // shared by GUN_SOUND, _, GUN_SOUND, GUN_SOUND + NET_C(GND, IC27.11/*GND*/) + NET_C(V12, IC27.4/*VCC*/) + + NET_C(IC26.OUT/*3*/, C62.1) + NET_C(C62.2, R132.1) + NET_C(R132.2, IC27.2/*MINUS1*/, R133.1) + NET_C(IC27.3/*PLUS1*/, V6) + NET_C(IC27.1/*OUT1*/, R133.2, R134.1) + NET_C(R134.2, R93.1, C63.1) + NET_C(R93.2, C48.1, IC27.10/*PLUS3*/) + NET_C(C48.2, GND) + NET_C(IC27.8/*OUT3*/, C63.2, R92.1, C46.1) + NET_C(IC27.9/*MINUS3*/, R92.2, R88.1) + NET_C(R88.2, V6) + + // -------------------------------- + // CON, MIX -> OUT + MB4391_DIP(IC20) // shared by GUN_SOUND, CRY_SOUND + NET_C(GND, IC20.3/*GND1*/, IC20.7/*GND2*/) + NET_C(V5, IC20.16/*VCC1*/, IC20.12/*VCC2*/) + CAP(C46, CAP_U(2.2)) + CAP(C25, CAP_U(2.2)) + CAP(C26, CAP_P(680)) + NET_C(C26.2, GND) + NET_C(IC20.14/*RO1*/, C26.1) + NET_C(IC20.1/*IN1*/, C46.2) + NET_C(IC20.15/*OUT1*/, C25.1) + + // -------------------------------- + // UNUSED PINS + NC_(IC37.13/*Q1*/) + + UNUSED_OP_OUT_MINUS(IC27.7/*OUT2*/, IC27.6/*MINUS2*/) + UNUSED_OP_PLUS(IC27.5/*PLUS2*/) + + // -------------------------------- + // OUTPUT + NET_C(GUN_SOUND, C25.2) + + + /* ------------------------------------------------------------------------ + * JEEP_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(JEEP_ON, R151.2) + + // -------------------------------- + TTL_7408_DIP(IC29) // shared by _, JEEP_SOUND, _, _ + NET_C(GND, IC29.7/*GND*/) + NET_C(V5, IC29.14/*VCC*/) + + TTL_7416_DIP(IC36) // shared by _, _, JEEP_SOUND, _, _, _ + NET_C(GND, IC36.7/*GND*/) + NET_C(V5, IC36.14/*VCC*/) + + TTL_7474_DIP(IC30) + NET_C(GND, IC30.7/*GND*/) + NET_C(V5, IC30.14/*VCC*/) + + TTL_7474_DIP(IC32) + NET_C(GND, IC32.7/*GND*/) + NET_C(V5, IC32.14/*VCC*/) + + NE555(IC31) + NET_C(GND, IC31.GND/*1*/) + NET_C(V5, IC31.VCC/*8*/) + + RES(R123, RES_K(51)) + RES(R150, RES_K(1)) + RES(R151, RES_K(1)) + RES(R152, RES_K(1)) + RES(R153, RES_K(33)) + RES(R154, RES_K(1)) + RES(R157, RES_K(51)) + RES(R158, RES_K(51)) + CAP(C58, CAP_U(0.047)) + CAP(C59, CAP_U(2.2)) + CAP(C72, CAP_U(0.1)) + + NET_C(GND, C72.2, C58.2) + NET_C(V5, R150.1, R152.1, R154.1, R151.1 + , IC30.1/*CLR1*/, IC30.4/*PR1*/, IC30.10/*PR2*/, IC30.13/*CLR2*/ + , IC32.1/*CLR1*/, IC32.4/*PR1*/, IC32.10/*PR2*/, IC32.13/*CLR2*/ + ) + NET_C(IC36.5/*A3*/, R151.2) + NET_C(IC36.6/*Q3*/, R152.2 + , IC31.RESET/*4*/ + ) + NET_C(IC31.DISCH/*7*/, R150.2, R153.1) + NET_C(IC31.THRESH/*6*/, IC31.TRIG/*2*/, R153.2, C72.1) + NET_C(IC31.OUT/*3*/, R154.2 + , IC32.3/*CLK1*/, IC30.3/*CLK1*/, IC30.11/*CLK2*/ + ) + NET_C(IC32.6/*QQ1*/, R157.1 + , IC32.2/*D1*/, IC32.11/*CLK2*/ + ) + NET_C(IC32.8/*QQ2*/, IC32.12/*D2*/, R158.1) + NET_C(IC29.6/*Q2*/, IC30.2/*D1*/) + NET_C(IC30.5/*Q1*/, IC30.12/*D2*/) + NET_C(IC30.6/*QQ1*/, IC29.4/*A2*/) + NET_C(IC30.8/*QQ2*/, IC29.5/*B2*/, R123.1) + NET_C(R123.2, R157.2, R158.2, C58.1, C59.1) + + // -------------------------------- + // UNUSED PINS + NC_(IC30.9/*Q2*/) + + NC_(IC31.CONT/*5*/) + + NC_(IC32.5/*Q1*/) + NC_(IC32.9/*Q2*/) + + UNUSED_TTL_I(IC29.1/*A1*/) + UNUSED_TTL_I(IC29.2/*B1*/) + UNUSED_TTL_Q(IC29.3/*Q1*/) + UNUSED_TTL_Q(IC29.8/*Q3*/) + UNUSED_TTL_I(IC29.9/*A3*/) + UNUSED_TTL_I(IC29.10/*B3*/) + UNUSED_TTL_Q(IC29.11/*Q4*/) + UNUSED_TTL_I(IC29.12/*A4*/) + UNUSED_TTL_I(IC29.13/*B4*/) + + UNUSED_TTL_I(IC36.1/*A1*/) + UNUSED_TTL_Q(IC36.2/*Q1*/) + UNUSED_TTL_I(IC36.3/*A2*/) + UNUSED_TTL_Q(IC36.4/*Q2*/) + UNUSED_TTL_Q(IC36.8/*Q4*/) + UNUSED_TTL_I(IC36.9/*A4*/) + UNUSED_TTL_Q(IC36.10/*Q5*/) + UNUSED_TTL_I(IC36.11/*A5*/) + UNUSED_TTL_Q(IC36.12/*Q6*/) + UNUSED_TTL_I(IC36.13/*A6*/) + + // -------------------------------- + // OUTPUT + NET_C(JEEP_SOUND, C59.2) + + + /* ------------------------------------------------------------------------ + * POINT_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(POINT_TRG, R148.2) + + // -------------------------------- + // TRG -> CON + RES(R148, RES_K(1)) + RES(R149, RES_K(47)) + MA150(D5) + RES(R159, 470) + RES(R164, RES_K(470)) + RES(R165, RES_K(470)) + RES(R163, RES_K(27)) + RES(R166, RES_K(12)) + RES(R169, RES_K(30)) + RES(R168, RES_K(10)) + CAP(C71, CAP_U(1)) + CAP(C74, CAP_U(1)) + NET_C(R148.1, V5) + NET_C(IC35.9/*A2*/, R148.2) + NET_C(IC35.10/*B2*/, IC35.11/*CLRQ2*/, V5) + NET_C(IC35.6/*C2*/, C71.1) + NET_C(IC35.7/*RC2*/, C71.2, R149.2) + NET_C(R149.1, V5) + NET_C(IC35.12/*QQ2*/, D5.K) + NET_C(D5.A, R159.1) + NET_C(R159.2, C74.1, R165.2) + NET_C(C74.2, GND) + NET_C(IC38.12/*PLUS4*/, R165.1, R164.2) + NET_C(R164.1, V5) + NET_C(IC38.14/*OUT4*/, IC38.13/*MINUS4*/, R166.1) + NET_C(R163.1, V12) + NET_C(IC38.10/*PLUS3*/, R163.2, R168.1) + NET_C(R168.2, GND) + NET_C(IC38.9/*MINUS3*/, R166.2, R169.1) + NET_C(IC38.8/*OUT3*/, R169.2) + + // -------------------------------- + // UPPER STAGE -> MIX + RES(R79, RES_K(30)) + RES(R80, RES_K(51)) + RES(R81, RES_K(51)) + RES(R78, RES_K(15)) + RES(R32, RES_K(30)) + RES(R33, RES_K(10)) + CAP(C43, CAP_U(0.022)) + C458(TR13) + NE555(IC18) + NET_C(GND, IC18.GND/*1*/) + NET_C(V5, IC18.VCC/*8*/) + LM324_DIP(IC25) // shared by ANIMAL_SOUND, POINT_SOUND, POINT_SOUND, POINT_SOUND + NET_C(GND, IC25.11/*GND*/) + NET_C(V12, IC25.4/*VCC*/) + NET_C(IC38.8/*OUT3*/, R79.1, R80.1) + NET_C(IC25.12/*PLUS4*/, R80.2, R81.1) + NET_C(R81.2, GND) + NET_C(IC25.13/*MINUS4*/, R79.2, C43.1, R78.1) + NET_C(IC18.RESET/*4*/, RST) + NET_C(R33.1, V5) + NET_C(IC18.DISCH/*7*/, R33.2) + NET_C(TR13.B, IC18.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR13.C, R78.2) // B & C swapped, wrong in schematics + NET_C(TR13.E, GND) + NET_C(IC25.14/*OUT4*/, IC18.TRIG/*2*/, IC18.THRESH/*6*/, C43.2, R32.1) + + // -------------------------------- + // MIDDLE STAGE -> UPPER STAGE + RES(R84, RES_K(30)) + RES(R83, RES_K(51)) + RES(R82, RES_K(51)) + RES(R85, RES_K(15)) + RES(R35, RES_K(30)) + RES(R36, RES_K(10)) + RES(R37, RES_K(2.2)) + CAP(C44, CAP_P(6800)) + C458(TR14) + NE555(IC19) + NET_C(GND, IC19.GND/*1*/) + NET_C(V5, IC19.VCC/*8*/) + NET_C(IC38.8/*OUT3*/, R83.1, R84.1) + NET_C(IC25.10/*PLUS3*/, R83.2, R82.1) + NET_C(R82.2, GND) + NET_C(IC25.9/*MINUS3*/, R84.2, C44.1, R85.1) + NET_C(IC19.RESET/*4*/, RST) + NET_C(R36.1, V5) + NET_C(IC19.DISCH/*7*/, R36.2) + NET_C(TR14.B, IC19.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR14.C, R85.2) // B & C swapped, wrong in schematics + NET_C(TR14.E, GND) + NET_C(IC25.8/*OUT3*/, IC19.TRIG/*2*/, IC19.THRESH/*6*/, C44.2, R35.2) + NET_C(R35.1, R32.2) + NET_C(R37.1, IC18.CONT/*5*/, IC19.CONT/*5*/) + + // -------------------------------- + // LOWER STAGE -> UPPER STAGE + RES(R130, RES_K(30)) + RES(R129, RES_K(51)) + RES(R128, RES_K(51)) + RES(R131, RES_K(15)) + RES(R34, RES_K(10)) + CAP(C61, CAP_U(0.068)) + CAP(C60, CAP_U(0.022)) + CAP(C23, CAP_U(0.01)) + C458(TR4) + NE555(IC8) + NET_C(GND, IC8.GND/*1*/) + NET_C(V5, IC8.VCC/*8*/) + NET_C(IC38.8/*OUT3*/, R130.1, R129.1) + NET_C(IC25.5/*PLUS2*/, R129.2, R128.1) + NET_C(R128.2, GND) + NET_C(IC25.6/*MINUS2*/, R130.2, C60.1, C61.1, R131.1) + NET_C(IC8.RESET/*4*/, RST) + NET_C(IC8.CONT/*5*/, C23.1) + NET_C(C23.2, GND) + NET_C(R34.1, V5) + NET_C(IC8.DISCH/*7*/, R34.2) + NET_C(TR4.B, IC8.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR4.C, R131.2) // B & C swapped, wrong in schematics + NET_C(TR4.E, GND) + NET_C(IC25.7/*OUT2*/, IC8.TRIG/*2*/, IC8.THRESH/*6*/, C61.2, C60.2, R37.2) + + // -------------------------------- + // CON, MIX -> OUT + CAP(C15, CAP_U(2.2)) + CAP(C16, CAP_P(680)) + CAP(C13, CAP_U(2.2)) + NET_C(R32.2, C13.1) + NET_C(IC5.1/*IN1*/, C13.2) + NET_C(IC5.15/*OUT1*/, C15.1) + NET_C(IC5.14/*RO1*/, C16.1) + NET_C(C16.2, GND) + NET_C(IC38.14/*OUT4*/, IC5.2/*CON1*/) + + // -------------------------------- + // UNUSED PINS + NC_(IC35.5/*Q2*/) + + NET_C(IC8.OUT/*3*/, NC_IC8_OUT.1) // not connected in schematics + RES(NC_IC8_OUT, RES_M(1)) + NET_C(NC_IC8_OUT.2, GND) + NET_C(IC18.OUT/*3*/, NC_IC18_OUT.1) // not connected in schematics + RES(NC_IC18_OUT, RES_M(1)) + NET_C(NC_IC18_OUT.2, GND) + NET_C(IC19.OUT/*3*/, NC_IC19_OUT.1) // not connected in schematics + RES(NC_IC19_OUT, RES_M(1)) + NET_C(NC_IC19_OUT.2, GND) + + // -------------------------------- + // OUTPUT + NET_C(POINT_SOUND, C15.2) + + + /* ------------------------------------------------------------------------ + * HIT_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(HIT_TRG, R147.1) + + // -------------------------------- + // TRG -> CON + TTL_74123_DIP(IC35) // shared by HIT_SOUND, POINT_SOUND + NET_C(GND, IC35.8/*GND*/) + NET_C(V5, IC35.16/*VCC*/) + RES(R147, RES_K(1)) + RES(R146, RES_K(47)) + RES(R160, 470) + RES(R161, RES_K(470)) + RES(R162, RES_K(470)) + CAP(C70, CAP_U(1)) + CAP(C75, CAP_U(1)) + MA150(D6) + NET_C(IC35.1/*A1*/, R147.1) + NET_C(R147.2, V5) + NET_C(IC35.2/*B1*/, IC35.3/*CLRQ1*/, V5) + NET_C(IC35.14/*C1*/, C70.1) + NET_C(IC35.15/*RC1*/, C70.2, R146.2) + NET_C(R146.1, V5) + NET_C(IC35.4/*QQ1*/, D6.K) + NET_C(D6.A, R160.1) + NET_C(R160.2, C75.1, R161.2) + NET_C(C75.2, GND) + NET_C(IC38.3/*PLUS1*/, R161.1, R162.2) + NET_C(R162.1, V5) + NET_C(IC38.1/*OUT1*/, IC38.2/*MINUS1*/) + + // -------------------------------- + // CON, MIX -> OUT + MB4391_DIP(IC5) // shared by POINT_SOUND, HIT_SOUND + NET_C(GND, IC5.3/*GND1*/, IC5.7/*GND2*/) + NET_C(V5, IC5.16/*VCC1*/, IC5.12/*VCC2*/) + CAP(C18, CAP_P(680)) + NET_C(C18.1, IC5.10/*RO2*/) + NET_C(C18.2, GND) + CAP(C14, CAP_U(2.2)) + CAP(C17, CAP_U(2.2)) + NET_C(IC5.6/*CON2*/, IC38.1/*OUT1*/) + NET_C(IC5.11/*OUT2*/, C17.1) + NET_C(IC5.5/*IN2*/, C14.2) + + // -------------------------------- + // LOWER STAGE -> MIX + C458(TR11) + NE555(IC16) + NET_C(GND, IC16.GND/*1*/) + NET_C(V5, IC16.VCC/*8*/) + RES(R71, RES_K(51)) + RES(R70, RES_K(30)) + RES(R72, RES_K(51)) + RES(R69, RES_K(15)) + RES(R28, RES_K(10)) + RES(R76, RES_K(1)) + CAP(C39, CAP_U(0.01)) + CAP(C40, CAP_U(0.0033)) + NET_C(IC24.14/*OUT4*/, C14.1) + NET_C(IC24.7/*OUT2*/, R70.1, R71.1) + NET_C(IC24.12/*PLUS4*/, R71.2, R72.1) + NET_C(R72.2, GND) + NET_C(IC24.13/*MINUS4*/, R70.2, C39.1, C40.1, R69.1) + NET_C(IC24.14/*OUT4*/, IC16.TRIG/*2*/, IC16.THRESH/*6*/, C39.2, C40.2) + NET_C(IC16.RESET/*4*/, RST) + NET_C(IC16.CONT/*5*/, R76.2) + NET_C(R28.1, V5) + NET_C(TR11.B, IC16.DISCH/*7*/, R28.2) // B & C swapped, wrong in schematics + NET_C(TR11.C, R69.2) // B & C swapped, wrong in schematics + NET_C(TR11.E, GND) + + NET_C(IC24.8/*OUT3*/, R76.1) + + RES(R119, RES_K(10)) + RES(R120, RES_K(39)) + RES(R121, RES_K(47)) + RES(R122, RES_K(15)) + + LM324_DIP(IC24) // shared by EMAR_SOUND, HIT_SOUND, HIT_SOUND, HIT_SOUND + NET_C(GND, IC24.11/*GND*/) + NET_C(V12, IC24.4/*VCC*/) + + NET_C(V12, R120.1) + NET_C(R120.2, R119.1) + NET_C(IC24.5/*PLUS2*/, R120.2) + NET_C(R119.2, GND) + NET_C(IC24.6/*MINUS2*/, R122.2, R121.1) + NET_C(IC24.7/*OUT2*/, R121.2) + + NET_C(IC24.8/*OUT3*/, R122.1) + + // -------------------------------- + // UPPER STAGE -> LOWER STAGE + C458(TR12) + NE555(IC17) + NET_C(GND, IC17.GND/*1*/) + NET_C(V5, IC17.VCC/*8*/) + RES(R75, RES_K(470)) + RES(R74, RES_K(51)) + RES(R73, RES_K(51)) + RES(R77, RES_K(5.1)) + RES(R30, RES_K(10)) + CAP(C41, CAP_U(2.2)) + CAP(C42, CAP_U(2.2)) + CAP(C21, CAP_U(0.01)) + NET_C(V6, R75.1, R74.1) + NET_C(C41.1, C42.1) + NET_C(IC24.9/*MINUS3*/, R75.2, R77.1, C41.2) + NET_C(IC24.10/*PLUS3*/, R74.2, R73.1) + NET_C(R73.2, GND) + NET_C(IC17.RESET/*4*/, RST) + NET_C(R30.1, V5) + NET_C(IC17.DISCH/*7*/, R30.2) + NET_C(IC17.CONT/*5*/, C21.1) + NET_C(C21.2, GND) + NET_C(TR12.B, IC17.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR12.C, R77.2) // B & C swapped, wrong in schematics + NET_C(TR12.E, GND) + NET_C(IC24.8/*OUT3*/, IC17.TRIG/*2*/, IC17.THRESH/*6*/, C42.2) + + // -------------------------------- + // UNUSED PINS + NC_(IC35.13/*Q1*/) + + NET_C(IC17.OUT/*3*/, NC_IC17_OUT.1) // not connected in schematics + RES(NC_IC17_OUT, RES_M(1)) + NET_C(NC_IC17_OUT.2, GND) + NET_C(IC16.OUT/*3*/, NC_IC16_OUT.1) // not connected in schematics + RES(NC_IC16_OUT, RES_M(1)) + NET_C(NC_IC16_OUT.2, GND) + + // -------------------------------- + // OUTPUT + NET_C(HIT_SOUND, C17.2) + + + /* ------------------------------------------------------------------------ + * ANIMAL_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(ANIMAL_TRG, R145.2) + + // -------------------------------- + // TGG -> TRG2 -> CON + RES(R145, RES_K(1)) + RES(R143, RES_K(47)) + RES(R144, RES_K(47)) + RES(R106, 470) + RES(R108, RES_K(470)) + RES(R107, RES_K(470)) + CAP(C67, CAP_U(47)) + CAP(C66, CAP_U(47)) + CAP(C69, CAP_U(1)) + CAP(C53, CAP_U(1)) + MA150(D4) + TTL_74123_DIP(IC34) // shared by ANIMAL_SOUND, ANIMAL_SOUND + NET_C(GND, IC34.8/*GND*/) + NET_C(V5, IC34.16/*VCC*/) + NET_C(R145.1, V5) + NET_C(IC34.1/*A1*/, R145.2) + NET_C(IC34.2/*B1*/, IC34.3/*CLRQ1*/, V5) + NET_C(IC34.14/*C1*/, C67.2, C66.2) + NET_C(IC34.15/*RC1*/, C67.1, C66.1, R143.2) + NET_C(R143.1, V5) + NET_C(IC34.1/*A1*/, IC34.9/*A2*/) + NET_C(IC34.13/*Q1*/, IC34.10/*B2*/, IC34.11/*CLRQ2*/) + NET_C(IC34.6/*C2*/, C69.2) + NET_C(IC34.7/*RC2*/, C69.1, R144.2) + NET_C(R144.1, V5) + NET_C(IC34.12/*QQ2*/, D4.K) + NET_C(D4.A, R106.1) + NET_C(R106.2, C53.1, R107.2) + NET_C(C53.2, GND) + NET_C(IC23.3/*PLUS1*/, R107.1, R108.2) + NET_C(R108.1, V5) + NET_C(IC23.1/*OUT1*/, IC23.2/*MINUS1*/, IC4.6/*CON2*/) + + // -------------------------------- + C458(TR16) + RES(R110, RES_K(10)) + NET_C(IC34.13/*Q1*/, R110.1) + NET_C(TR16.B, R110.2) // B & C swapped, wrong in schematics + NET_C(TR16.C, R109.2) // B & C swapped, wrong in schematics + NET_C(TR16.E, GND) + + C458(TR15) + RES(R109, RES_K(1)) + RES(R44, 220) + NET_C(R109.1, V5) + NET_C(TR15.B, R109.2) // B & C swapped, wrong in schematics + NET_C(TR15.C, C24.1) // B & C swapped, wrong in schematics + NET_C(TR15.E, R44.1) + NET_C(R44.2, C24.2) + + // -------------------------------- + // UPPER STAGE -> MIDDLE STAGE + RES(R39, RES_K(51)) + RES(R38, RES_K(22)) + RES(R15, RES_K(51)) + RES(R41, RES_K(22)) + RES(R42, RES_K(36)) + RES(R43, RES_K(10)) + RES(R40, RES_M(1)) + CAP(C24, CAP_U(100)) + LM324_DIP(IC9) // shared by ANIMAL_SOUND, ANIMAL_SOUND, ANIMAL_SOUND, ANIMAL_SOUND + NET_C(GND, IC9.11/*GND*/) + NET_C(V12, IC9.4/*VCC*/) + NET_C(R40.1, R39.1, V12) + NET_C(IC9.5/*PLUS2*/, R39.2, R15.1) + NET_C(R15.2, GND) + NET_C(IC9.6/*MINUS2*/, R40.2, C24.1) + NET_C(IC9.7/*OUT2*/, C24.2, R38.1) + NET_C(R42.1, V12) + NET_C(IC9.3/*PLUS1*/, R42.2, R43.1) + NET_C(R43.2, GND) + NET_C(IC9.2/*MINUS1*/, R38.2, R41.1) + NET_C(IC9.1/*OUT1*/, R41.2) + + // -------------------------------- + // MIDDLE STAGE -> MIX + RES(R11, RES_K(30)) + RES(R12, RES_K(51)) + RES(R13, RES_K(51)) + RES(R10, RES_K(1)) + RES(R9, RES_K(10)) + RES(R14, RES_K(5.1)) + RES(R16, RES_K(10)) + CAP(C1, CAP_U(0.033)) + C458(TR1) + NE555(IC1) + NET_C(GND, IC1.GND/*1*/) + NET_C(V5, IC1.VCC/*8*/) + NET_C(IC9.1/*OUT1*/, R11.1, R12.1) + NET_C(IC9.12/*PLUS4*/, R12.2, R13.1) + NET_C(R13.2, GND) + NET_C(IC9.13/*MINUS4*/, R11.2, C1.1, R10.1) + NET_C(IC1.RESET/*4*/, RST) + NET_C(IC1.DISCH/*7*/, R9.2) + NET_C(R9.1, V5) + NET_C(TR1.B, IC1.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR1.C, R10.2) // B & C swapped, wrong in schematics + NET_C(TR1.E, GND) + NET_C(IC9.14/*OUT4*/, IC1.TRIG/*2*/, IC1.THRESH/*6*/, C1.2) + NET_C(IC9.14/*OUT4*/, R16.1) + NET_C(IC1.CONT/*5*/, R14.1) + + RES(R17, RES_K(5.1)) + RES(R18, RES_K(3.3)) + NET_C(IC9.8/*OUT3*/, IC9.9/*MINUS3*/, R14.2) + NET_C(IC9.10/*PLUS3*/, R17.2, R18.2) + + // -------------------------------- + // LOWER STAGE -> MIDDLE STAGE + RES(R59, RES_K(560)) + RES(R58, RES_K(51)) + RES(R57, RES_K(51)) + RES(R60, RES_K(5.1)) + RES(R23, RES_K(10)) + CAP(C34, CAP_U(1)) + CAP(C35, CAP_U(1)) + CAP(C7, CAP_U(0.01)) + C458(TR8) + NE555(IC13) + NET_C(GND, IC13.GND/*1*/) + NET_C(V5, IC13.VCC/*8*/) + NET_C(R59.1, R58.1, V6) + NET_C(IC22.10/*PLUS3*/, R58.2, R57.1) + NET_C(R57.2, GND) + NET_C(IC22.9/*MINUS3*/, R59.2, C34.2, R60.1) + NET_C(C34.1, C35.1) + NET_C(IC13.RESET/*4*/, RST) + NET_C(IC13.DISCH/*7*/, R23.2) + NET_C(R23.1, V5) + NET_C(IC13.CONT/*5*/, C7.1) + NET_C(C7.2, GND) + NET_C(TR8.B, IC13.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR8.C, R60.2) // B & C swapped, wrong in schematics + NET_C(TR8.E, GND) + NET_C(IC22.8/*OUT3*/, IC13.TRIG/*2*/, IC13.THRESH/*6*/, C35.2, R18.1) + + // -------------------------------- + // BOTTOM STAGE -> MIDDLE STAGE + RES(R127, RES_K(56)) + RES(R125, RES_K(51)) + RES(R124, RES_K(51)) + RES(R126, RES_K(30)) + RES(R31, RES_K(10)) + CAP(C57, CAP_U(1)) + CAP(C56, CAP_U(1)) + CAP(C22, CAP_U(0.01)) + C458(TR3) + NE555(IC7) + NET_C(GND, IC7.GND/*1*/) + NET_C(V5, IC7.VCC/*8*/) + NET_C(R127.1, R125.1, V6) + NET_C(IC25.3/*PLUS1*/, R125.2, R124.1) + NET_C(R124.2, GND) + NET_C(IC25.2/*MINUS1*/, R127.2, C57.2, R126.1) + NET_C(C57.1, C56.1) + NET_C(IC7.RESET/*4*/, RST) + NET_C(IC7.CONT/*5*/, C22.1) + NET_C(C22.2, GND) + NET_C(IC7.DISCH/*7*/, R31.2) + NET_C(R31.1, V5) + NET_C(TR3.B, IC7.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR3.C, R126.2) // B & C swapped, wrong in schematics + NET_C(TR3.E, GND) + NET_C(IC25.1/*OUT1*/, IC7.TRIG/*2*/, IC7.THRESH/*6*/, C56.2) + NET_C(IC25.1/*OUT1*/, R17.1) + + // -------------------------------- + // CON, MIX -> OUT + CAP(C6, CAP_U(2.2)) + CAP(C11, CAP_U(2.2)) + CAP(C12, CAP_P(680)) + NET_C(IC4.10/*RO2*/, C12.1) + NET_C(C12.2, GND) + NET_C(R16.2, C6.1) + NET_C(IC4.5/*IN2*/, C6.2) + NET_C(IC4.11/*OUT2*/, C11.1) + + // -------------------------------- + // UNUSED PINS + NC_(IC34.4/*QQ1*/) + NC_(IC34.5/*Q2*/) + + NET_C(IC1.OUT/*3*/, NC_IC1_OUT.1) // not connected in schematics + RES(NC_IC1_OUT, RES_M(1)) + NET_C(NC_IC1_OUT.2, GND) + + NET_C(IC13.OUT/*3*/, NC_IC13_OUT.1) // not connected in schematics + RES(NC_IC13_OUT, RES_M(1)) + NET_C(NC_IC13_OUT.2, GND) + + NET_C(IC7.OUT/*3*/, NC_IC7_OUT.1) // not connected in schematics + RES(NC_IC7_OUT, RES_M(1)) + NET_C(NC_IC7_OUT.2, GND) + + + // -------------------------------- + // OUTPUT + NET_C(ANIMAL_SOUND, C11.2) + + + /* ------------------------------------------------------------------------ + * EMAR_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(EMAR_TRG, R142.2) + + // -------------------------------- + // TRG -> CON + RES(R142, RES_K(1)) + RES(R141, RES_K(47)) + MA150(D3) + RES(R103, 470) + RES(R105, RES_K(470)) + RES(R104, RES_K(470)) + CAP(C68, CAP_U(1)) + CAP(C52, CAP_U(1)) + NET_C(IC33.9/*A2*/, R142.2) + NET_C(R142.1, V5) + NET_C(IC33.10/*B2*/, IC33.11/*CLRQ2*/, V5) + NET_C(IC33.6/*C2*/, C68.1) + NET_C(IC33.7/*RC2*/, C68.2, R141.2) + NET_C(R141.1, V5) + NET_C(IC33.12/*QQ2*/, D3.K) + NET_C(D3.A, R103.1) + NET_C(R103.2, C52.1, R105.2) + NET_C(C52.2, GND) + NET_C(IC22.5/*PLUS2*/, R105.1, R104.2) + NET_C(R104.1, V5) + NET_C(IC22.7/*OUT2*/, IC22.6/*MINUS2*/) + + // -------------------------------- + // CON, MIX -> OUT + MB4391_DIP(IC4) // shared by EMAR_SOUND, ANIMAL_SOUND + NET_C(GND, IC4.3/*GND1*/, IC4.7/*GND2*/) + NET_C(V5, IC4.16/*VCC1*/, IC4.12/*VCC2*/) + RES(R24, RES_K(10)) + CAP(C8, CAP_U(2.2)) + CAP(C9, CAP_U(2.2)) + CAP(C10, CAP_P(680)) + NET_C(IC22.7/*OUT2*/, IC4.2/*CON1*/) + NET_C(IC4.14/*RO1*/, C10.1) + NET_C(C10.2, GND) + NET_C(IC4.15/*OUT1*/, C9.1) + NET_C(IC4.1/*IN1*/, C8.2) + NET_C(R24.2, C8.1) + + LM324_DIP(IC23) // shared by ANIMAL_SOUND, EMAR_SOUND, EMAR_SOUND, EMAR_SOUND + NET_C(GND, IC23.11/*GND*/) + NET_C(V12, IC23.4/*VCC*/) + + // -------------------------------- + // LOWER STAGE -> UPPER STAGE + C458(TR2) + NE555(IC6) + NET_C(GND, IC6.GND/*1*/) + NET_C(V5, IC6.VCC/*8*/) + RES(R116, RES_K(470)) + RES(R117, RES_K(51)) + RES(R118, RES_K(51)) + RES(R115, RES_K(51)) + RES(R29, RES_K(10)) + CAP(C55, CAP_U(3.3)) + CAP(C54, CAP_U(3.3)) + CAP(C20, CAP_U(0.01)) + NET_C(R116.1, R117.1, V6) + NET_C(IC24.3/*PLUS1*/, R117.2, R118.1) + NET_C(R118.2, GND) + NET_C(IC24.2/*MINUS1*/, R116.2, C55.2, R115.1) + NET_C(C55.1, C54.1) + NET_C(IC6.RESET/*4*/, RST) + NET_C(IC6.CONT/*5*/, C20.1) + NET_C(C20.2, GND) + NET_C(IC6.DISCH/*7*/, R29.2) + NET_C(R29.1, V5) + NET_C(TR2.B, IC6.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR2.C, R115.2) // B & C swapped, wrong in schematics + NET_C(TR2.E, GND) + NET_C(IC24.1/*OUT1*/, IC6.TRIG/*2*/, IC6.THRESH/*6*/, C54.2) + + NET_C(IC24.1/*OUT1*/, R113.1) + RES(R113, RES_K(22)) + RES(R111, RES_K(27)) + RES(R112, RES_K(10)) + RES(R114, RES_K(22)) + NET_C(R111.1, V12) + NET_C(IC23.5/*PLUS2*/, R111.2, R112.1) + NET_C(R112.2, GND) + NET_C(IC23.6/*MINUS2*/, R113.2, R114.1) + NET_C(IC23.7/*OUT2*/, R114.2) + + // -------------------------------- + // MIDDLE STAGE -> UPPER STAGE + C458(TR10) + NE555(IC15) + NET_C(GND, IC15.GND/*1*/) + NET_C(V5, IC15.VCC/*8*/) + RES(R67, RES_K(220)) + RES(R66, RES_K(51)) + RES(R65, RES_K(51)) + RES(R68, RES_K(100)) + RES(R27, RES_K(10)) + RES(R26, RES_K(33)) + CAP(C38, CAP_U(1)) + CAP(C37, CAP_U(1)) + CAP(C19, CAP_U(0.01)) + NET_C(R67.1, R66.1, V6) + NET_C(IC23.10/*PLUS3*/, R66.2, R65.1) + NET_C(R65.2, GND) + NET_C(IC23.9/*MINUS3*/, R67.2, C37.2, R68.1) + NET_C(IC15.RESET/*4*/, RST) + NET_C(IC15.CONT/*5*/, C19.1) + NET_C(C19.2, GND) + NET_C(IC15.DISCH/*7*/, R27.2) + NET_C(R27.1, V5) + NET_C(TR10.B, IC15.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR10.C, R68.2) // B & C swapped, wrong in schematics + NET_C(TR10.E, GND) + NET_C(IC23.8/*OUT3*/, IC15.TRIG/*2*/, IC15.THRESH/*6*/, C38.2) + NET_C(C38.1, C37.1) + NET_C(IC15.OUT/*3*/, R26.2) + + // -------------------------------- + // UPPER STAGE -> MIX + C458(TR9) + NE555(IC14) + NET_C(GND, IC14.GND/*1*/) + NET_C(V5, IC14.VCC/*8*/) + RES(R62, RES_K(30)) + RES(R63, RES_K(51)) + RES(R64, RES_K(51)) + RES(R61, RES_K(15)) + RES(R25, RES_K(10)) + CAP(C36, CAP_U(0.022)) + CAP(C2, CAP_U(1)) // ? maybe 0.01uF + NET_C(IC23.7/*OUT2*/, R62.1, R63.1) + NET_C(IC23.12/*PLUS4*/, R63.2, R64.1) + NET_C(R64.2, GND) + NET_C(IC23.13/*MINUS4*/, R62.2, C36.1, R61.1) + NET_C(IC14.RESET/*4*/, RST) + NET_C(IC14.DISCH/*7*/, R25.2) + NET_C(R25.1, V5) + NET_C(IC14.CONT/*5*/, C2.1, R26.1) + NET_C(C2.2, GND) + NET_C(TR9.B, IC14.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR9.C, R61.2) // B & C swapped, wrong in schematics + NET_C(TR9.E, GND) + NET_C(IC23.14/*OUT4*/, IC14.TRIG/*2*/, IC14.THRESH/*6*/, C36.2) + NET_C(IC23.14/*OUT4*/, R24.1) + + // -------------------------------- + // UNUSED PINS + NC_(IC33.5/*Q2*/) + + NET_C(IC6.OUT/*3*/, NC_IC6_OUT.1) // not connected in schematics + RES(NC_IC6_OUT, RES_M(1)) + NET_C(NC_IC6_OUT.2, GND) + NET_C(IC14.OUT/*3*/, NC_IC14_OUT.1) // not connected in schematics + RES(NC_IC14_OUT, RES_M(1)) + NET_C(NC_IC14_OUT.2, GND) + + // -------------------------------- + // OUTPUT + NET_C(EMAR_SOUND, C9.2) + + + /* ------------------------------------------------------------------------ + * WALK_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(WALK_TRG, R140.2) + + // -------------------------------- + NE555(IC28) + NET_C(GND, IC28.GND/*1*/) + NET_C(V5, IC28.VCC/*8*/) + + LM324_DIP(IC21) // shared by CRY_SOUND, WALK_SOUND, CRY_SOUND, CRY_SOUND + NET_C(GND, IC21.11/*GND*/) + NET_C(V12, IC21.4/*VCC*/) + + RES(R95, RES_K(100)) + RES(R96, RES_K(22)) + RES(R98, RES_K(27)) + RES(R137, RES_K(22)) + RES(R140, RES_K(1)) + CAP(C3, CAP_U(2.2)) + CAP(C50, CAP_U(0.1)) + CAP(C51, CAP_U(2.2)) + CAP(C65, CAP_U(0.01)) + CAP(C77, CAP_U(2.2)) + + NET_C(GND, C65.2, C77.2, C50.2) + NET_C(V6, IC21.5/*PLUS2*/) + NET_C(V5, R140.1, R137.1) + NET_C(R140.2, IC28.TRIG/*2*/) + NET_C(C65.1, IC28.CONT/*5*/) + NET_C(IC28.THRESH/*6*/, IC28.DISCH/*7*/, R137.2, C77.1) + NET_C(IC28.OUT/*3*/ , R98.1) + NET_C(R98.2, C50.1, C51.1) + NET_C(C51.2, R96.1) + NET_C(R96.2, R95.1, IC21.6/*MINUS2*/) + NET_C(IC21.7/*OUT2*/, R95.2, C3.1) + + // -------------------------------- + // UNUSED PINS + NET_C(V5, IC28.RESET/*4*/) // not connected on schematic + + // -------------------------------- + // OUTPUT + NET_C(WALK_SOUND, C3.2) + + + /* ------------------------------------------------------------------------ + * CRY_SOUND + * -----------------------------------------------------------------------*/ + // INPUT + NET_C(CRY_TRG, R139.2) + + // -------------------------------- + // TRG -> CON + TTL_74123_DIP(IC33) // shared by CRY_SOUND, EMAR_SOUND + NET_C(GND, IC33.8/*GND*/) + NET_C(V5, IC33.16/*VCC*/) + LM324_DIP(IC22) // shared by CRY_SOUND, EMAR_SOUND, ANIMAL_SOUND, CRY_SOUND + NET_C(GND, IC22.11/*GND*/) + NET_C(V12, IC22.4/*VCC*/) + MA150(D2) + RES(R139, RES_K(1)) + RES(R138, RES_K(47)) + RES(R97, 470) + RES(R87, RES_K(470)) + RES(R94, RES_K(470)) + CAP(C64, CAP_U(1)) + NET_C(V5, R139.1, R138.1, R87.1) + NET_C(GND, C49.2) + NET_C(R139.2, IC33.1/*A1*/) + NET_C(V5, IC33.2/*B1*/, IC33.3/*CLRQ1*/) + NET_C(IC33.14/*C1*/, C64.1) + NET_C(IC33.15/*RC1*/, C64.2, R138.2) + NET_C(IC33.4/*QQ1*/, D2.K) + NC_(IC33.13/*Q1*/) + NET_C(D2.A, R97.1) + NET_C(R97.2, C49.1, R94.2) + NET_C(IC21.3/*PLUS1*/, R87.2, R94.1) + NET_C(IC21.1/*OUT1*/, IC21.2/*MINUS1*/, IC20.6/*CON2*/) + + // -------------------------------- + // CON, MIX -> OUT + RES(R86, RES_K(10)) + CAP(C47, CAP_U(2.2)) + CAP(C49, CAP_U(1)) + CAP(C28, CAP_P(680)) + CAP(C27, CAP_U(2.2)) + NET_C(IC21.14/*OUT4*/, R86.1) + NET_C(R86.2, C47.1) + NET_C(IC20.5/*IN2*/, C47.2) + NET_C(IC20.10/*RO2*/, C28.1) + NET_C(C28.2, GND) + NET_C(IC20.11/*OUT2*/, C27.1) + + // -------------------------------- + // UPPER STAGE -> MIDDLE STAGE + C458(TR7) + NE555(IC12) + NET_C(GND, IC12.GND/*1*/) + NET_C(V5, IC12.VCC/*8*/) + NET_C(RST, IC12.RESET/*4*/) + RES(R22, RES_K(10)) + RES(R55, RES_K(51)) + RES(R54, RES_K(220)) + RES(R56, RES_K(51)) + RES(R53, RES_K(100)) + CAP(C33, CAP_U(0.22)) + CAP(C32, CAP_U(0.22)) + CAP(C5, CAP_U(0.01)) + NET_C(TR7.B, IC12.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR7.C, R53.2) // B & C swapped, wrong in schematics + NET_C(TR7.E, GND) + NET_C(V5, R22.1) + NET_C(IC12.DISCH/*7*/, R22.2) + NET_C(IC22.14/*OUT4*/, IC12.TRIG/*2*/, IC12.THRESH/*6*/) + NET_C(IC22.14/*OUT4*/, C32.2) + NET_C(C32.1, C33.1) + NET_C(IC22.13/*MINUS4*/, R53.1, R54.2, C33.2) + NET_C(IC22.12/*PLUS4*/, R55.2, R56.1) + NET_C(R56.2, GND) + NET_C(R54.1, R55.1, V6) + NET_C(IC12.CONT/*5*/, C5.1) + NET_C(C5.2, GND) + + RES(R99, RES_K(22)) + RES(R100, RES_K(100)) + RES(R101, RES_K(15)) + RES(R102, RES_K(33)) + NET_C(IC22.14/*OUT4*/, R100.1) + NET_C(IC22.1/*OUT1*/, R102.2) + NET_C(IC22.2/*MINUS1*/, R100.2, R102.1) + NET_C(IC22.3/*PLUS1*/, R99.2, R101.1) + NET_C(R99.1, V12) + NET_C(R101.2, GND) + + // -------------------------------- + // LOWER STAGE -> MIDDLE STAGE + C458(TR6) + NE555(IC11) + NET_C(GND, IC11.GND/*1*/) + NET_C(V5, IC11.VCC/*8*/) + NET_C(RST, IC11.RESET/*4*/) + RES(R21, RES_K(10)) + RES(R49, RES_K(51)) + RES(R50, RES_K(51)) + RES(R51, RES_K(470)) + RES(R52, RES_K(5.1)) + CAP(C30, CAP_U(2.2)) + CAP(C31, CAP_U(2.2)) + CAP(C4, CAP_U(0.01)) + NET_C(TR6.B, IC11.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR6.C, R52.2) // B & C swapped, wrong in schematics + NET_C(TR6.E, GND) + NET_C(V5, R21.1) + NET_C(IC11.DISCH/*7*/, R21.2) + NET_C(IC21.8/*OUT3*/, IC11.TRIG/*2*/, IC11.THRESH/*6*/) + NET_C(IC21.9/*MINUS3*/, R52.1, R51.2, C30.2) + NET_C(C30.1, C31.1) + NET_C(IC21.8/*OUT3*/, C31.2) + NET_C(IC21.10/*PLUS3*/, R50.2, R49.1) + NET_C(R49.2, GND) + NET_C(V6, R51.1, R50.1) + NET_C(IC11.CONT/*5*/, C4.1) + NET_C(C4.2, GND) + NET_C(IC21.8/*OUT3*/, R20.1) + NET_C(IC10.CONT/*5*/, R20.2) + + // -------------------------------- + // MIDDLE STAGE -> MIX + C458(TR5) + NE555(IC10) + NET_C(GND, IC10.GND/*1*/) + NET_C(V5, IC10.VCC/*8*/) + NET_C(RST, IC10.RESET/*4*/) + RES(R19, RES_K(10)) + RES(R45, RES_K(15)) + RES(R46, RES_K(30)) + RES(R47, RES_K(51)) + RES(R48, RES_K(51)) + CAP(C29, CAP_U(0.022)) + RES(R20, RES_K(1)) + + NET_C(TR5.B, IC10.DISCH/*7*/) // B & C swapped, wrong in schematics + NET_C(TR5.C, R45.2) // B & C swapped, wrong in schematics + NET_C(TR5.E, GND) + NET_C(V5, R19.1) + NET_C(IC10.DISCH/*7*/, R19.2) + NET_C(IC21.14/*OUT4*/, IC10.TRIG/*2*/, IC10.THRESH/*6*/) + NET_C(IC21.13/*MINUS4*/, R45.1, R46.2, C29.1) + NET_C(IC21.12/*PLUS4*/, R47.2, R48.1) + NET_C(R48.2, GND) + NET_C(IC22.1/*OUT1*/, R46.1, R47.1) + NET_C(IC21.14/*OUT4*/, C29.2) + + // -------------------------------- + // UNUSED PINS + NET_C(IC10.OUT/*3*/, NC_IC10_OUT.1) // not connected in schematics + RES(NC_IC10_OUT, RES_M(1)) + NET_C(NC_IC10_OUT.2, GND) + NET_C(IC11.OUT/*3*/, NC_IC11_OUT.1) // not connected in schematics + RES(NC_IC11_OUT, RES_M(1)) + NET_C(NC_IC11_OUT.2, GND) + NET_C(IC12.OUT/*3*/, NC_IC12_OUT.1) // not connected in schematics + RES(NC_IC12_OUT, RES_M(1)) + NET_C(NC_IC12_OUT.2, GND) + + // -------------------------------- + // OUTPUT + NET_C(CRY_SOUND, C27.2) + +NETLIST_END() + + + + +static NETLIST_START(brdrline_sound_out) + LM324_DIP(IC38) // shared by HIT_SOUND, SOUND_OUT, POINT_SOUND, POINT_SOUND + NET_C(GND, IC38.11/*GND*/) + NET_C(V12, IC38.4/*VCC*/) + + POT(VR8, RES_K(200)) + POT(VR1, RES_K(200)) + POT(VR6, RES_K(200)) + POT(VR7, RES_K(200)) + POT(VR5, RES_K(500)) + POT(VR4, RES_K(200)) + POT(VR3, RES_K(200)) + POT(VR2, RES_K(200)) + + PARAM(VR1.DIAL, 0.350) // GUN_SOUND + PARAM(VR8.DIAL, 0.000) // JEEP_SOUND + PARAM(VR6.DIAL, 0.985) // POINT_SOUND + PARAM(VR7.DIAL, 0.640) // HIT_SOUND + PARAM(VR5.DIAL, 0.960) // ANIMAL_SOUND + PARAM(VR4.DIAL, 0.900) // EMAR_SOUND + PARAM(VR3.DIAL, 0.000) // WALK_SOUND + PARAM(VR2.DIAL, 0.900) // CRY_SOUND + + RES(R8, RES_K(22)) + RES(R1, RES_K(22)) + RES(R6, RES_K(22)) + RES(R7, RES_K(22)) + RES(R5, RES_K(22)) + RES(R4, RES_K(22)) + RES(R3, RES_K(22)) + RES(R2, RES_K(22)) + RES(R167, RES_K(10)) + + CAP(C76, CAP_U(10)) + + NET_C(VR8.1, VR8.2) + NET_C(VR1.1, VR1.2) + NET_C(VR6.1, VR6.2) + NET_C(VR7.1, VR7.2) + NET_C(VR5.1, VR5.2) + NET_C(VR4.1, VR4.2) + NET_C(VR3.1, VR3.2) + NET_C(VR2.1, VR2.2) + + NET_C(VR8.3, R8.1) + NET_C(VR1.3, R1.1) + NET_C(VR6.3, R6.1) + NET_C(VR7.3, R7.1) + NET_C(VR5.3, R5.1) + NET_C(VR4.3, R4.1) + NET_C(VR3.3, R3.1) + NET_C(VR2.3, R2.1) + + NET_C(R1.2, R2.2, R3.2, R4.2, R5.2, R6.2, R7.2, R8.2 + , IC38.6/*MINUS2*/ + , R167.1 + ) + NET_C(V6, IC38.5/*PLUS2*/) + NET_C(IC38.7/*OUT2*/, R167.2, C76.1) + + // -------------------------------- + // INPUT +#if (ENABLE_FRONTIERS) + // using AFUNCs here tends to remove the DC bias, so add + // it back in manually + AFUNC(JEEP_F, 1, "5+A0") + ALIAS(JEEP_SOUND, JEEP_F.A0) + NET_C(JEEP_F.Q, VR8.1) + + AFUNC(GUN_F, 1, "6+A0") + ALIAS(GUN_SOUND, GUN_F.A0) + NET_C(GUN_F.Q, VR1.1) + + AFUNC(POINT_F, 1, "6+A0") + ALIAS(POINT_SOUND, POINT_F.A0) + NET_C(POINT_F.Q, VR6.1) + + AFUNC(HIT_F, 1, "6+A0") + ALIAS(HIT_SOUND, HIT_F.A0) + NET_C(HIT_F.Q, VR7.1) + + AFUNC(ANIMAL_F, 1, "6+A0") + ALIAS(ANIMAL_SOUND, ANIMAL_F.A0) + NET_C(ANIMAL_F.Q, VR5.1) + + AFUNC(EMAR_F, 1, "6+A0") + ALIAS(EMAR_SOUND, EMAR_F.A0) + NET_C(EMAR_F.Q, VR4.1) + + AFUNC(WALK_F, 1, "A0") + ALIAS(WALK_SOUND, WALK_F.A0) + NET_C(WALK_F.Q, VR3.1) + + AFUNC(CRY_F, 1, "6+A0") + ALIAS(CRY_SOUND, CRY_F.A0) + NET_C(CRY_F.Q, VR2.1) +#else + ALIAS(JEEP_SOUND, VR8.1) + ALIAS(GUN_SOUND, VR1.1) + ALIAS(POINT_SOUND, VR6.1) + ALIAS(HIT_SOUND, VR7.1) + ALIAS(ANIMAL_SOUND, VR5.1) + ALIAS(EMAR_SOUND, VR4.1) + ALIAS(WALK_SOUND, VR3.1) + ALIAS(CRY_SOUND, VR2.1) +#endif + + // -------------------------------- + // OUTPUT + RES(Rsound, RES_K(1)) // dummy load + NET_C(C76.2, Rsound.1) + NET_C(GND, Rsound.2) +#if 0 + // for test only + AFUNC(CLIPPING, 1, "max(-0.11,min(0.11, A0))") + NET_C(C76.2, CLIPPING.A0) +#else + ALIAS(SOUND_OUT, Rsound.1) +#endif + +NETLIST_END() + + + + +NETLIST_START(brdrline) + +#if 1 + SOLVER(Solver, 1000) + PARAM(Solver.DYNAMIC_TS, 1) + PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 4e-5) +#else + SOLVER(solver, 48000) +#endif + + LOCAL_SOURCE(_MB4391) + LOCAL_SOURCE(_MB4391_DIP) + + LOCAL_SOURCE(brdrline_schematics) + LOCAL_SOURCE(brdrline_sound_out) + + // -------------------------------- + // VOLTAGE SOURCES + ANALOG_INPUT(V12, 12) + ANALOG_INPUT(V5, 5) + ANALOG_INPUT(V6, 6) + + // -------------------------------- + INCLUDE(brdrline_schematics) + + // -------------------------------- + TTL_INPUT(I_SOUND_0, 1) // active low + NET_C(GND, I_SOUND_0.GND) + NET_C(V5, I_SOUND_0.VCC) + + TTL_INPUT(I_SOUND_1, 1) // active low + NET_C(GND, I_SOUND_1.GND) + NET_C(V5, I_SOUND_1.VCC) + + TTL_INPUT(I_SOUND_2, 1) // active low + NET_C(GND, I_SOUND_2.GND) + NET_C(V5, I_SOUND_2.VCC) + + TTL_INPUT(I_SOUND_3, 1) // active low + NET_C(GND, I_SOUND_3.GND) + NET_C(V5, I_SOUND_3.VCC) + + TTL_INPUT(I_SOUND_4, 1) // active low + NET_C(GND, I_SOUND_4.GND) + NET_C(V5, I_SOUND_4.VCC) + + TTL_INPUT(I_SOUND_5, 1) // active low + NET_C(GND, I_SOUND_5.GND) + NET_C(V5, I_SOUND_5.VCC) + + TTL_INPUT(I_SOUND_6, 1) // active low + NET_C(GND, I_SOUND_6.GND) + NET_C(V5, I_SOUND_6.VCC) + + TTL_INPUT(I_SOUND_7, 1) // active low + NET_C(GND, I_SOUND_7.GND) + NET_C(V5, I_SOUND_7.VCC) + + +#if 1 + // {---(A5)Logic Board---}{-(C1/2)Top-}{-Sound Board-} + // D0 -> LS374( 3- 2) -> 40 -> PNK -> 9 -> ANIMAL_TRG + // D1 -> LS374(18-19) -> 35 -> BRN -> 12 -> CRY_TRG + // D2 -> LS374( 4- 5) -> 33 -> ORN -> 11 -> WALK_TRG + // D3 -> LS374(17-16) -> 34 -> YEL -> 10 -> EMAR_TRG + // D4 -> LS374( 7- 6) -> 32 -> BLU -> 8 -> HIT_TRG + // D5 -> LS374(14-15) -> 31 -> GRY -> 7 -> POINT_TRG + // D6 -> LS374( 8- 9) -> 30 -> WHT -> 6 -> JEEP_ON + // D7 -> LS374(13-12) -> 29 -> GRN -> 5 -> GUN_TRG + ALIAS(GUN_TRG, I_SOUND_7.Q) + ALIAS(JEEP_ON, I_SOUND_6.Q) + ALIAS(POINT_TRG, I_SOUND_5.Q) + ALIAS(HIT_TRG, I_SOUND_4.Q) + ALIAS(ANIMAL_TRG, I_SOUND_0.Q) + ALIAS(EMAR_TRG, I_SOUND_3.Q) + ALIAS(WALK_TRG, I_SOUND_2.Q) + ALIAS(CRY_TRG, I_SOUND_1.Q) +#else + /* + * 2020-10-06 by 'beta-tester' + * | | ||personal |personal | + * | | ||assignment |assignment | + * |brdrline |starrkr ||NL SOUND |plausibility |note + * ---+-------------------------+------------------++-------------+-------------+---- + * D0 | |fire, jeep_field ||POINT_TRG.IN | | + * D1 |next_sector, hit_rocket2 |hit_animal ||HIT_TRG.IN |+ | + * D2 | |fire, next_sector ||WALK_TRG.IN | | + * D3 | |fire ||CRY_TRG.IN | | + * D4 |jeep_field | ||ANIMAL_TRG.IN|+++ |see note 1 + * D5 |fire | ||GUN_TRG.IN |++ | + * D6 |jeep_path |jeep_path? ||JEEP_ON.IN |++ | + * D7 |hit_animal | ||EMAR_TRG.IN |+ | + * + * note 1: as far as i remember (from the early 1980'th) it was triggered more often while crawling through the field at sector2 & 3, + * issue in schematic/netlist? + * or trigger? + * or were the acrade what i played in the past a modified bootleg? + * or is it only in my head? + */ + ALIAS(GUN_TRG, I_SOUND_5.Q) + ALIAS(JEEP_ON, I_SOUND_6.Q) + ALIAS(POINT_TRG, I_SOUND_0.Q) + ALIAS(HIT_TRG, I_SOUND_1.Q) + ALIAS(ANIMAL_TRG, I_SOUND_4.Q) + ALIAS(EMAR_TRG, I_SOUND_7.Q) + ALIAS(WALK_TRG, I_SOUND_2.Q) + ALIAS(CRY_TRG, I_SOUND_3.Q) +#endif + + // -------------------------------- + INCLUDE(brdrline_sound_out) + + + // -------------------------------- + ALIAS(OUTPUT, SOUND_OUT) + +NETLIST_END() + + + + +#if 0 +~/mame/src/lib/netlist/devices/nld_ne555.cpp +NE555() + * +--------------+ + * .GND/*1*/ |1 ++ 8| .VCC/*8*/ + * .TRIG/*2*/ |2 7| .DISCH/*7*/ + * .OUT/*3*/ |3 6| .THRESH/*6*/ + * .RESET/*4*/ |4 NE555 5| .CONT/*5*/ + * +--------------+ +#endif + +#if 0 +~/mame/src/lib/netlist/devices/nld_74123.cpp +TTL_74123_DIP() + * +--------------+ + * .1/*A1*/ |1 ++ 16| .16/*VCC*/ + * .2/*B1*/ |2 15| .15/*RC1*/ + * .3/*CLRQ1*/ |3 14| .14/*C1*/ + * .4/*QQ1*/ |4 74123 13| .13/*Q1*/ + * .5/*Q2*/ |5 12| .12/*QQ2*/ + * .6/*C2*/ |6 11| .11/*CLRQ2*/ + * .7/*RC2*/ |7 10| .10/*B2*/ + * .8/*GND*/ |8 9| .9/*A2*/ + * +--------------+ +#endif + +#if 0 +~/mame/src/lib/netlist/macro/nlm_opamp_lib.cpp +LM324_DIP() +OPAMP(A, "LM324") + * +--------------+ + * .1/*OUT1*/ |1 ++ 14| .14/*OUT4*/ + * .2/*MINUS1*/ |2 13| .13/*MINUS4*/ + * .3/*PLUS1*/ |3 12| .12/*PLUS4*/ + * .4/*VCC*/ |4 11| .11/*GND*/ + * .5/*PLUS2*/ |5 10| .10/*PLUS3*/ + * .6/*MINUS2*/ |6 9| .9/*MINUS3*/ + * .7/*OUT2*/ |7 LM324 8| .8/*OUT3*/ + * +--------------+ +#endif + +#if 0 +WARNING: fake implementation for MB4391 based on guesses only +MB4391_DIP +MB4391(A) + * +--------------+ + * .1/*IN1*/ |1 ++ 16| .16/*VCC1*/ + * .2/*CON1*/ |2 15| .15/*OUT1*/ + * .3/*GND1*/ |3 14| .14/*RO1*/ + * |4 MB4391 13| + * .5/*IN2*/ |5 12| .12/*VCC2*/ + * .6/*CON2*/ |6 11| .11/*OUT2*/ + * .7/*GND2*/ |7 10| .10/*RO2*/ + * |8 9| + * +--------------+ +#endif + +#if 0 +~/mame/src/lib/netlist/devices/nld_7474.cpp +TTL_7474_DIP() - have to use pin numbers... why? + * +--------------+ + * .1/*CLR1*/ |1 ++ 14| .14/*VCC*/ + * .2/*D1*/ |2 13| .13/*CLR2*/ + * .3/*CLK1*/ |3 12| .12/*D2*/ + * .4/*PR1*/ |4 7474 11| .11/*CLK2*/ + * .5/*Q1*/ |5 10| .10/*PR2*/ + * .6/*QQ1*/ |6 9| .9/*Q2*/ + * .7/*GND*/ |7 8| .8/*QQ2*/ + * +--------------+ +#endif + +#if 0 +~/mame/src/lib/netlist/devices/nld_mm5837.cpp +MM5837() + * +--------------+ + * .VDD/*1*/ |1 ++ 8| .NC + * .VGG/*2*/ |2 7| .NC + * .OUT/*3*/ |3 6| .NC + * .VSS/*4*/ |4 MM5837 5| .NC + * +--------------+ +#endif + +#if 0 +~/mame/src/lib/netlist/macro/nlm_ttl74xx_lib.cpp +TTL_7408_DIP() +TTL_7408_AND(A) + * +--------------+ + * .1/*A1*/ |1 ++ 14| .14/*VCC*/ + * .2/*B1*/ |2 13| .13/*B4*/ + * .3/*Q1*/ |3 12| .12/*A4*/ + * .4/*A2*/ |4 7408 11| .11/*Q4*/ + * .5/*B2*/ |5 10| .10/*B3*/ + * .6/*Q2*/ |6 9| .9/*A3*/ + * .7/*GND*/ |7 8| .8/*Q3*/ + * +--------------+ +#endif + +#if 0 +TTL_7416_DIP() +TTL_7416_GATE(A) + * +--------------+ + * .1/*A1*/ |1 ++ 14| .14/*VCC*/ + * .2/*Q1*/ |2 13| .13/*A6*/ + * .3/*A2*/ |3 12| .12/*Q6*/ + * .4/*Q2*/ |4 7416 11| .11/*A5*/ + * .5/*A3*/ |5 10| .10/*Q5*/ + * .6/*Q3*/ |6 9| .9/*A4*/ + * .7/*GND*/ |7 8| .8/*Q4*/ + * +--------------+ +#endif + diff --git a/src/mame/audio/nl_brdrline.h b/src/mame/audio/nl_brdrline.h new file mode 100644 index 00000000000..66317699377 --- /dev/null +++ b/src/mame/audio/nl_brdrline.h @@ -0,0 +1,11 @@ +// license:CC0 +// copyright-holders: beta-tester (https://github.com/beta-tester) + +#ifndef MAME_AUDIO_NL_BRDRLINE_H +#define MAME_AUDIO_NL_BRDRLINE_H + +#pragma once + +NETLIST_EXTERNAL(brdrline) + +#endif // MAME_AUDIO_NL_BRDRLINE_H diff --git a/src/mame/audio/nl_frogs.cpp b/src/mame/audio/nl_frogs.cpp new file mode 100644 index 00000000000..dc9ebe90a84 --- /dev/null +++ b/src/mame/audio/nl_frogs.cpp @@ -0,0 +1,567 @@ +// license:CC0 +// copyright-holders:Aaron Giles + +// +// Netlist for Frogs +// +// Derived from the schematics in the Frogs manual. +// +// Known problems/issues: +// +// * Croak sound should have a little bit more tonality. +// +// * Performance work needed +// + +#include "netlist/devices/net_lib.h" +#include "nl_frogs.h" + + +// +// Optimizations +// + +#define ENABLE_FRONTIERS (1) +#define UNDERCLOCK_NOISE_GEN (1) + + + +// +// Hacks +// + + + +// +// Main netlist +// + +#define D_1N914(name) DIODE(name, "1N914") + +#define Q_2N4401(name) QBJT_EB(name, "2N4401") +#define Q_2N4403(name) QBJT_EB(name, "2N4403") + +// JFET transistors not supported, but this should do the trick +#define Q_2N4093(name) MOSFET(name, "NMOS(VTO=-1 CAPMOD=0)") + +#define LM741_DIP UA741_DIP8 + +NETLIST_START(frogs) + + SOLVER(Solver, 1000) + PARAM(Solver.DYNAMIC_TS, 1) + PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 4e-6) + + TTL_INPUT(I_SOUND_0, 0) + TTL_INPUT(I_SOUND_1, 0) + TTL_INPUT(I_SOUND_2, 0) + TTL_INPUT(I_SOUND_3, 0) + TTL_INPUT(I_SOUND_4, 0) + TTL_INPUT(I_SOUND_5, 0) + TTL_INPUT(I_SOUND_6, 0) + TTL_INPUT(I_SOUND_7, 0) + + NET_C(GND, I_SOUND_0.GND, I_SOUND_1.GND, I_SOUND_2.GND, I_SOUND_3.GND, I_SOUND_4.GND, I_SOUND_5.GND, I_SOUND_6.GND, I_SOUND_7.GND) + NET_C(I_V5, I_SOUND_0.VCC, I_SOUND_1.VCC, I_SOUND_2.VCC, I_SOUND_3.VCC, I_SOUND_4.VCC, I_SOUND_5.VCC, I_SOUND_6.VCC, I_SOUND_7.VCC) + + ALIAS(I_HOP, I_SOUND_0) + ALIAS(I_JUMP, I_SOUND_1) + ALIAS(I_TONGUE, I_SOUND_2) + ALIAS(I_CAPTURE, I_SOUND_3) + ALIAS(I_FLY, I_SOUND_4) + ALIAS(I_SPLASH, I_SOUND_7) + + ANALOG_INPUT(I_V5, 5) + ANALOG_INPUT(I_V12, 12) + ANALOG_INPUT(I_VM12, -12) + + RES(R1, RES_K(3.3)) // SPLASH + RES(R2, RES_K(3.3)) // SPLASH + RES(R3, RES_K(3.3)) // CAPTURE + RES(R4, RES_K(3.3)) // CAPTURE + RES(R5, RES_K(3.3)) // TONGUE + RES(R6, RES_K(3.3)) // TONGUE + RES(R7, RES_K(3.3)) // HOP + RES(R8, RES_K(3.3)) // HOP + RES(R9, RES_K(3.3)) // JUMP + RES(R10, RES_K(3.3)) // JUMP + RES(R11, RES_K(3.3)) // FLY + RES(R12, RES_K(10)) // FLY + RES(R13, RES_K(10)) // SPLASH + RES(R14, RES_K(4.7)) // SPLASH + RES(R15, RES_K(100)) // SPLASH + RES(R16, RES_K(4.7)) // CAPTURE + RES(R17, RES_K(330)) // CAPTURE + RES(R18, RES_K(4.7)) // TONGUE + RES(R19, RES_K(100)) // TONGUE + RES(R20, RES_K(4.7)) // HOP + RES(R21, RES_K(3.3)) // HOP + RES(R22, RES_K(4.7)) // JUMP + RES(R23, RES_K(150)) // JUMP + RES(R24, RES_K(4.7)) // FLY + RES(R25, RES_K(22)) // SPLASH + RES(R26, 51) // HOP + RES(R27, RES_K(10)) // FLY + RES(R28, RES_K(22)) // TONGUE + RES(R29, RES_K(100)) // TONGUE + RES(R30, RES_K(470)) // HOP + RES(R31, 220) // HOP + RES(R32, RES_K(33)) // HOP (mislabelled R22) + RES(R33, 330) // JUMP + RES(R34, 820) // JUMP + RES(R35, RES_K(100)) // FLY + RES(R36, RES_K(2.2)) // FLY + RES(R37, RES_K(2.2)) // SPLASH + RES(R38, RES_K(10)) // SPLASH + RES(R39, RES_K(10)) // SPLASH + RES(R40, RES_K(68)) // CAPTURE + RES(R41, RES_K(4.7)) // CAPTURE + RES(R42, RES_K(1)) // TONGUE + RES(R43, RES_K(82)) // HOP + RES(R44, RES_K(3.3)) // FLY + RES(R45, RES_K(100)) // FLY + RES(R46, RES_K(3.3)) // FLY + POT(R47, RES_K(50)) // SPLASH + RES(R48, RES_K(47)) // CAPTURE + RES(R49, RES_K(3.3)) // CAPTURE + RES(R50, RES_K(100)) // CAPTURE + RES(R51, RES_K(39)) // TONGUE + RES(R52, 51) // HOP + RES(R53, RES_K(62)) + RES(R54, 470) // JUMP + RES(R55, RES_K(22)) // JUMP + RES(R56, RES_M(2.2)) // JUMP + RES(R57, RES_K(22)) + RES(R58, RES_K(22)) + RES(R59, RES_K(3.3)) // FLY +// RES(R60, RES_K(10)) -- final amp + RES(R61, RES_K(100)) // SPLASH + RES(R62, RES_K(47)) // SPLASH + RES(R63, RES_K(33)) // SPLASH + RES(R64, RES_K(820)) // CAPTURE + RES(R65, RES_K(150)) // CAPTURE + RES(R66, 51) // CAPTURE + RES(R67, 51) // CAPTURE + RES(R68, RES_K(1)) // JUMP + RES(R69, RES_K(82)) // JUMP + RES(R70, 51) // JUMP + RES(R71, RES_K(4.7)) // JUMP + RES(R72, RES_K(27)) // FLY + RES(R73, RES_K(10)) // FLY + RES(R74, RES_K(1)) // FLY + RES(R75, RES_K(10)) // JUMP + RES(R76, RES_K(10)) // JUMP + RES(R77, 560) // JUMP + RES(R78, RES_K(10)) // JUMP + RES(R79, RES_K(10)) // JUMP + RES(R80, RES_K(39)) // FLY + RES(R81, RES_K(100)) // FLY + RES(R82, RES_K(10)) // FLY + RES(R83, RES_K(100)) // JUMP + RES(R84, RES_K(1)) // JUMP + RES(R85, RES_K(10)) // JUMP + RES(R86, RES_K(1)) // FLY + RES(R87, RES_K(100)) // FLY + RES(R88, RES_K(82)) // FLY + RES(R90, RES_K(56)) // MIXER + POT(R91, RES_K(100)) + POT(R92, RES_M(1)) + POT(R93, RES_M(1)) + POT(R94, RES_M(1)) + POT(R95, RES_M(1)) + POT(R96, RES_K(50)) + +// CAP(C1, CAP_U(10)) +// CAP(C2, CAP_U(10)) + CAP(C3, CAP_U(0.047)) + CAP(C4, CAP_U(1)) + CAP(C5, CAP_U(1)) + CAP(C6, CAP_U(0.1)) + CAP(C7, CAP_U(0.1)) + CAP(C8, CAP_U(1)) + CAP(C9, CAP_U(0.1)) + CAP(C10, CAP_U(0.1)) + CAP(C11, CAP_U(0.05)) + CAP(C12, CAP_U(0.05)) + CAP(C13, CAP_U(0.05)) + CAP(C14, CAP_U(0.05)) + CAP(C15, CAP_U(0.05)) + CAP(C16, CAP_U(0.05)) + CAP(C17, CAP_U(0.05)) + CAP(C18, CAP_U(0.05)) + CAP(C19, CAP_U(0.05)) + CAP(C20, CAP_U(0.05)) + CAP(C21, CAP_U(0.05)) + CAP(C22, CAP_U(2.2)) + CAP(C23, CAP_U(10)) + CAP(C24, CAP_U(0.1)) + CAP(C25, CAP_U(4.7)) + CAP(C26, CAP_U(0.05)) + CAP(C27, CAP_U(1)) + CAP(C28, CAP_U(0.05)) + CAP(C29, CAP_U(0.047)) + CAP(C30, CAP_U(10)) + CAP(C31, CAP_U(0.47)) + CAP(C32, CAP_U(0.47)) + CAP(C33, CAP_U(0.05)) +// CAP(C34, CAP_U(0.05)) -- final amp +// CAP(C35, CAP_U(0.05)) -- final amp + CAP(C36, CAP_U(0.05)) + CAP(C37, CAP_U(0.05)) + CAP(C38, CAP_U(0.05)) + CAP(C39, CAP_U(0.1)) + CAP(C40, CAP_U(0.1)) + CAP(C41, CAP_U(0.05)) + CAP(C42, CAP_U(0.05)) + CAP(C43, CAP_U(0.05)) + CAP(C44, CAP_U(10)) + CAP(C45, CAP_U(0.01)) + CAP(C46, CAP_U(0.01)) + CAP(C47, CAP_U(1)) + CAP(C48, CAP_U(0.05)) + CAP(C49, CAP_U(0.1)) + CAP(C50, CAP_U(0.01)) + CAP(C51, CAP_U(0.01)) + CAP(C52, CAP_U(0.1)) + CAP(C53, CAP_U(0.05)) + CAP(C54, CAP_U(0.01)) + CAP(C55, CAP_U(0.05)) + CAP(C56, CAP_U(0.05)) + CAP(C57, CAP_U(2.2)) +// CAP(C58, CAP_U(0.1)) -- final amp + CAP(C59, CAP_U(0.05)) + CAP(C60, CAP_U(0.05)) + CAP(C61, CAP_U(0.05)) + CAP(C62, CAP_U(0.1)) + CAP(C63, CAP_U(0.05)) + CAP(C64, CAP_U(0.05)) + CAP(C65, CAP_U(0.1)) + CAP(C66, CAP_U(2.2)) + CAP(C67, CAP_U(0.05)) + CAP(C68, CAP_U(0.05)) + CAP(C69, CAP_U(0.05)) + CAP(C70, CAP_U(0.05)) + CAP(C71, CAP_U(0.05)) + CAP(C72, CAP_U(1)) + CAP(C73, CAP_U(0.047)) + CAP(C74, CAP_U(0.05)) + + D_1N914(D1) + D_1N914(D2) + D_1N914(D3) + D_1N914(D4) + D_1N914(D5) + D_1N914(D6) + D_1N914(D7) + D_1N914(D8) + D_1N914(D9) + + Q_2N4401(Q1) + Q_2N4401(Q2) + Q_2N4401(Q3) + Q_2N4401(Q4) + Q_2N4401(Q5) + Q_2N4401(Q6) + Q_2N4401(Q7) + Q_2N4403(Q8) + Q_2N4403(Q9) + Q_2N4093(Q10) + Q_2N4401(Q11) + Q_2N4401(Q12) + Q_2N4403(Q13) + Q_2N4401(Q14) + Q_2N4403(Q15) + Q_2N4401(Q16) + Q_2N4403(Q17) + Q_2N4093(Q18) + Q_2N4401(Q19) + Q_2N4401(Q20) + Q_2N4401(Q21) + + MM5837_DIP(U1) // Noise Generator +#if (UNDERCLOCK_NOISE_GEN) + PARAM(U1.FREQ, 24000) +#endif + NE555_DIP(U2) // Timer + NE555_DIP(U3) // Timer + NE555_DIP(U4) // Timer + NE555_DIP(U5) // Timer + NE555_DIP(U6) // Timer + NE555_DIP(U7) // Timer + LM741_DIP(U8) // Op. Amp. + NE555_DIP(U9) // Timer + LM741_DIP(U10) // Op. Amp. + LM741_DIP(U11) // Op. Amp. + NE555_DIP(U12) // Timer +// LM741_DIP(U13) // Op. Amp. -- final amp + LM741_DIP(U14) // Op. Amp. + NE555_DIP(U15) // Timer + LM741_DIP(U16) // Op. Amp. + LM741_DIP(U17) // Op. Amp. + LM741_DIP(U18) // Op. Amp. + NE555_DIP(U19) // Timer + LM741_DIP(U20) // Op. Amp. + + // + // JUMP + // + + NET_C(I_V12, R22.2, U6.4, U6.8, C68.2, R23.2) + NET_C(GND, R10.1, Q2.E, C15.1, U6.1, C7.1, R34.1, U11.3, C71.1, C70.1, R54.1, Q19.B, D7.A, R84.1, R75.1, C64.1, R77.1, U19.1, C53.1, C52.1, U16.3) + NET_C(I_JUMP, R9.1) + NET_C(R9.2, R10.2, Q2.B) + NET_C(Q2.C, R22.1, U6.2) + NET_C(C15.2, U6.5) + NET_C(C68.1, GND) + NET_C(R23.1, U6.7, U6.6, C7.2) + NET_C(U6.3, C22.1, R33.1) + NET_C(R33.2, Q8.E) + NET_C(Q8.B, GND) + NET_C(Q8.C, C44.1, R57.1) + NET_C(C44.2, R70.1) + NET_C(R57.2, R58.2, Q16.B) + NET_C(Q16.E, R71.2) + NET_C(R71.1, R58.1, R70.2, I_VM12) + NET_C(R34.2, C22.2, C32.1, C31.1) + NET_C(C32.2, R56.1, U11.2) + NET_C(R56.2, C31.2, U11.6, R55.1) + NET_C(I_V12, C70.2, U11.7) + NET_C(I_VM12, U11.4, C71.2) + NET_C(R55.2, R54.2, Q21.B) + NET_C(Q21.E, D7.K, Q16.C) + NET_C(Q19.E, Q21.C, Q20.E) + NET_C(Q19.C, R76.1, R85.1, U20.2) + NET_C(I_V12, R76.2, R78.2) + NET_C(R78.1, Q20.C, U20.3, R75.2) + NET_C(Q20.B, R84.2, R83.1) + NET_C(R85.2, U20.6, R79.1) + NET_C(I_V12, U20.7, C63.2) + NET_C(C63.1, GND) + NET_C(I_VM12, U20.4, C64.2) + NET_C(R83.2, C62.1) + NET_C(R79.2, R77.2, C54.1, C51.1) + NET_C(C62.2, U19.3) + NET_C(I_V12, U19.4, C61.2, U19.8, R68.2) + NET_C(C61.1, GND) + NET_C(C53.2, U19.5) + NET_C(U19.2, U19.6, R69.1, C52.2) + NET_C(U19.7, R69.2, R68.1) + NET_C(C54.2, U16.2, R53.1) + NET_C(R53.2, U16.6, C51.2) + NET_C(I_V12, U16.7, C42.2) + NET_C(C42.1, GND) + NET_C(I_VM12, U16.4, C43.2) + NET_C(C43.1, GND) + ALIAS(BOING, U16.6) + + // + // TONGUE + // + + NET_C(I_V12, C20.2, R18.2, U4.4, U4.8, R19.2, Q11.C, R28.2, R42.2, U15.4, U15.8, C48.2) + NET_C(GND, R6.1, Q4.E, C13.1, U4.1, C5.2, R51.1, C49.1, U15.1, C41.1, C48.1) + NET_C(I_TONGUE, R5.1) + NET_C(R5.2, R6.2, Q4.B) + NET_C(C20.1, GND) + NET_C(Q4.C, R18.1, U4.2) + NET_C(C13.2, U4.5) + NET_C(C5.1, U4.7, U4.6, R19.1, R29.1) + RES(RU4, RES_K(100)) // netlist doesn't like unconnected + NET_C(RU4.1, U4.3) // 555 outputs, so run it through + NET_C(RU4.2, GND) // a 100k resistor to ground + NET_C(R29.2, Q11.B) + NET_C(Q11.E, Q12.B) + NET_C(Q12.E, R51.2) + NET_C(Q12.C, R28.1, Q13.B) + NET_C(Q13.E, R42.1) + NET_C(Q13.C, C49.2, U15.2, U15.6, U15.7, C50.1) + NET_C(U15.5, C41.2) + RES(RU15, RES_K(100)) // netlist doesn't like unconnected + NET_C(RU15.1, U15.3) // 555 outputs, so run it through + NET_C(RU15.2, GND) // a 100k resistor to ground + ALIAS(ZIP, C50.2) + + // + // HOP + // + + NET_C(I_V12, C69.2, R20.2, U5.4, U5.8, R21.2) + NET_C(GND, R8.1, Q3.E, C14.1, U5.1, C6.1, C30.2, Q9.B, R52.1, U10.3) + NET_C(I_HOP, R7.1) + NET_C(R7.2, R8.2, Q3.B) + NET_C(C69.1, GND) + NET_C(Q3.C, R20.1, U5.2) + NET_C(U5.5, C14.2) + NET_C(R21.1, U5.6, U5.7, C6.2) + NET_C(U5.3, D2.A, R31.1) + NET_C(D2.K, R32.2, C30.1) + NET_C(R32.1, Q9.E) + NET_C(Q9.C, C72.1, R43.2, Q10.G) + NET_C(C72.2, R26.2) + NET_C(I_VM12, R26.1, R43.1) + NET_C(R31.2, Q10.D, C29.1, C73.1) + NET_C(Q10.S, R52.2) + NET_C(C29.2, U10.2, R30.1) + NET_C(C73.2, R30.2, U10.6) + NET_C(I_V12, U10.7, C28.2) + NET_C(I_VM12, U10.4, C21.2) + NET_C(C21.1, GND) + NET_C(C28.1, GND) + ALIAS(HOP, U10.6) + + // + // CAPTURE + // + + NET_C(I_V12, R16.2, C18.2, U3.4, U3.8, R17.2, C74.2, U9.8, R41.2) + NET_C(GND, R4.1, Q5.E, C12.1, U3.1, C4.2, C19.1, U9.1, C27.2, R65.1, Q17.B, R66.1, U8.3, C18.1) + NET_C(I_CAPTURE, R3.1) + NET_C(R3.2, R4.2, Q5.B) + NET_C(Q5.C, R16.1, U3.2) + NET_C(U3.5, C12.2) + NET_C(R17.1, U3.6, U3.7, C4.1) + NET_C(U3.3, U9.4) + NET_C(C74.1, GND) + NET_C(C19.2, U9.5) + NET_C(R41.1, R48.2, D4.A, U9.7) + NET_C(U9.2, U9.6, R48.1, D4.K, C27.1) + NET_C(U9.3, R50.2, R49.1) + NET_C(R65.2, R64.2, C47.1, Q17.C, Q18.G) + NET_C(I_VM12, R64.1, R67.1) + NET_C(R67.2, C47.2) + NET_C(R50.1, Q17.E) + NET_C(R49.2, Q18.D, C39.1, C40.1) + NET_C(Q18.S, R66.2) + NET_C(C39.2, R40.1, U8.2) + NET_C(C40.2, R40.2, U8.6) + NET_C(I_V12, U8.7, C38.2) + NET_C(C38.1, GND) + NET_C(I_VM12, U8.4, C26.2) + NET_C(C26.1, GND) + ALIAS(CROAK, U8.6) + + // + // SPLASH + // + + NET_C(I_V12, R14.2, C17.2, U2.4, U2.8, R15.2, C25.1, R47.3, Q15.E, U1.4) + NET_C(GND, R2.1, Q6.E, C11.1, U2.1, C3.1, R38.1, Q14.E, U1.1, R62.1, R63.1, C37.1) + NET_C(I_SPLASH, R1.1) + NET_C(R1.2, R2.2, Q6.B) + NET_C(Q6.C, R14.1, U2.2) + NET_C(U2.5, C11.2) + NET_C(C17.1, GND) + NET_C(U2.6, U2.7, R15.1, C3.2) + NET_C(U2.3, R39.1) + NET_C(R39.2, R38.2, Q14.B) + NET_C(Q14.C, R37.1) + NET_C(R37.2, C25.2, R47.1, R25.1) + NET_C(R25.2, C10.1, R13.2, C9.1) + NET_C(Q15.C, C10.2) + NET_C(R13.1, D1.K) + NET_C(D1.A, D5.K) + NET_C(D5.A, U1.3) + NET_C(U1.2, I_VM12) + NET_C(C9.2, R63.2, U14.3) + NET_C(R62.2, U14.2, R61.1) + NET_C(R61.2, U14.6) + NET_C(I_V12, U14.7, C36.2) + NET_C(C36.1, GND) + NET_C(I_VM12, C37.2, U14.4) + ALIAS(SPLASH, U14.6) + + // + // FLY + // + + NET_C(I_V12, R12.2, R24.2, C67.2, U7.8, R35.2, C33.2, U12.8, R44.2, U17.7, C55.2, R87.2) + NET_C(GND, R11.1, C16.1, U7.1, C8.2, Q7.E, C23.2, U12.1, C24.1, R72.1, C56.1, R74.1, R88.1, C66.2, R86.1, U18.3, C60.1) + NET_C(I_FLY, Q1.E) + NET_C(R11.2, R12.1, Q1.B) + NET_C(Q1.C, R24.1, U7.2, U7.4, U12.4) + NET_C(C16.2, U7.5) + NET_C(C67.1, GND) + NET_C(R35.1, U7.6, U7.7, C8.1) + NET_C(U7.3, R27.1, D3.A) + NET_C(R27.2, Q7.B) + NET_C(Q7.C, R36.1) + NET_C(R36.2, C23.1, U12.5) + NET_C(C33.1, GND) + NET_C(U12.2, U12.6, D6.K, R45.1, C24.2) + NET_C(U12.7, D6.A, R45.2, R44.1) + NET_C(U12.3, C46.1) + NET_C(C46.2, C45.1, R59.1) + NET_C(C45.2, R72.2, U17.3) + NET_C(R59.2, U17.2, U17.6, C57.1) + NET_C(I_VM12, U17.4, C56.2) + NET_C(C55.1, GND) + NET_C(C57.2, R73.1) + NET_C(D3.K, R46.1) + NET_C(R46.2, R87.1, R80.2, R88.2, C66.1) + NET_C(R73.2, R74.2, D8.K) + NET_C(D8.A, R80.1, D9.A) + NET_C(D9.K, R86.2, C65.1) + NET_C(C65.2, R82.1) + NET_C(R82.2, U18.2, R81.1) + NET_C(R81.2, U18.6) + NET_C(I_V12, U18.7, C59.2) + NET_C(I_VM12, U18.4, C60.2) + NET_C(C59.1, GND) + ALIAS(BUZZZ, U18.6) + + // + // Mixer + // + +#if (ENABLE_FRONTIERS) + AFUNC(BOING_F, 1, "A0") + NET_C(BOING, BOING_F.A0) + NET_C(BOING_F.Q, R95.1) + + AFUNC(ZIP_F, 1, "A0") + NET_C(ZIP, ZIP_F.A0) + NET_C(ZIP_F.Q, R93.1) + + AFUNC(HOP_F, 1, "A0") + NET_C(HOP, HOP_F.A0) + NET_C(HOP_F.Q, R94.1) + + AFUNC(CROAK_F, 1, "A0") + NET_C(CROAK, CROAK_F.A0) + NET_C(CROAK_F.Q, R92.1) + + AFUNC(SPLASH_F, 1, "A0") + NET_C(SPLASH, SPLASH_F.A0) + NET_C(SPLASH_F.Q, R91.1) + + AFUNC(BUZZZ_F, 1, "A0") + NET_C(BUZZZ, BUZZZ_F.A0) + NET_C(BUZZZ_F.Q, R96.1) +#else + NET_C(BOING, R95.1) + NET_C(ZIP, R93.1) + NET_C(HOP, R94.1) + NET_C(CROAK, R92.1) + NET_C(SPLASH, R91.1) + NET_C(BUZZZ, R96.1) +#endif + + NET_C(R95.3, R93.3, R94.3, R92.3, R91.3, R96.3, R90.1) + ALIAS(OUTPUT, R90.1) + NET_C(R90.2, GND) + + // + // Unconnected inputs + // + + + // + // Unconnected outputs + // + +#if (ENABLE_FRONTIERS) +#define RXX 192 + OPTIMIZE_FRONTIER(BOING, RES_M(1), RXX) +#endif + +NETLIST_END() diff --git a/src/mame/audio/nl_frogs.h b/src/mame/audio/nl_frogs.h new file mode 100644 index 00000000000..c1a2cedc56b --- /dev/null +++ b/src/mame/audio/nl_frogs.h @@ -0,0 +1,10 @@ +// license:CC0 +// copyright-holders:Aaron Giles +#ifndef MAME_AUDIO_NL_FROGS_H +#define MAME_AUDIO_NL_FROGS_H + +#pragma once + +NETLIST_EXTERNAL(frogs) + +#endif // MAME_AUDIO_NL_FROGS_H diff --git a/src/mame/audio/nl_ripoff.cpp b/src/mame/audio/nl_ripoff.cpp index 84ccfea212a..60e525cb615 100644 --- a/src/mame/audio/nl_ripoff.cpp +++ b/src/mame/audio/nl_ripoff.cpp @@ -239,9 +239,15 @@ NETLIST_START(ripoff) Q_2N3906(Q5) // PNP // Q_2N6292(Q6) // PNP -- part of final amp (not emulated) // Q_2N6107(Q7) // PNP -- part of final amp (not emulated) +#if !(HLE_LASER_VCO) Q_2N3904(Q8) // NPN +#endif +#if !(HLE_TORPEDO_VCO) Q_2N3904(Q9) // NPN +#endif +#if !(HLE_BACKGROUND_VCOS) Q_2N3904(Q10) // NPN +#endif AMI_S2688(IC1) // Noise generator diff --git a/src/mame/audio/nl_solarq.cpp b/src/mame/audio/nl_solarq.cpp index be6ef4bca6f..ec7795e1cfa 100644 --- a/src/mame/audio/nl_solarq.cpp +++ b/src/mame/audio/nl_solarq.cpp @@ -298,7 +298,9 @@ NETLIST_START(solarq) Q_2N3906(Q10) // PNP Q_2N3906(Q11) // PNP Q_2N3904(Q12) // NPN +#if !(HLE_CAPTURE_VCO) Q_2N3904(Q13) // NPN +#endif Q_2N3906(Q14) // PNP Q_2N3906(Q15) // PNP Q_2N3906(Q16) // PNP diff --git a/src/mame/audio/nl_spacewar.cpp b/src/mame/audio/nl_spacewar.cpp index 778906b31ad..1d1d9e7df40 100644 --- a/src/mame/audio/nl_spacewar.cpp +++ b/src/mame/audio/nl_spacewar.cpp @@ -128,11 +128,13 @@ NETLIST_START(spacewar) D_1N914(CR5) D_1N914(CR6) +#if !(HLE_NOISE_GEN) Q_2N3906(Q1) // PNP Q_2N3904(Q2) // NPN +#endif Q_2N6426(Q3) // NPN Darlington - Q_2N6292(Q4) // NPN - Q_2N6107(Q5) // PNP +// Q_2N6292(Q4) // NPN -- not used +// Q_2N6107(Q5) // PNP -- not used Q_2N6426(Q6) // NPN Darlington Q_2N3904(Q7) // NPN diff --git a/src/mame/audio/nl_starcas.cpp b/src/mame/audio/nl_starcas.cpp index fd6dee8d968..1792217fd01 100644 --- a/src/mame/audio/nl_starcas.cpp +++ b/src/mame/audio/nl_starcas.cpp @@ -281,11 +281,15 @@ NETLIST_START(wotw) D_1N914B(D9) D_1N914B(D10) +#if !(HLE_BACKGROUND_VCO) Q_2N3904(Q1) // NPN +#endif Q_2N3904(Q2) // NPN Q_2N3906(Q3) // PNP Q_2N3904(Q4) // NPN +#if !(HLE_LASER_VCO) Q_2N3904(Q5) // NPN +#endif Q_2N3906(Q6) // PNP Q_2N3906(Q7) // PNP Q_2N3906(Q8) // PNP diff --git a/src/mame/audio/nl_tailg.cpp b/src/mame/audio/nl_tailg.cpp index fab4b88bf9c..63c01ae4cf7 100644 --- a/src/mame/audio/nl_tailg.cpp +++ b/src/mame/audio/nl_tailg.cpp @@ -204,8 +204,8 @@ NETLIST_START(tailg) D_1N914(D8) D_1N914(D9) - Q_2N3904(Q1) // NPN - Q_2N3904(Q2) // NPN +// Q_2N3904(Q1) // NPN -- not used +// Q_2N3904(Q2) // NPN -- not used Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP Q_2N3906(Q5) // PNP diff --git a/src/mame/audio/nl_warrior.cpp b/src/mame/audio/nl_warrior.cpp index d5403559420..cd439d0fff4 100644 --- a/src/mame/audio/nl_warrior.cpp +++ b/src/mame/audio/nl_warrior.cpp @@ -168,7 +168,9 @@ NETLIST_START(warrior) Q_2N3906(Q2) // PNP Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP +#if !(HLE_PITFALL_VCO) Q_2N3904(Q5) // NPN +#endif // Q_2N5878(Q6) // NPN -- part of final amp (not emulated) // Q_2N5876(Q7) // PNP -- part of final amp (not emulated) diff --git a/src/mame/audio/phoenix.cpp b/src/mame/audio/phoenix.cpp index 7c43519c186..772f4bb889a 100644 --- a/src/mame/audio/phoenix.cpp +++ b/src/mame/audio/phoenix.cpp @@ -89,7 +89,7 @@ void phoenix_sound_device::device_start() m_poly18[i] = bits; } - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); save_item(NAME(m_sound_latch_a)); save_item(NAME(m_c24_state.counter)); @@ -101,7 +101,6 @@ void phoenix_sound_device::device_start() save_item(NAME(m_noise_state.polyoffs)); save_item(NAME(m_noise_state.lowpass_counter)); save_item(NAME(m_noise_state.lowpass_polybit)); - save_pointer(NAME(m_poly18), (1ul << (18-5))); } int phoenix_sound_device::update_c24(int samplerate) @@ -520,18 +519,18 @@ void phoenix_sound_device::control_b_w(uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void phoenix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void phoenix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int samplerate = machine().sample_rate(); - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; + int samplerate = buffer.sample_rate(); - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = 0; sum = noise(samplerate) / 2; - *buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767; + buffer.put_int_clamp(sampindex, sum, 32768); } } diff --git a/src/mame/audio/phoenix.h b/src/mame/audio/phoenix.h index 6a02220c30e..30e6edfef10 100644 --- a/src/mame/audio/phoenix.h +++ b/src/mame/audio/phoenix.h @@ -22,7 +22,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct c_state @@ -46,7 +46,7 @@ private: struct n_state m_noise_state; uint8_t m_sound_latch_a; sound_stream * m_channel; - std::unique_ptr<uint32_t[]> m_poly18; + std::unique_ptr<uint32_t[]> m_poly18; required_device<discrete_device> m_discrete; required_device<tms36xx_device> m_tms; diff --git a/src/mame/audio/pleiads.cpp b/src/mame/audio/pleiads.cpp index ee69320e7d6..965b445f67a 100644 --- a/src/mame/audio/pleiads.cpp +++ b/src/mame/audio/pleiads.cpp @@ -642,7 +642,7 @@ void pleiads_sound_device::common_start() m_poly18[i] = bits; } - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); save_item(NAME(m_sound_latch_a)); save_item(NAME(m_sound_latch_b)); @@ -691,27 +691,27 @@ void pleiads_sound_device::common_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void pleiads_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void pleiads_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int rate = machine().sample_rate(); - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; + int rate = buffer.sample_rate(); - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate); - *buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767; + buffer.put_int_clamp(sampindex, sum, 32768); } } -void naughtyb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void naughtyb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples); + pleiads_sound_device::sound_stream_update(stream, inputs, outputs); } -void popflame_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void popflame_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples); + pleiads_sound_device::sound_stream_update(stream, inputs, outputs); } diff --git a/src/mame/audio/pleiads.h b/src/mame/audio/pleiads.h index 0c4ef99b4a9..9dd77f6e857 100644 --- a/src/mame/audio/pleiads.h +++ b/src/mame/audio/pleiads.h @@ -51,7 +51,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void common_start(); inline int tone1(int samplerate); @@ -105,7 +105,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; @@ -119,7 +119,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; diff --git a/src/mame/audio/polepos.cpp b/src/mame/audio/polepos.cpp index 48865d300e0..a1dd8bc24dc 100644 --- a/src/mame/audio/polepos.cpp +++ b/src/mame/audio/polepos.cpp @@ -225,7 +225,7 @@ polepos_sound_device::polepos_sound_device(const machine_config &mconfig, const void polepos_sound_device::device_start() { - m_stream = stream_alloc_legacy(0, 1, OUTPUT_RATE); + m_stream = stream_alloc(0, 1, OUTPUT_RATE); m_sample_msb = m_sample_lsb = 0; m_sample_enable = 0; @@ -251,21 +251,21 @@ void polepos_sound_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void polepos_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint32_t step, clock, slot; uint8_t *base; double volume, i_total; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; int loop; /* if we're not enabled, just fill with 0 */ if (!m_sample_enable) { - memset(buffer, 0, samples * sizeof(*buffer)); + buffer.fill(0); return; } @@ -279,7 +279,7 @@ void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stre base = &machine().root_device().memregion("engine")->base()[slot * 0x800]; /* fill in the sample */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { m_filter_engine[0].x0 = (3.4 / 255 * base[(m_current_position >> 12) & 0x7ff] - 2) * volume; m_filter_engine[1].x0 = m_filter_engine[0].x0; @@ -296,9 +296,9 @@ void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stre i_total += m_filter_engine[loop].y0 / r_filt_out[loop]; } - i_total *= r_filt_total * 32000/2; /* now contains voltage adjusted by final gain */ + i_total *= r_filt_total/2; /* now contains voltage adjusted by final gain */ - *buffer++ = (int)i_total; + buffer.put(sampindex, i_total); m_current_position += step; } } diff --git a/src/mame/audio/polepos.h b/src/mame/audio/polepos.h index 430078088b2..b8611218284 100644 --- a/src/mame/audio/polepos.h +++ b/src/mame/audio/polepos.h @@ -19,7 +19,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: DECLARE_WRITE_LINE_MEMBER(clson_w); diff --git a/src/mame/audio/redbaron.cpp b/src/mame/audio/redbaron.cpp index c08036c7d3b..51586a809fd 100644 --- a/src/mame/audio/redbaron.cpp +++ b/src/mame/audio/redbaron.cpp @@ -102,19 +102,19 @@ void redbaron_sound_device::device_start() m_vol_crash[i] = 32767 * r0 / (r0 + r1); } - m_channel = stream_alloc_legacy(0, 1, OUTPUT_RATE); + m_channel = stream_alloc(0, 1, OUTPUT_RATE); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void redbaron_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - while( samples-- ) + auto &buffer = outputs[0]; + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = 0; @@ -214,7 +214,7 @@ void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, str if( m_squeal_out ) sum += 32767 * 40 / 100; - *buffer++ = sum; + buffer.put_int(sampindex, sum, 32768); } } diff --git a/src/mame/audio/redbaron.h b/src/mame/audio/redbaron.h index a66b74dff21..71f072ff44f 100644 --- a/src/mame/audio/redbaron.h +++ b/src/mame/audio/redbaron.h @@ -21,7 +21,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: std::unique_ptr<int16_t[]> m_vol_lookup; diff --git a/src/mame/audio/s11c_bg.cpp b/src/mame/audio/s11c_bg.cpp index fef33ee26b9..33fd826e1b8 100644 --- a/src/mame/audio/s11c_bg.cpp +++ b/src/mame/audio/s11c_bg.cpp @@ -232,6 +232,8 @@ s11c_bg_device::s11c_bg_device(const machine_config &mconfig, const char *tag, d , m_dac(*this, "dac") , m_ym2151(*this, "ym2151") , m_cvsd(*this, "hc55516") + , m_cvsd_filter(*this, "cvsd_filter") + , m_cvsd_filter2(*this, "cvsd_filter2") , m_pia40(*this, "pia40") , m_cpubank(*this, "bgbank") , m_cb2_cb(*this) @@ -248,6 +250,8 @@ s11c_bg_device::s11c_bg_device(const machine_config &mconfig, device_type type, , m_dac(*this, "dac") , m_ym2151(*this, "ym2151") , m_cvsd(*this, "hc55516") + , m_cvsd_filter(*this, "cvsd_filter") + , m_cvsd_filter2(*this, "cvsd_filter2") , m_pia40(*this, "pia40") , m_cpubank(*this, "bgbank") , m_cb2_cb(*this) @@ -390,7 +394,18 @@ void s11c_bg_device::s11_bg_ym(machine_config &config) // add a CVSD chip for boards which have it void s11c_bg_device::s11_bg_cvsd(machine_config &config) { - HC55516(config, m_cvsd, 0); + // m_cvsd_filter is the first 'half' of U18(MC1458), with R32, R30, R29, no capacitor to ground(!?!) and C9, output feeding the second half + // m_cvsd_filter2 is the second 'half' of U18(MC1458), with R20, R15, R19, C10 and C7, output feeding the final mixer + // Note that the (intended 1800uf according to Sinistar/System 6) capacitor + // to ground for m_cvsd_filter is COMPLETELY MISSING, and hence this + // filter section behaves very oddly under simulation, retaining a + // gain but having a first-order falloff response! + // This was presumably a design error, and not intended, given the + // strange filter response. We emulate this weird circuit as it existed. + FILTER_BIQUAD(config, m_cvsd_filter2).opamp_mfb_lowpass_setup(RES_K(27), RES_K(15), RES_K(27), CAP_P(4700), CAP_P(1200)); + FILTER_BIQUAD(config, m_cvsd_filter).opamp_mfb_lowpass_setup(RES_K(43), RES_K(36), RES_K(180), CAP_P(0), CAP_P(180)); // note the first capacitor is 0pf meaning it doesn't exist + m_cvsd_filter->add_route(ALL_OUTPUTS, m_cvsd_filter2, 1.0); + HC55516(config, m_cvsd, 0).add_route(ALL_OUTPUTS, m_cvsd_filter, 1.0/4.0); // to prevent massive clipping issues, we divide the signal by 4 here before going into the filters, then multiply it by 4 after it comes out the other end } @@ -405,11 +420,13 @@ void s11c_bg_device::device_add_mconfig(machine_config &config) // 1/resistance * 57990 is 4.460769, 2.8895, 2.8895, 11.62124 // the sum of the previous 4 values is 21.88101; 100/21.88101 = 4.570173 // the 4 (1/r)*rtotal numbers * 4.570173 are 20.38649, 13.25122, 13.25122 and 53.11108 respectively - // NOTE: audio passthrough from the mainboard is 4.7kohm - m_dac->add_route(ALL_OUTPUTS, *this, 0.2038); // 13Kohm - m_ym2151->add_route(1, *this, 0.1325); // 20kohm - m_ym2151->add_route(0, *this, 0.1325); // 20kohm - m_cvsd->add_route(ALL_OUTPUTS, *this, 0.5311); // 4.99kohm + // NOTE: Multiply all numbers here or the final output by 1/0.6395 = 1.5638 to get the relative + // volume values if there is no audio input used at all + // audio passthrough resistor from the mainboard input is 4.7kohm, 0.3605 in files sending audio into this device + m_dac->add_route(ALL_OUTPUTS, *this, 0.1304); // 13Kohm + m_ym2151->add_route(1, *this, 0.08473); // 20kohm + m_ym2151->add_route(0, *this, 0.08473); // 20kohm + m_cvsd_filter2->add_route(ALL_OUTPUTS, *this, 0.3396*4.0); // 4.99kohm } // D-11581 (without the W10/W11 jumpers) @@ -423,11 +440,13 @@ void s11_bg_device::device_add_mconfig(machine_config &config) // 1/resistance * 57990 is 4.9666, 3.129, 3.129, 6.2705 // the sum of the previous 4 values is 17.49521; 100/17.49521 = 5.715851 // the 4 (1/r)*rtotal numbers * 5.715851 are 28.38873, 17.8849, 17.8849, and 35.84148 respectively - // NOTE: audio passthrough from the mainboard is 2.2kohm - m_dac->add_route(ALL_OUTPUTS, *this, 0.2839); // 6.3Kohm - m_ym2151->add_route(1, *this, 0.1788); // 10kohm - m_ym2151->add_route(0, *this, 0.1788); // 10kohm - m_cvsd->add_route(ALL_OUTPUTS, *this, 0.3584); // 4.99kohm + // NOTE: Multiply all numbers here or the final output by 1/0.5516 = 1.8129 to get the relative + // volume values correct if there is no audio input used at all + // NOTE: audio passthrough from the mainboard is 2.2kohm, 0.4484 in files sending audio into this device + m_dac->add_route(ALL_OUTPUTS, *this, 0.1566); // 6.3Kohm + m_ym2151->add_route(1, *this, 0.0987); // 10kohm + m_ym2151->add_route(0, *this, 0.0987); // 10kohm + m_cvsd_filter2->add_route(ALL_OUTPUTS, *this, 0.1977*4.0); // 4.99kohm } // D-11297 or D-11298 @@ -441,11 +460,13 @@ void s11_obg_device::device_add_mconfig(machine_config &config) // 1/resistance * 40000 is 4.0, 4.0, 4.0, 4.0 // the sum of the previous 4 values is 16.0; 100/16 = 6.25 // the 4 (1/r)*rtotal numbers * 6.25 are 25.0, 25.0, 25.0, 25.0 respectively - // NOTE: audio passthrough from the mainboard is 2.2kohm - m_dac->add_route(ALL_OUTPUTS, *this, 0.25); // 10Kohm - m_ym2151->add_route(1, *this, 0.25); // 10kohm - m_ym2151->add_route(0, *this, 0.25); // 10kohm - m_cvsd->add_route(ALL_OUTPUTS, *this, 0.25); // 10kohm + // NOTE: Multiply all numbers here or the final output by 1/0.468 = 2.1368 to get the relative + // volume values correct if there is no audio input used at all + // NOTE: audio passthrough from the mainboard is 2.2kohm, 0.5319 in files sending audio into this device + m_dac->add_route(ALL_OUTPUTS, *this, 0.1170); // 10Kohm + m_ym2151->add_route(1, *this, 0.1170); // 10kohm + m_ym2151->add_route(0, *this, 0.1170); // 10kohm + m_cvsd_filter2->add_route(ALL_OUTPUTS, *this, 0.1170*4.0); // 10kohm } // D-11197 @@ -459,10 +480,12 @@ void s11_bgm_device::device_add_mconfig(machine_config &config) // 1/resistance * 40000 is 4.0, 4.0, 4.0, 4.0 // the sum of the previous 4 values is 16.0; 100/16 = 6.25 // the 4 (1/r)*rtotal numbers * 6.25 are 25.0, 25.0, 25.0, 25.0 respectively - // NOTE: audio passthrough from the mainboard is 2.2kohm - m_dac->add_route(ALL_OUTPUTS, *this, 0.25); // 10Kohm - m_ym2151->add_route(1, *this, 0.25); // 10kohm - m_ym2151->add_route(0, *this, 0.25); // 10kohm + // NOTE: Multiply all numbers here or the final output by 1/0.468 = 2.1368 to get the relative + // volume values correct if there is no audio input used at all + // NOTE: audio passthrough from the mainboard is 2.2kohm, 0.5319 in files sending audio into this device + m_dac->add_route(ALL_OUTPUTS, *this, 0.1170); // 10Kohm + m_ym2151->add_route(1, *this, 0.1170); // 10kohm + m_ym2151->add_route(0, *this, 0.1170); // 10kohm // interestingly, there is no cvsd, but a fourth 10k resistor here, but it is tied to ground. this makes the board quieter than it would otherwise be, presumably. } @@ -473,8 +496,8 @@ void s11_bgs_device::device_add_mconfig(machine_config &config) m_cpu->set_addrmap(AS_PROGRAM, &s11c_bg_device::s11c_bgs_map); // volume mixer stuff // the sum of all resistances is 10k + 10k = 20k - // NOTE: audio passthrough from the mainboard is 10k - m_dac->add_route(ALL_OUTPUTS, *this, 1.00); // 10Kohm + // NOTE: audio passthrough from the mainboard is 10k, 0.50 in files sending audio to this device + m_dac->add_route(ALL_OUTPUTS, *this, 0.50); // 10Kohm } void s11c_bg_device::device_start() diff --git a/src/mame/audio/s11c_bg.h b/src/mame/audio/s11c_bg.h index cab8d03defd..756b71c89f7 100644 --- a/src/mame/audio/s11c_bg.h +++ b/src/mame/audio/s11c_bg.h @@ -13,7 +13,9 @@ #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" +#include "machine/rescap.h" #include "sound/dac.h" +#include "sound/flt_biquad.h" #include "sound/hc55516.h" #include "sound/ym2151.h" @@ -63,6 +65,8 @@ protected: required_device<mc1408_device> m_dac; optional_device<ym2151_device> m_ym2151; optional_device<hc55516_device> m_cvsd; + optional_device<filter_biquad_device> m_cvsd_filter; + optional_device<filter_biquad_device> m_cvsd_filter2; required_device<pia6821_device> m_pia40; required_memory_bank m_cpubank; diff --git a/src/mame/audio/segag80r.cpp b/src/mame/audio/segag80r.cpp index 90a8463cbad..4acd7c2104a 100644 --- a/src/mame/audio/segag80r.cpp +++ b/src/mame/audio/segag80r.cpp @@ -46,7 +46,7 @@ void sega005_sound_device::device_start() segag80r_state *state = machine().driver_data<segag80r_state>(); /* create the stream */ - m_sega005_stream = stream_alloc_legacy(0, 1, SEGA005_COUNTER_FREQ); + m_sega005_stream = stream_alloc(0, 1, SEGA005_COUNTER_FREQ); /* create a timer for the 555 */ m_sega005_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega005_sound_device::sega005_auto_timer), this)); @@ -57,17 +57,17 @@ void sega005_sound_device::device_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void sega005_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { segag80r_state *state = machine().driver_data<segag80r_state>(); const uint8_t *sound_prom = state->memregion("proms")->base(); int i; /* no implementation yet */ - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { if (!(state->m_sound_state[1] & 0x10) && (++state->m_square_count & 0xff) == 0) { @@ -78,7 +78,7 @@ void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stre state->m_square_state += 2; } - outputs[0][i] = (state->m_square_state & 2) ? 0x7fff : 0x0000; + outputs[0].put(i, (state->m_square_state & 2) ? 1.0 : 0.0); } } diff --git a/src/mame/audio/segausb.cpp b/src/mame/audio/segausb.cpp index ef6343e945d..dc87b73ae8c 100644 --- a/src/mame/audio/segausb.cpp +++ b/src/mame/audio/segausb.cpp @@ -100,7 +100,7 @@ void usb_sound_device::device_start() #else - m_stream = stream_alloc_legacy(0, 1, USB_2MHZ_CLOCK); + m_stream = stream_alloc(0, 1, USB_2MHZ_CLOCK); m_noise_shift = 0x15555; @@ -451,15 +451,15 @@ void usb_sound_device::env_w(int which, u8 offset, u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void usb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *dest = outputs[0]; + auto &dest = outputs[0]; // iterate over samples - while (samples--) + for (int sampindex = 0; sampindex < dest.samples(); sampindex++) { /*---------------- Noise Source @@ -590,7 +590,7 @@ void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s WEIGHT */ - *dest++ = 3000 * m_final_filter.step_cr(sample); + dest.put(sampindex, 0.1 * m_final_filter.step_cr(sample)); } } diff --git a/src/mame/audio/segausb.h b/src/mame/audio/segausb.h index e34d892142d..e1e4a581782 100644 --- a/src/mame/audio/segausb.h +++ b/src/mame/audio/segausb.h @@ -62,7 +62,7 @@ protected: #if (!ENABLE_SEGAUSB_NETLIST) // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; #endif private: diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp index 17075367960..57c6253fe9b 100644 --- a/src/mame/audio/seibu.cpp +++ b/src/mame/audio/seibu.cpp @@ -385,7 +385,7 @@ seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char void seibu_adpcm_device::device_start() { m_playing = 0; - m_stream = stream_alloc_legacy(0, 1, clock()); + m_stream = stream_alloc(0, 1, clock()); m_adpcm.reset(); save_item(NAME(m_current)); @@ -443,14 +443,15 @@ void seibu_adpcm_device::ctl_w(u8 data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void seibu_adpcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *dest = outputs[0]; + auto &dest = outputs[0]; - while (m_playing && samples > 0) + int sampindex; + for (sampindex = 0; m_playing && sampindex < dest.samples(); sampindex++) { int val = (m_base[m_current] >> m_nibble) & 15; @@ -462,12 +463,7 @@ void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream m_playing = 0; } - *dest++ = m_adpcm.clock(val) << 4; - samples--; - } - while (samples > 0) - { - *dest++ = 0; - samples--; + dest.put_int(sampindex, m_adpcm.clock(val), 32768 >> 4); } + dest.fill(0, sampindex); } diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 9954b462205..1c53beb7746 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -145,7 +145,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state diff --git a/src/mame/audio/sente6vb.cpp b/src/mame/audio/sente6vb.cpp index 22c9721a18a..de06af02feb 100644 --- a/src/mame/audio/sente6vb.cpp +++ b/src/mame/audio/sente6vb.cpp @@ -55,6 +55,7 @@ ***************************************************************************/ #include "emu.h" +#include "sound/mm5837.h" #include "audio/sente6vb.h" #include "cpu/z80/z80.h" #include "machine/clock.h" @@ -66,53 +67,6 @@ DEFINE_DEVICE_TYPE(SENTE6VB, sente6vb_device, "sente6vb", "Bally Sente 6VB Audio Board") -/************************************* -* -* Trivial sound device to spew -* a MM5837 noise stream to CEM3394 -* inputs -* -*************************************/ - -DECLARE_DEVICE_TYPE(MM5837_NOISE_SOURCE, mm5837_noise_source) - -class mm5837_noise_source : public device_t, public device_sound_interface -{ -public: - mm5837_noise_source(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, MM5837_NOISE_SOURCE, tag, owner, clock), - device_sound_interface(mconfig, *this), - m_stream(nullptr), - m_noise_state(0x1ffff) - { - } - -protected: - // device-level overrides - virtual void device_start() override - { - m_stream = stream_alloc(0, 1, clock()); - save_item(NAME(m_noise_state)); - } - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override - { - for (int sampindex = 0; sampindex < outputs[0].samples(); sampindex++) - { - outputs[0].put(sampindex, BIT(m_noise_state, 0) ? 1.0 : 0.0); - m_noise_state = (m_noise_state >> 1) | ((BIT(m_noise_state, 0) ^ BIT(m_noise_state, 3)) << 16); - } - } - -private: - sound_stream *m_stream; // sound stream - u32 m_noise_state; // noise state -}; - -DEFINE_DEVICE_TYPE(MM5837_NOISE_SOURCE, mm5837_noise_source, "mm5837noise", "MM5837") - - /************************************* * @@ -172,7 +126,9 @@ void sente6vb_device::device_add_mconfig(machine_config &config) SPEAKER(config, "mono").front_center(); - mm5837_noise_source &noise(MM5837_NOISE_SOURCE(config, "noise", 100000)); + mm5837_stream_device &noise(MM5837_STREAM(config, "noise", 0)); +// noise.set_vdd(-6.5); // seems too low -- possible the mapping in mm5837 is wrong + noise.set_vdd(-8.0); for (auto &cem_device : m_cem_device) { @@ -180,7 +136,7 @@ void sente6vb_device::device_add_mconfig(machine_config &config) cem_device->set_vco_zero_freq(431.894); cem_device->set_filter_zero_freq(1300.0); cem_device->add_route(ALL_OUTPUTS, "mono", 0.90); - noise.add_route(0, *cem_device, 1.0); + noise.add_route(0, *cem_device, 0.5); } } diff --git a/src/mame/audio/snk6502.cpp b/src/mame/audio/snk6502.cpp index 4d5550e08c3..0dc3b1868a5 100644 --- a/src/mame/audio/snk6502.cpp +++ b/src/mame/audio/snk6502.cpp @@ -165,7 +165,7 @@ void snk6502_sound_device::device_start() // 38.99 Hz update (according to schematic) set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1)); - m_tone_stream = stream_alloc_legacy(0, 1, SAMPLE_RATE); + m_tone_stream = stream_alloc(0, 1, SAMPLE_RATE); for (int i = 0; i < NUM_CHANNELS; i++) { @@ -509,17 +509,17 @@ void snk6502_sound_device::speech_w(uint8_t data, const uint16_t *table, int sta */ //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void snk6502_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; for (int i = 0; i < NUM_CHANNELS; i++) validate_tone_channel(i); - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int32_t data = 0; @@ -541,7 +541,7 @@ void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stre } } - *buffer++ = data; + buffer.put_int(sampindex, data, 3768); m_tone_clock += FRAC_ONE; if (m_tone_clock >= m_tone_clock_expire) diff --git a/src/mame/audio/snk6502.h b/src/mame/audio/snk6502.h index 99c0178120c..54474aa8207 100644 --- a/src/mame/audio/snk6502.h +++ b/src/mame/audio/snk6502.h @@ -40,7 +40,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: static constexpr unsigned NUM_CHANNELS = 3; diff --git a/src/mame/audio/socrates.cpp b/src/mame/audio/socrates.cpp index 4b49ec0b5bd..4f9731494eb 100644 --- a/src/mame/audio/socrates.cpp +++ b/src/mame/audio/socrates.cpp @@ -43,20 +43,20 @@ void socrates_snd_device::device_start() m_DAC_output = 0x00; /* output */ m_state[0] = m_state[1] = m_state[2] = 0; m_accum[0] = m_accum[1] = m_accum[2] = 0xFF; - m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate()); + m_stream = stream_alloc(0, 1, clock() ? clock() : machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void socrates_snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void socrates_snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { snd_clock(); - outputs[0][i] = ((int)m_DAC_output<<4); + outputs[0].put_int(i, (int)m_DAC_output, 32768 >> 4); } } diff --git a/src/mame/audio/socrates.h b/src/mame/audio/socrates.h index cd2d240079c..a75e5c1ca6f 100644 --- a/src/mame/audio/socrates.h +++ b/src/mame/audio/socrates.h @@ -22,7 +22,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void snd_clock(); static const uint8_t s_volumeLUT[]; diff --git a/src/mame/audio/special.cpp b/src/mame/audio/special.cpp index 9a1383bfec0..40442b2cfb2 100644 --- a/src/mame/audio/special.cpp +++ b/src/mame/audio/special.cpp @@ -41,41 +41,24 @@ specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const void specimx_sound_device::device_start() { m_specimx_input[0] = m_specimx_input[1] = m_specimx_input[2] = 0; - m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void specimx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void specimx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int16_t channel_0_signal; - int16_t channel_1_signal; - int16_t channel_2_signal; + auto &sample_left = outputs[0]; - stream_sample_t *sample_left = outputs[0]; + stream_buffer::sample_t channel_0_signal = m_specimx_input[0] ? 0.1 : -0.1; + stream_buffer::sample_t channel_1_signal = m_specimx_input[1] ? 0.1 : -0.1; + stream_buffer::sample_t channel_2_signal = m_specimx_input[2] ? 0.1 : -0.1; + stream_buffer::sample_t sum = channel_0_signal + channel_1_signal + channel_2_signal; - channel_0_signal = m_specimx_input[0] ? 3000 : -3000; - channel_1_signal = m_specimx_input[1] ? 3000 : -3000; - channel_2_signal = m_specimx_input[2] ? 3000 : -3000; - - while (samples--) - { - *sample_left = 0; - - /* music channel 0 */ - *sample_left += channel_0_signal; - - /* music channel 1 */ - *sample_left += channel_1_signal; - - /* music channel 2 */ - *sample_left += channel_2_signal; - - sample_left++; - } + sample_left.fill(sum); } diff --git a/src/mame/audio/special.h b/src/mame/audio/special.h index daaa983a2d7..51dca82f12f 100644 --- a/src/mame/audio/special.h +++ b/src/mame/audio/special.h @@ -26,7 +26,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_mixer_channel; diff --git a/src/mame/audio/svis_snd.cpp b/src/mame/audio/svis_snd.cpp index 91fdd2dcce1..ed80d459821 100644 --- a/src/mame/audio/svis_snd.cpp +++ b/src/mame/audio/svis_snd.cpp @@ -45,22 +45,23 @@ void svision_sound_device::device_start() memset(&m_noise, 0, sizeof(m_noise)); memset(m_channel, 0, sizeof(m_channel)); - m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void svision_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left=outputs[0], *right=outputs[1]; + auto &left=outputs[0]; + auto &right=outputs[1]; - for (int i = 0; i < samples; i++, left++, right++) + for (int i = 0; i < left.samples(); i++) { - *left = 0; - *right = 0; + s32 lsum = 0; + s32 rsum = 0; for (int j = 0; j < ARRAY_LENGTH(m_channel); j++) { CHANNEL &channel(m_channel[j]); @@ -88,9 +89,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre { int16_t s = on ? channel.volume << 8 : 0; if (j == 0) - *right += s; + rsum += s; else - *left += s; + lsum += s; } } channel.pos++; @@ -103,9 +104,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre int16_t s = (m_noise.value ? 1 << 8: 0) * m_noise.volume; int b1, b2; if (m_noise.left) - *left += s; + lsum += s; if (m_noise.right) - *right += s; + rsum += s; m_noise.pos += m_noise.step; if (m_noise.pos >= 1.0) { @@ -146,9 +147,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre s = (sample & 0xf0) >> 4; s <<= 8; if (m_dma.left) - *left += s; + lsum += s; if (m_dma.right) - *right += s; + rsum += s; m_dma.pos += m_dma.step; if (m_dma.pos >= m_dma.size) { @@ -157,6 +158,8 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre m_irq_cb(1); } } + left.put_int(i, lsum, 32768); + right.put_int(i, rsum, 32768); } } diff --git a/src/mame/audio/svis_snd.h b/src/mame/audio/svis_snd.h index 9b7efad6353..d080976261b 100644 --- a/src/mame/audio/svis_snd.h +++ b/src/mame/audio/svis_snd.h @@ -41,7 +41,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct NOISE diff --git a/src/mame/audio/tiamc1.cpp b/src/mame/audio/tiamc1.cpp index d99de897c22..67049496ceb 100644 --- a/src/mame/audio/tiamc1.cpp +++ b/src/mame/audio/tiamc1.cpp @@ -77,7 +77,7 @@ void tiamc1_sound_device::device_start() timer8253_reset(&m_timer0); timer8253_reset(&m_timer1); - m_channel = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER); + m_channel = stream_alloc(0, 1, clock() / CLOCK_DIVIDER); m_timer1_divider = 0; @@ -104,14 +104,14 @@ void tiamc1_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tiamc1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int count, o0, o1, o2, len, orval = 0; - len = samples * CLOCK_DIVIDER; + len = outputs[0].samples() * CLOCK_DIVIDER; for (count = 0; count < len; count++) { @@ -140,7 +140,7 @@ void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, strea if ((count + 1) % CLOCK_DIVIDER == 0) { - outputs[0][count / CLOCK_DIVIDER] = orval ? 0x2828 : 0; + outputs[0].put(count / CLOCK_DIVIDER, orval ? 0.3 : 0.0); orval = 0; } } diff --git a/src/mame/audio/tiamc1.h b/src/mame/audio/tiamc1.h index d8834816899..f469e8a40e0 100644 --- a/src/mame/audio/tiamc1.h +++ b/src/mame/audio/tiamc1.h @@ -25,7 +25,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct timer8253chan diff --git a/src/mame/audio/timeplt.cpp b/src/mame/audio/timeplt.cpp index 7fe94dd46c7..f626a8f98f9 100644 --- a/src/mame/audio/timeplt.cpp +++ b/src/mame/audio/timeplt.cpp @@ -34,7 +34,6 @@ locomotn_audio_device::locomotn_audio_device(const machine_config &mconfig, cons timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) - , device_sound_interface(mconfig, *this) , m_soundcpu(*this, "tpsound") , m_soundlatch(*this, "soundlatch") , m_filter_0(*this, "filter.0.%u", 0) @@ -226,13 +225,3 @@ void locomotn_audio_device::device_add_mconfig(machine_config &config) /* basic machine hardware */ m_soundcpu->set_addrmap(AS_PROGRAM, &locomotn_audio_device::locomotn_sound_map); } - -//------------------------------------------------- -// sound_stream_update_legacy - handle a stream update -//------------------------------------------------- - -void timeplt_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - // should never get here - fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n"); -} diff --git a/src/mame/audio/timeplt.h b/src/mame/audio/timeplt.h index 8e69d20caa1..b4e5b7c0677 100644 --- a/src/mame/audio/timeplt.h +++ b/src/mame/audio/timeplt.h @@ -10,7 +10,7 @@ #include "sound/ay8910.h" #include "sound/flt_rc.h" -class timeplt_audio_device : public device_t, public device_sound_interface +class timeplt_audio_device : public device_t { public: timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 14'318'181); @@ -26,9 +26,6 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; - // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - void filter_w(offs_t offset, uint8_t data); uint8_t portB_r(); diff --git a/src/mame/audio/trackfld.cpp b/src/mame/audio/trackfld.cpp index bf139f858e9..9a8a863d551 100644 --- a/src/mame/audio/trackfld.cpp +++ b/src/mame/audio/trackfld.cpp @@ -15,7 +15,6 @@ DEFINE_DEVICE_TYPE(TRACKFLD_AUDIO, trackfld_audio_device, "trackfld_audio", "Tra trackfld_audio_device::trackfld_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TRACKFLD_AUDIO, tag, owner, clock) - , device_sound_interface(mconfig, *this) , m_audiocpu(*this, finder_base::DUMMY_TAG) , m_vlm(*this, finder_base::DUMMY_TAG) , m_last_addr(0) @@ -130,13 +129,3 @@ WRITE_LINE_MEMBER(trackfld_audio_device::sh_irqtrigger_w) m_last_irq = state; } - -//------------------------------------------------- -// sound_stream_update_legacy - handle a stream update -//------------------------------------------------- - -void trackfld_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - // should never get here - fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n"); -} diff --git a/src/mame/audio/trackfld.h b/src/mame/audio/trackfld.h index f1502443562..141916cec65 100644 --- a/src/mame/audio/trackfld.h +++ b/src/mame/audio/trackfld.h @@ -8,7 +8,7 @@ #include "sound/vlm5030.h" #include "cpu/m6800/m6800.h" -class trackfld_audio_device : public device_t, public device_sound_interface +class trackfld_audio_device : public device_t { public: template <typename T, typename U> @@ -33,9 +33,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - private: optional_device<cpu_device> m_audiocpu; optional_device<vlm5030_device> m_vlm; diff --git a/src/mame/audio/tranqgun.cpp b/src/mame/audio/tranqgun.cpp deleted file mode 100644 index afa28fe3591..00000000000 --- a/src/mame/audio/tranqgun.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari, Jim Hernandez -/* - * Tranquillizer Gun audio routines - */ - -#include "emu.h" -#include "includes/vicdual.h" - -/* output port 0x01 definitions - sound effect drive outputs */ -#define OUT_PORT_1_ANIMAL 0x01 -#define OUT_PORT_1_CRY 0x02 -#define OUT_PORT_1_WALK 0x04 -#define OUT_PORT_1_EMAR 0x08 -#define OUT_PORT_1_ANIMALHIT 0x10 -#define OUT_PORT_1_POINT 0x20 -#define OUT_PORT_1_JEEP 0x40 -#define OUT_PORT_1_GUN 0x80 - - -#define PLAY(samp,id,loop) samp->start( id, id, loop ) -#define STOP(samp,id) samp->stop( id ) - - -/* sample file names */ -static const char *const tranqgun_sample_names[] = -{ - "*tranqgun", - "cry", - "walk", - "emar", - "animalhit", - "point", - "jeep", - "gun", - "animal", - nullptr -}; - - -/* sample IDs - must match sample file name table above */ -enum -{ - SND_CRY = 0, - SND_WALK, - SND_EMAR, - SND_ANIMALHIT, - SND_POINT, - SND_JEEP, - SND_GUN, - SND_ANIMAL, -}; - - -void vicdual_state::tranqgun_audio_w(uint8_t data) -{ - int bitsChanged; - int bitsGoneHigh; - int bitsGoneLow; - - bitsChanged = m_port1State ^ data; - bitsGoneHigh = bitsChanged & data; - bitsGoneLow = bitsChanged & ~data; - - m_port1State = data; - - if ( bitsGoneHigh & OUT_PORT_1_ANIMAL ) - { - PLAY( m_samples, SND_ANIMAL, 0 ); - } - if ( bitsGoneLow & OUT_PORT_1_ANIMAL ) - { - STOP( m_samples, SND_ANIMAL ); - } - - if ( bitsGoneHigh & OUT_PORT_1_CRY ) - { - PLAY( m_samples, SND_CRY, 0 ); - } - if ( bitsGoneLow & OUT_PORT_1_CRY ) - { - STOP( m_samples, SND_CRY ); - } - - if ( bitsGoneHigh & OUT_PORT_1_WALK ) - { - PLAY( m_samples, SND_WALK, 0 ); - } - if ( bitsGoneLow & OUT_PORT_1_WALK ) - { - STOP( m_samples, SND_WALK ); - } - - if ( bitsGoneLow & OUT_PORT_1_ANIMAL ) - { - PLAY( m_samples, SND_ANIMAL,0 ); - } - - if ( bitsGoneHigh & OUT_PORT_1_ANIMALHIT ) - { - PLAY( m_samples, SND_ANIMALHIT, 0 ); - } - if ( bitsGoneLow & OUT_PORT_1_ANIMALHIT ) - { - STOP( m_samples, SND_ANIMALHIT ); - } - - if ( bitsGoneHigh & OUT_PORT_1_POINT ) - { - PLAY( m_samples, SND_POINT, 0 ); - } - if ( bitsGoneLow & OUT_PORT_1_POINT ) - { - STOP( m_samples, SND_POINT ); - } - - if ( bitsGoneLow & OUT_PORT_1_JEEP ) - { - PLAY( m_samples, SND_JEEP, 1 ); - - } - if ( bitsGoneHigh & OUT_PORT_1_JEEP ) - { - STOP( m_samples, SND_JEEP ); - } - - if ( bitsGoneLow & OUT_PORT_1_EMAR ) - { - PLAY( m_samples, SND_EMAR, 0 ); - } - - if ( bitsGoneHigh & OUT_PORT_1_GUN ) - { - PLAY( m_samples, SND_GUN, 0 ); - } - if ( bitsGoneLow & OUT_PORT_1_GUN ) - { - STOP( m_samples, SND_GUN ); - } -} - - -void vicdual_state::tranqgun_audio(machine_config &config) -{ - /* samples */ - SAMPLES(config, m_samples); - m_samples->set_channels(8); - m_samples->set_samples_names(tranqgun_sample_names); - m_samples->add_route(ALL_OUTPUTS, "mono", 0.5); -} diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp index 4d8414b0118..a2f9ecdb5af 100644 --- a/src/mame/audio/turrett.cpp +++ b/src/mame/audio/turrett.cpp @@ -47,7 +47,7 @@ void turrett_device::device_start() space().cache(m_cache); // Create the sound stream - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); // Create the volume table for (int i = 0; i < 0x4f; ++i) @@ -78,20 +78,17 @@ void turrett_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - update sound stream +// sound_stream_update - update sound stream //------------------------------------------------- -void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // Silence the buffers - memset(outputs[0], 0x00, sizeof(stream_sample_t) * samples); - memset(outputs[1], 0x00, sizeof(stream_sample_t) * samples); + outputs[0].fill(0); + outputs[1].fill(0); for (int ch = 0; ch < SOUND_CHANNELS; ++ch) { - stream_sample_t *l = outputs[0]; - stream_sample_t *r = outputs[1]; - if (m_channels[ch].m_playing) { uint32_t &addr = m_channels[ch].m_address; @@ -104,7 +101,7 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam // Channels 30 and 31 expect interleaved stereo samples uint32_t incr = (ch >= 30) ? 2 : 1; - for (int s = 0; s < samples; ++s) + for (int s = 0; s < outputs[0].samples(); ++s) { int16_t sample = m_cache.read_word(addr << 1); @@ -116,8 +113,8 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam addr += incr; - *l++ += (sample * lvol) >> 17; - *r++ += (sample * rvol) >> 17; + outputs[0].add_int(s, (sample * lvol) >> 17, 32768); + outputs[1].add_int(s, (sample * rvol) >> 17, 32768); } } } diff --git a/src/mame/audio/tvc.cpp b/src/mame/audio/tvc.cpp index e30c79ef959..84495e0838b 100644 --- a/src/mame/audio/tvc.cpp +++ b/src/mame/audio/tvc.cpp @@ -31,7 +31,7 @@ void tvc_sound_device::device_start() // resolve callbacks m_write_sndint.resolve_safe(); - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); m_sndint_timer = timer_alloc(TIMER_SNDINT); } @@ -58,19 +58,19 @@ void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int pa } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tvc_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int rate = machine().sample_rate() / 2; - stream_sample_t *output = outputs[0]; + auto &output = outputs[0]; + int rate = output.sample_rate() / 2; if (m_enabled && m_freq) { - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < output.samples(); sampindex++) { - *output++ = m_signal * (m_volume * 0x0800); + output.put_int(sampindex, m_signal * m_volume, 32768 / 0x0800); m_incr -= m_freq; while(m_incr < 0) { @@ -82,7 +82,7 @@ void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s else { // fill output with 0 if the sound is disabled - memset(output, 0, samples * sizeof(stream_sample_t)); + output.fill(0); } } diff --git a/src/mame/audio/tvc.h b/src/mame/audio/tvc.h index 669184a0a2b..004ed6975bf 100644 --- a/src/mame/audio/tvc.h +++ b/src/mame/audio/tvc.h @@ -34,7 +34,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: static const device_timer_id TIMER_SNDINT = 0; diff --git a/src/mame/audio/tx1.cpp b/src/mame/audio/tx1.cpp index a6dd9d2aeb6..22f3e23ec5b 100644 --- a/src/mame/audio/tx1.cpp +++ b/src/mame/audio/tx1.cpp @@ -111,7 +111,7 @@ void tx1_sound_device::device_start() /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_stream = stream_alloc(0, 2, machine().sample_rate()); m_freq_to_step = (double)(1 << TX1_FRAC) / (double)machine().sample_rate(); /* Compute the engine resistor weights */ @@ -356,20 +356,16 @@ static inline void update_engine(int eng[4]) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tx1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint32_t step_0, step_1, step_2; double /*gain_0, gain_1,*/ gain_2, gain_3; - stream_sample_t *fl = &outputs[0][0]; - stream_sample_t *fr = &outputs[1][0]; - - /* Clear the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + auto &fl = outputs[0]; + auto &fr = outputs[1]; /* 8253 outputs for the player/opponent engine sounds. */ step_0 = m_pit8253.counts[0].val ? (TX1_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0; @@ -381,7 +377,7 @@ void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s gain_2 = tx1_engine_gains[m_ay_outputb & 0xf]; gain_3 = BIT(m_ay_outputb, 5) ? 1.0f : 1.5f; - while (samples--) + for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { if (m_step0 & ((1 << TX1_FRAC))) { @@ -404,8 +400,8 @@ void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s m_step2 &= ((1 << TX1_FRAC) - 1); } - *fl++ = (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2; - *fr++ = (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2; + fl.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768); + fr.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768); m_step0 += step_0; m_step1 += step_1; @@ -662,7 +658,7 @@ void buggyboy_sound_device::device_start() m_eng_voltages[i] = combine_weights(aweights, BIT(tmp[i], 0), BIT(tmp[i], 1), BIT(tmp[i], 2), BIT(tmp[i], 3)); /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_stream = stream_alloc(0, 2, machine().sample_rate()); m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate(); } @@ -763,10 +759,10 @@ void buggyboy_sound_device::ym2_b_w(uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* This is admittedly a bit of a hack job... */ @@ -774,12 +770,8 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str int n1_en, n2_en; double gain0, gain1_l, gain1_r; - stream_sample_t *fl = &outputs[0][0]; - stream_sample_t *fr = &outputs[1][0]; - - /* Clear the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + auto &fl = outputs[0]; + auto &fr = outputs[1]; /* 8253 outputs for the player/opponent buggy engine sounds. */ step_0 = m_pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0; @@ -796,10 +788,10 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str gain1_l = bb_engine_gains[m_ym2_outputa >> 4] * 5; gain1_r = bb_engine_gains[m_ym2_outputa & 0xf] * 5; - while (samples--) + for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { int i; - stream_sample_t pit0, pit1, n1, n2; + s32 pit0, pit1, n1, n2; pit0 = m_eng_voltages[(m_step0 >> 24) & 0xf]; pit1 = m_eng_voltages[(m_step1 >> 24) & 0xf]; @@ -839,8 +831,8 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str else n2 = 8192; - *fl++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l); - *fr++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r); + fl.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l), 32768); + fr.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r), 32768); m_step0 += step_0; m_step1 += step_1; diff --git a/src/mame/audio/tx1.h b/src/mame/audio/tx1.h index 71e228e324c..8d8e4d49739 100644 --- a/src/mame/audio/tx1.h +++ b/src/mame/audio/tx1.h @@ -73,7 +73,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void tx1_sound_io(address_map &map); void tx1_sound_prg(address_map &map); @@ -104,9 +104,9 @@ protected: uint8_t m_ppi_latch_b = 0; uint32_t m_ts = 0; - stream_sample_t m_pit0 = 0; - stream_sample_t m_pit1 = 0; - stream_sample_t m_pit2 = 0; + s32 m_pit0 = 0; + s32 m_pit1 = 0; + s32 m_pit2 = 0; double m_weights0[4] = { 0, 0, 0, 0 }; double m_weights1[3] = { 0, 0, 0 }; @@ -155,7 +155,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void ym1_a_w(uint8_t data); diff --git a/src/mame/audio/vboy.cpp b/src/mame/audio/vboy.cpp index 37eec2ee80b..56aa88e9054 100644 --- a/src/mame/audio/vboy.cpp +++ b/src/mame/audio/vboy.cpp @@ -209,7 +209,7 @@ void vboysnd_device::device_start() { uint32_t rate = clock() / 120; // create the stream - m_stream = stream_alloc_legacy(0, 2, rate); + m_stream = stream_alloc(0, 2, rate); m_timer = timer_alloc(0, nullptr); m_timer->adjust(attotime::zero, 0, rate ? attotime::from_hz(rate / 4) : attotime::never); @@ -265,19 +265,18 @@ void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int par } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vboysnd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; int len, i, j, channel; - outL = outputs[0]; - outR = outputs[1]; + auto &outL = outputs[0]; + auto &outR = outputs[1]; - len = samples; + len = outL.samples(); // if (mgetb(m_aram+SST0P) & 0x1) // Sound Stop Reg // goto end; @@ -384,13 +383,9 @@ void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sam // scale to 16 bits note_left = (note_left << 5) | ((note_left >> 6) & 0x1f); note_right = (note_right << 5) | ((note_right >> 6) & 0x1f); - if (note_left < -32767) note_left = -32767; - if (note_left > 32767) note_left = 32767; - if (note_right < -32767) note_right = -32767; - if (note_right > 32767) note_right = 32767; - *(outL++) = ((int16_t)note_left); - *(outR++) = ((int16_t)note_right); + outL.put_int_clamp(j, (int16_t)note_left, 32768); + outR.put_int_clamp(j, (int16_t)note_right, 32768); } } diff --git a/src/mame/audio/vboy.h b/src/mame/audio/vboy.h index f8d3a050272..ca4de746db3 100644 --- a/src/mame/audio/vboy.h +++ b/src/mame/audio/vboy.h @@ -72,7 +72,7 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; s_snd_channel snd_channel[5]; diff --git a/src/mame/audio/vc4000.cpp b/src/mame/audio/vc4000.cpp index 84c19a2d942..0454af936a5 100644 --- a/src/mame/audio/vc4000.cpp +++ b/src/mame/audio/vc4000.cpp @@ -31,26 +31,22 @@ vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const ch void vc4000_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void vc4000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vc4000_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (i = 0; i < samples; i++, buffer++) + for (i = 0; i < buffer.samples(); i++) { - *buffer = 0; - if (m_reg[0] && m_pos <= m_size / 2) - { - *buffer = 0x7fff; - } + buffer.put(i, (m_reg[0] && m_pos <= m_size / 2) ? 1.0 : 0.0); if (m_pos <= m_size) m_pos++; if (m_pos > m_size) diff --git a/src/mame/audio/vc4000.h b/src/mame/audio/vc4000.h index 3917ffa2776..2dad7a87d27 100644 --- a/src/mame/audio/vc4000.h +++ b/src/mame/audio/vc4000.h @@ -28,7 +28,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: void soundport_w(int mode, int data); diff --git a/src/mame/audio/vicdual.cpp b/src/mame/audio/vicdual.cpp index b3bd59c288f..2c44cd6107c 100644 --- a/src/mame/audio/vicdual.cpp +++ b/src/mame/audio/vicdual.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Derrick Renaud, Couriersud +// copyright-holders:Derrick Renaud, Couriersud, Aaron Giles /************************************************************************* VIC Dual Game board @@ -9,187 +9,8 @@ #include "emu.h" #include "includes/vicdual.h" - -/************************************************************************ - * frogs Sound System Analog emulation - * Oct 2004, Derrick Renaud - ************************************************************************/ - - -/* Discrete Sound Input Nodes */ -#define FROGS_FLY_EN NODE_01 -#define FROGS_JUMP_EN NODE_03 -#define FROGS_HOP_EN NODE_04 -#define FROGS_TONGUE_EN NODE_05 -#define FROGS_CAPTURE_EN NODE_06 -#define FROGS_SPLASH_EN NODE_08 - -/* Nodes - Sounds */ -#define FROGS_BUZZZ_SND NODE_11 -#define FROGS_BOING_SND NODE_13 -#define FROGS_HOP_SND NODE_14 -#define FROGS_ZIP_SND NODE_15 -#define FROGS_CROAK_SND NODE_16 -#define FROGS_SPLASH_SND NODE_18 -/* VRs */ -#define FROGS_R93 NODE_25 - -static const discrete_555_desc frogsZip555m = -{ - DISC_555_OUT_CAP | DISC_555_OUT_DC | DISC_555_TRIGGER_IS_LOGIC, - 12, // B+ voltage of 555 - DEFAULT_555_VALUES -}; - -static const discrete_555_cc_desc frogsZip555cc = -{ - DISC_555_OUT_CAP | DISC_555_OUT_DC, - 12, // B+ voltage of 555 - DEFAULT_555_VALUES, - 0.6 // Q13 Vbe -}; - -static const discrete_mixer_desc frogsMixer = -{ - DISC_MIXER_IS_OP_AMP, - {RES_K(1), RES_K(5)}, - {FROGS_R93, 0}, - {CAP_U(0.01), CAP_U(0.01)}, - 0, RES_K(56), 0, CAP_U(0.1), 0, 10000 -}; - -static DISCRETE_SOUND_START(frogs_discrete) - /************************************************ - * Input register mapping for frogs - * - * All inputs are inverted by initial transistor. - ************************************************/ - DISCRETE_INPUT_LOGIC(FROGS_FLY_EN) - DISCRETE_INPUT_NOT(FROGS_JUMP_EN) - DISCRETE_INPUT_NOT(FROGS_HOP_EN) - DISCRETE_INPUT_NOT(FROGS_TONGUE_EN) - DISCRETE_INPUT_NOT(FROGS_CAPTURE_EN) - DISCRETE_INPUT_NOT(FROGS_SPLASH_EN) - - DISCRETE_ADJUSTMENT(FROGS_R93, RES_M(1), RES_K(10), DISC_LOGADJ, "R93") - - DISCRETE_555_MSTABLE(NODE_30, 1, FROGS_TONGUE_EN, RES_K(100), CAP_U(1), &frogsZip555m) - - /* Q11 & Q12 transform the voltage from the oneshot U4, to what is - * needed by the 555CC circuit. Vin to R29 must be > 1V for things - * to change. <=1 then The Vout of this circuit is 12V. - * The Current through R28 equals current through R51. iR28 = iR51 - * So when Vin>.5, iR51 = (Vin-.5)/39k. =0 when Vin<=.5 - * So the voltage drop across R28 is vR28 = iR51 * 22k. - * Finally the Vout = 12 - vR28. - * Note this formula only works when Vin < 39/(22+39)*12V+1. - * Which it always is, due to the 555 clamping to 12V*2/3. - * The Zip effect is hard to emulate 100% due to loading effects - * of the output stage on the charge stage. So I added some values - * to get a similar waveshape to the breadboarded circuit. - */ - DISCRETE_TRANSFORM5(NODE_31, 12, NODE_30, .5, RES_K(22)/RES_K(39), 0, "012-P4>*3*-") - - DISCRETE_555_CC(NODE_32, 1, NODE_31, RES_K(1.1), CAP_U(0.14), 0, RES_K(100), 500, &frogsZip555cc) - - DISCRETE_MIXER2(NODE_90, 1, NODE_32, 0, &frogsMixer) - - DISCRETE_OUTPUT(NODE_90, 1) - -DISCRETE_SOUND_END - -static const char *const frogs_sample_names[] = -{ - "*frogs", - "boing", - "buzzz", - "croak", - "hop", - "splash", - "zip", - nullptr -}; - - -void vicdual_state::frogs_audio(machine_config &config) -{ - SAMPLES(config, m_samples); - m_samples->set_channels(5); - m_samples->set_samples_names(frogs_sample_names); - m_samples->add_route(ALL_OUTPUTS, "mono", 0.35); - - DISCRETE(config, m_discrete, frogs_discrete); - m_discrete->add_route(ALL_OUTPUTS, "mono", 1.0); -} - - -TIMER_CALLBACK_MEMBER( vicdual_state::frogs_croak_callback ) -{ - m_samples->stop(2); -} - - -MACHINE_START_MEMBER(vicdual_state,frogs_audio) -{ - m_frogs_croak_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vicdual_state::frogs_croak_callback), this)); - - machine_start(); -} - - -void vicdual_state::frogs_audio_w(uint8_t data) -{ - static int last_croak = 0; - static int last_buzzz = 0; - int new_croak = data & 0x08; - int new_buzzz = data & 0x10; - -// m_discrete->write(FROGS_HOP_EN, data & 0x01); -// m_discrete->write(FROGS_JUMP_EN, data & 0x02); - m_discrete->write(FROGS_TONGUE_EN, data & 0x04); -// m_discrete->write(FROGS_CAPTURE_EN, data & 0x08); -// m_discrete->write(FROGS_FLY_EN, data & 0x10); -// m_discrete->write(FROGS_SPLASH_EN, data & 0x80); - - if (data & 0x01) - m_samples->start(3, 3); // Hop - if (data & 0x02) - m_samples->start(0, 0); // Boing - if (new_croak) - m_samples->start(2, 2); // Croak - else - { - if (last_croak) - { - /* The croak will keep playing until .429s after being disabled */ - m_frogs_croak_timer->adjust(attotime::from_double(1.1 * RES_K(390) * CAP_U(1))); - } - } - if (new_buzzz) - { - /* The Buzzz sound starts off a little louder in volume then - * settles down to a steady buzzz. Whenever the trigger goes - * low, the sound is disabled. If it then goes high, the buzzz - * then starts off louder again. The games does this every time - * the fly moves. - * So I made the sample start with the louder effect and then play - * for 12 seconds. A fly should move before this. If not the - * sample loops, adding the loud part as if the fly moved. - * This is obviously incorrect, but a fly never stands still for - * 12 seconds. - */ - if (!last_buzzz) - m_samples->start(1, 1, true); // Buzzz - } - else - m_samples->stop(1); - if (data & 0x80) - m_samples->start(4, 4); // Splash - - last_croak = new_croak; - last_buzzz = new_buzzz; -} - +#include "audio/nl_brdrline.h" +#include "audio/nl_frogs.h" /************************************************************************ @@ -479,154 +300,90 @@ void vicdual_state::invho2_audio_w(uint8_t data) } -/************************************************************************ - * brdrline Sound System Analog emulation - * May 2006, Derrick Renaud - ************************************************************************/ -#if 0 - - -/* Discrete Sound Input Nodes */ -#define BRDRLINE_GUN_TRG_EN NODE_01 -#define BRDRLINE_JEEP_ON_EN NODE_02 -#define BRDRLINE_POINT_TRG_EN NODE_03 -#define BRDRLINE_HIT_TRG_EN NODE_04 -#define BRDRLINE_ANIMAL_TRG_EN NODE_05 -#define BRDRLINE_EMAR_TRG_EN NODE_06 -#define BRDRLINE_WALK_TRG_EN NODE_07 -#define BRDRLINE_CRY_TRG_EN NODE_08 - -/* Nodes - Sounds */ -#define BRDRLINE_GUN_TRG_SND NODE_91 -#define BRDRLINE_JEEP_ON_SND NODE_92 -#define BRDRLINE_POINT_TRG_SND NODE_93 -#define BRDRLINE_HIT_TRG_SND NODE_94 -#define BRDRLINE_ANIMAL_TRG_SND NODE_95 -#define BRDRLINE_EMAR_TRG_SND NODE_96 -#define BRDRLINE_WALK_TRG_SND NODE_97 -#define BRDRLINE_CRY_TRG_SND NODE_98 - -DISCRETE_SOUND_START(brdrline_discrete) - /************************************************ - * Input register mapping - ************************************************/ - DISCRETE_INPUT_LOGIC(BRDRLINE_GUN_TRG_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_JEEP_ON_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_POINT_TRG_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_HIT_TRG_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_ANIMAL_TRG_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_EMAR_TRG_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_WALK_TRG_EN) - DISCRETE_INPUT_LOGIC(BRDRLINE_CRY_TRG_EN) - - /************************************************ - * GUN TRG - ************************************************/ - DISCRETE_LFSR_NOISE(NODE_10, 1, 1,CLK,AMPL,FEED,BIAS,LFSRTB) - DISCRETE_MIXER2(NODE_11, 1, NODE_10,IN1,INFO) - DISCRETE_FILTER2(NODE_12, 1, NODE_11,FREQ,DAMP,TYPE) - DISCRETE_ONESHOT(NODE_13, BRDRLINE_GUN_TRG_EN, DEFAULT_TTL_V_LOGIC_1, - TIME_OF_74LS123(RES_K(47), CAP_U(1)), // R155, C73 - DISC_ONESHOT_FEDGE | DISC_ONESHOT_RETRIG | DISC_OUT_ACTIVE_LOW) - DISCRETE_RCDISC4(NODE_14, 1, NODE_13,RVAL0,RVAL1,RVAL2,CVAL,VP,TYPE) - DISCRETE_VCA(BRDRLINE_GUN_TRG_SND, 1, NODE_12, NODE_14,TYPE) - - /************************************************ - * JEEP ON - ************************************************/ - DISCRETE_555_ASTABLE(NODE_20, BRDRLINE_JEEP_ON_EN, - RES_K(1), // R150 - RES_K(33), // R153 - CAP_U(.1), // C72 - OPTIONS) - DISCRETE_COUNTER(NODE_21, 1, 1, NODE_20,MIN,MAX,DIR,INIT0, DISC_CLK_BY_COUNT) - DISCRETE_COUNTER(NODE_22, 1, 1, NODE_20,MIN,MAX,DIR,INIT0, DISC_CLK_BY_COUNT) - DISCRETE_TRANSFORM3(NODE,INP0,INP1,INP2,FUNCT) - DISCRETE_DAC_R1(NODE,DATA,VDATA,LADDER) - - /************************************************ - * POINT TRG - ************************************************/ - - /************************************************ - * HIT TRG - ************************************************/ - - /************************************************ - * ANIMAL TRG - ************************************************/ - - /************************************************ - * EMAR TRG - ************************************************/ - - /************************************************ - * WALK TRG - ************************************************/ - /************************************************ - * CRY TRG - ************************************************/ - - /************************************************ - * Mixer - ************************************************/ - - DISCRETE_OUTPUT(NODE_90, 1) - -DISCRETE_SOUND_END -#endif - -static const char *const brdrline_sample_names[] = +/************************************* + * + * Netlist-based Vic Dual Audio + * + *************************************/ + +vicdual_audio_device_base::vicdual_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale) : + device_t(mconfig, type, tag, owner, clock), + device_mixer_interface(mconfig, *this), + m_input_line(*this, "sound_nl:in_%u", 0), + m_inputs_mask(inputs_mask), + m_netlist(netlist), + m_output_scale(output_scale) { - "*brdrline", - "boot_and_start", - "coin", - "crashes", - "end_level", - "engine_noise", - "field", - "fire", - nullptr -}; +} +void vicdual_audio_device_base::device_add_mconfig(machine_config &config) +{ + NETLIST_SOUND(config, "sound_nl", 48000) + .set_source(m_netlist) + .add_route(ALL_OUTPUTS, *this, 1.0); + + if (BIT(m_inputs_mask, 0)) + NETLIST_LOGIC_INPUT(config, m_input_line[0], "I_SOUND_0.IN", 0); + if (BIT(m_inputs_mask, 1)) + NETLIST_LOGIC_INPUT(config, m_input_line[1], "I_SOUND_1.IN", 0); + if (BIT(m_inputs_mask, 2)) + NETLIST_LOGIC_INPUT(config, m_input_line[2], "I_SOUND_2.IN", 0); + if (BIT(m_inputs_mask, 3)) + NETLIST_LOGIC_INPUT(config, m_input_line[3], "I_SOUND_3.IN", 0); + if (BIT(m_inputs_mask, 4)) + NETLIST_LOGIC_INPUT(config, m_input_line[4], "I_SOUND_4.IN", 0); + if (BIT(m_inputs_mask, 5)) + NETLIST_LOGIC_INPUT(config, m_input_line[5], "I_SOUND_5.IN", 0); + if (BIT(m_inputs_mask, 6)) + NETLIST_LOGIC_INPUT(config, m_input_line[6], "I_SOUND_6.IN", 0); + if (BIT(m_inputs_mask, 7)) + NETLIST_LOGIC_INPUT(config, m_input_line[7], "I_SOUND_7.IN", 0); + + NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUTPUT").set_mult_offset(m_output_scale, 0.0); +} -void vicdual_state::brdrline_audio(machine_config &config) +void vicdual_audio_device_base::device_start() { - SAMPLES(config, m_samples); - m_samples->set_channels(7); - m_samples->set_samples_names(brdrline_sample_names); - m_samples->add_route(ALL_OUTPUTS, "mono", 0.35); + save_item(NAME(m_input_state)); } -void vicdual_state::brdrline_audio_w(uint8_t data) +void vicdual_audio_device_base::write(u8 value) { - uint8_t res = data ^ 0xff; + if (value != m_input_state) + { + m_input_state = value; + for (int index = 0; index < 8; index++) + if (m_input_line[index] != nullptr) + m_input_line[index]->write_line(BIT(m_input_state, index)); + } +} -// if(res & 2) // low fuel, MISSING - if(res & 8) // end level - m_samples->start(3, 3); +/************************************* + * + * Borderline/Tranquilizer Gun + * + *************************************/ - if(res & 0x10) // moving in the brush - m_samples->start(5, 5); +DEFINE_DEVICE_TYPE(BORDERLINE_AUDIO, borderline_audio_device, "borderline_audio", "Borderline Sound Board") - if(res & 0x20) // fire - m_samples->start(6, 6); +borderline_audio_device::borderline_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + vicdual_audio_device_base(mconfig, BORDERLINE_AUDIO, tag, owner, clock, 0xff, NETLIST_NAME(brdrline), 1.0) +{ +} - if(res & 0x40) // car engine noise - m_samples->start(4, 4); - if(res & 0x80) // crashes - m_samples->start(2, 2); - //printf("%02x\n",res); -} +/************************************* + * + * Frogs + * + *************************************/ + +DEFINE_DEVICE_TYPE(FROGS_AUDIO, frogs_audio_device, "frogs_audio", "Frogs Sound Board") -void vicdual_state::brdrline_audio_aux_w(uint8_t data) +frogs_audio_device::frogs_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + vicdual_audio_device_base(mconfig, FROGS_AUDIO, tag, owner, clock, 0xff, NETLIST_NAME(frogs), 1.0) { - if(data & 0xfc) // coin, unknown which is the trigger - m_samples->start(1, 1); - else // boot sample - m_samples->start(0, 0); } diff --git a/src/mame/audio/vicdual.h b/src/mame/audio/vicdual.h new file mode 100644 index 00000000000..e0a918899e2 --- /dev/null +++ b/src/mame/audio/vicdual.h @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +#ifndef MAME_AUDIO_VICDUAL_H +#define MAME_AUDIO_VICDUAL_H + +#pragma once + +#include "machine/netlist.h" +#include "netlist/nl_setup.h" + + +class vicdual_audio_device_base : public device_t, public device_mixer_interface +{ +protected: + vicdual_audio_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 inputs_mask, void (*netlist)(netlist::nlparse_t &), double output_scale); + + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; + +public: + void write(u8 data); + +private: + optional_device_array<netlist_mame_logic_input_device, 8> m_input_line; + u8 m_input_state = 0xff; + u8 const m_inputs_mask; + void (*const m_netlist)(netlist::nlparse_t &); + double const m_output_scale; +}; + + +class borderline_audio_device : public vicdual_audio_device_base +{ +public: + borderline_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + + +class frogs_audio_device : public vicdual_audio_device_base +{ +public: + frogs_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + + +DECLARE_DEVICE_TYPE(BORDERLINE_AUDIO, borderline_audio_device) +DECLARE_DEVICE_TYPE(FROGS_AUDIO, frogs_audio_device) + +#endif // MAME_AUDIO_VICDUAL_H diff --git a/src/mame/audio/warpwarp.cpp b/src/mame/audio/warpwarp.cpp index 9e00ff069fd..5ef7e52659c 100644 --- a/src/mame/audio/warpwarp.cpp +++ b/src/mame/audio/warpwarp.cpp @@ -52,7 +52,7 @@ void warpwarp_sound_device::device_start() m_clock_16h = clock() / 3 / 2 / 16; m_clock_1v = clock() / 3 / 2 / 384; - m_channel = stream_alloc_legacy(0, 1, m_clock_16h); + m_channel = stream_alloc(0, 1, m_clock_16h); m_sound_volume_timer = timer_alloc(TIMER_SOUND_VOLUME_DECAY); m_music_volume_timer = timer_alloc(TIMER_MUSIC_VOLUME_DECAY); @@ -169,16 +169,16 @@ void warpwarp_sound_device::music2_w(u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void warpwarp_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) - { - stream_sample_t *buffer = outputs[0]; +void warpwarp_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + auto &buffer = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer++ = (m_sound_signal + m_music_signal) / 2; + buffer.put_int(sampindex, m_sound_signal + m_music_signal, 32768 * 2); /* * The music signal is selected at a rate of 2H (1.536MHz) from the diff --git a/src/mame/audio/warpwarp.h b/src/mame/audio/warpwarp.h index 7bf06a4dc25..d4bcdc15d23 100644 --- a/src/mame/audio/warpwarp.h +++ b/src/mame/audio/warpwarp.h @@ -27,7 +27,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/audio/williams.cpp b/src/mame/audio/williams.cpp index b685d102652..e20ef10f8ed 100644 --- a/src/mame/audio/williams.cpp +++ b/src/mame/audio/williams.cpp @@ -76,6 +76,7 @@ williams_cvsd_sound_device::williams_cvsd_sound_device(const machine_config &mco device_mixer_interface(mconfig, *this), m_cpu(*this, "cpu"), m_pia(*this, "pia"), + m_ym2151(*this, "ym2151"), m_hc55516(*this, "cvsd"), m_rombank(*this, "rombank"), m_talkback(0) @@ -185,12 +186,13 @@ void williams_cvsd_sound_device::device_add_mconfig(machine_config &config) PIA6821(config, m_pia, 0); m_pia->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); m_pia->writepb_handler().set(FUNC(williams_cvsd_sound_device::talkback_w)); + m_pia->ca2_handler().set(m_ym2151, FUNC(ym2151_device::reset_w)); m_pia->irqa_handler().set_inputline(m_cpu, M6809_FIRQ_LINE); m_pia->irqb_handler().set_inputline(m_cpu, INPUT_LINE_NMI); - ym2151_device &ym(YM2151(config, "ym2151", CVSD_FM_CLOCK)); - ym.irq_handler().set(m_pia, FUNC(pia6821_device::ca1_w)).invert(); // IRQ is not true state - ym.add_route(ALL_OUTPUTS, *this, 0.10); + YM2151(config, m_ym2151, CVSD_FM_CLOCK); + m_ym2151->irq_handler().set(m_pia, FUNC(pia6821_device::ca1_w)).invert(); // IRQ is not true state + m_ym2151->add_route(ALL_OUTPUTS, *this, 0.10); MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 0.25); voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref")); diff --git a/src/mame/audio/williams.h b/src/mame/audio/williams.h index a14e1d57d06..78006b1800d 100644 --- a/src/mame/audio/williams.h +++ b/src/mame/audio/williams.h @@ -63,6 +63,7 @@ private: // devices required_device<mc6809e_device> m_cpu; required_device<pia6821_device> m_pia; + required_device<ym2151_device> m_ym2151; required_device<hc55516_device> m_hc55516; required_memory_bank m_rombank; diff --git a/src/mame/audio/wiping.cpp b/src/mame/audio/wiping.cpp index 0b83b88f8ac..3ce7f02e096 100644 --- a/src/mame/audio/wiping.cpp +++ b/src/mame/audio/wiping.cpp @@ -11,8 +11,6 @@ #include "emu.h" #include "audio/wiping.h" -static constexpr int defgain = 48; - DEFINE_DEVICE_TYPE(WIPING_CUSTOM, wiping_sound_device, "wiping_sound", "Wiping Custom Sound") wiping_sound_device::wiping_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) @@ -23,10 +21,7 @@ wiping_sound_device::wiping_sound_device(const machine_config &mconfig, const ch m_sound_rom(nullptr), m_num_voices(0), m_sound_enable(0), - m_stream(nullptr), - m_mixer_table(nullptr), - m_mixer_lookup(nullptr), - m_mixer_buffer(nullptr) + m_stream(nullptr) { memset(m_channel_list, 0, sizeof(wp_sound_channel)*MAX_VOICES); memset(m_soundregs, 0, sizeof(uint8_t)*0x4000); @@ -42,13 +37,10 @@ void wiping_sound_device::device_start() wp_sound_channel *voice; /* get stream channels */ - m_stream = stream_alloc_legacy(0, 1, clock()/2); + m_stream = stream_alloc(0, 1, clock()/2); /* allocate a buffer to mix into - 1 second's worth should be more than enough */ - m_mixer_buffer = make_unique_clear<short[]>(clock()/2); - - /* build the mixer table */ - make_mixer_table(8, defgain); + m_mixer_buffer.resize(clock()/2); /* extract globals from the interface */ m_num_voices = 8; @@ -81,26 +73,6 @@ void wiping_sound_device::device_start() } } -/* build a table to divide by the number of voices; gain is specified as gain*16 */ -void wiping_sound_device::make_mixer_table(int voices, int gain) -{ - /* allocate memory */ - m_mixer_table = make_unique_clear<int16_t[]>(256 * voices); - - /* find the middle of the table */ - m_mixer_lookup = m_mixer_table.get() + (128 * voices); - - /* fill in the table - 16 bit case */ - for (int i = 0; i < voices * 128; i++) - { - int val = i * gain * 16 / voices; - if (val > 32767) val = 32767; - m_mixer_lookup[ i] = val; - m_mixer_lookup[-i] = -val; - } -} - - /********************************************************************************/ void wiping_sound_device::sound_w(offs_t offset, uint8_t data) @@ -150,12 +122,12 @@ void wiping_sound_device::sound_w(offs_t offset, uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void wiping_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; wp_sound_channel *voice; short *mix; int i; @@ -163,12 +135,12 @@ void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, strea /* if no sound, we're done */ if (m_sound_enable == 0) { - memset(buffer, 0, samples * sizeof(*buffer)); + buffer.fill(0); return; } /* zap the contents of the mixer buffer */ - memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); /* loop over each voice and add its contribution */ for (voice = m_channel_list; voice < m_last_channel; voice++) @@ -182,10 +154,10 @@ void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, strea const uint8_t *w = voice->wave; int c = voice->counter; - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; /* add our contribution */ - for (i = 0; i < samples; i++) + for (i = 0; i < buffer.samples(); i++) { int offs; @@ -229,7 +201,7 @@ void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } /* mix it down */ - mix = m_mixer_buffer.get(); - for (i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; + mix = &m_mixer_buffer[0]; + for (i = 0; i < buffer.samples(); i++) + buffer.put_int(i, *mix++, 128 * MAX_VOICES); } diff --git a/src/mame/audio/wiping.h b/src/mame/audio/wiping.h index d10a26d2848..1f50683387e 100644 --- a/src/mame/audio/wiping.h +++ b/src/mame/audio/wiping.h @@ -17,7 +17,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: /* 8 voices max */ @@ -48,10 +48,7 @@ private: sound_stream *m_stream; /* mixer tables and internal buffers */ - std::unique_ptr<int16_t[]> m_mixer_table; - int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; - std::unique_ptr<short[]> m_mixer_buffer_2; + std::vector<short> m_mixer_buffer; uint8_t m_soundregs[0x4000]; diff --git a/src/mame/audio/wswan.cpp b/src/mame/audio/wswan.cpp index 0e6442cea6d..6f956ffb57c 100644 --- a/src/mame/audio/wswan.cpp +++ b/src/mame/audio/wswan.cpp @@ -62,7 +62,7 @@ constexpr int clk_div = 64; void wswan_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 2, clock() / clk_div); + m_channel = stream_alloc(0, 2, clock() / clk_div); save_item(NAME(m_sweep_step)); save_item(NAME(m_sweep_time)); @@ -164,16 +164,16 @@ int wswan_sound_device::fetch_sample(int channel, int offset) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void wswan_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t sample, left, right; + s32 sample, left, right; - stream_sample_t *outputl = outputs[0]; - stream_sample_t *outputr = outputs[1]; - while( samples-- > 0 ) + auto &outputl = outputs[0]; + auto &outputr = outputs[1]; + for (int sampindex = 0; sampindex < outputl.samples(); sampindex++) { left = right = 0; @@ -268,11 +268,8 @@ void wswan_sound_device::sound_stream_update_legacy(sound_stream &stream, stream right += m_audio4.vol_right * sample; } - left <<= 5; - right <<= 5; - - *outputl++ = left; - *outputr++ = right; + outputl.put_int(sampindex, left, 32768 >> 5); + outputr.put_int(sampindex, right, 32768 >> 5); } } diff --git a/src/mame/audio/wswan.h b/src/mame/audio/wswan.h index e3c4974bf54..f21ad6adbc5 100644 --- a/src/mame/audio/wswan.h +++ b/src/mame/audio/wswan.h @@ -59,7 +59,7 @@ protected: virtual void rom_bank_updated() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void wswan_ch_set_freq( CHAN *ch, uint16_t freq ); diff --git a/src/mame/audio/xavix.cpp b/src/mame/audio/xavix.cpp index a4b2d12dccb..ab5b2387a86 100644 --- a/src/mame/audio/xavix.cpp +++ b/src/mame/audio/xavix.cpp @@ -27,7 +27,7 @@ void xavix_sound_device::device_start() m_readregs_cb.resolve_safe(0xff); m_readsamples_cb.resolve_safe(0x80); - m_stream = stream_alloc_legacy(0, 2, 163840); + m_stream = stream_alloc(0, 2, 163840); } void xavix_sound_device::device_reset() @@ -43,14 +43,15 @@ void xavix_sound_device::device_reset() } -void xavix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void xavix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // reset the output stream - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); int outpos = 0; // loop while we still have samples to generate + int samples = outputs[0].samples(); while (samples-- != 0) { for (int channel = 0; channel < 2; channel++) @@ -83,7 +84,7 @@ void xavix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream */ } - outputs[channel][outpos] += sample * (m_voice[v].vol + 1); + outputs[channel].add_int(outpos, sample * (m_voice[v].vol + 1), 32768); m_voice[v].position[channel] += m_voice[v].rate; } else diff --git a/src/mame/drivers/1945kiii.cpp b/src/mame/drivers/1945kiii.cpp index db424a83f54..1f78b084df1 100644 --- a/src/mame/drivers/1945kiii.cpp +++ b/src/mame/drivers/1945kiii.cpp @@ -234,8 +234,8 @@ void k3_state::k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_eleme { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp index 1d8ca3d4af0..387a2362366 100644 --- a/src/mame/drivers/5clown.cpp +++ b/src/mame/drivers/5clown.cpp @@ -553,7 +553,7 @@ MC6845_UPDATE_ROW(_5clown_state::update_row) x--- ---- Extra color for 7's. */ - uint32_t *pix = &bitmap.pix32(y); + uint32_t *pix = &bitmap.pix(y); ra &= 0x07; for (int x = 0; x < x_count; x++) diff --git a/src/mame/drivers/8080bw.cpp b/src/mame/drivers/8080bw.cpp index fce3ba4df08..ff08f30ba54 100644 --- a/src/mame/drivers/8080bw.cpp +++ b/src/mame/drivers/8080bw.cpp @@ -5720,10 +5720,10 @@ GAME( 1979, sflush, 0, sflush, sflush, _8080bw_state, empty_i GAME( 1980, lupin3, 0, lupin3, lupin3, _8080bw_state, empty_init, ROT270, "Taito", "Lupin III (set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) GAME( 1980, lupin3a, lupin3, lupin3a, lupin3a, _8080bw_state, empty_init, ROT270, "Taito", "Lupin III (set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1980, polaris, 0, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (Latest version)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980, polarisa, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (Second revision)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980, polarisb, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (First revision)", MACHINE_SUPPORTS_SAVE ) -GAME( 1980, polariso, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (Original version)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980, polaris, 0, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (latest version)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980, polarisa, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (second revision)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980, polarisb, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (first revision)", MACHINE_SUPPORTS_SAVE ) +GAME( 1980, polariso, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito", "Polaris (original version)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, polarisbr, polaris, polaris, polaris, _8080bw_state, empty_init, ROT270, "Taito do Brasil", "Polaris (Brazil)", MACHINE_SUPPORTS_SAVE ) GAME( 1980, ballbomb, 0, ballbomb, ballbomb, _8080bw_state, empty_init, ROT270, "Taito", "Balloon Bomber", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) /* missing clouds */ diff --git a/src/mame/drivers/a5105.cpp b/src/mame/drivers/a5105.cpp index d8ffbbcc55c..3525ce5b51d 100644 --- a/src/mame/drivers/a5105.cpp +++ b/src/mame/drivers/a5105.cpp @@ -120,7 +120,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels ) { int const pen = ((gfx >> xi) & 1) ? 7 : 0; - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } @@ -151,7 +151,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text ) pen = 0; if (m_screen->visible_area().contains(res_x+0, res_y)) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/a7150.cpp b/src/mame/drivers/a7150.cpp index 66250419e21..92a3327b452 100644 --- a/src/mame/drivers/a7150.cpp +++ b/src/mame/drivers/a7150.cpp @@ -122,18 +122,17 @@ private: uint32_t a7150_state::screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b; int addr = 0; - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { int horpos = 0; - for (x = 0; x < 80; x++) + for (int x = 0; x < 80; x++) { uint8_t code = m_video_ram[addr++]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? 1 : 0; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? 1 : 0; } } } diff --git a/src/mame/drivers/abc1600.cpp b/src/mame/drivers/abc1600.cpp index d0a9e05dd02..0f59fbd87b9 100644 --- a/src/mame/drivers/abc1600.cpp +++ b/src/mame/drivers/abc1600.cpp @@ -34,20 +34,20 @@ TODO: - - sas/format/format in abcenix tries to access the SASI card using a memory location mapped for task 0, when the process is run as task 1 - - [:mac] ':3f' (0009E) ff800:4f TASK 0 SEGMENT 15 PAGE 15 MEM 7f800-7ffff 1ff800 - [:mac] ':3f' (0009E) ff801:ff TASK 0 SEGMENT 15 PAGE 15 MEM 7f800-7ffff 1ff800 - [:mac] ':3f' (0009E) ff000:4f TASK 0 SEGMENT 15 PAGE 14 MEM 7f000-7f7ff 1ff000 - [:mac] ':3f' (0009E) ff001:fe TASK 0 SEGMENT 15 PAGE 14 MEM 7f000-7f7ff 1ff000 - [:mac] ':3f' (0009E) fe800:4f TASK 0 SEGMENT 15 PAGE 13 MEM 7e800-7efff 1fe800 - [:mac] ':3f' (0009E) fe801:fd TASK 0 SEGMENT 15 PAGE 13 MEM 7e800-7efff 1fe800 - [:mac] ':3f' (0009E) fe000:4f TASK 0 SEGMENT 15 PAGE 12 MEM 7e000-7e7ff 1fe000 - [:mac] ':3f' (0009E) fe001:fc TASK 0 SEGMENT 15 PAGE 12 MEM 7e000-7e7ff 1fe000 - - [:mac] ':3f' (08A98) MAC 7e4a2:0004a2 (SEGA 02f SEGD 09 PGA 09c PGD 8000 NONX 1 WP 0 TASK 1 FC 1) - should be - [:mac] ':3f' (089A8) MAC 7e4a2:1fe4a2 (SEGA 00f SEGD 0f PGA 0fc PGD 43fc NONX 0 WP 1 TASK 0 FC 5) + - sas/format/format in abcenix tries to access the SASI card using a memory location mapped for task 0, when the process is run as task 1 + + [:mac] ':3f' (0009E) ff800:4f TASK 0 SEGMENT 15 PAGE 15 MEM 7f800-7ffff 1ff800 + [:mac] ':3f' (0009E) ff801:ff TASK 0 SEGMENT 15 PAGE 15 MEM 7f800-7ffff 1ff800 + [:mac] ':3f' (0009E) ff000:4f TASK 0 SEGMENT 15 PAGE 14 MEM 7f000-7f7ff 1ff000 + [:mac] ':3f' (0009E) ff001:fe TASK 0 SEGMENT 15 PAGE 14 MEM 7f000-7f7ff 1ff000 + [:mac] ':3f' (0009E) fe800:4f TASK 0 SEGMENT 15 PAGE 13 MEM 7e800-7efff 1fe800 + [:mac] ':3f' (0009E) fe801:fd TASK 0 SEGMENT 15 PAGE 13 MEM 7e800-7efff 1fe800 + [:mac] ':3f' (0009E) fe000:4f TASK 0 SEGMENT 15 PAGE 12 MEM 7e000-7e7ff 1fe000 + [:mac] ':3f' (0009E) fe001:fc TASK 0 SEGMENT 15 PAGE 12 MEM 7e000-7e7ff 1fe000 + + [:mac] ':3f' (08A98) MAC 7e4a2:0004a2 (SEGA 02f SEGD 09 PGA 09c PGD 8000 NONX 1 WP 0 TASK 1 FC 1) + should be + [:mac] ':3f' (089A8) MAC 7e4a2:1fe4a2 (SEGA 00f SEGD 0f PGA 0fc PGD 43fc NONX 0 WP 1 TASK 0 FC 5) - short/long reset (RSTBUT) - CIO diff --git a/src/mame/drivers/ac1.cpp b/src/mame/drivers/ac1.cpp index cf6f2bf9658..ea8fae0c277 100644 --- a/src/mame/drivers/ac1.cpp +++ b/src/mame/drivers/ac1.cpp @@ -254,9 +254,9 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR('^') PORT_CHAR('~') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR('_') PORT_CHAR(127) diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp index f93a40832ae..6a1c050195e 100644 --- a/src/mame/drivers/accomm.cpp +++ b/src/mame/drivers/accomm.cpp @@ -234,7 +234,7 @@ inline uint8_t accomm_state::read_vram(uint16_t addr) inline void accomm_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t accomm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/acefruit.cpp b/src/mame/drivers/acefruit.cpp index c41d958d314..f8fc8e8b065 100644 --- a/src/mame/drivers/acefruit.cpp +++ b/src/mame/drivers/acefruit.cpp @@ -149,16 +149,14 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in { int startrow = cliprect.min_y / 8; int endrow = cliprect.max_y / 8; - int row; - int col; - for( row = startrow; row <= endrow; row++ ) + for( int row = startrow; row <= endrow; row++ ) { int spriterow = 0; int spriteindex = 0; int spriteparameter = 0; - for( col = 0; col < 32; col++ ) + for( int col = 0; col < 32; col++ ) { int tile_index = ( col * 32 ) + row; int code = m_videoram[ tile_index ]; @@ -170,20 +168,18 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in } else if( color >= 0x5 && color <= 0x7 ) { - int y; - int x; static const int spriteskip[] = { 1, 2, 4 }; int spritesize = spriteskip[ color - 5 ]; gfx_element *gfx = m_gfxdecode->gfx(0); - for( x = 0; x < 16; x++ ) + for( int x = 0; x < 16; x++ ) { int sprite = ( m_spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf; const uint8_t *gfxdata = gfx->get_data(sprite); - for( y = 0; y < 8; y++ ) + for( int y = 0; y < 8; y++ ) { - uint16_t *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) ); + uint16_t *dst = &bitmap.pix(y + ( row * 8 ), x + ( col * 16 ) ); *( dst ) = *( gfxdata + ( ( spriterow + y ) * gfx->rowbytes() ) + ( ( spriteindex % 64 ) >> 1 ) ); } @@ -192,14 +188,11 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in } else { - int y; - int x; - - for( x = 0; x < 16; x++ ) + for( int x = 0; x < 16; x++ ) { - for( y = 0; y < 8; y++ ) + for( int y = 0; y < 8; y++ ) { - uint16_t *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) ); + uint16_t *dst = &bitmap.pix(y + ( row * 8 ), x + ( col * 16 ) ); *( dst ) = 0; } } diff --git a/src/mame/drivers/adacp150.cpp b/src/mame/drivers/adacp150.cpp new file mode 100644 index 00000000000..1243bf7a279 --- /dev/null +++ b/src/mame/drivers/adacp150.cpp @@ -0,0 +1,229 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/*************************************************************************** + + Preliminary driver for Adacom IBM 3287 ASCII printer adapters. + + Currently this does not much more than pass the extensive self-test. + + TODO: make this a bus device in the eventuality of synchronous + communications and a 3270-compatible host both being emulated. + +***************************************************************************/ + +#include "emu.h" +#include "bus/rs232/rs232.h" +#include "cpu/bcp/dp8344.h" +#include "cpu/z80/z80.h" +#include "machine/nvram.h" +#include "machine/z80ctc.h" +#include "machine/z80pio.h" +#include "machine/z80sio.h" +#include "video/hd44780.h" +#include "emupal.h" +#include "screen.h" + +class adacp150_state : public driver_device +{ +public: + adacp150_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_bcp(*this, "bcp") + , m_lcdc(*this, "lcdc") + , m_leds(*this, "led%u", 0U) + , m_bcp_cmd(false) + { + } + + void adacp150(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + HD44780_PIXEL_UPDATE(pixel_update); + void palette_init(palette_device &palette); + + u8 bcp_ram_r(offs_t offset); + void bcp_ram_w(offs_t offset, u8 data); + void output_control_w(u8 data); + + void z80_mem_map(address_map &map); + void z80_io_map(address_map &map); + void bcp_prog_map(address_map &map); + void bcp_data_map(address_map &map); + + required_device<z80_device> m_maincpu; + required_device<dp8344_device> m_bcp; + required_device<hd44780_device> m_lcdc; + output_finder<4> m_leds; + + bool m_bcp_cmd; +}; + +void adacp150_state::machine_start() +{ + m_leds.resolve(); + + m_lcdc->rw_w(0); + + save_item(NAME(m_bcp_cmd)); +} + +HD44780_PIXEL_UPDATE(adacp150_state::pixel_update) +{ + if (x < 5 && y < 8 && line < 2 && pos < 16) + bitmap.pix(line * 8 + y, pos * 6 + x) = state; +} + + +u8 adacp150_state::bcp_ram_r(offs_t offset) +{ + if (m_bcp_cmd) + return m_bcp->cmd_r(); + else + return m_bcp->remote_read(offset | 0x4000); +} + +void adacp150_state::bcp_ram_w(offs_t offset, u8 data) +{ + if (m_bcp_cmd) + m_bcp->cmd_w(data); + else + m_bcp->remote_write(offset | 0x4000, data); +} + +void adacp150_state::output_control_w(u8 data) +{ + for (int n = 0; n < 4; n++) + m_leds[n] = BIT(data, n); + + m_bcp_cmd = BIT(data, 4); + m_lcdc->rs_w(BIT(data, 6)); + m_lcdc->e_w(BIT(data, 5)); +} + + +void adacp150_state::z80_mem_map(address_map &map) +{ + map(0x0000, 0xbfff).rom().region("program", 0); + map(0xc000, 0xffff).rw(FUNC(adacp150_state::bcp_ram_r), FUNC(adacp150_state::bcp_ram_w)); +} + +void adacp150_state::z80_io_map(address_map &map) +{ + map.global_mask(0xff); + map(0x00, 0x03).rw("pio", FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); + map(0x04, 0x07).rw("ctc", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x08, 0x0b).rw("sio", FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w)); + map(0x80, 0x80).portr("IN0"); + map(0xa0, 0xa0).portr("IN1"); + map(0xc0, 0xc0).w(FUNC(adacp150_state::output_control_w)); + map(0xe0, 0xe0).w(m_lcdc, FUNC(hd44780_device::db_w)); +} + +void adacp150_state::bcp_prog_map(address_map &map) +{ + map(0x0000, 0x07ff).ram(); // 2x CXK5814P-35L +} + +void adacp150_state::bcp_data_map(address_map &map) +{ + map(0x0000, 0x7fff).ram().share("nvram"); +} + + +static INPUT_PORTS_START(adacp150) + PORT_START("IN0") // not verified + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Save") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Roll") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Set-Up") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Reset") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Cancel") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Reprint") + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PA 1") + + PORT_START("IN1") // not verified + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PA 2") + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("LF") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("FF") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hold") + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +void adacp150_state::palette_init(palette_device &palette) +{ + palette.set_pen_color(0, rgb_t(131, 136, 139)); + palette.set_pen_color(1, rgb_t( 92, 83, 88)); +} + +static const z80_daisy_config daisy_chain[] = +{ + { "ctc" }, + { "sio" }, + { "pio" }, + { nullptr } +}; + +void adacp150_state::adacp150(machine_config &config) +{ + auto MAIN_CLOCK = 18.8696_MHz_XTAL / 6; + + Z80(config, m_maincpu, MAIN_CLOCK); // Zilog Z84C0006PEC + m_maincpu->set_addrmap(AS_PROGRAM, &adacp150_state::z80_mem_map); + m_maincpu->set_addrmap(AS_IO, &adacp150_state::z80_io_map); + m_maincpu->set_daisy_config(daisy_chain); + + DP8344A(config, m_bcp, 18.8696_MHz_XTAL); // DP8344AV + m_bcp->set_addrmap(AS_PROGRAM, &adacp150_state::bcp_prog_map); + m_bcp->set_addrmap(AS_DATA, &adacp150_state::bcp_data_map); + m_bcp->set_auto_start(false); + + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // CXK58257P-10L + battery + + z80ctc_device &ctc(Z80CTC(config, "ctc", MAIN_CLOCK)); // TODO: part of Zilog Z84C9008VSC Z80 KIO + ctc.set_clk<0>(2.4576_MHz_XTAL / 2); + ctc.set_clk<1>(2.4576_MHz_XTAL / 2); + ctc.zc_callback<0>().set("sio", FUNC(z80sio_device::rxca_w)); + ctc.zc_callback<0>().append("sio", FUNC(z80sio_device::txca_w)); + ctc.zc_callback<1>().set("sio", FUNC(z80sio_device::rxcb_w)); + ctc.zc_callback<1>().append("sio", FUNC(z80sio_device::txcb_w)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + + z80pio_device &pio(Z80PIO(config, "pio", MAIN_CLOCK)); // TODO: part of Zilog Z84C9008VSC Z80 KIO + pio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + + z80sio_device &sio(Z80SIO(config, "sio", MAIN_CLOCK)); // TODO: part of Zilog Z84C9008VSC Z80 KIO + sio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + sio.out_txda_callback().set("printer", FUNC(rs232_port_device::write_txd)); + sio.out_txdb_callback().set("host", FUNC(rs232_port_device::write_txd)); + + rs232_port_device &printer(RS232_PORT(config, "printer", default_rs232_devices, nullptr)); + printer.rxd_handler().set("sio", FUNC(z80sio_device::rxa_w)); + + rs232_port_device &host(RS232_PORT(config, "host", default_rs232_devices, nullptr)); + host.rxd_handler().set("sio", FUNC(z80sio_device::rxb_w)); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(50); + screen.set_screen_update(m_lcdc, FUNC(hd44780_device::screen_update)); + screen.set_size(16*6, 16); + screen.set_visarea(0, 16*6-1, 0, 16-1); + screen.set_palette("palette"); + + HD44780(config, m_lcdc); + m_lcdc->set_lcd_size(2, 20); + m_lcdc->set_pixel_update_cb(FUNC(adacp150_state::pixel_update)); + + PALETTE(config, "palette", FUNC(adacp150_state::palette_init), 2); +} + +ROM_START(adacp150p) + ROM_REGION(0xc000, "program", 0) + ROM_LOAD("pa_2436__rev-4.52.u11", 0x0000, 0x8000, CRC(a381674c) SHA1(1d3cb4ca3ead40da67a353efe7553ea953fa929d)) // Intel D27C256 + ROM_LOAD("pa_2437__rev-4.52.u22", 0x8000, 0x4000, CRC(eb468ad0) SHA1(881a90a6aa89d7e289d7adbec46d007a8cfa5351)) // Intel D27C128 +ROM_END + +SYST(1989, adacp150p, 0, 0, adacp150, adacp150, adacp150_state, empty_init, "Adacom", "CP-150 Plus", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW) diff --git a/src/mame/drivers/adm11.cpp b/src/mame/drivers/adm11.cpp index f976f7da444..e21e34ee018 100644 --- a/src/mame/drivers/adm11.cpp +++ b/src/mame/drivers/adm11.cpp @@ -93,7 +93,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(adm11_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/aleck64.cpp b/src/mame/drivers/aleck64.cpp index 48eb265d078..b0d380bffe0 100644 --- a/src/mame/drivers/aleck64.cpp +++ b/src/mame/drivers/aleck64.cpp @@ -1085,10 +1085,6 @@ uint32_t aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &b for(int offs=0;offs<0x1000/4;offs+=2) { - int xi,yi; - int r,g,b; - int pal_offs; - int pal_shift; // 0x400 is another enable? end code if off? //uint16_t tile = m_e90_vram[offs] >> 16; @@ -1113,28 +1109,26 @@ uint32_t aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &b // some pieces needs this color adjustment (see T piece / 5 block version of I piece) pal |= (attr & 0xc0) >> 4; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - uint16_t raw_rgb; - res_x = x+xi + 4; - res_y = (y & 0xff)+yi + 7; + int res_x = x+xi + 4; + int res_y = (y & 0xff)+yi + 7; - pal_offs = (pal*0x10); + int pal_offs = (pal*0x10); pal_offs+= pal_table[xi+yi*8]; - pal_shift = pal_offs & 1 ? 0 : 16; - raw_rgb = m_e90_pal[pal_offs>>1] >> pal_shift; - r = (raw_rgb & 0x001f) >> 0; - g = (raw_rgb & 0x03e0) >> 5; - b = (raw_rgb & 0x7c00) >> 10; + int pal_shift = pal_offs & 1 ? 0 : 16; + uint16_t raw_rgb = m_e90_pal[pal_offs>>1] >> pal_shift; + int r = (raw_rgb & 0x001f) >> 0; + int g = (raw_rgb & 0x03e0) >> 5; + int b = (raw_rgb & 0x7c00) >> 10; r = pal5bit(r); g = pal5bit(g); b = pal5bit(b); if(cliprect.contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b; + bitmap.pix(res_y, res_x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp index 36759cd6af8..1b02744e3bb 100644 --- a/src/mame/drivers/alesis.cpp +++ b/src/mame/drivers/alesis.cpp @@ -411,7 +411,7 @@ HD44780_PIXEL_UPDATE(alesis_state::sr16_pixel_update) if (line == 1 && pos >= 6 && pos < 8) // last 2 characters of the second line are used to control the LCD symbols update_lcd_symbols(bitmap, pos, y, x, state); else if (pos < 8) - bitmap.pix16(line*9 + y, pos*6 + x) = state; + bitmap.pix(line*9 + y, pos*6 + x) = state; } void alesis_state::hr16(machine_config &config) diff --git a/src/mame/drivers/alfaskop41xx.cpp b/src/mame/drivers/alfaskop41xx.cpp index 30bb0733266..103f9897616 100644 --- a/src/mame/drivers/alfaskop41xx.cpp +++ b/src/mame/drivers/alfaskop41xx.cpp @@ -285,14 +285,14 @@ template <unsigned N> void alfaskop4110_state::irq_w(int state) /* Simplified chargen, no attributes or special formats/features yet */ MC6845_UPDATE_ROW( alfaskop4110_state::crtc_update_row ) { - offs_t base = ma + 0x4000; - u32 *px = &bitmap.pix32(y); + offs_t const base = ma + 0x4000; + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { u8 chr = m_vram[(base + i) & 0x07ff] & 0x7f; - rgb_t bg = rgb_t::white(); - rgb_t fg = rgb_t::black(); + rgb_t const bg = rgb_t::white(); + rgb_t const fg = rgb_t::black(); u8 dots = m_chargen[chr * 16 + ra]; diff --git a/src/mame/drivers/alg.cpp b/src/mame/drivers/alg.cpp index 73189abc79e..9e42a1ce7e5 100644 --- a/src/mame/drivers/alg.cpp +++ b/src/mame/drivers/alg.cpp @@ -30,7 +30,6 @@ #include "machine/ldp1450.h" #include "machine/nvram.h" #include "machine/amigafdc.h" -#include "render.h" #include "speaker.h" diff --git a/src/mame/drivers/alinvade.cpp b/src/mame/drivers/alinvade.cpp index ce86f28db3a..a13baceb064 100644 --- a/src/mame/drivers/alinvade.cpp +++ b/src/mame/drivers/alinvade.cpp @@ -177,23 +177,19 @@ void alinvade_state::machine_reset() uint32_t alinvade_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = (offs << 3)&0x7f; int y = (offs >> 4)&0x7f; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/alphajuno.cpp b/src/mame/drivers/alphajuno.cpp index 95800a634b9..13f09295084 100644 --- a/src/mame/drivers/alphajuno.cpp +++ b/src/mame/drivers/alphajuno.cpp @@ -58,7 +58,7 @@ void alphajuno_state::machine_reset() HD44780_PIXEL_UPDATE(alphajuno_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp index 08a9c361569..68a3936f12c 100644 --- a/src/mame/drivers/alphatpx.cpp +++ b/src/mame/drivers/alphatpx.cpp @@ -903,31 +903,31 @@ static const gfx_layout extcharlayout = u32 alphatp_12_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); - int start = m_crtc->upscroll_offset(); + pen_t const *const pen = m_palette->pens(); + int const start = m_crtc->upscroll_offset(); rectangle cursor; m_crtc->cursor_bounds(cursor); for (int y = 0; y < 24; y++) { - int vramy = (start + y) % 24; + int const vramy = (start + y) % 24; for (int x = 0; x < 80; x++) { u8 code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line // draw 12 lines of the character - bool cursoren = cursor.contains(x * 8, y * 12); + bool const cursoren = cursor.contains(x * 8, y * 12); for (int line = 0; line < 12; line++) { u8 data = m_gfx[((code & 0x7f) * 16) + line]; if (cursoren) data ^= 0xff; - bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; } } } @@ -945,23 +945,23 @@ GFXDECODE_END u32 alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); - int start = m_crtc->upscroll_offset(); + pen_t const *const pen = m_palette->pens(); + int const start = m_crtc->upscroll_offset(); rectangle cursor; m_crtc->cursor_bounds(cursor); - bool scrext = m_scncfg->read() ? true : false; + bool const scrext = m_scncfg->read() ? true : false; for (int y = 0; y < 24; y++) { - int vramy = (start + y) % 24; + int const vramy = (start + y) % 24; for (int x = 0; x < 80; x++) { u8 code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line // draw 12 lines of the character - bool cursoren = cursor.contains(x * 8, y * 12); + bool const cursoren = cursor.contains(x * 8, y * 12); for (int line = 0; line < 12; line++) { u8 data = 0; - if(scrext) + if (scrext) { offs_t offset = (((vramy * 12) + line) * 80) + x; if(offset < (371 * 80)) @@ -974,14 +974,14 @@ u32 alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, if (cursoren) data ^= 0xff; } - bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; } } } diff --git a/src/mame/drivers/alphatro.cpp b/src/mame/drivers/alphatro.cpp index 0070adcf3d6..912dc35452f 100644 --- a/src/mame/drivers/alphatro.cpp +++ b/src/mame/drivers/alphatro.cpp @@ -340,22 +340,19 @@ void alphatro_state::portf0_w(uint8_t data) MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); bool palette = BIT(m_config->read(), 5); if (y==0) m_flashcnt++; - bool inv; - u8 chr,gfx,attr,bg,fg; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x); - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - attr = m_p_videoram[mem | 0x800]; - bg = (palette) ? 8 : attr & 7; // amber or RGB - fg = (palette) ? 0 : (attr & 0x38) >> 3; + bool inv = (x == cursor_x); + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_p_videoram[mem]; + u8 attr = m_p_videoram[mem | 0x800]; + u8 bg = (palette) ? 8 : attr & 7; // amber or RGB + u8 fg = (palette) ? 0 : (attr & 0x38) >> 3; if (BIT(attr, 7)) // reverse video { @@ -369,7 +366,7 @@ MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; + u8 gfx = m_p_chargen[(chr<<4) | ra]; if (inv) { diff --git a/src/mame/drivers/amust.cpp b/src/mame/drivers/amust.cpp index 1c7d01dd4d8..e62018b31fa 100644 --- a/src/mame/drivers/amust.cpp +++ b/src/mame/drivers/amust.cpp @@ -85,6 +85,7 @@ ToDo: #include "bus/rs232/rs232.h" #include "machine/upd765.h" #include "sound/beep.h" +#include "machine/timer.h" #include "video/mc6845.h" #include "emupal.h" #include "screen.h" @@ -106,16 +107,12 @@ public: , m_fdc (*this, "fdc") , m_floppy0(*this, "fdc:0") , m_floppy1(*this, "fdc:1") + , m_beep_timer(*this, "beep_timer") { } void amust(machine_config &config); private: - enum - { - TIMER_BEEP_OFF - }; - u8 port04_r(); void port04_w(u8 data); u8 port05_r(); @@ -133,6 +130,7 @@ private: DECLARE_WRITE_LINE_MEMBER(intrq_w); void kbd_put(u8 data); MC6845_UPDATE_ROW(crtc_update_row); + TIMER_DEVICE_CALLBACK_MEMBER(beep_timer); void io_map(address_map &map); void mem_map(address_map &map); @@ -151,7 +149,6 @@ private: bool m_hsync; bool m_vsync; std::unique_ptr<u8[]> m_vram; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; memory_passthrough_handler *m_rom_shadow_tap; required_device<palette_device> m_palette; required_device<cpu_device> m_maincpu; @@ -163,18 +160,12 @@ private: required_device<upd765a_device> m_fdc; required_device<floppy_connector> m_floppy0; required_device<floppy_connector> m_floppy1; + required_device<timer_device> m_beep_timer; }; -void amust_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(amust_state::beep_timer) { - switch (id) - { - case TIMER_BEEP_OFF: - m_beep->set_state(0); - break; - default: - throw emu_fatalerror("Unknown id in amust_state::device_timer"); - } + m_beep->set_state(0); } //void amust_state::port00_w(u8 data) @@ -346,7 +337,7 @@ void amust_state::port0a_w(u8 data) if (!BIT(data, 4)) { m_beep->set_state(1); - timer_set(attotime::from_msec(150), TIMER_BEEP_OFF); + m_beep_timer->adjust(attotime::from_msec(150)); } floppy_image_device *floppy = m_floppy0->get_device(); m_fdc->set_floppy(floppy); @@ -384,16 +375,15 @@ GFXDECODE_END MC6845_UPDATE_ROW( amust_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,inv; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; + u8 inv = (x == cursor_x) ? 0xff : 0; + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra] ^ inv; else @@ -481,6 +471,7 @@ void amust_state::amust(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); BEEP(config, m_beep, 800).add_route(ALL_OUTPUTS, "mono", 0.50); + TIMER(config, m_beep_timer).configure_generic(FUNC(amust_state::beep_timer)); /* Devices */ hd6845s_device &crtc(HD6845S(config, "crtc", XTAL(14'318'181) / 8)); diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp index 9c010c25bbb..cf3686b1730 100644 --- a/src/mame/drivers/apc.cpp +++ b/src/mame/drivers/apc.cpp @@ -207,51 +207,38 @@ UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi,yi_trans; - int x; - uint8_t char_size; -// uint8_t interlace_on; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // if(m_video_ff[DISPLAY_REG] == 0) //screen is off // return; -// interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ - char_size = 19; +// uint8_t interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ + uint8_t char_size = 19; - for(x=0;x<pitch;x++) + for(int x=0;x<pitch;x++) { - uint8_t tile_data; - uint8_t u_line, o_line, v_line, reverse, blink; - uint8_t color; - uint8_t tile,attr,pen; - uint32_t tile_addr; - uint8_t tile_sel; - -// tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); - tile_addr = addr+(x*(1)); - - tile = (m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] >> 8) & 0x00ff; - tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; - attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); - - u_line = attr & 0x01; - o_line = attr & 0x02; - v_line = attr & 0x04; - blink = attr & 0x08; - reverse = attr & 0x10; +// uint32_t tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); + uint32_t tile_addr = addr+(x*(1)); + + uint8_t tile = (m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] >> 8) & 0x00ff; + uint8_t tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; + uint8_t attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); + + uint8_t u_line = attr & 0x01; + uint8_t o_line = attr & 0x02; + uint8_t v_line = attr & 0x04; + uint8_t blink = attr & 0x08; + uint8_t reverse = attr & 0x10; // secret= (attr & 1) ^ 1; - color = (attr & 0xe0) >> 5; + uint8_t color = (attr & 0xe0) >> 5; - for(yi=0;yi<lr;yi++) + for(int yi=0;yi<lr;yi++) { - yi_trans = (yi==0)?lr-1:yi-1; - for(xi=0;xi<8;xi++) + int yi_trans = (yi==0)?lr-1:yi-1; + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - - res_x = (x*8+xi); - res_y = y+yi; + int res_x = (x*8+xi); + int res_y = y+yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; @@ -272,6 +259,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) Data bus: 76543210 = pixels, in left->01234567->right order */ + uint8_t tile_data; if(tile_sel == 0x89)// Aux character RAM select TODO: correct triggering? { if(yi & 0x10) @@ -291,13 +279,14 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) if(cursor_on && cursor_addr == tile_addr && m_screen->frame_number() & 0x10) tile_data^=0xff; + uint8_t pen; if(yi >= char_size) pen = 0; else pen = (tile_data >> (xi) & 1) ? color : 0; if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/apf.cpp b/src/mame/drivers/apf.cpp index d04c8e164a7..66fcf6af6b8 100644 --- a/src/mame/drivers/apf.cpp +++ b/src/mame/drivers/apf.cpp @@ -34,6 +34,16 @@ RAM switch - Basic will work with 8K or 16K. +The monitor +----------- +From Basic, do CALL 28672 to enter the monitor - you get a * prompt. Commands: +D nnnn - display memory +G nnnn - goto an address +M nnnn - modify memory +Type the command letter, then all 4 digits, no need to hit Enter. +To exit back to Basic, do G 8894 (Basic has no prompt). + + Status of cart-based games -------------------------- backgammon - works, needs offset of 0x120, bottom line is coming from 0x3E0, should be 0x380 diff --git a/src/mame/drivers/apogee.cpp b/src/mame/drivers/apogee.cpp index e89e0ba03b0..6284114c8e6 100644 --- a/src/mame/drivers/apogee.cpp +++ b/src/mame/drivers/apogee.cpp @@ -153,7 +153,7 @@ static INPUT_PORTS_START( apogee ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) INPUT_PORTS_END -static const int16_t speaker_levels[] = {-32767, -10922, 10922, 32767}; +static const double speaker_levels[] = {-1.0, -0.33333, 0.33333, 1.0}; WRITE_LINE_MEMBER(apogee_state::pit8253_out0_changed) { @@ -216,7 +216,7 @@ I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels) pixels ^= 0xff; for(int i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index 5cf5e9c3e95..cdc46753200 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -324,24 +324,21 @@ void apple1_state::poll_keyboard() void apple1_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; int fg = 1, bg = 0; - int charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); + int const charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); /* look up the character data */ - chardata = &textgfx_data[(charcode * 8)]; + uint8_t const *const chardata = &textgfx_data[(charcode * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index 48df76ff6b4..2f33aeece2c 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -803,14 +803,11 @@ void apple2_state::inh_w(offs_t offset, uint8_t data) } } -// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter +// floating bus code from old machine/apple2: now works reasonably well with French Touch and Deater "vapor lock" stuff uint8_t apple2_state::read_floatingbus() { enum { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - // scanner constants kHBurstClock = 53, // clock when Color Burst starts kHBurstClocks = 4, // clocks per Color Burst duration @@ -855,8 +852,7 @@ uint8_t apple2_state::read_floatingbus() // ScanCycles = ScanLines * kHClocks; // calculate horizontal scanning state - // - h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock + h_clock = (i + 63) % kHClocks; // which horizontal scanning clock h_state = kHClock0State + h_clock; // H state bits if (h_clock >= kHPresetClock) // check for horizontal preset { @@ -871,7 +867,7 @@ uint8_t apple2_state::read_floatingbus() // calculate vertical scanning state // - v_line = (i / kHClocks) + 188; // which vertical scanning line + v_line = (i / kHClocks) + 192; // which vertical scanning line v_state = kVLine0State + v_line; // V state bits if ((v_line >= kVPresetLine)) // check for previous vertical state preset { @@ -922,15 +918,14 @@ uint8_t apple2_state::read_floatingbus() { // N: text, so no higher address bits unless Apple ][, not Apple //e // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? + if ((kHPEClock <= h_clock) && // Y: HBL? (h_clock <= (kHClocks - 1))) { address |= 1 << 12; // Y: a12 (add $1000 to address!) } } - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? + return m_ram_ptr[address % m_ram_size]; } /*************************************************************************** @@ -1063,6 +1058,15 @@ WRITE_LINE_MEMBER(apple2_state::ay3600_data_ready_w) if (state == ASSERT_LINE) { int mod = 0; + + // if the user presses a valid key to start the driver from the info screen, + // we will see that key. ignore keys in the first 25,000 cycles (in my tests, + // the unwanted key shows up at 17030 cycles) + if (m_maincpu->total_cycles() < 25000) + { + return; + } + m_lastchar = m_ay3600->b_r(); mod = (m_kbspecial->read() & 0x06) ? 0x01 : 0x00; @@ -1344,7 +1348,7 @@ void apple2_state::apple2_common(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - SPEAKER_SOUND(config, A2_SPEAKER_TAG).add_route(ALL_OUTPUTS, "mono", 1.00); + SPEAKER_SOUND(config, A2_SPEAKER_TAG).add_route(ALL_OUTPUTS, "mono", 0.4); /* /INH banking */ ADDRESS_MAP_BANK(config, A2_UPPERBANK_TAG).set_map(&apple2_state::inhbank_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x3000); diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 891e8dbe22c..4a244d12f2f 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -176,6 +176,7 @@ MIG RAM page 2 $CE02 is the speaker/slot bitfield and $CE03 is the paddle/accele #include "bus/a2bus/byte8251.h" #include "bus/a2bus/a2iwm.h" #include "bus/a2bus/uthernet.h" +#include "bus/a2bus/sider.h" #include "bus/a2gameio/gameio.h" #include "bus/rs232/rs232.h" @@ -187,7 +188,6 @@ MIG RAM page 2 $CE02 is the speaker/slot bitfield and $CE03 is the paddle/accele #include "formats/ap2_dsk.h" #include "formats/ap_dsk35.h" - #define A2_CPU_TAG "maincpu" #define A2_KBDC_TAG "ay3600" #define A2_BUS_TAG "a2bus" @@ -271,6 +271,13 @@ public: m_ds1315(*this, "nsc") { m_accel_laser = false; + m_isiic = false; + m_isiicplus = false; + m_iscec = false; + m_iscecm = false; + m_iscec2000 = false; + m_spectrum_text = false; + m_pal = false; } required_device<cpu_device> m_maincpu; @@ -402,10 +409,12 @@ public: void cec(machine_config &config); void mprof3(machine_config &config); void apple2e(machine_config &config); + void apple2epal(machine_config &config); void apple2ep(machine_config &config); void apple2c(machine_config &config); void tk3000(machine_config &config); void apple2ee(machine_config &config); + void apple2eepal(machine_config &config); void apple2c_map(address_map &map); void apple2c_memexp_map(address_map &map); void apple2e_map(address_map &map); @@ -425,6 +434,7 @@ public: void spectred_keyb_map(address_map &map); void init_128ex(); void init_spect(); + void init_pal(); bool m_35sel, m_hdsel, m_intdrive; @@ -466,7 +476,7 @@ private: bool m_mockingboard4c; bool m_intc8rom; - bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_spectrum_text; + bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_spectrum_text, m_pal; uint8_t m_migram[0x800]; uint16_t m_migpage; @@ -1014,6 +1024,8 @@ void apple2e_state::machine_reset() m_slotc3rom = false; m_romswitch = false; m_irqmask = 0; + m_strobe = 0; + m_transchar = 0; m_anykeydown = false; m_repeatdelay = 10; m_xy = false; @@ -1105,6 +1117,11 @@ void apple2e_state::init_spect() m_spectrum_text = true; } +void apple2e_state::init_pal() +{ + m_pal = true; +} + void apple2e_state::raise_irq(int irq) { m_irqmask |= (1 << irq); @@ -1760,7 +1777,7 @@ void apple2e_state::do_io(int offset, bool is_iic) uint8_t apple2e_state::c000_r(offs_t offset) { if(machine().side_effects_disabled()) return read_floatingbus(); - u8 uFloatingBus7 = read_floatingbus() & 0x7f; + const u8 uFloatingBus7 = read_floatingbus() & 0x7f; if ((offset & 0xf0) == 0x00) // keyboard latch, $C000 is really 00-0F { @@ -2153,7 +2170,7 @@ uint8_t apple2e_state::c000_iic_r(offs_t offset) return m_y0edge ? 0x80 : 0x00; case 0x60: // 40/80 column switch (IIc only) - return ((m_sysconfig->read() & 0x04) ? 0x80 : 0) | uFloatingBus7; + return ((m_sysconfig->read() & 0x40) ? 0x80 : 0) | uFloatingBus7; case 0x61: // button 0 or Open Apple or mouse button 1 case 0x69: @@ -2362,7 +2379,7 @@ void apple2e_state::update_iic_mouse() { int new_mx, new_my; - // read the axes + // read the axes and check for changes new_mx = m_mousex->read(); new_my = m_mousey->read(); @@ -2373,9 +2390,16 @@ void apple2e_state::update_iic_mouse() /* check for wrap */ if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; + { + diff -= 0x100; + } + else + { + if (diff < -0x80) + { + diff += 0x100; + } + } count_x += diff; last_mx = new_mx; @@ -2388,9 +2412,16 @@ void apple2e_state::update_iic_mouse() /* check for wrap */ if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; + { + diff -= 0x100; + } + else + { + if (diff < -0x80) + { + diff += 0x100; + } + } count_y += diff; last_my = new_my; @@ -2895,14 +2926,11 @@ void apple2e_state::lc_w(offs_t offset, uint8_t data) } } -// floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter +// floating bus code from old machine/apple2: now works reasonably well with French Touch and Deater "vapor lock" stuff uint8_t apple2e_state::read_floatingbus() { enum { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - // scanner constants kHBurstClock = 53, // clock when Color Burst starts kHBurstClocks = 4, // clocks per Color Burst duration @@ -2919,9 +2947,10 @@ uint8_t apple2e_state::read_floatingbus() kVLine0State = 0x100, // V[543210CBA] = 100000000 kVPresetLine = 256, // line when V state presets kVSyncLines = 4, // lines per VSync duration - kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? }; + const int kClocksPerVSync = kHClocks * (m_pal ? kPALScanLines : kNTSCScanLines); + // vars // int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ @@ -2941,14 +2970,11 @@ uint8_t apple2e_state::read_floatingbus() _80Store = m_80store ? 1 : 0; // calculate video parameters according to display standard - // - ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? - // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? - // ScanCycles = ScanLines * kHClocks; + // we call this "PAL", but it's also for SECAM + ScanLines = m_pal ? kPALScanLines : kNTSCScanLines; // calculate horizontal scanning state - // - h_clock = (i + kHPEClock) % kHClocks; // which horizontal scanning clock + h_clock = (i + 63) % kHClocks; // which horizontal scanning clock h_state = kHClock0State + h_clock; // H state bits if (h_clock >= kHPresetClock) // check for horizontal preset { @@ -2963,7 +2989,7 @@ uint8_t apple2e_state::read_floatingbus() // calculate vertical scanning state // - v_line = (i / kHClocks) + 188; // which vertical scanning line (MAME starts at blank, not the beginning of the scanning area) + v_line = (i / kHClocks) + 192; // which vertical scanning line (MAME starts at blank, not the beginning of the scanning area) v_state = kVLine0State + v_line; // V state bits if ((v_line >= kVPresetLine)) // check for previous vertical state preset { @@ -3010,19 +3036,8 @@ uint8_t apple2e_state::read_floatingbus() address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 address |= (Page2 & (1 ^ _80Store)) << 14; // a14 } - else - { - // N: text, so no higher address bits unless Apple ][, not Apple //e - // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? - (h_clock <= (kHClocks - 1))) - { - address |= 1 << 12; // Y: a12 (add $1000 to address!) - } - } - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? + return m_ram_ptr[address % m_ram_size]; } /*************************************************************************** @@ -3290,6 +3305,14 @@ WRITE_LINE_MEMBER(apple2e_state::ay3600_data_ready_w) uint8_t *decode = m_kbdrom->base(); uint16_t trans; + // if the user presses a valid key to start the driver from the info screen, + // we will see that key. ignore keys in the first 25,000 cycles (in my tests, + // the unwanted key shows up at 17030 cycles) + if (m_maincpu->total_cycles() < 25000) + { + return; + } + m_lastchar = m_ay3600->b_r(); trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff @@ -3309,7 +3332,7 @@ WRITE_LINE_MEMBER(apple2e_state::ay3600_data_ready_w) if (m_isiic) { - if (m_sysconfig->read() & 0x08) + if (m_sysconfig->read() & 0x80) { trans += 0x400; // go to DVORAK half of the ROM } @@ -3381,17 +3404,18 @@ INPUT_PORTS_END static INPUT_PORTS_START( apple2c_sysconfig ) PORT_START("a2_config") - PORT_CONFNAME(0x03, 0x00, "Composite monitor type") + PORT_CONFNAME(0x07, 0x00, "Composite monitor type") PORT_CONFSETTING(0x00, "Color") PORT_CONFSETTING(0x01, "B&W") PORT_CONFSETTING(0x02, "Green") PORT_CONFSETTING(0x03, "Amber") - PORT_CONFNAME(0x04, 0x04, "40/80 Columns") + + PORT_CONFNAME(0x40, 0x40, "40/80 Columns") PORT_CONFSETTING(0x00, "80 columns") - PORT_CONFSETTING(0x04, "40 columns") - PORT_CONFNAME(0x08, 0x00, "QWERTY/DVORAK") + PORT_CONFSETTING(0x40, "40 columns") + PORT_CONFNAME(0x80, 0x00, "QWERTY/DVORAK") PORT_CONFSETTING(0x00, "QWERTY") - PORT_CONFSETTING(0x08, "DVORAK") + PORT_CONFSETTING(0x80, "DVORAK") PORT_CONFNAME(0x10, 0x00, "CPU type") PORT_CONFSETTING(0x00, "Standard") @@ -4502,6 +4526,8 @@ static void apple2_cards(device_slot_interface &device) device.option_add("byte8251", A2BUS_BYTE8251); /* BYTE Magazine 8251 serial card */ device.option_add("cmsscsi", A2BUS_CMSSCSI); /* CMS Apple II SCSI Card */ device.option_add("uthernet", A2BUS_UTHERNET); /* A2RetroSystems Uthernet card */ + device.option_add("sider2", A2BUS_SIDER2); /* Advanced Tech Systems / First Class Peripherals Sider 2 SASI card */ + device.option_add("sider1", A2BUS_SIDER1); /* Advanced Tech Systems / First Class Peripherals Sider 1 SASI card */ } static void apple2eaux_cards(device_slot_interface &device) @@ -4533,7 +4559,7 @@ void apple2e_state::apple2e(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - SPEAKER_SOUND(config, A2_SPEAKER_TAG).add_route(ALL_OUTPUTS, "mono", 1.00); + SPEAKER_SOUND(config, A2_SPEAKER_TAG).add_route(ALL_OUTPUTS, "mono", 0.4); /* DS1315 for no-slot clock */ DS1315(config, m_ds1315, 0).read_backing().set(FUNC(apple2e_state::nsc_backing_r)); @@ -4631,6 +4657,12 @@ void apple2e_state::apple2e(machine_config &config) m_cassette->add_route(ALL_OUTPUTS, "mono", 0.05); } +void apple2e_state::apple2epal(machine_config &config) +{ + apple2e(config); + m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 312, 0, 192); +} + void apple2e_state::mprof3(machine_config &config) { apple2e(config); @@ -4648,6 +4680,12 @@ void apple2e_state::apple2ee(machine_config &config) m_maincpu->set_dasm_override(FUNC(apple2e_state::dasm_trampoline)); } +void apple2e_state::apple2eepal(machine_config &config) +{ + apple2ee(config); + m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 312, 0, 192); +} + void apple2e_state::spectred(machine_config &config) { apple2e(config); @@ -5342,12 +5380,12 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ COMP( 1983, apple2e, 0, apple2, apple2e, apple2e, apple2e_state, empty_init, "Apple Computer", "Apple //e", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, apple2euk, apple2e, 0, apple2e, apple2euk, apple2e_state, empty_init, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, apple2ees, apple2e, 0, apple2e, apple2ees, apple2e_state, empty_init, "Apple Computer", "Apple //e (Spain)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, apple2euk, apple2e, 0, apple2epal, apple2euk, apple2e_state, init_pal, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, apple2ees, apple2e, 0, apple2epal, apple2ees, apple2e_state, init_pal, "Apple Computer", "Apple //e (Spain)", MACHINE_SUPPORTS_SAVE ) COMP( 1983, mprof3, apple2e, 0, mprof3, apple2e, apple2e_state, empty_init, "Multitech", "Microprofessor III", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, apple2e_state, empty_init, "Apple Computer", "Apple //e (enhanced)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2eeuk, apple2e, 0, apple2ee, apple2euk, apple2e_state, empty_init, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2eefr, apple2e, 0, apple2ee, apple2efr, apple2e_state, empty_init, "Apple Computer", "Apple //e (enhanced, France)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, apple2eeuk, apple2e, 0, apple2eepal, apple2euk, apple2e_state, init_pal, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, apple2eefr, apple2e, 0, apple2eepal, apple2efr, apple2e_state, init_pal, "Apple Computer", "Apple //e (enhanced, France)", MACHINE_SUPPORTS_SAVE ) COMP( 1987, apple2ep, apple2e, 0, apple2ep, apple2ep, apple2e_state, empty_init, "Apple Computer", "Apple //e (Platinum)", MACHINE_SUPPORTS_SAVE ) COMP( 1984, apple2c, 0, apple2, apple2c, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c" , MACHINE_SUPPORTS_SAVE ) COMP( 1985?,spectred, apple2e, 0, spectred, apple2e, apple2e_state, init_spect, "Scopus/Spectrum", "Spectrum ED" , MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 6f9e3e8402b..28f1296e22c 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -109,6 +109,7 @@ //#include "bus/a2bus/hostram.h" //#include "bus/a2bus/ramfast.h" #include "bus/a2bus/uthernet.h" +#include "bus/a2bus/sider.h" #include "bus/a2gameio/gameio.h" @@ -783,6 +784,14 @@ WRITE_LINE_MEMBER(apple2gs_state::ay3600_data_ready_w) uint8_t *decode = m_kbdrom->base(); uint16_t trans; + // if the user presses a valid key to start the driver from the info screen, + // we will see that key. ignore keys in the first 25,000 cycles (in my tests, + // the unwanted key shows up at 17030 cycles) + if (m_maincpu->total_cycles() < 25000) + { + return; + } + m_lastchar = m_ay3600->b_r(); trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff @@ -1232,10 +1241,11 @@ void apple2gs_state::machine_start() // setup speaker toggle volumes. this should be done mathematically probably, // but these ad-hoc values aren't too bad. - static const int16_t lvlTable[16] = +#define LVL(x) (double(x) / 32768.0) + static const double lvlTable[16] = { - 0x0000, 0x03ff, 0x04ff, 0x05ff, 0x06ff, 0x07ff, 0x08ff, 0x09ff, - 0x0aff, 0x0bff, 0x0cff, 0x0fff, 0x1fff, 0x3fff, 0x5fff, 0x7fff + LVL(0x0000), LVL(0x03ff), LVL(0x04ff), LVL(0x05ff), LVL(0x06ff), LVL(0x07ff), LVL(0x08ff), LVL(0x09ff), + LVL(0x0aff), LVL(0x0bff), LVL(0x0cff), LVL(0x0fff), LVL(0x1fff), LVL(0x3fff), LVL(0x5fff), LVL(0x7fff) }; m_speaker->set_levels(16, lvlTable); @@ -2281,6 +2291,9 @@ uint8_t apple2gs_state::c000_r(offs_t offset) case 0x31: // DISKREG return m_diskreg; + case 0x32: // VGCINTCLEAR + return 0; + case 0x33: // CLOCKDATA return m_clkdata; @@ -2508,12 +2521,12 @@ void apple2gs_state::c000_w(offs_t offset, uint8_t data) break; case 0x23: // VGCINT - if ((m_vgcint & VGCINT_SECOND) && !(data & VGCINT_SECOND)) + if ((m_vgcint & VGCINT_SECOND) && !(data & VGCINT_SECONDENABLE)) { lower_irq(IRQS_SECOND); m_vgcint &= ~(VGCINT_SECOND); } - if ((m_vgcint & VGCINT_SCANLINE) && !(data & VGCINT_SCANLINE)) + if ((m_vgcint & VGCINT_SCANLINE) && !(data & VGCINT_SCANLINEEN)) { lower_irq(IRQS_SCAN); m_vgcint &= ~(VGCINT_SCANLINE); @@ -2563,14 +2576,14 @@ void apple2gs_state::c000_w(offs_t offset, uint8_t data) case 0x32: // VGCINTCLEAR //printf("%02x to VGCINTCLEAR\n", data); // one second - if ((m_vgcint & VGCINT_SECOND) && !(data & VGCINT_SECOND)) + if (m_vgcint & VGCINT_SECOND) { lower_irq(IRQS_SECOND); m_vgcint &= ~(VGCINT_SECOND|VGCINT_ANYVGCINT); } // scanline - if ((m_vgcint & VGCINT_SCANLINE) && !(data & VGCINT_SCANLINE)) + if (m_vgcint & VGCINT_SCANLINE) { lower_irq(IRQS_SCAN); m_vgcint &= ~(VGCINT_SCANLINE|VGCINT_ANYVGCINT); @@ -4577,7 +4590,9 @@ static void apple2_cards(device_slot_interface &device) // device.option_add("hostram", A2BUS_HOSTRAM); /* Slot 7 RAM for GS Plus host protocol */ // device.option_add("ramfast", A2BUS_RAMFAST); /* C.V. Technologies RAMFast SCSI card */ device.option_add("cmsscsi", A2BUS_CMSSCSI); /* CMS Apple II SCSI Card */ - device.option_add("uthernet", A2BUS_UTHERNET); /* CMS Apple II SCSI Card */ + device.option_add("uthernet", A2BUS_UTHERNET); /* A2RetroSystems Uthernet card */ + device.option_add("sider2", A2BUS_SIDER2); /* Advanced Tech Systems / First Class Peripherals Sider 2 SASI card */ + device.option_add("sider1", A2BUS_SIDER1); /* Advanced Tech Systems / First Class Peripherals Sider 1 SASI card */ } void apple2gs_state::apple2gs(machine_config &config) diff --git a/src/mame/drivers/apple3.cpp b/src/mame/drivers/apple3.cpp index c38c1939b74..b0c79838079 100644 --- a/src/mame/drivers/apple3.cpp +++ b/src/mame/drivers/apple3.cpp @@ -103,7 +103,7 @@ void apple3_state::apple3(machine_config &config) m_a2bus->set_space(m_maincpu, AS_PROGRAM); m_a2bus->irq_w().set(FUNC(apple3_state::a2bus_irq_w)); m_a2bus->nmi_w().set(FUNC(apple3_state::a2bus_nmi_w)); - //m_a2bus->inh_w().set(FUNC(apple3_state::a2bus_inh_w)); + m_a2bus->inh_w().set(FUNC(apple3_state::a2bus_inh_w)); m_a2bus->dma_w().set_inputline(m_maincpu, INPUT_LINE_HALT); A2BUS_SLOT(config, "sl1", m_a2bus, apple3_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple3_cards, nullptr); @@ -139,6 +139,7 @@ void apple3_state::apple3(machine_config &config) /* rtc */ MM58167(config, m_rtc, 32.768_kHz_XTAL); + m_rtc->irq().set(m_via[1], FUNC(via6522_device::write_ca1)); /* via */ VIA6522(config, m_via[0], 14.318181_MHz_XTAL / 14); @@ -357,10 +358,10 @@ INPUT_PORTS_END ROM_START(apple3) ROM_REGION(0x1000,"maincpu",0) ROM_SYSTEM_BIOS(0, "original", "Apple /// boot ROM") - ROMX_LOAD( "apple3.rom", 0x0000, 0x1000, CRC(55e8eec9) SHA1(579ee4cd2b208d62915a0aa482ddc2744ff5e967), ROM_BIOS(1)) + ROMX_LOAD( "apple3.rom", 0x0000, 0x1000, CRC(55e8eec9) SHA1(579ee4cd2b208d62915a0aa482ddc2744ff5e967), ROM_BIOS(0)) ROM_SYSTEM_BIOS(1, "soshd", "Rob Justice SOSHDBOOT") - ROMX_LOAD( "soshdboot.bin", 0x000000, 0x001000, CRC(fd5ac9e2) SHA1(ba466a54ddb7f618c4f18f344754343c5945b417), ROM_BIOS(0)) + ROMX_LOAD( "soshdboot.bin", 0x000000, 0x001000, CRC(fd5ac9e2) SHA1(ba466a54ddb7f618c4f18f344754343c5945b417), ROM_BIOS(1)) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ diff --git a/src/mame/drivers/applix.cpp b/src/mame/drivers/applix.cpp index 1c3c9182cdc..14c28072e3a 100644 --- a/src/mame/drivers/applix.cpp +++ b/src/mame/drivers/applix.cpp @@ -517,22 +517,22 @@ void applix_state::keytronic_pc3270_io(address_map &map) /* Input ports */ static INPUT_PORTS_START( applix ) PORT_START( "K0f" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') /* 06 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') /* 05 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') /* 14 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') /* 13 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') /* 22 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') /* 21 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') /* 06 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') /* 05 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') /* 14 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') /* 13 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') /* 22 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') /* 21 */ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F7 (IRMA)") /* 41 */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6a?") /* 6a */ PORT_START( "K30_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') /* 31 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') /* 32 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') /* 30 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') /* 2f */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') /* 2e */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') /* 33 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') /* 31 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') /* 32 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') /* 30 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') /* 2f */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') /* 2e */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') /* 33 */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K30_1" ) @@ -546,31 +546,31 @@ static INPUT_PORTS_START( applix ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F8 (IRMA)") /* 42 */ PORT_START( "K31_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') /* 07 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') /* 08 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') /* 15 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') /* 16 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') /* 23 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') /* 24 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') /* 07 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') /* 08 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') /* 15 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') /* 16 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') /* 23 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') /* 24 */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K31_1" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) /* 37 */ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) /* 5f */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") /* 2a */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("LShift") PORT_CHAR(UCHAR_SHIFT_1) /* 2a */ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<") /* 70 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') /* 2c */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') /* 2d */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') /* 2c */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') /* 2d */ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?6c?") /* 6c */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F9 (IRMA)") /* 43 */ PORT_START( "K32_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') /* 0a */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') /* 09 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') /* 18 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') /* 17 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') /* 26 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') /* 25 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') /* 0a */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') /* 09 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') /* 18 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') /* 17 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') /* 26 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') /* 25 */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K32_1" ) @@ -592,40 +592,40 @@ static INPUT_PORTS_START( applix ) PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K33_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') /* 02 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') /* 29 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') /* 10 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') /* 02 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') /* 29 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') /* 10 */ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) /* 0f */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') /* 1e */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') /* 1e */ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps") /* 3a */ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?68?") /* 68 */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5 (IRMA)") /* 3f */ PORT_START( "K34_0" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') /* 35 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') /* 35 */ PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) /* 36 */ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left") /* 56 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') /* 34 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') /* 34 */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K34_1" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') /* 02 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') /* 03 */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') /* 11 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') /* 12 */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') /* 1f */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') /* 20 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') /* 02 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') /* 03 */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') /* 11 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') /* 12 */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') /* 1f */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') /* 20 */ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?67?") /* 67 */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4 (IRMA)") /* 3e */ PORT_START( "K35_0" ) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') /* 0b */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') /* 0c */ - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') /* 19 */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') /* 1a */ - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') /* 27 */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') /* 28 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') /* 0b */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') /* 0c */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') /* 19 */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') /* 1a */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') /* 27 */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') /* 28 */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K35_1" ) @@ -635,10 +635,10 @@ static INPUT_PORTS_START( applix ) PORT_START( "K36_0" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) /* 0e */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') /* 0d */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') /* 0d */ PORT_BIT( 0x14, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) /* 1c */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') /* 2b */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') /* 1b */ + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') /* 2b */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') /* 1b */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START( "K36_1" ) @@ -818,7 +818,7 @@ MC6845_UPDATE_ROW( applix_state::crtc_update_row ) // The 6845 cursor signal is not used at all. rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u32 const vidbase = (m_video_latch & 15) << 14 | (ra & 7) << 12; - u32 *p = &bitmap.pix32(y + vbp, hbp); + u32 *p = &bitmap.pix(y + vbp, hbp); for (u16 x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp index d782dd9111d..60a80be6f72 100644 --- a/src/mame/drivers/apricot.cpp +++ b/src/mame/drivers/apricot.cpp @@ -298,14 +298,14 @@ MC6845_UPDATE_ROW( apricot_state::crtc_update_row ) { int color = fill ? 1 : BIT(data, x); color ^= BIT(code, 15); // reverse? - bitmap.pix32(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; + bitmap.pix(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; } } else { // draw 16 pixels of the cell for (int x = 0; x <= 16; x++) - bitmap.pix32(y, x + i*16) = pen[BIT(data, x)]; + bitmap.pix(y, x + i*16) = pen[BIT(data, x)]; } } } diff --git a/src/mame/drivers/apricotf.cpp b/src/mame/drivers/apricotf.cpp index d7ee2f5d1d1..f3d59584e27 100644 --- a/src/mame/drivers/apricotf.cpp +++ b/src/mame/drivers/apricotf.cpp @@ -149,7 +149,7 @@ u32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const r { int color = (BIT(data, 15) << 1) | BIT(data, 7); - bitmap.pix16(y, (sx * 8) + x) = color; + bitmap.pix(y, (sx * 8) + x) = color; data <<= 1; } @@ -160,8 +160,8 @@ u32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const r { int color = (BIT(data, 15) << 3) | (BIT(data, 14) << 2) | (BIT(data, 7) << 1) | BIT(data, 6); - bitmap.pix16(y, (sx * 8) + (x * 2)) = color; - bitmap.pix16(y, (sx * 8) + (x * 2) + 1) = color; + bitmap.pix(y, (sx * 8) + (x * 2)) = color; + bitmap.pix(y, (sx * 8) + (x * 2) + 1) = color; data <<= 2; } diff --git a/src/mame/drivers/apricotp.cpp b/src/mame/drivers/apricotp.cpp index a2d356486da..8e6b94d197d 100644 --- a/src/mame/drivers/apricotp.cpp +++ b/src/mame/drivers/apricotp.cpp @@ -190,7 +190,7 @@ uint32_t fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co { int color = BIT(data, 15); - bitmap.pix16(y, (sx * 16) + x) = color; + bitmap.pix(y, (sx * 16) + x) = color; data <<= 1; } diff --git a/src/mame/drivers/argo.cpp b/src/mame/drivers/argo.cpp index 090172d407f..9a85211d859 100644 --- a/src/mame/drivers/argo.cpp +++ b/src/mame/drivers/argo.cpp @@ -267,7 +267,7 @@ I8275_DRAW_CHARACTER_MEMBER(argo_state::display_pixels) gfx ^= 0xff; for(u8 i=0;i<7;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 6-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 6-i) ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t argo_pens[3] = diff --git a/src/mame/drivers/aristmk4.cpp b/src/mame/drivers/aristmk4.cpp index 8264d8cf124..0220a60610e 100644 --- a/src/mame/drivers/aristmk4.cpp +++ b/src/mame/drivers/aristmk4.cpp @@ -2342,47 +2342,49 @@ ROM_END ROM_START( fhunter ) ROM_REGION(0x10000, "maincpu", 0 ) /* VIDEO AND SOUND EPROM */ - ROM_LOAD("2vas004.u59", 0x02000, 0x2000, CRC(84226547) SHA1(df9c2c01a7ac4d930c06a8c4863853ddb1a2adbe)) - + ROM_LOAD("2vas004.u59", 0x02000, 0x2000, CRC(84226547) SHA1(df9c2c01a7ac4d930c06a8c4863853ddb1a2adbe)) // VIDEO SOUND 2VA/S004 U59/7 1AAA/FP34/8E00 + // Alternate label: VIDEO SOUND 2VA/S004/MEM/59/7 FP34/8E00 /* GAME EPROMs */ ROM_LOAD("2xf5196i01.u87", 0x06000, 0x2000, CRC(f9e6b760) SHA1(af7f16727e84ba8f07400f7f02302862e02d1af4)) ROM_LOAD("2xf5196i01.u86", 0x08000, 0x8000, CRC(6971ccee) SHA1(1292cfa8125cbaec3bcd9d136cb385a3574bfa4a)) /* SHAPE EPROMs */ ROM_REGION(0xc000, "tile_gfx", 0 ) - ROM_LOAD("2xf5196.u20", 0x00000, 0x2000, CRC(96c81134) SHA1(e5e75e8b4897ee7cd9c27b0546fe4006cf384cba)) // unknown EPROM names, should contain VLSH or VL/SH letters on sticker - ROM_LOAD("2xf5196.u21", 0x02000, 0x2000, CRC(ad7bc6a0) SHA1(145e9a094212841e8a684136ea813bd1bea070fb)) - ROM_LOAD("2xf5196.u22", 0x04000, 0x2000, CRC(450d47bb) SHA1(219a0eeca3989da8cec68405466c9a20f2ee9bfa)) - ROM_LOAD("2xf5196.u45", 0x06000, 0x2000, CRC(560b2417) SHA1(1ed26ceaff87150d2f0115825f952348e34e0414)) - ROM_LOAD("2xf5196.u46", 0x08000, 0x2000, CRC(7704c13f) SHA1(4cfca6ee9e2e543714e8bf0c6de4d9e9406ce250)) - ROM_LOAD("2xf5196.u47", 0x0a000, 0x2000, CRC(a9e6da98) SHA1(3b7d8920d3ef4ae17a55d2e1968318eb3c70264d)) + ROM_LOAD("1vlsh293.u20", 0x00000, 0x2000, CRC(96c81134) SHA1(e5e75e8b4897ee7cd9c27b0546fe4006cf384cba)) // F. HUNTER BLU-L 1VL/SH293 U20/8 516C/3780/8F37 + ROM_LOAD("1vlsh293.u21", 0x02000, 0x2000, CRC(ad7bc6a0) SHA1(145e9a094212841e8a684136ea813bd1bea070fb)) // F. HUNTER GRN-L 1VL/SH293 U21/10 PC01/0649/05A6 + ROM_LOAD("1vlsh293.u22", 0x04000, 0x2000, CRC(450d47bb) SHA1(219a0eeca3989da8cec68405466c9a20f2ee9bfa)) // F. HUNTER RED-L 1VL/SH293 U22/12 2H12/6AH8/EA7A + ROM_LOAD("1vlsh293.u45", 0x06000, 0x2000, CRC(560b2417) SHA1(1ed26ceaff87150d2f0115825f952348e34e0414)) // F. HUNTER BLU-M 1VL/SH293 U45/9 A0C8/0A1F/88C5 + ROM_LOAD("1vlsh293.u46", 0x08000, 0x2000, CRC(7704c13f) SHA1(4cfca6ee9e2e543714e8bf0c6de4d9e9406ce250)) // F. HUNTER GRN-M 1VL/SH293 U46/11 2648/8H31/CEDD + ROM_LOAD("1vlsh293.u47", 0x0a000, 0x2000, CRC(a9e6da98) SHA1(3b7d8920d3ef4ae17a55d2e1968318eb3c70264d)) // F. HUNTER RED-M 1VL/SH293 U47/13 FFP8/AA7A/F5AD /* COLOR PROM */ ROM_REGION(0x200, "proms", 0 ) - ROM_LOAD("1cm48.u71", 0x0000, 0x0200, CRC(81daeeb0) SHA1(7dfe198c6def5c4ae4ecac488d65c2911fb3a890)) + ROM_LOAD("1cm48.u71", 0x0000, 0x0200, CRC(81daeeb0) SHA1(7dfe198c6def5c4ae4ecac488d65c2911fb3a890)) // FORTUNE HUNTER 1CM48 8CFA U71/40 + // Alternate label: FH/3BF/LGF 1CM48 8CFA U71/40 ROM_END ROM_START( fhuntera ) ROM_REGION(0x10000, "maincpu", 0 ) /* VIDEO AND SOUND EPROM */ - ROM_LOAD("2vas004.u59", 0x02000, 0x2000, CRC(84226547) SHA1(df9c2c01a7ac4d930c06a8c4863853ddb1a2adbe)) - + ROM_LOAD("2vas004.u59", 0x02000, 0x2000, CRC(84226547) SHA1(df9c2c01a7ac4d930c06a8c4863853ddb1a2adbe)) // VIDEO SOUND 2VA/S004 U59/7 1AAA/FP34/8E00 + // Alternate label: VIDEO SOUND 2VA/S004/MEM/59/7 FP34/8E00 /* GAME EPROMs */ ROM_LOAD("2xf5196i02.u87", 0x06000, 0x2000, CRC(4b532a14) SHA1(98d1753ad1d0d041f81a535947ed501d0eb1d85c)) ROM_LOAD("2xf5196i01.u86", 0x08000, 0x8000, CRC(6971ccee) SHA1(1292cfa8125cbaec3bcd9d136cb385a3574bfa4a)) /* SHAPE EPROMs */ ROM_REGION(0xc000, "tile_gfx", 0 ) - ROM_LOAD("2xf5196.u20", 0x00000, 0x2000, CRC(96c81134) SHA1(e5e75e8b4897ee7cd9c27b0546fe4006cf384cba)) // unknown EPROM names, should contain VLSH or VL/SH letters on sticker - ROM_LOAD("2xf5196.u21", 0x02000, 0x2000, CRC(ad7bc6a0) SHA1(145e9a094212841e8a684136ea813bd1bea070fb)) - ROM_LOAD("2xf5196.u22", 0x04000, 0x2000, CRC(450d47bb) SHA1(219a0eeca3989da8cec68405466c9a20f2ee9bfa)) - ROM_LOAD("2xf5196.u45", 0x06000, 0x2000, CRC(560b2417) SHA1(1ed26ceaff87150d2f0115825f952348e34e0414)) - ROM_LOAD("2xf5196.u46", 0x08000, 0x2000, CRC(7704c13f) SHA1(4cfca6ee9e2e543714e8bf0c6de4d9e9406ce250)) - ROM_LOAD("2xf5196.u47", 0x0a000, 0x2000, CRC(a9e6da98) SHA1(3b7d8920d3ef4ae17a55d2e1968318eb3c70264d)) + ROM_LOAD("1vlsh293.u20", 0x00000, 0x2000, CRC(96c81134) SHA1(e5e75e8b4897ee7cd9c27b0546fe4006cf384cba)) // F. HUNTER BLU-L 1VL/SH293 U20/8 516C/3780/8F37 + ROM_LOAD("1vlsh293.u21", 0x02000, 0x2000, CRC(ad7bc6a0) SHA1(145e9a094212841e8a684136ea813bd1bea070fb)) // F. HUNTER GRN-L 1VL/SH293 U21/10 PC01/0649/05A6 + ROM_LOAD("1vlsh293.u22", 0x04000, 0x2000, CRC(450d47bb) SHA1(219a0eeca3989da8cec68405466c9a20f2ee9bfa)) // F. HUNTER RED-L 1VL/SH293 U22/12 2H12/6AH8/EA7A + ROM_LOAD("1vlsh293.u45", 0x06000, 0x2000, CRC(560b2417) SHA1(1ed26ceaff87150d2f0115825f952348e34e0414)) // F. HUNTER BLU-M 1VL/SH293 U45/9 A0C8/0A1F/88C5 + ROM_LOAD("1vlsh293.u46", 0x08000, 0x2000, CRC(7704c13f) SHA1(4cfca6ee9e2e543714e8bf0c6de4d9e9406ce250)) // F. HUNTER GRN-M 1VL/SH293 U46/11 2648/8H31/CEDD + ROM_LOAD("1vlsh293.u47", 0x0a000, 0x2000, CRC(a9e6da98) SHA1(3b7d8920d3ef4ae17a55d2e1968318eb3c70264d)) // F. HUNTER RED-M 1VL/SH293 U47/13 FFP8/AA7A/F5AD /* COLOR PROM */ ROM_REGION(0x200, "proms", 0 ) - ROM_LOAD("1cm48.u71", 0x0000, 0x0200, CRC(81daeeb0) SHA1(7dfe198c6def5c4ae4ecac488d65c2911fb3a890)) + ROM_LOAD("1cm48.u71", 0x0000, 0x0200, CRC(81daeeb0) SHA1(7dfe198c6def5c4ae4ecac488d65c2911fb3a890)) // FORTUNE HUNTER 1CM48 8CFA U71/40 + // Alternate label: FH/3BF/LGF 1CM48 8CFA U71/40 ROM_END ROM_START( arcwins ) diff --git a/src/mame/drivers/aristmk6.cpp b/src/mame/drivers/aristmk6.cpp index 3e90126427d..b0e332129fe 100644 --- a/src/mame/drivers/aristmk6.cpp +++ b/src/mame/drivers/aristmk6.cpp @@ -173,7 +173,7 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r | g<<8 | b<<16; + bitmap.pix(y, x) = r | g<<8 | b<<16; count+=2; } @@ -184,7 +184,7 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg color = blit_ram[count]; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } @@ -205,12 +205,12 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg pix1 = pix & 0xffffffff; col = 0; if (pix1) col = 1; - bitmap.pix32(y, x*2) = m_palette->pen(col); + bitmap.pix(y, x*2) = m_palette->pen(col); pix1 = pix >> 32; col = 0; if (pix1) col = 1; - bitmap.pix32(y, x*2+1) = m_palette->pen(col); + bitmap.pix(y, x*2+1) = m_palette->pen(col); count++; diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp index 0a23d19cbf5..86d1dc1502f 100644 --- a/src/mame/drivers/astinvad.cpp +++ b/src/mame/drivers/astinvad.cpp @@ -168,14 +168,14 @@ void astinvad_state::plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint { uint8_t flip_xor = m_screen_flip & 7; - bitmap.pix32(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); } diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp index 9992933eac3..d04d0c8d672 100644 --- a/src/mame/drivers/astrof.cpp +++ b/src/mame/drivers/astrof.cpp @@ -356,14 +356,9 @@ void astrof_state::tomahawk_video_control_2_w(uint8_t data) void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens, int num_pens ) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - uint8_t data; - int i; - - uint8_t color = m_colorram[offs >> 1]; + uint8_t const color = m_colorram[offs >> 1]; pen_t back_pen = pens[(color & (num_pens-1)) | 0x00]; pen_t fore_pen = pens[(color & (num_pens-1)) | 0x01]; @@ -377,22 +372,23 @@ void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &c if ((y <= cliprect.top()) || (y >= cliprect.bottom())) continue; + uint8_t data; if (m_screen_off) data = 0; else data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen = (data & 0x01) ? fore_pen : back_pen; + pen_t const pen = (data & 0x01) ? fore_pen : back_pen; if (m_flipscreen) - bitmap.pix32(y, 255 - x) = pen; + bitmap.pix(y, 255 - x) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data >> 1; + x++; + data >>= 1; } } } @@ -1048,7 +1044,7 @@ ROM_START( astrof3 ) ROM_LOAD( "astrf.clr", 0x0000, 0x0020, CRC(61329fd1) SHA1(15782d8757d4dda5a8b97815e94c90218f0e08dd) ) ROM_END - +// Famaresa "500" PCB set (500-001, 500-002, 500-003 and 500-004). ROM_START( astroff ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "b.4a", 0xd000, 0x0400, CRC(18bdc2d9) SHA1(1fc93de1212f04f04acc224d91c2308758f5d5ca) ) @@ -1065,7 +1061,27 @@ ROM_START( astroff ) ROM_LOAD( "0.5k", 0xfc00, 0x0400, CRC(c63a9c80) SHA1(f51694912d823a5ae7883c603915b9c1aa0e0733) ) ROM_REGION( 0x0020, "proms", 0 ) - ROM_LOAD( "im5610-82s123.2f", 0x0000, 0x0020, CRC(61329fd1) SHA1(15782d8757d4dda5a8b97815e94c90218f0e08dd) ) + ROM_LOAD( "im5610-82s123.2f", 0x0000, 0x0020, CRC(61329fd1) SHA1(15782d8757d4dda5a8b97815e94c90218f0e08dd) ) +ROM_END + +// Famaresa "500" PCB set (500-001, 500-002, 500-003 and 500-004). Tested, shows a black background. +ROM_START( astroff2 ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "b.4a", 0xd000, 0x0400, CRC(18bdc2d9) SHA1(1fc93de1212f04f04acc224d91c2308758f5d5ca) ) + ROM_LOAD( "a.4c", 0xd400, 0x0400, CRC(2344521c) SHA1(7f50890df10219b51bf4cf617e8ffb4336e19ae3) ) + ROM_LOAD( "9.5a", 0xd800, 0x0400, CRC(9bd0e10d) SHA1(0170f56ce0c7a3827548bdd954acb2c0e4a2cb24) ) + ROM_LOAD( "8r.5c", 0xdc00, 0x0400, CRC(06ff0192) SHA1(f581eb508364b44e51aa998b7dba6a97578a3a92) ) + ROM_LOAD( "7.4d", 0xe000, 0x0400, CRC(6cd01b9e) SHA1(597db331008a4a561bc8d9bbd42ffde9bcd565dc) ) + ROM_LOAD( "6.4f", 0xe400, 0x0400, CRC(69cd2604) SHA1(09201ae691330e3bd788f9c714f6dcbb7e8335d0) ) + ROM_LOAD( "5.5d", 0xe800, 0x0400, CRC(14a4118f) SHA1(d99876f405dd646a7f0e85e584f2509d9cf17372) ) + ROM_LOAD( "4.5f", 0xec00, 0x0400, CRC(0513bc92) SHA1(dbf774e8353c966c303e02ce8196b888d235bdb2) ) + ROM_LOAD( "3.4h", 0xf000, 0x0400, CRC(e01713bd) SHA1(e0370a070c727f8f7ff767fdd84f7aeef31c8347) ) + ROM_LOAD( "2.4k", 0xf400, 0x0400, CRC(24ab94d5) SHA1(1e0a61d83fa67340d4b1477377ed9d65cf826f53) ) + ROM_LOAD( "1.5h", 0xf800, 0x0400, CRC(142bbc5d) SHA1(55017fd88a19d09943cde16d583db00cf4c3218b) ) + ROM_LOAD( "0.5k", 0xfc00, 0x0400, CRC(c63a9c80) SHA1(f51694912d823a5ae7883c603915b9c1aa0e0733) ) + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD( "im5610-82s123.2f", 0x0000, 0x0020, CRC(61329fd1) SHA1(15782d8757d4dda5a8b97815e94c90218f0e08dd) ) ROM_END @@ -1135,6 +1151,29 @@ ROM_START( afire ) ROM_END +ROM_START( asterion ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "asterion eprom 12.bin", 0xd000, 0x0400, CRC(9ba57987) SHA1(becf89b7d474f86839f13f9be5502c91491e8584) ) + ROM_LOAD( "asterion eprom 11.bin", 0xd400, 0x0400, CRC(8974715e) SHA1(1a4a576d51a0788dd973de5c5fde5131a940d3f0) ) + ROM_LOAD( "asterion eprom 10.bin", 0xd800, 0x0400, CRC(354cf432) SHA1(138956ea8064eba0dcd8b2f175d4981b689a2077) ) + ROM_LOAD( "asterion eprom 9.bin", 0xdc00, 0x0400, CRC(4cee0c8b) SHA1(98bfdda9d2d368db16d6e9090536b09d8337c0e5) ) + ROM_LOAD( "asterion eprom 5.bin", 0xe000, 0x0400, CRC(9cb477f3) SHA1(6866264aa8d0479cee237a00e4a919e3981144a5) ) + ROM_LOAD( "asterion eprom 7.bin", 0xe400, 0x0400, CRC(272de8f1) SHA1(e917b3b8bb96fedacd6d5cb3d1c30977818f2e85) ) + ROM_LOAD( "asterion eprom 6.bin", 0xe800, 0x0400, CRC(ff25acaa) SHA1(5cb360c556c9b36039ae05702e6900b82fe5676b) ) + ROM_LOAD( "asterion eprom 4.bin", 0xec00, 0x0400, CRC(6edf202d) SHA1(a4cab2f10a99e0a4b1c571168e17cbee1d18cf06) ) + ROM_LOAD( "asterion eprom 8.bin", 0xf000, 0x0400, CRC(47dccb04) SHA1(b6b6c6685c93ac9531efb970b2e82ad68eea87ba) ) + ROM_LOAD( "asterion eprom 2.bin", 0xf400, 0x0400, CRC(86c6ae5c) SHA1(c5d8dab0ef3168884ae6fe7099708a290daba2ba) ) + ROM_LOAD( "asterion eprom 3.bin", 0xf800, 0x0400, CRC(b206deda) SHA1(9ab52920c06ed6beb38bc7f97ffd00e8ad46c17d) ) + ROM_LOAD( "asterion eprom 1.bin", 0xfc00, 0x0400, CRC(99008e90) SHA1(bfa1c3a66992f432fad37203f052f820b098e05f) ) + + ROM_REGION( 0x0100, "proms", 0 ) + ROM_LOAD( "sn74s470.bin", 0x0000, 0x0100, CRC(3bf3ccb0) SHA1(d61d19d38045f42a9adecf295e479fee239bed48) ) + + ROM_REGION( 0x0200, "user1", 0 ) // data relevant for the decryption is the same as the one for abattle, but it's on a larger PROM + ROM_LOAD( "sn74s472.bin", 0x0000, 0x0200, CRC(d437a9d8) SHA1(32e3513ab2ce1cde5196d80c53f5aa98b339929f) ) +ROM_END + + /* This is a newer revision of "Astro Combat" (most probably manufactured by Sidam), with correct spelling for FUEL and the main boss sporting "CB". */ ROM_START( acombat ) @@ -1397,28 +1436,48 @@ void astrof_state::init_acombat3() } +void astrof_state::init_asterion() +{ + // use the protection PROM to decrypt the ROMs + uint8_t *rom = memregion("maincpu")->base(); + uint8_t *prom = memregion("user1")->base(); + + for (int i = 0xd000; i < 0x10000; i++) + { + rom[i] = prom[(rom[i] & 0x1f) + ((rom[i] & 0xe0) << 1)]; + } + + // set up protection handlers + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8smo_delegate(*this, FUNC(astrof_state::shoot_r))); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8smo_delegate(*this, FUNC(astrof_state::abattle_coin_prot_r))); +} + + /************************************* * * Game drivers * *************************************/ -GAME( 1979, astrof, 0, astrof, astrof, astrof_state, empty_init, ROT90, "Data East", "Astro Fighter (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, astrof2, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "Data East", "Astro Fighter (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, astrof3, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "Data East", "Astro Fighter (set 3)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, astroff, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "bootleg? (Famaresa)", "Astro Fighter (set 4)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, abattle, astrof, abattle, abattle, astrof_state, init_abattle, ROT90, "bootleg? (Sidam)", "Astro Battle (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, abattle2, astrof, abattle, abattle, astrof_state, init_abattle, ROT90, "bootleg? (Sidam)", "Astro Battle (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, afire, astrof, abattle, abattle, astrof_state, init_afire, ROT90, "bootleg (Rene Pierre)", "Astro Fire", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, acombat, astrof, abattle, abattle, astrof_state, init_afire, ROT90, "bootleg", "Astro Combat (newer, CB)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, acombato, astrof, abattle, abattle, astrof_state, init_afire, ROT90, "bootleg", "Astro Combat (older, PZ)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, acombat3, astrof, abattle, abattle, astrof_state, init_acombat3, ROT90, "bootleg (Proel)", "Astro Combat (unencrypted)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, acombat4, astrof, abattle, abattle, astrof_state, init_abattle, ROT90, "bootleg (Proel)", "Astro Combat (encrypted)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, astrof, 0, astrof, astrof, astrof_state, empty_init, ROT90, "Data East", "Astro Fighter (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, astrof2, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "Data East", "Astro Fighter (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, astrof3, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "Data East", "Astro Fighter (set 3)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, astroff, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "bootleg (Famaresa)", "Astro Fighter (Famaresa bootleg, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, astroff2, astrof, astrof, astrof, astrof_state, empty_init, ROT90, "bootleg (Famaresa)", "Astro Fighter (Famaresa bootleg, set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, abattle, astrof, abattle, abattle, astrof_state, init_abattle, ROT90, "bootleg? (Sidam)", "Astro Battle (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, abattle2, astrof, abattle, abattle, astrof_state, init_abattle, ROT90, "bootleg? (Sidam)", "Astro Battle (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, afire, astrof, abattle, abattle, astrof_state, init_afire, ROT90, "bootleg (Rene Pierre)", "Astro Fire", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, asterion, astrof, abattle, abattle, astrof_state, init_asterion, ROT90, "bootleg? (Olympia)", "Asterion", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, acombat, astrof, abattle, abattle, astrof_state, init_afire, ROT90, "bootleg", "Astro Combat (newer, CB)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, acombato, astrof, abattle, abattle, astrof_state, init_afire, ROT90, "bootleg", "Astro Combat (older, PZ)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, acombat3, astrof, abattle, abattle, astrof_state, init_acombat3, ROT90, "bootleg (Proel)", "Astro Combat (unencrypted)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, acombat4, astrof, abattle, abattle, astrof_state, init_abattle, ROT90, "bootleg (Proel)", "Astro Combat (encrypted)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) + GAME( 1979, strfight, astrof, abattle, abattle, astrof_state, init_acombat3, ROT90, "bootleg (VGG)", "Star Fighter (bootleg of Astro Fighter)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, sstarbtl, astrof, abattle, abattle, astrof_state, init_sstarbtl, ROT90, "bootleg", "Super Star Battle", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, sstarbtl, astrof, abattle, abattle, astrof_state, init_sstarbtl, ROT90, "bootleg (SG-Florence)", "Super Star Battle", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, spfghmk2, 0, spfghmk2, spfghmk2, astrof_state, empty_init, ROT90, "Data East", "Space Fighter Mark II (set 1)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1979, spfghmk22, spfghmk2, spfghmk2, spfghmk22, astrof_state, empty_init, ROT90, "Data East", "Space Fighter Mark II (set 2)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, spfghmk2, 0, spfghmk2, spfghmk2, astrof_state, empty_init, ROT90, "Data East", "Space Fighter Mark II (set 1)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, spfghmk22, spfghmk2, spfghmk2, spfghmk22, astrof_state, empty_init, ROT90, "Data East", "Space Fighter Mark II (set 2)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1980, tomahawk, 0, tomahawk, tomahawk, astrof_state, empty_init, ROT90, "Data East", "Tomahawk 777 (rev 5)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1980, tomahawk1, tomahawk, tomahawk, tomahawk1, astrof_state, empty_init, ROT90, "Data East", "Tomahawk 777 (rev 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, tomahawk, 0, tomahawk, tomahawk, astrof_state, empty_init, ROT90, "Data East", "Tomahawk 777 (rev 5)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, tomahawk1, tomahawk, tomahawk, tomahawk1, astrof_state, empty_init, ROT90, "Data East", "Tomahawk 777 (rev 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/at.cpp b/src/mame/drivers/at.cpp index 879f53f6a69..e1c1436c6aa 100644 --- a/src/mame/drivers/at.cpp +++ b/src/mame/drivers/at.cpp @@ -4334,7 +4334,7 @@ ROM_END // 40-040A-001291-00101111-111192-OP495SLC-0 / 486DX-OP-WBq-25/33/50-K2-ZZ ROM_START( nat48pv ) ROM_REGION32_LE(0x20000, "bios", 0) - ROM_LOAD( "amibios_aa5312581.bin", 0x10000, 0x10000, CRC(8A788C79) SHA1(050972B7A369A463D6654EC52C0804002E9BCB37)) + ROM_LOAD( "amibios_aa5312581.bin", 0x10000, 0x10000, CRC(8a788c79) SHA1(050972b7a369a463d6654ec52c0804002e9bcb37)) ROM_END diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp index 8da5a02d553..1dfd60758f8 100644 --- a/src/mame/drivers/atarisy4.cpp +++ b/src/mame/drivers/atarisy4.cpp @@ -231,7 +231,6 @@ void atarisy4_state::video_reset() uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; uint32_t offset = 0; if (m_gpu.bcrw & 0x80) @@ -245,15 +244,14 @@ uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rg //uint32_t offset = m_gpu.dpr << 5; - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { - uint16_t *src = &m_screen_ram[(offset + (4096 * y)) / 2]; - uint32_t *dest = &bitmap.pix32(y, cliprect.left()); - int x; + uint16_t const *src = &m_screen_ram[(offset + (4096 * y)) / 2]; + uint32_t *dest = &bitmap.pix(y, cliprect.left()); - for (x = cliprect.left(); x < cliprect.right(); x += 2) + for (int x = cliprect.left(); x < cliprect.right(); x += 2) { - uint16_t data = *src++; + uint16_t const data = *src++; *dest++ = m_palette->pen(data & 0xff); *dest++ = m_palette->pen(data >> 8); diff --git a/src/mame/drivers/atom.cpp b/src/mame/drivers/atom.cpp index 524f1679e10..7f4d8036c51 100644 --- a/src/mame/drivers/atom.cpp +++ b/src/mame/drivers/atom.cpp @@ -343,81 +343,81 @@ static INPUT_PORTS_START( atom ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_START("Y1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_START("Y2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x95") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_START("Y3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\x94") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_START("Y4") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DELETE") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_START("Y5") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('^') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_START("Y6") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_START("Y7") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_START("Y8") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_START("Y9") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_START("Y10") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) @@ -426,8 +426,8 @@ static INPUT_PORTS_START( atom ) PORT_START("Y11") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPT") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_START("BRK") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_CHANGED_MEMBER(DEVICE_SELF, atom_state, trigger_reset, 0) + PORT_START("BRK") // This is a full reset - program in memory is lost + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHANGED_MEMBER(DEVICE_SELF, atom_state, trigger_reset, 0) PORT_START("ECONET") // station ID (0-255) diff --git a/src/mame/drivers/atronic.cpp b/src/mame/drivers/atronic.cpp index 5d73e60b702..19fe4c15a7e 100644 --- a/src/mame/drivers/atronic.cpp +++ b/src/mame/drivers/atronic.cpp @@ -423,8 +423,8 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(atronic_state::from_shiftreg) TMS340X0_SCANLINE_RGB32_CB_MEMBER(atronic_state::scanline_update) { uint32_t fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 5; - uint32_t* bg0_base = &m_vidram[(fulladdr & 0x7fe00)]; // this probably isn't screen ram, but some temp gfx are copied on startup - uint32_t* dst = &bitmap.pix32(scanline); + uint32_t const *const bg0_base = &m_vidram[(fulladdr & 0x7fe00)]; // this probably isn't screen ram, but some temp gfx are copied on startup + uint32_t *const dst = &bitmap.pix(scanline); int coladdr = fulladdr & 0x1ff; const pen_t *pens = m_palette->pens(); diff --git a/src/mame/drivers/att4425.cpp b/src/mame/drivers/att4425.cpp index e574f006e55..b2033aa5f05 100644 --- a/src/mame/drivers/att4425.cpp +++ b/src/mame/drivers/att4425.cpp @@ -131,26 +131,26 @@ void att4425_state::video_start() uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx, fg, bg, chr, attr; - uint16_t sy = 0, ma, x, ca; + uint16_t sy = 0; - fg = 2; - bg = 0; + uint8_t fg = 2; + uint8_t bg = 0; - for (y = 0; y < 27; y++) + for (uint8_t y = 0; y < 27; y++) { - ma = 0x7e9c + 4 * (81 - 27 + y); + uint16_t ma = 0x7e9c + 4 * (81 - 27 + y); ma = (m_p_videoram[ma] << 8) + m_p_videoram[ma + 1] - 0x8000; - for (ra = 0; ra < 13; ra++) + for (uint8_t ra = 0; ra < 13; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 160; x += 2) + for (uint16_t x = ma; x < ma + 160; x += 2) { - chr = m_p_videoram[x + 1]; - attr = m_p_videoram[x]; - ca = (chr << 4) & 0x7f0; + uint8_t const chr = m_p_videoram[x + 1]; + uint8_t const attr = m_p_videoram[x]; + uint16_t ca = (chr << 4) & 0x7f0; + uint8_t gfx; // font 2 if (attr & 0x01) @@ -178,9 +178,8 @@ uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* Display a scanline of a character */ for (int i = 7; i >= 0; i--) - { *p++ = BIT(gfx, i) ? fg : bg; - } + *p++ = bg; } } diff --git a/src/mame/drivers/att630.cpp b/src/mame/drivers/att630.cpp index 96e0626ea4a..bcedcd25c15 100644 --- a/src/mame/drivers/att630.cpp +++ b/src/mame/drivers/att630.cpp @@ -54,7 +54,7 @@ u32 att630_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con { for (int y = 0; y < 1024; y++) for (int x = 0; x < 1024; x++) - bitmap.pix32(y, x) = BIT(m_vram[y * (1024 / 16) + x / 16], 15 - (x % 16)) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = BIT(m_vram[y * (1024 / 16) + x / 16], 15 - (x % 16)) ? rgb_t::white() : rgb_t::black(); return 0; } diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp index 7f42d3e551a..17f434fce48 100644 --- a/src/mame/drivers/attache.cpp +++ b/src/mame/drivers/attache.cpp @@ -299,39 +299,35 @@ private: // bit 7 = subscript (superscript and subscript combined produces strikethrough) uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y,vy,start,bit,scan,data; - uint8_t dbl_mode = 0; // detemines which half of character to display when using double size attribute, - // as it can start on either odd or even character cells. - // Graphics output (if enabled) if(m_gfx_enabled) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); - for(y=0;y<(bitmap.height()-1)/10;y++) + for(uint8_t y=0;y<(bitmap.height()-1)/10;y++) { - for(x=0;x<(bitmap.width()-1)/8;x++) + for(uint8_t x=0;x<(bitmap.width()-1)/8;x++) { // graphics pixels use half the clock of text, so 4 graphics pixels per character - for(scan=0;scan<10;scan+=2) + for(uint8_t scan=0;scan<10;scan+=2) { - data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; - bitmap.pix32(y*10+scan,x*8) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+1) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+2) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+3) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+4) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+5) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+6) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan,x*8+7) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan+1,x*8) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; - bitmap.pix32(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; + uint8_t const data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; + bitmap.pix(y*10+scan,x*8) = pen[BIT(data,7)]; + bitmap.pix(y*10+scan,x*8+1) = pen[BIT(data,7)]; + bitmap.pix(y*10+scan,x*8+2) = pen[BIT(data,6)]; + bitmap.pix(y*10+scan,x*8+3) = pen[BIT(data,6)]; + bitmap.pix(y*10+scan,x*8+4) = pen[BIT(data,5)]; + bitmap.pix(y*10+scan,x*8+5) = pen[BIT(data,5)]; + bitmap.pix(y*10+scan,x*8+6) = pen[BIT(data,4)]; + bitmap.pix(y*10+scan,x*8+7) = pen[BIT(data,4)]; + bitmap.pix(y*10+scan+1,x*8) = pen[BIT(data,3)]; + bitmap.pix(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; + bitmap.pix(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; + bitmap.pix(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; + bitmap.pix(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; + bitmap.pix(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; + bitmap.pix(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; + bitmap.pix(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; } } } @@ -340,12 +336,14 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma bitmap.fill(0); // Text output - for(y=0;y<(bitmap.height()-1)/10;y++) // lines + uint8_t dbl_mode = 0; // detemines which half of character to display when using double size attribute, + // as it can start on either odd or even character cells. + for(uint8_t y=0;y<(bitmap.height()-1)/10;y++) // lines { - start = m_crtc->upscroll_offset(); - vy = (start + y) % 24; + uint8_t const start = m_crtc->upscroll_offset(); + uint8_t const vy = (start + y) % 24; - for(x=0;x<(bitmap.width()-1)/8;x++) // columns + for(uint8_t x=0;x<(bitmap.width()-1)/8;x++) // columns { assert(((y*128)+x) >= 0 && ((y*128)+x) < ARRAY_LENGTH(m_char_ram)); assert(((vy*128)+x) >= 0 && ((vy*128)+x) < ARRAY_LENGTH(m_char_ram)); @@ -356,9 +354,9 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma else dbl_mode = 0; - for(scan=0;scan<10;scan++) // 10 scanlines per line + for(uint8_t scan=0;scan<10;scan++) // 10 scanlines per line { - data = m_char_rom->base()[(ch*16+scan)]; + uint8_t data = m_char_rom->base()[(ch*16+scan)]; if((m_attr_ram[(vy*128)+x] & 0xc0) != 0xc0) // if not strikethrough { if(m_attr_ram[(vy*128)+x] & 0x40) // superscript @@ -402,13 +400,13 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma data = newdata; } - for(bit=0;bit<8;bit++) // 8 pixels per character + for(uint8_t bit=0;bit<8;bit++) // 8 pixels per character { - uint16_t xpos = x*8+bit; - uint16_t ypos = y*10+scan; + uint16_t const xpos = x*8+bit; + uint16_t const ypos = y*10+scan; if(BIT(data,7-bit)) - bitmap.pix32(ypos,xpos) = fg; + bitmap.pix(ypos,xpos) = fg; } } } diff --git a/src/mame/drivers/avalnche.cpp b/src/mame/drivers/avalnche.cpp index 5b3f930a43e..7c8896238b9 100644 --- a/src/mame/drivers/avalnche.cpp +++ b/src/mame/drivers/avalnche.cpp @@ -48,17 +48,13 @@ uint32_t avalnche_state::screen_update_avalnche(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - int y = offs >> 5; + int const y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen; @@ -67,10 +63,10 @@ uint32_t avalnche_state::screen_update_avalnche(screen_device &screen, bitmap_rg else pen = (data & 0x80) ? rgb_t::black() : rgb_t::white(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data << 1; - x = x + 1; + data <<= 1; + x++; } } diff --git a/src/mame/drivers/b16.cpp b/src/mame/drivers/b16.cpp index a156c83826d..d4a864b0a77 100644 --- a/src/mame/drivers/b16.cpp +++ b/src/mame/drivers/b16.cpp @@ -97,18 +97,17 @@ uint32_t b16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for(int x=0;x<mc6845_h_display;x++) { - int tile = m_vram[x+y*mc6845_h_display] & 0xff; - int color = (m_vram[x+y*mc6845_h_display] & 0x700) >> 8; - int pen; + int const tile = m_vram[x+y*mc6845_h_display] & 0xff; + int const color = (m_vram[x+y*mc6845_h_display] & 0x700) >> 8; for(int yi=0;yi<mc6845_tile_height;yi++) { for(int xi=0;xi<8;xi++) { - pen = (m_char_rom[tile*16+yi] >> (7-xi) & 1) ? color : 0; + int const pen = (m_char_rom[tile*16+yi] >> (7-xi) & 1) ? color : 0; if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/bagman.cpp b/src/mame/drivers/bagman.cpp index 56c0a514555..0c7d093797e 100644 --- a/src/mame/drivers/bagman.cpp +++ b/src/mame/drivers/bagman.cpp @@ -137,10 +137,10 @@ void bagman_state::main_map(address_map &map) map(0x9c00, 0x9fff).nopw(); // Written to, but unused map(0xa000, 0xa000).r(FUNC(bagman_state::pal16r6_r)); map(0xa000, 0xa007).w("mainlatch", FUNC(ls259_device::write_d0)); - map(0xc000, 0xffff).rom(); // Super Bagman only map(0xa800, 0xa807).w(FUNC(bagman_state::ls259_w)); // TMS5110 driving state machine map(0xb000, 0xb000).portr("DSW"); map(0xb800, 0xb800).nopr(); // Looks like watchdog from schematics + map(0xc000, 0xffff).rom(); // Super Bagman only #if 0 map(0xb000, 0xb000).nopw(); // ???? @@ -748,7 +748,7 @@ ROM_START( bagnardi ) // 1983 ROM_REGION (0x104, "plds", 0) ROM_LOAD( "lebag_itisa_pal16r6cn.p6", 0x000, 0x104, CRC(13f14bbf) SHA1(b8c4ddf61609465f3a3699dd42796f15a7b17979) ) - + ROM_END ROM_START( bagnardio ) // 1982, based on bagnard set with mods for license text @@ -780,93 +780,127 @@ ROM_START( bagnardio ) // 1982, based on bagnard set with mods for license text ROM_LOAD( "bagnardi_12.t9", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) // == t9_b12.bin ROM_END +/* +Stern Bagman ROM labels follow this format: + +BAGMAN (c) +A5 9F <-- Revision level and PCB location +1983 STERN +*/ ROM_START( bagmans ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "a4_9e.bin", 0x0000, 0x1000, CRC(5fb0a1a3) SHA1(849cd60b58de9585a78a1c4c1747f666a4a4fcc3) ) - ROM_LOAD( "a5-9f", 0x1000, 0x1000, CRC(2ddf6bb9) SHA1(151068dddc55163bb6f925f68e5d04e347ded6a5) ) - ROM_LOAD( "a4_9j.bin", 0x2000, 0x1000, CRC(b2da8b77) SHA1(ea36cd6be42c5548a9a91054aeebb4b985ba15c9) ) - ROM_LOAD( "a5-9k", 0x3000, 0x1000, CRC(f91d617b) SHA1(a3323b51277e08747701cc4e2d3a9c466e96d4c1) ) - ROM_LOAD( "a4_9m.bin", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) - ROM_LOAD( "a5-9n", 0x5000, 0x1000, CRC(68e4b64d) SHA1(55950d7c07c621cafa001d5d3bfec6bbc02712e2) ) + ROM_LOAD( "bagman_a4_9e.9e", 0x0000, 0x1000, CRC(5fb0a1a3) SHA1(849cd60b58de9585a78a1c4c1747f666a4a4fcc3) ) + ROM_LOAD( "bagman_a5_9f.9f", 0x1000, 0x1000, CRC(2ddf6bb9) SHA1(151068dddc55163bb6f925f68e5d04e347ded6a5) ) + ROM_LOAD( "bagman_a4_9j.9j", 0x2000, 0x1000, CRC(b2da8b77) SHA1(ea36cd6be42c5548a9a91054aeebb4b985ba15c9) ) + ROM_LOAD( "bagman_a5_9k.9k", 0x3000, 0x1000, CRC(f91d617b) SHA1(a3323b51277e08747701cc4e2d3a9c466e96d4c1) ) + ROM_LOAD( "bagman_a4_9m.9m", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) // == bagman_a2_9m.9m + ROM_LOAD( "bagman_a5_9n.9n", 0x5000, 0x1000, CRC(68e4b64d) SHA1(55950d7c07c621cafa001d5d3bfec6bbc02712e2) ) ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "a2_1e.bin", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) - ROM_LOAD( "j1_b04.bin", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) + ROM_LOAD( "bagman_a2_1e.1e", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) + ROM_LOAD( "bagman_a2_1j.1j", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) ROM_REGION( 0x2000, "gfx2", 0 ) - ROM_LOAD( "a2_1c.bin", 0x0000, 0x1000, CRC(f3e11bd7) SHA1(43ee00ff777008c89f619eb183e7c5e63f6c7694) ) - ROM_LOAD( "a2_1f.bin", 0x1000, 0x1000, CRC(d0f7105b) SHA1(fb382703850a4ded567706e02ebb7f3e22531b7c) ) + ROM_LOAD( "bagman_a2_1c.1c", 0x0000, 0x1000, CRC(f3e11bd7) SHA1(43ee00ff777008c89f619eb183e7c5e63f6c7694) ) + ROM_LOAD( "bagman_a2_1f.1f", 0x1000, 0x1000, CRC(d0f7105b) SHA1(fb382703850a4ded567706e02ebb7f3e22531b7c) ) - // according to MT #02508 Stern/Seeburg logos should have different colors. ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "p3.bin", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) - ROM_LOAD( "r3.bin", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + ROM_LOAD( "bagman_color_3pa2.3p", 0x0000, 0x0020, CRC(47504204) SHA1(7524ed766cc6d9a158327717d2cf53346ace2392) ) // MMI 6331 BPROM + ROM_LOAD( "bagman_color_3ra1.3r", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) // MMI 6331 BPROM ROM_REGION( 0x0020, "5110ctrl", 0) - ROM_LOAD( "r6.bin", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 + ROM_LOAD( "bagman_sound_6ra2.6r", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 - MMI 6331 BPROM ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip - ROM_LOAD( "r9_b11.bin", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) - ROM_LOAD( "t9_b12.bin", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) + ROM_LOAD( "bagman_a1_9r.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "bagman_a1_9t.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) ROM_END -ROM_START( bagmans2 ) +ROM_START( bagmans4 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "a4_9e.bin", 0x0000, 0x1000, CRC(5fb0a1a3) SHA1(849cd60b58de9585a78a1c4c1747f666a4a4fcc3) ) - ROM_LOAD( "a4_9f.bin", 0x1000, 0x1000, CRC(7871206e) SHA1(14d9b7a0779d59a870e0d4b911797dff5435a16c) ) - ROM_LOAD( "a4_9j.bin", 0x2000, 0x1000, CRC(b2da8b77) SHA1(ea36cd6be42c5548a9a91054aeebb4b985ba15c9) ) - ROM_LOAD( "a4_9k.bin", 0x3000, 0x1000, CRC(36b6a944) SHA1(270dd2566b36129366adcbdd5a8db396bec7631f) ) - ROM_LOAD( "a4_9m.bin", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) - ROM_LOAD( "a4_9n.bin", 0x5000, 0x1000, CRC(83fccb1c) SHA1(7225d738b64a2cdaaec8860017de4229f2852ed2) ) + ROM_LOAD( "bagman_a4_9e.9e", 0x0000, 0x1000, CRC(5fb0a1a3) SHA1(849cd60b58de9585a78a1c4c1747f666a4a4fcc3) ) + ROM_LOAD( "bagman_a4_9f.9f", 0x1000, 0x1000, CRC(7871206e) SHA1(14d9b7a0779d59a870e0d4b911797dff5435a16c) ) + ROM_LOAD( "bagman_a4_9j.9j", 0x2000, 0x1000, CRC(b2da8b77) SHA1(ea36cd6be42c5548a9a91054aeebb4b985ba15c9) ) + ROM_LOAD( "bagman_a4_9k.9k", 0x3000, 0x1000, CRC(36b6a944) SHA1(270dd2566b36129366adcbdd5a8db396bec7631f) ) + ROM_LOAD( "bagman_a4_9m.9m", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) // == bagman_a2_9m.9m + ROM_LOAD( "bagman_a4_9n.9n", 0x5000, 0x1000, CRC(83fccb1c) SHA1(7225d738b64a2cdaaec8860017de4229f2852ed2) ) ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "a2_1e.bin", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) - ROM_LOAD( "j1_b04.bin", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) + ROM_LOAD( "bagman_a2_1e.1e", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) + ROM_LOAD( "bagman_a2_1j.1j", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) ROM_REGION( 0x2000, "gfx2", 0 ) - ROM_LOAD( "a2_1c.bin", 0x0000, 0x1000, CRC(f3e11bd7) SHA1(43ee00ff777008c89f619eb183e7c5e63f6c7694) ) - ROM_LOAD( "a2_1f.bin", 0x1000, 0x1000, CRC(d0f7105b) SHA1(fb382703850a4ded567706e02ebb7f3e22531b7c) ) + ROM_LOAD( "bagman_a2_1c.1c", 0x0000, 0x1000, CRC(f3e11bd7) SHA1(43ee00ff777008c89f619eb183e7c5e63f6c7694) ) + ROM_LOAD( "bagman_a2_1f.1f", 0x1000, 0x1000, CRC(d0f7105b) SHA1(fb382703850a4ded567706e02ebb7f3e22531b7c) ) - // according to MT #02508 Stern/Seeburg logos should have different colors. ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "p3.bin", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) - ROM_LOAD( "r3.bin", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + ROM_LOAD( "bagman_color_3pa2.3p", 0x0000, 0x0020, CRC(47504204) SHA1(7524ed766cc6d9a158327717d2cf53346ace2392) ) // MMI 6331 BPROM + ROM_LOAD( "bagman_color_3ra1.3r", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) // MMI 6331 BPROM ROM_REGION( 0x0020, "5110ctrl", 0) - ROM_LOAD( "r6.bin", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 + ROM_LOAD( "bagman_sound_6ra2.6r", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 - MMI 6331 BPROM ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip - ROM_LOAD( "r9_b11.bin", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) - ROM_LOAD( "t9_b12.bin", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) + ROM_LOAD( "bagman_a1_9r.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "bagman_a1_9t.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) ROM_END -ROM_START( bagmanj ) +ROM_START( bagmans3 ) // not compatible with the PAL16R6 emulator in ../mame/machine/bagman.cpp?? ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "bf8_06.e9", 0x0000, 0x1000, CRC(5fb0a1a3) SHA1(849cd60b58de9585a78a1c4c1747f666a4a4fcc3) ) // 2732 - ROM_LOAD( "bf8_07.f9", 0x1000, 0x1000, CRC(7871206e) SHA1(14d9b7a0779d59a870e0d4b911797dff5435a16c) ) // 2732 - ROM_LOAD( "bf8_08.j9", 0x2000, 0x1000, CRC(ae037d0a) SHA1(57d287b3968a4e7fdee2a98014dbdf4fae93d157) ) // 2732 - ROM_LOAD( "bf8_09.k9", 0x3000, 0x1000, CRC(36b6a944) SHA1(270dd2566b36129366adcbdd5a8db396bec7631f) ) // 2732 - ROM_LOAD( "bf8_10.m9", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) // 2732 - ROM_LOAD( "bf8_11.n9", 0x5000, 0x1000, CRC(83fccb1c) SHA1(7225d738b64a2cdaaec8860017de4229f2852ed2) ) // 2732 + ROM_LOAD( "bagman_a2_9e.9e", 0x0000, 0x1000, CRC(5f04d805) SHA1(84bcdfd25634879438429d2b41c491e092388add) ) + ROM_LOAD( "bagman_a3_9f.9f", 0x1000, 0x1000, CRC(136a78aa) SHA1(14e6a556e00b6ebe718f2fe119b372dc7bfa78d9) ) + ROM_LOAD( "bagman_a2_9j.9j", 0x2000, 0x1000, CRC(f94f5626) SHA1(0ec41c4957833e84e9e498fb4269dfd701a2e5b3) ) + ROM_LOAD( "bagman_a2_9k.9k", 0x3000, 0x1000, CRC(31788fc1) SHA1(959af99490b96c390a43c76dc4e09b35ebda3a24) ) + ROM_LOAD( "bagman_a2_9m.9m", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) + ROM_LOAD( "bagman_a3_9n.9n", 0x5000, 0x1000, CRC(ab66d4c1) SHA1(b90ffc7a8e16abcb88bb5d4705622cfafdf08c81) ) ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "bf8_03.e1", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) // 2732 - ROM_LOAD( "bf8_05.j1", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) // 2732 + ROM_LOAD( "bagman_a2_1e.1e", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) + ROM_LOAD( "bagman_a2_1j.1j", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) + + ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_LOAD( "bagman_a2_1c.1c", 0x0000, 0x1000, CRC(f3e11bd7) SHA1(43ee00ff777008c89f619eb183e7c5e63f6c7694) ) + ROM_LOAD( "bagman_a2_1f.1f", 0x1000, 0x1000, CRC(d0f7105b) SHA1(fb382703850a4ded567706e02ebb7f3e22531b7c) ) + + ROM_REGION( 0x0040, "proms", 0 ) + ROM_LOAD( "bagman_color_3pa2.3p", 0x0000, 0x0020, CRC(47504204) SHA1(7524ed766cc6d9a158327717d2cf53346ace2392) ) // MMI 6331 BPROM + ROM_LOAD( "bagman_color_3ra1.3r", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) // MMI 6331 BPROM + + ROM_REGION( 0x0020, "5110ctrl", 0) + ROM_LOAD( "bagman_sound_6ra2.6r", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 - MMI 6331 BPROM + + ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip + ROM_LOAD( "bagman_a1_9r.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "bagman_a1_9t.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) +ROM_END + +ROM_START( bagmanj ) // based on Stern's Bagman revision A4 set (bagmans4) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "bf8_06.e9", 0x0000, 0x1000, CRC(5fb0a1a3) SHA1(849cd60b58de9585a78a1c4c1747f666a4a4fcc3) ) // 2732 == bagman_a4_9e.9e + ROM_LOAD( "bf8_07.f9", 0x1000, 0x1000, CRC(7871206e) SHA1(14d9b7a0779d59a870e0d4b911797dff5435a16c) ) // 2732 == bagman_a4_9f.9f + ROM_LOAD( "bf8_08.j9", 0x2000, 0x1000, CRC(ae037d0a) SHA1(57d287b3968a4e7fdee2a98014dbdf4fae93d157) ) // 2732 + ROM_LOAD( "bf8_09.k9", 0x3000, 0x1000, CRC(36b6a944) SHA1(270dd2566b36129366adcbdd5a8db396bec7631f) ) // 2732 == bagman_a4_9k.9k + ROM_LOAD( "bf8_10.m9", 0x4000, 0x1000, CRC(b8e75eb6) SHA1(433fd736512f10bc0879b15821eb55cc41d58d33) ) // 2732 == bagman_a2_9m.9m + ROM_LOAD( "bf8_11.n9", 0x5000, 0x1000, CRC(83fccb1c) SHA1(7225d738b64a2cdaaec8860017de4229f2852ed2) ) // 2732 == bagman_a4_9n.9n + + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "bf8_03.e1", 0x0000, 0x1000, CRC(f217ac09) SHA1(a9716674401dff27344a01df8121b6b648688680) ) // 2732 == bagman_a2_1e.1e + ROM_LOAD( "bf8_05.j1", 0x1000, 0x1000, CRC(c680ef04) SHA1(79406bc786374abfcd9f548268c445b5c8d8858d) ) // 2732 == bagman_a2_1j.1j ROM_REGION( 0x2000, "gfx2", 0 ) ROM_LOAD( "bf8_02.c1", 0x0000, 0x1000, CRC(404283ed) SHA1(18613670cf23181089812c02429e222db0340a60) ) // 2732 ROM_LOAD( "bf8_04-1.f1", 0x1000, 0x1000, CRC(3f5c991e) SHA1(853c629ba0b4739dcb1af669fd600a3d83fb2072) ) // 2732 ROM_REGION( 0x0040, "proms", 0 ) // not dumped for this set - ROM_LOAD( "p3.bin", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) - ROM_LOAD( "r3.bin", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + ROM_LOAD( "bagman_color_3pa2.3p", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) + ROM_LOAD( "bagman_color_3ra1.3r", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) ROM_REGION( 0x0020, "5110ctrl", 0) // not dumped for this set - ROM_LOAD( "r6.bin", 0x0000, 0x0020, BAD_DUMP CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 + ROM_LOAD( "bagman_sound_6ra2.6r", 0x0000, 0x0020, BAD_DUMP CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip - ROM_LOAD( "bf8_12.r9", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) // 2732 - ROM_LOAD( "bf8_13.t9", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) // 2732 + ROM_LOAD( "bf8_12.r9", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) // 2732 == bagman_a1_9r.9r + ROM_LOAD( "bf8_13.t9", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) // 2732 == bagman_a1_9t.9t ROM_END ROM_START( botanic2 ) // PCB has Valadon logo with 'bajo licencia Itisa (Palamos)'. @@ -921,23 +955,23 @@ ROM_START( sbagman ) ROM_CONTINUE( 0xce00, 0x0200 ) ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "sb2v3.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) - ROM_LOAD( "sb4v3.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) + ROM_LOAD( "sb2v3.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) + ROM_LOAD( "sb4v3.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) ROM_REGION( 0x2000, "gfx2", 0 ) - ROM_LOAD( "sb1v3.1c", 0x0000, 0x1000, CRC(a046ff44) SHA1(af319cfb74e5efe435c26e971de13bd390f4b378) ) - ROM_LOAD( "sb3v3.1f", 0x1000, 0x1000, CRC(a4422da4) SHA1(3aa55ca8c99566c1c9eb097b6d645c4216e09dfb) ) + ROM_LOAD( "sb1v3.1c", 0x0000, 0x1000, CRC(a046ff44) SHA1(af319cfb74e5efe435c26e971de13bd390f4b378) ) + ROM_LOAD( "sb3v3.1f", 0x1000, 0x1000, CRC(a4422da4) SHA1(3aa55ca8c99566c1c9eb097b6d645c4216e09dfb) ) ROM_REGION( 0x0040, "proms", 0 ) // not dumped for this set - ROM_LOAD( "p3.bin", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) - ROM_LOAD( "r3.bin", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + ROM_LOAD( "p3.bin", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) + ROM_LOAD( "r3.bin", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) ROM_REGION( 0x0020, "5110ctrl", 0) // not dumped for this set - ROM_LOAD( "r6.bin", 0x0000, 0x0020, BAD_DUMP CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 + ROM_LOAD( "r6.bin", 0x0000, 0x0020, BAD_DUMP CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip - ROM_LOAD( "b11v3.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) - ROM_LOAD( "b12v3.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) + ROM_LOAD( "b11v3.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "b12v3.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) ROM_END ROM_START( sbagman2 ) @@ -945,41 +979,51 @@ ROM_START( sbagman2 ) ROM_LOAD( "5.9e", 0x0000, 0x1000, CRC(1b1d6b0a) SHA1(549161f6adc88fa16339815e05af33ca57815660) ) ROM_LOAD( "6.9f", 0x1000, 0x1000, CRC(ac49cb82) SHA1(5affa0c03bedf2c9d5368c7f075818e1760c12ae) ) ROM_LOAD( "7.9j", 0x2000, 0x1000, CRC(9a1c778d) SHA1(a655e25dc9efdf60cc5b34e42c93c4acaa4a7922) ) - ROM_LOAD( "8.9k", 0x3000, 0x1000, CRC(b94fbb73) SHA1(5d676c5d1d864d70d98f0137c4072062a781b3a0) ) - ROM_LOAD( "9.9m", 0x4000, 0x1000, CRC(601f34ba) SHA1(1b7ee61a341b9a87abe4fe10b0c647a9b0b97d38) ) - ROM_LOAD( "10.9n", 0x5000, 0x1000, CRC(5f750918) SHA1(3dc44f259e88999dbb95b4d4376281cc81c1ab87) ) + ROM_LOAD( "sb8v3.9k", 0x3000, 0x1000, CRC(b94fbb73) SHA1(5d676c5d1d864d70d98f0137c4072062a781b3a0) ) + ROM_LOAD( "sb9v3.9m", 0x4000, 0x1000, CRC(601f34ba) SHA1(1b7ee61a341b9a87abe4fe10b0c647a9b0b97d38) ) + ROM_LOAD( "sb10v3.9n", 0x5000, 0x1000, CRC(5f750918) SHA1(3dc44f259e88999dbb95b4d4376281cc81c1ab87) ) ROM_LOAD( "13.8d", 0xc000, 0x0e00, CRC(944a4453) SHA1(cd64d9267d2c5cea39464ba9308752c690e7fd24) ) ROM_CONTINUE( 0xfe00, 0x0200 ) - ROM_LOAD( "14.8f", 0xd000, 0x0400, CRC(83b10139) SHA1(8a1880c6ab8a345676fe30465351d69cc1b416b2) ) + ROM_LOAD( "sb14v3.8f", 0xd000, 0x0400, CRC(83b10139) SHA1(8a1880c6ab8a345676fe30465351d69cc1b416b2) ) ROM_CONTINUE( 0xe400, 0x0200 ) ROM_CONTINUE( 0xd600, 0x0a00 ) - ROM_LOAD( "15.8j", 0xe000, 0x0400, CRC(fe924879) SHA1(b80cbf9cba91e553f7685aef348854c02f0619c7) ) + ROM_LOAD( "sb15v3.8j", 0xe000, 0x0400, CRC(fe924879) SHA1(b80cbf9cba91e553f7685aef348854c02f0619c7) ) ROM_CONTINUE( 0xd400, 0x0200 ) ROM_CONTINUE( 0xe600, 0x0a00 ) - ROM_LOAD( "16.8k", 0xf000, 0x0e00, CRC(b77eb1f5) SHA1(ef94c1b449e3fa230491052fc3bd4db3f1239263) ) + ROM_LOAD( "sb16v3.8k", 0xf000, 0x0e00, CRC(b77eb1f5) SHA1(ef94c1b449e3fa230491052fc3bd4db3f1239263) ) ROM_CONTINUE( 0xce00, 0x0200 ) ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "2.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) - ROM_LOAD( "4.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) + ROM_LOAD( "sb2v3.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) + ROM_LOAD( "sb4v3.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) ROM_REGION( 0x2000, "gfx2", 0 ) - ROM_LOAD( "1.1c", 0x0000, 0x1000, CRC(a046ff44) SHA1(af319cfb74e5efe435c26e971de13bd390f4b378) ) - ROM_LOAD( "3.1f", 0x1000, 0x1000, CRC(a4422da4) SHA1(3aa55ca8c99566c1c9eb097b6d645c4216e09dfb) ) + ROM_LOAD( "sb1v3.1c", 0x0000, 0x1000, CRC(a046ff44) SHA1(af319cfb74e5efe435c26e971de13bd390f4b378) ) + ROM_LOAD( "sb3v3.1f", 0x1000, 0x1000, CRC(a4422da4) SHA1(3aa55ca8c99566c1c9eb097b6d645c4216e09dfb) ) ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "p3.bin", 0x0000, 0x0020, CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) - ROM_LOAD( "r3.bin", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + ROM_LOAD( "p3.bin", 0x0000, 0x0020, CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) + ROM_LOAD( "r3.bin", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) ROM_REGION( 0x0020, "5110ctrl", 0) - ROM_LOAD( "r6.bin", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 + ROM_LOAD( "r6.bin", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip - ROM_LOAD( "11.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) - ROM_LOAD( "12.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) + ROM_LOAD( "b11v3.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "b12v3.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) ROM_END -ROM_START( sbagmans ) +/* +Stern Super Bagman ROM labels follow this format: + +S. BAGMAN (c) +A1 1F <-- Revision level and PCB location +1984 STERN + +Most examples/photos of the PCB show several hand written labels. + +*/ +ROM_START( sbagmans ) // known to come in the form of a Bagman to Super Bagman conversion kit ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "sbag_9e.bin", 0x0000, 0x1000, CRC(c19696f2) SHA1(3a40202a97201a123033358f7afcb06f8ac15063) ) ROM_LOAD( "6.9f", 0x1000, 0x1000, CRC(ac49cb82) SHA1(5affa0c03bedf2c9d5368c7f075818e1760c12ae) ) @@ -999,23 +1043,23 @@ ROM_START( sbagmans ) ROM_CONTINUE( 0xce00, 0x0200 ) ROM_REGION( 0x2000, "gfx1", 0 ) - ROM_LOAD( "2.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) - ROM_LOAD( "4.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) + ROM_LOAD( "sb2v3.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) // hand written: SB #3 Ver3 + ROM_LOAD( "sb4v3.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) // hand written: SB #4 Ver3 ROM_REGION( 0x2000, "gfx2", 0 ) - ROM_LOAD( "sbag_1c.bin", 0x0000, 0x1000, CRC(262f870a) SHA1(90877b869a7e927cfa4f9729ec3d6eac3a95dc8f) ) - ROM_LOAD( "sbag_1f.bin", 0x1000, 0x1000, CRC(350ed0fb) SHA1(c7804e9618ebc88a1e3684a92a98d9a181441a1f) ) + ROM_LOAD( "s._bagman_a1_1c.1c", 0x0000, 0x1000, CRC(262f870a) SHA1(90877b869a7e927cfa4f9729ec3d6eac3a95dc8f) ) + ROM_LOAD( "s._bagman_a1_1f.1f", 0x1000, 0x1000, CRC(350ed0fb) SHA1(c7804e9618ebc88a1e3684a92a98d9a181441a1f) ) ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "p3.bin", 0x0000, 0x0020, CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) - ROM_LOAD( "r3.bin", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + ROM_LOAD( "bagman_color_3pa2.3p", 0x0000, 0x0020, CRC(47504204) SHA1(7524ed766cc6d9a158327717d2cf53346ace2392) ) // MMI 6331 BPROM + ROM_LOAD( "bagman_color_3ra1.3r", 0x0020, 0x0020, CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) // MMI 6331 BPROM ROM_REGION( 0x0020, "5110ctrl", 0) - ROM_LOAD( "r6.bin", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 + ROM_LOAD( "bagman_sound_6ra2.6r", 0x0000, 0x0020, CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) // State machine driving TMS5110 - MMI 6331 BPROM ROM_REGION( 0x2000, "tmsprom", 0 ) // Data for the TMS5110 speech chip - ROM_LOAD( "11.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) - ROM_LOAD( "12.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) + ROM_LOAD( "bagman_a1_9r.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "bagman_a1_9t.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) ROM_END /* @@ -1182,24 +1226,31 @@ ROM_START( squaitsa ) ROM_END -GAME( 1982, bagman, 0, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Bagman", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagnard, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Le Bagnard (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagnarda, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Le Bagnard (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, bagnardi, bagman, bagman, bagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Le Bagnard (Itisa, Spain)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagnardio, bagman, bagman, bagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Le Bagnard (Itisa, Spain, older)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagmans, bagman, bagman, bagmans, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagmans2, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagmanj, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation (Taito license)", "Bagman (Taito)", MACHINE_SUPPORTS_SAVE ) // Title screen actually doesn't mention Valadon, only Stern and Taito +void bagman_state::init_bagmans3() +{ + // this earlier version has extra code at 0x5f98 - 0x5fa5 that reads a value from $ed01. Returning 0x01 allows starting a game and gives correct music tempo. TODO: What happens here? Fix this workaround + m_maincpu->space(AS_PROGRAM).install_read_handler(0xed01, 0xed01, read8smo_delegate(*this, []() { return 0x01; }, "hack_r")); +} + +GAME( 1982, bagman, 0, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Bagman", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagnard, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Le Bagnard (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagnarda, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Le Bagnard (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, bagnardi, bagman, bagman, bagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Le Bagnard (Itisa, Spain)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagnardio, bagman, bagman, bagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Le Bagnard (Itisa, Spain, older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagmans, bagman, bagman, bagmans, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, revision A5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagmans4, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, revision A4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagmans3, bagman, bagman, bagman, bagman_state, init_bagmans3, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, revision A3)", MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE ) // see init_bagmans3(). Not sure it's actually protection +GAME( 1982, bagmanj, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation (Taito license)", "Bagman (Taito)", MACHINE_SUPPORTS_SAVE ) // Title screen actually doesn't mention Valadon, only Stern and Taito -GAME( 1984, sbagman, 0, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman (version 5)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, sbagman2, sbagman, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman (version 3?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, sbagmani, sbagman, sbagmani, sbagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Super Bagman (Itisa, Spain)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // Different color PROMs, needs correct decoding -GAME( 1984, sbagmans, sbagman, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Super Bagman (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagman, 0, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman (version 5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagman2, sbagman, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman (version 3?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagmani, sbagman, sbagmani, sbagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Super Bagman (Itisa, Spain)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // Different color PROMs, needs correct decoding +GAME( 1984, sbagmans, sbagman, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Super Bagman (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, pickin, 0, pickin, pickin, bagman_state, empty_init, ROT270, "Valadon Automation", "Pickin'", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, pickin, 0, pickin, pickin, bagman_state, empty_init, ROT270, "Valadon Automation", "Pickin'", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, botanic, 0, botanic, botanici, bagman_state, empty_init, ROT90, "Itisa", "Botanic (English / Spanish, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, botanic2, botanic, bagman, botanici2, bagman_state, empty_init, ROT90, "Itisa", "Botanic (English / Spanish, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // At the title screen, Botanic in corrupted in the first loop, OK from the second on. Colors likely wrong, too. Has a leftover 5110. -GAME( 1984, botanicf, botanic, botanic, botanicf, bagman_state, empty_init, ROT270, "Itisa (Valadon Automation license)", "Botanic (French)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, botanic, 0, botanic, botanici, bagman_state, empty_init, ROT90, "Itisa", "Botanic (English / Spanish, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, botanic2, botanic, bagman, botanici2, bagman_state, empty_init, ROT90, "Itisa", "Botanic (English / Spanish, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // At the title screen, Botanic in corrupted in the first loop, OK from the second on. Colors likely wrong, too. Has a leftover 5110. +GAME( 1984, botanicf, botanic, botanic, botanicf, bagman_state, empty_init, ROT270, "Itisa (Valadon Automation license)", "Botanic (French)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, squaitsa, 0, botanic, squaitsa, squaitsa_state, empty_init, ROT0, "Itisa", "Squash (Itisa)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, squaitsa, 0, botanic, squaitsa, squaitsa_state, empty_init, ROT0, "Itisa", "Squash (Itisa)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/banctec.cpp b/src/mame/drivers/banctec.cpp index 8d5857a7a1f..220ad278819 100644 --- a/src/mame/drivers/banctec.cpp +++ b/src/mame/drivers/banctec.cpp @@ -87,16 +87,14 @@ void banctec_state::videoram_w(u8 data) MC6845_UPDATE_ROW( banctec_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0xff; - chr = m_videoram[mem]; - gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0); + u16 const mem = (ma + x) & 0xff; + u8 const chr = m_videoram[mem]; + u8 const gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/bbc.cpp b/src/mame/drivers/bbc.cpp index ce3ab361072..f29d8ad55dd 100644 --- a/src/mame/drivers/bbc.cpp +++ b/src/mame/drivers/bbc.cpp @@ -1181,6 +1181,8 @@ void bbc_state::bbcb(machine_config &config) m_via6522_1->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); m_via6522_1->writepb_handler().append(m_internal, FUNC(bbc_internal_slot_device::latch_fe60_w)); m_via6522_1->ca2_handler().set("printer", FUNC(centronics_device::write_strobe)); + m_via6522_1->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); + m_via6522_1->cb2_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb2)); m_via6522_1->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<2>)); /* adc */ @@ -1403,6 +1405,33 @@ void bbcbp_state::bbcbp128(machine_config &config) } +void bbcbp_state::cfa3000bp(machine_config &config) +{ + bbcbp(config); + + /* fdc */ + m_wd_fdc->subdevice<floppy_connector>("0")->set_default_option(nullptr); + m_wd_fdc->subdevice<floppy_connector>("1")->set_default_option(nullptr); + + /* keyboard */ + m_userport->set_default_option("cfa3000kbd"); + m_userport->set_fixed(true); + + /* option board */ + m_1mhzbus->set_default_option("cfa3000opt"); + m_1mhzbus->set_fixed(true); + + /* analogue dials/sensors */ + m_analog->set_default_option("cfa3000a"); + m_analog->set_fixed(true); + + /* software lists */ + config.device_remove("cass_ls"); + config.device_remove("flop_ls_b"); + config.device_remove("flop_ls_b_orig"); +} + + /*************************************************************************** Acorn Business Computers @@ -1651,6 +1680,8 @@ void bbcm_state::bbcm(machine_config &config) m_via6522_1->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via6522_1->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); m_via6522_1->ca2_handler().set("printer", FUNC(centronics_device::write_strobe)); + m_via6522_1->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); + m_via6522_1->cb2_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb2)); m_via6522_1->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<2>)); /* fdc */ @@ -1974,6 +2005,8 @@ void bbcm_state::bbcmc(machine_config &config) m_via6522_1->readpb_handler().append(m_exp, FUNC(bbc_exp_slot_device::pb_r)).mask(0xe0); m_via6522_1->writepb_handler().set(m_joyport, FUNC(bbc_joyport_slot_device::pb_w)).mask(0x1f); m_via6522_1->writepb_handler().append(m_exp, FUNC(bbc_exp_slot_device::pb_w)).mask(0xe0); + m_via6522_1->cb1_handler().set(m_joyport, FUNC(bbc_joyport_slot_device::write_cb1)); + m_via6522_1->cb2_handler().set(m_joyport, FUNC(bbc_joyport_slot_device::write_cb2)); /* cartridge sockets */ config.device_remove("cartslot1"); @@ -2864,11 +2897,60 @@ ROM_START(mpc900gx) ROM_END +ROM_START(cfa3000bp) + ROM_REGION(0x44000, "swr", ROMREGION_ERASEFF) /* Sideways ROMs */ + ROM_LOAD("bpos2.ic71", 0x3c000, 0x8000, CRC(9f356396) SHA1(ea7d3a7e3ee1ecfaa1483af994048057362b01f2)) + /* rom page 0 00000 SWRAM (B+ 128K only) */ + /* rom page 1 04000 SWRAM (B+ 128K only) */ + /* rom page 2 08000 IC35 32K IN PAGE 3 */ + /* rom page 3 0c000 IC35 SPARE SOCKET */ + /* rom page 4 10000 IC44 32K IN PAGE 5 */ + /* rom page 5 14000 IC44 SPARE SOCKET */ + /* rom page 6 18000 IC57 32K IN PAGE 7 */ + /* rom page 7 1c000 IC57 SPARE SOCKET */ + /* rom page 8 20000 IC62 32K IN PAGE 9 */ + /* rom page 9 24000 IC62 SPARE SOCKET */ + /* rom page 10 28000 IC68 32K IN PAGE 11 */ + /* rom page 11 2c000 IC68 SPARE SOCKET */ + /* rom page 12 30000 SWRAM (B+ 128K only) */ + /* rom page 13 34000 SWRAM (B+ 128K only) */ + /* rom page 14 38000 IC71 32K IN PAGE 15 */ + /* rom page 15 3C000 IC71 BASIC */ + ROM_SYSTEM_BIOS(0, "4", "Issue 4") + ROMX_LOAD("cfa3000_3.rom", 0x14000, 0x4000, CRC(4f246cd5) SHA1(6ba9625248c585deed5c651a889eecc86384a60d), ROM_BIOS(0)) + ROMX_LOAD("cfa3000_4.rom", 0x1c000, 0x4000, CRC(ca0e30fd) SHA1(abddc7ba6d16855ebda2ef55fe8662bc545ae755), ROM_BIOS(0)) + ROMX_LOAD("cfa3000_s.rom", 0x24000, 0x4000, CRC(71fd4c8a) SHA1(5bad70ee55403bc0191f6b189c9b6e5effdbca4c), ROM_BIOS(0)) + + /* link S13 set for BASIC to take low priority ROM numbers 0/1 */ + ROM_COPY("swr", 0x3c000, 0x4000, 0x4000) + ROM_FILL(0x3c000, 0x4000, 0xff) + + ROM_REGION(0x4000, "mos", 0) + ROM_COPY("swr", 0x40000, 0, 0x4000) + + ROM_REGION(0x4000, "vsm", 0) /* system speech PHROM */ + ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) +ROM_END + + ROM_START(cfa3000) ROM_REGION(0x44000, "swr", ROMREGION_ERASEFF) /* Sideways ROMs */ - ROM_LOAD("cfa3000_3_4_iss10.3.ic41", 0x10000, 0x08000, CRC(ecb385ab) SHA1(eafa9b34cb1cf63790f74332bb7d85ee356b6973)) - ROM_LOAD("cfa3000_sm_iss10.3.ic37", 0x18000, 0x08000, CRC(c07aee5f) SHA1(1994e3755dc15d1ea7e105bc19cd57893b719779)) - ROM_LOAD("acorn_mos,tinsley_64k,iss10.3.ic24", 0x20000, 0x10000, CRC(4413c3ee) SHA1(76d0462b4dabe2461010fce2341570ff3d606d54)) + ROM_SYSTEM_BIOS(0, "103", "Issue 10.3") + ROMX_LOAD("cfa3000_3m4_iss10.3.ic41", 0x10000, 0x08000, CRC(ecb385ab) SHA1(eafa9b34cb1cf63790f74332bb7d85ee356b6973), ROM_BIOS(0)) + ROMX_LOAD("cfa3000_sm_iss10.3.ic37", 0x18000, 0x08000, CRC(c07aee5f) SHA1(1994e3755dc15d1ea7e105bc19cd57893b719779), ROM_BIOS(0)) + ROMX_LOAD("acorn_mos,tinsley_64k,iss10.3.ic24", 0x20000, 0x10000, CRC(4413c3ee) SHA1(76d0462b4dabe2461010fce2341570ff3d606d54), ROM_BIOS(0)) + ROM_SYSTEM_BIOS(1, "102", " Issue 10.2") + ROMX_LOAD("cfa3000_3m4_iss10.2.ic41", 0x10000, 0x08000, CRC(ecb385ab) SHA1(eafa9b34cb1cf63790f74332bb7d85ee356b6973), ROM_BIOS(1)) + ROMX_LOAD("cfa3000_sm_iss10.2.ic37", 0x18000, 0x08000, CRC(e733d5b3) SHA1(07e89943c6ac0953b75686ee06e947f33119dbed), ROM_BIOS(1)) + ROMX_LOAD("acorn_mos,tinsley_64k,iss10.2.ic24", 0x20000, 0x10000, CRC(4413c3ee) SHA1(76d0462b4dabe2461010fce2341570ff3d606d54), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(2, "9", " Issue 9") + ROMX_LOAD("cfa3000_3m4_iss9.ic41", 0x10000, 0x08000, CRC(a4bd5d53) SHA1(90747ff7bd81ac1e124bae964c206d8df163e1d6), ROM_BIOS(2)) + ROMX_LOAD("cfa3000_sm_iss9.ic37", 0x18000, 0x08000, CRC(559d1fae) SHA1(271e1ab9b53e82028e92e7cdb8c517df06e76477), ROM_BIOS(2)) + ROMX_LOAD("acorn_mos,tinsley_64k,iss9.ic24", 0x20000, 0x10000, CRC(4413c3ee) SHA1(76d0462b4dabe2461010fce2341570ff3d606d54), ROM_BIOS(2)) + ROM_SYSTEM_BIOS(3, "7", "Issue 7") + ROMX_LOAD("cfa3000_3m4_iss7.ic41", 0x10000, 0x08000, CRC(a0b32288) SHA1(83b047e9eb35f0644bd8f0acb1a56e1428bacc0b), ROM_BIOS(3)) + ROMX_LOAD("cfa3000_sm_iss7.ic37", 0x18000, 0x08000, CRC(3cd42bbd) SHA1(17f6c66039d20a364cc9e1377c7ced14d5302603), ROM_BIOS(3)) + ROMX_LOAD("acorn_mos,tinsley_64k,iss7.ic24", 0x20000, 0x10000, CRC(4413c3ee) SHA1(76d0462b4dabe2461010fce2341570ff3d606d54), ROM_BIOS(3)) ROM_COPY("swr", 0x20000, 0x30000, 0x10000) /* Mirror MOS */ ROM_COPY("swr", 0x30000, 0x40000, 0x04000) /* Move loaded roms into place */ ROM_FILL(0x30000, 0x4000, 0xff) @@ -2902,39 +2984,50 @@ ROM_END #define rom_ltmpm rom_bbcm -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP ( 1981, bbcb, 0, bbca, bbcb, bbcb, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model B", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1981, bbca, bbcb, 0, bbca, bbca, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model A", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1982, bbcb_de, bbcb, 0, bbcb_de, bbcb, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model B (German)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1983, bbcb_us, bbcb, 0, bbcb_us, bbcb, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model B (US)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1982, torchf, bbcb, 0, torchf, torchb, torch_state, init_bbc, "Torch Computers", "Torch CF240", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1983, torchh, bbcb, 0, torchh, torchb, torch_state, init_bbc, "Torch Computers", "Torch CH240", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1984, torch301, bbcb, 0, torch301, torchi, torch_state, init_bbc, "Torch Computers", "Torch Model 301", MACHINE_NOT_WORKING) -COMP ( 1984, torch725, bbcb, 0, torch725, torchi, torch_state, init_bbc, "Torch Computers", "Torch Model 725", MACHINE_NOT_WORKING) -COMP ( 1985, bbcbp, 0, bbcb, bbcbp, bbcbp, bbcbp_state, init_bbc, "Acorn Computers", "BBC Micro Model B+ 64K", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, bbcbp128, bbcbp, 0, bbcbp128, bbcbp, bbcbp_state, init_bbc, "Acorn Computers", "BBC Micro Model B+ 128K", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, abc110, bbcbp, 0, abc110, abc, bbcbp_state, init_bbc, "Acorn Computers", "ABC 110", MACHINE_NOT_WORKING) -COMP ( 1985, acw443, bbcbp, 0, acw443, abc, bbcbp_state, init_bbc, "Acorn Computers", "ABC 210/Cambridge Workstation", MACHINE_NOT_WORKING) -COMP ( 1985, abc310, bbcbp, 0, abc310, abc, bbcbp_state, init_bbc, "Acorn Computers", "ABC 310", MACHINE_NOT_WORKING) -COMP ( 1985, ltmpbp, bbcbp, 0, bbcbp, ltmpbp, bbcbp_state, init_ltmp, "Lawrie T&M Ltd.", "LTM Portable (B+)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1985, reutapm, bbcbp, 0, reutapm, bbcb, bbcbp_state, init_bbc, "Acorn Computers", "Reuters APM", MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING) -COMP ( 1986, econx25, bbcbp, 0, econx25, bbcbp, bbcbp_state, init_bbc, "Acorn Computers", "Econet X25 Gateway", MACHINE_NOT_WORKING) -COMP ( 1986, bbcm, 0, bbcb, bbcm, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master 128", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcmt, bbcm, 0, bbcmt, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master Turbo", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcmaiv, bbcm, 0, bbcmaiv, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master AIV", MACHINE_NOT_WORKING) -COMP ( 1986, bbcmet, bbcm, 0, bbcmet, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master ET", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcm512, bbcm, 0, bbcm512, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master 512", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcmarm, bbcm, 0, bbcmarm, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master (ARM Evaluation)", MACHINE_NOT_WORKING) -COMP ( 1986, ltmpm, bbcm, 0, bbcm, ltmpm, bbcm_state, init_ltmp, "Lawrie T&M Ltd.", "LTM Portable (Master)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1987, daisy, bbcm, 0, daisy, bbcm, bbcm_state, init_bbc, "Comus Instruments Ltd.", "Comus Daisy", MACHINE_NOT_WORKING) -COMP ( 1986, bbcmc, 0, bbcm, bbcmc, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master Compact", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1986, bbcmc_ar, bbcmc, 0, bbcmc, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master Compact (Arabic)", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1987, pro128s, bbcmc, 0, pro128s, bbcm, bbcm_state, init_bbc, "Olivetti", "Prodest PC 128S", MACHINE_IMPERFECT_GRAPHICS) -COMP ( 1988, autoc15, bbcmc, 0, autoc15, autoc, bbcm_state, init_bbc, "Autocue Ltd.", "Autocue 1500 Telepromter", MACHINE_NOT_WORKING) -COMP ( 1988, discmon, bbcm, 0, discmon, bbcm, bbcm_state, init_bbc, "Arbiter Leisure", "Arbiter Discmonitor A-01", MACHINE_NOT_WORKING) -COMP ( 1988, discmate, bbcm, 0, discmate, bbcm, bbcm_state, init_bbc, "Arbiter Leisure", "Arbiter Discmate A-02", MACHINE_NOT_WORKING) -//COMP ( 1988, discmast, bbcm, 0, discmast, bbcm, bbcm_state, init_bbc, "Arbiter Leisure", "Arbiter Discmaster A-03", MACHINE_NOT_WORKING) -COMP ( 1987, mpc800, bbcm, 0, mpc800, bbcm, bbcm_state, init_bbc, "G2 Systems", "MasterPieCe 800 Series", MACHINE_NOT_WORKING) -COMP ( 1988, mpc900, bbcm, 0, mpc900, bbcm, bbcm_state, init_bbc, "G2 Systems", "MasterPieCe 900 Series", MACHINE_NOT_WORKING) -COMP ( 1990, mpc900gx, bbcm, 0, mpc900gx, bbcm, bbcm_state, init_bbc, "G2 Systems", "MasterPieCe 900GX Series", MACHINE_NOT_WORKING) -COMP ( 1989, cfa3000, bbcm, 0, cfa3000, bbcm, bbcm_state, init_cfa, "Tinsley Medical Instruments", "Henson CFA 3000", MACHINE_NOT_WORKING) +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ + +/* Acorn Computers */ +COMP( 1981, bbcb, 0, bbca, bbcb, bbcb, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model B", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1981, bbca, bbcb, 0, bbca, bbca, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model A", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1982, bbcb_de, bbcb, 0, bbcb_de, bbcb, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model B (German)", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1983, bbcb_us, bbcb, 0, bbcb_us, bbcb, bbc_state, init_bbc, "Acorn Computers", "BBC Micro Model B (US)", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1985, bbcbp, 0, bbcb, bbcbp, bbcbp, bbcbp_state, init_bbc, "Acorn Computers", "BBC Micro Model B+ 64K", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1985, bbcbp128, bbcbp, 0, bbcbp128, bbcbp, bbcbp_state, init_bbc, "Acorn Computers", "BBC Micro Model B+ 128K", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1985, abc110, bbcbp, 0, abc110, abc, bbcbp_state, init_bbc, "Acorn Computers", "ABC 110", MACHINE_NOT_WORKING ) +COMP( 1985, acw443, bbcbp, 0, acw443, abc, bbcbp_state, init_bbc, "Acorn Computers", "ABC 210/Cambridge Workstation", MACHINE_NOT_WORKING ) +COMP( 1985, abc310, bbcbp, 0, abc310, abc, bbcbp_state, init_bbc, "Acorn Computers", "ABC 310", MACHINE_NOT_WORKING ) +COMP( 1985, reutapm, bbcbp, 0, reutapm, bbcb, bbcbp_state, init_bbc, "Acorn Computers", "Reuters APM", MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING ) +COMP( 1986, econx25, bbcbp, 0, econx25, bbcbp, bbcbp_state, init_bbc, "Acorn Computers", "Econet X25 Gateway", MACHINE_NOT_WORKING ) +COMP( 1986, bbcm, 0, bbcb, bbcm, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master 128", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1986, bbcmt, bbcm, 0, bbcmt, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master Turbo", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1986, bbcmaiv, bbcm, 0, bbcmaiv, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master AIV", MACHINE_NOT_WORKING ) +COMP( 1986, bbcmet, bbcm, 0, bbcmet, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master ET", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1986, bbcm512, bbcm, 0, bbcm512, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master 512", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1986, bbcmarm, bbcm, 0, bbcmarm, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master (ARM Evaluation)", MACHINE_NOT_WORKING ) +COMP( 1986, bbcmc, 0, bbcm, bbcmc, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master Compact", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1986, bbcmc_ar, bbcmc, 0, bbcmc, bbcm, bbcm_state, init_bbc, "Acorn Computers", "BBC Master Compact (Arabic)", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1987, pro128s, bbcmc, 0, pro128s, bbcm, bbcm_state, init_bbc, "Olivetti", "Prodest PC 128S", MACHINE_IMPERFECT_GRAPHICS ) + +/* Torch Computers */ +COMP( 1982, torchf, bbcb, 0, torchf, torchb, torch_state, init_bbc, "Torch Computers", "Torch CF240", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1983, torchh, bbcb, 0, torchh, torchb, torch_state, init_bbc, "Torch Computers", "Torch CH240", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1984, torch301, bbcb, 0, torch301, torchi, torch_state, init_bbc, "Torch Computers", "Torch Model 301", MACHINE_NOT_WORKING ) +COMP( 1984, torch725, bbcb, 0, torch725, torchi, torch_state, init_bbc, "Torch Computers", "Torch Model 725", MACHINE_NOT_WORKING ) + +/* TV Production */ +COMP( 1988, autoc15, bbcmc, 0, autoc15, autoc, bbcm_state, init_bbc, "Autocue Ltd.", "Autocue 1500 Teleprompter", MACHINE_NOT_WORKING ) +COMP( 1987, mpc800, bbcm, 0, mpc800, bbcm, bbcm_state, init_bbc, "G2 Systems", "MasterPieCe 800 Series", MACHINE_NOT_WORKING ) +COMP( 1988, mpc900, bbcm, 0, mpc900, bbcm, bbcm_state, init_bbc, "G2 Systems", "MasterPieCe 900 Series", MACHINE_NOT_WORKING ) +COMP( 1990, mpc900gx, bbcm, 0, mpc900gx, bbcm, bbcm_state, init_bbc, "G2 Systems", "MasterPieCe 900GX Series", MACHINE_NOT_WORKING ) + +/* Jukeboxes */ +COMP( 1988, discmon, bbcm, 0, discmon, bbcm, bbcm_state, init_bbc, "Arbiter Leisure", "Arbiter Discmonitor A-01", MACHINE_NOT_WORKING ) +COMP( 1988, discmate, bbcm, 0, discmate, bbcm, bbcm_state, init_bbc, "Arbiter Leisure", "Arbiter Discmate A-02", MACHINE_NOT_WORKING ) +//COMP( 1988, discmast, bbcm, 0, discmast, bbcm, bbcm_state, init_bbc, "Arbiter Leisure", "Arbiter Discmaster A-03", MACHINE_NOT_WORKING ) + +/* Industrial */ +COMP( 1985, ltmpbp, bbcbp, 0, bbcbp, ltmpbp, bbcbp_state, init_ltmp, "Lawrie T&M Ltd.", "LTM Portable (B+)", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1986, ltmpm, bbcm, 0, bbcm, ltmpm, bbcm_state, init_ltmp, "Lawrie T&M Ltd.", "LTM Portable (Master)", MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1987, daisy, bbcm, 0, daisy, bbcm, bbcm_state, init_bbc, "Comus Instruments Ltd.", "Comus Daisy", MACHINE_NOT_WORKING ) +COMP( 198?, cfa3000bp, bbcbp, 0, cfa3000bp, bbcbp, bbcbp_state, init_cfa, "Tinsley Medical Instruments", "Henson CFA 3000 (B+)", MACHINE_NOT_WORKING ) +COMP( 1989, cfa3000, bbcm, 0, cfa3000, bbcm, bbcm_state, init_cfa, "Tinsley Medical Instruments", "Henson CFA 3000 (Master)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/bcs3.cpp b/src/mame/drivers/bcs3.cpp index 8660ded8640..1bb81ef9fc7 100644 --- a/src/mame/drivers/bcs3.cpp +++ b/src/mame/drivers/bcs3.cpp @@ -265,24 +265,24 @@ INPUT_PORTS_END // Official version u32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,rat; - u16 sy=0,ma=0x50,x; + u16 sy=0,ma=0x50; - for (y = 0; y < 12; y++) + for (u8 y = 0; y < 12; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; + uint16_t *p = &bitmap.pix(sy++); + u8 const rat = (ra + 1) & 7; - for (x = ma; x < ma + 28; x++) + for (u16 x = ma; x < ma + 28; x++) { + u8 gfx; if (ra < 8) { - chr = m_p_videoram[x] & 0x7f; + u8 const chr = m_p_videoram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | rat ] ^ 0xff; + gfx = m_p_chargen[(chr<<3) | rat] ^ 0xff; } else gfx = 0xff; @@ -307,27 +307,27 @@ u32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, I'm assuming that it only shows a portion of this, with the cursor always in sight. */ u32 bcs3_state::screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,rat; - u16 sy = 0, ma = s_init, x; - u16 cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position - rat = cursor / (s_cols+1); - if (rat > (s_rows-1)) ma += (rat-(s_rows-1)) * (s_cols+1); + u16 sy = 0, ma = s_init; + u16 const cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position + u8 const cw = cursor / (s_cols+1); + if (cw > (s_rows-1)) ma += (cw-(s_rows-1)) * (s_cols+1); - for (y = 0; y < s_rows; y++) + for (u8 y = 0; y < s_rows; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; + uint16_t *p = &bitmap.pix(sy++); + u8 const rat = (ra + 1) & 7; - for (x = ma; x < ma + s_cols; x++) + for (u16 x = ma; x < ma + s_cols; x++) { + u8 gfx; if (ra < 8) { - chr = m_p_videoram[x] & 0x7f; + u8 const chr = m_p_videoram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | rat ] ^ 0xff; + gfx = m_p_chargen[(chr<<3) | rat] ^ 0xff; } else gfx = 0xff; diff --git a/src/mame/drivers/beaminv.cpp b/src/mame/drivers/beaminv.cpp index e323210244f..91b9e7b664d 100644 --- a/src/mame/drivers/beaminv.cpp +++ b/src/mame/drivers/beaminv.cpp @@ -186,23 +186,19 @@ void beaminv_state::machine_reset() uint32_t beaminv_state::screen_update_beaminv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t y = offs; uint8_t x = offs >> 8 << 3; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/beezer.cpp b/src/mame/drivers/beezer.cpp index 64ccb3971e9..4d6a88944ce 100644 --- a/src/mame/drivers/beezer.cpp +++ b/src/mame/drivers/beezer.cpp @@ -257,8 +257,8 @@ uint32_t beezer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - bitmap.pix16(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; - bitmap.pix16(y, x + 0) = m_videoram[0x80 * x + y] >> 4; + bitmap.pix(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; + bitmap.pix(y, x + 0) = m_videoram[0x80 * x + y] >> 4; } } @@ -554,7 +554,7 @@ void beezer_state::beezer(machine_config &config) // schematics show an input labeled VCO to channel 2, but the source is unknown mm5837_device &noise(MM5837(config, "noise")); - noise.set_vdd_voltage(12); + noise.set_vdd(-12); noise.output_callback().set(FUNC(beezer_state::noise_w)); SPEAKER(config, "speaker").front_center(); diff --git a/src/mame/drivers/berzerk.cpp b/src/mame/drivers/berzerk.cpp index 778046da173..6d45d41f3aa 100644 --- a/src/mame/drivers/berzerk.cpp +++ b/src/mame/drivers/berzerk.cpp @@ -492,30 +492,30 @@ uint32_t berzerk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t data = m_videoram[offs]; uint8_t color = m_colorram[((offs >> 2) & 0x07e0) | (offs & 0x001f)]; uint8_t y = offs >> 5; uint8_t x = offs << 3; + int i; + for (i = 0; i < 4; i++) { rgb_t pen = (data & 0x80) ? pens[color >> 4] : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } for (; i < 8; i++) { rgb_t pen = (data & 0x80) ? pens[color & 0x0f] : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } } diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp index ccbefc4235f..c960664c5f8 100644 --- a/src/mame/drivers/bfcobra.cpp +++ b/src/mame/drivers/bfcobra.cpp @@ -415,20 +415,16 @@ void bfcobra_state::video_start() uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint8_t *src; - uint32_t *dest; - uint32_t offset; - uint8_t *hirescol; - uint8_t *lorescol; - /* Select screen has to be programmed into two registers */ /* No idea what happens if the registers are different */ + uint32_t offset; if (m_flip_8 & 0x40 && m_flip_22 & 0x40) offset = 0x10000; else offset = 0; + uint8_t const *hirescol; + uint8_t const *lorescol; if(m_videomode & 0x20) { hirescol = m_col3bit; @@ -445,16 +441,16 @@ uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb3 lorescol = m_col8bit; } - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { uint16_t y_offset = (y + m_v_scroll) * 256; - src = &m_video_ram[offset + y_offset]; - dest = &bitmap.pix32(y); + uint8_t const *const src = &m_video_ram[offset + y_offset]; + uint32_t *dest = &bitmap.pix(y); - for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) + for (int x = cliprect.left(); x <= cliprect.right() / 2; ++x) { - uint8_t x_offset = x + m_h_scroll; - uint8_t pen = *(src + x_offset); + uint8_t const x_offset = x + m_h_scroll; + uint8_t const pen = *(src + x_offset); if ( ( m_videomode & 0x81 ) == 1 || (m_videomode & 0x80 && pen & 0x80) ) { @@ -2323,21 +2319,16 @@ void bfcobjam_state::chipset_w(offs_t offset, uint8_t data) uint32_t bfcobjam_state::screen_update_bfcobjam(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint8_t *src; - uint32_t *dest; - uint32_t offset; - uint8_t *hirescol; - uint8_t *lorescol; - - /* Select screen has to be programmed into two registers */ /* No idea what happens if the registers are different */ + uint32_t offset; if (m_flip_8 & 0x40 && m_flip_22 & 0x40) offset = 0x10000; else offset = 0; + uint8_t const *hirescol; + uint8_t const *lorescol; if(m_videomode & 0x20) { hirescol = m_col3bit; @@ -2354,16 +2345,16 @@ uint32_t bfcobjam_state::screen_update_bfcobjam(screen_device &screen, bitmap_rg lorescol = m_col8bit; } - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { - uint16_t y_offset = (y + m_v_scroll) * 256; - src = &m_video_ram[offset + y_offset]; - dest = &bitmap.pix32(y); + uint16_t const y_offset = (y + m_v_scroll) * 256; + uint8_t const *const src = &m_video_ram[offset + y_offset]; + uint32_t *dest = &bitmap.pix(y); - for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) + for (int x = cliprect.left(); x <= cliprect.right() / 2; ++x) { - uint8_t x_offset = x + m_h_scroll; - uint8_t pen = *(src + x_offset); + uint8_t const x_offset = x + m_h_scroll; + uint8_t const pen = *(src + x_offset); if ( ( m_videomode & 0x81 ) == 1 || (m_videomode & 0x80 && pen & 0x80) ) { diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp index dc597cba79d..a80176597bc 100644 --- a/src/mame/drivers/bigbord2.cpp +++ b/src/mame/drivers/bigbord2.cpp @@ -554,21 +554,19 @@ u8 bigbord2_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, uint16_t ac_cnt, boo MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,attr; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); ra &= 15; m_cnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - attr = m_aram[mem]; - chr = m_vram[mem]; + u16 mem = (ma + x) & 0x7ff; + u8 attr = m_aram[mem]; + u8 chr = m_vram[mem]; /* process attributes */ - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + u8 gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character */ *p++ = palette[BIT( gfx, 7 )]; diff --git a/src/mame/drivers/bingor.cpp b/src/mame/drivers/bingor.cpp index 63a39cc8c05..1d20658a6e3 100644 --- a/src/mame/drivers/bingor.cpp +++ b/src/mame/drivers/bingor.cpp @@ -564,37 +564,32 @@ void bingor_state::video_start() uint32_t bingor_state::screen_update_bingor(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - bitmap.fill(m_palette->black_pen(), cliprect); - count = (0x2000 / 2); - - for(y = 0; y < 256; y++) + int count = (0x2000 / 2); + for(int y = 0; y < 256; y++) { - for(x = 0; x < 286; x += 4) + for(int x = 0; x < 286; x += 4) { - uint32_t color; - - color = (m_blit_ram[count] & 0xf000) >> 12; + uint32_t color = (m_blit_ram[count] & 0xf000) >> 12; if(cliprect.contains(x + 3, y)) - bitmap.pix32(y, x + 3) = m_palette->pen(color); + bitmap.pix(y, x + 3) = m_palette->pen(color); color = (m_blit_ram[count] & 0x0f00) >> 8; if(cliprect.contains(x + 2, y)) - bitmap.pix32(y, x + 2) = m_palette->pen(color); + bitmap.pix(y, x + 2) = m_palette->pen(color); color = (m_blit_ram[count] & 0x00f0) >> 4; if(cliprect.contains(x + 1, y)) - bitmap.pix32(y, x + 1) = m_palette->pen(color); + bitmap.pix(y, x + 1) = m_palette->pen(color); color = (m_blit_ram[count] & 0x000f) >> 0; if(cliprect.contains(x + 0, y)) - bitmap.pix32(y, x + 0) = m_palette->pen(color); + bitmap.pix(y, x + 0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/bitgraph.cpp b/src/mame/drivers/bitgraph.cpp index 89207357183..52279795d3c 100644 --- a/src/mame/drivers/bitgraph.cpp +++ b/src/mame/drivers/bitgraph.cpp @@ -384,16 +384,13 @@ void bitgraph_state::adlc_w(offs_t offset, uint8_t data) uint32_t bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx = 0; - int x, y; - - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = 0; x < 1024 / 8; x += 2) + for (int x = 0; x < 1024 / 8; x += 2) { - gfx = m_videoram[(x + 1) | (y << 7)]; + uint8_t gfx = m_videoram[(x + 1) | (y << 7)]; for (int i = 7; i >= 0; i--) { *p++ = BIT(gfx, i); diff --git a/src/mame/drivers/blitz68k.cpp b/src/mame/drivers/blitz68k.cpp index 8b7a6c96874..2fdfb11ef41 100644 --- a/src/mame/drivers/blitz68k.cpp +++ b/src/mame/drivers/blitz68k.cpp @@ -12,6 +12,7 @@ Year Game Manufacturer ---------------------------------------------------------------------- 1990 Mega Double Poker Blitz Systems Inc. 1990 Mega Double Poker Jackpot Blitz Systems Inc. +1992 Mega Double Strip Blitz Systems Inc. 1993 Bank Robbery Entertainment Technology Corp. 1993? Poker 52 Blitz Systems Inc. 1993 Strip Teaser <unknown> @@ -94,6 +95,7 @@ public: void init_megadblj(); void init_hermit(); void init_dualgame(); + void init_megastrp(); void hermit(machine_config &config); void bankrob(machine_config &config); @@ -274,13 +276,13 @@ VIDEO_START_MEMBER(blitz68k_state,blitz68k_addr_factor1) uint32_t blitz68k_state::screen_update_blitz68k(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *src = m_blit_buffer.get(); + const uint8_t *src = m_blit_buffer.get(); for(int y = 0; y < 256; y++) { for(int x = 0; x < 512; x++) { - bitmap.pix32(y, x) = m_palette->pen(*src++); + bitmap.pix(y, x) = m_palette->pen(*src++); } } @@ -292,17 +294,17 @@ uint32_t blitz68k_state::screen_update_blitz68k(screen_device &screen, bitmap_rg uint32_t blitz68k_state::screen_update_blitz68k_noblit(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *src = m_frame_buffer; + const uint16_t *src = m_frame_buffer; for(int y = 0; y < 256; y++) { for(int x = 0; x < 512; ) { - uint16_t pen = *src++; - bitmap.pix32(y, x++) = m_palette->pen((pen >> 8) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 12) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 0) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 4) & 0xf); + const uint16_t pen = *src++; + bitmap.pix(y, x++) = m_palette->pen((pen >> 8) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 12) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 0) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 4) & 0xf); } } @@ -2211,6 +2213,32 @@ ROM_START( bankrobb ) // DK-B main PCB + 8L74 sub PCB ROM_LOAD( "palce16v8h.u71", 0x000, 0x117, NO_DUMP ) ROM_END +// Mega Strip on ROM labels +// Maxi Strip Poker and both copyright 91 and 1992 in ROMs +// Mega Double Strip on title screen, 1992 copyright on following screen +// English and French strings in ROMs +// Main PCB: DK-B Copyright 1991 Blitz System inc. +// Sub PCB: BLZ AB1 Copyright 1992, Blitz System Inc. + +ROM_START( megastrp ) + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code, on main board + ROM_LOAD16_BYTE( "1992_mega_strip_1.10b_b.u32", 0x00000, 0x20000, CRC(aaac8916) SHA1(74320bdf8b0f4de8a571fc6494252f01eff32cf9) ) // 1xxxxxxxxxxxxxxxx = 0xFF + ROM_LOAD16_BYTE( "1992_mega_strip_1.10b_a.u31", 0x00001, 0x20000, CRC(7661bd45) SHA1(b25b20b893ca428e0364f6b6d0ad435354958c31) ) // 1xxxxxxxxxxxxxxxx = 0xFF + + ROM_REGION( 0x2000, "mcu1", 0 ) // 68HC705C8P code, on main board + ROM_LOAD( "1992_mega_strip_control_1.0.u2", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION( 0x2000, "mcu2", 0 ) // 68HC705C8P code, on sub board + ROM_LOAD( "blz_10b-4.01.u2", 0x0000, 0x2000, NO_DUMP ) + + ROM_REGION16_BE( 0x100000, "blitter", 0 ) // on main board + ROM_LOAD( "1992_mega_strip_1.10b_c.u46", 0x00000, 0x80000, CRC(d3813101) SHA1(80c6311ddea1b161a03fcd69c1b8d4e8a2d99636) ) + ROM_LOAD( "1992_mega_strip_1.10b_d.u51", 0x80000, 0x80000, CRC(ee45ca2f) SHA1(9d1faeac17f60f1ea72d3fd3355544ea2d89a2bb) ) + + ROM_REGION( 0x80000, "samples", 0 ) // on main board + ROM_LOAD( "1992_mega_strip_1.10_sound.u18", 0x00000, 0x80000, CRC(8c345dc2) SHA1(2ad9dea4543d2c16f42a38653d740ff0c0fa1798) ) +ROM_END + /************************************************************************************************************* Triple Play @@ -3018,11 +3046,22 @@ void blitz68k_state::init_megadble() ROM[0x1d40/2] = 0x4e71; } +void blitz68k_state::init_megastrp() +{ + uint16_t *ROM = (uint16_t *)memregion("maincpu")->base(); + + // skip loops until the MCUs are dumped and the hardware better understood + ROM[0x1678/2] = 0x4e71; + + ROM[0x10c80/2] = 0x4e71; +} + GAME( 1992, maxidbl, 0, maxidbl, maxidbl, blitz68k_state, init_maxidbl, ROT0, "Blitz Systems Inc.", "Maxi Double Poker (Ver. 1.10)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND | MACHINE_WRONG_COLORS ) GAME( 1990, megadblj, 0, maxidbl, maxidbl, blitz68k_state, init_megadblj, ROT0, "Blitz Systems Inc.", "Mega Double Poker Jackpot (Ver. 1.26)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // JUNE 28TH, 1993 GAME( 1990, megadble, 0, maxidbl, maxidbl, blitz68k_state, init_megadble, ROT0, "Blitz Systems Inc.", "Mega Double Poker (Ver. 1.63 Espagnol)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND | MACHINE_WRONG_COLORS ) // NOVEMBER 1994 +GAME( 1992, megastrp, 0, bankroba, bankrob, blitz68k_state, init_megastrp, ROT0, "Blitz Systems Inc.", "Mega Double Strip (Ver. 1.10b)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // @ 1993 BLITZ SYSTEM INC GAME( 1993, steaser, 0, steaser, steaser, blitz68k_state, empty_init, ROT0, "<unknown>", "Strip Teaser (Italy, Ver. 1.22)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // In-game strings are in Italian but service mode is half English / half French? GAME( 1993, bankrob, 0, bankrob, bankrob, blitz68k_state, init_bankrob, ROT0, "Entertainment Technology Corp.", "Bank Robbery (Ver. 3.32)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // BLITZ SYSTEM INC APRIL 1995 GAME( 1993, bankroba, bankrob, bankroba, bankrob, blitz68k_state, init_bankroba, ROT0, "Entertainment Technology Corp.", "Bank Robbery (Ver. 2.00)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // BLITZ SYSTEM INC MAY 10TH, 1993 diff --git a/src/mame/drivers/blw700i.cpp b/src/mame/drivers/blw700i.cpp index c5c8a0fd9b7..3552b957a64 100644 --- a/src/mame/drivers/blw700i.cpp +++ b/src/mame/drivers/blw700i.cpp @@ -122,29 +122,24 @@ void lw700i_state::video_start() uint32_t lw700i_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0xffffff, 0 }; - uint8_t *pVRAM = (uint8_t *)m_mainram.target(); + uint8_t const *const pVRAM = (uint8_t *)m_mainram.target() + 0x3e200; - pVRAM += 0x3e200; - - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 480/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 480/8; x++) { - pixels = pVRAM[(y * (480/8)) + (BYTE_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = pVRAM[(y * (480/8)) + (BYTE_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/bmcbowl.cpp b/src/mame/drivers/bmcbowl.cpp index 847acd2b025..79970bf864b 100644 --- a/src/mame/drivers/bmcbowl.cpp +++ b/src/mame/drivers/bmcbowl.cpp @@ -167,41 +167,42 @@ uint32_t bmcbowl_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma missing scroll and priorities (maybe fixed ones) */ - int x,y,z,pixdat; bitmap.fill(rgb_t::black(), cliprect); - z=0; - for (y=0;y<230;y++) + int z=0; + for (int y=0; y<230; y++) { - for (x=0;x<280;x+=2) + for (int x=0; x<280; x+=2) { + int pixdat; + pixdat = m_vid2[0x8000+z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid2[z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid1[0x8000+z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid1[z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); z++; } diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp index 05700c64b71..094dde0f078 100644 --- a/src/mame/drivers/bmcpokr.cpp +++ b/src/mame/drivers/bmcpokr.cpp @@ -147,21 +147,21 @@ void bmcpokr_state::pixram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { COMBINE_DATA(&m_pixram[offset]); - int x = (offset & 0xff) << 2; - int y = (offset >> 8); + int const x = (offset & 0xff) << 2; + int const y = (offset >> 8); - uint16_t pixpal = (m_pixpal & 0xf) << 4; + uint16_t const pixpal = (m_pixpal & 0xf) << 4; uint16_t pen; if (ACCESSING_BITS_8_15) { - pen = (data >> 12) & 0xf; m_pixbitmap->pix16(y, x + 0) = pen ? pixpal + pen : 0; - pen = (data >> 8) & 0xf; m_pixbitmap->pix16(y, x + 1) = pen ? pixpal + pen : 0; + pen = (data >> 12) & 0xf; m_pixbitmap->pix(y, x + 0) = pen ? pixpal + pen : 0; + pen = (data >> 8) & 0xf; m_pixbitmap->pix(y, x + 1) = pen ? pixpal + pen : 0; } if (ACCESSING_BITS_0_7) { - pen = (data >> 4) & 0xf; m_pixbitmap->pix16(y, x + 2) = pen ? pixpal + pen : 0; - pen = (data >> 0) & 0xf; m_pixbitmap->pix16(y, x + 3) = pen ? pixpal + pen : 0; + pen = (data >> 4) & 0xf; m_pixbitmap->pix(y, x + 2) = pen ? pixpal + pen : 0; + pen = (data >> 0) & 0xf; m_pixbitmap->pix(y, x + 3) = pen ? pixpal + pen : 0; } } @@ -173,12 +173,12 @@ void bmcpokr_state::pixbitmap_redraw() { for (int x = 0; x < 1024; x += 4) { - uint16_t data = m_pixram[offset++]; + uint16_t const data = m_pixram[offset++]; uint16_t pen; - pen = (data >> 12) & 0xf; m_pixbitmap->pix16(y, x + 0) = pen ? pixpal + pen : 0; - pen = (data >> 8) & 0xf; m_pixbitmap->pix16(y, x + 1) = pen ? pixpal + pen : 0; - pen = (data >> 4) & 0xf; m_pixbitmap->pix16(y, x + 2) = pen ? pixpal + pen : 0; - pen = (data >> 0) & 0xf; m_pixbitmap->pix16(y, x + 3) = pen ? pixpal + pen : 0; + pen = (data >> 12) & 0xf; m_pixbitmap->pix(y, x + 0) = pen ? pixpal + pen : 0; + pen = (data >> 8) & 0xf; m_pixbitmap->pix(y, x + 1) = pen ? pixpal + pen : 0; + pen = (data >> 4) & 0xf; m_pixbitmap->pix(y, x + 2) = pen ? pixpal + pen : 0; + pen = (data >> 0) & 0xf; m_pixbitmap->pix(y, x + 3) = pen ? pixpal + pen : 0; } } } diff --git a/src/mame/drivers/bmjr.cpp b/src/mame/drivers/bmjr.cpp index 081e5feff2b..93f0fedcf4c 100644 --- a/src/mame/drivers/bmjr.cpp +++ b/src/mame/drivers/bmjr.cpp @@ -71,20 +71,20 @@ private: u32 bmjr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,fg=4; - u16 sy=0,ma=0x100,x; - u8 inv = (m_xor_display) ? 0xff : 0; + u8 fg=4; + u16 sy=0,ma=0x100; + u8 const inv = (m_xor_display) ? 0xff : 0; - for(y = 0; y < 24; y++ ) + for(u8 y = 0; y < 24; y++ ) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 32; x++) + for (u16 x = ma; x < ma + 32; x++) { - chr = m_p_wram[x]; - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + u8 const chr = m_p_wram[x]; + u8 const gfx = m_p_chargen[(chr<<3) | ra] ^ inv; /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? fg : 0; diff --git a/src/mame/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp index 12e600ee196..5636185c513 100644 --- a/src/mame/drivers/bml3.cpp +++ b/src/mame/drivers/bml3.cpp @@ -97,6 +97,7 @@ public: void bml3mk5(machine_config &config); void bml3(machine_config &config); void bml3_common(machine_config &config); + DECLARE_INPUT_CHANGED_MEMBER(nmi_button); private: void bml3_mem(address_map &map); @@ -159,6 +160,7 @@ private: std::unique_ptr<u8[]> m_aram; u8 m_firq_mask; u8 m_firq_status; + u8 m_nmi; required_device<cpu_device> m_maincpu; required_region_ptr<u8> m_p_chargen; required_device<bml3bus_device> m_bml3bus; @@ -336,7 +338,7 @@ void bml3_state::relay_w(u8 data) u8 bml3_state::keyb_nmi_r() { - return 0; // bit 7 used to signal a BREAK key pressure + return m_nmi; // bit 7 used to signal a BREAK key pressure } void bml3_state::firq_mask_w(u8 data) @@ -472,100 +474,108 @@ static INPUT_PORTS_START( bml3 ) PORT_START("key1") //0x00-0x1f PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("? PAD") PORT_CHAR('?') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("? PAD") + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift")PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X2") // ??? PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana Lock") PORT_CODE(KEYCODE_NUMLOCK) PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana Shift") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 PAD") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 PAD") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 PAD") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 PAD") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 PAD") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('^') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 PAD") PORT_CODE(KEYCODE_7_PAD) PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Delete PAD") //backspace PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xC2\xA5") PORT_CODE(KEYCODE_TAB) // yen sign PORT_START("key2") //0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 PAD") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 PAD") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) //or cls? - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 PAD") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 PAD") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 PAD") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- PAD") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 PAD") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 PAD") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 PAD") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- PAD") PORT_CODE(KEYCODE_MINUS_PAD) PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ PAD") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_TILDE) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 PAD") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 PAD") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 PAD") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ PAD") PORT_CODE(KEYCODE_SLASH_PAD) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 PAD") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 PAD") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 PAD") PORT_CODE(KEYCODE_3_PAD) PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_BIT(0xffe00000,IP_ACTIVE_HIGH,IPT_UNKNOWN) + + PORT_START("key4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_CHANGED_MEMBER(DEVICE_SELF, bml3_state, nmi_button, 0) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(bml3_state::nmi_button) +{ + m_nmi = newval ? 0x80 : 0; +} + MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // The MB-6890 has a 5-bit colour RAM region. The meaning of the bits are: // 0: blue // 1: red @@ -573,13 +583,9 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) // 3: reverse/inverse video // 4: graphic (not character) - u8 x=0,hf=0,xi=0,interlace=0,bgcolor=0,rawbits=0,dots[2]={0,0},color=0,pen=0; - bool reverse=0,graphic=0,lowres=0; - u16 mem=0; - - interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; - lowres = BIT(m_hres_reg, 6); - bgcolor = m_hres_reg & 7; + u8 const interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; + bool const lowres = BIT(m_hres_reg, 6); + u8 const bgcolor = m_hres_reg & 7; if (interlace) { @@ -587,19 +593,21 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) if (y > 0x191) return; } - for(x=0; x<x_count; x++) + for(u8 x=0; x<x_count; x++) { + u16 mem; if (lowres) mem = (ma + x - 0x400) & 0x3fff; else mem = (ma + x + ra * x_count/40 * 0x400 -0x400) & 0x3fff; - color = m_aram[mem] & 7; - reverse = BIT(m_aram[mem], 3) ^ (x == cursor_x); - graphic = BIT(m_aram[mem], 4); + u8 const color = m_aram[mem] & 7; + bool const reverse = BIT(m_aram[mem], 3) ^ (x == cursor_x); + bool const graphic = BIT(m_aram[mem], 4); - rawbits = m_vram[mem]; + u8 const rawbits = m_vram[mem]; + u8 dots[2] = { 0, 0 }; if (graphic) { if (lowres) @@ -619,8 +627,8 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) else { // character mode - int tile = rawbits & 0x7f; - int tile_bank = BIT(rawbits, 7); + int const tile = rawbits & 0x7f; + int const tile_bank = BIT(rawbits, 7); if (interlace) { dots[0] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)]; @@ -632,18 +640,19 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) } } - for(hf=0;hf<=interlace;hf++) + for(u8 hf=0;hf<=interlace;hf++) { - for(xi=0;xi<8;xi++) + for(u8 xi=0;xi<8;xi++) { + u8 pen; if(reverse) pen = (dots[hf] >> (7-xi) & 1) ? bgcolor : color; else pen = (dots[hf] >> (7-xi) & 1) ? color : bgcolor; - bitmap.pix32(y, x*8+xi) = palette[pen]; + bitmap.pix(y, x*8+xi) = palette[pen]; // when the mc6845 device gains full interlace&video support, replace the line above with the line below - // bitmap.pix32(y*(interlace+1)+hf, x*8+xi) = palette[pen]; + // bitmap.pix(y*(interlace+1)+hf, x*8+xi) = palette[pen]; } } } @@ -759,6 +768,7 @@ void bml3_state::machine_start() save_item(NAME(m_crtc_index)); save_item(NAME(m_firq_mask)); save_item(NAME(m_firq_status)); + save_item(NAME(m_nmi)); u8 *r = m_extram.get(); u8 *m = memregion("maincpu")->base(); @@ -799,6 +809,7 @@ void bml3_state::machine_reset() m_firq_status = 0; m_cassbit = 0; m_cassold = 0; + m_nmi = 0; } void bml3_state::piaA_w(uint8_t data) diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index 93337ce0e5b..d9928ac612c 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -302,13 +302,12 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); - int column, bit; + pen_t const *const pen = m_palette->pens(); - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { - uint8_t code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; - uint16_t addr = code << 4 | (ra & 0x0f); + uint8_t const code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; + uint16_t const addr = code << 4 | (ra & 0x0f); uint8_t data = m_char_rom->base()[addr & BW12_CHARROM_MASK]; if (column == cursor_x) @@ -316,12 +315,12 @@ MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) data = 0xff; } - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; + int const x = (column * 8) + bit; + int const color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/bw2.cpp b/src/mame/drivers/bw2.cpp index 9a1d03e82bd..7f1ff1234fd 100644 --- a/src/mame/drivers/bw2.cpp +++ b/src/mame/drivers/bw2.cpp @@ -450,7 +450,7 @@ uint8_t bw2_state::ppi_pc_r() */ - uint8_t data = 0; + uint8_t data = m_bank; // centronics busy data |= m_centronics_busy << 4; @@ -459,7 +459,7 @@ uint8_t bw2_state::ppi_pc_r() data |= m_mfdbk << 5; // write protect - if (m_floppy) data |= m_floppy->wpt_r() << 7; + if (m_floppy) data |= !m_floppy->wpt_r() << 7; return data; } diff --git a/src/mame/drivers/by17.cpp b/src/mame/drivers/by17.cpp index b8832806c8d..33074d0e79b 100644 --- a/src/mame/drivers/by17.cpp +++ b/src/mame/drivers/by17.cpp @@ -26,7 +26,6 @@ ToDo: #include "by17.lh" #include "by17_pwerplay.lh" #include "by17_matahari.lh" -#include "render.h" class by17_state : public genpin_class { @@ -980,10 +979,6 @@ void by17_state::machine_reset() { genpin_class::machine_reset(); - render_target *target = machine().render().first_target(); - - target->set_view(0); - m_u10a = 0; m_u10b = 0; m_u11a = 0; diff --git a/src/mame/drivers/by35.cpp b/src/mame/drivers/by35.cpp index e4f3aab38a6..70d15834ce1 100644 --- a/src/mame/drivers/by35.cpp +++ b/src/mame/drivers/by35.cpp @@ -73,7 +73,6 @@ ToDo: #include "machine/6821pia.h" #include "machine/timer.h" #include "audio/bally.h" -#include "render.h" #include "speaker.h" //#define VERBOSE 1 @@ -1441,10 +1440,6 @@ void by35_state::machine_reset() { genpin_class::machine_reset(); - render_target *target = machine().render().first_target(); - - target->set_view(0); - m_u10a = 0; m_u10b = 0; m_u11a = 0; diff --git a/src/mame/drivers/c10.cpp b/src/mame/drivers/c10.cpp index 628082f4987..fd7e5f5945b 100644 --- a/src/mame/drivers/c10.cpp +++ b/src/mame/drivers/c10.cpp @@ -98,24 +98,23 @@ void c10_state::machine_reset() uint32_t c10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { //static uint8_t framecnt=0; - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x,xx; + uint16_t sy=0,ma=0; //framecnt++; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - xx = ma; - for (x = ma; x < ma + 80; x++) + uint16_t xx = ma; + for (uint16_t x = ma; x < ma + 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_vram[xx++]; + uint8_t chr = m_vram[xx++]; // /* Take care of flashing characters */ // if ((chr < 0x80) && (framecnt & 0x08)) diff --git a/src/mame/drivers/c128.cpp b/src/mame/drivers/c128.cpp index 0774ac43835..47843515c0c 100644 --- a/src/mame/drivers/c128.cpp +++ b/src/mame/drivers/c128.cpp @@ -783,7 +783,7 @@ static INPUT_PORTS_START( c128 ) PORT_START( "ROW6" ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191,'^') PORT_CHAR(0x03C0) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) diff --git a/src/mame/drivers/c65.cpp b/src/mame/drivers/c65.cpp index c918bf97d04..b4bd8c4ec75 100644 --- a/src/mame/drivers/c65.cpp +++ b/src/mame/drivers/c65.cpp @@ -178,7 +178,7 @@ uint32_t c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, if (attr & 0x10) enable_dot = 0; //if(cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_palette->pen(highlight_color + ((enable_dot) ? foreground_color : background_color)); + bitmap.pix(y, x) = m_palette->pen(highlight_color + ((enable_dot) ? foreground_color : background_color)); //gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); diff --git a/src/mame/drivers/calcune.cpp b/src/mame/drivers/calcune.cpp index 64dc5f6453d..f58fbd9f63e 100644 --- a/src/mame/drivers/calcune.cpp +++ b/src/mame/drivers/calcune.cpp @@ -149,7 +149,7 @@ uint32_t calcune_state::screen_update_calcune(screen_device &screen, bitmap_rgb3 { const unsigned palette_per_scanline = 64 * y; - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int pix; diff --git a/src/mame/drivers/camplynx.cpp b/src/mame/drivers/camplynx.cpp index fe43ec05f5c..81d46cc91ff 100644 --- a/src/mame/drivers/camplynx.cpp +++ b/src/mame/drivers/camplynx.cpp @@ -748,9 +748,8 @@ void camplynx_state::machine_reset() MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) { - u8 r,g,b,x; - uint32_t green_bank, *p = &bitmap.pix32(y); - uint16_t mem = ((ma << 2) + (ra << 5)) & 0x1fff; + uint32_t green_bank, *p = &bitmap.pix(y); + uint16_t const mem = ((ma << 2) + (ra << 5)) & 0x1fff; // determine green bank if (BIT(m_port80, 4)) @@ -758,11 +757,11 @@ MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) else green_bank = 0x3c000 + mem; // normal green - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - r = m_p_ram[0x2c000 + mem + x]; - b = m_p_ram[0x28000 + mem + x]; - g = m_p_ram[green_bank + x]; + u8 const r = m_p_ram[0x2c000 + mem + x]; + u8 const b = m_p_ram[0x28000 + mem + x]; + u8 const g = m_p_ram[green_bank + x]; *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); @@ -777,20 +776,20 @@ MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) MC6845_UPDATE_ROW( camplynx_state::lynx128k_update_row ) { - u8 r,g,b,x; - uint32_t green_bank, *p = &bitmap.pix32(y); - uint16_t mem = ((ma << 2) + (ra << 6)) & 0x3fff; + uint32_t green_bank, *p = &bitmap.pix(y); + uint16_t const mem = ((ma << 2) + (ra << 6)) & 0x3fff; + // determine green bank if (BIT(m_port80, 4)) - green_bank = 0x2c000+mem; // alt green + green_bank = 0x2c000 + mem; // alt green else - green_bank = 0x28000+mem; // normal green + green_bank = 0x28000 + mem; // normal green - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - r = m_p_ram[0x20000+mem+x]; - b = m_p_ram[0x24000+mem+x]; - g = m_p_ram[green_bank+x]; + u8 const r = m_p_ram[0x20000 + mem + x]; + u8 const b = m_p_ram[0x24000 + mem + x]; + u8 const g = m_p_ram[green_bank + x]; *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); diff --git a/src/mame/drivers/candela.cpp b/src/mame/drivers/candela.cpp index ca381740f0a..ec9997a80a8 100644 --- a/src/mame/drivers/candela.cpp +++ b/src/mame/drivers/candela.cpp @@ -570,7 +570,7 @@ uint32_t can09_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (x = 0; x < 8; x++) { // if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + y, col + x) = x & 1; //(*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + y, col + x) = x & 1; //(*chardata & (1 << x)) ? 1 : 0; } // chardata++; } diff --git a/src/mame/drivers/canon_s80.cpp b/src/mame/drivers/canon_s80.cpp index 7e2aa68a4dc..7799077fb53 100644 --- a/src/mame/drivers/canon_s80.cpp +++ b/src/mame/drivers/canon_s80.cpp @@ -41,7 +41,7 @@ private: HD44780_PIXEL_UPDATE(canons80_state::pixel_update) { if (pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void canons80_state::canons80_map(address_map &map) diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp index 0db1f9319dd..6dac232e77b 100644 --- a/src/mame/drivers/cardline.cpp +++ b/src/mame/drivers/cardline.cpp @@ -136,9 +136,9 @@ MC6845_UPDATE_ROW( cardline_state::crtc_update_row ) int fg_col = gfx[fg_tile * 64 + ra * 8 + i]; if (fg_col == 1) - bitmap.pix32(y, x) = palette[bg_pal_ofs + bg_col]; + bitmap.pix(y, x) = palette[bg_pal_ofs + bg_col]; else - bitmap.pix32(y, x) = palette[fg_pal_ofs + fg_col]; + bitmap.pix(y, x) = palette[fg_pal_ofs + fg_col]; x++; } diff --git a/src/mame/drivers/casloopy.cpp b/src/mame/drivers/casloopy.cpp index 4ade93aa0eb..7beec8a8564 100644 --- a/src/mame/drivers/casloopy.cpp +++ b/src/mame/drivers/casloopy.cpp @@ -255,7 +255,6 @@ void casloopy_state::video_start() uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *gfx = m_gfxdecode->gfx(m_gfx_index); - int x,y; int count; static int test; @@ -279,9 +278,9 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm #endif count = test; - for (y=0;y<32;y++) + for (int y=0;y<32;y++) { - for (x=0;x<32;x++) + for (int x=0;x<32;x++) { uint16_t tile = (m_vram[count+1])|(m_vram[count]<<8); @@ -295,15 +294,13 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm count = test; - for (y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one? + for (int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one? { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t pix; - - pix = m_bitmap_vram[count]; + uint8_t pix = m_bitmap_vram[count]; if(pix) - bitmap.pix16(y, x) = pix + 0x100; + bitmap.pix(y, x) = pix + 0x100; count++; } diff --git a/src/mame/drivers/cat.cpp b/src/mame/drivers/cat.cpp index 353e2caa6ea..628fa66569f 100644 --- a/src/mame/drivers/cat.cpp +++ b/src/mame/drivers/cat.cpp @@ -960,10 +960,10 @@ uint32_t cat_state::screen_update_cat(screen_device &screen, bitmap_rgb32 &bitma int horpos = 0; for (int x = 0; x < 42; x++) { - uint16_t code = m_p_cat_videoram[addr++]; + const uint16_t code = m_p_cat_videoram[addr++]; for (int b = 15; b >= 0; b--) { - bitmap.pix32(y, horpos++) = BIT(code, b) ? on_color : off_color; + bitmap.pix(y, horpos++) = BIT(code, b) ? on_color : off_color; } } } diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp index fd30f06e933..07c3cd03156 100644 --- a/src/mame/drivers/cave.cpp +++ b/src/mame/drivers/cave.cpp @@ -222,7 +222,7 @@ void cave_state::videoregs_w(offs_t offset, u16 data, u16 mem_mask) COMBINE_DATA(&m_videoregs[Chip][offset]); offset <<= 1; // offset 0x04 and 0x06 is offset related? - // offset 0x0a is position mode toggle in bit 13-12 (seperated for X and Y?), other bits used but unknown + // offset 0x0a is position mode toggle in bit 13-12 (separated for X and Y?), other bits used but unknown // offset 0x68 or 0x78 is commonly watchdog or DMA command? // offset 0x6c or 0x7c is encryption key or CRTC or something else? // offset 0x6e is commonly communication when sound CPU exists @@ -236,7 +236,7 @@ void cave_state::videoregs_w(offs_t offset, u16 data, u16 mem_mask) offset != 0x68 && offset != 0x6e && offset != 0x78) - logerror("%s: Unknown videoregs #%02X writtten %04X = %04X & %04X\n", + logerror("%s: Unknown videoregs #%02X written %04X = %04X & %04X\n", machine().describe_context(), Chip, offset, data, mem_mask); } @@ -1186,6 +1186,31 @@ void cave_state::paceight_map(address_map &map) map(0xe00001, 0xe00001).w(FUNC(cave_state::tjumpman_eeprom_w)); // EEPROM } + +/*************************************************************************** + Pac-Carnival +***************************************************************************/ + +//TODO: leds need verifying + +void cave_state::paccarn_map(address_map &map) +{ + map(0x000000, 0x07ffff).rom(); // ROM + map(0x100000, 0x10ffff).ram().share("nvram"); // RAM (battery) + map(0x200000, 0x20ffff).ram().share("spriteram.0"); // Sprites + map(0x300000, 0x307fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 + map(0x400000, 0x40007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs + map(0x400000, 0x400007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause + map(0x400068, 0x400069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog + map(0x500000, 0x500001).portr("IN0"); // Inputs + EEPROM + Hopper + map(0x500002, 0x500003).portr("IN1"); // Inputs + map(0x600000, 0x600005).w(m_tilemap[0], FUNC(tilemap038_device::vregs_w)); // Layer 0 Control + map(0x700000, 0x70ffff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette + map(0x800001, 0x800001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 + map(0xc00000, 0xc00001).w(FUNC(cave_state::pacslot_leds_w)); // Leds + Hopper + map(0xe00001, 0xe00001).w(FUNC(cave_state::tjumpman_eeprom_w)); // EEPROM +} + /*************************************************************************** Uo Poko ***************************************************************************/ @@ -1692,6 +1717,28 @@ static INPUT_PORTS_START( paceight ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Max Bet" ) INPUT_PORTS_END +static INPUT_PORTS_START( paccarn ) // holding together Bet 4 and Bet 8 activates Bet 12 in IO Test Mode + PORT_START("IN0") + PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10) // credits (impulse needed to coin up reliably) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Bet 4" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Bet 2" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(cave_state, tjumpman_hopper_r) + + PORT_START("IN1") + PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_CONFNAME( 0x08, 0x08, "Self Test" ) + PORT_CONFSETTING( 0x08, DEF_STR( Off ) ) + PORT_CONFSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME( "Bet 8" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Bet 3" ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10) // medal (impulse needed to coin up reliably) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) +INPUT_PORTS_END + static INPUT_PORTS_START( ppsatan ) PORT_START("SYSTEM") // $200000 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -2406,6 +2453,12 @@ void cave_state::paceight(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &cave_state::paceight_map); } +void cave_state::paccarn(machine_config &config) +{ + pacslot(config); + m_maincpu->set_addrmap(AS_PROGRAM, &cave_state::paccarn_map); +} + /*************************************************************************** Poka Poka Satan ***************************************************************************/ @@ -4099,6 +4152,51 @@ ROM_END /*************************************************************************** + Pac-Carnival by Namco, 1996 + Namco N-44 EM VIDEO platform, PCB B0445 + + TMP 68HC000P-16 + + 013 9341E7005 + 038 9429WX704 + + OKI M6295 x 2 + + Battery + 93C46 EEPROM (at U24) + + 28MHz XTAL + + TODO: doesn't boot. Can be tricked via debugger: + when stuck at PC 0x16628, do PC = 0x1662a +***************************************************************************/ + +ROM_START( paccarn ) + ROM_REGION( 0x80000, "maincpu", 0 ) + ROM_LOAD16_WORD_SWAP( "pl1-mpr0b.u41", 0x00000, 0x80000, CRC(ef6b08ea) SHA1(61fe4db433a154233c4e1efd248ad51ba1d265d0) ) + + ROM_REGION( 0x100000, "sprites0", 0 ) + ROM_LOAD16_BYTE( "pl1-obj0.u52", 0x00000, 0x80000, CRC(1dd7c292) SHA1(e78d4be35c24616a1954910039e381869246a246) ) + ROM_LOAD16_BYTE( "pl1-obj1.u53", 0x00001, 0x80000, CRC(7b9935d0) SHA1(ef05230689124d0999ba9e472968e04d6e75c405) ) + + ROM_REGION( 0x80000, "layer0", 0 ) + ROM_LOAD16_BYTE( "pl1-cha0.u60", 0x00000, 0x40000, CRC(7977662e) SHA1(5aaa69ffaa62b20196a7b638232716b7c6391490) ) + ROM_LOAD16_BYTE( "pl1-cha1.u61", 0x00001, 0x40000, CRC(2150eafa) SHA1(e744a0861ee8a76c2bb24f681df38966df5dc9f0) ) + + ROM_REGION( 0x40000, "oki1", 0 ) + ROM_LOAD( "pl1-voi0.u27", 0x00000, 0x40000, CRC(e22b87e3) SHA1(83a6952fb0f695bb74cc5a3a1e24a916b6de9c8e) ) + + ROM_REGION( 0x40000, "oki2", ROMREGION_ERASE00 ) + // empty ROM socket + + ROM_REGION( 0x117 * 3, "plds", 0 ) // all protected + ROM_LOAD( "n44u1b.u1", 0x117*0, 0x117, NO_DUMP ) + ROM_LOAD( "n44u3b.u3", 0x117*1, 0x117, NO_DUMP ) + ROM_LOAD( "n44u51a.u51", 0x117*2, 0x117, NO_DUMP ) +ROM_END + +/*************************************************************************** + Poka Poka Satan - wack-a-mole game with one frontal upright screen and two table-top touch screens to bang on with plastic "hammers" @@ -5255,8 +5353,9 @@ GAME( 1996, agalletah, agallet, sailormn, cave, cave_state, init_agallet, GAME( 1996, hotdogst, 0, hotdogst, cave, cave_state, init_hotdogst, ROT90, "Marble (Ace International license)", "Hotdog Storm (Korea)", MACHINE_SUPPORTS_SAVE ) -GAME( 1996, pacslot, 0, pacslot, pacslot, cave_state, init_tjumpman, ROT0, "Namco", "Pac-Slot", MACHINE_SUPPORTS_SAVE ) -GAME( 1996, paceight, 0, paceight, paceight, cave_state, init_tjumpman, ROT0, "Namco", "Pac-Eight", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, pacslot, 0, pacslot, pacslot, cave_state, init_tjumpman, ROT0, "Namco", "Pac-Slot", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, paceight, 0, paceight, paceight, cave_state, init_tjumpman, ROT0, "Namco", "Pac-Eight", MACHINE_SUPPORTS_SAVE ) +GAME( 1996, paccarn, 0, paccarn, paccarn, cave_state, init_tjumpman, ROT0, "Namco", "Pac-Carnival", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // stuck at boot. See ROM_LOAD for infos on how to get it to start via debugger GAME( 1996, ppsatan, 0, ppsatan, ppsatan, cave_state, init_ppsatan, ROT0, "Kato Seisakujo Co., Ltd.", "Poka Poka Satan (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp index 5cec01c471f..ae2bbae0d14 100644 --- a/src/mame/drivers/cbm2.cpp +++ b/src/mame/drivers/cbm2.cpp @@ -11,10 +11,7 @@ */ #include "emu.h" -#include "emupal.h" -#include "screen.h" -#include "softlist.h" -#include "speaker.h" + #include "bus/cbm2/exp.h" #include "bus/cbm2/user.h" #include "bus/ieee488/ieee488.h" @@ -37,6 +34,11 @@ #include "video/mc6845.h" #include "video/mos6566.h" +#include "emupal.h" +#include "screen.h" +#include "softlist.h" +#include "speaker.h" + #define PLA1_TAG "u78" #define PLA2_TAG "u88" #define MOS6567_TAG "u23" @@ -1413,7 +1415,7 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); int x = 0; @@ -1429,7 +1431,7 @@ MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) if (cursor_x == column) color ^= 1; color &= de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; if (bit < 8 || !m_graphics) data <<= 1; } diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index 31cb481ddc3..c0f60554e7e 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -226,7 +226,7 @@ HD44780_PIXEL_UPDATE(cc40_state::cc40_pixel_update) { // internal: 2*16, external: 1*31 if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp index f5469448101..01760a14fbd 100644 --- a/src/mame/drivers/cd2650.cpp +++ b/src/mame/drivers/cd2650.cpp @@ -189,26 +189,25 @@ u32 cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con Further, the letters have bit 6 set low, thus the range is 01 to 1A. When the bottom of the screen is reached, it does not scroll, it just wraps around. */ - u8 y,ra,chr,gfx; - u16 offset=0,sy=0,x,mem; + u16 offset=0,sy=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < CHARACTER_LINES; ra++) + for (u8 ra = 0; ra < CHARACTER_LINES; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (u16 x = 0; x < 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < CHARACTER_HEIGHT) { - mem = offset + y + (x<<4); + u16 mem = offset + y + (x<<4); if (mem > 0x4ff) mem -= 0x500; - chr = m_p_videoram[mem] & 0x3f; + u8 chr = m_p_videoram[mem] & 0x3f; gfx = m_p_chargen[(bitswap<8>(chr,7,6,2,1,0,3,4,5)<<3) | ra]; } diff --git a/src/mame/drivers/cdc721.cpp b/src/mame/drivers/cdc721.cpp index 028d9cae951..1643cf91350 100644 --- a/src/mame/drivers/cdc721.cpp +++ b/src/mame/drivers/cdc721.cpp @@ -259,24 +259,23 @@ void cdc721_state::cdc721_palette(palette_device &palette) const uint32_t cdc721_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,attr,pen; - uint16_t sy=0,x; + uint16_t sy=0; m_flashcnt++; - for (y = 0; y < 30; y++) + for (uint8_t y = 0; y < 30; y++) { uint16_t ma = m_videoram[y * 2] | m_videoram[y * 2 + 1] << 8; - for (ra = 0; ra < 15; ra++) + for (uint8_t ra = 0; ra < 15; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 160; x+=2) + for (uint16_t x = 0; x < 160; x+=2) { - pen = 1; - chr = m_videoram[(x + ma) & 0x1fff]; - attr = m_videoram[(x + ma + 1) & 0x1fff]; - gfx = m_rom_chargen[chr | (ra << 8) ]; + uint8_t pen = 1; + uint8_t chr = m_videoram[(x + ma) & 0x1fff]; + uint8_t attr = m_videoram[(x + ma + 1) & 0x1fff]; + uint8_t gfx = m_rom_chargen[chr | (ra << 8) ]; if (BIT(attr, 0)) // blank pen = 0; if (BIT(attr, 1) && (ra == 14)) // underline diff --git a/src/mame/drivers/cdi.cpp b/src/mame/drivers/cdi.cpp index 94e939df12b..f5579cf659a 100644 --- a/src/mame/drivers/cdi.cpp +++ b/src/mame/drivers/cdi.cpp @@ -402,7 +402,7 @@ void cdi_state::draw_lcd(int y) if (y >= 22 || !m_slave_hle.found()) return; - uint32_t *scanline = &m_lcdbitmap.pix32(y); + uint32_t *scanline = &m_lcdbitmap.pix(y); for (int lcd = 0; lcd < 8; lcd++) { diff --git a/src/mame/drivers/ceres.cpp b/src/mame/drivers/ceres.cpp new file mode 100644 index 00000000000..ace6ea7b186 --- /dev/null +++ b/src/mame/drivers/ceres.cpp @@ -0,0 +1,283 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * Eidgenössische Technische Hochschule (ETH) Zürich Ceres-1 + * + * Sources: + * - http://bitsavers.org/pdf/eth/ceres/Eberle_Hardware_Description_of_the_Workstation_Ceres_198701.pdf + * + * TODO: + * - startup/reset memory map + * - i/o device mapping + * - interrupt acknowledge + * - WD1002-05 Winchester/Floppy Disk Controller (WFC) + * - keyboard + * - mouse + */ + +#include "emu.h" + +// cpus and memory +#include "cpu/ns32000/ns32000.h" +#include "machine/ram.h" + +// various hardware +//#include "machine/ns32081.h" +//#include "machine/ns32082.h" +#include "machine/mc68681.h" +#include "machine/z80scc.h" +#include "machine/m3002.h" +#include "machine/am9519.h" +#include "machine/wd_fdc.h" + +// busses and connectors +#include "bus/rs232/rs232.h" +#include "imagedev/floppy.h" + +// video +#include "screen.h" + +#define VERBOSE 0 +#include "logmacro.h" + +class ceres1_state : public driver_device +{ +public: + ceres1_state(machine_config const &mconfig, device_type type, char const *tag) + : driver_device(mconfig, type, tag) + , m_cpu(*this, "cpu") + , m_ram(*this, "ram") + , m_uart(*this, "uart") + , m_serial(*this, "v24") + , m_scc(*this, "scc") + , m_rtc(*this, "rtc") + , m_icu(*this, "icu") + , m_fdc(*this, "fdc") + , m_fdd(*this, "fdc:0:35dd") + , m_screen(*this, "screen") + , m_vram(*this, "vram") + { + } + +protected: + // driver_device overrides + virtual void machine_start() override; + virtual void machine_reset() override; + + // address maps + template <unsigned ST> void cpu_map(address_map &map); + +public: + // machine config + void ceres1(machine_config &config); + + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rectangle const &cliprect); + + void wfc_w(offs_t offset, u8 data); + u8 wfc_r(offs_t offset); + +protected: + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device<ns32032_device> m_cpu; + required_device<ram_device> m_ram; + + required_device<scn2681_device> m_uart; + required_device<rs232_port_device> m_serial; + required_device<z80scc_device> m_scc; + required_device<m3002_device> m_rtc; + required_device<am9519_device> m_icu; + + required_device<wd2797_device> m_fdc; + required_device<floppy_image_device> m_fdd; + + required_device<screen_device> m_screen; + required_shared_ptr<u32> m_vram; + + u8 m_dcr; +}; + +void ceres1_state::machine_start() +{ + save_item(NAME(m_dcr)); +} + +void ceres1_state::machine_reset() +{ + m_dcr = 0; +} + +void ceres1_state::wfc_w(offs_t offset, u8 data) +{ + switch (offset) + { + case 0: LOG("wfc_w data 0x%02x\n", offset, data); break; + case 1: LOG("wfc_w write precomp 0x%02x\n", offset, data); break; + case 2: LOG("wfc_w sector count 0x%02x\n", offset, data); break; + case 3: LOG("wfc_w sector number 0x%02x\n", offset, data); break; + case 4: LOG("wfc_w cylinder low 0x%02x\n", offset, data); break; + case 5: LOG("wfc_w cylinder high 0x%02x\n", offset, data); break; + case 6: LOG("wfc_w size/drive/head 0x%02x\n", offset, data); break; + case 7: LOG("wfc_w command 0x%02x\n", offset, data); break; + } +} + +u8 ceres1_state::wfc_r(offs_t offset) +{ + u8 data = 0; + + switch (offset) + { + case 0: // data + case 1: // error + case 2: // sector count + case 3: // sector number + case 4: // cylinder low + case 5: // cylinder high + case 6: // size/drive/head + break; + + case 7: // status + //data = 0x40; // drive ready + break; + } + + LOG("wfc_r reg %d data 0x%02x\n", offset, data); + + return data; +} + +template <unsigned ST> void ceres1_state::cpu_map(address_map &map) +{ + // FIXME: address lines 19-23 driven high until boot flipflop reset + map(0x000000, 0x007fff).rom().region("eprom", 0); + + map(0xe00000, 0xe3ffff).ram().share("vram"); + map(0xf80000, 0xf87fff).rom().region("eprom", 0); + map(0xfffa00, 0xfffa00).lw8( + [this](u8 data) + { + m_dcr = data & 7; + }, "dcr_w"); + map(0xfffdc0, 0xfffdc3).portr("SW1"); + map(0xfffdc0, 0xfffdc0).lw8( + [this](u8 data) + { + m_cpu->space(0).install_ram(0, m_ram->mask(), m_ram->pointer()); + }, "bt_ff_w"); + + map(0xfffc00, 0xfffc1f).rw(FUNC(ceres1_state::wfc_r), FUNC(ceres1_state::wfc_w)).umask32(0xff); +} + +static INPUT_PORTS_START(ceres1) + PORT_START("SW1") + PORT_DIPNAME(0x80, 0x00, "Diagnostic") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING(0x00, DEF_STR(On)) + PORT_DIPSETTING(0x80, DEF_STR(Off)) + + PORT_DIPNAME(0x40, 0x40, "FPU") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING(0x00, DEF_STR(On)) + PORT_DIPSETTING(0x40, DEF_STR(Off)) + + PORT_DIPNAME(0x20, 0x00, "MMU") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING(0x00, DEF_STR(On)) + PORT_DIPSETTING(0x20, DEF_STR(Off)) + + PORT_DIPUNUSED_DIPLOC(0x10, 0x00, "SW1:4") + + // TODO: configuration is guesswork + PORT_DIPNAME(0x0f, 0x08, "Memory Size") PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING(0x01, "2M") + PORT_DIPSETTING(0x03, "4M") + PORT_DIPSETTING(0x07, "6M") + PORT_DIPSETTING(0x0f, "8M") +INPUT_PORTS_END + +void ceres1_state::ceres1(machine_config &config) +{ + NS32032(config, m_cpu, 10_MHz_XTAL); + m_cpu->set_addrmap(0, &ceres1_state::cpu_map<0>); + m_cpu->set_addrmap(6, &ceres1_state::cpu_map<6>); + + RAM(config, m_ram); + m_ram->set_default_size("2MiB"); + m_ram->set_default_value(0); + m_ram->set_extra_options("4MiB,6MiB,8MiB"); + + // TODO: port A txd/rxd connect to keyboard + SCN2681(config, m_uart, 3.6864_MHz_XTAL); + m_uart->irq_cb().set(m_icu, FUNC(am9519_device::ireq2_w)); + m_uart->outport_cb().set( + [this](u8 data) + { + m_serial->write_dtr(BIT(data, 0)); + m_serial->write_rts(BIT(data, 1)); + m_icu->ireq0_w(BIT(data, 3)); + m_icu->ireq4_w(BIT(data, 4)); + }); + m_uart->b_tx_cb().set(m_serial, FUNC(rs232_port_device::write_txd)); + + RS232_PORT(config, m_serial, default_rs232_devices, nullptr); + m_serial->rxd_handler().set(m_uart, FUNC(scn2681_device::rx_b_w)); + m_serial->cts_handler().set(m_uart, FUNC(scn2681_device::ip1_w)); + m_serial->dcd_handler().set(m_uart, FUNC(scn2681_device::ip0_w)); + m_serial->dsr_handler().set(m_uart, FUNC(scn2681_device::ip2_w)); + + // TODO: RS-485 ports "na" and "nb" + SCC8530N(config, m_scc, 6_MHz_XTAL); + m_scc->configure_channels(m_uart->clock(), 0, m_uart->clock(), 0); + m_scc->out_int_callback().set(m_icu, FUNC(am9519_device::ireq1_w)); + + M3002(config, m_rtc, 32.768_kHz_XTAL); + m_rtc->irq_out().set(m_icu, FUNC(am9519_device::ireq5_w)); + + AM9519(config, m_icu); + m_icu->out_int_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + + // TODO: WD1002-05 Winchester/Floppy Disk Controller (WFC) + WD2797(config, m_fdc, 0); + FLOPPY_CONNECTOR(config, "fdc:0", "35dd", FLOPPY_35_DD, true, floppy_formats).enable_sound(false); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(70'000'000, 1344, 0, 1024, 838, 0, 800); + m_screen->set_screen_update(FUNC(ceres1_state::screen_update)); +} + +u32 ceres1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rectangle const &cliprect) +{ + if (!BIT(m_dcr, 0)) + { + offs_t offset = BIT(m_dcr, 1) ? 0x20000 : 0; + u32 const invert = BIT(m_dcr, 2) ? 0xffffffffU : 0; + + for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++) + { + for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 32) + { + u32 const data = m_vram[offset++] ^ invert; + + for (unsigned i = 0; i < 32; i++) + bitmap.pix(y, x + i) = BIT(data, 31 - i) ? rgb_t::white() : rgb_t::black(); + } + } + } + + return 0; +} + +FLOPPY_FORMATS_MEMBER(ceres1_state::floppy_formats) + {} +FLOPPY_FORMATS_END + +ROM_START(ceres1) + ROM_REGION32_LE(0x8000, "eprom", 0) + ROM_SYSTEM_BIOS(0, "ceres1", "30.6.89") + ROMX_LOAD("by0_u44__30_6_89.u44", 0x0000, 0x2000, CRC(8e1559fe) SHA1(2e11c144fd698b9576816f5cfb003c46ab9ce43b), ROM_BIOS(0) | ROM_SKIP(3)) + ROMX_LOAD("by1_u43__30_6_89.u43", 0x0001, 0x2000, CRC(18625b0c) SHA1(3319043507b7eeb488ecd839708032f968e6e53e), ROM_BIOS(0) | ROM_SKIP(3)) + ROMX_LOAD("by2_u42__30_6_89.u42", 0x0002, 0x2000, CRC(a56497c5) SHA1(85858bea9fd27031ee0191b1d508c7469a384f10), ROM_BIOS(0) | ROM_SKIP(3)) + ROMX_LOAD("by3_u41__30_6_89.u41", 0x0003, 0x2000, CRC(6b628912) SHA1(f76ea089e8bf82f572f27def344b5174e577ebbb), ROM_BIOS(0) | ROM_SKIP(3)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP(1986, ceres1, 0, 0, ceres1, ceres1, ceres1_state, empty_init, "Eidgenössische Technische Hochschule Zürich", "Ceres-1", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/cesclass.cpp b/src/mame/drivers/cesclass.cpp index 73d88eaeccd..1ebb1c639f9 100644 --- a/src/mame/drivers/cesclass.cpp +++ b/src/mame/drivers/cesclass.cpp @@ -71,25 +71,21 @@ void cesclassic_state::video_start() uint32_t cesclassic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,xi; - bitmap.fill(m_palette->black_pen(), cliprect); + for(int y=0;y<64;y++) { - for(y=0;y<64;y++) + for(int x=0;x<16;x++) { - for(x=0;x<16;x++) + for(int xi=0;xi<16;xi++) { - for(xi=0;xi<16;xi++) - { - uint8_t color; + uint8_t color; - color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1); - color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1; + color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1); + color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1; - if((x*16+xi)<256 && ((y)+0)<256) - bitmap.pix32(y, x*16+xi) = m_palette->pen(color); - } + if((x*16+xi)<256 && ((y)+0)<256) + bitmap.pix(y, x*16+xi) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/cfx9850.cpp b/src/mame/drivers/cfx9850.cpp index ffed4490e53..cfd718e9aa1 100644 --- a/src/mame/drivers/cfx9850.cpp +++ b/src/mame/drivers/cfx9850.cpp @@ -270,7 +270,7 @@ u32 cfx9850_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co for (int b = 0; b < 8; b++) { - bitmap.pix16(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); + bitmap.pix(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); data1 <<= 1; data2 <<= 1; } diff --git a/src/mame/drivers/cgang.cpp b/src/mame/drivers/cgang.cpp index 094cef0f10c..851f021bf4e 100644 --- a/src/mame/drivers/cgang.cpp +++ b/src/mame/drivers/cgang.cpp @@ -9,14 +9,12 @@ It is an electromechanical arcade lightgun game. There is no screen, feedback is with motorized elements, lamps and 7segs, and of course sounds and music. To shoot the targets in MAME, either enable -mouse and click on one of the -cosmogang lanes(left mouse button doubles as gun trigger by default). +pink aliens(left mouse button doubles as gun trigger by default). Or, configure the gun aim inputs and share them with the trigger. For example use Z,X,C,V,B for the gun aims, and "Z or X or C or V or B" for the trigger. TODO: - dump/add Japanese version -- game can't be played properly within MAME's constraints (mechanical stuff, - and the lightguns linked to it) - shot target is sometimes ignored, maybe a BTANB? since it's easy to dismiss on the real thing as a missed aim. It turns on the lightgun lamp but then doesn't read the lightsensor. @@ -346,14 +344,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(cgang_state::door_motor_tick) void cgang_state::refresh_motor_output() { - // output motor positions in range 0-100 + // output motor positions in range 0-255 for (int i = 0; i < 5; i++) { - m_cg_count[i] = int((m_cg_motor_pos[i] / float(CG_MOTOR_LIMIT)) * 100.0 + 0.5); - m_en_count[i] = int((m_en_pos[i] / float(CG_MOTOR_LIMIT)) * 100.0 + 0.5); + m_cg_count[i] = int((m_cg_motor_pos[i] / float(CG_MOTOR_LIMIT)) * 255.0 + 0.5); + m_en_count[i] = int((m_en_pos[i] / float(CG_MOTOR_LIMIT)) * 255.0 + 0.5); } - m_door_count = (m_conf->read() & 1) ? int((m_door_motor_pos / float(DOOR_MOTOR_LIMIT)) * 100.0 + 0.5) : 0; + m_door_count = (m_conf->read() & 1) ? int((m_door_motor_pos / float(DOOR_MOTOR_LIMIT)) * 255.0 + 0.5) : 0; } diff --git a/src/mame/drivers/cgenie.cpp b/src/mame/drivers/cgenie.cpp index ca1fe971ec6..b9c8edae374 100644 --- a/src/mame/drivers/cgenie.cpp +++ b/src/mame/drivers/cgenie.cpp @@ -344,10 +344,10 @@ MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) { const rgb_t map[] = { m_background_color, m_palette[8], m_palette[6], m_palette[5] }; - bitmap.pix32(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; } else { @@ -367,7 +367,7 @@ MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) // 8 pixel chars for (int p = 0; p < 8; p++) - bitmap.pix32(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; + bitmap.pix(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; } } } diff --git a/src/mame/drivers/champbas.cpp b/src/mame/drivers/champbas.cpp index 472b2a4fc7f..d802707a1b4 100644 --- a/src/mame/drivers/champbas.cpp +++ b/src/mame/drivers/champbas.cpp @@ -281,6 +281,13 @@ void exctsccr_state::exctsccr_sound_io_map(address_map &map) map(0x8e, 0x8f).w("ay4", FUNC(ay8910_device::data_address_w)); } +void exctsccr_state::exctscc2_sound_io_map(address_map &map) +{ + map.global_mask(0x00ff); + map(0x8a, 0x8b).w("ay1", FUNC(ay8910_device::data_address_w)); + map(0x8e, 0x8f).w("ay2", FUNC(ay8910_device::data_address_w)); +} + /************************************* @@ -715,6 +722,19 @@ void exctsccr_state::exctsccr(machine_config &config) vref.add_route(0, "dac2", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "dac2", -1.0, DAC_VREF_NEG_INPUT); } +void exctsccr_state::exctscc2(machine_config &config) +{ + exctsccr(config); + + m_audiocpu->set_addrmap(AS_IO, &exctsccr_state::exctscc2_sound_io_map); + + subdevice<ay8910_device>("ay1")->set_clock(XTAL(14'318'181)/8); // measured on PCB + + // Exciting Soccer II only has two AYs + config.device_remove("ay3"); + config.device_remove("ay4"); +} + /* Bootleg running on a modified Champion Baseball board */ void exctsccr_state::exctsccrb(machine_config &config) { @@ -1184,9 +1204,9 @@ ROM_END ROM_START( exctscc2 ) // 2-PCB stack: CPU & SOUND BOARD + DISPLAY BOARD N. 58AS51-1 ROM_REGION( 0x10000, "maincpu", 0 ) // on CPU & sound board - ROM_LOAD( "eprom_1_vr_alpha_denshi.3j", 0x0000, 0x2000, CRC(c6115362) SHA1(6a258631abd72ef6b8d7968bb4b2bc88e89e597d) ) + ROM_LOAD( "eprom_1_vr_b_alpha_denshi.3j", 0x0000, 0x2000, CRC(c6115362) SHA1(6a258631abd72ef6b8d7968bb4b2bc88e89e597d) ) // B handwritten ROM_LOAD( "eprom_2_vr_alpha_denshi.3k", 0x2000, 0x2000, CRC(de36ba00) SHA1(0a0d92e710b8c749f145571bc8a204609456d19d) ) - ROM_LOAD( "eprom_3_vr_alpha_denshi.3l", 0x4000, 0x2000, CRC(1ddfdf65) SHA1(313d0a7f13fc2de15aa32492c38a59fbafad9f01) ) + ROM_LOAD( "eprom_3_vr_v_alpha_denshi.3l", 0x4000, 0x2000, CRC(1ddfdf65) SHA1(313d0a7f13fc2de15aa32492c38a59fbafad9f01) ) // V handwritten ROM_REGION( 0x10000, "audiocpu", 0 ) // on CPU & sound board ROM_LOAD( "eprom_0_vr_alpha_denshi.7d", 0x0000, 0x2000, CRC(2c675a43) SHA1(aa0a8dbcae955e3da92c435202f2a1ed238c377e) ) // yes 0, not 10 @@ -1198,21 +1218,21 @@ ROM_START( exctscc2 ) // 2-PCB stack: CPU & SOUND BOARD + DISPLAY BOARD N. 58AS5 ROM_REGION( 0x2000, "alpha_8201:mcu", 0 ) // on CPU & sound board ROM_LOAD( "alpha-8303_44801b42.1d", 0x0000, 0x2000, CRC(66adcb37) SHA1(e1c72ecb161129dcbddc0b16dd90e716d0c79311) ) - ROM_REGION( 0x04000, "gfx1", 0 ) // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars, on display board + ROM_REGION( 0x04000, "gfx1", 0 ) // 3bpp chars + sprites: rearranged by init_exctsccr() to leave only chars, on display board ROM_LOAD( "eprom_4_vr_alpha_denshi.5a", 0x0000, 0x2000, CRC(4ff1783d) SHA1(c45074864c3a4bcbf3a87d164027ae16dca53d9c) ) // planes 0,1 ROM_LOAD( "eprom_6_vr_alpha_denshi.5c", 0x2000, 0x2000, CRC(1fb84ee6) SHA1(56ceb86c509be783f806403ac21e7c9684760d5f) ) // plane 3 - ROM_REGION( 0x04000, "gfx2", 0 ) // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites, on display board + ROM_REGION( 0x04000, "gfx2", 0 ) // 3bpp chars + sprites: rearranged by init_exctsccr() to leave only sprites, on display board ROM_LOAD( "eprom_5_vr_alpha_denshi.5b", 0x0000, 0x2000, CRC(5605b60b) SHA1(19d5909896ae4a3d7552225c369d30475c56793b) ) // planes 0,1 ROM_REGION( 0x02000, "gfx3", 0 ) // 4bpp sprites, on display board ROM_LOAD( "eprom_7_vr_alpha_denshi.5k", 0x0000, 0x1000, CRC(1d37edfa) SHA1(184fa6dd7b1b3fff4c5fc19b42301ccb7979ac84) ) ROM_LOAD( "eprom_8_vr_alpha_denshi.5l", 0x1000, 0x1000, CRC(b97f396c) SHA1(4ffe512acf047230bd593911a615fc0ef66b481d) ) - ROM_REGION( 0x0220, "proms", 0 ) // it's suspected these weren't dumped for this set, but taken from an Exciting Soccer (see MT5026) - ROM_LOAD( "prom1.5j", 0x0000, 0x0020, BAD_DUMP CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) // palette, marked as 7051 on CPU & sound board - ROM_LOAD( "prom3.60h", 0x0020, 0x0100, BAD_DUMP CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) // lookup table, marked as 7052 on display board - ROM_LOAD( "prom2.61d", 0x0120, 0x0100, BAD_DUMP CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) // lookup table, marked as 7052 on display board + ROM_REGION( 0x0220, "proms", 0 ) // colors match video from PCB (even the field one) + ROM_LOAD( "tbp18s030.5j", 0x0000, 0x0020, CRC(899d153d) SHA1(669f1a2de387ae7cdce16c2714a384c9586ed255) ) // palette, marked as 7051 on CPU & sound board + ROM_LOAD( "tbp24s10.61d", 0x0020, 0x0100, CRC(75613784) SHA1(38dc1c1d2d0f33d58f035942e71665c9810fdab1) ) // lookup table, marked as 7052 on display board + ROM_LOAD( "tbp24s10.60h", 0x0120, 0x0100, CRC(1a52d6eb) SHA1(cd0c8cbaf5d8df14df34103cde2ec595039a6d51) ) // lookup table, marked as 7052 on display board ROM_END @@ -1291,4 +1311,4 @@ GAME( 1983, exctsccra, exctsccr, exctsccr, exctsccr, exctsccr_state, init_exc GAME( 1983, exctsccrj, exctsccr, exctsccr, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1983, exctsccrjo, exctsccr, exctsccr, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer (Japan, older)", MACHINE_SUPPORTS_SAVE ) GAME( 1983, exctsccrb, exctsccr, exctsccrb, exctsccr, exctsccr_state, init_exctsccr, ROT270, "bootleg (Kazutomi)", "Exciting Soccer (bootleg)", MACHINE_SUPPORTS_SAVE ) // on champbasj hardware -GAME( 1984, exctscc2, 0, exctsccr, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer II", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, exctscc2, 0, exctscc2, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer II", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 764e59c8606..678403f7abc 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -1953,8 +1953,10 @@ void chihiro_state::chihirogd(machine_config &config) ROM_SYSTEM_BIOS( 0, "bios0", "Chihiro Bios" ) \ ROM_LOAD_BIOS( 0, "chihiro_xbox_bios.bin", 0x000000, 0x80000, CRC(66232714) SHA1(b700b0041af8f84835e45d1d1250247bf7077188) ) \ ROM_REGION( 0x200000, "mediaboard", 0) \ + ROM_LOAD16_WORD_SWAP_BIOS( 0, "fpr-23887_29lv160te.ic4", 0x000000, 0x200000, CRC(13034372) SHA1(77197fba2781ed1d81402c48bd743adb26d3161a) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "fpr21042_m29w160et.bin", 0x000000, 0x200000, CRC(a4fcab0b) SHA1(a13cf9c5cdfe8605d82150b7573652f419b30197) ) \ ROM_REGION( 0x204080, "others", 0) \ + ROM_LOAD16_WORD_SWAP_BIOS( 0, "315-6351a_epc1pc8.ic2", 0x0000, 0x1ff01, CRC(488624ea) SHA1(1a607337a186415ae90b48934ce2aae81639d4de) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "ic10_g24lc64.bin", 0x0000, 0x2000, CRC(cfc5e06f) SHA1(3ababd4334d8d57abb22dd98bd2d347df39648d9) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "ic11_24lc024.bin", 0x2000, 0x80, CRC(8dc8374e) SHA1(cc03a0650bfac4bf6cb66e414bbef121cba53efe) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "pc20_g24lc64.bin", 0x2080, 0x2000, CRC(7742ab62) SHA1(82dad6e2a75bab4a4840dc6939462f1fb9b95101) ) diff --git a/src/mame/drivers/cinemat.cpp b/src/mame/drivers/cinemat.cpp index cdf9babd997..863ef360e7f 100644 --- a/src/mame/drivers/cinemat.cpp +++ b/src/mame/drivers/cinemat.cpp @@ -31,6 +31,7 @@ #include "emu.h" #include "includes/cinemat.h" +#include "speaker.h" #include "armora.lh" #include "barrier.lh" @@ -1069,14 +1070,23 @@ void cinemat_state::cinemat_jmi_32k(machine_config &config) void cinemat_state::spacewar(machine_config &config) { cinemat_nojmi_4k(config); - SPACE_WARS_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + SPACE_WARS_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); + m_screen->set_screen_update(FUNC(cinemat_state::screen_update_spacewar)); } void cinemat_state::barrier(machine_config &config) { cinemat_jmi_4k(config); - BARRIER_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + BARRIER_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } WRITE_LINE_MEMBER(cinemat_state::speedfrk_start_led_w) @@ -1088,78 +1098,127 @@ WRITE_LINE_MEMBER(cinemat_state::speedfrk_start_led_w) void cinemat_state::speedfrk(machine_config &config) { cinemat_nojmi_8k(config); - SPEED_FREAK_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + SPEED_FREAK_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); // m_outlatch->q_out_cb<1>().set(FUNC(cinemat_state::speedfrk_start_led_w)); } void cinemat_state::starhawk(machine_config &config) { cinemat_jmi_4k(config); - STAR_HAWK_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + STAR_HAWK_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_16level_state::sundance(machine_config &config) { cinemat_jmi_8k(config); - SUNDANCE_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + SUNDANCE_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_state::tailg(machine_config &config) { cinemat_nojmi_8k(config); - TAIL_GUNNER_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + TAIL_GUNNER_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); m_outlatch->q_out_cb<7>().set(FUNC(cinemat_state::mux_select_w)); } void cinemat_state::warrior(machine_config &config) { cinemat_jmi_8k(config); - WARRIOR_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + WARRIOR_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_state::armora(machine_config &config) { cinemat_jmi_16k(config); - ARMOR_ATTACK_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + ARMOR_ATTACK_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_state::ripoff(machine_config &config) { cinemat_jmi_8k(config); - RIPOFF_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + RIPOFF_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_state::starcas(machine_config &config) { cinemat_jmi_8k(config); - STAR_CASTLE_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + STAR_CASTLE_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_64level_state::solarq(machine_config &config) { cinemat_jmi_16k(config); - SOLAR_QUEST_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + SOLAR_QUEST_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_color_state::boxingb(machine_config &config) { cinemat_jmi_32k(config); - BOXING_BUGS_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); - m_screen->set_visarea(0, 1024, 0, 788); + + SPEAKER(config, "mono").front_center(); + BOXING_BUGS_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); m_outlatch->q_out_cb<7>().append(FUNC(cinemat_state::mux_select_w)); + + m_screen->set_visarea(0, 1024, 0, 788); } void cinemat_state::wotw(machine_config &config) { cinemat_jmi_16k(config); m_screen->set_visarea(0, 1120, 0, 767); - WAR_OF_THE_WORLDS_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + WAR_OF_THE_WORLDS_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void cinemat_color_state::wotwc(machine_config &config) { cinemat_jmi_16k(config); - WAR_OF_THE_WORLDS_AUDIO(config, "soundboard", 0).configure_latch_inputs(*m_outlatch); + + SPEAKER(config, "mono").front_center(); + WAR_OF_THE_WORLDS_AUDIO(config, "soundboard", 0) + .configure_latch_inputs(*m_outlatch) + .add_route(ALL_OUTPUTS, "mono", 1.0); } void demon_state::demon(machine_config &config) diff --git a/src/mame/drivers/cit101.cpp b/src/mame/drivers/cit101.cpp index a34c5d077ef..97ec2c97ffa 100644 --- a/src/mame/drivers/cit101.cpp +++ b/src/mame/drivers/cit101.cpp @@ -232,7 +232,7 @@ u32 cit101_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con { const int line = ((z / (BIT(rowattr, 8) ? 2 : 1)) + (rowattr & 0x00f)) & 15; const bool last_line = z++ == rowlines - 1; - draw_line(&bitmap.pix32(y++), cliprect.left(), cliprect.right(), line, last_line, rowaddr, rowattr, scrattr); + draw_line(&bitmap.pix(y++), cliprect.left(), cliprect.right(), line, last_line, rowaddr, rowattr, scrattr); if (last_line) break; } diff --git a/src/mame/drivers/cit220.cpp b/src/mame/drivers/cit220.cpp index 18651203502..bbde707b26c 100644 --- a/src/mame/drivers/cit220.cpp +++ b/src/mame/drivers/cit220.cpp @@ -135,7 +135,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(cit220_state::draw_character) for (int i = 0; i < width; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/clayshoo.cpp b/src/mame/drivers/clayshoo.cpp index 87b59a9ad6f..3af7ad14ed8 100644 --- a/src/mame/drivers/clayshoo.cpp +++ b/src/mame/drivers/clayshoo.cpp @@ -196,7 +196,7 @@ uint32_t clayshoo_state::screen_update_clayshoo(screen_device &screen, bitmap_rg for (i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; data = data << 1; x = x + 1; diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index 7f014bca587..aae6accb85e 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -105,43 +105,43 @@ public: for (int x = 0; x < 60; x++) { - uint8_t bit = m_ram->pointer()[offset++]; - - bitmap.pix16(y, (x * 8) + 0) = (bit >> 7) & 1; - bitmap.pix16(y, (x * 8) + 1) = (bit >> 6) & 1; - bitmap.pix16(y, (x * 8) + 2) = (bit >> 5) & 1; - bitmap.pix16(y, (x * 8) + 3) = (bit >> 4) & 1; - bitmap.pix16(y, (x * 8) + 4) = (bit >> 3) & 1; - bitmap.pix16(y, (x * 8) + 5) = (bit >> 2) & 1; - bitmap.pix16(y, (x * 8) + 6) = (bit >> 1) & 1; - bitmap.pix16(y, (x * 8) + 7) = (bit >> 0) & 1; + uint8_t const bit = m_ram->pointer()[offset++]; + + bitmap.pix(y, (x * 8) + 0) = BIT(bit, 7); + bitmap.pix(y, (x * 8) + 1) = BIT(bit, 6); + bitmap.pix(y, (x * 8) + 2) = BIT(bit, 5); + bitmap.pix(y, (x * 8) + 3) = BIT(bit, 4); + bitmap.pix(y, (x * 8) + 4) = BIT(bit, 3); + bitmap.pix(y, (x * 8) + 5) = BIT(bit, 2); + bitmap.pix(y, (x * 8) + 6) = BIT(bit, 1); + bitmap.pix(y, (x * 8) + 7) = BIT(bit, 0); } } } else { - uint8_t *font = m_lcd_char_rom->base(); + uint8_t const *font = m_lcd_char_rom->base(); if (m_lcd_mode & LCD_MODE_ALT) { font += 1024; } - int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; + int const chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; for (int y = 0; y < 128; y++) { - int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); + int const offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); for (int x = 0; x < 480; x++) { - uint8_t ch = m_ram->pointer()[offset + (x / chrw)]; + uint8_t const ch = m_ram->pointer()[offset + (x / chrw)]; uint8_t bit = font[((ch & 0x7f) * 8) + (y % 8)]; if (ch & 0x80) { bit = ~bit; } - bitmap.pix16(y, x) = (bit >> (7 - (x % chrw))) & 1; + bitmap.pix(y, x) = (bit >> (7 - (x % chrw))) & 1; } } } @@ -565,52 +565,54 @@ void clcd_state::clcd_mem(address_map &map) } /* Input ports */ +// The keyboard has { } ~ _ marked, but there doesn't seem to be a way to type them in. +// Natural keyboard is set up for the various apps, but since BASIC is the usual Commodore Basic, uppercase turns into graphics and is unusable. static INPUT_PORTS_START( clcd ) PORT_START( "COL0" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR('_') PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_START( "COL1" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_START( "COL2" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(':') PORT_CHAR('[') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(':') PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_START( "COL3" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_START( "COL4" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('^') PORT_CHAR('~') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') @@ -618,22 +620,22 @@ static INPUT_PORTS_START( clcd ) PORT_START( "COL5" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR(']') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(';') PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') PORT_START( "COL6" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HOME CLR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("*") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_START( "COL7" ) @@ -649,7 +651,7 @@ static INPUT_PORTS_START( clcd ) PORT_START( "SPECIAL" ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT),UCHAR_SHIFT_1) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // clears screen and goes into infinite loop diff --git a/src/mame/drivers/clickstart.cpp b/src/mame/drivers/clickstart.cpp index 9c67a8f78cc..e46cc3d3d7d 100644 --- a/src/mame/drivers/clickstart.cpp +++ b/src/mame/drivers/clickstart.cpp @@ -9,7 +9,7 @@ mouse optical sensor is a N2163, probably from Agilent. ClickStart cartridges pinout: - + 1 N/C 2 GND 3 GND 4 VCC 5 GND 6 VCC diff --git a/src/mame/drivers/cliffhgr.cpp b/src/mame/drivers/cliffhgr.cpp index 3761c0548b7..339866ab13c 100644 --- a/src/mame/drivers/cliffhgr.cpp +++ b/src/mame/drivers/cliffhgr.cpp @@ -83,7 +83,6 @@ Side 2 = 0x8F7DDD (or 0x880000 | ( 0x77 << 12 ) | 0x0DDD) #include "video/tms9928a.h" #include "machine/nvram.h" -#include "render.h" #include "speaker.h" diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index 333d352af29..2f83ed95871 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -490,7 +490,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint8_t *src = &m_video_ram[(512/8) * ((y + y_scroll) & 0xff)]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 8) { @@ -507,7 +507,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit if (m_lp_touch_port->read() && BIT(m_q219_pia->b_output(), 1)) { /* Invert target pixel */ - bitmap.pix32(m_lp_y_port->read(), m_lp_x_port->read()) ^= 0x00ffffff; + bitmap.pix(m_lp_y_port->read(), m_lp_x_port->read()) ^= 0x00ffffff; } @@ -2048,6 +2048,14 @@ void cmi_state::machine_reset() m_m6809_bs_hack_cnt[0] = 0; m_m6809_bs_hack_cnt[1] = 0; + //m_midi_ptm[0]->set_g1(1); // /G1 has unknown source, "TIMER 1A /GATE" per schematic + m_midi_ptm[0]->set_g2(0); // /G2 and /G3 wired to ground per schematic + m_midi_ptm[0]->set_g3(0); + + m_midi_ptm[1]->set_g1(0); // /G1, /G2, and /G3 wired to ground per schematic + m_midi_ptm[1]->set_g2(0); + m_midi_ptm[1]->set_g3(0); + memset(m_map_sel, 0, 16); for (int i = 0; i < 4; i++) @@ -2229,17 +2237,11 @@ void cmi_state::cmi2x(machine_config &config) PTM6840(config, m_midi_ptm[0], 0); m_midi_ptm[0]->set_external_clocks(0, 384000, 0); // C1 is 0, C2 is 384kHz per schematic block diagram, C3 is CLICK SYNC IN - //m_midi_ptm[0]->set_g1(1); // /G1 has unknown source, "TIMER 1A /GATE" per schematic - m_midi_ptm[0]->set_g2(0); // /G2 and /G3 wired to ground per schematic - m_midi_ptm[0]->set_g3(0); //m_midi_ptm[0]->o1_callback().set(FUNC(cmi_state::midi_ptm0_c1_w)); // TIMER 1A O/P per schematic //m_midi_ptm[0]->o2_callback().set(FUNC(cmi_state::midi_ptm0_c2_w)); // CLK 2 per schematic m_midi_ptm[0]->o3_callback().set(FUNC(cmi_state::midi_ptm0_c3_w)); PTM6840(config, m_midi_ptm[1], 0); // entirely clocked by PTM 0 - m_midi_ptm[1]->set_g1(0); // /G1, /G2, and /G3 wired to ground per schematic - m_midi_ptm[1]->set_g2(0); - m_midi_ptm[1]->set_g3(0); //m_midi_ptm[1]->o1_callback().set(FUNC(cmi_state::midi_sync_out_1_w)); // SYNC OUT 1 per schematic //m_midi_ptm[1]->o2_callback().set(FUNC(cmi_state::midi_sync_out_2_w)); // SYNC OUT 2 per schematic //m_midi_ptm[1]->o3_callback().set(FUNC(cmi_state::midi_sync_out_3_w)); // SYNC OUT 3 per schematic diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp index 162bf98d927..9fcd2d39ca6 100644 --- a/src/mame/drivers/cobra.cpp +++ b/src/mame/drivers/cobra.cpp @@ -860,8 +860,8 @@ public: void cobra_renderer::render_color_scan(int32_t scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid) { - uint32_t *fb = &m_backbuffer->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_backbuffer->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); float z = extent.param[POLY_Z].start; float dz = extent.param[POLY_Z].dpdx; @@ -961,8 +961,8 @@ void cobra_renderer::render_texture_scan(int32_t scanline, const extent_t &exten float ga = extent.param[POLY_A].start; float dga = extent.param[POLY_A].dpdx; - uint32_t *fb = &m_backbuffer->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_backbuffer->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); uint32_t texture_width = 1 << ((extradata.tex_format >> 28) & 0xf); uint32_t texture_height = 1 << ((extradata.tex_format >> 24) & 0xf); @@ -1066,7 +1066,7 @@ void cobra_renderer::draw_point(const rectangle &visarea, vertex_t &v, uint32_t if (x >= visarea.min_x && x <= visarea.max_x && y >= visarea.min_y && y <= visarea.max_y) { - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; } } @@ -1094,7 +1094,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t { int y = y1 + (dy * (float)(x - x1) / (float)(dx)); - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; x++; @@ -1107,7 +1107,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t { int x = x1 + (dx * (float)(y - y1) / (float)(dy)); - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; y++; @@ -2610,11 +2610,11 @@ void cobra_renderer::gfx_fifo_exec() uint32_t *buffer; switch (m_gfx_gram[0x80104/4]) { - case 0x800000: buffer = &m_framebuffer->pix32(y); break; - case 0x200000: buffer = &m_backbuffer->pix32(y); break; - case 0x0e0000: buffer = &m_overlay->pix32(y); break; - case 0x000800: buffer = &m_zbuffer->pix32(y); break; - case 0x000200: buffer = &m_stencil->pix32(y); break; + case 0x800000: buffer = &m_framebuffer->pix(y); break; + case 0x200000: buffer = &m_backbuffer->pix(y); break; + case 0x0e0000: buffer = &m_overlay->pix(y); break; + case 0x000800: buffer = &m_zbuffer->pix(y); break; + case 0x000200: buffer = &m_stencil->pix(y); break; default: { @@ -2666,11 +2666,11 @@ void cobra_renderer::gfx_fifo_exec() uint32_t *buffer; switch (m_gfx_gram[0x80104/4]) { - case 0x800000: buffer = &m_framebuffer->pix32(y+i); break; - case 0x200000: buffer = &m_backbuffer->pix32(y+i); break; - case 0x0e0000: buffer = &m_overlay->pix32(y+i); break; - case 0x000800: buffer = &m_zbuffer->pix32(y+i); break; - case 0x000200: buffer = &m_stencil->pix32(y+i); break; + case 0x800000: buffer = &m_framebuffer->pix(y+i); break; + case 0x200000: buffer = &m_backbuffer->pix(y+i); break; + case 0x0e0000: buffer = &m_overlay->pix(y+i); break; + case 0x000800: buffer = &m_zbuffer->pix(y+i); break; + case 0x000200: buffer = &m_stencil->pix(y+i); break; default: { diff --git a/src/mame/drivers/cocoloco.cpp b/src/mame/drivers/cocoloco.cpp index 37e9ac204ba..18e6e0060d4 100644 --- a/src/mame/drivers/cocoloco.cpp +++ b/src/mame/drivers/cocoloco.cpp @@ -288,7 +288,7 @@ uint32_t cocoloco_state::screen_update(screen_device &screen, bitmap_ind16 &bitm color |= ((m_videoram[count|0x6000] >> (xi)) & 1) << 3; if (cliprect.contains(x + xi, 256 - y)) - bitmap.pix16(256 - y, x + xi) = m_palette->pen(color & 0x0f); + bitmap.pix(256 - y, x + xi) = m_palette->pen(color & 0x0f); } count++; diff --git a/src/mame/drivers/compucolor.cpp b/src/mame/drivers/compucolor.cpp index f5dc5662f4b..ca1b9824215 100644 --- a/src/mame/drivers/compucolor.cpp +++ b/src/mame/drivers/compucolor.cpp @@ -284,12 +284,12 @@ uint32_t compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &b uint8_t data = m_char_rom->base()[char_offs]; - rgb_t fg = m_palette->pen_color(attr & 0x07); - rgb_t bg = m_palette->pen_color((attr >> 3) & 0x07); + rgb_t const fg = m_palette->pen_color(attr & 0x07); + rgb_t const bg = m_palette->pen_color((attr >> 3) & 0x07); for (int x = 0; x < 6; x++) { - bitmap.pix32(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; + bitmap.pix(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; data <<= 1; } diff --git a/src/mame/drivers/comx35.cpp b/src/mame/drivers/comx35.cpp index ae63ceabe3e..12d4842427e 100644 --- a/src/mame/drivers/comx35.cpp +++ b/src/mame/drivers/comx35.cpp @@ -20,7 +20,6 @@ #include "includes/comx35.h" #include "formats/imageutl.h" #include "screen.h" -#include "softlist.h" /*************************************************************************** PARAMETERS @@ -346,7 +345,7 @@ static INPUT_PORTS_START( comx35 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('?') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) PORT_START("D2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('[') @@ -392,11 +391,11 @@ static INPUT_PORTS_START( comx35 ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('+') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') PORT_CHAR('|') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('}') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('~') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(8) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR('+') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('-') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("D7") PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -633,7 +632,6 @@ void comx35_state::base(machine_config &config, const XTAL clock) QUICKLOAD(config, "quickload", "comx").set_load_callback(FUNC(comx35_state::quickload_cb)); CASSETTE(config, m_cassette).set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED); - //m_cassette->add_route(ALL_OUTPUTS, "mono", 0.05); // expansion bus COMX_EXPANSION_SLOT(config, m_exp, 0, comx_expansion_cards, "eb").irq_callback().set(FUNC(comx35_state::irq_w)); diff --git a/src/mame/drivers/consola_emt.cpp b/src/mame/drivers/consola_emt.cpp index 8e5abca8046..74bff79497f 100644 --- a/src/mame/drivers/consola_emt.cpp +++ b/src/mame/drivers/consola_emt.cpp @@ -233,7 +233,7 @@ HD44780_PIXEL_UPDATE( consoemt_state::lcd_pixel_update ) return; if (line < 2 && pos < 20) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/drivers/coolpool.cpp b/src/mame/drivers/coolpool.cpp index 8028dcc7a7e..f5fad8a2a87 100644 --- a/src/mame/drivers/coolpool.cpp +++ b/src/mame/drivers/coolpool.cpp @@ -63,21 +63,20 @@ static const uint16_t nvram_unlock_seq[] = TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::amerdart_scanline) { - uint16_t *vram = &m_vram_base[(params->rowaddr << 8) & 0xff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram_base[(params->rowaddr << 8) & 0xff00]; + uint32_t *const dest = &bitmap.pix(scanline); rgb_t pens[16]; int coladdr = params->coladdr; - int x; /* update the palette */ if (scanline < 256) - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { uint16_t pal = m_vram_base[x]; pens[x] = rgb_t(pal4bit(pal >> 4), pal4bit(pal >> 8), pal4bit(pal >> 12)); } - for (x = params->heblnk; x < params->hsblnk; x += 4) + for (int x = params->heblnk; x < params->hsblnk; x += 4) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[(pixels >> 0) & 15]; @@ -90,13 +89,12 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::amerdart_scanline) TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::coolpool_scanline) { - uint16_t *vram = &m_vram_base[(params->rowaddr << 8) & 0x1ff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const vram = &m_vram_base[(params->rowaddr << 8) & 0x1ff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/coolridr.cpp b/src/mame/drivers/coolridr.cpp index 8b454e86424..cbb54e200b3 100644 --- a/src/mame/drivers/coolridr.cpp +++ b/src/mame/drivers/coolridr.cpp @@ -663,17 +663,17 @@ do { /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + PIXEL_TYPE *destptr = &dest.pix(cury, destx); \ + const uint8_t *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ for (curx = 0; curx < numblocks; curx++) \ { \ - COOL_PIXEL_OP(destptr[0], srcptr[0]); \ - COOL_PIXEL_OP(destptr[1], srcptr[1]); \ - COOL_PIXEL_OP(destptr[2], srcptr[2]); \ - COOL_PIXEL_OP(destptr[3], srcptr[3]); \ + COOL_PIXEL_OP(destptr[0], srcptr[0]); \ + COOL_PIXEL_OP(destptr[1], srcptr[1]); \ + COOL_PIXEL_OP(destptr[2], srcptr[2]); \ + COOL_PIXEL_OP(destptr[3], srcptr[3]); \ \ srcptr += 4; \ destptr += 4; \ @@ -682,7 +682,7 @@ do { /* iterate over leftover pixels */ \ for (curx = 0; curx < leftovers; curx++) \ { \ - COOL_PIXEL_OP(destptr[0], srcptr[0]); \ + COOL_PIXEL_OP(destptr[0], srcptr[0]); \ srcptr++; \ destptr++; \ } \ @@ -695,8 +695,8 @@ do { /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + PIXEL_TYPE *destptr = &dest.pix(cury, destx); \ + const uint8_t *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -910,8 +910,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t* linesrc = &m_screen_bitmap[Screen].pix16(y); - uint16_t* linedest = &bitmap.pix16(y); + uint16_t const *const linesrc = &m_screen_bitmap[Screen].pix(y); + uint16_t *const linedest = &bitmap.pix(y); for (int x = cliprect.left(); x<= cliprect.right(); x++) { @@ -1129,8 +1129,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm const int pixelOffsetnextX = ((hPositionTable) + ((h+1)* 16 * hZoomHere)) / 0x40; \ if (drawy>clipmaxY) { break; }; \ if (drawy<clipminY) { drawy++; continue; }; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int blockwide = pixelOffsetnextX-pixelOffsetX; \ if (pixelOffsetX+blockwide <clipminX) { drawy++; continue; } \ if (pixelOffsetX>clipmaxX) { drawy++; continue; } \ @@ -1167,8 +1167,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int realy = ((y*incy)>>21); \ const int drawy = pixelOffsetY+y; \ if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int drawx = pixelOffsetX; \ for (int x = 0; x < blockwide; x++) \ { \ @@ -1185,8 +1185,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { \ const int drawy = pixelOffsetY+realy; \ if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int drawx = pixelOffsetX; \ for (int realx = 0; realx < 16; realx++) \ { \ @@ -1937,9 +1937,6 @@ void *coolridr_state::draw_object_threaded(void *param, int threadid) uint32_t incy = 0x8000000 / vZoom; // DEBUG: Draw 16x16 block - uint16_t* line; - //uint16_t* zline; - if (indirect_zoom_enable) { diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp index d8bd5d0ae54..90c58278ed9 100644 --- a/src/mame/drivers/corona.cpp +++ b/src/mame/drivers/corona.cpp @@ -499,22 +499,18 @@ void corona_state::video_start() uint32_t corona_state::screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) - bitmap.pix16(y, x) = m_videobuf[y * 512 + x]; + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(y, x) = m_videobuf[y * 512 + x]; return 0; } uint32_t corona_state::screen_update_luckyrlt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) - bitmap.pix16(255 - y, x) = m_videobuf[y * 512 + x]; + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(255 - y, x) = m_videobuf[y * 512 + x]; return 0; } diff --git a/src/mame/drivers/cowtipping.cpp b/src/mame/drivers/cowtipping.cpp new file mode 100644 index 00000000000..211f6fc680b --- /dev/null +++ b/src/mame/drivers/cowtipping.cpp @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders: + +/* +Cow Tipping +Game Refuge / Team Play 2004 + +PCB sputnik rev. 1.1 + +- Motorola Super VZ DragonBall MC68SZ328AVH66 +- XTAL: 80 MHz (near Cyclone), 32.768k (near SoC and PIC) +- Altera Cyclone EP1C6Q240C7 +- TDA8771AH DAC +- PIC12C508 Microcontroller + +Two identical looking PCBs were dumped. The dumps are different (even taking into account a suspected bad dump), but it +isn't currently known if it's because they're different sets or because of the saved scores and settings. + +The PIC is undumped, but on PCB the game seems to run without it, hanging when checking the ticket dispenser. +*/ + + + +#include "emu.h" +#include "cpu/pic16c5x/pic16c5x.h" +#include "cpu/m68000/m68000.h" +#include "machine/mc68328.h" +#include "emupal.h" +#include "screen.h" +#include "speaker.h" + +class cowtipping_state : public driver_device +{ +public: + cowtipping_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + void cowtipping(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + required_device<cpu_device> m_maincpu; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); +}; + + +void cowtipping_state::machine_start() +{ +} + +uint32_t cowtipping_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +void cowtipping_state::main_map(address_map &map) +{ + map(0x000000, 0x8000ff).rom().region("maincpu", 0); +} + + +static INPUT_PORTS_START( cowtipping ) + +INPUT_PORTS_END + +void cowtipping_state::cowtipping(machine_config &config) +{ + MC68328(config, m_maincpu, 32.768_kHz_XTAL * 506); // 16.580608 MHz, multiplier unknown, to be adjusted + m_maincpu->set_addrmap(AS_PROGRAM, &cowtipping_state::main_map); + + PIC16C56(config, "pic", 4000000); // Actually PIC12C508/P, clock not verified + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // wrong + screen.set_refresh_hz(60); + screen.set_screen_update(FUNC(cowtipping_state::screen_update)); + screen.set_size(1024, 256); + screen.set_visarea_full(); + + PALETTE(config, "palette").set_entries(65536); // wrong + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); +} + + +ROM_START( cowtipp ) + ROM_REGION16_BE(0x800100, "maincpu", 0) + ROM_LOAD16_WORD_SWAP( "am29lv640mb-u5-3287.u5", 0x000000, 0x800100, CRC(5aa4ac7c) SHA1(4b882008e13e581c0131875a1845c7e78696087e) ) + // empty space at u6 + + ROM_REGION( 0x1000, "pic", 0 ) + ROM_LOAD( "56_pic12c508-04p.u3", 0x000, 0x09db, NO_DUMP ) +ROM_END + +ROM_START( cowtippa ) + ROM_REGION16_BE(0x800100, "maincpu", 0) + ROM_LOAD16_WORD_SWAP( "am29lv640mb-u5-3276.u5", 0x000000, 0x800100, BAD_DUMP CRC(05ce9f7f) SHA1(c27772c9a6a1feaf4d83ae0902759fa25642ad65) ) // suspected bad, seems to have some problems with bit 5 + // empty space at u6 + + ROM_REGION( 0x1000, "pic", 0 ) + ROM_LOAD( "54_pic12c508-04p.u3", 0x000, 0x09db, NO_DUMP ) +ROM_END + + +GAME( 2004, cowtipp, 0, cowtipping, cowtipping, cowtipping_state, empty_init, ROT270, "Game Refuge / Team Play", "Cow Tipping - Shake Cattle & Roll (set 1)", MACHINE_IS_SKELETON ) +GAME( 2004, cowtippa, cowtipp, cowtipping, cowtipping, cowtipping_state, empty_init, ROT270, "Game Refuge / Team Play", "Cow Tipping - Shake Cattle & Roll (set 2)", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/cps1bl_5205.cpp b/src/mame/drivers/cps1bl_5205.cpp index 30dbe9fc440..b305c46597f 100644 --- a/src/mame/drivers/cps1bl_5205.cpp +++ b/src/mame/drivers/cps1bl_5205.cpp @@ -1082,7 +1082,7 @@ ROM_START( knightsb3 ) == | | 1 5 6 | |________________________| - + #1 palce20v8h secured, bruteforce ok #2 palce16v8h secured, bruteforce ok #3 palce16v8h secured, registered @@ -1351,10 +1351,10 @@ GAME( 1991, knightsb3, knights, knightsb, knights, captcommb2_state, GAME( 1992, sf2b, sf2, sf2b, sf2mdt, cps1bl_5205_state, init_sf2b, ROT0, "bootleg (Playmark)", "Street Fighter II: The World Warrior (bootleg, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 910204 ETC GAME( 1992, sf2b2, sf2, sf2b, sf2mdt, cps1bl_5205_state, init_sf2mdtb, ROT0, "bootleg", "Street Fighter II: The World Warrior (bootleg, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 910204 ETC -GAME( 1992, sf2ceb, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdta, ROT0, "bootleg (Playmark)", "Street Fighter II': Champion Edition (Playmark bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC +GAME( 1992, sf2ceb, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdta, ROT0, "bootleg (Playmark)", "Street Fighter II': Champion Edition (Playmark bootleg, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC GAME( 1992, sf2ceb2, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdtb, ROT0, "bootleg", "Street Fighter II': Champion Edition (bootleg, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC GAME( 1992, sf2ceb3, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdtb, ROT0, "bootleg", "Street Fighter II': Champion Edition (bootleg, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC -GAME( 1992, sf2ceb4, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdtb, ROT0, "bootleg", "Street Fighter II': Champion Edition (bootleg, set 3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC +GAME( 1992, sf2ceb4, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdtb, ROT0, "bootleg", "Street Fighter II': Champion Edition (Playmark bootleg, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC GAME( 1992, sf2mdt, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdt, ROT0, "bootleg", "Street Fighter II': Magic Delta Turbo (bootleg, set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC GAME( 1992, sf2mdta, sf2ce, sf2mdt, sf2mdt, cps1bl_5205_state, init_sf2mdta, ROT0, "bootleg", "Street Fighter II': Magic Delta Turbo (bootleg, set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC diff --git a/src/mame/drivers/cps1bl_pic.cpp b/src/mame/drivers/cps1bl_pic.cpp index b0b88216320..d8a1efd5d07 100644 --- a/src/mame/drivers/cps1bl_pic.cpp +++ b/src/mame/drivers/cps1bl_pic.cpp @@ -1319,7 +1319,7 @@ ROM_START( jurassic99 ) U98G ATF16V8B-15PC 8 secured, registered U99G ATF16V8B-15PC 8 secured, registered U134G ATF16V8B-15PC 8? secured, registered - + 3rd column numbers are what's hand-written on each chip ? = hard to read or rubbed off the #8 pals appear to be just 74LS298 equivalents, can be replaced with real 74LS298 (additional 16-pin footprints underneath each chip) or hand-crafted jed diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp index ce0a55bc62c..ab0408d1a1c 100644 --- a/src/mame/drivers/cps3.cpp +++ b/src/mame/drivers/cps3.cpp @@ -707,8 +707,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -723,8 +723,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -740,8 +740,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -757,8 +757,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -1288,8 +1288,8 @@ u32 cps3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const /* copy render bitmap without zoom */ for (u32 rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++) { - u32* dstbitmap = &bitmap.pix32(rendery); - u32* srcbitmap = &m_renderbuffer_bitmap.pix32(rendery); + u32 *const dstbitmap = &bitmap.pix(rendery); + u32 const *const srcbitmap = &m_renderbuffer_bitmap.pix(rendery); for (u32 renderx = cliprect.left(); renderx <= cliprect.right(); renderx++) { @@ -1303,8 +1303,8 @@ u32 cps3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const u32 srcy = cliprect.top() * fszy; for (u32 rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++) { - u32* dstbitmap = &bitmap.pix32(rendery); - u32* srcbitmap = &m_renderbuffer_bitmap.pix32(srcy >> 16); + u32 *const dstbitmap = &bitmap.pix(rendery); + u32 const *const srcbitmap = &m_renderbuffer_bitmap.pix(srcy >> 16); u32 srcx = cliprect.left() * fszx; for (u32 renderx = cliprect.left(); renderx <= cliprect.right(); renderx++) diff --git a/src/mame/drivers/crvision.cpp b/src/mame/drivers/crvision.cpp index f93bd04a6dc..ef0177bb6e7 100644 --- a/src/mame/drivers/crvision.cpp +++ b/src/mame/drivers/crvision.cpp @@ -922,6 +922,7 @@ void laser2001_state::lasr2001(machine_config &config) // software list SOFTWARE_LIST(config, "cart_list").set_original("crvision"); SOFTWARE_LIST(config, "cart_list2").set_original("laser2001_cart"); + SOFTWARE_LIST(config, "flop_list").set_original("laser2001_flop"); } /*************************************************************************** diff --git a/src/mame/drivers/cubeqst.cpp b/src/mame/drivers/cubeqst.cpp index 6df6c4eec61..96a799ac89b 100644 --- a/src/mame/drivers/cubeqst.cpp +++ b/src/mame/drivers/cubeqst.cpp @@ -130,8 +130,6 @@ void cubeqst_state::palette_w(offs_t offset, uint16_t data, uint16_t mem_mask) /* TODO: This is a simplified version of what actually happens */ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; - /* * Clear the display with palette RAM entry 0xff * This will be either transparent or an actual colour @@ -141,13 +139,11 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 bitmap.fill(m_colormap[255], cliprect); /* TODO: Add 1 for linebuffering? */ - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - int i; int num_entries = m_linecpu->cubeqcpu_get_ptr_ram_val(y); - uint32_t *stk_ram = m_linecpu->cubeqcpu_get_stack_ram(); - uint32_t *dest = &bitmap.pix32(y); - uint32_t pen; + uint32_t const *const stk_ram = m_linecpu->cubeqcpu_get_stack_ram(); + uint32_t *const dest = &bitmap.pix(y); /* Zap the depth buffer */ memset(m_depth_buffer.get(), 0xff, 512); @@ -155,11 +151,10 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 /* Process all the spans on this scanline */ if (y < 256) { - for (i = 0; i < num_entries; i += 2) + for (int i = 0; i < num_entries; i += 2) { int color = 0, depth = 0; int h1 = 0, h2 = 0; - int x; int entry1 = stk_ram[(y << 7) | ((i + 0) & 0x7f)]; int entry2 = stk_ram[(y << 7) | ((i + 1) & 0x7f)]; @@ -187,8 +182,8 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 } /* Draw the span, testing for depth */ - pen = m_colormap[m_generic_paletteram_16[color]]; - for (x = h1; x <= h2; ++x) + uint32_t pen = m_colormap[m_generic_paletteram_16[color]]; + for (int x = h1; x <= h2; ++x) { if (!(m_depth_buffer[x] < depth)) { diff --git a/src/mame/drivers/cupidon.cpp b/src/mame/drivers/cupidon.cpp index a4681e71eaf..4f0066ebf99 100644 --- a/src/mame/drivers/cupidon.cpp +++ b/src/mame/drivers/cupidon.cpp @@ -29,25 +29,23 @@ public: m_gfxram(*this, "gfxram") { } + void init_cupidon(); + void init_funnyfm(); + + void cupidon(machine_config &config); + void cupidon_map(address_map &map); + +protected: // devices required_device<m68340_cpu_device> m_maincpu; required_shared_ptr<uint32_t> m_gfxram; uint32_t screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void init_cupidon(); - void init_funnyfm(); - uint32_t cupidon_return_ffffffff() { return -1; // or it hits an illegal opcode (sleep on the 68340?) - }; - - void cupidon(machine_config &config); - void cupidon_map(address_map &map); -protected: - - + } }; uint32_t cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -60,7 +58,7 @@ uint32_t cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind1 { for (int y=0;y<16;y++) { - uint16_t* destline = &bitmap.pix16(ytile*16 + y); + uint16_t *const destline = &bitmap.pix(ytile*16 + y); for (int x=0;x<8;x++) { diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp index 612e69281e3..a477f9626df 100644 --- a/src/mame/drivers/cxhumax.cpp +++ b/src/mame/drivers/cxhumax.cpp @@ -897,17 +897,14 @@ static inline uint32_t ycc_to_rgb(uint32_t ycc) uint32_t cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - uint32_t osd_pointer = m_drm1_regs[DRM_OSD_PTR_REG]; if(osd_pointer) { - uint32_t *ram = m_ram; - uint32_t *osd_header = &ram[osd_pointer/4]; - uint8_t *vbuf = (uint8_t*)(&ram[osd_header[3]/4]); - uint32_t *palette = &ram[osd_header[7]/4]; + uint32_t const *ram = m_ram; + uint32_t const *osd_header = &ram[osd_pointer/4]; + uint8_t const *vbuf = (uint8_t*)(&ram[osd_header[3]/4]); + uint32_t const *palette = &ram[osd_header[7]/4]; uint32_t x_disp_start_and_width = osd_header[1]; uint32_t xdisp_width = (x_disp_start_and_width >> 16) & 0x1fff; @@ -927,14 +924,14 @@ uint32_t cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb3 uint32_t first_y = m_drm0_regs[DRM_ACTIVE_Y_REG] & 0xfff; uint32_t last_y = (m_drm0_regs[DRM_ACTIVE_Y_REG] >> 16) & 0xfff;*/ - for (j=ydisp_start; j <= ydisp_last; j++) + for (int j=ydisp_start; j <= ydisp_last; j++) { - uint32_t *bmp = &bitmap.pix32(j); + uint32_t *const bmp = &bitmap.pix(j); - for (i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) + for (int i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) { if ((i <= (xdisp_start + ximg_width)) && (j <= (ydisp_start + yimg_height))) { - bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; + bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; // FIXME: need BYTE4_XOR_?E for endianness } else { bmp[i] = ycc_to_rgb(m_drm1_regs[DRM_BCKGND_REG]); } diff --git a/src/mame/drivers/cybertnk.cpp b/src/mame/drivers/cybertnk.cpp index 306769ebbb5..bc713eedbe1 100644 --- a/src/mame/drivers/cybertnk.cpp +++ b/src/mame/drivers/cybertnk.cpp @@ -379,7 +379,7 @@ void cybertnk_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c if ((yy>=miny) && (yy<=maxy)) { - dest = &bitmap.pix16(yy, 0); + dest = &bitmap.pix(yy, 0); int start,end,inc; diff --git a/src/mame/drivers/cz101.cpp b/src/mame/drivers/cz101.cpp index b41b08c17b0..1e475f33125 100644 --- a/src/mame/drivers/cz101.cpp +++ b/src/mame/drivers/cz101.cpp @@ -259,7 +259,7 @@ HD44780_PIXEL_UPDATE( cz101_state::lcd_pixel_update ) return; if (line < 2 && pos < 16) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } void cz101_state::led_4_w(uint8_t data) diff --git a/src/mame/drivers/d6800.cpp b/src/mame/drivers/d6800.cpp index 25dd3194179..010f6274193 100644 --- a/src/mame/drivers/d6800.cpp +++ b/src/mame/drivers/d6800.cpp @@ -41,6 +41,8 @@ Information and programs can be found at http://chip8.com/?page=78 + Due to the way the keyboard is scanned, Natural Keyboard/Paste is not possible. + **********************************************************************************/ @@ -66,14 +68,7 @@ public: , m_pia(*this, "pia") , m_beeper(*this, "beeper") , m_videoram(*this, "videoram") - , m_io_x0(*this, "X0") - , m_io_x1(*this, "X1") - , m_io_x2(*this, "X2") - , m_io_x3(*this, "X3") - , m_io_y0(*this, "Y0") - , m_io_y1(*this, "Y1") - , m_io_y2(*this, "Y2") - , m_io_y3(*this, "Y3") + , m_io_keyboard(*this, "X%u", 0U) , m_io_shift(*this, "SHIFT") { } @@ -107,14 +102,7 @@ private: required_device<pia6821_device> m_pia; required_device<beep_device> m_beeper; required_shared_ptr<uint8_t> m_videoram; - required_ioport m_io_x0; - required_ioport m_io_x1; - required_ioport m_io_x2; - required_ioport m_io_x3; - required_ioport m_io_y0; - required_ioport m_io_y1; - required_ioport m_io_y2; - required_ioport m_io_y3; + required_ioport_array<4> m_io_keyboard; required_ioport m_io_shift; }; @@ -135,61 +123,33 @@ void d6800_state::d6800_map(address_map &map) static INPUT_PORTS_START( d6800 ) PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_NAME("0") // ee + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_NAME("1") // ed + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_NAME("2") // eb + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("3") // e7 PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_NAME("4") // de + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_NAME("5") // dd + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("6") // db + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("7") // d7 PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("X2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("8") // be + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_NAME("9") // bd + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("A") // bb + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_NAME("B") // b7 PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("X3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("C") // 7e + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_NAME("D") // 7d + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_NAME("E") // 7b + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_NAME("F") // 77 PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("Y0") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - - PORT_START("Y1") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - - PORT_START("Y2") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - - PORT_START("Y3") - PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_START("SHIFT") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("FN") PORT_CODE(KEYCODE_LSHIFT) @@ -197,7 +157,6 @@ static INPUT_PORTS_START( d6800 ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RST") PORT_CODE(KEYCODE_LALT) PORT_CHANGED_MEMBER(DEVICE_SELF, d6800_state, reset_button, 0) PORT_START("VS") - /* vblank */ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") INPUT_PORTS_END @@ -212,16 +171,16 @@ INPUT_CHANGED_MEMBER(d6800_state::reset_button) /* Video */ uint32_t d6800_state::screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t x,y,gfx=0; + uint8_t gfx=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = 0; x < 8; x++) + for (uint8_t x = 0; x < 8; x++) { if (m_cb2) - gfx = m_videoram[ x | (y<<3)]; + gfx = m_videoram[x | (y<<3)]; *p++ = BIT(gfx, 7); *p++ = BIT(gfx, 6); @@ -262,7 +221,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::kansas_r) if (m_rtc > 159) m_rtc = 0; - uint8_t data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read(); + uint8_t data = m_io_keyboard[0]->read() & m_io_keyboard[1]->read() & m_io_keyboard[2]->read() & m_io_keyboard[3]->read(); int ca1 = (data == 255) ? 0 : 1; int ca2 = m_io_shift->read(); int cb1 = (m_rtc) ? 1 : 0; @@ -323,10 +282,18 @@ uint8_t d6800_state::d6800_keyboard_r() lines around and reads it another way. This isolates the key that was pressed. */ - uint8_t data = m_io_x0->read() & m_io_x1->read() & m_io_x2->read() & m_io_x3->read() - & m_io_y0->read() & m_io_y1->read() & m_io_y2->read() & m_io_y3->read(); + u8 y = 8; + for (u8 i = 0; i < 4; i++) + { + u8 data = m_io_keyboard[i]->read() & 15; + y <<= 1; + if (data < 15) + for (u8 j = 0; j < 4; j++) + if (!BIT(data, j)) + return data | (0xf0 - y); + } - return data; + return 0xff; } void d6800_state::d6800_keyboard_w(uint8_t data) diff --git a/src/mame/drivers/dai.cpp b/src/mame/drivers/dai.cpp index 5cc6d97261f..efae8655fcb 100644 --- a/src/mame/drivers/dai.cpp +++ b/src/mame/drivers/dai.cpp @@ -212,7 +212,6 @@ void dai_state::dai(machine_config &config) GFXDECODE(config, "gfxdecode", m_palette, gfx_dai); PALETTE(config, m_palette, FUNC(dai_state::dai_palette), ARRAY_LENGTH(s_palette)); - /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER(config, "lspeaker").front_left(); @@ -230,6 +229,7 @@ void dai_state::dai(machine_config &config) m_tms5501->int_callback().set_inputline("maincpu", I8085_INTR_LINE); m_tms5501->xi_callback().set(FUNC(dai_state::keyboard_r)); m_tms5501->xo_callback().set(FUNC(dai_state::keyboard_w)); + TIMER(config, m_tms_timer).configure_generic(FUNC(dai_state::tms_timer)); /* software lists */ SOFTWARE_LIST(config, "cass_list").set_original("dai_cass"); diff --git a/src/mame/drivers/dai3wksi.cpp b/src/mame/drivers/dai3wksi.cpp index 91293f00cee..64a54bdad0e 100644 --- a/src/mame/drivers/dai3wksi.cpp +++ b/src/mame/drivers/dai3wksi.cpp @@ -179,9 +179,9 @@ uint32_t dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rg rgb_t pen = (data & (1 << i)) ? m_palette->pen_color(color) : rgb_t::black(); if (m_dai3wksi_flipscreen) - bitmap.pix32(255-y, 255-x) = pen; + bitmap.pix(255-y, 255-x) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; x++; } diff --git a/src/mame/drivers/darius.cpp b/src/mame/drivers/darius.cpp index 71ed723f5cf..6ef7140a0ec 100644 --- a/src/mame/drivers/darius.cpp +++ b/src/mame/drivers/darius.cpp @@ -324,8 +324,8 @@ void darius_state::update_psg1(int port) void darius_state::update_da() { - const int left = m_def_vol[(m_pan[4] >> 4) & 0x0f]; - const int right = m_def_vol[(m_pan[4] >> 0) & 0x0f]; + const int left = m_def_vol[(m_pan[4] >> 0) & 0x0f]; + const int right = m_def_vol[(m_pan[4] >> 4) & 0x0f]; if (m_msm5205_l != nullptr) m_msm5205_l->flt_volume_set_volume(left / 100.0); diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index 85e8f828216..8e59a701fa2 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -1703,7 +1703,6 @@ uint8_t ddenlovr_state::ddenlovr_gfxrom_r() void ddenlovr_state::copylayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer) { - int x,y; int scrollx = m_ddenlovr_scroll[layer / 4 * 8 + (layer % 4) + 0]; int scrolly = m_ddenlovr_scroll[layer / 4 * 8 + (layer % 4) + 4]; @@ -1720,15 +1719,15 @@ void ddenlovr_state::copylayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (((m_ddenlovr_layer_enable2 << 4) | m_ddenlovr_layer_enable) & (1 << layer)) { - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { int pen = m_ddenlovr_pixmap[layer][512 * ((y + scrolly) & 0x1ff) + ((x + scrollx) & 0x1ff)]; if ((pen & transmask) != transpen) { pen &= penmask; - bitmap.pix32(y, x) = pens[pen]; + bitmap.pix(y, x) = pens[pen]; } } } @@ -4283,18 +4282,16 @@ VIDEO_START_MEMBER(htengoku_state,htengoku) uint32_t htengoku_state::screen_update_htengoku(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int layer, x, y; - // render the layers, one by one, "dynax.c" style. Then convert the pixmaps to "ddenlovr.c" // format and let screen_update_ddenlovr() do the final compositing (priorities + palettes) - for (layer = 0; layer < 4; layer++) + for (int layer = 0; layer < 4; layer++) { m_htengoku_layer.fill(0, cliprect); hanamai_copylayer(m_htengoku_layer, cliprect, layer); - for (y = 0; y < 256; y++) - for (x = 0; x < 512; x++) - m_ddenlovr_pixmap[3 - layer][y * 512 + x] = (uint8_t)(m_htengoku_layer.pix16(y, x)); + for (int y = 0; y < 256; y++) + for (int x = 0; x < 512; x++) + m_ddenlovr_pixmap[3 - layer][y * 512 + x] = uint8_t(m_htengoku_layer.pix(y, x)); } return screen_update_ddenlovr(screen, bitmap, cliprect); diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp index f4741f3cfa6..b320fac8a5e 100644 --- a/src/mame/drivers/dec0.cpp +++ b/src/mame/drivers/dec0.cpp @@ -1469,9 +1469,9 @@ static INPUT_PORTS_START( midres ) PORT_DIPUNUSED_DIPLOC( 0x0080, IP_ACTIVE_LOW, "SW1:8" ) // Always OFF PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") + PORT_DIPSETTING( 0x0100, "1" ) PORT_DIPSETTING( 0x0300, "3" ) - PORT_DIPSETTING( 0x0200, "4" ) - PORT_DIPSETTING( 0x0100, "5" ) + PORT_DIPSETTING( 0x0200, "5" ) PORT_DIPSETTING( 0x0000, "Infinite (Cheat)") PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4") PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) ) @@ -1492,17 +1492,6 @@ static INPUT_PORTS_START( midres ) PORT_INCLUDE( rotary_ports ) INPUT_PORTS_END -static INPUT_PORTS_START( midresu ) - PORT_INCLUDE( midres ) - - PORT_MODIFY("DSW") - PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") - PORT_DIPSETTING( 0x0100, "1" ) - PORT_DIPSETTING( 0x0300, "3" ) - PORT_DIPSETTING( 0x0200, "5" ) - PORT_DIPSETTING( 0x0000, "Infinite (Cheat)") -INPUT_PORTS_END - static INPUT_PORTS_START( midresb ) PORT_INCLUDE( dec0 ) @@ -4167,8 +4156,8 @@ GAME( 1989, slyspy, secretag, slyspy, slyspy, dec0_state, init_slysp GAME( 1989, slyspy3, secretag, slyspy, slyspy, dec0_state, init_slyspy, ROT0, "Data East USA", "Sly Spy (US revision 3)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, slyspy2, secretag, slyspy, slyspy, dec0_state, init_slyspy, ROT0, "Data East USA", "Sly Spy (US revision 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, midres, 0, midres, midres, dec0_state, empty_init, ROT0, "Data East Corporation", "Midnight Resistance (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, midresu, midres, midres, midresu, dec0_state, empty_init, ROT0, "Data East USA", "Midnight Resistance (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, midresj, midres, midres, midresu, dec0_state, empty_init, ROT0, "Data East Corporation", "Midnight Resistance (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, midresu, midres, midres, midres, dec0_state, empty_init, ROT0, "Data East USA", "Midnight Resistance (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, midresj, midres, midres, midres, dec0_state, empty_init, ROT0, "Data East Corporation", "Midnight Resistance (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, bouldash, 0, slyspy, bouldash, dec0_state, init_slyspy, ROT0, "Data East Corporation (licensed from First Star)", "Boulder Dash / Boulder Dash Part 2 (World)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, bouldashj, bouldash, slyspy, bouldash, dec0_state, init_slyspy, ROT0, "Data East Corporation (licensed from First Star)", "Boulder Dash / Boulder Dash Part 2 (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp index 0fdd7a79c5e..e443f17e22a 100644 --- a/src/mame/drivers/dec8.cpp +++ b/src/mame/drivers/dec8.cpp @@ -2602,17 +2602,17 @@ ROM_START( gondo ) ROM_REGION( 0x40000, "maincpu", 0 ) ROM_LOAD( "dt00-e.f3", 0x08000, 0x08000, CRC(912a7eee) SHA1(15af89babf166dadaa77640e1973d7ebb4c078db) ) // Verified only DT00-E & DT03-E have the "-E" extention ROM_LOAD( "dt01.f5", 0x10000, 0x10000, CRC(c39bb877) SHA1(9beb59ba19f38417c5d4d36e8f3c41f2b017d2d6) ) - ROM_LOAD( "dt02.f6", 0x20000, 0x10000, CRC(bb5e674b) SHA1(8057dc7464a8b6987536f248d607957923b223cf) ) + ROM_LOAD( "dt02.f6", 0x20000, 0x10000, CRC(925307a4) SHA1(1e8b8eb21df1a11b14c981b343b34c6cc3676517) ) // same label as the US version, but content identical to Japanese version ROM_LOAD( "dt03-e.f7", 0x30000, 0x10000, CRC(ee7475eb) SHA1(8c68198ea1c3e89c9c2c4ba0e5d3f47afb8eecd4) ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "dt05-e.h5", 0x8000, 0x8000, CRC(ec08aa29) SHA1(ce83974ae095d9518d1ebf9f7e712f0cbc2c1b42) ) ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "dt-e.b1", 0x0000, 0x1000, NO_DUMP ) // No decapped dump or hand crafted code for this set + ROM_LOAD( "dt-e.b1", 0x0000, 0x1000, BAD_DUMP CRC(0d0532ec) SHA1(30894f69ff24c1be4b684e07729bbb3e0f353086) ) // hand-crafted from the US version ROM_REGION( 0x08000, "gfx1", 0 ) /* characters */ - ROM_LOAD( "dt14.b18", 0x00000, 0x08000, CRC(4bef16e1) SHA1(b8157a7a1b8f36cea1fd353267a4e03d920cb4aa) ) + ROM_LOAD( "dt14-e.b18", 0x00000, 0x08000, CRC(00cbe9c8) SHA1(de7b640de8fd54ee79194945c96d5768d09f483b) ) // identical to Japanese version ROM_REGION( 0x80000, "gfx2", 0 ) /* sprites */ ROM_LOAD( "dt19.f13", 0x00000, 0x10000, CRC(da2abe4b) SHA1(d53e4769671f3fd437edcff7e7ea05156bbcb45d) ) // All sprite data matches the Japanese set @@ -3729,7 +3729,7 @@ GAME( 1986, lastmisnu5, lastmisn, lastmisn, lastmisn, dec8_state, init_dec8, GAME( 1986, lastmisnj, lastmisn, lastmisn, lastmisnj, dec8_state, init_dec8, ROT270, "Data East Corporation", "Last Mission (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, shackled, 0, shackled, shackled, dec8_state, init_dec8, ROT0, "Data East USA", "Shackled (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, breywood, shackled, shackled, breywood, dec8_state, init_dec8, ROT0, "Data East Corporation", "Breywood (Japan revision 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, gondo, 0, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East Corporation", "Gondomania (World)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // i8751 protection MCU not dumped +GAME( 1987, gondo, 0, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East Corporation", "Gondomania (World)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, gondou, gondo, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East USA", "Gondomania (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, makyosen, gondo, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East Corporation", "Makyou Senshi (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, garyoret, 0, garyoret, garyoret, dec8_state, init_dec8, ROT0, "Data East Corporation", "Garyo Retsuden (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp index c74c7a8aaf8..5154be2e8c6 100644 --- a/src/mame/drivers/deco_mlc.cpp +++ b/src/mame/drivers/deco_mlc.cpp @@ -92,13 +92,14 @@ Driver TODO: stadhr96 - protection? issues (or 156 co-processor? or timing?) avengrgs - doesn't generate enough line interrupts? - ddream95 seems to have a dual screen mode(??) - skullfng - slowdowns not verified from real PCB, Random hangs sometimes + ddream95 - seems to have a dual screen mode(??) + skullfng - slowdowns not verified from real PCB, random hangs sometimes Graphic TODO: - blending, raster effect features isn't fully emulated, verified currently - Not verified : Can sprites effect 8bpp and shadowing simultaneously? - Not verified what palette highest bits actually doing + blending, raster effect features aren't fully emulated, verified currently + Not verified : Can sprites affect 8bpp and shadowing simultaneously? + Not verified what palette highest bits actually do + Zoom algorithm is incorrect/unverified, reference: https://www.youtube.com/watch?v=eCwAVt0GbhQ Driver by Bryan McPhail, bmcphail@tendril.co.uk, thank you to Avedis and The Guru. @@ -186,7 +187,7 @@ void deco_mlc_state::eeprom_w(offs_t offset, u32 data, u32 mem_mask) } else if (ACCESSING_BITS_0_7) { - /* Master volume control (TODO: probably logaritmic) */ + // Master volume control (TODO: probably logarithmic) m_ymz->set_output_gain(0, (255.0 - data) / 255.0); m_ymz->set_output_gain(1, (255.0 - data) / 255.0); } @@ -206,14 +207,14 @@ void deco_mlc_state::irq_ram_w(offs_t offset, u32 data, u32 mem_mask) COMBINE_DATA(&m_irq_ram[offset]); /* - TODO : Accurate this from real PCB - Word 0 : Used but Unknown + TODO : Verify this on real PCB + Word 0 : Used but unknown skullfng : 0x00000cf3 hoops** : 0xffffdfff avengrgs : 0x00000cd3 stadhr96 : 0x000028f3 - Word 1 : 0xc0 at shadow, 0x00 at alpha, Other bits unknown + Word 1 : 0xc0 at shadow, 0x00 at alpha, other bits unknown skullfng : 0x000000c0 or 0x00000000 hoops** : 0xfffffffc avengrgs : 0xffffffff @@ -230,10 +231,10 @@ void deco_mlc_state::irq_ram_w(offs_t offset, u32 data, u32 mem_mask) switch (offset * 4) { - case 0x10: /* IRQ ack. Value written doesn't matter */ + case 0x10: // IRQ ack. Value written doesn't matter m_maincpu->set_input_line(m_irqLevel, CLEAR_LINE); return; - case 0x14: /* Prepare scanline interrupt */ + case 0x14: // Prepare scanline interrupt if(m_irq_ram[0x14 / 4] == -1) // TODO: likely to be anything that doesn't fit into the screen v-pos range. m_raster_irq_timer->adjust(attotime::never); else @@ -323,7 +324,7 @@ void deco_mlc_state::avengrgs_map(address_map &map) map(0x0600000, 0x0600007).rw(m_ymz, FUNC(ymz280b_device::read), FUNC(ymz280b_device::write)).umask32(0xff000000).mirror(0xff000000); } -void deco_mlc_state::decomlc_map(address_map &map) +void deco_mlc_state::decomlc_no146_map(address_map &map) { map(0x0000000, 0x00fffff).rom(); map(0x0100000, 0x011ffff).ram().share("mainram"); @@ -344,6 +345,12 @@ void deco_mlc_state::decomlc_map(address_map &map) map(0x044001c, 0x044001f).rw(FUNC(deco_mlc_state::mlc_44001c_r), FUNC(deco_mlc_state::mlc_44001c_w)); map(0x0500000, 0x0500003).w(FUNC(deco_mlc_state::eeprom_w)); map(0x0600000, 0x0600007).rw(m_ymz, FUNC(ymz280b_device::read), FUNC(ymz280b_device::write)).umask32(0xff000000); +} + +void deco_mlc_state::decomlc_146_map(address_map &map) +{ + decomlc_no146_map(map); + map(0x070f000, 0x070ffff).rw(FUNC(deco_mlc_state::sh96_protection_region_0_146_r), FUNC(deco_mlc_state::sh96_protection_region_0_146_w)).umask32(0xffff0000); } @@ -494,6 +501,18 @@ static const gfx_layout spritelayout_6bpp = 16*32 }; +static const gfx_layout spritelayout_acchi = +{ + 16,16, + RGN_FRAC(1,5), + 5, + { RGN_FRAC(0,5), RGN_FRAC(1,5), RGN_FRAC(2,5), RGN_FRAC(3,5), RGN_FRAC(4,5) }, + { 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 }, + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, + 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, + 16*16 +}; + static GFXDECODE_START( gfx_deco_mlc ) GFXDECODE_ENTRY( "gfx1", 0, spritelayout_4bpp, 0, 256 ) GFXDECODE_END @@ -506,6 +525,10 @@ static GFXDECODE_START( gfx_6bpp ) GFXDECODE_ENTRY( "gfx1", 0, spritelayout_6bpp, 0, 64 ) GFXDECODE_END +static GFXDECODE_START( gfx_acchi ) + GFXDECODE_ENTRY( "gfx1", 0, spritelayout_acchi, 0, 64 ) +GFXDECODE_END + /******************************************************************************/ void deco_mlc_state::machine_reset() @@ -515,15 +538,15 @@ void deco_mlc_state::machine_reset() void deco_mlc_state::avengrgs(machine_config &config) { - /* basic machine hardware */ - SH2(config, m_maincpu, 42000000/2); /* 21 MHz clock confirmed on real board */ + // basic machine hardware + SH2(config, m_maincpu, 42000000/2); // 21 MHz clock confirmed on real board m_maincpu->set_addrmap(AS_PROGRAM, &deco_mlc_state::avengrgs_map); - EEPROM_93C46_16BIT(config, m_eeprom); /* Actually 93c45 */ + EEPROM_93C46_16BIT(config, m_eeprom); // Actually 93c45 TIMER(config, m_raster_irq_timer).configure_generic(FUNC(deco_mlc_state::interrupt_gen)); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(58); m_screen->set_size(40*8, 32*8); @@ -536,7 +559,7 @@ void deco_mlc_state::avengrgs(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048); m_palette->set_membits(16); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -547,15 +570,15 @@ void deco_mlc_state::avengrgs(machine_config &config) void deco_mlc_state::mlc(machine_config &config) { - /* basic machine hardware */ - ARM(config, m_maincpu, 42000000/6); /* 42 MHz -> 7MHz clock confirmed on real board */ - m_maincpu->set_addrmap(AS_PROGRAM, &deco_mlc_state::decomlc_map); + // basic machine hardware + ARM(config, m_maincpu, 42000000/6); // 42 MHz -> 7MHz clock confirmed on real board + m_maincpu->set_addrmap(AS_PROGRAM, &deco_mlc_state::decomlc_no146_map); - EEPROM_93C46_16BIT(config, m_eeprom); /* Actually 93c45 */ + EEPROM_93C46_16BIT(config, m_eeprom); // Actually 93c45 TIMER(config, m_raster_irq_timer).configure_generic(FUNC(deco_mlc_state::interrupt_gen)); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(58); m_screen->set_size(40*8, 32*8); @@ -568,10 +591,7 @@ void deco_mlc_state::mlc(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048); m_palette->set_membits(16); - DECO146PROT(config, m_deco146, 0); - m_deco146->set_use_magic_read_address_xor(true); - - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -598,6 +618,23 @@ void deco_mlc_state::mlc_5bpp(machine_config &config) m_ymz->add_route(0, "rspeaker", 1.0); } +void deco_mlc_state::stadhr96(machine_config &config) +{ + mlc_6bpp(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &deco_mlc_state::decomlc_146_map); + + DECO146PROT(config, m_deco146, 0); + m_deco146->set_use_magic_read_address_xor(true); +} + +void deco_mlc_state::acchi(machine_config &config) +{ + mlc(config); + + m_gfxdecode->set_info(gfx_acchi); +} + /***************************************************************************/ /* @@ -680,8 +717,8 @@ ROM_END ROM_START( stadhr96 ) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD32_WORD( "sh-eaj.2a", 0x000000, 0x80000, CRC(10d1496a) SHA1(1dc151547463a38d717159b3dfce7ffd78a943ad) ) /* FRI SEP 20 14:32:35 JST 1996 */ - ROM_LOAD32_WORD( "sh-eaj.2b", 0x000002, 0x80000, CRC(608a9144) SHA1(15e2fa99dc96e8ebd9868713ae7708cb824fc6c5) ) /* EUROPE (DISTRIBUTED) */ + ROM_LOAD32_WORD( "sh-eaj.2a", 0x000000, 0x80000, CRC(10d1496a) SHA1(1dc151547463a38d717159b3dfce7ffd78a943ad) ) // FRI SEP 20 14:32:35 JST 1996 + ROM_LOAD32_WORD( "sh-eaj.2b", 0x000002, 0x80000, CRC(608a9144) SHA1(15e2fa99dc96e8ebd9868713ae7708cb824fc6c5) ) // EUROPE (DISTRIBUTED) ROM_REGION( 0x1800000, "gfx1", 0 ) ROM_LOAD16_BYTE( "mcm-00.2e", 0x0000001, 0x400000, CRC(c1919c3c) SHA1(168000ff1512a147d7029ee8878dd70de680fb08) ) @@ -703,8 +740,8 @@ ROM_END ROM_START( stadhr96u ) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD32_WORD( "eah00-0.2a", 0x000000, 0x80000, CRC(f45b2ca0) SHA1(442dbfea97abb98451b323986878504ac0370e85) ) /* FRI SEP 20 14:01:45 JST 1996 */ - ROM_LOAD32_WORD( "eah01-0.2b", 0x000002, 0x80000, CRC(328a2bca) SHA1(7e398b48719e5d71b2212d5b65be667e20663589) ) /* U.S.A. */ + ROM_LOAD32_WORD( "eah00-0.2a", 0x000000, 0x80000, CRC(f45b2ca0) SHA1(442dbfea97abb98451b323986878504ac0370e85) ) // FRI SEP 20 14:01:45 JST 1996 + ROM_LOAD32_WORD( "eah01-0.2b", 0x000002, 0x80000, CRC(328a2bca) SHA1(7e398b48719e5d71b2212d5b65be667e20663589) ) // U.S.A. ROM_REGION( 0x1800000, "gfx1", 0 ) ROM_LOAD16_BYTE( "mcm-00.2e", 0x0000001, 0x400000, CRC(c1919c3c) SHA1(168000ff1512a147d7029ee8878dd70de680fb08) ) @@ -726,8 +763,8 @@ ROM_END ROM_START( stadhr96j ) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD32_WORD( "ead00-4.2a", 0x000000, 0x80000, CRC(b0adfc39) SHA1(3094dfb7c7f8fa9d7e10d98dff8fb8aba285d710) ) /* WED SEP 5 00:00:00 JST 1996 (FINAL) */ - ROM_LOAD32_WORD( "ead01-4.2b", 0x000002, 0x80000, CRC(0b332820) SHA1(28b757fe529250711fcb82424ba63c222a9329b9) ) /* JAPAN */ + ROM_LOAD32_WORD( "ead00-4.2a", 0x000000, 0x80000, CRC(b0adfc39) SHA1(3094dfb7c7f8fa9d7e10d98dff8fb8aba285d710) ) // WED SEP 5 00:00:00 JST 1996 (FINAL) + ROM_LOAD32_WORD( "ead01-4.2b", 0x000002, 0x80000, CRC(0b332820) SHA1(28b757fe529250711fcb82424ba63c222a9329b9) ) // JAPAN ROM_REGION( 0x1800000, "gfx1", 0 ) ROM_LOAD16_BYTE( "mcm-00.2e", 0x0000001, 0x400000, CRC(c1919c3c) SHA1(168000ff1512a147d7029ee8878dd70de680fb08) ) @@ -913,11 +950,37 @@ ROM_START( skullfnga ) ROM_LOAD( "skullfng.eeprom", 0x00, 0x80, CRC(240d882e) SHA1(3c1a15ccac91d95b02a8c54b051aa64ff28ce2ab) ) ROM_END +ROM_START( acchi ) // DE-0444-1 + DE-0457-0 + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD32_WORD( "eaa-00-3.l10", 0x000000, 0x80000, CRC(faff1710) SHA1(b28d210b16b7a0a818ecfeb59696b093be27dc2b) ) + ROM_LOAD32_WORD( "eaa-01-3.l11", 0x000002, 0x80000, CRC(00510371) SHA1(1beef396065c10e5f16b80a92d960abcd4838363) ) + + ROM_REGION( 0x1400000, "gfx1", 0 ) + ROM_LOAD16_BYTE( "faa-09-0.c2", 0x0000000, 0x200000, CRC(b616058f) SHA1(9dd8f259f08b76e177fc2a266159e4a716b5f4c6) ) + ROM_LOAD16_BYTE( "faa-08-0.c1", 0x0000001, 0x200000, CRC(70ba2149) SHA1(fbcf7c65021e55ed74b0333852860bfb56f05cab) ) + ROM_LOAD16_BYTE( "faa-07-0.h2", 0x0400000, 0x200000, CRC(60028a62) SHA1(883935cb5421b344c9a83665a6bbdcff4986f1e7) ) + ROM_LOAD16_BYTE( "faa-05-0.h1", 0x0400001, 0x200000, CRC(1e7a7a0a) SHA1(09333289177aa102ca082f55d27c453037769b4c) ) + ROM_LOAD16_BYTE( "faa-06-0.f2", 0x0800000, 0x200000, CRC(5538ff81) SHA1(f68369a0ee25fe5ac3ce5f36c56ca72e46a08279) ) + ROM_LOAD16_BYTE( "faa-04-0.f1", 0x0800001, 0x200000, CRC(35280765) SHA1(9dcee2724f16fa5c371bf89a4257bbb7eb25f733) ) + ROM_LOAD16_BYTE( "faa-03-0.e2", 0x0c00000, 0x200000, CRC(af457714) SHA1(dcb94ac0cc632a9d84bb896588f33b47bf87a695) ) + ROM_LOAD16_BYTE( "faa-01-0.e1", 0x0c00001, 0x200000, CRC(a245270b) SHA1(a2279af96878fb099f8c1e67c2ecf3d0254b36a3) ) + ROM_LOAD16_BYTE( "faa-02-0.b2", 0x1000000, 0x200000, CRC(bdf75bd6) SHA1(f271192a851e3750beeea6033dc43df614967de1) ) + ROM_LOAD16_BYTE( "faa-00-0.b1", 0x1000001, 0x200000, CRC(2cf34cd6) SHA1(4d96ca597ad84bedabf53dc17a976f0d95ab99b4) ) + // there are two unpopulated IC spaces at d1 and d2 + + ROM_REGION( 0x80000, "gfx2", 0 ) + ROM_LOAD( "eaa-02-0.l12", 0x000000, 0x80000, CRC(09baf624) SHA1(548269cead3204c6d269955f5b91937a231bd6af) ) + + ROM_REGION( 0x400000, "ymz", ROMREGION_ERASE00 ) + ROM_LOAD( "faa-10-0.a5", 0x000000, 0x200000, CRC(9f280e5f) SHA1(47c3532b4142ff677f4f0b763ba142883ba3d545) ) + ROM_LOAD( "faa-11-0.a7", 0x200000, 0x200000, CRC(3775ae66) SHA1(28208d6fee4bf638545dc6b002c900dbb7ab85b0) ) +ROM_END + /***************************************************************************/ void deco_mlc_state::descramble_sound( ) { - /* the same as simpl156 / heavy smash? */ + // the same as simpl156 / heavy smash? u8 *rom = memregion("ymz")->base(); int length = memregion("ymz")->bytes(); std::vector<u8> buf(length); @@ -978,17 +1041,26 @@ void deco_mlc_state::init_mlc() descramble_sound(); } +void deco_mlc_state::init_acchi() // sound ROMs don't appear to be scrambled +{ + m_maincpu->set_clock_scale(2.0f); // avoids hangs in attract mode / end of round, see init_mlc() + m_irqLevel = ARM_IRQ_LINE; + deco156_decrypt(machine()); +} + + /***************************************************************************/ -GAME( 1995, avengrgs, 0, avengrgs, mlc, deco_mlc_state, init_avengrgs, ROT0, "Data East Corporation", "Avengers In Galactic Storm (US/Europe 1.0)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1995, avengrgsj, avengrgs, avengrgs, mlc, deco_mlc_state, init_avengrgs, ROT0, "Data East Corporation", "Avengers In Galactic Storm (Japan 1.2)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1996, stadhr96, 0, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (Europe, EAJ)", MACHINE_IMPERFECT_GRAPHICS ) // Rom labels are EAJ ^^ -GAME( 1996, stadhr96u, stadhr96, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (USA, EAH)", MACHINE_IMPERFECT_GRAPHICS ) // Rom labels are EAH ^^ -GAME( 1996, stadhr96j, stadhr96, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (Japan, EAD)", MACHINE_IMPERFECT_GRAPHICS ) // Rom labels are EAD (this isn't a Konami region code!) -GAME( 1996, stadhr96j2,stadhr96, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (Japan?, EAE)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rom labels are EAE ^^ -GAME( 1996, skullfng, 0, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT270, "Data East Corporation", "Skull Fang (Europe 1.13)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) /* Version 1.13, Europe, Master 96.02.19 13:45 */ -GAME( 1996, skullfngj, skullfng, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT270, "Data East Corporation", "Skull Fang (Japan 1.09)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) /* Version 1.09, Japan, Master 96.02.08 14:39 */ -GAME( 1996, skullfnga, skullfng, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT270, "Data East Corporation", "Skull Fang (Asia 1.13)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) /* Version 1.13, Asia, Master 96.02.19 13:49 */ -GAME( 1996, hoops96, 0, mlc_5bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Hoops '96 (Europe/Asia 2.0)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1995, ddream95, hoops96, mlc_5bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Dunk Dream '95 (Japan 1.4, EAM)", MACHINE_IMPERFECT_GRAPHICS ) -GAME( 1995, hoops95, hoops96, mlc_5bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Hoops (Europe/Asia 1.7)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1995, avengrgs, 0, avengrgs, mlc, deco_mlc_state, init_avengrgs, ROT0, "Data East Corporation", "Avengers In Galactic Storm (US/Europe 1.0)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1995, avengrgsj, avengrgs, avengrgs, mlc, deco_mlc_state, init_avengrgs, ROT0, "Data East Corporation", "Avengers In Galactic Storm (Japan 1.2)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1996, stadhr96, 0, stadhr96, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (Europe, EAJ)", MACHINE_IMPERFECT_GRAPHICS ) // Rom labels are EAJ ^^ +GAME( 1996, stadhr96u, stadhr96, stadhr96, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (USA, EAH)", MACHINE_IMPERFECT_GRAPHICS ) // Rom labels are EAH ^^ +GAME( 1996, stadhr96j, stadhr96, stadhr96, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (Japan, EAD)", MACHINE_IMPERFECT_GRAPHICS ) // Rom labels are EAD (this isn't a Konami region code!) +GAME( 1996, stadhr96j2, stadhr96, stadhr96, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Stadium Hero '96 (Japan?, EAE)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Rom labels are EAE ^^ +GAME( 1996, skullfng, 0, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT270, "Data East Corporation", "Skull Fang (Europe 1.13)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Version 1.13, Europe, Master 96.02.19 13:45 +GAME( 1996, skullfngj, skullfng, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT270, "Data East Corporation", "Skull Fang (Japan 1.09)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Version 1.09, Japan, Master 96.02.08 14:39 +GAME( 1996, skullfnga, skullfng, mlc_6bpp, mlc, deco_mlc_state, init_mlc, ROT270, "Data East Corporation", "Skull Fang (Asia 1.13)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Version 1.13, Asia, Master 96.02.19 13:49 +GAME( 1996, hoops96, 0, mlc_5bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Hoops '96 (Europe/Asia 2.0)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1995, ddream95, hoops96, mlc_5bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Dunk Dream '95 (Japan 1.4, EAM)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1995, hoops95, hoops96, mlc_5bpp, mlc, deco_mlc_state, init_mlc, ROT0, "Data East Corporation", "Hoops (Europe/Asia 1.7)", MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1995, acchi, 0, acchi, mlc, deco_mlc_state, init_acchi, ROT0, "Data East Corporation", "Janken Game Acchi Muite Hoi! (Japan 1.3)", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/decstation.cpp b/src/mame/drivers/decstation.cpp index 36125d8c584..aa0ecc18f17 100644 --- a/src/mame/drivers/decstation.cpp +++ b/src/mame/drivers/decstation.cpp @@ -171,17 +171,14 @@ void decstation_state::video_start() uint32_t decstation_state::kn01_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - uint8_t *vram = (uint8_t *)m_kn01vram.target(); + uint8_t const *const vram = (uint8_t *)m_kn01vram.target(); - for (y = 0; y < 864; y++) + for (int y = 0; y < 864; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024; x++) { - pixels = vram[(y * 1024) + x]; + uint8_t const pixels = vram[(y * 1024) + x]; *scanline++ = m_palette[pixels]; } } diff --git a/src/mame/drivers/decwritr.cpp b/src/mame/drivers/decwritr.cpp index b5b32b2ee71..84133c2e05c 100644 --- a/src/mame/drivers/decwritr.cpp +++ b/src/mame/drivers/decwritr.cpp @@ -19,7 +19,7 @@ #include "machine/i8251.h" #include "machine/input_merger.h" #include "sound/beep.h" -#include "render.h" +#include "screen.h" #include "speaker.h" diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp index 8d328ae2003..fd863440050 100644 --- a/src/mame/drivers/destroyr.cpp +++ b/src/mame/drivers/destroyr.cpp @@ -174,7 +174,7 @@ uint32_t destroyr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int i = 0; i < 256; i++) { if (i & 4) - bitmap.pix16(m_cursor ^ 0xff, i) = 7; + bitmap.pix(m_cursor ^ 0xff, i) = 7; } return 0; } diff --git a/src/mame/drivers/dgpix.cpp b/src/mame/drivers/dgpix.cpp index 29484abd2d0..e06bdcb99b2 100644 --- a/src/mame/drivers/dgpix.cpp +++ b/src/mame/drivers/dgpix.cpp @@ -419,8 +419,8 @@ u32 dgpix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { int x = cliprect.left(); - u16 *src = &m_vram[(m_vbuffer ? 0 : 0x20000) | (y << 9) | x]; - u16 *dest = &bitmap.pix16(y, x); + u16 const *src = &m_vram[(m_vbuffer ? 0 : 0x20000) | (y << 9) | x]; + u16 *dest = &bitmap.pix(y, x); for (; x <= cliprect.right(); x++) { diff --git a/src/mame/drivers/dim68k.cpp b/src/mame/drivers/dim68k.cpp index ebb3ce6763d..b2937aaef95 100644 --- a/src/mame/drivers/dim68k.cpp +++ b/src/mame/drivers/dim68k.cpp @@ -234,20 +234,20 @@ void dim68k_state::machine_reset() // Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used. MC6845_UPDATE_ROW( dim68k_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,x,xx,inv; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint16_t chr16=0x2020; // set to spaces if screen is off - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); u8 screen_on = ~m_video_control & 4; u8 dot8 = ~m_video_control & 40; // need to divide everything in half to cater for 16-bit reads x_count /= 2; ma /= 2; - xx = 0; + u8 xx = 0; - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { + u8 inv, chr, gfx; if (screen_on) chr16 = m_ram[ma+x]; // reads 2 characters diff --git a/src/mame/drivers/dkmb.cpp b/src/mame/drivers/dkmb.cpp index 5a83f16b125..715c0c03bbb 100644 --- a/src/mame/drivers/dkmb.cpp +++ b/src/mame/drivers/dkmb.cpp @@ -67,11 +67,11 @@ uint32_t dkmb_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, int count = 0; for (int y = 0; y < 256; y++) { - uint32_t* dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = 0; x < 1024 / 2; x++) { - uint64_t val = m_framebuffer[count]; + uint64_t const val = m_framebuffer[count]; dst[(x * 2) + 0] = (val >> 32) & 0x00ffffff; dst[(x * 2) + 1] = (val >> 0) & 0x00ffffff; diff --git a/src/mame/drivers/dlair.cpp b/src/mame/drivers/dlair.cpp index b914c58b35c..496ad516322 100644 --- a/src/mame/drivers/dlair.cpp +++ b/src/mame/drivers/dlair.cpp @@ -46,7 +46,6 @@ #include "sound/ay8910.h" #include "sound/spkrdev.h" #include "emupal.h" -#include "render.h" #include "speaker.h" #include "dlair.lh" diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index ced56a6fb8c..ba0a6881739 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -315,17 +315,17 @@ UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) for(int xi=0; xi<16; xi++) { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; + int r = BIT(red, xi) ? 255 : 0; + int g = BIT(green, xi) ? 255 : 0; + int b = BIT(blue, xi) ? 255 : 0; if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + bitmap.pix(y, x + xi) = rgb_t(r, g, b); } } else { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // 32KB videoram uint16_t gfx = m_video_ram[(address & 0xffff) >> 1]; @@ -333,7 +333,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) for(int xi=0;xi<16;xi++) { if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = ((gfx >> xi) & 1) ? palette[2] : palette[0]; + bitmap.pix(y, x + xi) = ((gfx >> xi) & 1) ? palette[2] : palette[0]; } } } @@ -367,18 +367,17 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) for( int xi = 0; xi < 8; xi++) { - int res_x,res_y; int pen = (tile_data >> xi) & 1 ? 1 : 0; - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; if(yi >= 16) { pen = 0; } - bitmap.pix32(res_y, res_x) = pen ? fg : bg; + bitmap.pix(res_y, res_x) = pen ? fg : bg; } } } diff --git a/src/mame/drivers/dolphunk.cpp b/src/mame/drivers/dolphunk.cpp index 94a05ae39ce..ae6cd62068b 100644 --- a/src/mame/drivers/dolphunk.cpp +++ b/src/mame/drivers/dolphunk.cpp @@ -2,51 +2,51 @@ // copyright-holders:Robbbert /*************************************************************************** - Dolphin / Dauphin - - 2010-04-08 Skeleton driver. - 2012-05-20 Fixed keyboard, added notes & speaker [Robbbert] - 2013-11-03 Added cassette [Robbbert] - - Minimal Setup: - 0000-00FF ROM "MO" (74S471) - 0100-01FF ROM "MONI" (74S471) - 0200-02FF RAM (2x 2112) - 18 pushbuttons for programming (0-F, ADR, NXT). - 4-digit LED display. - - Other options: - 0400-07FF Expansion RAM (8x 2112) - 0800-08FF Pulse for operation of an optional EPROM programmer - 0C00-0FFF ROM "MONA" (2708) - LEDs connected to all Address and Data Lines - LEDs connected to WAIT and FLAG lines. - Speaker with a LED wired across it. - PAUSE switch. - RUN/STOP switch. - STEP switch. - CLOCK switch. - - Cassette player connected to SENSE and FLAG lines. - - Keyboard encoder: AY-5-2376 (57 keys) - - CRT interface: (512 characters on a separate bus) - 2114 video ram (one half holds the lower 4 data bits, other half the upper bits) - 74LS175 holds the upper bits for the 74LS472 - 74LS472 Character Generator - - NOTE: a rom is missing, when the ADR button (- key) is pressed, - it causes a freeze in nodebug mode, and a crash in debug mode. - To see it, start in debug mode. g 6c. In the emulation, press the - minus key. The debugger will stop and you can see an instruction - referencing location 0100, which is in the missing rom. - - Keys: - 0-9,A-F hexadecimal numbers - UP - (NXT) to enter data and advance to the next address - MINUS - (ADR) to change the address to what is shown in the data side - Special keys: +Dolphin / Dauphin + +2010-04-08 Skeleton driver. +2012-05-20 Fixed keyboard, added notes & speaker [Robbbert] +2013-11-03 Added cassette [Robbbert] + +Minimal Setup: + 0000-00FF ROM "MO" (74S471) + 0100-01FF ROM "MONI" (74S471) + 0200-02FF RAM (2x 2112) + 18 pushbuttons for programming (0-F, ADR, NXT). + 4-digit LED display. + +Other options: + 0400-07FF Expansion RAM (8x 2112) + 0800-08FF Pulse for operation of an optional EPROM programmer + 0C00-0FFF ROM "MONA" (2708) + LEDs connected to all Address and Data Lines + LEDs connected to WAIT and FLAG lines. + Speaker with a LED wired across it. + PAUSE switch. + RUN/STOP switch. + STEP switch. + CLOCK switch. + +Cassette player connected to SENSE and FLAG lines. + +Keyboard encoder: AY-5-2376 (57 keys) + +CRT interface: (512 characters on a separate bus) + 2114 video ram (one half holds the lower 4 data bits, other half the upper bits) + 74LS175 holds the upper bits for the 74LS472 + 74LS472 Character Generator + +NOTE: a rom is missing, when the ADR button (- key) is pressed, + it causes a freeze in nodebug mode, and a crash in debug mode. + To see it, start in debug mode. g 6c. In the emulation, press the + minus key. The debugger will stop and you can see an instruction + referencing location 0100, which is in the missing rom. + +Keys: + 0-9,A-F hexadecimal numbers + UP - (NXT) to enter data and advance to the next address + MINUS - (ADR) to change the address to what is shown in the data side + Special keys: Hold UP, hold 0, release UP, release 0 - execute program at the current address (i.e. 2xx) Hold UP, hold 1, release UP, release 1 - execute program at address 0C00 (rom MONA) Hold UP, hold 2, release UP, release 2 - play a tune with the keys @@ -54,28 +54,32 @@ Hold MINUS, hold any hex key, release MINUS, release other key - execute program at the current address-0x100 (i.e. 1xx). - If you want to scan through other areas of memory (e.g. the roms), alter the - data at address 2F9 (high byte) and 2FA (low byte). +If you want to scan through other areas of memory (e.g. the roms), alter the +data at address 2F9 (high byte) and 2FA (low byte). - How to Use: - The red digits are the address, and the orange digits are the data. - The address range is 200-2FF (the 2 isn't displayed). To select an address, - either press the UP key until you get there, or type the address and press - minus. The orange digits show the current data at that address. To alter - data, just type it in and press UP. +How to Use: + The red digits are the address, and the orange digits are the data. + The address range is 200-2FF (the 2 isn't displayed). To select an address, + either press the UP key until you get there, or type the address and press + minus. The orange digits show the current data at that address. To alter + data, just type it in and press UP. - To play the reflexes game, hold UP, press 1, release UP, release 1. - The display will show A--0 (or some random number in the last position). - Press any odd-numbered key (B is convenient), and read off the reaction time. - After a short delay it will show '--' again, this is the signal to react. - It doesn't seem to reset the counters each time around. +To play the reflexes game, hold UP, press 1, release UP, release 1. + The display will show A--0 (or some random number in the last position). + Press any odd-numbered key (B is convenient), and read off the reaction time. + After a short delay it will show '--' again, this is the signal to react. + It doesn't seem to reset the counters each time around. - TODO: - - Find missing roms - - Add optional hardware listed above - - Cassette is added, but no idea how to operate it. +Test Paste: + Paste this: 11^22^33^44^55^66^77^88^99^00- + Now press up-arrow to review the data that was entered. - Thanks to Amigan site for various documents. +TODO: + - Find missing roms + - Add optional hardware listed above + - Cassette is added, but no idea how to operate it. + +Thanks to Amigan site for various documents. ****************************************************************************/ diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp index c1498e8e5ce..c8fc3ac0278 100644 --- a/src/mame/drivers/dooyong.cpp +++ b/src/mame/drivers/dooyong.cpp @@ -770,9 +770,9 @@ u32 popbingo_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 & for (int y = cliprect.top(); cliprect.bottom() >= y; y++) { - const u16 *const bg_src(&m_bg_bitmap[0].pix16(y, 0)); - const u16 *const bg2_src(&m_bg_bitmap[1].pix16(y, 0)); - u16 *const dst(&bitmap.pix16(y, 0)); + const u16 *const bg_src(&m_bg_bitmap[0].pix(y, 0)); + const u16 *const bg2_src(&m_bg_bitmap[1].pix(y, 0)); + u16 *const dst(&bitmap.pix(y, 0)); for (int x = cliprect.left(); cliprect.right() >= x; x++) dst[x] = 0x100U | (bg_src[x] << 4) | bg2_src[x]; } diff --git a/src/mame/drivers/dorachan.cpp b/src/mame/drivers/dorachan.cpp index fc0e8a74f96..54820630f8c 100644 --- a/src/mame/drivers/dorachan.cpp +++ b/src/mame/drivers/dorachan.cpp @@ -74,8 +74,6 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg { for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - uint8_t fore_color; - uint8_t x = offs >> 8 << 3; uint8_t y = offs & 0xff; @@ -84,6 +82,7 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg uint8_t data = m_videoram[offs]; + uint8_t fore_color; if (m_flip_screen) fore_color = (m_colors[color_address] >> 3) & 0x07; else @@ -92,7 +91,7 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg for (int i = 0; i < 8; i++) { uint8_t color = BIT(data, i) ? fore_color : 0; - bitmap.pix32(y, x++) = m_palette->pen_color(color); + bitmap.pix(y, x++) = m_palette->pen_color(color); } } diff --git a/src/mame/drivers/dotrikun.cpp b/src/mame/drivers/dotrikun.cpp index 9fb00be2adf..3f56aeafaa1 100644 --- a/src/mame/drivers/dotrikun.cpp +++ b/src/mame/drivers/dotrikun.cpp @@ -130,7 +130,7 @@ uint32_t dotrikun_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if ((x & 7) == 0) m_vram_latch = m_vram[x >> 3 | y >> 1 << 4]; - bitmap.pix16(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3; + bitmap.pix(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3; } } diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index 1179cf9a0aa..87b278a2638 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -47,8 +47,8 @@ #define LOG_SIZE_CARD (1 << 14) #define LOG_FILTER_CARD (1 << 15) #define LOG_KEYBC (1 << 16) -#define LOG_TDS (1 << 17) -#define LOG_TABLET (1 << 18) +#define LOG_TDS (1 << 17) +#define LOG_TABLET (1 << 18) #define LOG_ALL (LOG_UNKNOWN | LOG_CSR | LOG_CTRLBUS | LOG_SYS_CTRL | LOG_FDC_CTRL | LOG_FDC_PORT | LOG_FDC_CMD | LOG_FDC_MECH | LOG_BRUSH_ADDR | \ LOG_STORE_ADDR | LOG_COMBINER | LOG_SIZE_CARD | LOG_FILTER_CARD) @@ -1068,8 +1068,8 @@ void dpb7000_state::device_timer(emu_timer &timer, device_timer_id id, int param MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row) { - const pen_t *pen = m_palette->pens(); - const uint8_t *char_rom = m_vdu_char_rom->base(); + const pen_t *const pen = m_palette->pens(); + const uint8_t *const char_rom = m_vdu_char_rom->base(); for (int column = 0; column < x_count; column++) { @@ -1087,7 +1087,7 @@ MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row) int x = (column * 8) + bit; int color = BIT(data, 7) && de; - bitmap.pix32(y, x) = pen[color]; + bitmap.pix(y, x) = pen[color]; data <<= 1; } @@ -2396,9 +2396,9 @@ uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 { for (int py = 0; py < 768; py++) { - uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; - uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; - uint32_t *dst = &bitmap.pix32(py); + const uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; + const uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; + uint32_t *dst = &bitmap.pix(py); for (int px = 0; px < 800; px++) { const uint32_t u = *src_chr++ << 16; @@ -2412,9 +2412,9 @@ uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 { for (int py = 512; py < 768; py++) { - uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; - uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; - uint32_t *dst = &bitmap.pix32(py); + const uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; + const uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; + uint32_t *dst = &bitmap.pix(py); for (int px = 0; px < 256; px += 2) { const uint32_t u = *src_chr++ << 16; diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp index 2e5df2d838f..570716dd2da 100644 --- a/src/mame/drivers/dragon.cpp +++ b/src/mame/drivers/dragon.cpp @@ -2,10 +2,12 @@ // copyright-holders:Nathan Woods /*************************************************************************** - dragon.c + dragon.cpp Dragon + Bug? dragon200e hangs when single-quote is typed. + ***************************************************************************/ #include "emu.h" @@ -148,9 +150,9 @@ static INPUT_PORTS_START( dragon_keyboard ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP), '^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN), 10) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN), 10) PORT_CHAR('[') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT), 8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT), 9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT), 9) PORT_CHAR(']') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("row6") @@ -174,6 +176,7 @@ static INPUT_PORTS_START( dragon200e_keyboard ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(';') PORT_CHAR('+') PORT_MODIFY("row5") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP), '^') PORT_CHAR('_') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("DOWN \xC2\xA1") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) PORT_CHAR(0xA1) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("RIGHT \xC2\xBF") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) PORT_CHAR(0xBF) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(0xA7) diff --git a/src/mame/drivers/drdmania.cpp b/src/mame/drivers/drdmania.cpp index 7e8c9a9b890..95e66fd299e 100644 --- a/src/mame/drivers/drdmania.cpp +++ b/src/mame/drivers/drdmania.cpp @@ -57,6 +57,8 @@ #include "machine/nvram.h" #include "sound/ay8910.h" #include "screen.h" +#include "tilemap.h" +#include "emupal.h" #include "speaker.h" class drdmania_state : public driver_device @@ -65,39 +67,123 @@ public: drdmania_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") + , m_gfxdecode(*this, "gfxdecode") + , m_fgram(*this, "fgram") { } void drdmania(machine_config &config); + void init_drdmania(); + +protected: + virtual void video_start() override; + private: void mem_map(address_map &map); void io_map(address_map &map); required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + required_device<gfxdecode_device> m_gfxdecode; + required_shared_ptr<uint8_t> m_fgram; + + tilemap_t *m_fg_tilemap; + + uint8_t unk_port00_r(); + + void fgram_w(offs_t offset, uint8_t data); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); }; void drdmania_state::mem_map(address_map &map) { - map(0x0000, 0x7fff).rom().region("maincpu", 0); + map(0x0000, 0xbfff).rom().region("maincpu", 0x0000); + + map(0xc000, 0xc7ff).ram(); // stack is here, but also writes ASCII strings as if it were a tilemap, but tile ROMs don't decode as ASCII + map(0xd000, 0xd3ff).ram().w(FUNC(drdmania_state::fgram_w)).share("fgram"); // vram? fills with value of blank tile } +uint8_t drdmania_state::unk_port00_r() +{ + return machine().rand(); +} + + void drdmania_state::io_map(address_map &map) { + map(0x00, 0x00).r(FUNC(drdmania_state::unk_port00_r)); + + map.global_mask(0xff); } static INPUT_PORTS_START(drdmania) INPUT_PORTS_END +static const gfx_layout tiles8x8_layout = +{ + 8,8, + RGN_FRAC(1,3), + 3, + { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( gfxa ) + GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 1 ) +GFXDECODE_END + +void drdmania_state::fgram_w(offs_t offset, uint8_t data) +{ + m_fgram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); +} + + +TILE_GET_INFO_MEMBER(drdmania_state::get_fg_tile_info) +{ + int code = m_fgram[tile_index]; + tileinfo.set(0,code,0,0); +} + + +void drdmania_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(drdmania_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + +uint32_t drdmania_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + + void drdmania_state::drdmania(machine_config &config) { Z80(config, m_maincpu, 18.432_MHz_XTAL / 4); // divider not verified m_maincpu->set_addrmap(AS_PROGRAM, &drdmania_state::mem_map); m_maincpu->set_addrmap(AS_IO, &drdmania_state::io_map); + m_maincpu->set_vblank_int("screen", FUNC(drdmania_state::irq0_line_hold)); //NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // MK48Z02B-20 - //SCREEN(config, "screen", SCREEN_TYPE_RASTER); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(256, 256); + m_screen->set_visarea(0, 256-1, 0, 256-1); + m_screen->set_screen_update(FUNC(drdmania_state::screen_update)); + + GFXDECODE(config, m_gfxdecode, "palette", gfxa); + + PALETTE(config, "palette").set_format(palette_device::xRGB_444, 0x100).set_endianness(ENDIANNESS_BIG); SPEAKER(config, "mono").front_center(); @@ -105,17 +191,36 @@ void drdmania_state::drdmania(machine_config &config) } ROM_START(drdmania) - ROM_REGION(0x08000, "maincpu", 0) + ROM_REGION(0x0c000, "maincpu", 0) ROM_LOAD( "dardomania_dmp01_v2.1.ic38", 0x00000, 0x8000, CRC(9f24336f) SHA1(9a82b851d5c67a50118a3669d3bc5793e94219e4) ) - - ROM_REGION(0x20000, "unsorted", 0) - ROM_LOAD( "dardomania_dmp02_v2.1.ic33", 0x00000, 0x8000, CRC(e5dbf948) SHA1(241be0f2969b962bba602548dab3e2bdbf8f0696) ) // 1ST AND 2ND HALF IDENTICAL - ROM_LOAD( "dardomania_dmp03_v2.1.ic21", 0x08000, 0x8000, CRC(b458975e) SHA1(862d62d147ac09b86aa8d2c54b2e03a6c5436f85) ) // 1ST AND 2ND HALF IDENTICAL - ROM_LOAD( "dardomania_dmp04_v2.1.ic16", 0x10000, 0x8000, CRC(8564d0ba) SHA1(38c81173f1cf788d1a524abfae9ef7b6697383e4) ) // 1ST AND 2ND HALF IDENTICAL - ROM_LOAD( "dardomania_dmp05_v2.1.ic10", 0x18000, 0x8000, CRC(e24f2a02) SHA1(16f3a9c80b3d60c66b070521a90c958b0fc690e7) ) // 1ST AND 2ND HALF IDENTICAL + // seems to have some bad bytes eg rst $08 instructions which should be calls but end up resetting it instead, see init + ROM_LOAD( "dardomania_dmp02_v2.1.ic33", 0x08000, 0x4000, BAD_DUMP CRC(e5dbf948) SHA1(241be0f2969b962bba602548dab3e2bdbf8f0696) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) + + ROM_REGION(0xc000, "gfx1", 0) + ROM_LOAD( "dardomania_dmp03_v2.1.ic21", 0x00000, 0x4000, CRC(b458975e) SHA1(862d62d147ac09b86aa8d2c54b2e03a6c5436f85) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) + ROM_LOAD( "dardomania_dmp04_v2.1.ic16", 0x04000, 0x4000, CRC(8564d0ba) SHA1(38c81173f1cf788d1a524abfae9ef7b6697383e4) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) + ROM_LOAD( "dardomania_dmp05_v2.1.ic10", 0x08000, 0x4000, CRC(e24f2a02) SHA1(16f3a9c80b3d60c66b070521a90c958b0fc690e7) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) ROM_REGION(0x20, "proms", 0) ROM_LOAD( "n82s123n.ic49", 0x00, 0x20, CRC(dcbd2352) SHA1(ce72e84129ed1b455aaf648e1dfaa4333e7e7628) ) ROM_END -GAME(1994, drdmania, 0, drdmania, drdmania, drdmania_state, empty_init, ROT0, "Sleic", "Dardomania (v2.1)", MACHINE_IS_SKELETON_MECHANICAL) +void drdmania_state::init_drdmania() +{ + uint8_t *ROM = memregion("maincpu")->base(); + ROM[0x8de0] ^= 0x02; // these are 0xcf in ROM so bit 0x02 got flipped? 3 calls in a row are incorrect in this way, so call addresses are suspect too + ROM[0x8de1] ^= 0x02; // call address + + ROM[0x8de3] ^= 0x02; // call opcode + + ROM[0x8de6] ^= 0x02; // call opcode + ROM[0x8de7] ^= 0x02; // call address + + ROM[0x8e00] ^= 0x02; // wrong, different bit flipped? +} + +GAME(1994, drdmania, 0, drdmania, drdmania, drdmania_state, init_drdmania, ROT0, "Sleic", "Dardomania (v2.1)", MACHINE_NOT_WORKING | MACHINE_MECHANICAL ) diff --git a/src/mame/drivers/duet16.cpp b/src/mame/drivers/duet16.cpp index e2c0f49c303..e008bd8283a 100644 --- a/src/mame/drivers/duet16.cpp +++ b/src/mame/drivers/duet16.cpp @@ -111,8 +111,7 @@ void duet16_state::fdcctrl_w(u8 data) m_fd[0]->get_device()->mon_w(!BIT(data, 0)); m_fd[1]->get_device()->mon_w(!BIT(data, 0)); - if(!BIT(data, 1)) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(data, 1)); // TODO: bit 3 = LSPD } @@ -194,7 +193,7 @@ MC6845_UPDATE_ROW(duet16_state::crtc_update_row) { if(!de) return; - u8 *gvram = (u8 *)&m_gvram[0]; + u8 const *const gvram = (u8 *)&m_gvram[0]; for(int i = 0; i < x_count; i++) { u16 coffset = (ma + i) & 0x07ff; @@ -235,7 +234,7 @@ MC6845_UPDATE_ROW(duet16_state::crtc_update_row) color = m_pal->pen_color((BIT(g2, 7 - xi) << 2) | (BIT(g1, 7 - xi) << 1) | BIT(g0, 7 - xi)); else color = 0; - bitmap.pix32(y, (i * 8) + xi) = color; + bitmap.pix(y, (i * 8) + xi) = color; } } } diff --git a/src/mame/drivers/dvk_kcgd.cpp b/src/mame/drivers/dvk_kcgd.cpp index 664a1d83db0..0844a6781e4 100644 --- a/src/mame/drivers/dvk_kcgd.cpp +++ b/src/mame/drivers/dvk_kcgd.cpp @@ -307,19 +307,19 @@ void kcgd_state::draw_scanline(uint16_t *p, uint16_t offset) TIMER_DEVICE_CALLBACK_MEMBER(kcgd_state::scanline_callback) { - uint16_t y = m_screen->vpos(), offset; + uint16_t y = m_screen->vpos(); if (y < KCGD_VERT_START) return; y -= KCGD_VERT_START; if (y >= KCGD_DISP_VERT) return; - offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); + uint16_t const offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); DBG_LOG(2,"scanline_cb", ("frame %d y %.3d page %d offset %04X *offset %04X\n", m_screen->frame_number(), BIT(m_video.status, KCGD_STATUS_PAGE), y, offset + y, m_videoram[offset + y])); - draw_scanline(&m_tmpbmp.pix16(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); + draw_scanline(&m_tmpbmp.pix(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); } uint32_t kcgd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp index 37dc73a84e8..4a6bc1afa65 100644 --- a/src/mame/drivers/dvk_ksm.cpp +++ b/src/mame/drivers/dvk_ksm.cpp @@ -365,7 +365,6 @@ uint32_t ksm_state::draw_scanline(uint16_t *p, uint16_t offset, uint8_t scanline TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) { uint16_t y = m_screen->vpos(); - uint16_t offset; LOGDBG("scanline_cb addr %02x frame %d x %.4d y %.3d row %.2d\n", m_video.line, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11); @@ -374,6 +373,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) y -= KSM_VERT_START; if (y >= KSM_DISP_VERT) return; + uint16_t offset; if (y < KSM_STATUSLINE_TOTAL) { offset = KSM_STATUSLINE_VRAM - 0xC000; @@ -383,7 +383,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) offset = 0x2000 + 0x30 + (((m_video.line + y / 11 - 1) % 48) << 7); } - draw_scanline(&m_tmpbmp.pix16(y), offset, y % 11); + draw_scanline(&m_tmpbmp.pix(y), offset, y % 11); } uint32_t ksm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dwarfd.cpp b/src/mame/drivers/dwarfd.cpp index 246e31d1bb1..4e040d7581b 100644 --- a/src/mame/drivers/dwarfd.cpp +++ b/src/mame/drivers/dwarfd.cpp @@ -619,10 +619,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::pesp_display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } @@ -642,10 +642,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } @@ -665,10 +665,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::qc_display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } diff --git a/src/mame/drivers/e100.cpp b/src/mame/drivers/e100.cpp index 6afd7a2ec69..2ac709df04e 100644 --- a/src/mame/drivers/e100.cpp +++ b/src/mame/drivers/e100.cpp @@ -235,7 +235,7 @@ uint32_t e100_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (x = 0; x < 8; x++) { if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0; } chardata++; } diff --git a/src/mame/drivers/ec65.cpp b/src/mame/drivers/ec65.cpp index c18395857b2..4ce325e34b5 100644 --- a/src/mame/drivers/ec65.cpp +++ b/src/mame/drivers/ec65.cpp @@ -164,19 +164,17 @@ void ec65_state::machine_reset() MC6845_UPDATE_ROW( ec65_common::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,inv; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; + u8 const inv = (x == cursor_x) ? 0xff : 0; + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; + u8 const gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/elan_eu3a05.cpp b/src/mame/drivers/elan_eu3a05.cpp index c1c7675cd21..29abd9ff08d 100644 --- a/src/mame/drivers/elan_eu3a05.cpp +++ b/src/mame/drivers/elan_eu3a05.cpp @@ -247,7 +247,7 @@ public: void init_sudelan(); void init_sudelan3(); - + protected: // driver_device overrides virtual void machine_start() override; @@ -869,7 +869,7 @@ void elan_eu3a05_pvwwcas_state::pvwwcas(machine_config& config) m_screen->set_refresh_hz(50); m_sys->set_pal(); // TODO: also set PAL clocks - m_gpio->read_2_callback().set(FUNC(elan_eu3a05_pvwwcas_state::pvwwc_portc_r)); + m_gpio->read_2_callback().set(FUNC(elan_eu3a05_pvwwcas_state::pvwwc_portc_r)); m_gpio->write_2_callback().set(FUNC(elan_eu3a05_pvwwcas_state::pvwwc_portc_w)); } diff --git a/src/mame/drivers/electron.cpp b/src/mame/drivers/electron.cpp index 83764b30a6d..f60a6936a19 100644 --- a/src/mame/drivers/electron.cpp +++ b/src/mame/drivers/electron.cpp @@ -333,6 +333,8 @@ void electronsp_state::electronsp(machine_config &config) VIA6522(config, m_via, 16_MHz_XTAL / 16); m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); + m_via->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); + m_via->cb2_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb2)); m_via->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<2>)); /* user port */ diff --git a/src/mame/drivers/elekscmp.cpp b/src/mame/drivers/elekscmp.cpp index e0f7e012ee8..b3a43fc765b 100644 --- a/src/mame/drivers/elekscmp.cpp +++ b/src/mame/drivers/elekscmp.cpp @@ -12,8 +12,9 @@ To Use: - Press MINUS to enter data input mode - Press UP or DOWN to cycle through addresses -At the moment Paste cannot be tested, but if it worked, you could -paste this in: -0F0011^22^33^44^55^66^77^88^99^ +Paste test: +paste this in: -0F0011^22^33^44^55^66^77^88^99^N-0F00 +Now press UP to verify the data that was entered. It seems the only way to exit each mode is to press NRST. @@ -190,7 +191,7 @@ static INPUT_PORTS_START( elekscmp ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NRST") PORT_CODE(KEYCODE_LALT) PORT_CHANGED_MEMBER(DEVICE_SELF, elekscmp_state, reset_button, 0) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NRST") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, elekscmp_state, reset_button, 0) PORT_CHAR('N') INPUT_PORTS_END INPUT_CHANGED_MEMBER(elekscmp_state::reset_button) diff --git a/src/mame/drivers/elwro800.cpp b/src/mame/drivers/elwro800.cpp index 29e116d660c..59b7d0c53c2 100644 --- a/src/mame/drivers/elwro800.cpp +++ b/src/mame/drivers/elwro800.cpp @@ -408,8 +408,8 @@ static INPUT_PORTS_START( elwro800 ) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(':') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_START("LINE1") /* 0xFDFE */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') @@ -417,8 +417,8 @@ static INPUT_PORTS_START( elwro800 ) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_START("LINE2") /* 0xFBFE */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') @@ -426,26 +426,26 @@ static INPUT_PORTS_START( elwro800 ) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_START("LINE3") /* 0xF7FE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR(0xff) PORT_CHAR('!') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(0xff) PORT_CHAR('"') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0xff) PORT_CHAR('#') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(0xff) PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR(0xff) PORT_CHAR('%') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') PORT_CHAR('\\') PORT_START("LINE4") /* 0xEFFE */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(0xff) PORT_CHAR('_') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(0xff) PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR(0xff) PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0xff) PORT_CHAR('\'') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR(0xff) PORT_CHAR('&') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL),127) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_START("LINE5") /* 0xDFFE */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') @@ -453,8 +453,8 @@ static INPUT_PORTS_START( elwro800 ) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE),8) PORT_START("LINE6") /* 0xBFFE */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) @@ -472,7 +472,7 @@ static INPUT_PORTS_START( elwro800 ) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ -") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('-') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ -") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_START("LINE8") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC4\x98") PORT_CODE(KEYCODE_0_PAD) // LATIN CAPITAL LETTER E WITH OGONEK @@ -643,4 +643,4 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1986, elwro800, 0, 0, elwro800, elwro800, elwro800_state, empty_init, "Elwro", "800 Junior", 0 ) +COMP( 1986, elwro800, 0, 0, elwro800, elwro800, elwro800_state, empty_init, "Elwro", "800-3 Junior", 0 ) diff --git a/src/mame/drivers/embargo.cpp b/src/mame/drivers/embargo.cpp index 9c528330d11..44d903197b8 100644 --- a/src/mame/drivers/embargo.cpp +++ b/src/mame/drivers/embargo.cpp @@ -52,23 +52,19 @@ private: uint32_t embargo_state::screen_update_embargo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - uint8_t y = offs >> 5; + uint8_t const y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/emu3.cpp b/src/mame/drivers/emu3.cpp index 4bd40415e09..b2b0791654d 100644 --- a/src/mame/drivers/emu3.cpp +++ b/src/mame/drivers/emu3.cpp @@ -64,6 +64,7 @@ public: protected: virtual void machine_start() override; + virtual void machine_reset() override; private: void emu3_map(address_map &map); @@ -133,6 +134,12 @@ void emu3_state::machine_start() m_irq_state = false; } +void emu3_state::machine_reset() +{ + m_fdc->set_floppy(m_fdd); + m_fdc->dden_w(0); +} + void emu3_state::emu3_map(address_map &map) { map(0x000000, 0x007fff).rom().region("bootprom", 0); @@ -147,7 +154,7 @@ void emu3_state::emu3_map(address_map &map) map(0xd70000, 0xd70000).lw8( [this](u8 data) { - m_fdd->ss_w(BIT(data, MISC_SIDE)); + m_fdd->ss_w(!BIT(data, MISC_SIDE)); m_fdd->mon_w(BIT(data, MISC_MTR)); m_led[16] = BIT(data, MISC_LED); }, "misc_w"); @@ -209,10 +216,8 @@ void emu3_state::emu3(machine_config &config) WD1772(config, m_fdc, 16_MHz_XTAL / 2); m_fdc->intrq_wr_callback().set(*this, FUNC(emu3_state::irq_w<FDCINT>)); m_fdc->set_disable_motor_control(true); - //m_fdc->sso_wr_callback().set([this](int state) {}); - m_fdc->dden_w(0); - FLOPPY_CONNECTOR(config, "fdc:0", emu3_floppies, "35dd", floppy_image_device::default_floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:0", emu3_floppies, "35dd", floppy_image_device::default_floppy_formats).enable_sound(true); PIT8254(config, m_pit); // 8254-2 m_pit->set_clk<0>(20_MHz_XTAL / 2); diff --git a/src/mame/drivers/emu68k.cpp b/src/mame/drivers/emu68k.cpp index 2d2dba851cb..f4deb4ebf30 100644 --- a/src/mame/drivers/emu68k.cpp +++ b/src/mame/drivers/emu68k.cpp @@ -54,7 +54,7 @@ void emu68k_state::machine_start() HD44780_PIXEL_UPDATE(emu68k_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/enigma2.cpp b/src/mame/drivers/enigma2.cpp index 7d9b2211cd0..6537fa57d92 100644 --- a/src/mame/drivers/enigma2.cpp +++ b/src/mame/drivers/enigma2.cpp @@ -282,7 +282,7 @@ uint32_t enigma2_state::screen_update_enigma2(screen_device &screen, bitmap_rgb3 /* stars only appear at certain positions */ color = ((x & y & 0x0f) == 0x0f) ? star_color : 0; - bitmap.pix32(bitmap_y, x) = m_palette->pen_color(color); + bitmap.pix(bitmap_y, x) = m_palette->pen_color(color); /* next pixel */ x = x + 1; @@ -344,7 +344,7 @@ uint32_t enigma2_state::screen_update_enigma2a(screen_device &screen, bitmap_rgb } pen = bit ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(bitmap_y, x) = pen; + bitmap.pix(bitmap_y, x) = pen; /* next pixel */ x = x + 1; diff --git a/src/mame/drivers/eolith16.cpp b/src/mame/drivers/eolith16.cpp index de0de146aaa..d3ad8c11532 100644 --- a/src/mame/drivers/eolith16.cpp +++ b/src/mame/drivers/eolith16.cpp @@ -129,7 +129,7 @@ uint32_t eolith16_state::screen_update_eolith16(screen_device &screen, bitmap_in { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[(y * 320) + x] & 0xff; + bitmap.pix(y, x) = m_vram[(y * 320) + x] & 0xff; } } return 0; diff --git a/src/mame/drivers/epic14e.cpp b/src/mame/drivers/epic14e.cpp index a32884f75ee..65647de0e8b 100644 --- a/src/mame/drivers/epic14e.cpp +++ b/src/mame/drivers/epic14e.cpp @@ -61,7 +61,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(epic14e_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index 98eeea10226..f47cbf90200 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -118,7 +118,7 @@ uint32_t esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitma for(int yi=0;yi<8;yi++) for(int xi=0;xi<8;xi++) - bitmap.pix32(yi+chary*8, xi+charx*8) = m_palette->pen(palIndex * 8 + pal_bank * 0x100); + bitmap.pix(yi+chary*8, xi+charx*8) = m_palette->pen(palIndex * 8 + pal_bank * 0x100); continue; } diff --git a/src/mame/drivers/esprit.cpp b/src/mame/drivers/esprit.cpp index 610c0fca646..6969eabe52e 100644 --- a/src/mame/drivers/esprit.cpp +++ b/src/mame/drivers/esprit.cpp @@ -82,8 +82,8 @@ INPUT_PORTS_END MC6845_UPDATE_ROW(esprit_state::crtc_update_row) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/esq1.cpp b/src/mame/drivers/esq1.cpp index b0a9e97a293..c7f4869c33d 100644 --- a/src/mame/drivers/esq1.cpp +++ b/src/mame/drivers/esq1.cpp @@ -210,7 +210,7 @@ protected: virtual void device_start() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct filter { @@ -334,13 +334,13 @@ void esq1_filters::recalc_filter(filter &f) void esq1_filters::device_start() { - stream = stream_alloc_legacy(8, 2, 44100); + stream = stream_alloc(8, 2, 44100); memset(filters, 0, sizeof(filters)); for(auto & elem : filters) recalc_filter(elem); } -void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void esq1_filters::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* if(0) { for(int i=0; i<8; i++) @@ -352,11 +352,11 @@ void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sampl fprintf(stderr, "\n"); }*/ - for(int i=0; i<samples; i++) { + for(int i=0; i<outputs[0].samples(); i++) { double l=0, r=0; for(int j=0; j<8; j++) { filter &f = filters[j]; - double x = inputs[j][i]; + double x = inputs[j].get(i); double y = (x*f.a[0] + f.x[0]*f.a[1] + f.x[1]*f.a[2] + f.x[2]*f.a[3] + f.x[3]*f.a[4] - f.y[0]*f.b[1] - f.y[1]*f.b[2] - f.y[2]*f.b[3] - f.y[3]*f.b[4]) / f.b[0]; @@ -378,8 +378,8 @@ void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sampl // r *= 6553; l *= 2; r *= 2; - outputs[0][i] = l < -32768 ? -32768 : l > 32767 ? 32767 : int(l); - outputs[1][i] = r < -32768 ? -32768 : r > 32767 ? 32767 : int(r); + outputs[0].put_clamp(i, l, 1.0); + outputs[1].put_clamp(i, r, 1.0); } } diff --git a/src/mame/drivers/eurit.cpp b/src/mame/drivers/eurit.cpp index 24b9ad57b44..1bb12cfc320 100644 --- a/src/mame/drivers/eurit.cpp +++ b/src/mame/drivers/eurit.cpp @@ -53,7 +53,7 @@ void eurit_state::machine_start() HD44780_PIXEL_UPDATE(eurit_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp index 719bb57852c..a62c695a9e5 100644 --- a/src/mame/drivers/eurocom2.cpp +++ b/src/mame/drivers/eurocom2.cpp @@ -302,19 +302,16 @@ uint8_t waveterm_state::waveterm_adc() uint32_t eurocom2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, offset, page; - uint16_t gfx, *p; + int const page = (m_vico[0] & 3) << 14; - page = (m_vico[0] & 3) << 14; - - for (y = 0; y < VC_DISP_VERT; y++) + for (int y = 0; y < VC_DISP_VERT; y++) { - offset = (VC_DISP_HORZ / 8) * ((m_vico[1] + y) % VC_DISP_VERT); - p = &m_tmpbmp.pix16(y); + int const offset = (VC_DISP_HORZ / 8) * ((m_vico[1] + y) % VC_DISP_VERT); + uint16_t *p = &m_tmpbmp.pix(y); - for (x = offset; x < offset + VC_DISP_HORZ / 8; x++) + for (int x = offset; x < offset + VC_DISP_HORZ / 8; x++) { - gfx = m_p_videoram[page + x]; + uint16_t const gfx = m_p_videoram[page + x]; for (int i = 7; i >= 0; i--) { diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp index bf1368c495d..56d2afc5406 100644 --- a/src/mame/drivers/excali64.cpp +++ b/src/mame/drivers/excali64.cpp @@ -530,20 +530,19 @@ void excali64_state::excali64_palette(palette_device &palette) MC6845_UPDATE_ROW( excali64_state::update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,col,bg,fg; - u16 mem,x; - u8 col_base = BIT(m_sys_status, 3) ? 16 : 0; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u8 const col_base = BIT(m_sys_status, 3) ? 16 : 0; + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - col = m_vram[mem+0x800]; - fg = col_base + (col >> 4); - bg = 32 + ((col >> 1) & 7); + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; + u8 const col = m_vram[mem+0x800]; + u8 const fg = col_base + (col >> 4); + u8 const bg = 32 + ((col >> 1) & 7); + u8 gfx; if (BIT(col, 0)) { u8 h = m_vram[mem+0x1000] - 4; diff --git a/src/mame/drivers/expro02.cpp b/src/mame/drivers/expro02.cpp index 6767f6454c7..5a2bc1ed6eb 100644 --- a/src/mame/drivers/expro02.cpp +++ b/src/mame/drivers/expro02.cpp @@ -338,7 +338,7 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1; @@ -363,7 +363,7 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff; diff --git a/src/mame/drivers/f-32.cpp b/src/mame/drivers/f-32.cpp index 7e58b37a5cc..0f07d04cd4a 100644 --- a/src/mame/drivers/f-32.cpp +++ b/src/mame/drivers/f-32.cpp @@ -67,17 +67,15 @@ private: uint32_t mosaicf2_state::screen_update_mosaicf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x10000; offs++) + for (offs_t offs = 0; offs < 0x10000; offs++) { int y = offs >> 8; int x = offs & 0xff; if ((x < 0xa0) && (y < 0xe0)) { - bitmap.pix16(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff; - bitmap.pix16(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff; + bitmap.pix(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff; + bitmap.pix(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff; } } diff --git a/src/mame/drivers/facit4440.cpp b/src/mame/drivers/facit4440.cpp index 2c066aa243c..84c6d8cc8db 100644 --- a/src/mame/drivers/facit4440.cpp +++ b/src/mame/drivers/facit4440.cpp @@ -148,7 +148,7 @@ WRITE_LINE_MEMBER(facit4440_state::vsync_w) MC6845_UPDATE_ROW(facit4440_state::update_row) { offs_t base = ma / 5 * 6; - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { diff --git a/src/mame/drivers/falco5220.cpp b/src/mame/drivers/falco5220.cpp index b7950bde463..a4a2660e4db 100644 --- a/src/mame/drivers/falco5220.cpp +++ b/src/mame/drivers/falco5220.cpp @@ -96,7 +96,7 @@ u32 falco5220_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, gfx = 0xff; for (int x = 0; x < 8; x++) - bitmap.pix32(col*16 + y, row*8 + x) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(col*16 + y, row*8 + x) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/fanucspmg.cpp b/src/mame/drivers/fanucspmg.cpp index 4d8a2f70aca..c5608e0eb92 100644 --- a/src/mame/drivers/fanucspmg.cpp +++ b/src/mame/drivers/fanucspmg.cpp @@ -846,11 +846,10 @@ void fanucspmg_state::memory_write_byte(offs_t offset, uint8_t data) MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); - int i; - uint8_t *chargen = m_chargen->base(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const chargen = m_chargen->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); @@ -868,14 +867,14 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) if (attr & 0x40) fg |= 0x00ff00; if (attr & 0x80) fg |= 0x0000ff; - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; + *p++ = BIT(data, 0) ? fg : bg; + *p++ = BIT(data, 1) ? fg : bg; + *p++ = BIT(data, 2) ? fg : bg; + *p++ = BIT(data, 3) ? fg : bg; + *p++ = BIT(data, 4) ? fg : bg; + *p++ = BIT(data, 5) ? fg : bg; + *p++ = BIT(data, 6) ? fg : bg; + *p++ = BIT(data, 7) ? fg : bg; } } else @@ -894,11 +893,10 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) { - uint32_t *p = &bitmap.pix32(y); - int i; - uint8_t *chargen = m_chargen->base(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const chargen = m_chargen->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); @@ -912,14 +910,14 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) uint32_t fg = 0xff00; uint32_t bg = 0; - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; + *p++ = BIT(data, 0) ? fg : bg; + *p++ = BIT(data, 1) ? fg : bg; + *p++ = BIT(data, 2) ? fg : bg; + *p++ = BIT(data, 3) ? fg : bg; + *p++ = BIT(data, 4) ? fg : bg; + *p++ = BIT(data, 5) ? fg : bg; + *p++ = BIT(data, 6) ? fg : bg; + *p++ = BIT(data, 7) ? fg : bg; } } else diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp index 35cf5c36c46..e05ba8a9255 100644 --- a/src/mame/drivers/fb01.cpp +++ b/src/mame/drivers/fb01.cpp @@ -148,7 +148,7 @@ HD44780_PIXEL_UPDATE(fb01_state::fb01_pixel_update) { if ( pos < 8 && line < 2 ) { - bitmap.pix16(y, line*6*8 + pos*6 + x) = state; + bitmap.pix(y, line*6*8 + pos*6 + x) = state; } } diff --git a/src/mame/drivers/fc100.cpp b/src/mame/drivers/fc100.cpp index 67a08b7f92a..05f48542c8b 100644 --- a/src/mame/drivers/fc100.cpp +++ b/src/mame/drivers/fc100.cpp @@ -159,8 +159,8 @@ static INPUT_PORTS_START( fc100 ) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_NAME("Caps") PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[") PORT_CHAR('[') PORT_CHAR('{') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("]") PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('o') PORT_CHAR('O') PORT_START("KEY.1") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) @@ -171,10 +171,10 @@ static INPUT_PORTS_START( fc100 ) PORT_START("KEY.2") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_START("KEY.3") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) @@ -199,17 +199,17 @@ static INPUT_PORTS_START( fc100 ) PORT_START("KEY.6") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_NAME("F5") PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") PORT_CHAR(32) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Run") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR(')') PORT_START("KEY.7") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("F1") PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("F2") PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("F3") PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("F4") PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_START("KEY.8") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) @@ -227,45 +227,45 @@ static INPUT_PORTS_START( fc100 ) PORT_START("KEY.10") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('l') PORT_CHAR('L') PORT_START("KEY.11") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('C') PORT_CHAR('c') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('v') PORT_CHAR('V') PORT_START("KEY.12") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('K') PORT_CHAR('k') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('k') PORT_CHAR('K') PORT_START("KEY.13") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('f') PORT_CHAR('F') PORT_START("KEY.14") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('I') PORT_CHAR('i') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('i') PORT_CHAR('I') PORT_START("KEY.15") PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('r') PORT_CHAR('R') PORT_START("JOY0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) diff --git a/src/mame/drivers/fk1.cpp b/src/mame/drivers/fk1.cpp index 3e8f728ce02..e0d11652fee 100644 --- a/src/mame/drivers/fk1.cpp +++ b/src/mame/drivers/fk1.cpp @@ -404,17 +404,15 @@ void fk1_state::machine_reset() uint32_t fk1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code; - int y, x, b; - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x8000]; - for (b = 0; b < 8; b++) - bitmap.pix16(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; + uint8_t code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x8000]; + for (int b = 0; b < 8; b++) + bitmap.pix(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; } } return 0; diff --git a/src/mame/drivers/flipjack.cpp b/src/mame/drivers/flipjack.cpp index 9f84bca2350..e0eb29c1691 100644 --- a/src/mame/drivers/flipjack.cpp +++ b/src/mame/drivers/flipjack.cpp @@ -173,8 +173,8 @@ MC6845_UPDATE_ROW(flipjack_state::update_row) { const bool flip = !BIT(m_layer, 0); const uint16_t row_base = ((ma & 0x03e0) << 3 | (ra & 7) << 5) ^ (flip ? 0x1fff : 0); - uint32_t *const pbegin = &bitmap.pix32(y); - uint32_t *const pend = &bitmap.pix32(y, x_count * 8); + uint32_t *const pbegin = &bitmap.pix(y); + uint32_t *const pend = &bitmap.pix(y, x_count * 8); std::fill(pbegin, pend, rgb_t::black()); diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp index a45064ae13f..ee657e4a41e 100644 --- a/src/mame/drivers/flyball.cpp +++ b/src/mame/drivers/flyball.cpp @@ -175,7 +175,7 @@ uint32_t flyball_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = bally; y < bally + 2; y++) for (int x = ballx; x < ballx + 2; x++) if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; return 0; } diff --git a/src/mame/drivers/fm7.cpp b/src/mame/drivers/fm7.cpp index 642c68c9631..34db0decb19 100644 --- a/src/mame/drivers/fm7.cpp +++ b/src/mame/drivers/fm7.cpp @@ -1727,7 +1727,7 @@ INPUT_PORTS_START( fm7_keyboard ) PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") PORT_CHAR(165) PORT_CHAR('|') PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') @@ -1767,7 +1767,7 @@ INPUT_PORTS_START( fm7_keyboard ) PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR('_') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR('"') PORT_CHAR('_') PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp index 9a0f29f04d4..07044988df3 100644 --- a/src/mame/drivers/fmtowns.cpp +++ b/src/mame/drivers/fmtowns.cpp @@ -2012,16 +2012,6 @@ WRITE_LINE_MEMBER(towns_state::rtc_busy_w) } // SCSI controller - I/O ports 0xc30 and 0xc32 -uint16_t towns_state::towns_scsi_dma_r() -{ - return m_scsi->fmscsi_data_r(); -} - -void towns_state::towns_scsi_dma_w(uint16_t data) -{ - m_scsi->fmscsi_data_w(data & 0xff); -} - WRITE_LINE_MEMBER(towns_state::towns_scsi_irq) { m_pic_slave->ir0_w(state); @@ -2374,6 +2364,13 @@ void towns_state::towns_io(address_map &map) map(0xff80, 0xffff).rw(FUNC(towns_state::towns_video_cff80_r), FUNC(towns_state::towns_video_cff80_w)); } +void towns_state::towns_1g_io(address_map &map) +{ + // For the first generation FM Towns with a SCSI card slot + towns_io(map); + map(0x0c30, 0x0c37).rw(m_scsi_slot, FUNC(fmt_scsi_slot_device::read), FUNC(fmt_scsi_slot_device::write)).umask32(0x00ff00ff); +} + void towns_state::towns2_io(address_map &map) { // For FM Towns II models with integrated SCSI controller @@ -2469,59 +2466,59 @@ static INPUT_PORTS_START( towns ) PORT_START( "key1" ) // scancodes 0x00-0x1f PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 ! \xE3\x81\xAC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 \x22 \xE3\x81\xB5") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 # \xE3\x81\x82 \xE3\x81\x81") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $ \xE3\x81\x86 \xE3\x81\x85") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 % \xE3\x81\x88 \xE3\x81\x87") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 & \xE3\x81\x8A \xE3\x81\x89") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 ´ \xE3\x82\x84 \xE3\x82\x83") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 ( \xE3\x82\x86 \xE3\x82\x85") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 ) \xE3\x82\x88 \xE3\x82\x87") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1 ! \xE3\x81\xAC") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2 \x22 \xE3\x81\xB5") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR(34) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3 # \xE3\x81\x82 \xE3\x81\x81") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4 $ \xE3\x81\x86 \xE3\x81\x85") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5 % \xE3\x81\x88 \xE3\x81\x87") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6 & \xE3\x81\x8A \xE3\x81\x89") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7 ´ \xE3\x82\x84 \xE3\x82\x83") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8 ( \xE3\x82\x86 \xE3\x82\x85") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9 ) \xE3\x82\x88 \xE3\x82\x87") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0 \xE3\x82\x8F \xE3\x82\x92") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- = \xE3\x81\xBB") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("- = \xE3\x81\xBB") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^ \xE2\x80\xBE \xE3\x81\xB8") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5 | -") PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5 | -") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(165) PORT_CHAR('|') PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q \xE3\x81\x9F") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W \xE3\x81\xA6") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E \xE3\x81\x84") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R \xE3\x81\x99") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T \xE3\x81\x8B") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y \xE3\x82\x93") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U \xE3\x81\xAA") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I \xE3\x81\xAB") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O \xE3\x82\x89") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P \xE3\x81\x9B") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ ` \xE2\x80\x9D") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ { \xE3\x82\x9C \xE3\x80\x8C") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A \xE3\x81\xA1") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S \xE3\x81\xA8") PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q \xE3\x81\x9F") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W \xE3\x81\xA6") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E \xE3\x81\x84") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R \xE3\x81\x99") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T \xE3\x81\x8B") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y \xE3\x82\x93") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U \xE3\x81\xAA") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I \xE3\x81\xAB") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O \xE3\x82\x89") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P \xE3\x81\x9B") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@ ` \xE2\x80\x9D") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[ { \xE3\x82\x9C \xE3\x80\x8C") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A \xE3\x81\xA1") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S \xE3\x81\xA8") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_START( "key2" ) // scancodes 0x20-0x3f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D \xE3\x81\x97") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F \xE3\x81\xAF") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G \xE3\x81\x8D") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H \xE3\x81\x8F") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J \xE3\x81\xBE") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K \xE3\x81\xAE") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L \xE3\x82\x8A") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; + \xE3\x82\x8C") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": * \xE3\x81\x91") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] } \xE3\x82\x80 \xE3\x80\x8D") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z \xE3\x81\xA4 \xE3\x81\xA3") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X \xE3\x81\x95") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C \xE3\x81\x9D") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V \xE3\x81\xB2") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B \xE3\x81\x93") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N \xE3\x81\xBF") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M \xE3\x82\x82") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", < \xE3\x81\xAD \xE3\x80\x81") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". > \xE3\x82\x8B \xE3\x80\x82") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ? \xE3\x82\x81 \xE3\x83\xBB") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\x22 _ \xE3\x82\x8D") + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D \xE3\x81\x97") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F \xE3\x81\xAF") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G \xE3\x81\x8D") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H \xE3\x81\x8F") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J \xE3\x81\xBE") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K \xE3\x81\xAE") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L \xE3\x82\x8A") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("; + \xE3\x82\x8C") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(": * \xE3\x81\x91") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("] } \xE3\x82\x80 \xE3\x80\x8D") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z \xE3\x81\xA4 \xE3\x81\xA3") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X \xE3\x81\x95") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C \xE3\x81\x9D") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V \xE3\x81\xB2") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B \xE3\x81\x93") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N \xE3\x81\xBF") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M \xE3\x82\x82") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(", < \xE3\x81\xAD \xE3\x80\x81") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(". > \xE3\x82\x8B \xE3\x80\x82") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/ ? \xE3\x82\x81 \xE3\x83\xBB") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\x22 _ \xE3\x82\x8D") PORT_CHAR('"') PORT_CHAR('_') PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) @@ -2548,13 +2545,13 @@ static INPUT_PORTS_START( towns ) PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 000") PORT_CODE(KEYCODE_000_PAD) PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE5\x89\x8A\xE9\x99\xA4 (Delete) / EL") PORT_CODE(KEYCODE_DEL) PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x81\xB2\xE3\x82\x89\xE3\x81\x8C\xE3\x81\xAA (Hiragana) / \xE3\x83\xAD\xE3\x83\xBC\xE3\x83\x9E\xE5\xAD\x97 (Romaji)") PORT_CODE(KEYCODE_RCONTROL) @@ -2562,23 +2559,23 @@ static INPUT_PORTS_START( towns ) PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE5\xA4\x89\xE6\x8F\x9B (Conversion)") PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x81\x8B\xE3\x81\xAA\xE6\xBC\xA2\xE5\xAD\x97 (Kana Kanji)") PORT_CODE(KEYCODE_RALT) PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE3\x82\xAB\xE3\x82\xBF\xE3\x82\xAB\xE3\x83\x8A (Katakana)") PORT_CODE(KEYCODE_RWIN) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF12") PORT_CODE(KEYCODE_F12) + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF12") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ALT") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_START("key4") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF11") PORT_CODE(KEYCODE_F11) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE6\xBC\xA2\xE5\xAD\x97\xE8\xBE\x9E\xE6\x9B\xB8 (Kanji Dictionary)") PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xE5\x8D\x98\xE8\xAA\x9E\xE6\x8A\xB9\xE6\xB6\x88 (Word Deletion)") @@ -2831,7 +2828,7 @@ void towns_state::towns_base(machine_config &config) /* basic machine hardware */ I386(config, m_maincpu, 16000000); m_maincpu->set_addrmap(AS_PROGRAM, &towns_state::towns_mem); - m_maincpu->set_addrmap(AS_IO, &towns_state::towns_io); + m_maincpu->set_addrmap(AS_IO, &towns_state::towns_1g_io); m_maincpu->set_vblank_int("screen", FUNC(towns_state::towns_vsync_irq)); m_maincpu->set_irq_acknowledge_callback("pic8259_master", FUNC(pic8259_device::inta_cb)); //MCFG_MACHINE_RESET_OVERRIDE(towns_state,towns) @@ -2960,6 +2957,15 @@ void towns_state::towns(machine_config &config) { towns_base(config); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); + + FMT_SCSI_SLOT(config, m_scsi_slot, fmt_scsi_default_devices, nullptr); + m_scsi_slot->irq_handler().set(FUNC(towns_state::towns_scsi_irq)); + m_scsi_slot->drq_handler().set(FUNC(towns_state::towns_scsi_drq)); + + m_dma[0]->dma_read_callback<1>().set(m_scsi_slot, FUNC(fmt_scsi_slot_device::data_read)); + m_dma[0]->dma_write_callback<1>().set(m_scsi_slot, FUNC(fmt_scsi_slot_device::data_write)); + m_dma[1]->dma_read_callback<1>().set(m_scsi_slot, FUNC(fmt_scsi_slot_device::data_read)); + m_dma[1]->dma_write_callback<1>().set(m_scsi_slot, FUNC(fmt_scsi_slot_device::data_write)); } void towns16_state::townsux(machine_config &config) @@ -2984,10 +2990,10 @@ void towns16_state::townsux(machine_config &config) m_scsi->irq_handler().set(FUNC(towns16_state::towns_scsi_irq)); m_scsi->drq_handler().set(FUNC(towns16_state::towns_scsi_drq)); - m_dma[0]->dma_read_callback<1>().set(FUNC(towns16_state::towns_scsi_dma_r)); - m_dma[0]->dma_write_callback<1>().set(FUNC(towns16_state::towns_scsi_dma_w)); - m_dma[1]->dma_read_callback<1>().set(FUNC(towns16_state::towns_scsi_dma_r)); - m_dma[1]->dma_write_callback<1>().set(FUNC(towns16_state::towns_scsi_dma_w)); + m_dma[0]->dma_read_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_r)); + m_dma[0]->dma_write_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_w)); + m_dma[1]->dma_read_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_r)); + m_dma[1]->dma_write_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_w)); // 2 MB onboard, one SIMM slot with 2-8 MB m_ram->set_default_size("2M").set_extra_options("4M,6M,10M"); @@ -2997,7 +3003,7 @@ void towns16_state::townsux(machine_config &config) void towns_state::townssj(machine_config &config) { - towns(config); + towns_base(config); I486(config.replace(), m_maincpu, 66000000); m_maincpu->set_addrmap(AS_PROGRAM, &towns_state::towns_mem); @@ -3017,13 +3023,15 @@ void towns_state::townssj(machine_config &config) m_scsi->irq_handler().set(FUNC(towns_state::towns_scsi_irq)); m_scsi->drq_handler().set(FUNC(towns_state::towns_scsi_drq)); - m_dma[0]->dma_read_callback<1>().set(FUNC(towns_state::towns_scsi_dma_r)); - m_dma[0]->dma_write_callback<1>().set(FUNC(towns_state::towns_scsi_dma_w)); - m_dma[1]->dma_read_callback<1>().set(FUNC(towns_state::towns_scsi_dma_r)); - m_dma[1]->dma_write_callback<1>().set(FUNC(towns_state::towns_scsi_dma_w)); + m_dma[0]->dma_read_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_r)); + m_dma[0]->dma_write_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_w)); + m_dma[1]->dma_read_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_r)); + m_dma[1]->dma_write_callback<1>().set(m_scsi, FUNC(fmscsi_device::fmscsi_data_w)); // 4 MB (SJ2/SJ2A) or 8 MB (SJ26/SJ53) onboard, 2 SIMM slots with 4-32 MB each m_ram->set_default_size("8M").set_extra_options("4M,12M,16M,20M,24M,28M,32M,36M,40M,44M,48M,52M,56M,68M,72M"); + + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); } void towns_state::townshr(machine_config &config) diff --git a/src/mame/drivers/fp1100.cpp b/src/mame/drivers/fp1100.cpp index dab8f080191..0c3208d75b1 100644 --- a/src/mame/drivers/fp1100.cpp +++ b/src/mame/drivers/fp1100.cpp @@ -137,7 +137,7 @@ private: MC6845_UPDATE_ROW( fp1100_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); if (BIT(m_upd7801.porta, 4)) { // green screen diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp index bb8d027dc55..6794d2c5122 100644 --- a/src/mame/drivers/fp200.cpp +++ b/src/mame/drivers/fp200.cpp @@ -135,20 +135,16 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix(y,x) = pix; } /* else if(m_lcd.attr[x/8+yoffs*20] == 0x40) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix(y,x) = pix; }*/ } } @@ -166,19 +162,15 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix(y,x) = pix; } /*else if(m_lcd.attr[x/8+yoffs*20] == 0x40) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix(y,x) = pix; }*/ } } diff --git a/src/mame/drivers/fp6000.cpp b/src/mame/drivers/fp6000.cpp index b4f5ecff25a..51bec4e9682 100644 --- a/src/mame/drivers/fp6000.cpp +++ b/src/mame/drivers/fp6000.cpp @@ -243,15 +243,15 @@ uint16_t fp6000_state::unk_r() MC6845_UPDATE_ROW( fp6000_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); - uint8_t *pcg = reinterpret_cast<uint8_t *>(m_pcg.target()); - uint32_t *vram = reinterpret_cast<uint32_t *>(m_gvram.target()); + pen_t const *const pen = m_palette->pens(); + uint8_t const *const pcg = reinterpret_cast<uint8_t *>(m_pcg.target()); + uint32_t const *const vram = reinterpret_cast<uint32_t *>(m_gvram.target()); for (int x = 0; x < x_count; x++) { // text mode - uint8_t code = (m_vram[ma + x] >> 0) & 0xff; - uint8_t color = (m_vram[ma + x] >> 8) & 0x0f; + uint8_t const code = (m_vram[ma + x] >> 0) & 0xff; + uint8_t const color = (m_vram[ma + x] >> 8) & 0x0f; uint8_t gfx = pcg[(code << 4) | ra]; // cursor? @@ -260,20 +260,20 @@ MC6845_UPDATE_ROW( fp6000_state::crtc_update_row ) // draw 8 pixels of the character for (int i = 0; i < 8; i++) - bitmap.pix32(y, x * 8 + i) = BIT(gfx, 7 - i) ? pen[color] : 0; + bitmap.pix(y, x * 8 + i) = BIT(gfx, 7 - i) ? pen[color] : 0; // graphics - uint32_t data = vram[(ma << 3) + (ra * x_count) + x]; + uint32_t const data = vram[(ma << 3) + (ra * x_count) + x]; // draw 8 gfx pixels - if ((data >> 12) & 0x0f) bitmap.pix32(y, x * 8 + 0) = pen[(data >> 12) & 0x0f]; - if ((data >> 8) & 0x0f) bitmap.pix32(y, x * 8 + 1) = pen[(data >> 8) & 0x0f]; - if ((data >> 4) & 0x0f) bitmap.pix32(y, x * 8 + 2) = pen[(data >> 4) & 0x0f]; - if ((data >> 0) & 0x0f) bitmap.pix32(y, x * 8 + 3) = pen[(data >> 0) & 0x0f]; - if ((data >> 28) & 0x0f) bitmap.pix32(y, x * 8 + 4) = pen[(data >> 28) & 0x0f]; - if ((data >> 24) & 0x0f) bitmap.pix32(y, x * 8 + 5) = pen[(data >> 24) & 0x0f]; - if ((data >> 20) & 0x0f) bitmap.pix32(y, x * 8 + 6) = pen[(data >> 20) & 0x0f]; - if ((data >> 16) & 0x0f) bitmap.pix32(y, x * 8 + 7) = pen[(data >> 16) & 0x0f]; + if ((data >> 12) & 0x0f) bitmap.pix(y, x * 8 + 0) = pen[(data >> 12) & 0x0f]; + if ((data >> 8) & 0x0f) bitmap.pix(y, x * 8 + 1) = pen[(data >> 8) & 0x0f]; + if ((data >> 4) & 0x0f) bitmap.pix(y, x * 8 + 2) = pen[(data >> 4) & 0x0f]; + if ((data >> 0) & 0x0f) bitmap.pix(y, x * 8 + 3) = pen[(data >> 0) & 0x0f]; + if ((data >> 28) & 0x0f) bitmap.pix(y, x * 8 + 4) = pen[(data >> 28) & 0x0f]; + if ((data >> 24) & 0x0f) bitmap.pix(y, x * 8 + 5) = pen[(data >> 24) & 0x0f]; + if ((data >> 20) & 0x0f) bitmap.pix(y, x * 8 + 6) = pen[(data >> 20) & 0x0f]; + if ((data >> 16) & 0x0f) bitmap.pix(y, x * 8 + 7) = pen[(data >> 16) & 0x0f]; } } diff --git a/src/mame/drivers/fs3216.cpp b/src/mame/drivers/fs3216.cpp index 5491a7a518b..a8ca0327d8e 100644 --- a/src/mame/drivers/fs3216.cpp +++ b/src/mame/drivers/fs3216.cpp @@ -141,7 +141,7 @@ void fs3216_state::machine_reset() MC6845_UPDATE_ROW(fs3216_state::crt_update_row) { - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { @@ -343,9 +343,9 @@ void fs3216_state::floppy_control_w(u8 data) m_floppy_status &= 0xef; } + m_fdc->reset_w(!BIT(data, 1)); if (!BIT(data, 1)) { - m_fdc->soft_reset(); m_fdc_dma_count = 0; m_fdc->tc_w(0); } diff --git a/src/mame/drivers/gaelco.cpp b/src/mame/drivers/gaelco.cpp index c5f84c5dc1a..f68d28271c9 100644 --- a/src/mame/drivers/gaelco.cpp +++ b/src/mame/drivers/gaelco.cpp @@ -105,87 +105,87 @@ void gaelco_state::thoop_encrypted_w(address_space &space, offs_t offset, uint16 void gaelco_state::bigkarnk_map(address_map &map) { - map(0x000000, 0x07ffff).rom(); /* ROM */ - map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::vram_w)).share("videoram"); /* Video RAM */ - map(0x102000, 0x103fff).ram(); /* Screen RAM */ - map(0x108000, 0x108007).writeonly().share("vregs"); /* Video Registers */ -// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); /* INT 6 ACK/Watchdog timer */ - map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); /* Palette */ - map(0x440000, 0x440fff).ram().share("spriteram"); /* Sprite RAM */ + map(0x000000, 0x07ffff).rom(); // ROM + map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::vram_w)).share("videoram"); // Video RAM + map(0x102000, 0x103fff).ram(); // Screen RAM + map(0x108000, 0x108007).writeonly().share("vregs"); // Video Registers +// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // INT 6 ACK/Watchdog timer + map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette + map(0x440000, 0x440fff).ram().share("spriteram"); // Sprite RAM map(0x700000, 0x700001).portr("DSW1"); map(0x700002, 0x700003).portr("DSW2"); map(0x700004, 0x700005).portr("P1"); map(0x700006, 0x700007).portr("P2"); map(0x700008, 0x700009).portr("SERVICE"); map(0x70000b, 0x70000b).select(0x000070).lw8(NAME([this] (offs_t offset, u8 data) { m_outlatch->write_d0(offset >> 4, data); })); - map(0x70000f, 0x70000f).w(m_soundlatch, FUNC(generic_latch_8_device::write)); /* Triggers a FIRQ on the sound CPU */ - map(0xff8000, 0xffffff).ram(); /* Work RAM */ + map(0x70000f, 0x70000f).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // Triggers a FIRQ on the sound CPU + map(0xff8000, 0xffffff).ram(); // Work RAM } void gaelco_state::bigkarnk_snd_map(address_map &map) { - map(0x0000, 0x07ff).ram(); /* RAM */ - map(0x0800, 0x0801).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 */ -// map(0x0900, 0x0900).nopw(); /* enable sound output? */ - map(0x0a00, 0x0a01).rw("ymsnd", FUNC(ym3812_device::read), FUNC(ym3812_device::write)); /* YM3812 */ - map(0x0b00, 0x0b00).r(m_soundlatch, FUNC(generic_latch_8_device::read)); /* Sound latch */ - map(0x0c00, 0xffff).rom(); /* ROM */ + map(0x0000, 0x07ff).ram(); // RAM + map(0x0800, 0x0801).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // OKI6295 +// map(0x0900, 0x0900).nopw(); // Enable sound output? + map(0x0a00, 0x0a01).rw("ymsnd", FUNC(ym3812_device::read), FUNC(ym3812_device::write)); // YM3812 + map(0x0b00, 0x0b00).r(m_soundlatch, FUNC(generic_latch_8_device::read)); // Sound latch + map(0x0c00, 0xffff).rom(); // ROM } void gaelco_state::maniacsq_map(address_map &map) { - map(0x000000, 0x0fffff).rom(); /* ROM */ - map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::vram_w)).share("videoram"); /* Video RAM */ - map(0x102000, 0x103fff).ram(); /* Screen RAM */ - map(0x108000, 0x108007).writeonly().share("vregs"); /* Video Registers */ -// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); /* INT 6 ACK/Watchdog timer */ - map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); /* Palette */ - map(0x440000, 0x440fff).ram().share("spriteram"); /* Sprite RAM */ + map(0x000000, 0x0fffff).rom(); // ROM + map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::vram_w)).share("videoram"); // Video RAM + map(0x102000, 0x103fff).ram(); // Screen RAM + map(0x108000, 0x108007).writeonly().share("vregs"); // Video Registers +// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // INT 6 ACK/Watchdog timer + map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette + map(0x440000, 0x440fff).ram().share("spriteram"); // Sprite RAM map(0x700000, 0x700001).portr("DSW2"); map(0x700002, 0x700003).portr("DSW1"); map(0x700004, 0x700005).portr("P1"); map(0x700006, 0x700007).portr("P2"); map(0x70000d, 0x70000d).w(FUNC(gaelco_state::oki_bankswitch_w)); - map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status register */ - map(0xff0000, 0xffffff).ram(); /* Work RAM */ + map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // OKI6295 status register + map(0xff0000, 0xffffff).ram(); // Work RAM } void gaelco_state::squash_map(address_map &map) { - map(0x000000, 0x0fffff).rom(); /* ROM */ - map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::vram_encrypted_w)).share("videoram"); /* Video RAM */ - map(0x102000, 0x103fff).ram().w(FUNC(gaelco_state::encrypted_w)).share("screenram"); /* Screen RAM */ - map(0x108000, 0x108007).writeonly().share("vregs"); /* Video Registers */ -// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); /* INT 6 ACK/Watchdog timer */ - map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); /* Palette */ - map(0x440000, 0x440fff).ram().share("spriteram"); /* Sprite RAM */ + map(0x000000, 0x0fffff).rom(); // ROM + map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::vram_encrypted_w)).share("videoram"); // Video RAM + map(0x102000, 0x103fff).ram().w(FUNC(gaelco_state::encrypted_w)).share("screenram"); // Screen RAM + map(0x108000, 0x108007).writeonly().share("vregs"); // Video Registers +// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // INT 6 ACK/Watchdog timer + map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette + map(0x440000, 0x440fff).ram().share("spriteram"); // Sprite RAM map(0x700000, 0x700001).portr("DSW2"); map(0x700002, 0x700003).portr("DSW1"); map(0x700004, 0x700005).portr("P1"); map(0x700006, 0x700007).portr("P2"); map(0x70000b, 0x70000b).select(0x000070).lw8(NAME([this] (offs_t offset, u8 data) { m_outlatch->write_d0(offset >> 4, data); })); map(0x70000d, 0x70000d).w(FUNC(gaelco_state::oki_bankswitch_w)); - map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status register */ - map(0xff0000, 0xffffff).ram(); /* Work RAM */ + map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // OKI6295 status register + map(0xff0000, 0xffffff).ram(); // Work RAM } void gaelco_state::thoop_map(address_map &map) { - map(0x000000, 0x0fffff).rom(); /* ROM */ - map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::thoop_vram_encrypted_w)).share("videoram"); /* Video RAM */ - map(0x102000, 0x103fff).ram().w(FUNC(gaelco_state::thoop_encrypted_w)).share("screenram"); /* Screen RAM */ - map(0x108000, 0x108007).writeonly().share("vregs"); /* Video Registers */ -// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); /* INT 6 ACK/Watchdog timer */ - map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); /* Palette */ - map(0x440000, 0x440fff).ram().share("spriteram"); /* Sprite RAM */ + map(0x000000, 0x0fffff).rom(); // ROM + map(0x100000, 0x101fff).ram().w(FUNC(gaelco_state::thoop_vram_encrypted_w)).share("videoram"); // Video RAM + map(0x102000, 0x103fff).ram().w(FUNC(gaelco_state::thoop_encrypted_w)).share("screenram"); // Screen RAM + map(0x108000, 0x108007).writeonly().share("vregs"); // Video Registers +// map(0x10800c, 0x10800d).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // INT 6 ACK/Watchdog timer + map(0x200000, 0x2007ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette + map(0x440000, 0x440fff).ram().share("spriteram"); // Sprite RAM map(0x700000, 0x700001).portr("DSW2"); map(0x700002, 0x700003).portr("DSW1"); map(0x700004, 0x700005).portr("P1"); map(0x700006, 0x700007).portr("P2"); map(0x70000b, 0x70000b).select(0x000070).lw8(NAME([this] (offs_t offset, u8 data) { m_outlatch->write_d0(offset >> 4, data); })); map(0x70000d, 0x70000d).w(FUNC(gaelco_state::oki_bankswitch_w)); - map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status register */ - map(0xff0000, 0xffffff).ram(); /* Work RAM */ + map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // OKI6295 status register + map(0xff0000, 0xffffff).ram(); // Work RAM } @@ -202,7 +202,7 @@ void gaelco_state::oki_map(address_map &map) * *************************************/ -/* Common Inputs used by all the games */ +// Common Inputs used by all the games static INPUT_PORTS_START( gaelco ) PORT_START("DSW1") PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:8,7,6,5") @@ -638,12 +638,12 @@ void gaelco_state::machine_start() // TODO: verify all clocks (XTALs are 8.0MHz & 24.000 MHz) - One PCB reported to have 8867.23 kHz instead of 8MHz void gaelco_state::bigkarnk(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(24'000'000)/2); /* MC68000P10, 12 MHz? */ + // Basic machine hardware + M68000(config, m_maincpu, XTAL(24'000'000)/2); // MC68000P10, 12 MHz? m_maincpu->set_addrmap(AS_PROGRAM, &gaelco_state::bigkarnk_map); m_maincpu->set_vblank_int("screen", FUNC(gaelco_state::irq6_line_hold)); - MC6809E(config, m_audiocpu, XTAL(8'000'000)/4); /* 68B09EP, 2 MHz? */ + MC6809E(config, m_audiocpu, XTAL(8'000'000)/4); // 68B09EP, 2 MHz? m_audiocpu->set_addrmap(AS_PROGRAM, &gaelco_state::bigkarnk_snd_map); config.set_maximum_quantum(attotime::from_hz(600)); @@ -654,7 +654,7 @@ void gaelco_state::bigkarnk(machine_config &config) m_outlatch->q_out_cb<2>().set(FUNC(gaelco_state::coin1_counter_w)); m_outlatch->q_out_cb<3>().set(FUNC(gaelco_state::coin2_counter_w)); - /* video hardware */ + // Video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); @@ -668,7 +668,7 @@ void gaelco_state::bigkarnk(machine_config &config) MCFG_VIDEO_START_OVERRIDE(gaelco_state,bigkarnk) - /* sound hardware */ + // Sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -681,12 +681,12 @@ void gaelco_state::bigkarnk(machine_config &config) void gaelco_state::maniacsq(machine_config &config) { - /* basic machine hardware */ + // Basic machine hardware M68000(config, m_maincpu, XTAL(24'000'000)/2); /* verified on pcb */ m_maincpu->set_addrmap(AS_PROGRAM, &gaelco_state::maniacsq_map); m_maincpu->set_vblank_int("screen", FUNC(gaelco_state::irq6_line_hold)); - /* video hardware */ + // Video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); @@ -700,7 +700,7 @@ void gaelco_state::maniacsq(machine_config &config) MCFG_VIDEO_START_OVERRIDE(gaelco_state,maniacsq) - /* sound hardware */ + // Sound hardware SPEAKER(config, "mono").front_center(); okim6295_device &oki(OKIM6295(config, "oki", XTAL(1'000'000), okim6295_device::PIN7_HIGH)); // pin 7 not verified @@ -710,8 +710,8 @@ void gaelco_state::maniacsq(machine_config &config) void gaelco_state::squash(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(20'000'000)/2); /* verified on pcb */ + // Basic machine hardware + M68000(config, m_maincpu, XTAL(20'000'000)/2); // Verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &gaelco_state::squash_map); m_maincpu->set_vblank_int("screen", FUNC(gaelco_state::irq6_line_hold)); @@ -724,7 +724,7 @@ void gaelco_state::squash(machine_config &config) m_outlatch->q_out_cb<3>().set(FUNC(gaelco_state::coin2_counter_w)); m_outlatch->q_out_cb<4>().set_nop(); // used - /* video hardware */ + // Video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(58); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); @@ -738,7 +738,7 @@ void gaelco_state::squash(machine_config &config) MCFG_VIDEO_START_OVERRIDE(gaelco_state,maniacsq) - /* sound hardware */ + // Sound hardware SPEAKER(config, "mono").front_center(); okim6295_device &oki(OKIM6295(config, "oki", XTAL(1'000'000), okim6295_device::PIN7_HIGH)); /* verified on pcb */ @@ -748,8 +748,8 @@ void gaelco_state::squash(machine_config &config) void gaelco_state::thoop(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(24'000'000)/2); /* verified on pcb */ + // Basic machine hardware + M68000(config, m_maincpu, XTAL(24'000'000)/2); // Verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &gaelco_state::thoop_map); m_maincpu->set_vblank_int("screen", FUNC(gaelco_state::irq6_line_hold)); @@ -762,7 +762,7 @@ void gaelco_state::thoop(machine_config &config) m_outlatch->q_out_cb<3>().set(FUNC(gaelco_state::coin2_counter_w)); m_outlatch->q_out_cb<4>().set_nop(); // used - /* video hardware */ + // Video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); @@ -776,7 +776,7 @@ void gaelco_state::thoop(machine_config &config) MCFG_VIDEO_START_OVERRIDE(gaelco_state,maniacsq) - /* sound hardware */ + // Sound hardware SPEAKER(config, "mono").front_center(); okim6295_device &oki(OKIM6295(config, "oki", XTAL(1'000'000), okim6295_device::PIN7_HIGH)); // pin 7 not verified @@ -791,12 +791,12 @@ void gaelco_state::thoop(machine_config &config) * *************************************/ -ROM_START( bigkarnk ) /* PCB silkscreened REF.901112 */ - ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */ +ROM_START( bigkarnk ) // PCB silkscreened REF.901112 + ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "d16", 0x000000, 0x040000, CRC(44fb9c73) SHA1(c33852b37afea15482f4a43cb045434660e7a056) ) ROM_LOAD16_BYTE( "d19", 0x000001, 0x040000, CRC(ff79dfdd) SHA1(2bfa440299317967ba2018d3a148291ae0c144ae) ) - ROM_REGION( 0x01e000, "audiocpu", 0 ) /* 6809 code */ + ROM_REGION( 0x01e000, "audiocpu", 0 ) // 6809 code ROM_LOAD( "d5", 0x000000, 0x010000, CRC(3b73b9c5) SHA1(1b1c5545609a695dab87d611bd53e0c3dd91e6b7) ) ROM_REGION( 0x200000, "gfx1", 0 ) @@ -805,8 +805,12 @@ ROM_START( bigkarnk ) /* PCB silkscreened REF.901112 */ ROM_LOAD( "h8", 0x100000, 0x080000, CRC(83dce5a3) SHA1(b4f9473e93c96f4b86c446e89d13fd3ef2b03996) ) ROM_LOAD( "h6", 0x180000, 0x080000, CRC(24e84b24) SHA1(c0ad6ce1e4b8aa7b9c9a3db8bb0165e90f4b48ed) ) - ROM_REGION( 0x040000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_REGION( 0x040000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 ROM_LOAD( "d1", 0x000000, 0x040000, CRC(26444ad1) SHA1(804101b9bbb6e1b6d43a1e9d91737f9c3b27802a) ) + + ROM_REGION( 0x26e, "plds", 0 ) + ROM_LOAD( "bigkarnak_gal16v8.d6", 0x000, 0x117, BAD_DUMP CRC(587fe895) SHA1(bc244a50820ceff9bfbdc7f04bcac030198371ec) ) // Bruteforced but verified + ROM_LOAD( "bigkarnak_gal20v8.d21", 0x117, 0x157, BAD_DUMP CRC(0dcb286e) SHA1(4071af05ba0fd17446691e53bdbba736e416bf4a) ) // Bruteforced but verified ROM_END ROM_START( maniacsp ) /* PCB - REF 922804/2 */ @@ -816,17 +820,17 @@ ROM_START( maniacsp ) /* PCB - REF 922804/2 */ ROM_REGION( 0x200000, "gfx1", ROMREGION_ERASE00 ) ROM_LOAD( "f3", 0x000000, 0x040000, CRC(e7f6582b) SHA1(9e352edf2f71d0edecb54a11ab3fd0e3ec867d42) ) - /* 0x040000-0x07ffff empty */ + // 0x040000-0x07ffff empty ROM_LOAD( "f2", 0x080000, 0x040000, CRC(ca43a5ae) SHA1(8d2ed537be1dee60096a58b68b735fb50cab3285) ) - /* 0x0c0000-0x0fffff empty */ + // 0x0c0000-0x0fffff empty ROM_LOAD( "f1", 0x100000, 0x040000, CRC(fca112e8) SHA1(2a1412f8f1c856b18b6cc7794191d327a415266f) ) - /* 0x140000-0x17ffff empty */ + // 0x140000-0x17ffff empty ROM_LOAD( "f0", 0x180000, 0x040000, CRC(6e829ee8) SHA1(b602da8d987c1bafa41baf5d5e5d753e29ff5403) ) - /* 0x1c0000-0x1fffff empty */ + // 0x1c0000-0x1fffff empty - ROM_REGION( 0x080000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_REGION( 0x080000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 ROM_LOAD( "c1", 0x000000, 0x080000, CRC(2557f2d6) SHA1(3a99388f2d845281f73a427d6dc797dce87b2f82) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + // 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs ROM_END @@ -1089,49 +1093,61 @@ Notes: SQUASH_SOUND.1D 27C040 Sound */ -ROM_START( squash ) /* PCB - REF.922804/1 */ - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ +ROM_START( squash ) // PCB - REF.922804/1 + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "squash.d18", 0x000000, 0x20000, CRC(ce7aae96) SHA1(4fe8666ae571bffc5a08fa68346c0623282989eb) ) ROM_LOAD16_BYTE( "squash.d16", 0x000001, 0x20000, CRC(8ffaedd7) SHA1(f4aada17ba67dd8b6c5a395e832bcbba2764c59d) ) ROM_REGION( 0x200000, "gfx1", 0 ) - ROM_LOAD( "squash.c09", 0x180000, 0x80000, CRC(0bb91c69) SHA1(8be945049ab411a4d49bd64bd3937542ec9ef9fb) ) /* encrypted video ram */ - ROM_LOAD( "squash.c10", 0x100000, 0x80000, CRC(892a035c) SHA1(d0156ceb9aa6639a1124c17fb12389be319bb51f) ) /* encrypted video ram */ - ROM_LOAD( "squash.c11", 0x080000, 0x80000, CRC(9e19694d) SHA1(1df4646f3147719fef516a37aa361ae26d9b23a2) ) /* encrypted video ram */ - ROM_LOAD( "squash.c12", 0x000000, 0x80000, CRC(5c440645) SHA1(4f2fc1647ffc549fa079f2dc0aaaceb447afdf44) ) /* encrypted video ram */ + ROM_LOAD( "squash.c09", 0x180000, 0x80000, CRC(0bb91c69) SHA1(8be945049ab411a4d49bd64bd3937542ec9ef9fb) ) // Encrypted video RAM + ROM_LOAD( "squash.c10", 0x100000, 0x80000, CRC(892a035c) SHA1(d0156ceb9aa6639a1124c17fb12389be319bb51f) ) // Encrypted video RAM + ROM_LOAD( "squash.c11", 0x080000, 0x80000, CRC(9e19694d) SHA1(1df4646f3147719fef516a37aa361ae26d9b23a2) ) // Encrypted video RAM + ROM_LOAD( "squash.c12", 0x000000, 0x80000, CRC(5c440645) SHA1(4f2fc1647ffc549fa079f2dc0aaaceb447afdf44) ) // Encrypted video RAM - ROM_REGION( 0x80000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_REGION( 0x80000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 ROM_LOAD( "squash.d01", 0x000000, 0x80000, CRC(a1b9651b) SHA1(a396ba94889f70ea06d6330e3606b0f2497ff6ce) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + // 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs + + ROM_REGION( 0x4dc, "plds", 0) + ROM_LOAD ( "squashv1_gal16v8.f2", 0x000, 0x117, CRC(d5ed5985) SHA1(a4e9c8e3a7774e2a02fbca3ddf8175cf251825ba) ) // Unprotected + ROM_LOAD ( "squashv1_gal16v8.j16", 0x117, 0x117, CRC(fe78b903) SHA1(c806e63ce56a77f631043c184a42bf77ebda8a09) ) // Unprotected + ROM_LOAD ( "squashv1_gal20v8.d21", 0x22e, 0x157, CRC(a715e392) SHA1(31ebc78b084d49cc2f6479cbd42738e6bfbfb46a) ) // Unprotected + ROM_LOAD ( "squashv1_gal20v8.h11", 0x385, 0x157, CRC(51e34bc2) SHA1(381a898b3afb709e7d8e0f87df106f23aec2ccbe) ) // Unprotected ROM_END -ROM_START( thoop ) /* PCB - REF.922804/1 */ - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ +ROM_START( thoop ) // PCB - REF.922804/1 + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "th18dea1.040", 0x000000, 0x80000, CRC(59bad625) SHA1(28e058b2290bc5f7130b801014d026432f9e7fd5) ) ROM_LOAD16_BYTE( "th161eb4.020", 0x000001, 0x40000, CRC(6add61ed) SHA1(0e789d9a0ac19b6143044fbc04ab2227735b2a8f) ) ROM_REGION( 0x400000, "gfx1", 0 ) - ROM_LOAD( "c09", 0x300000, 0x040000, CRC(06f0edbf) SHA1(3cf2e5c29cd00b43d49a106084076f2ac0dbad98) ) /* encrypted video ram */ + ROM_LOAD( "c09", 0x300000, 0x040000, CRC(06f0edbf) SHA1(3cf2e5c29cd00b43d49a106084076f2ac0dbad98) ) // Encrypted video RAM ROM_CONTINUE( 0x380000, 0x040000 ) ROM_CONTINUE( 0x340000, 0x040000 ) ROM_CONTINUE( 0x3c0000, 0x040000 ) - ROM_LOAD( "c10", 0x200000, 0x040000, CRC(2d227085) SHA1(b224efd59ec83bb786fa92a23ef2d27ed36cab6c) ) /* encrypted video ram */ + ROM_LOAD( "c10", 0x200000, 0x040000, CRC(2d227085) SHA1(b224efd59ec83bb786fa92a23ef2d27ed36cab6c) ) // Encrypted video RAM ROM_CONTINUE( 0x280000, 0x040000 ) ROM_CONTINUE( 0x240000, 0x040000 ) ROM_CONTINUE( 0x2c0000, 0x040000 ) - ROM_LOAD( "c11", 0x100000, 0x040000, CRC(7403ef7e) SHA1(52a737816e25a07ada070ed3a5f40bbbd22ac8e0) ) /* encrypted video ram */ + ROM_LOAD( "c11", 0x100000, 0x040000, CRC(7403ef7e) SHA1(52a737816e25a07ada070ed3a5f40bbbd22ac8e0) ) // Encrypted video RAM ROM_CONTINUE( 0x180000, 0x040000 ) ROM_CONTINUE( 0x140000, 0x040000 ) ROM_CONTINUE( 0x1c0000, 0x040000 ) - ROM_LOAD( "c12", 0x000000, 0x040000, CRC(29a5ca36) SHA1(fdcfdefb3b02bfe34781fdd0295640caabe2a5fb) ) /* encrypted video ram */ + ROM_LOAD( "c12", 0x000000, 0x040000, CRC(29a5ca36) SHA1(fdcfdefb3b02bfe34781fdd0295640caabe2a5fb) ) // Encrypted video RAM ROM_CONTINUE( 0x080000, 0x040000 ) ROM_CONTINUE( 0x040000, 0x040000 ) ROM_CONTINUE( 0x0c0000, 0x040000 ) - ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_REGION( 0x100000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 ROM_LOAD( "sound", 0x000000, 0x100000, CRC(99f80961) SHA1(de3a514a8f46dffd5f762e52aac1f4c3b08e2e18) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + // 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs + + ROM_REGION( 0x4dc, "plds", 0) + ROM_LOAD ( "thunderhoop_gal16v8.f2", 0x000, 0x117, BAD_DUMP CRC(d5ed5985) SHA1(a4e9c8e3a7774e2a02fbca3ddf8175cf251825ba) ) // Bruteforced but verified + ROM_LOAD ( "thunderhoop_gal16v8.j16", 0x117, 0x117, BAD_DUMP CRC(fe78b903) SHA1(c806e63ce56a77f631043c184a42bf77ebda8a09) ) // Bruteforced but verified + ROM_LOAD ( "thunderhoop_gal20v8.d21", 0x22e, 0x157, BAD_DUMP CRC(a715e392) SHA1(31ebc78b084d49cc2f6479cbd42738e6bfbfb46a) ) // Bruteforced but verified + ROM_LOAD ( "thunderhoop_gal20v8.h11", 0x385, 0x157, BAD_DUMP CRC(51e34bc2) SHA1(381a898b3afb709e7d8e0f87df106f23aec2ccbe) ) // Bruteforced but verified ROM_END @@ -1142,13 +1158,13 @@ ROM_END * *************************************/ -GAME( 1991, bigkarnk, 0, bigkarnk, bigkarnk, gaelco_state, empty_init, ROT0, "Gaelco", "Big Karnak", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, biomtoy, 0, maniacsq, biomtoy, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1885)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, biomtoya, biomtoy, maniacsq, biomtoy, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1884)", MACHINE_SUPPORTS_SAVE ) -GAME( 1995, biomtoyb, biomtoy, maniacsq, biomtoy, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1878)", MACHINE_SUPPORTS_SAVE ) -GAME( 1994, biomtoyc, biomtoy, maniacsq, biomtoyc, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1870)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, bigkarnk, 0, bigkarnk, bigkarnk, gaelco_state, empty_init, ROT0, "Gaelco", "Big Karnak", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, biomtoy, 0, maniacsq, biomtoy, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1885)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, biomtoya, biomtoy, maniacsq, biomtoy, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1884)", MACHINE_SUPPORTS_SAVE ) +GAME( 1995, biomtoyb, biomtoy, maniacsq, biomtoy, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1878)", MACHINE_SUPPORTS_SAVE ) +GAME( 1994, biomtoyc, biomtoy, maniacsq, biomtoyc, gaelco_state, empty_init, ROT0, "Gaelco", "Biomechanical Toy (Ver. 1.0.1870)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, bioplayc, biomtoy, maniacsq, bioplayc, gaelco_state, empty_init, ROT0, "Gaelco", "Bioplaything Cop (Ver. 1.0.1823, prototype)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) // copyright based on Ver. 1.0.1870 -GAME( 1996, maniacsp, maniacsq, maniacsq, maniacsq, gaelco_state, empty_init, ROT0, "Gaelco", "Maniac Square (prototype)", MACHINE_SUPPORTS_SAVE ) // sometimes listed as a 1992 proto? -GAME( 1995, lastkm, 0, maniacsq, lastkm, gaelco_state, empty_init, ROT0, "Gaelco", "Last KM (Ver 1.0.0275)", MACHINE_SUPPORTS_SAVE ) // used on 'Salter' exercise bikes -GAME( 1992, squash, 0, squash, squash, gaelco_state, empty_init, ROT0, "Gaelco", "Squash (Ver. 1.0)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, thoop, 0, thoop, thoop, gaelco_state, empty_init, ROT0, "Gaelco", "Thunder Hoop (Ver. 1, Checksum 02A09F7D)", MACHINE_SUPPORTS_SAVE ) // could be other versions, still Ver. 1 but different checksum listed on boot +GAME( 1996, maniacsp, maniacsq, maniacsq, maniacsq, gaelco_state, empty_init, ROT0, "Gaelco", "Maniac Square (prototype)", MACHINE_SUPPORTS_SAVE ) // sometimes listed as a 1992 proto? +GAME( 1995, lastkm, 0, maniacsq, lastkm, gaelco_state, empty_init, ROT0, "Gaelco", "Last KM (Ver 1.0.0275)", MACHINE_SUPPORTS_SAVE ) // used on 'Salter' exercise bikes +GAME( 1992, squash, 0, squash, squash, gaelco_state, empty_init, ROT0, "Gaelco", "Squash (Ver. 1.0)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, thoop, 0, thoop, thoop, gaelco_state, empty_init, ROT0, "Gaelco", "Thunder Hoop (Ver. 1, Checksum 02A09F7D)", MACHINE_SUPPORTS_SAVE ) // could be other versions, still Ver. 1 but different checksum listed on boot diff --git a/src/mame/drivers/gaelco2.cpp b/src/mame/drivers/gaelco2.cpp index b24d2709298..8dd8abfa485 100644 --- a/src/mame/drivers/gaelco2.cpp +++ b/src/mame/drivers/gaelco2.cpp @@ -1102,8 +1102,8 @@ INPUT_PORTS_END void bang_state::bang(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(30'000'000) / 2); /* 15 MHz */ + // Basic machine hardware + M68000(config, m_maincpu, XTAL(30'000'000) / 2); // 15 MHz m_maincpu->set_addrmap(AS_PROGRAM, &bang_state::bang_map); TIMER(config, "scantimer").configure_scanline(FUNC(bang_state::bang_irq), "screen", 0, 1); @@ -1116,7 +1116,7 @@ void bang_state::bang(machine_config &config) m_mainlatch->q_out_cb<5>().set("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)); /* EEPROM serial clock */ m_mainlatch->q_out_cb<6>().set("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)); /* EEPROM chip select */ - /* video hardware */ + // Video hardware BUFFERED_SPRITERAM16(config, m_spriteram); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -1195,57 +1195,63 @@ JP3 - 4 pin light gun header (player 2) */ ROM_START( bang ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bang53.ic53", 0x000000, 0x080000, CRC(014bb939) SHA1(bb245acf7a3bd4a56b3559518bcb8d0ae39dbaf4) ) ROM_LOAD16_BYTE( "bang55.ic55", 0x000001, 0x080000, CRC(582f8b1e) SHA1(c9b0d4c1dee71cdb2c01d49f20ffde32eddc9583) ) - ROM_REGION( 0x0a00000, "gfx1", 0 ) /* GFX + Sound */ - ROM_LOAD( "bang16.ic16", 0x0000000, 0x0080000, CRC(6ee4b878) SHA1(f646380d95650a60b5a17973bdfd3b80450a4d3b) ) /* GFX only */ - ROM_LOAD( "bang17.ic17", 0x0080000, 0x0080000, CRC(0c35aa6f) SHA1(df0474b1b9466d3c199e5aade39b7233f0cb45ee) ) /* GFX only */ - ROM_LOAD( "bang18.ic18", 0x0100000, 0x0080000, CRC(2056b1ad) SHA1(b796f92eef4bbb0efa12c53580e429b8a0aa394c) ) /* Sound only */ - ROM_FILL( 0x0180000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang9.ic9", 0x0200000, 0x0080000, CRC(078195dc) SHA1(362ff194e2579346dfc7af88559b0718bc36ec8a) ) /* GFX only */ - ROM_LOAD( "bang10.ic10", 0x0280000, 0x0080000, CRC(06711eeb) SHA1(3662ffe730fb54ee48925de9765f88be1abd5e4e) ) /* GFX only */ - ROM_LOAD( "bang11.ic11", 0x0300000, 0x0080000, CRC(2088d15c) SHA1(0c043ab9fd33836fa4b7ad60fd8e7cb96ffb6121) ) /* Sound only */ - ROM_FILL( 0x0380000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang1.ic1", 0x0400000, 0x0080000, CRC(e7b97b0f) SHA1(b5503687ae3ca0a0faa4b867a267d89dac788d6d) ) /* GFX only */ - ROM_LOAD( "bang2.ic2", 0x0480000, 0x0080000, CRC(ff297a8f) SHA1(28819a9d7b3cb177e7a7db3fe23a94f5cba33049) ) /* GFX only */ - ROM_LOAD( "bang3.ic3", 0x0500000, 0x0080000, CRC(d3da5d4f) SHA1(b9bea0b4d20ab0bfda3fac2bb1fab974c007aaf0) ) /* Sound only */ - ROM_FILL( 0x0580000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang20.ic20", 0x0600000, 0x0080000, CRC(a1145df8) SHA1(305cda041a6f201cb011982f1bf1fc6a4153a669) ) /* GFX only */ - ROM_LOAD( "bang13.ic13", 0x0680000, 0x0080000, CRC(fe3e8d07) SHA1(7a37561b1cf422b47cddb8751a6b6d57dec8baae) ) /* GFX only */ - ROM_LOAD( "bang5.ic5", 0x0700000, 0x0080000, CRC(9bee444c) SHA1(aebaa3306e7e5aada99ed469da9bf64507808cff) ) /* Sound only */ - ROM_FILL( 0x0780000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang21.ic21", 0x0800000, 0x0080000, CRC(fd93d7f2) SHA1(ff9d8eb5ac8d9757132aa6d79d2f7662c14cd650) ) /* GFX only */ - ROM_LOAD( "bang14.ic14", 0x0880000, 0x0080000, CRC(858fcbf9) SHA1(1e67431c8775666f4839bdc427fabf59ffc708c0) ) /* GFX only */ - ROM_FILL( 0x0900000, 0x0100000, 0x00 ) /* Empty */ + ROM_REGION( 0x0a00000, "gfx1", 0 ) // GFX + Sound + ROM_LOAD( "bang16.ic16", 0x0000000, 0x0080000, CRC(6ee4b878) SHA1(f646380d95650a60b5a17973bdfd3b80450a4d3b) ) // GFX only + ROM_LOAD( "bang17.ic17", 0x0080000, 0x0080000, CRC(0c35aa6f) SHA1(df0474b1b9466d3c199e5aade39b7233f0cb45ee) ) // GFX only + ROM_LOAD( "bang18.ic18", 0x0100000, 0x0080000, CRC(2056b1ad) SHA1(b796f92eef4bbb0efa12c53580e429b8a0aa394c) ) // Sound only + ROM_FILL( 0x0180000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang9.ic9", 0x0200000, 0x0080000, CRC(078195dc) SHA1(362ff194e2579346dfc7af88559b0718bc36ec8a) ) // GFX only + ROM_LOAD( "bang10.ic10", 0x0280000, 0x0080000, CRC(06711eeb) SHA1(3662ffe730fb54ee48925de9765f88be1abd5e4e) ) // GFX only + ROM_LOAD( "bang11.ic11", 0x0300000, 0x0080000, CRC(2088d15c) SHA1(0c043ab9fd33836fa4b7ad60fd8e7cb96ffb6121) ) // Sound only + ROM_FILL( 0x0380000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang1.ic1", 0x0400000, 0x0080000, CRC(e7b97b0f) SHA1(b5503687ae3ca0a0faa4b867a267d89dac788d6d) ) // GFX only + ROM_LOAD( "bang2.ic2", 0x0480000, 0x0080000, CRC(ff297a8f) SHA1(28819a9d7b3cb177e7a7db3fe23a94f5cba33049) ) // GFX only + ROM_LOAD( "bang3.ic3", 0x0500000, 0x0080000, CRC(d3da5d4f) SHA1(b9bea0b4d20ab0bfda3fac2bb1fab974c007aaf0) ) // Sound only + ROM_FILL( 0x0580000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang20.ic20", 0x0600000, 0x0080000, CRC(a1145df8) SHA1(305cda041a6f201cb011982f1bf1fc6a4153a669) ) // GFX only + ROM_LOAD( "bang13.ic13", 0x0680000, 0x0080000, CRC(fe3e8d07) SHA1(7a37561b1cf422b47cddb8751a6b6d57dec8baae) ) // GFX only + ROM_LOAD( "bang5.ic5", 0x0700000, 0x0080000, CRC(9bee444c) SHA1(aebaa3306e7e5aada99ed469da9bf64507808cff) ) // Sound only + ROM_FILL( 0x0780000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang21.ic21", 0x0800000, 0x0080000, CRC(fd93d7f2) SHA1(ff9d8eb5ac8d9757132aa6d79d2f7662c14cd650) ) // GFX only + ROM_LOAD( "bang14.ic14", 0x0880000, 0x0080000, CRC(858fcbf9) SHA1(1e67431c8775666f4839bdc427fabf59ffc708c0) ) // GFX only + ROM_FILL( 0x0900000, 0x0100000, 0x00 ) // Empty + + ROM_REGION( 0x400, "plds", 0) + ROM_LOAD ( "bang_gal16v8.ic56", 0x000, 0x117, BAD_DUMP CRC(226923ac) SHA1(b1cac5208673183f401702ba844e1016d5fa4ea0) ) // Bruteforced but verified ROM_END ROM_START( bangj ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "bang-a.ic53", 0x000000, 0x080000, CRC(5ee514e9) SHA1(b78b507d18de41be58049f5c597acd107ec1273f) ) ROM_LOAD16_BYTE( "bang-a.ic55", 0x000001, 0x080000, CRC(b90223ab) SHA1(7c097754a710169f41c574c3cc1a6346824853c4) ) - ROM_REGION( 0x0a00000, "gfx1", 0 ) /* GFX + Sound */ - ROM_LOAD( "bang-a.ic16", 0x0000000, 0x0080000, CRC(3b63acfc) SHA1(48f5598cdbc70f342d6b75909166571271920a8f) ) /* GFX only */ - ROM_LOAD( "bang-a.ic17", 0x0080000, 0x0080000, CRC(72865b80) SHA1(ec7753ea7961015149b9e6386fdeb9bd59aa962a) ) /* GFX only */ - ROM_LOAD( "bang18.ic18", 0x0100000, 0x0080000, CRC(2056b1ad) SHA1(b796f92eef4bbb0efa12c53580e429b8a0aa394c) ) /* Sound only */ - ROM_FILL( 0x0180000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang-a.ic9", 0x0200000, 0x0080000, CRC(3cb86360) SHA1(c803b3add253a552a1554714218740bdfca91764) ) /* GFX only */ - ROM_LOAD( "bang-a.ic10", 0x0280000, 0x0080000, CRC(03fdd777) SHA1(9eec194239f93d961ee9902a585c872dcdc7728f) ) /* GFX only */ - ROM_LOAD( "bang11.ic11", 0x0300000, 0x0080000, CRC(2088d15c) SHA1(0c043ab9fd33836fa4b7ad60fd8e7cb96ffb6121) ) /* Sound only */ - ROM_FILL( 0x0380000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang-a.ic1", 0x0400000, 0x0080000, CRC(965d0ad9) SHA1(eff521735129b7dd9366855c6312ed568950233c) ) /* GFX only */ - ROM_LOAD( "bang-a.ic2", 0x0480000, 0x0080000, CRC(8ea261a7) SHA1(50b59cf058ca03c0b8c888f6ddb40c720a210ece) ) /* GFX only */ - ROM_LOAD( "bang3.ic3", 0x0500000, 0x0080000, CRC(d3da5d4f) SHA1(b9bea0b4d20ab0bfda3fac2bb1fab974c007aaf0) ) /* Sound only */ - ROM_FILL( 0x0580000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang-a.ic20", 0x0600000, 0x0080000, CRC(4b828f3c) SHA1(5227a89c05c659a85d33f092c6778ce9d57a0236) ) /* GFX only */ - ROM_LOAD( "bang-a.ic13", 0x0680000, 0x0080000, CRC(d1146b92) SHA1(2b28d49fbffea6c038160fdab177bc0045195ca8) ) /* GFX only */ - ROM_LOAD( "bang5.ic5", 0x0700000, 0x0080000, CRC(9bee444c) SHA1(aebaa3306e7e5aada99ed469da9bf64507808cff) ) /* Sound only */ - ROM_FILL( 0x0780000, 0x0080000, 0x00 ) /* Empty */ - ROM_LOAD( "bang-a.ic21", 0x0800000, 0x0080000, CRC(531ce3b6) SHA1(196bb720591acc082f815b609a7cf1609510c8c1) ) /* GFX only */ - ROM_LOAD( "bang-a.ic14", 0x0880000, 0x0080000, CRC(f8e1cf84) SHA1(559c08584094e605635c5ef3a25534ea0bcfa199) ) /* GFX only */ - ROM_FILL( 0x0900000, 0x0100000, 0x00 ) /* Empty */ + ROM_REGION( 0x0a00000, "gfx1", 0 ) // GFX + Sound + ROM_LOAD( "bang-a.ic16", 0x0000000, 0x0080000, CRC(3b63acfc) SHA1(48f5598cdbc70f342d6b75909166571271920a8f) ) // GFX only + ROM_LOAD( "bang-a.ic17", 0x0080000, 0x0080000, CRC(72865b80) SHA1(ec7753ea7961015149b9e6386fdeb9bd59aa962a) ) // GFX only + ROM_LOAD( "bang18.ic18", 0x0100000, 0x0080000, CRC(2056b1ad) SHA1(b796f92eef4bbb0efa12c53580e429b8a0aa394c) ) // Sound only + ROM_FILL( 0x0180000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang-a.ic9", 0x0200000, 0x0080000, CRC(3cb86360) SHA1(c803b3add253a552a1554714218740bdfca91764) ) // GFX only + ROM_LOAD( "bang-a.ic10", 0x0280000, 0x0080000, CRC(03fdd777) SHA1(9eec194239f93d961ee9902a585c872dcdc7728f) ) // GFX only + ROM_LOAD( "bang11.ic11", 0x0300000, 0x0080000, CRC(2088d15c) SHA1(0c043ab9fd33836fa4b7ad60fd8e7cb96ffb6121) ) // Sound only + ROM_FILL( 0x0380000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang-a.ic1", 0x0400000, 0x0080000, CRC(965d0ad9) SHA1(eff521735129b7dd9366855c6312ed568950233c) ) // GFX only + ROM_LOAD( "bang-a.ic2", 0x0480000, 0x0080000, CRC(8ea261a7) SHA1(50b59cf058ca03c0b8c888f6ddb40c720a210ece) ) // GFX only + ROM_LOAD( "bang3.ic3", 0x0500000, 0x0080000, CRC(d3da5d4f) SHA1(b9bea0b4d20ab0bfda3fac2bb1fab974c007aaf0) ) // Sound only + ROM_FILL( 0x0580000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang-a.ic20", 0x0600000, 0x0080000, CRC(4b828f3c) SHA1(5227a89c05c659a85d33f092c6778ce9d57a0236) ) // GFX only + ROM_LOAD( "bang-a.ic13", 0x0680000, 0x0080000, CRC(d1146b92) SHA1(2b28d49fbffea6c038160fdab177bc0045195ca8) ) // GFX only + ROM_LOAD( "bang5.ic5", 0x0700000, 0x0080000, CRC(9bee444c) SHA1(aebaa3306e7e5aada99ed469da9bf64507808cff) ) // Sound only + ROM_FILL( 0x0780000, 0x0080000, 0x00 ) // Empty + ROM_LOAD( "bang-a.ic21", 0x0800000, 0x0080000, CRC(531ce3b6) SHA1(196bb720591acc082f815b609a7cf1609510c8c1) ) // GFX only + ROM_LOAD( "bang-a.ic14", 0x0880000, 0x0080000, CRC(f8e1cf84) SHA1(559c08584094e605635c5ef3a25534ea0bcfa199) ) // GFX only + ROM_FILL( 0x0900000, 0x0100000, 0x00 ) // Empty + + ROM_REGION( 0x117, "plds", 0) + ROM_LOAD ( "bang_gal16v8.ic56", 0x000, 0x117, BAD_DUMP CRC(226923ac) SHA1(b1cac5208673183f401702ba844e1016d5fa4ea0) ) // Bruteforced but verified ROM_END @@ -2165,7 +2171,7 @@ ROM_START( snowboar ) ROM_LOAD( "sb.a4", 0x0200000, 0x0080000, CRC(2ba3a5c8) SHA1(93de0382cbb41806ae3349ce7cfecdc1404bfb88) ) /* Sound only */ ROM_LOAD( "sb.a5", 0x0280000, 0x0080000, CRC(ae011eb3) SHA1(17223404640c55637364fa6e51cf07d8e64df085) ) /* Sound only */ ROM_FILL( 0x0300000, 0x0100000, 0x00 ) /* Empty */ - ROM_LOAD( "sb.b0", 0x0400000, 0x0080000, CRC(96c714cd) SHA1(c6225c43b88531a70436cc8a631b8ba401903e45) ) /* GFX only */ + ROM_LOAD( "sb.b0", 0x0400000, 0x0080000, CRC(96c714cd) SHA1(c6225c43b88531a70436cc8a631b8ba401903e45) ) /* GFX only */ ROM_LOAD( "sb.b1", 0x0480000, 0x0080000, CRC(39a4c30c) SHA1(4598a68ef41483ba372aa3a40383de8eb70d706e) ) /* GFX only */ ROM_LOAD( "sb.b2", 0x0500000, 0x0080000, CRC(b58fcdd6) SHA1(21a8c00778be77165f89421fb2e3123244cf02c6) ) /* GFX only */ ROM_LOAD( "sb.b3", 0x0580000, 0x0080000, CRC(96afdebf) SHA1(880cfb365efa93bbee882aeb483ad6d75d8b7430) ) /* GFX only */ @@ -2575,11 +2581,11 @@ Also known to come with a GAE1 with various production codes including 449, 501 */ ROM_START( wrally2 ) // REF: 950510-1 - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "wr2_64.ic64", 0x000000, 0x080000, CRC(4cdf4e1e) SHA1(a3b3ff4a70336b61c7bba5d518527bf4bd901867) ) ROM_LOAD16_BYTE( "wr2_63.ic63", 0x000001, 0x080000, CRC(94887c9f) SHA1(ad09f1fbeff4c3ba47f72346d261b22fa6a51457) ) - ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) // DS5002FP code /* This SRAM has been dumped from 2 PCBs. The first had unused space filled as 0xff, the 2nd space was filled as 0x00. In addition, the first had 2 bad bytes, one of which was identified at the time, the other not. For reference the one that was not is "1938: 18 <-> 9B" (part of a data table) @@ -2609,26 +2615,26 @@ ROM_START( wrally2 ) // REF: 950510-1 ROM_LOAD( "wrally2_ds5002fp_sram.bin", 0x00000, 0x8000, CRC(4c532e9e) SHA1(d0aad72b204d4abd3b8d7d5bbaf8d2d2f78edaa6) ) ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) - /* these are the default states stored in NVRAM */ + // These are the default states stored in NVRAM DS5002FP_SET_MON( 0x69 ) DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) - ROM_REGION( 0x0a00000, "gfx1", 0 ) /* GFX + Sound */ - /* 0x0000000-0x06fffff filled in in the DRIVER_INIT */ - ROM_LOAD( "wr2_ic68.ic68", 0x0800000, 0x0100000, CRC(4a75ffaa) SHA1(ffae561ad4fa100398ab6b94d8dcb13e9fae4272) ) /* GFX only - read as 27C801 */ + ROM_REGION( 0x0a00000, "gfx1", 0 ) // GFX + Sound + // 0x0000000-0x06fffff filled in in the DRIVER_INIT + ROM_LOAD( "wr2_ic68.ic68", 0x0800000, 0x0100000, CRC(4a75ffaa) SHA1(ffae561ad4fa100398ab6b94d8dcb13e9fae4272) ) // GFX only - read as 27C801 - ROM_REGION( 0x0600000, "gfx2", 0 ) /* Temporary storage */ - ROM_LOAD( "wr2_ic69.ic69", 0x0000000, 0x0400000, CRC(a174d196) SHA1(4a7da1cd288e73518143a027782f3140e6582cf4) ) /* GFX & Sound - read as 27C332 */ - ROM_LOAD( "wr2_ic70.ic70", 0x0400000, 0x0200000, CRC(8d1e43ba) SHA1(79eed51788c6c55a4347be70a3be4eb14a0d1747) ) /* GFX only - read as 27C160 */ + ROM_REGION( 0x0600000, "gfx2", 0 ) // Temporary storage + ROM_LOAD( "wr2_ic69.ic69", 0x0000000, 0x0400000, CRC(a174d196) SHA1(4a7da1cd288e73518143a027782f3140e6582cf4) ) // GFX & Sound - read as 27C332 + ROM_LOAD( "wr2_ic70.ic70", 0x0400000, 0x0200000, CRC(8d1e43ba) SHA1(79eed51788c6c55a4347be70a3be4eb14a0d1747) ) // GFX only - read as 27C160 ROM_END ROM_START( wrally2a ) // REF: 950510 - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "wr2_64.ic64", 0x000000, 0x080000, CRC(4cdf4e1e) SHA1(a3b3ff4a70336b61c7bba5d518527bf4bd901867) ) ROM_LOAD16_BYTE( "wr2_63.ic63", 0x000001, 0x080000, CRC(94887c9f) SHA1(ad09f1fbeff4c3ba47f72346d261b22fa6a51457) ) - ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) // DS5002FP code /* This SRAM has been dumped from 2 PCBs. The first had unused space filled as 0xff, the 2nd space was filled as 0x00. In addition, the first had 2 bad bytes, one of which was identified at the time, the other not. For reference the one that was not is "1938: 18 <-> 9B" (part of a data table) @@ -2658,29 +2664,29 @@ ROM_START( wrally2a ) // REF: 950510 ROM_LOAD( "wrally2_ds5002fp_sram.bin", 0x00000, 0x8000, CRC(4c532e9e) SHA1(d0aad72b204d4abd3b8d7d5bbaf8d2d2f78edaa6) ) ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) - /* these are the default states stored in NVRAM */ + // These are the default states stored in NVRAM DS5002FP_SET_MON( 0x69 ) DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) - ROM_REGION( 0x0a00000, "gfx1", 0 ) /* GFX + Sound */ - ROM_LOAD( "wr2.16d", 0x0000000, 0x0080000, CRC(ad26086b) SHA1(487ffaaca57c9d030fc486b8cae6735ee40a0ac3) ) /* GFX only */ - ROM_LOAD( "wr2.17d", 0x0080000, 0x0080000, CRC(c1ec0745) SHA1(a6c3ce9c889e6a53f4155f54d6655825af34a35b) ) /* GFX only */ - ROM_LOAD( "wr2.18d", 0x0100000, 0x0080000, CRC(e3617814) SHA1(9f9514052bb07d7e243f33b11bae409a444b7d9f) ) /* Sound only */ - ROM_LOAD( "wr2.19d", 0x0180000, 0x0080000, CRC(2dae988c) SHA1(a585e10b0e1519b828738b0b90698f8600082250) ) /* Sound only */ - ROM_LOAD( "wr2.09d", 0x0200000, 0x0080000, CRC(372d70c8) SHA1(a6d8419765eab1fa20c6d3ddff9d026adaab5cd9) ) /* GFX only */ - ROM_LOAD( "wr2.10d", 0x0280000, 0x0080000, CRC(5db67eb3) SHA1(faa58dafa26befb3291e5185ee04c39ce3b45b3f) ) /* GFX only */ - ROM_LOAD( "wr2.11d", 0x0300000, 0x0080000, CRC(ae66b97c) SHA1(bd0eba0b1c77864e06a9e136cfd834b35f200683) ) /* Sound only */ - ROM_LOAD( "wr2.12d", 0x0380000, 0x0080000, CRC(6dbdaa95) SHA1(f23df65e3df92d79f7b1e99d611c067a79fc849a) ) /* Sound only */ - ROM_LOAD( "wr2.01d", 0x0400000, 0x0080000, CRC(753a138d) SHA1(b05348af6d25e95208fc39007eb2082b759384e8) ) /* GFX only */ - ROM_LOAD( "wr2.02d", 0x0480000, 0x0080000, CRC(9c2a723c) SHA1(5259c8fa1ad73518e89a8df6e76a565b8f8799e3) ) /* GFX only */ - ROM_FILL( 0x0500000, 0x0100000, 0x00 ) /* Empty */ - ROM_LOAD( "wr2.20d", 0x0600000, 0x0080000, CRC(4f7ade84) SHA1(c8efcd4bcb1f2ad6ab8104ec0daea8324cefd3fd) ) /* GFX only */ - ROM_LOAD( "wr2.13d", 0x0680000, 0x0080000, CRC(a4cd32f8) SHA1(bc4cc73b7a58aecd735bf55bb5062baa6dd22f83) ) /* GFX only */ - ROM_FILL( 0x0700000, 0x0100000, 0x00 ) /* Empty */ - ROM_LOAD( "wr2.21d", 0x0800000, 0x0080000, CRC(899b0583) SHA1(a313e679980cc4da22bc70f2c7c9685af4f3d6df) ) /* GFX only */ - ROM_LOAD( "wr2.14d", 0x0880000, 0x0080000, CRC(6eb781d5) SHA1(d5c13db88e6de606b34805391cef9f3fbf09fac4) ) /* GFX only */ - ROM_FILL( 0x0900000, 0x0100000, 0x00 ) /* Empty */ + ROM_REGION( 0x0a00000, "gfx1", 0 ) // GFX + Sound + ROM_LOAD( "wr2.16d", 0x0000000, 0x0080000, CRC(ad26086b) SHA1(487ffaaca57c9d030fc486b8cae6735ee40a0ac3) ) // GFX only + ROM_LOAD( "wr2.17d", 0x0080000, 0x0080000, CRC(c1ec0745) SHA1(a6c3ce9c889e6a53f4155f54d6655825af34a35b) ) // GFX only + ROM_LOAD( "wr2.18d", 0x0100000, 0x0080000, CRC(e3617814) SHA1(9f9514052bb07d7e243f33b11bae409a444b7d9f) ) // Sound only + ROM_LOAD( "wr2.19d", 0x0180000, 0x0080000, CRC(2dae988c) SHA1(a585e10b0e1519b828738b0b90698f8600082250) ) // Sound only + ROM_LOAD( "wr2.09d", 0x0200000, 0x0080000, CRC(372d70c8) SHA1(a6d8419765eab1fa20c6d3ddff9d026adaab5cd9) ) // GFX only + ROM_LOAD( "wr2.10d", 0x0280000, 0x0080000, CRC(5db67eb3) SHA1(faa58dafa26befb3291e5185ee04c39ce3b45b3f) ) // GFX only + ROM_LOAD( "wr2.11d", 0x0300000, 0x0080000, CRC(ae66b97c) SHA1(bd0eba0b1c77864e06a9e136cfd834b35f200683) ) // Sound only + ROM_LOAD( "wr2.12d", 0x0380000, 0x0080000, CRC(6dbdaa95) SHA1(f23df65e3df92d79f7b1e99d611c067a79fc849a) ) // Sound only + ROM_LOAD( "wr2.01d", 0x0400000, 0x0080000, CRC(753a138d) SHA1(b05348af6d25e95208fc39007eb2082b759384e8) ) // GFX only + ROM_LOAD( "wr2.02d", 0x0480000, 0x0080000, CRC(9c2a723c) SHA1(5259c8fa1ad73518e89a8df6e76a565b8f8799e3) ) // GFX only + ROM_FILL( 0x0500000, 0x0100000, 0x00 ) // Empty + ROM_LOAD( "wr2.20d", 0x0600000, 0x0080000, CRC(4f7ade84) SHA1(c8efcd4bcb1f2ad6ab8104ec0daea8324cefd3fd) ) // GFX only + ROM_LOAD( "wr2.13d", 0x0680000, 0x0080000, CRC(a4cd32f8) SHA1(bc4cc73b7a58aecd735bf55bb5062baa6dd22f83) ) // GFX only + ROM_FILL( 0x0700000, 0x0100000, 0x00 ) // Empty + ROM_LOAD( "wr2.21d", 0x0800000, 0x0080000, CRC(899b0583) SHA1(a313e679980cc4da22bc70f2c7c9685af4f3d6df) ) // GFX only + ROM_LOAD( "wr2.14d", 0x0880000, 0x0080000, CRC(6eb781d5) SHA1(d5c13db88e6de606b34805391cef9f3fbf09fac4) ) // GFX only + ROM_FILL( 0x0900000, 0x0100000, 0x00 ) // Empty ROM_END diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index 75f79e07db7..5f90d0a126c 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -1639,6 +1639,8 @@ void bosco_state::bosco(machine_config &config) WATCHDOG_TIMER(config, "watchdog").set_vblank_count(m_screen, 8); + config.set_maximum_quantum(attotime::from_hz(6000)); + /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 16, 224+16); @@ -1716,6 +1718,8 @@ void galaga_state::galaga(machine_config &config) WATCHDOG_TIMER(config, "watchdog").set_vblank_count(m_screen, 8); + config.set_maximum_quantum(attotime::from_hz(6000)); + /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 0, 224); @@ -1834,6 +1838,8 @@ void xevious_state::xevious(machine_config &config) WATCHDOG_TIMER(config, "watchdog").set_vblank_count(m_screen, 8); + config.set_maximum_quantum(attotime::from_hz(6000)); + /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 0, 224); @@ -1952,6 +1958,8 @@ void digdug_state::digdug(machine_config &config) WATCHDOG_TIMER(config, "watchdog"); + config.set_maximum_quantum(attotime::from_hz(6000)); + /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 0, 224); diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 9a3b5b9f375..cd93c2042d5 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -11683,6 +11683,26 @@ ROM_START( mandingarf ) ROM_LOAD( "6e.bin", 0x0000, 0x0020, BAD_DUMP CRC(4e3caeab) SHA1(a25083c3e36d28afdefe4af6e6d4f3155e303625) ) // not present, using mandinga PROM ROM_END +ROM_START( mandingac ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "2716-4.bin", 0x0000, 0x0800, CRC(a684a494) SHA1(76885bb3bdab09f46c7daa25164a2fdaa744742f) ) // 2716 + ROM_LOAD( "2716-3.bin", 0x0800, 0x0800, CRC(f4038373) SHA1(8823b9816fc4ea03b92e08776c13610980f5ea7a) ) // 2716 + ROM_LOAD( "2716-1.bin", 0x1000, 0x0800, CRC(96842877) SHA1(043ce4ed2628a209ca21cc42516c02366cd9f1fa) ) // 2716 + ROM_LOAD( "2716-9.bin", 0x1800, 0x0800, CRC(b69f9f71) SHA1(cb781d61a481c493e89605bc0edc6a092d8b4d56) ) // 2716 + ROM_LOAD( "2716-8.bin", 0x2000, 0x0800, CRC(400cf1bb) SHA1(06c891f7581b0c1036f6845ea847cd20b6f5dedc) ) // 2716 + ROM_LOAD( "2716-7.bin", 0x2800, 0x0800, CRC(5382f7ed) SHA1(425ec2c2caf404fc8ab13ee38d6567413022e1a1) ) // 2716 + ROM_LOAD( "2716-6.bin", 0x3000, 0x0800, CRC(c4e63305) SHA1(e03aed5ad89305ffc243cff8ff147ec82419c7bc) ) // 2716 + ROM_LOAD( "2716-5.bin", 0x3800, 0x0800, CRC(8a4018ae) SHA1(9aba6f4527c59b0b016038236d5a6074e65966f6) ) // 2716 + ROM_LOAD( "2716-2.bin", 0xc000, 0x0800, CRC(d8bf57e7) SHA1(421a0fa02fccbc52d460fafec6437bd2b7564056) ) // 2716 + + ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_LOAD( "2716-10.bin", 0x0000, 0x0800, CRC(2082ad0a) SHA1(c6014d9575e92adf09b0961c2158a779ebe940c4) ) // 2716 + ROM_LOAD( "2716-11.bin", 0x0800, 0x0800, CRC(1891fc68) SHA1(6d03f5092fd73462c9d81c1a64e39120d9f10aea) ) // 2716 + + ROM_REGION( 0x0020, "proms", 0 ) + ROM_LOAD( "82s123.bin", 0x0000, 0x0020, CRC(4e3caeab) SHA1(a25083c3e36d28afdefe4af6e6d4f3155e303625) ) // 82s123 +ROM_END + ROM_START( olmandingo ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "olmandingo_1.bin", 0x0000, 0x0800, CRC(b5b9fcd9) SHA1(7a134de30041ac18521274f330eb4afe349da2db) ) @@ -11703,24 +11723,24 @@ ROM_START( olmandingo ) ROM_LOAD( "olmandingo_pr.bin", 0x0000, 0x0020, CRC(c3ac9467) SHA1(f382ad5a34d282056c78a5ec00c30ec43772bae2) ) ROM_END -ROM_START( mandingac ) +ROM_START( olmandingc ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "2716-4.bin", 0x0000, 0x0800, CRC(a684a494) SHA1(76885bb3bdab09f46c7daa25164a2fdaa744742f) ) // 2716 - ROM_LOAD( "2716-3.bin", 0x0800, 0x0800, CRC(f4038373) SHA1(8823b9816fc4ea03b92e08776c13610980f5ea7a) ) // 2716 - ROM_LOAD( "2716-1.bin", 0x1000, 0x0800, CRC(96842877) SHA1(043ce4ed2628a209ca21cc42516c02366cd9f1fa) ) // 2716 - ROM_LOAD( "2716-9.bin", 0x1800, 0x0800, CRC(b69f9f71) SHA1(cb781d61a481c493e89605bc0edc6a092d8b4d56) ) // 2716 - ROM_LOAD( "2716-8.bin", 0x2000, 0x0800, CRC(400cf1bb) SHA1(06c891f7581b0c1036f6845ea847cd20b6f5dedc) ) // 2716 - ROM_LOAD( "2716-7.bin", 0x2800, 0x0800, CRC(5382f7ed) SHA1(425ec2c2caf404fc8ab13ee38d6567413022e1a1) ) // 2716 - ROM_LOAD( "2716-6.bin", 0x3000, 0x0800, CRC(c4e63305) SHA1(e03aed5ad89305ffc243cff8ff147ec82419c7bc) ) // 2716 - ROM_LOAD( "2716-5.bin", 0x3800, 0x0800, CRC(8a4018ae) SHA1(9aba6f4527c59b0b016038236d5a6074e65966f6) ) // 2716 - ROM_LOAD( "2716-2.bin", 0xc000, 0x0800, CRC(d8bf57e7) SHA1(421a0fa02fccbc52d460fafec6437bd2b7564056) ) // 2716 + ROM_LOAD( "omc_1-2716.bin", 0x0000, 0x0800, CRC(b5b9fcd9) SHA1(7a134de30041ac18521274f330eb4afe349da2db) ) + ROM_LOAD( "omc_2-2716.bin", 0x0800, 0x0800, CRC(f4038373) SHA1(8823b9816fc4ea03b92e08776c13610980f5ea7a) ) + ROM_LOAD( "omc_4-2716.bin", 0x1000, 0x0800, CRC(96842877) SHA1(043ce4ed2628a209ca21cc42516c02366cd9f1fa) ) + ROM_LOAD( "omc_5-2516.bin", 0x1800, 0x0800, CRC(29873461) SHA1(7d0ee9a82f02163b4cc6a7097e88ae34e96ebf58) ) + ROM_LOAD( "omc_6-2516.bin", 0x2000, 0x0800, CRC(3f536791) SHA1(e1ba306c4f9063db8d7a9f3d702986d205e480dc) ) + ROM_LOAD( "omc_7-2516.bin", 0x2800, 0x0800, CRC(5382f7ed) SHA1(425ec2c2caf404fc8ab13ee38d6567413022e1a1) ) + ROM_LOAD( "omc_8-2716.bin", 0x3000, 0x0800, CRC(e78d0c6d) SHA1(947ac20463384ca0721875954d59ec4ae15b0670) ) + ROM_LOAD( "omc_9-2516.bin", 0x3800, 0x0800, CRC(8a4018ae) SHA1(9aba6f4527c59b0b016038236d5a6074e65966f6) ) + ROM_LOAD( "omc_3-2716.bin", 0xc000, 0x0800, CRC(e4cbb827) SHA1(4efa49bd7486b4fa77d7faa130e842f4030f822b) ) ROM_REGION( 0x1000, "gfx1", 0 ) - ROM_LOAD( "2716-10.bin", 0x0000, 0x0800, CRC(2082ad0a) SHA1(c6014d9575e92adf09b0961c2158a779ebe940c4) ) // 2716 - ROM_LOAD( "2716-11.bin", 0x0800, 0x0800, CRC(1891fc68) SHA1(6d03f5092fd73462c9d81c1a64e39120d9f10aea) ) // 2716 + ROM_LOAD( "omc_10-2516.bin", 0x0000, 0x0800, CRC(2c51f2f1) SHA1(6a7a7dcedfa1f9f6f1964c7c67f5f766f551a258) ) + ROM_LOAD( "omc_11-2716.bin", 0x0800, 0x0800, CRC(3029f94f) SHA1(3b432b42e79f8b0a7d65e197f373a04e3c92ff20) ) ROM_REGION( 0x0020, "proms", 0 ) - ROM_LOAD( "82s123.bin", 0x0000, 0x0020, CRC(4e3caeab) SHA1(a25083c3e36d28afdefe4af6e6d4f3155e303625) ) // 82s123 + ROM_LOAD( "omc_27s19.bin", 0x0000, 0x0020, CRC(6a0c7d87) SHA1(140335d85c67c75b65689d4e76d29863c209cf32) ) ROM_END ROM_START( theend ) @@ -13371,19 +13391,20 @@ GAME( 1981, turpin, turtles, turtles, turpin, galaxian_state, init_ GAME( 1981, 600, turtles, turtles, turtles, galaxian_state, init_turtles, ROT90, "Konami", "600", MACHINE_SUPPORTS_SAVE ) GAME( 1981, turpins, turtles, turpins, turtles, galaxian_state, init_turtles, ROT90, "bootleg", "Turpin (bootleg on Super Cobra hardware)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // needs different sound timer -GAME( 1982, amidar, 0, turtles, amidaru, galaxian_state, init_turtles, ROT90, "Konami", "Amidar", MACHINE_SUPPORTS_SAVE ) -GAME( 1981, amidar1, amidar, turtles, amidar, galaxian_state, init_turtles, ROT90, "Konami", "Amidar (older)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, amidaru, amidar, turtles, amidaru, galaxian_state, init_turtles, ROT90, "Konami (Stern Electronics license)", "Amidar (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, amidaro, amidar, turtles, amidaro, galaxian_state, init_turtles, ROT90, "Konami (Olympia license)", "Amidar (Olympia)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, amidarb, amidar, turtles, amidaru, galaxian_state, init_turtles, ROT90, "bootleg", "Amidar (bootleg)", MACHINE_SUPPORTS_SAVE ) // Similar to Amigo bootleg -GAME( 1982, amigo, amidar, turtles, amidaru, galaxian_state, init_turtles, ROT90, "bootleg", "Amigo (bootleg of Amidar, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, amigo2, amidar, amigo2, amidaru, galaxian_state, init_amigo2, ROT90, "bootleg", "Amigo (bootleg of Amidar, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) // sound timer might be different? -GAME( 1982, amidars, amidar, scramble, amidars, galaxian_state, init_scramble, ROT90, "Konami", "Amidar (Scramble hardware)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, mandinga, amidar, scramble, amidars, galaxian_state, init_mandinga, ROT90, "bootleg (Artemi)", "Mandinga (Artemi bootleg of Amidar)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // color PROM needs bitswap<8> on addressing, reference: http://www.youtube.com/watch?v=6uGK4AZxV2U -GAME( 1982, mandingaeg, amidar, scramble, amidars, galaxian_state, init_mandingaeg, ROT90, "bootleg (Electrogame S.A.)", "Mandinga (Electrogame S.A. bootleg of Amidar)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) -GAME( 1982, mandingarf, amidar, mandingarf, mandingarf, galaxian_state, init_galaxian, ROT90, "bootleg (Recreativos Franco S.A.)", "Mandanga (bootleg of Mandinga on Galaxian hardware, set 1)", MACHINE_NO_COCKTAIL | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // assume same issue as mandinga -GAME( 1982, olmandingo, amidar, mandingarf, olmandingo, galaxian_state, init_galaxian, ROT90, "bootleg", "Olivmandingo (Spanish bootleg of Mandinga on Galaxian hardware)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, mandingac, amidar, mandingarf, mandingarf, galaxian_state, init_galaxian, ROT90, "bootleg (Centromatic)", "Mandanga (bootleg of Mandinga on Galaxian hardware, set 2)", MACHINE_NO_COCKTAIL | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // assume same issue as mandinga +GAME( 1982, amidar, 0, turtles, amidaru, galaxian_state, init_turtles, ROT90, "Konami", "Amidar", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, amidar1, amidar, turtles, amidar, galaxian_state, init_turtles, ROT90, "Konami", "Amidar (older)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, amidaru, amidar, turtles, amidaru, galaxian_state, init_turtles, ROT90, "Konami (Stern Electronics license)", "Amidar (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, amidaro, amidar, turtles, amidaro, galaxian_state, init_turtles, ROT90, "Konami (Olympia license)", "Amidar (Olympia)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, amidarb, amidar, turtles, amidaru, galaxian_state, init_turtles, ROT90, "bootleg", "Amidar (bootleg)", MACHINE_SUPPORTS_SAVE ) // Similar to Amigo bootleg +GAME( 1982, amigo, amidar, turtles, amidaru, galaxian_state, init_turtles, ROT90, "bootleg", "Amigo (bootleg of Amidar, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, amigo2, amidar, amigo2, amidaru, galaxian_state, init_amigo2, ROT90, "bootleg", "Amigo (bootleg of Amidar, set 2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) // sound timer might be different? +GAME( 1982, amidars, amidar, scramble, amidars, galaxian_state, init_scramble, ROT90, "Konami", "Amidar (Scramble hardware)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, mandinga, amidar, scramble, amidars, galaxian_state, init_mandinga, ROT90, "bootleg (Artemi)", "Mandinga (Artemi bootleg of Amidar)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // color PROM needs bitswap<8> on addressing, reference: http://www.youtube.com/watch?v=6uGK4AZxV2U +GAME( 1982, mandingaeg, amidar, scramble, amidars, galaxian_state, init_mandingaeg, ROT90, "bootleg (Electrogame S.A.)", "Mandinga (Electrogame S.A. bootleg of Amidar)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) +GAME( 1982, mandingarf, amidar, mandingarf, mandingarf, galaxian_state, init_galaxian, ROT90, "bootleg (Recreativos Franco S.A.)", "Mandanga (bootleg of Mandinga on Galaxian hardware, set 1)", MACHINE_NO_COCKTAIL | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // assume same issue as mandinga +GAME( 1982, mandingac, amidar, mandingarf, mandingarf, galaxian_state, init_galaxian, ROT90, "bootleg (Centromatic)", "Mandanga (bootleg of Mandinga on Galaxian hardware, set 2)", MACHINE_NO_COCKTAIL | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // assume same issue as mandinga +GAME( 1982, olmandingo, amidar, mandingarf, olmandingo, galaxian_state, init_galaxian, ROT90, "bootleg", "Olivmandingo (Spanish bootleg of Mandinga on Galaxian hardware, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, olmandingc, amidar, mandingarf, olmandingo, galaxian_state, init_galaxian, ROT90, "bootleg (Calfesa)", "Olivmandingo (Spanish bootleg of Mandinga on Galaxian hardware, set 2)", MACHINE_SUPPORTS_SAVE ) // The End/Scramble based hardware GAME( 1980, theend, 0, theend, theend, galaxian_state, init_theend, ROT90, "Konami", "The End", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/galgame.cpp b/src/mame/drivers/galgame.cpp index cbfb4a7c6be..53fa633f66b 100644 --- a/src/mame/drivers/galgame.cpp +++ b/src/mame/drivers/galgame.cpp @@ -187,7 +187,7 @@ uint32_t galaxygame_state::screen_update_galaxygame(screen_device &screen, bitma bitmap.fill(m_palette->black_pen(), cliprect); for (int i = 0; i < m_point_display_list_index; i++ ) { - bitmap.pix16(m_point_display_list[i].x >> 7, m_point_display_list[i].y >> 7) = 1; + bitmap.pix(m_point_display_list[i].x >> 7, m_point_display_list[i].y >> 7) = 1; } return 0; } diff --git a/src/mame/drivers/galpani3.cpp b/src/mame/drivers/galpani3.cpp index 0ffb68cd319..6e56e73c5db 100644 --- a/src/mame/drivers/galpani3.cpp +++ b/src/mame/drivers/galpani3.cpp @@ -190,7 +190,7 @@ void galpani3_state::video_start() uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); bitmap.fill(0, cliprect); @@ -198,137 +198,134 @@ uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rg // popmessage("%02x %02x", m_grap2[0]->m_framebuffer_bright2, m_grap2[1]->m_framebuffer_bright2); + for (int drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++) { - int drawy, drawx; - for (drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++) - { - uint16_t* sprline = &m_sprite_bitmap.pix16(drawy); - uint16_t* srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const sprline = &m_sprite_bitmap.pix(drawy); + uint16_t const *const srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200; - uint32_t* dst = &bitmap.pix32(drawy & 0x3ff); + uint32_t *const dst = &bitmap.pix(drawy & 0x3ff); - for (drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++) - { - int sproffs = drawx & 0x3ff; - int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff; - int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff; - int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff; + for (int drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++) + { + int sproffs = drawx & 0x3ff; + int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff; + int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff; + int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff; - int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff; + int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff; - uint16_t sprdat = sprline[sproffs]; - uint8_t dat1 = srcline1[srcoffs1]; - uint8_t dat2 = srcline2[srcoffs2]; - uint8_t dat3 = srcline3[srcoffs3]; + uint16_t sprdat = sprline[sproffs]; + uint8_t dat1 = srcline1[srcoffs1]; + uint8_t dat2 = srcline2[srcoffs2]; + uint8_t dat3 = srcline3[srcoffs3]; - uint8_t pridat = priline[prioffs]; + uint8_t pridat = priline[prioffs]; - // TODO : Verify priorities, blendings from real PCB. - if (pridat==0x0f) // relates to the area you've drawn over + // TODO : Verify priorities, blendings from real PCB. + if (pridat==0x0f) // relates to the area you've drawn over + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[2]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat1 && m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat2 && m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(2, dat3); } - else if (pridat==0xcf) // the girl + SPRITE_DRAW_PIXEL(0x4000); + if (dat1 && m_grap2[0]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, 0x100); - } - SPRITE_DRAW_PIXEL(0x4000); - if (m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, 0x100); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(0, dat1); } - else if (pridat==0x30) // during the 'gals boxes' on the intro + SPRITE_DRAW_PIXEL(0x8000); + if (dat2 && m_grap2[1]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[1]->m_framebuffer_enable) // TODO : Opaqued and Swapped order? - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat1 && m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(1, dat2); } - else + SPRITE_DRAW_PIXEL(0xc000); + } + else if (pridat==0xcf) // the girl + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[0]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB? - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat2 && m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(0, 0x100); } - - /* - else if (pridat==0x2f) // area outside of the girl + SPRITE_DRAW_PIXEL(0x4000); + if (m_grap2[1]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(1, 0x100); } - - else if (pridat==0x00) // the initial line / box that gets drawn + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) + { + FB_DRAW_PIXEL(2, dat3); + } + SPRITE_DRAW_PIXEL(0xc000); + } + else if (pridat==0x30) // during the 'gals boxes' on the intro + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[1]->m_framebuffer_enable) // TODO : Opaqued and Swapped order? + { + FB_DRAW_PIXEL(1, dat2); + } + SPRITE_DRAW_PIXEL(0x4000); + if (dat1 && m_grap2[0]->m_framebuffer_enable) + { + FB_DRAW_PIXEL(0, dat1); + } + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(2, dat3); } - else if (pridat==0x30) // during the 'gals boxes' on the intro + SPRITE_DRAW_PIXEL(0xc000); + } + else + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB? { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(0, dat1); } - else if (pridat==0x0c) // 'nice' at end of level + SPRITE_DRAW_PIXEL(0x4000); + if (dat2 && m_grap2[1]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(1, dat2); } - else + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) { - //printf("%02x, ",pridat); + FB_DRAW_PIXEL(2, dat3); } - */ + SPRITE_DRAW_PIXEL(0xc000); + } + + /* + else if (pridat==0x2f) // area outside of the girl + { + //dst[drawx] = machine().rand()&0x3fff; + } + + else if (pridat==0x00) // the initial line / box that gets drawn + { + //dst[drawx] = machine().rand()&0x3fff; + } + else if (pridat==0x30) // during the 'gals boxes' on the intro + { + //dst[drawx] = machine().rand()&0x3fff; + } + else if (pridat==0x0c) // 'nice' at end of level + { + //dst[drawx] = machine().rand()&0x3fff; + } + else + { + //printf("%02x, ",pridat); } + */ } } return 0; diff --git a/src/mame/drivers/galpanic_ms.cpp b/src/mame/drivers/galpanic_ms.cpp index f94e85e1de7..7401d06caf5 100644 --- a/src/mame/drivers/galpanic_ms.cpp +++ b/src/mame/drivers/galpanic_ms.cpp @@ -272,7 +272,7 @@ uint32_t galspanic_ms_state::screen_update_backgrounds(screen_device &screen, bi count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1; @@ -285,7 +285,7 @@ uint32_t galspanic_ms_state::screen_update_backgrounds(screen_device &screen, bi count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff; diff --git a/src/mame/drivers/gamecstl.cpp b/src/mame/drivers/gamecstl.cpp index 0207bd9dd2b..699c0b9ed55 100644 --- a/src/mame/drivers/gamecstl.cpp +++ b/src/mame/drivers/gamecstl.cpp @@ -137,16 +137,14 @@ void gamecstl_state::video_start() void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint16_t *p = &bitmap.pix16(j); + uint16_t *const p = &bitmap.pix(j); - for (i=x; i < x+8; i++) + for (int i=x; i < x+8; i++) { uint8_t pen = dp[index++]; if (pen) @@ -159,16 +157,15 @@ void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t gamecstl_state::screen_update_gamecstl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, j; gfx_element *gfx = m_gfxdecode->gfx(0); - uint32_t *cga = m_cga_ram; + uint32_t const *const cga = m_cga_ram; int index = 0; bitmap.fill(0, cliprect); - for (j=0; j < 25; j++) + for (int j=0; j < 25; j++) { - for (i=0; i < 80; i+=2) + for (int i=0; i < 80; i+=2) { int att0 = (cga[index] >> 8) & 0xff; int ch0 = (cga[index] >> 0) & 0xff; diff --git a/src/mame/drivers/gameking.cpp b/src/mame/drivers/gameking.cpp index b381b324244..0e02f8f42a5 100644 --- a/src/mame/drivers/gameking.cpp +++ b/src/mame/drivers/gameking.cpp @@ -153,10 +153,10 @@ uint32_t gameking_state::screen_update_gameking(screen_device &screen, bitmap_in for (int x=0, j=0;j<48/4;x+=4, j++) { uint8_t data=maincpu_ram->read_byte(lssa+j+i*12); - bitmap.pix16(y, x+3)=data&3; - bitmap.pix16(y, x+2)=(data>>2)&3; - bitmap.pix16(y, x+1)=(data>>4)&3; - bitmap.pix16(y, x)=(data>>6)&3; + bitmap.pix(y, x+3)=data&3; + bitmap.pix(y, x+2)=(data>>2)&3; + bitmap.pix(y, x+1)=(data>>4)&3; + bitmap.pix(y, x)=(data>>6)&3; } } return 0; @@ -188,24 +188,24 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r switch (i % 3) { case 0: - bitmap.pix32(y, x + 3) = rgb_t(0, gameking3_intensities[data&3], 0); - bitmap.pix32(y + 1, x + 2) = rgb_t(gameking3_intensities[(data>>2)&3], 0, 0); - bitmap.pix32(y, x + 1) = rgb_t(0, gameking3_intensities[(data>>4)&3], 0); - bitmap.pix32(y + 1, x) = rgb_t(gameking3_intensities[(data>>6)&3], 0, 0); + bitmap.pix(y, x + 3) = rgb_t(0, gameking3_intensities[data&3], 0); + bitmap.pix(y + 1, x + 2) = rgb_t(gameking3_intensities[(data>>2)&3], 0, 0); + bitmap.pix(y, x + 1) = rgb_t(0, gameking3_intensities[(data>>4)&3], 0); + bitmap.pix(y + 1, x) = rgb_t(gameking3_intensities[(data>>6)&3], 0, 0); break; case 1: - bitmap.pix32(y, x + 3) = rgb_t(0, 0, gameking3_intensities[data&3]); - bitmap.pix32(y + 1, x+2) = rgb_t(0, gameking3_intensities[(data>>2)&3], 0); - bitmap.pix32(y, x + 1) = rgb_t(0, 0, gameking3_intensities[(data>>4)&3]); - bitmap.pix32(y + 1, x) = rgb_t(0, gameking3_intensities[(data>>6)&3], 0); + bitmap.pix(y, x + 3) = rgb_t(0, 0, gameking3_intensities[data&3]); + bitmap.pix(y + 1, x+2) = rgb_t(0, gameking3_intensities[(data>>2)&3], 0); + bitmap.pix(y, x + 1) = rgb_t(0, 0, gameking3_intensities[(data>>4)&3]); + bitmap.pix(y + 1, x) = rgb_t(0, gameking3_intensities[(data>>6)&3], 0); break; case 2: - bitmap.pix32(y, x + 3) = rgb_t(gameking3_intensities[data&3], 0, 0); - bitmap.pix32(y + 1, x+2) = rgb_t(0, 0, gameking3_intensities[(data>>2)&3]); - bitmap.pix32(y, x + 1) = rgb_t(gameking3_intensities[(data>>4)&3], 0, 0); - bitmap.pix32(y + 1, x) = rgb_t(0, 0, gameking3_intensities[(data>>6)&3]); + bitmap.pix(y, x + 3) = rgb_t(gameking3_intensities[data&3], 0, 0); + bitmap.pix(y + 1, x+2) = rgb_t(0, 0, gameking3_intensities[(data>>2)&3]); + bitmap.pix(y, x + 1) = rgb_t(gameking3_intensities[(data>>4)&3], 0, 0); + bitmap.pix(y + 1, x) = rgb_t(0, 0, gameking3_intensities[(data>>6)&3]); break; } } @@ -216,12 +216,12 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r { for (int x = y & 1; x < 160; x += 2) { - rgb_t l = rgb_t(x == 0 ? 0 : bitmap.pix32(y, x - 1)); - rgb_t r = rgb_t(x == 159 ? 0 : bitmap.pix32(y, x + 1)); - rgb_t u = rgb_t(y == 0 ? 0 : bitmap.pix32(y - 1, x)); - rgb_t d = rgb_t(y == 159 ? 0 : bitmap.pix32(y + 1, x)); + rgb_t l = rgb_t(x == 0 ? 0 : bitmap.pix(y, x - 1)); + rgb_t r = rgb_t(x == 159 ? 0 : bitmap.pix(y, x + 1)); + rgb_t u = rgb_t(y == 0 ? 0 : bitmap.pix(y - 1, x)); + rgb_t d = rgb_t(y == 159 ? 0 : bitmap.pix(y + 1, x)); - bitmap.pix32(y, x) = rgb_t( + bitmap.pix(y, x) = rgb_t( ((u.r() + d.r()) * 2 + l.r() + r.r()) / 3, ((u.g() + d.g()) * 2 + l.g() + r.g()) / 3, ((u.b() + d.b()) * 2 + l.b() + r.b()) / 3 diff --git a/src/mame/drivers/gei.cpp b/src/mame/drivers/gei.cpp index d7d3dadd732..fa12d4e20cf 100644 --- a/src/mame/drivers/gei.cpp +++ b/src/mame/drivers/gei.cpp @@ -235,7 +235,7 @@ void gei_state::gei_bitmap_w(offs_t offset, uint8_t data) sy = (sy + m_yadd) & 0xff; for (int i = 0; i < 8; i++) - m_bitmap.pix16(sy, sx + i) = m_color[8 - i - 1]; + m_bitmap.pix(sy, sx + i) = m_color[8 - i - 1]; } void gei_state::video_start() diff --git a/src/mame/drivers/generalplus_gpl16250_rom.cpp b/src/mame/drivers/generalplus_gpl16250_rom.cpp index 0f6a192e7e9..9a118332720 100644 --- a/src/mame/drivers/generalplus_gpl16250_rom.cpp +++ b/src/mame/drivers/generalplus_gpl16250_rom.cpp @@ -416,6 +416,14 @@ ROM_START( myac220 ) ROM_LOAD16_WORD_SWAP( "myarcadegogamerportable.bin", 0x0000000, 0x8000000, BAD_DUMP CRC(c929a2fa) SHA1(e99007ccc45a268267b4ea0efaf22e3117f5a6bd) ) // several sections seemed to be erased, was repaired with data from tkmag220, likely good but should be verified ROM_END +ROM_START( beijuehh ) + //ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 ) // not on this model? (or at least not this size, as CS base is different) + //ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) + + ROM_REGION( 0x8000000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_WORD_SWAP( "beijeu.bin", 0x0000000, 0x8000000, CRC(e7b968af) SHA1(a39a3a70e6e0827e4395e09e55983eb9e9348e4a) ) // some address lines might be swapped +ROM_END + void tkmag220_game_state::tkmag220(machine_config &config) { gcm394_game_state::base(config); @@ -486,6 +494,9 @@ CONS(201?, myac220, 0, 0, tkmag220, tkmag220, tkmag220_game_state, empt CONS(2012, imgame, 0, 0, tkmag220, tkmag220, tkmag220_game_state, empty_init, "I'm Game", "I'm Game! GP120 (Family Sport 120-in-1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // a 180 game Family Sport I'm Game! also exists (and some Famiclones) +// memory mapping needs figuring out +CONS(201?, beijuehh, 0, 0, tkmag220, tkmag220, tkmag220_game_state, empty_init, "Beijue", "Beijue 16 Bit Handheld Games (Game Boy style case)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) + // die on this one is 'GCM420' CONS(2013, gormiti, 0, 0, base, gormiti, gormiti_game_state, empty_init, "Giochi Preziosi", "Gormiti Game Arena (Spain)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp b/src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp new file mode 100644 index 00000000000..c7b03fbacba --- /dev/null +++ b/src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp @@ -0,0 +1,886 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +/* These contain a similar game selection to the devices in unk6502_st2xxx.cpp but on updated hardware + + The hardware appears to be an abuse of the GPL16250 SoC. The palette and sprite banks are used, but as work-ram + rather than for their intended purpose, and the rest of the GPL16250 video hardware is either entirely bypassed + or doesn't exist. All video is software rendered and output directly to the LCD Controller. + + If this is confirmed via a decap then this should be merged with the GPL16250 implementation. + + The coding of these is similar to the unk6502_st2xxx.cpp too, with all game specific function calls being loaded + on the fly from the SPI to a tiny portion of work RAM, with graphics likewise being loaded and decompressed for + every draw call. + + pcp8718 / pcp8728 / bkid218 + to access test mode hold up + left on startup. + (bkid218 cursor in test menu can't be moved in emulation, works on unit, why?) +*/ + + +#include "emu.h" + +#include "cpu/unsp/unsp.h" +#include "machine/bl_handhelds_menucontrol.h" + +#include "emupal.h" +#include "screen.h" +#include "speaker.h" + +#define LOG_GPL162XX_LCDTYPE (1U << 1) +#define LOG_GPL162XX_LCDTYPE_SELECT_SIM (1U << 2) +#define LOG_GPL162XX_LCDTYPE_IO_PORT (1U << 3) + +#define LOG_ALL (LOG_GPL162XX_LCDTYPE | LOG_GPL162XX_LCDTYPE_SELECT_SIM | LOG_GPL162XX_LCDTYPE_IO_PORT) +#define VERBOSE (0) + +#include "logmacro.h" + + +class gpl162xx_lcdtype_state : public driver_device +{ +public: + gpl162xx_lcdtype_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mainrom(*this, "maincpu"), + m_mainram(*this, "mainram"), + m_palette(*this, "palette"), + m_screen(*this, "screen"), + m_spirom(*this, "spi"), + m_io_in0(*this, "IN0"), + m_io_in1(*this, "IN1"), + m_menucontrol(*this, "menucontrol") + { } + + void gpl162xx_lcdtype(machine_config &config); + +private: + virtual void machine_start() override; + virtual void machine_reset() override; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + required_device<unsp_20_device> m_maincpu; + required_region_ptr<uint16_t> m_mainrom; + required_shared_ptr<uint16_t> m_mainram; + + required_device<palette_device> m_palette; + required_device<screen_device> m_screen; + + void map(address_map &map); + + required_region_ptr<uint8_t> m_spirom; + + uint16_t unk_7abf_r(); + uint16_t io_7860_r(); + uint16_t unk_780f_r(); + + void io_7860_w(uint16_t data); + uint16_t m_7860; + + void unk_7862_w(uint16_t data); + void unk_7863_w(uint16_t data); + + void unk_7868_w(uint16_t data); + uint16_t unk_7868_r(); + uint16_t m_7868; + + void bankswitch_707e_w(uint16_t data); + uint16_t bankswitch_707e_r(); + uint16_t m_707e_bank; + + void bankswitch_703a_w(uint16_t data); + uint16_t bankswitch_703a_r(); + uint16_t m_703a_bank; + + void bankedram_7300_w(offs_t offset, uint16_t data); + uint16_t bankedram_7300_r(offs_t offset); + uint16_t m_bankedram_7300[0x400]; + + void bankedram_7400_w(offs_t offset, uint16_t data); + uint16_t bankedram_7400_r(offs_t offset); + uint16_t m_bankedram_7400[0x800]; + + void system_dma_params_channel0_w(offs_t offset, uint16_t data); + uint16_t system_dma_params_channel0_r(offs_t offset); + + uint16_t m_dmaregs[8]; + + void lcd_w(uint16_t data); + void lcd_command_w(uint16_t data); + + uint16_t spi_misc_control_r(); + uint16_t spi_rx_fifo_r(); + void spi_tx_fifo_w(uint16_t data); + + void spi_control_w(uint16_t data); + + void spi_process_tx_data(uint8_t data); + uint8_t spi_process_rx(); + uint8_t spi_rx(); + uint8_t spi_rx_fast(); + + uint8_t m_rx_fifo[5]; // actually 8 bytes? or 8 half-bytes? + + uint32_t m_spiaddress; + + uint16_t unk_78a1_r(); + uint16_t m_78a1; + uint16_t unk_78d8_r(); + void unk_78d8_w(uint16_t data); + + enum spistate : const int + { + SPI_STATE_READY = 0, + SPI_STATE_WAITING_HIGH_ADDR = 1, + SPI_STATE_WAITING_MID_ADDR = 2, + SPI_STATE_WAITING_LOW_ADDR = 3, + // probably not + SPI_STATE_WAITING_DUMMY1_ADDR = 4, + SPI_STATE_WAITING_DUMMY2_ADDR = 5, + SPI_STATE_READING = 6, + + SPI_STATE_WAITING_HIGH_ADDR_FAST = 8, + SPI_STATE_WAITING_MID_ADDR_FAST = 9, + SPI_STATE_WAITING_LOW_ADDR_FAST = 10, + SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY = 11, + SPI_STATE_READING_FAST = 12 + + }; + + spistate m_spistate; + + enum lcdstate : const int + { + LCD_STATE_READY = 0, + LCD_STATE_WAITING_FOR_COMMAND = 1, + LCD_STATE_PROCESSING_COMMAND = 2 + }; + + lcdstate m_lcdstate; + int m_lastlcdcommand; + + uint8_t m_displaybuffer[0x40000]; + int m_lcdaddr; + + uint16_t io_7870_r(); + required_ioport m_io_in0; + required_ioport m_io_in1; + required_device<bl_handhelds_menucontrol_device> m_menucontrol; + + DECLARE_WRITE_LINE_MEMBER(screen_vblank); +}; + +uint32_t gpl162xx_lcdtype_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int count = 0; + for (int y = 0; y < 256; y++) + { + uint32_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 320; x++) + { + // 8-bit values get pumped through a 256 word table in internal ROM and converted to words + uint16_t dat = m_displaybuffer[(count * 2) + 1] | (m_displaybuffer[(count * 2) + 0] << 8); + + int b = ((dat >> 0) & 0x1f) << 3; + int g = ((dat >> 5) & 0x3f) << 2; + int r = ((dat >> 11) & 0x1f) << 3; + + dst[x] = (r << 16) | (g << 8) | (b << 0); + count++; + } + } + + return 0; +} + + +static INPUT_PORTS_START( gpl162xx_lcdtype ) + PORT_START("IN0") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // causes lag if state is inverted, investigate + PORT_DIPNAME( 0x0002, 0x0002, "P0:0002" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0002, "0002" ) + PORT_DIPNAME( 0x0004, 0x0000, "Show Vs in Test Mode" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0004, "0004" ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("menucontrol", bl_handhelds_menucontrol_device, status_r) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("menucontrol", bl_handhelds_menucontrol_device, data_r) + PORT_DIPNAME( 0x0020, 0x0020, "P0:0020" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0020, "0020" ) + PORT_DIPNAME( 0x0040, 0x0040, "P0:0040" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0040, "0040" ) + PORT_DIPNAME( 0x0080, 0x0080, "P0:0080" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0080, "0080" ) + PORT_DIPNAME( 0x0100, 0x0100, "P0:0100" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0100, "0100" ) + PORT_DIPNAME( 0x0200, 0x0000, "Battery Level" ) + PORT_DIPSETTING( 0x0000, "Normal" ) + PORT_DIPSETTING( 0x0200, "Low" ) + PORT_DIPNAME( 0x0400, 0x0400, "P0:0400" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0400, "0400" ) + PORT_DIPNAME( 0x0800, 0x0800, "P0:0800" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0800, "0800" ) + PORT_DIPNAME( 0x1000, 0x1000, "P0:1000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x1000, "1000" ) + PORT_DIPNAME( 0x2000, 0x2000, "P0:2000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x2000, "2000" ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + + PORT_START("IN1") + PORT_DIPNAME( 0x0001, 0x0001, "P1:0001" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0001, "0001" ) + PORT_DIPNAME( 0x0002, 0x0002, "P1:0002" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0002, "0002" ) + PORT_DIPNAME( 0x0004, 0x0004, "P1:0004" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0004, "0004" ) + PORT_DIPNAME( 0x0008, 0x0008, "P1:0008" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0008, "0008" ) + PORT_DIPNAME( 0x0010, 0x0010, "P1:0010" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0010, "0010" ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("SOUND") + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("ON/OFF") + PORT_DIPNAME( 0x1000, 0x1000, "P1:1000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x1000, "1000" ) + PORT_DIPNAME( 0x2000, 0x2000, "P1:2000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x2000, "2000" ) + PORT_DIPNAME( 0x4000, 0x4000, "P1:4000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x4000, "4000" ) + PORT_DIPNAME( 0x8000, 0x8000, "P1:8000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x8000, "8000" ) +INPUT_PORTS_END + +uint16_t gpl162xx_lcdtype_state::unk_7abf_r() +{ + return 0x0001; +} + +uint16_t gpl162xx_lcdtype_state::io_7860_r() +{ + uint16_t ret = m_io_in0->read(); + LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: io_7860_r %02x\n", machine().describe_context(), ret); + return ret; +} + +void gpl162xx_lcdtype_state::io_7860_w(uint16_t data) +{ + m_menucontrol->data_w((data & 0x10)>>4); + m_menucontrol->clock_w((data & 0x20)>>5); + + m_7860 = data; +} + +void gpl162xx_lcdtype_state::unk_7862_w(uint16_t data) +{ +} + +void gpl162xx_lcdtype_state::unk_7863_w(uint16_t data) +{ + // probably port direction (or 7862 is?) + if (data == 0x3cf7) + { + m_menucontrol->reset_w(1); + } +} + +uint16_t gpl162xx_lcdtype_state::unk_780f_r() +{ + return 0x0002; +} + +uint16_t gpl162xx_lcdtype_state::spi_misc_control_r() +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_misc_control_r\n", machine().describe_context()); + return 0x0000; +} + +uint16_t gpl162xx_lcdtype_state::spi_rx_fifo_r() +{ + if (m_spistate == SPI_STATE_READING_FAST) + return spi_rx_fast(); + + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_rx_fifo_r\n", machine().describe_context()); + return spi_rx(); +} + +void gpl162xx_lcdtype_state::spi_process_tx_data(uint8_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"transmitting %02x\n", data); + + switch (m_spistate) + { + case SPI_STATE_READY: + { + if (data == 0x03) + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to read mode (need address) %02x\n", data); + m_spistate = SPI_STATE_WAITING_HIGH_ADDR; + } + else if (data == 0x0b) + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to fast read mode (need address) %02x\n", data); + m_spistate = SPI_STATE_WAITING_HIGH_ADDR_FAST; + //machine().debug_break(); + } + else + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"invalid state request %02x\n", data); + } + break; + } + + case SPI_STATE_WAITING_HIGH_ADDR: + { + m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to high address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_MID_ADDR; + break; + } + + case SPI_STATE_WAITING_MID_ADDR: + { + m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to mid address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_LOW_ADDR; + break; + } + + case SPI_STATE_WAITING_LOW_ADDR: + { + m_spiaddress = (m_spiaddress & 0xffffff00) | data; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to low address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_READING; + break; + } + + case SPI_STATE_READING: + { + // writes when in read mode clock in data? + LOGMASKED(LOG_GPL162XX_LCDTYPE,"write while in read mode (clock data?)\n", data, m_spiaddress); + break; + } + + case SPI_STATE_WAITING_DUMMY1_ADDR: + { + m_spistate = SPI_STATE_WAITING_DUMMY2_ADDR; + break; + } + + case SPI_STATE_WAITING_DUMMY2_ADDR: + { + // m_spistate = SPI_STATE_READY; + break; + } + + + case SPI_STATE_WAITING_HIGH_ADDR_FAST: + { + m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to high address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_MID_ADDR_FAST; + break; + } + + case SPI_STATE_WAITING_MID_ADDR_FAST: + { + m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to mid address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST; + break; + } + + case SPI_STATE_WAITING_LOW_ADDR_FAST: + { + m_spiaddress = (m_spiaddress & 0xffffff00) | data; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to low address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY; + + break; + } + + case SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY: + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"dummy write %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_READING_FAST; + break; + } + + case SPI_STATE_READING_FAST: + { + // writes when in read mode clock in data? + LOGMASKED(LOG_GPL162XX_LCDTYPE,"write while in read mode (clock data?)\n", data, m_spiaddress); + break; + } + + } +} + +uint8_t gpl162xx_lcdtype_state::spi_process_rx() +{ + + switch (m_spistate) + { + case SPI_STATE_READING: + case SPI_STATE_READING_FAST: + { + uint8_t dat = m_spirom[m_spiaddress & 0x7fffff]; + + LOGMASKED(LOG_GPL162XX_LCDTYPE,"reading SPI %02x from SPI Address %08x (adjusted word offset %08x)\n", dat, m_spiaddress, (m_spiaddress/2)+0x20000); + m_spiaddress++; + return dat; + } + + default: + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"reading FIFO in unknown state\n"); + return 0x00; + } + } + + return 0x00; +} + + +uint8_t gpl162xx_lcdtype_state::spi_rx() +{ + uint8_t ret = m_rx_fifo[0]; + + m_rx_fifo[0] = m_rx_fifo[1]; + m_rx_fifo[1] = m_rx_fifo[2]; + m_rx_fifo[2] = m_rx_fifo[3]; + m_rx_fifo[3] = spi_process_rx(); + + return ret; +} + +uint8_t gpl162xx_lcdtype_state::spi_rx_fast() +{ + uint8_t ret = m_rx_fifo[0]; + + m_rx_fifo[0] = m_rx_fifo[1]; + m_rx_fifo[1] = m_rx_fifo[2]; + m_rx_fifo[2] = m_rx_fifo[3]; + m_rx_fifo[3] = m_rx_fifo[4]; + m_rx_fifo[4] = spi_process_rx(); + + return ret; +} + +void gpl162xx_lcdtype_state::spi_tx_fifo_w(uint16_t data) +{ + data &= 0x00ff; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_tx_fifo_w %04x\n", machine().describe_context(), data); + + spi_process_tx_data(data); +} + +// this is probably 'port b' but when SPI is enabled some points of this can become SPI control pins +// it's accessed after each large data transfer, probably to reset the SPI into 'ready for command' state? +void gpl162xx_lcdtype_state::unk_7868_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: unk_7868_w %04x (Port B + SPI reset?)\n", machine().describe_context(), data); + + if ((m_7868 & 0x0100) != (data & 0x0100)) + { + if (!(data & 0x0100)) + { + for (int i = 0; i < 4; i++) + m_rx_fifo[i] = 0xff; + + m_spistate = SPI_STATE_READY; + } + } + + m_7868 = data; +} + +uint16_t gpl162xx_lcdtype_state::unk_7868_r() +{ + return m_7868; +} + +void gpl162xx_lcdtype_state::bankswitch_707e_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: bankswitch_707e_w %04x\n", machine().describe_context(), data); + m_707e_bank = data; +} + +uint16_t gpl162xx_lcdtype_state::bankswitch_707e_r() +{ + return m_707e_bank; +} + + +void gpl162xx_lcdtype_state::bankswitch_703a_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: bankswitch_703a_w %04x\n", machine().describe_context(), data); + m_703a_bank = data; +} + +uint16_t gpl162xx_lcdtype_state::bankswitch_703a_r() +{ + return m_703a_bank; +} + +void gpl162xx_lcdtype_state::bankedram_7300_w(offs_t offset, uint16_t data) +{ + offset |= (m_703a_bank & 0x000c) << 6; + m_bankedram_7300[offset] = data; +} + +uint16_t gpl162xx_lcdtype_state::bankedram_7300_r(offs_t offset) +{ + offset |= (m_703a_bank & 0x000c) << 6; + return m_bankedram_7300[offset]; +} + +void gpl162xx_lcdtype_state::bankedram_7400_w(offs_t offset, uint16_t data) +{ + if (m_707e_bank & 1) + { + m_bankedram_7400[offset + 0x400] = data; + } + else + { + m_bankedram_7400[offset] = data; + } +} + +uint16_t gpl162xx_lcdtype_state::bankedram_7400_r(offs_t offset) +{ + if (m_707e_bank & 1) + { + return m_bankedram_7400[offset + 0x400]; + } + else + { + return m_bankedram_7400[offset]; + } +} + +void gpl162xx_lcdtype_state::system_dma_params_channel0_w(offs_t offset, uint16_t data) +{ + m_dmaregs[offset] = data; + + switch (offset) + { + case 0: + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Mode)\n", machine().describe_context(), offset, data); + + uint16_t mode = m_dmaregs[0]; + uint32_t source = m_dmaregs[1] | (m_dmaregs[4] << 16); + uint32_t dest = m_dmaregs[2] | (m_dmaregs[5] << 16) ; + uint32_t length = m_dmaregs[3] | (m_dmaregs[6] << 16); + + if ((mode != 0x0200) && (mode != 0x4009) && (mode != 0x6009)) + fatalerror("unknown dma mode write %04x\n", data); + + if ((mode == 0x4009) || (mode == 0x6009)) + { + address_space& mem = m_maincpu->space(AS_PROGRAM); + + for (int i = 0; i < length; i++) + { + uint16_t dat = mem.read_word(source); + + if (mode & 0x2000) + { + // Racing Car and Elevator Action need this logic + mem.write_word(dest, dat & 0xff); + dest++; + mem.write_word(dest, dat >> 8); + dest++; + } + else + { + mem.write_word(dest, dat); + dest++; + } + + source++; + } + } + + break; + } + case 1: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Source Low)\n", machine().describe_context(), offset, data); + break; + + case 2: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Dest Low)\n", machine().describe_context(), offset, data); + break; + + case 3: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Length Low)\n", machine().describe_context(), offset, data); + break; + + case 4: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Source High)\n", machine().describe_context(), offset, data); + break; + + case 5: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Dest High)\n", machine().describe_context(), offset, data); + break; + + case 6: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Length High)\n", machine().describe_context(), offset, data); + break; + + case 7: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA unknown)\n", machine().describe_context(), offset, data); + break; + } +} + +uint16_t gpl162xx_lcdtype_state::system_dma_params_channel0_r(offs_t offset) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_r %01x\n", machine().describe_context(), offset); + return m_dmaregs[offset]; +} + +uint16_t gpl162xx_lcdtype_state::io_7870_r() +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: io_7870_r (IO port)\n", machine().describe_context() ); + return m_io_in1->read(); +} + +void gpl162xx_lcdtype_state::spi_control_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_control_w %04x\n", machine().describe_context(), data); +} + +uint16_t gpl162xx_lcdtype_state::unk_78a1_r() +{ + // checked in interrupt, code skipped entirely if this isn't set + return m_78a1; +} + +uint16_t gpl162xx_lcdtype_state::unk_78d8_r() +{ + return 0xffff; +} + +void gpl162xx_lcdtype_state::unk_78d8_w(uint16_t data) +{ + // written in IRQ, possible ack + if (data & 0x8000) + m_78a1 &= ~0x8000; +} + + +void gpl162xx_lcdtype_state::map(address_map &map) +{ + // there are calls to 01xxx and 02xxx regions + // (RAM populated by internal ROM?, TODO: check to make sure code copied there isn't from SPI ROM like the GPL16250 bootstrap + // does from NAND, it doesn't seem to have a header in the same format at least) + map(0x000000, 0x006fff).ram().share("mainram"); + + // registers at 7xxx are similar to GPL16250, but not identical? (different video system? or just GPL16250 with the video part unused?) + + map(0x00703a, 0x00703a).rw(FUNC(gpl162xx_lcdtype_state::bankswitch_703a_r), FUNC(gpl162xx_lcdtype_state::bankswitch_703a_w)); + map(0x00707e, 0x00707e).rw(FUNC(gpl162xx_lcdtype_state::bankswitch_707e_r), FUNC(gpl162xx_lcdtype_state::bankswitch_707e_w)); + + map(0x007100, 0x0071ff).ram(); // rowscroll on gpl16250 + map(0x007300, 0x0073ff).rw(FUNC(gpl162xx_lcdtype_state::bankedram_7300_r), FUNC(gpl162xx_lcdtype_state::bankedram_7300_w)); // palette on gpl16250 + map(0x007400, 0x0077ff).rw(FUNC(gpl162xx_lcdtype_state::bankedram_7400_r), FUNC(gpl162xx_lcdtype_state::bankedram_7400_w)); // spriteram on gpl16250 + + map(0x00780f, 0x00780f).r(FUNC(gpl162xx_lcdtype_state::unk_780f_r)); + + + map(0x007860, 0x007860).rw(FUNC(gpl162xx_lcdtype_state::io_7860_r),FUNC(gpl162xx_lcdtype_state::io_7860_w)); // Port A? + map(0x007862, 0x007862).w(FUNC(gpl162xx_lcdtype_state::unk_7862_w)); + map(0x007863, 0x007863).w(FUNC(gpl162xx_lcdtype_state::unk_7863_w)); + + map(0x007868, 0x007868).rw(FUNC(gpl162xx_lcdtype_state::unk_7868_r), FUNC(gpl162xx_lcdtype_state::unk_7868_w)); // Port B? + + map(0x007870, 0x007870).r(FUNC(gpl162xx_lcdtype_state::io_7870_r)); // Port C? + + map(0x0078a1, 0x0078a1).r(FUNC(gpl162xx_lcdtype_state::unk_78a1_r)); + + map(0x0078d8, 0x0078d8).rw(FUNC(gpl162xx_lcdtype_state::unk_78d8_r), FUNC(gpl162xx_lcdtype_state::unk_78d8_w)); + + + map(0x007940, 0x007940).w(FUNC(gpl162xx_lcdtype_state::spi_control_w)); + // 7941 SPI Transmit Status + map(0x007942, 0x007942).w(FUNC(gpl162xx_lcdtype_state::spi_tx_fifo_w)); + // 7943 SPI Receive Status + map(0x007944, 0x007944).r(FUNC(gpl162xx_lcdtype_state::spi_rx_fifo_r)); + map(0x007945, 0x007945).r(FUNC(gpl162xx_lcdtype_state::spi_misc_control_r)); + + map(0x007a80, 0x007a87).rw(FUNC(gpl162xx_lcdtype_state::system_dma_params_channel0_r), FUNC(gpl162xx_lcdtype_state::system_dma_params_channel0_w)); + + map(0x007abf, 0x007abf).r(FUNC(gpl162xx_lcdtype_state::unk_7abf_r)); + + // there are calls to 0x0f000 (internal ROM?) + map(0x00f000, 0x00ffff).rom().region("maincpu", 0x00000); + + // external LCD controller + map(0x200000, 0x200000).w(FUNC(gpl162xx_lcdtype_state::lcd_command_w)); + map(0x20fc00, 0x20fc00).w(FUNC(gpl162xx_lcdtype_state::lcd_w)); +} + +void gpl162xx_lcdtype_state::lcd_command_w(uint16_t data) +{ + data &= 0xff; + + switch (m_lcdstate) + { + case LCD_STATE_READY: + case LCD_STATE_PROCESSING_COMMAND: + { + if (data == 0x0000) + { + m_lcdstate = LCD_STATE_WAITING_FOR_COMMAND; + m_lastlcdcommand = 0; + } + break; + } + + case LCD_STATE_WAITING_FOR_COMMAND: + { + m_lastlcdcommand = data; + m_lcdstate = LCD_STATE_PROCESSING_COMMAND; + break; + } + + } +} + +void gpl162xx_lcdtype_state::lcd_w(uint16_t data) +{ + data &= 0xff; // definitely looks like 8-bit port as 16-bit values are shifted and rewritten + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: lcd_w %02x\n", machine().describe_context(), data); + + if ((m_lcdstate == LCD_STATE_PROCESSING_COMMAND) && (m_lastlcdcommand == 0x22)) + { + m_displaybuffer[m_lcdaddr] = data; + m_lcdaddr++; + + if (m_lcdaddr >= ((320 * 240) * 2)) + m_lcdaddr = 0; + + //m_lcdaddr &= 0x3ffff; + } +} + + +void gpl162xx_lcdtype_state::machine_start() +{ +} + + +void gpl162xx_lcdtype_state::machine_reset() +{ + m_spistate = SPI_STATE_READY; + m_spiaddress = 0; + + for (int i = 0; i < 320*240*2; i++) + m_displaybuffer[i] = 0x00; + + m_lcdaddr = 0; + + m_lcdstate = LCD_STATE_READY; + m_lastlcdcommand = 0; + + m_78a1 = 0; + +// first menu index is stored here +// m_spirom[0x16000] = gamenum & 0xff; +// m_spirom[0x16001] = (gamenum>>8) & 0xff; +} + +WRITE_LINE_MEMBER(gpl162xx_lcdtype_state::screen_vblank) +{ + if (state) + { + // probably a timer + m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); + m_78a1 |= 0x8000; + } + else + { + m_maincpu->set_input_line(UNSP_IRQ4_LINE, CLEAR_LINE); + } +} + +void gpl162xx_lcdtype_state::gpl162xx_lcdtype(machine_config &config) +{ + + UNSP_20(config, m_maincpu, 96000000); // unknown CPU, unsp20 based, 96Mhz is listed as the maximum for most unSP2.0 chips, and appears correct here + m_maincpu->set_addrmap(AS_PROGRAM, &gpl162xx_lcdtype_state::map); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(10)); + m_screen->set_size(64*8, 32*8); + m_screen->set_visarea(0*8, 320-1, 0*8, 240-1); + m_screen->set_screen_update(FUNC(gpl162xx_lcdtype_state::screen_update)); + m_screen->screen_vblank().set(FUNC(gpl162xx_lcdtype_state::screen_vblank)); + + PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x8000); + + BL_HANDHELDS_MENUCONTROL(config, m_menucontrol, 0); + m_menucontrol->set_is_unsp_type_hack(); + +} + +// pcp8718 and pcp8728 both contain user data (player name?) and will need to be factory defaulted once they work +// the ROM code is slightly different between them + +ROM_START( pcp8718 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) + + ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) + //ROM_LOAD16_WORD_SWAP( "8718_en25f32.bin", 0x000000, 0x400000, CRC(cc138db4) SHA1(379af3d94ae840f52c06416d6cf32e25923af5ae) ) // bad dump, some blocks are corrupt + ROM_LOAD( "eyecare_25q32av1g_ef4016.bin", 0x000000, 0x400000, CRC(58415e10) SHA1(b1adcc03f2ad8d741544204671677740e904ce1a) ) +ROM_END + +ROM_START( pcp8728 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) + + ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) + ROM_LOAD( "pcp 8728 788 in 1.bin", 0x000000, 0x400000, CRC(60115f21) SHA1(e15c39f11e442a76fae3823b6d510178f6166926) ) +ROM_END + +ROM_START( bkid218 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) + + ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) + ROM_LOAD( "218n1_25q64csig_c84017.bin", 0x000000, 0x800000, CRC(94f35dbd) SHA1(a1bd6defd2465ae14753cd83be5c31f99e9158ec) ) +ROM_END + + +CONS( 200?, pcp8718, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "PCP", "PCP 8718 - HD 360 Degrees Rocker Palm Eyecare Console - 788 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +CONS( 200?, pcp8728, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "PCP", "PCP 8728 - 788 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // what name was this sold under? +CONS( 200?, bkid218, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "BornKid", "Handheld Game Console BC-19 - 218 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/generalplus_gpl32612.cpp b/src/mame/drivers/generalplus_gpl32612.cpp index d7d830a0424..1c9df04d370 100644 --- a/src/mame/drivers/generalplus_gpl32612.cpp +++ b/src/mame/drivers/generalplus_gpl32612.cpp @@ -45,6 +45,8 @@ private: virtual void machine_start() override; virtual void machine_reset() override; + void arm_map(address_map &map); + required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; @@ -52,10 +54,49 @@ private: uint32_t screen_update_gpl32612(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void nand_init(int blocksize, int blocksize_stripped); + void copy_block(int i, int blocksize, int blocksize_stripped, uint8_t* nandrom, int dest); + void bootstrap(); std::vector<uint8_t> m_strippedrom; + + uint32_t unk_d000003c_r(offs_t offset, uint32_t mem_mask); + uint32_t unk_d0800018_r(offs_t offset, uint32_t mem_mask); + uint32_t unk_d0900140_r(offs_t offset, uint32_t mem_mask); + uint32_t unk_d0900153_r(offs_t offset, uint32_t mem_mask); }; +uint32_t generalplus_gpl32612_game_state::unk_d000003c_r(offs_t offset, uint32_t mem_mask) +{ + return machine().rand(); +} + +uint32_t generalplus_gpl32612_game_state::unk_d0800018_r(offs_t offset, uint32_t mem_mask) +{ + return machine().rand(); +} + +uint32_t generalplus_gpl32612_game_state::unk_d0900140_r(offs_t offset, uint32_t mem_mask) +{ + return machine().rand(); +} + +uint32_t generalplus_gpl32612_game_state::unk_d0900153_r(offs_t offset, uint32_t mem_mask) +{ + return machine().rand(); +} + +void generalplus_gpl32612_game_state::arm_map(address_map &map) +{ + map(0x00000000, 0x03ffffff).ram(); + + map(0xd000003c, 0xd000003f).r(FUNC(generalplus_gpl32612_game_state::unk_d000003c_r)); + + map(0xd0800018, 0xd080001b).r(FUNC(generalplus_gpl32612_game_state::unk_d0800018_r)); + + map(0xd0900140, 0xd0900143).r(FUNC(generalplus_gpl32612_game_state::unk_d0900140_r)); + map(0xd0900150, 0xd0900153).r(FUNC(generalplus_gpl32612_game_state::unk_d0900153_r)); +} + uint32_t generalplus_gpl32612_game_state::screen_update_gpl32612(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; @@ -72,10 +113,39 @@ void generalplus_gpl32612_game_state::machine_reset() static INPUT_PORTS_START( gpl32612 ) INPUT_PORTS_END +void generalplus_gpl32612_game_state::copy_block(int i, int blocksize, int blocksize_stripped, uint8_t* nandrom, int dest) +{ + const int base = i * blocksize; + address_space& mem = m_maincpu->space(AS_PROGRAM); + + for (int j = 0; j < blocksize_stripped; j++) + { + uint8_t data = nandrom[base + j]; + //printf("writing to %08x : %02x", dest + j, data); + mem.write_byte(dest+j, data); + } +} + +void generalplus_gpl32612_game_state::bootstrap() +{ + uint8_t* rom = memregion("nand")->base(); + + //int startblock = 0xe0000 / 0x800; + int startblock = 0xa0000 / 0x800; + int endblock = 0x1f0000 / 0x800; + + int j = 0; + for (int i = startblock; i < endblock; i++) // how much is copied, and where from? as with the unSP NAND ones there appear to be several stages of bootloader, this is not the 1st one + { + copy_block(i, 0x840, 0x800, rom, j * 0x800); + j++; + } +} void generalplus_gpl32612_game_state::gpl32612(machine_config &config) { ARM9(config, m_maincpu, 240000000); // unknown core / frequency, but ARM based + m_maincpu->set_addrmap(AS_PROGRAM, &generalplus_gpl32612_game_state::arm_map); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); @@ -90,35 +160,40 @@ void generalplus_gpl32612_game_state::gpl32612(machine_config &config) // NAND dumps, so there will be a bootloader / boot strap at least ROM_START( jak_swbstrik ) - ROM_REGION( 0x8400000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x8400000, "nand", ROMREGION_ERASEFF ) ROM_LOAD( "starwarsblaster.bin", 0x000000, 0x8400000, CRC(02c3c4d6) SHA1(a6ae05a7d7b2015023113f6baad25458f3c01102) ) ROM_END ROM_START( jak_tmnthp ) - ROM_REGION( 0x8400000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x8400000, "nand", ROMREGION_ERASEFF ) ROM_LOAD( "tmntheroportal.bin", 0x000000, 0x8400000, CRC(75ec7127) SHA1(cd05f55a1f5a7fd3d1b0658ad6805b8777857a7e) ) ROM_END ROM_START( jak_ddhp ) - ROM_REGION( 0x8400000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x8400000, "nand", ROMREGION_ERASEFF ) ROM_LOAD( "dragonsheroesportal_mx30lf1g08aa_c2f1.bin", 0x000000, 0x8400000, CRC(825cce7b) SHA1(2185137138f2a20e5cfe9c167eeb67a146953b65) ) ROM_END ROM_START( jak_dchp ) - ROM_REGION( 0x8400000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x8400000, "nand", ROMREGION_ERASEFF ) ROM_LOAD( "dcheroportal_mx30lf1g08aa_c2f1.bin", 0x000000, 0x8400000, CRC(576a3005) SHA1(6cd9edc4def707aede3f82a21c87269d2a6bc870) ) ROM_END ROM_START( jak_prhp ) - ROM_REGION( 0x8400000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x8400000, "nand", ROMREGION_ERASEFF ) ROM_LOAD( "mx30lf1g08aa.u2", 0x000000, 0x8400000, CRC(4ccd7e53) SHA1(decbd424f088d180776a817c80b147d6a887e5c1) ) ROM_END +// uncertain hardware type, ARM based, has GPNAND strings +ROM_START( zippity ) + ROM_REGION( 0x10800000, "nandrom", ROMREGION_ERASE00 ) + ROM_LOAD( "zippity_mt29f2g08aacwp_2cda8015.bin", 0x0000, 0x10800000, CRC(16248b63) SHA1(3607337588a68052ef5c495b496aa3e0449d3eb6) ) +ROM_END void generalplus_gpl32612_game_state::nand_init(int blocksize, int blocksize_stripped) { - uint8_t* rom = memregion("maincpu")->base(); - int size = memregion("maincpu")->bytes(); + uint8_t* rom = memregion("nand")->base(); + int size = memregion("nand")->bytes(); int numblocks = size / blocksize; @@ -153,6 +228,7 @@ void generalplus_gpl32612_game_state::nand_init(int blocksize, int blocksize_str void generalplus_gpl32612_game_state::nand_init840() { nand_init(0x840, 0x800); + bootstrap(); } @@ -162,3 +238,6 @@ CONS( 200?, jak_tmnthp, 0, 0, gpl32612, gpl32612, generalplus_gp CONS( 200?, jak_ddhp, 0, 0, gpl32612, gpl32612, generalplus_gpl32612_game_state, nand_init840, "JAKKS Pacific Inc", "DreamWorks Dragons Hero Portal", MACHINE_IS_SKELETON ) CONS( 200?, jak_prhp, 0, 0, gpl32612, gpl32612, generalplus_gpl32612_game_state, nand_init840, "JAKKS Pacific Inc", "Power Rangers Super Megaforce Hero Portal", MACHINE_IS_SKELETON ) // from a PAL unit (probably not region specific) CONS( 200?, jak_dchp, 0, 0, gpl32612, gpl32612, generalplus_gpl32612_game_state, nand_init840, "JAKKS Pacific Inc", "DC Super Heroes The Watchtower Hero Portal", MACHINE_IS_SKELETON ) + +// Might not belong here, SoC is marked GPL32300A instead, but is still ARM based, and has GPNAND strings +CONS( 201?, zippity, 0, 0, gpl32612, gpl32612, generalplus_gpl32612_game_state, empty_init, "LeapFrog", "Zippity (US)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/generalplus_gpl_unknown.cpp b/src/mame/drivers/generalplus_gpl_unknown.cpp index 7560eddf55b..6aaef1a32d8 100644 --- a/src/mame/drivers/generalplus_gpl_unknown.cpp +++ b/src/mame/drivers/generalplus_gpl_unknown.cpp @@ -1,78 +1,6 @@ // license:BSD-3-Clause // copyright-holders:David Haywood -// these contain the similar game selections to the games in unk6502_st2xxx.cpp but on updated hardware - -/* These use SPI ROMs and unSP2.0 instructions, so will be GeneralPlus branded parts, not SunPlus - this might just be a GPL16250 with the video features bypassed as the sprite/palette banking is still - used, but the RAM treated as work buffers -*/ - -/* - -for pcp8728 long jumps are done indirect via a call to RAM - -990c 20ec r4 = 20ec -d9dd [1d] = r4 -990c 0007 r4 = 0007 -d9de [1e] = r4 -fe80 28f7 goto 0028f7 - -the code to handle this is copied in at startup. - -Almost all function calls in the game are handled via a call to RAM which copies data inline from SPI for execution -these calls manage their own stack, and copying back the caller function on return etc. - -The largest function in RAM at any one time is ~0x600 bytes. - -This appears to be incredibly inefficient but the system can't execute directly from SPI ROM, and doesn't have any -RAM outside of the small area internal to the Sunplus SoC - -Graphics likewise appear to be loaded pixel by pixel from the SPI to framebuffer every single time there is a draw -call. Sound is almost certainly handled in the same way. - -There is a missing internal ROM that acts as bootstrap and provides some basic functions. It is at least 0x1000 -words in size, with the lowest call being to 0xf000. It is potentially larger than this. - -The internal ROM will also need to provide trampolining for the interrupts, there is a single pointer near the -start of the SPI ROM '02000A: 0041 0002' which points to 20041 (assuming you map the SPI ROM base as word address -0x20000, so that the calls to get code align with ROM addresses) - -The function pointed to for the interrupt has the same form of the other functions that get loaded into RAM via -calls to functions in the RAM area. - --------------------------------------------------------- - -BIOS (internal ROM) calls: - -0xf000 - copy dword from SPI using provided pointer - -0xf56f - unknown, after some time, done with PC = f56f, only in one place - -0xf58f - unknown, soon after startup (only 1 call) - -00f7a0 - unknown - 3 calls - -0xf931 - unknown, just one call - -00fa1d - unknown, just one call - -0xfb26 - unknown, after some time (done with pc = fb26 and calls) - -0xfb4f - unknown, just one call - -0xfbbf - unknown, 3 calls - -code currently goes off the rails after some of these unhandled calls (one to f56f?) - --- - -use 'go 2938' to get to the inline code these load on the fly - -the first piece of code copied appears to attempt to checksum the internal BIOS! - -*/ - #include "emu.h" #include "cpu/unsp/unsp.h" @@ -81,34 +9,23 @@ the first piece of code copied appears to attempt to checksum the internal BIOS! #include "screen.h" #include "speaker.h" - -#define LOG_GPL_UNKNOWN (1U << 1) -#define LOG_GPL_UNKNOWN_SELECT_SIM (1U << 2) - -#define LOG_ALL (LOG_GPL_UNKNOWN | LOG_GPL_UNKNOWN_SELECT_SIM) -#define VERBOSE (0) - #include "logmacro.h" -class pcp8718_state : public driver_device +class generalplus_gpl_unknown_state : public driver_device { public: - pcp8718_state(const machine_config &mconfig, device_type type, const char *tag) : + generalplus_gpl_unknown_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_mainrom(*this, "maincpu"), - m_mainram(*this, "mainram"), + //m_mainrom(*this, "maincpu"), + //m_mainram(*this, "mainram"), m_palette(*this, "palette"), m_screen(*this, "screen"), - m_spirom(*this, "spi"), - m_io_p1(*this, "IN0"), - m_io_p2(*this, "IN1") + m_spirom(*this, "spi") { } - - void pcp8718(machine_config &config); - - void spi_init(); + + void generalplus_gpl_unknown(machine_config &config); private: virtual void machine_start() override; @@ -117,1041 +34,90 @@ private: uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device<unsp_20_device> m_maincpu; - required_region_ptr<uint16_t> m_mainrom; - required_shared_ptr<uint16_t> m_mainram; + //required_region_ptr<uint16_t> m_mainrom; + //required_shared_ptr<uint16_t> m_mainram; required_device<palette_device> m_palette; required_device<screen_device> m_screen; - - void map(address_map &map); - - uint16_t simulate_f000_r(offs_t offset); - - uint16_t ramcall_2060_logger_r(); - uint16_t ramcall_2189_logger_r(); - - uint16_t ramcall_2434_logger_r(); - - uint16_t ramcall_2829_logger_r(); - uint16_t ramcall_287a_logger_r(); - uint16_t ramcall_28f7_logger_r(); - uint16_t ramcall_2079_logger_r(); - - required_region_ptr<uint8_t> m_spirom; - uint16_t unk_7abf_r(); - uint16_t unk_7860_r(); - uint16_t unk_780f_r(); - - void unk_7860_w(uint16_t data); - uint16_t m_7860; - - void unk_7868_w(uint16_t data); - uint16_t unk_7868_r(); - uint16_t m_7868; - - void bankswitch_707e_w(uint16_t data); - uint16_t bankswitch_707e_r(); - uint16_t m_707e_bank; - - void bankswitch_703a_w(uint16_t data); - uint16_t bankswitch_703a_r(); - uint16_t m_703a_bank; - - void bankedram_7300_w(offs_t offset, uint16_t data); - uint16_t bankedram_7300_r(offs_t offset); - uint16_t m_bankedram_7300[0x400]; - - void bankedram_7400_w(offs_t offset, uint16_t data); - uint16_t bankedram_7400_r(offs_t offset); - uint16_t m_bankedram_7400[0x800]; - - void system_dma_params_channel0_w(offs_t offset, uint16_t data); - uint16_t system_dma_params_channel0_r(offs_t offset); - - uint16_t m_dmaregs[8]; - - void lcd_w(uint16_t data); - void lcd_command_w(uint16_t data); - - uint16_t spi_misc_control_r(); - uint16_t spi_rx_fifo_r(); - void spi_tx_fifo_w(uint16_t data); - - void spi_control_w(uint16_t data); - - void spi_process_tx_data(uint8_t data); - uint8_t spi_process_rx(); - uint8_t spi_rx(); - uint8_t spi_rx_fast(); - - uint8_t m_rx_fifo[5]; // actually 8 bytes? or 8 half-bytes? - - uint32_t m_spiaddress; - - uint16_t unk_78a1_r(); - uint16_t m_78a1; - void unk_78d8_w(uint16_t data); - - enum spistate : const int - { - SPI_STATE_READY = 0, - SPI_STATE_WAITING_HIGH_ADDR = 1, - SPI_STATE_WAITING_MID_ADDR = 2, - SPI_STATE_WAITING_LOW_ADDR = 3, - // probably not - SPI_STATE_WAITING_DUMMY1_ADDR = 4, - SPI_STATE_WAITING_DUMMY2_ADDR = 5, - SPI_STATE_READING = 6, - - SPI_STATE_WAITING_HIGH_ADDR_FAST = 8, - SPI_STATE_WAITING_MID_ADDR_FAST = 9, - SPI_STATE_WAITING_LOW_ADDR_FAST = 10, - SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY = 11, - SPI_STATE_READING_FAST = 12 - - }; - - spistate m_spistate; - - enum lcdstate : const int - { - LCD_STATE_READY = 0, - LCD_STATE_WAITING_FOR_COMMAND = 1, - LCD_STATE_PROCESSING_COMMAND = 2 - }; - - lcdstate m_lcdstate; - int m_lastlcdcommand; - - uint8_t m_displaybuffer[0x40000]; - int m_lcdaddr; - - uint16_t unk_7870_r(); - required_ioport m_io_p1; - required_ioport m_io_p2; - - uint16_t m_stored_gamenum; - int m_addval; - - DECLARE_WRITE_LINE_MEMBER(screen_vblank); + void map(address_map &map); }; -uint32_t pcp8718_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t generalplus_gpl_unknown_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count = 0; - for (int y = 0; y < 256; y++) - { - uint32_t* dst = &bitmap.pix32(y); - - for (int x = 0; x < 320; x++) - { - // 8-bit values get pumped through a 256 word table in intenral ROM and converted to words, so it's probably raw 16-bit RGB data? - uint16_t dat = m_displaybuffer[(count * 2) + 1] | (m_displaybuffer[(count * 2) + 0] << 8); - - int b = ((dat >> 0) & 0x1f) << 3; - int g = ((dat >> 5) & 0x3f) << 2; - int r = ((dat >> 11) & 0x1f) << 3; - - dst[x] = (r << 16) | (g << 8) | (b << 0); - count++; - } - } - return 0; } - - - - -static INPUT_PORTS_START( pcp8718 ) - PORT_START("IN0") - PORT_DIPNAME( 0x0001, 0x0001, "P1:0001" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0001, "0001" ) - PORT_DIPNAME( 0x0002, 0x0002, "P1:0002" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0002, "0002" ) - PORT_DIPNAME( 0x0004, 0x0004, "P1:0004" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0004, "0004" ) - PORT_DIPNAME( 0x0008, 0x0008, "P1:0008" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0008, "0008" ) - PORT_DIPNAME( 0x0010, 0x0010, "P1:0010" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0010, "0010" ) - PORT_DIPNAME( 0x0020, 0x0020, "P1:0020" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0020, "0020" ) - PORT_DIPNAME( 0x0040, 0x0040, "P1:0040" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0040, "0040" ) - PORT_DIPNAME( 0x0080, 0x0080, "P1:0080" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0080, "0080" ) - PORT_DIPNAME( 0x0100, 0x0100, "P1:0100" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0100, "0100" ) - PORT_DIPNAME( 0x0200, 0x0200, "P1:0200" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0200, "0200" ) - PORT_DIPNAME( 0x0400, 0x0400, "P1:0400" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0400, "0400" ) - PORT_DIPNAME( 0x0800, 0x0800, "P1:0800" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0800, "0800" ) - PORT_DIPNAME( 0x1000, 0x1000, "P1:1000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x1000, "1000" ) - PORT_DIPNAME( 0x2000, 0x2000, "P1:2000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x2000, "2000" ) - PORT_DIPNAME( 0x4000, 0x4000, "P1:4000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x4000, "4000" ) - PORT_DIPNAME( 0x8000, 0x8000, "P1:8000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x8000, "8000" ) - - PORT_START("IN1") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // causes lag if state is inverted, investigate - PORT_DIPNAME( 0x0002, 0x0002, "P2:0002" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0002, "0002" ) - PORT_DIPNAME( 0x0004, 0x0004, "Show Vs in Test Mode" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0004, "0004" ) - PORT_DIPNAME( 0x0008, 0x0008, "P2:0008" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0008, "0008" ) - PORT_DIPNAME( 0x0010, 0x0010, "P2:0010" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0010, "0010" ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("SOUND") - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("ON/OFF") - PORT_DIPNAME( 0x1000, 0x1000, "P2:1000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x1000, "1000" ) - PORT_DIPNAME( 0x2000, 0x2000, "P2:2000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x2000, "2000" ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) +static INPUT_PORTS_START( generalplus_gpl_unknown ) INPUT_PORTS_END -uint16_t pcp8718_state::unk_7abf_r() -{ - return 0x0001; -} - -uint16_t pcp8718_state::unk_7860_r() -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: unk_7860_r (IO port)\n", machine().describe_context()); - - uint16_t ret = (m_io_p2->read() & 0xfff7); - - if ((m_7860 & 0x20)) - ret |= 0x08; - - return ret; -} - -void pcp8718_state::unk_7860_w(uint16_t data) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: unk_7860_w %04x (IO port)\n", machine().describe_context(), data); - m_7860 = data; -} - - -uint16_t pcp8718_state::unk_780f_r() -{ - return 0x0002; -} - - - -uint16_t pcp8718_state::spi_misc_control_r() -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: spi_misc_control_r\n", machine().describe_context()); - return 0x0000; -} - - -uint16_t pcp8718_state::spi_rx_fifo_r() -{ - if (m_spistate == SPI_STATE_READING_FAST) - return spi_rx_fast(); - - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: spi_rx_fifo_r\n", machine().describe_context()); - return spi_rx(); -} - -void pcp8718_state::spi_process_tx_data(uint8_t data) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"transmitting %02x\n", data); - - switch (m_spistate) - { - case SPI_STATE_READY: - { - if (data == 0x03) - { - LOGMASKED(LOG_GPL_UNKNOWN,"set to read mode (need address) %02x\n", data); - m_spistate = SPI_STATE_WAITING_HIGH_ADDR; - } - else if (data == 0x0b) - { - LOGMASKED(LOG_GPL_UNKNOWN,"set to fast read mode (need address) %02x\n", data); - m_spistate = SPI_STATE_WAITING_HIGH_ADDR_FAST; - //machine().debug_break(); - } - else - { - LOGMASKED(LOG_GPL_UNKNOWN,"invalid state request %02x\n", data); - } - break; - } - - case SPI_STATE_WAITING_HIGH_ADDR: - { - m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; - LOGMASKED(LOG_GPL_UNKNOWN,"set to high address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_MID_ADDR; - break; - } - - case SPI_STATE_WAITING_MID_ADDR: - { - m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; - LOGMASKED(LOG_GPL_UNKNOWN,"set to mid address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_LOW_ADDR; - break; - } - - case SPI_STATE_WAITING_LOW_ADDR: - { - m_spiaddress = (m_spiaddress & 0xffffff00) | data; - LOGMASKED(LOG_GPL_UNKNOWN,"set to low address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_READING; - break; - } - - case SPI_STATE_READING: - { - // writes when in read mode clock in data? - LOGMASKED(LOG_GPL_UNKNOWN,"write while in read mode (clock data?)\n", data, m_spiaddress); - break; - } - - case SPI_STATE_WAITING_DUMMY1_ADDR: - { - m_spistate = SPI_STATE_WAITING_DUMMY2_ADDR; - break; - } - - case SPI_STATE_WAITING_DUMMY2_ADDR: - { - // m_spistate = SPI_STATE_READY; - break; - } - - - case SPI_STATE_WAITING_HIGH_ADDR_FAST: - { - m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; - LOGMASKED(LOG_GPL_UNKNOWN,"set to high address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_MID_ADDR_FAST; - break; - } - - case SPI_STATE_WAITING_MID_ADDR_FAST: - { - m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; - LOGMASKED(LOG_GPL_UNKNOWN,"set to mid address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST; - break; - } - - case SPI_STATE_WAITING_LOW_ADDR_FAST: - { - m_spiaddress = (m_spiaddress & 0xffffff00) | data; - LOGMASKED(LOG_GPL_UNKNOWN,"set to low address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY; - - break; - } - - case SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY: - { - LOGMASKED(LOG_GPL_UNKNOWN,"dummy write %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_READING_FAST; - break; - } - - case SPI_STATE_READING_FAST: - { - // writes when in read mode clock in data? - LOGMASKED(LOG_GPL_UNKNOWN,"write while in read mode (clock data?)\n", data, m_spiaddress); - break; - } - - } -} - -uint8_t pcp8718_state::spi_process_rx() -{ - - switch (m_spistate) - { - case SPI_STATE_READING: - case SPI_STATE_READING_FAST: - { - uint8_t dat = m_spirom[m_spiaddress & 0x3fffff]; - - // hack internal BIOS checksum check - //if (m_spiaddress == ((0x49d13 - 0x20000) * 2)+1) - // if (dat == 0x4e) - // dat = 0x5e; - - LOGMASKED(LOG_GPL_UNKNOWN,"reading SPI %02x from SPI Address %08x (adjusted word offset %08x)\n", dat, m_spiaddress, (m_spiaddress/2)+0x20000); - m_spiaddress++; - return dat; - } - - default: - { - LOGMASKED(LOG_GPL_UNKNOWN,"reading FIFO in unknown state\n"); - return 0x00; - } - } - - return 0x00; -} - - -uint8_t pcp8718_state::spi_rx() -{ - uint8_t ret = m_rx_fifo[0]; - - m_rx_fifo[0] = m_rx_fifo[1]; - m_rx_fifo[1] = m_rx_fifo[2]; - m_rx_fifo[2] = m_rx_fifo[3]; - m_rx_fifo[3] = spi_process_rx(); - - return ret; -} - -uint8_t pcp8718_state::spi_rx_fast() -{ - uint8_t ret = m_rx_fifo[0]; - - m_rx_fifo[0] = m_rx_fifo[1]; - m_rx_fifo[1] = m_rx_fifo[2]; - m_rx_fifo[2] = m_rx_fifo[3]; - m_rx_fifo[3] = m_rx_fifo[4]; - m_rx_fifo[4] = spi_process_rx(); - - return ret; -} - -void pcp8718_state::spi_tx_fifo_w(uint16_t data) -{ - data &= 0x00ff; - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: spi_tx_fifo_w %04x\n", machine().describe_context(), data); - - spi_process_tx_data(data); -} - -// this is probably 'port b' but when SPI is enabled some points of this can become SPI control pins -// it's accessed after each large data transfer, probably to reset the SPI into 'ready for command' state? -void pcp8718_state::unk_7868_w(uint16_t data) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: unk_7868_w %04x (Port B + SPI reset?)\n", machine().describe_context(), data); - - if ((m_7868 & 0x0100) != (data & 0x0100)) - { - if (!(data & 0x0100)) - { - for (int i = 0; i < 4; i++) - m_rx_fifo[i] = 0xff; - - m_spistate = SPI_STATE_READY; - } - } - - m_7868 = data; -} - -uint16_t pcp8718_state::unk_7868_r() -{ - return m_7868; -} - -void pcp8718_state::bankswitch_707e_w(uint16_t data) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: bankswitch_707e_w %04x\n", machine().describe_context(), data); - m_707e_bank = data; -} - -uint16_t pcp8718_state::bankswitch_707e_r() -{ - return m_707e_bank; -} - - -void pcp8718_state::bankswitch_703a_w(uint16_t data) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: bankswitch_703a_w %04x\n", machine().describe_context(), data); - m_703a_bank = data; -} - -uint16_t pcp8718_state::bankswitch_703a_r() -{ - return m_703a_bank; -} - -void pcp8718_state::bankedram_7300_w(offs_t offset, uint16_t data) -{ - offset |= (m_703a_bank & 0x000c) << 6; - m_bankedram_7300[offset] = data; -} - -uint16_t pcp8718_state::bankedram_7300_r(offs_t offset) -{ - offset |= (m_703a_bank & 0x000c) << 6; - return m_bankedram_7300[offset]; -} - -void pcp8718_state::bankedram_7400_w(offs_t offset, uint16_t data) -{ - if (m_707e_bank & 1) - { - m_bankedram_7400[offset + 0x400] = data; - } - else - { - m_bankedram_7400[offset] = data; - } -} - -uint16_t pcp8718_state::bankedram_7400_r(offs_t offset) -{ - if (m_707e_bank & 1) - { - return m_bankedram_7400[offset + 0x400]; - } - else - { - return m_bankedram_7400[offset]; - } -} - -void pcp8718_state::system_dma_params_channel0_w(offs_t offset, uint16_t data) -{ - m_dmaregs[offset] = data; - - switch (offset) - { - case 0: - { - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Mode)\n", machine().describe_context(), offset, data); - -#if 1 - - uint16_t mode = m_dmaregs[0]; - uint32_t source = m_dmaregs[1] | (m_dmaregs[4] << 16); - uint32_t dest = m_dmaregs[2] | (m_dmaregs[5] << 16) ; - uint32_t length = m_dmaregs[3] | (m_dmaregs[6] << 16); - - if ((mode != 0x0200) && (mode != 0x4009) && (mode != 0x6009)) - fatalerror("unknown dma mode write %04x\n", data); - if ((mode == 0x4009) || (mode == 0x6009)) - { - address_space& mem = m_maincpu->space(AS_PROGRAM); - - for (int i = 0; i < length; i++) - { - uint16_t dat = mem.read_word(source); - - if (mode & 0x2000) - { - // Racing Car and Elevator Action need this logic, the code in gpl16250 should probably be like this - // but currently gets used in non-increment mode - mem.write_word(dest, dat & 0xff); - dest++; - mem.write_word(dest, dat >> 8); - dest++; - } - else - { - mem.write_word(dest, dat); - dest++; - } - - source++; - } - } -#endif - break; - } - case 1: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Source Low)\n", machine().describe_context(), offset, data); - break; - - case 2: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Dest Low)\n", machine().describe_context(), offset, data); - break; - - case 3: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Length Low)\n", machine().describe_context(), offset, data); - break; - - case 4: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Source High)\n", machine().describe_context(), offset, data); - break; - - case 5: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Dest High)\n", machine().describe_context(), offset, data); - break; - - case 6: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA Length High)\n", machine().describe_context(), offset, data); - break; - - case 7: - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_w %01x %04x (DMA unknown)\n", machine().describe_context(), offset, data); - break; - } -} - -uint16_t pcp8718_state::system_dma_params_channel0_r(offs_t offset) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: system_dma_params_channel0_r %01x\n", machine().describe_context(), offset); - return m_dmaregs[offset]; -} - -uint16_t pcp8718_state::unk_7870_r() -{ - logerror("%06x: unk_7870_r (IO port)\n", machine().describe_context()); - return m_io_p2->read(); -} - -void pcp8718_state::spi_control_w(uint16_t data) -{ - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: spi_control_w %04x\n", machine().describe_context(), data); -} - -uint16_t pcp8718_state::unk_78a1_r() -{ - // checked in interrupt, code skipped entirely if this isn't set - return m_78a1; -} - -void pcp8718_state::unk_78d8_w(uint16_t data) -{ - // written in IRQ, possible ack - if (data & 0x8000) - m_78a1 &= ~0x8000; -} - - -void pcp8718_state::map(address_map &map) +void generalplus_gpl_unknown_state::map(address_map &map) { - // there are calls to 01xxx and 02xxx regions - // (RAM populated by internal ROM?, TODO: check to make sure code copied there isn't from SPI ROM like the GPL16250 bootstrap - // does from NAND, it doesn't seem to have a header in the same format at least) - map(0x000000, 0x006fff).ram().share("mainram"); - - // registers at 7xxx are similar to GPL16250, but not identical? (different video system? or just GPL16250 with the video part unused?) - - map(0x00703a, 0x00703a).rw(FUNC(pcp8718_state::bankswitch_703a_r), FUNC(pcp8718_state::bankswitch_703a_w)); - map(0x00707e, 0x00707e).rw(FUNC(pcp8718_state::bankswitch_707e_r), FUNC(pcp8718_state::bankswitch_707e_w)); - - map(0x007100, 0x0071ff).ram(); // rowscroll on gpl16250 - map(0x007300, 0x0073ff).rw(FUNC(pcp8718_state::bankedram_7300_r), FUNC(pcp8718_state::bankedram_7300_w)); // palette on gpl16250 - map(0x007400, 0x0077ff).rw(FUNC(pcp8718_state::bankedram_7400_r), FUNC(pcp8718_state::bankedram_7400_w)); // spriteram on gpl16250 - - map(0x00780f, 0x00780f).r(FUNC(pcp8718_state::unk_780f_r)); - - - map(0x007860, 0x007860).rw(FUNC(pcp8718_state::unk_7860_r),FUNC(pcp8718_state::unk_7860_w)); - map(0x007862, 0x007862).nopw(); - map(0x007863, 0x007863).nopw(); - - map(0x007868, 0x007868).rw(FUNC(pcp8718_state::unk_7868_r), FUNC(pcp8718_state::unk_7868_w)); - - map(0x007870, 0x007870).r(FUNC(pcp8718_state::unk_7870_r)); // I/O - - map(0x0078a1, 0x0078a1).r(FUNC(pcp8718_state::unk_78a1_r)); - - map(0x0078d8, 0x0078d8).w(FUNC(pcp8718_state::unk_78d8_w)); - - - map(0x007940, 0x007940).w(FUNC(pcp8718_state::spi_control_w)); - // 7941 SPI Transmit Status - map(0x007942, 0x007942).w(FUNC(pcp8718_state::spi_tx_fifo_w)); - // 7943 SPI Receive Status - map(0x007944, 0x007944).r(FUNC(pcp8718_state::spi_rx_fifo_r)); - map(0x007945, 0x007945).r(FUNC(pcp8718_state::spi_misc_control_r)); - - map(0x007a80, 0x007a87).rw(FUNC(pcp8718_state::system_dma_params_channel0_r), FUNC(pcp8718_state::system_dma_params_channel0_w)); - - map(0x007abf, 0x007abf).r(FUNC(pcp8718_state::unk_7abf_r)); + map(0x000000, 0x00ffff).ram(); // unknown, RAM/ROM? there are jumps to this region, doesn't seem the usual unSP 8000-ffff ROM mapping // there are calls to 0x0f000 (internal ROM?) - map(0x00f000, 0x00ffff).rom().region("maincpu", 0x00000); - - // external LCD controller - map(0x200000, 0x200000).w(FUNC(pcp8718_state::lcd_command_w)); - map(0x20fc00, 0x20fc00).w(FUNC(pcp8718_state::lcd_w)); -} - -void pcp8718_state::lcd_command_w(uint16_t data) -{ - data &= 0xff; - - switch (m_lcdstate) - { - case LCD_STATE_READY: - case LCD_STATE_PROCESSING_COMMAND: - { - if (data == 0x0000) - { - m_lcdstate = LCD_STATE_WAITING_FOR_COMMAND; - m_lastlcdcommand = 0; - } - break; - } - - case LCD_STATE_WAITING_FOR_COMMAND: - { - m_lastlcdcommand = data; - m_lcdstate = LCD_STATE_PROCESSING_COMMAND; - break; - } - - } -} - -void pcp8718_state::lcd_w(uint16_t data) -{ - data &= 0xff; // definitely looks like 8-bit port as 16-bit values are shifted and rewritten - LOGMASKED(LOG_GPL_UNKNOWN,"%06x: lcd_w %02x\n", machine().describe_context(), data); - - if ((m_lcdstate == LCD_STATE_PROCESSING_COMMAND) && (m_lastlcdcommand == 0x22)) - { - m_displaybuffer[m_lcdaddr] = data; - m_lcdaddr++; - - if (m_lcdaddr >= ((320 * 240) * 2)) - m_lcdaddr = 0; - - //m_lcdaddr &= 0x3ffff; - } -} - -uint16_t pcp8718_state::simulate_f000_r(offs_t offset) -{ - if (!machine().side_effects_disabled()) - { - uint16_t pc = m_maincpu->state_int(UNSP_PC); - uint16_t sr = m_maincpu->state_int(UNSP_SR); - int realpc = (pc | (sr << 16)) & 0x003fffff; - - if ((offset + 0xf000) == (realpc)) - { - //LOGMASKED(LOG_GPL_UNKNOWN,"simulate_f000_r reading BIOS area (for BIOS call?) %04x\n", offset); - return m_mainrom[offset]; - } - else - { - //LOGMASKED(LOG_GPL_UNKNOWN,"simulate_f000_r reading BIOS area (for checksum?) %04x\n", offset); - return m_mainrom[offset]; - } - } - return m_mainrom[offset]; -} - -uint16_t pcp8718_state::ramcall_2060_logger_r() -{ - if (!machine().side_effects_disabled()) - { - LOGMASKED(LOG_GPL_UNKNOWN,"call to 0x2060 in RAM (set SPI to read mode, set address, do dummy FIFO reads)\n"); - } - return m_mainram[0x2060]; -} - -uint16_t pcp8718_state::ramcall_2189_logger_r() -{ - if (!machine().side_effects_disabled()) - { - LOGMASKED(LOG_GPL_UNKNOWN,"call to 0x2189 in RAM (unknown)\n"); - } - return m_mainram[0x2189]; -} - - -uint16_t pcp8718_state::ramcall_2829_logger_r() -{ - // this in turn calls 28f7 but has restore logic too - if (!machine().side_effects_disabled()) - { - LOGMASKED(LOG_GPL_UNKNOWN,"call to 0x2829 in RAM (load+call function from SPI address %08x)\n", (m_mainram[0x1e] << 16) | m_mainram[0x1d]); - } - return m_mainram[0x2829]; -} - - -uint16_t pcp8718_state::ramcall_287a_logger_r() -{ - // this transmits to a device, then reads back the result, needed for menu navigation?! - // TODO: data should transmit etc. over bits in the I/O ports, this is HLE, although - // most of this code will end up in a simulation handler for whatever this device is - - if (!machine().side_effects_disabled()) - { - if (m_maincpu->pc() == 0x287a) - { - // 1d = command, 1e = param? - int command = m_mainram[0x1d] & 0xff; - int param = m_mainram[0x1e] & 0xff; - - if ((command) == 0x00) // request result low - { - m_maincpu->set_state_int(UNSP_R1, m_stored_gamenum & 0xff); - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x (request result low)\n", command); - } - else if ((command) == 0x01) // request result high - { - m_maincpu->set_state_int(UNSP_R1, (m_stored_gamenum>>8) & 0xff); - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x (request result high)\n", command); - } - else if ((command) == 0x02) - { - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x %02x (set data low)\n", command, param); - m_stored_gamenum = (m_stored_gamenum & 0xff00) | (m_mainram[0x1e] & 0x00ff); - } - else if ((command) == 0x03) - { - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x %02x (set data high)\n", command, param); - m_stored_gamenum = (m_stored_gamenum & 0x00ff) | ((m_mainram[0x1e] & 0x00ff) << 8); - } - else if ((command) == 0x04) - { - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x %02x (set add value)\n", command, param); - // used with down - if (param == 0x03) - m_addval = 4; - else if (param == 0x00) - m_addval = 0; - - // used if you try to scroll up or left past 0 and the value becomes too large (a negative number) - // actually writes 0x314 split into 2 commands, so the 2nd write to 0x04 with param then instead 0b/16 sequence of writes instead of 26/0c adds to the high byte? - if (param == 0x14) - m_addval = 0x314; - - } - else if ((command) == 0x05) - { - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x %02x (set subtract value)\n", command, param); - - // used if you try to scroll down past the and the value becomes too large - // actually writes 0x313 split into 2 commands, so the 2nd write to 0x05 with param then instead 0b/16 sequence of writes instead of 26/0c subtracts from the high byte? - if (param == 0x13) - m_addval = -0x314; // why 314, it writes 313 - - } - else if ((command) == 0x10) - { - // this is followed by 0x1b, written if you try to move right off last entry - m_stored_gamenum = 0x00; - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x (reset value)\n", command); - } - else if (command == 0x26) - { - // used in direction handlers after writing the first command - m_stored_gamenum += m_addval; - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x\n", command); - } - else if (command == 0x30) - { - // used with right - m_addval = 1; - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x\n", command); - // 26/0c called after this, then another fixed command value, then 0b/16 - // unlike commands 04/05 there's no parameter byte written here, must be derived from the command? - } - else if (command == 0x37) - { - // used with left - m_addval = -1; - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x\n", command); - // 26/0c called after this, then another fixed command value, then 0b/16 - // unlike commands 04/05 there's no parameter byte written here, must be derived from the command? - } - else if (command == 0x39) - { - // used with up - m_addval = -4; - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x\n", command); - // 26/0c called after this, then another fixed command value, then 0b/16 - // unlike commands 04/05 there's no parameter byte written here, must be derived from the command? - } - else - { - LOGMASKED(LOG_GPL_UNKNOWN_SELECT_SIM,"call to 0x287a in RAM (transmit / receive) %02x\n", command); - } - - // hack retf - return 0x9a90; - } - } - return m_mainram[0x287a]; + map(0x200000, 0x3fffff).ram(); // almost certainly RAM where the SPI ROM gets copied } -uint16_t pcp8718_state::ramcall_28f7_logger_r() -{ - if (!machine().side_effects_disabled()) - { - // no restore logic? - LOGMASKED(LOG_GPL_UNKNOWN,"call to 0x28f7 in RAM (load+GO TO function from SPI address %08x)\n", (m_mainram[0x1e] << 16) | m_mainram[0x1d]); - } - return m_mainram[0x28f7]; -} -uint16_t pcp8718_state::ramcall_2079_logger_r() +void generalplus_gpl_unknown_state::machine_start() { - if (!machine().side_effects_disabled()) - { - LOGMASKED(LOG_GPL_UNKNOWN,"call to 0x2079 in RAM (maybe drawing related?)\n"); // called in the 'dummy' loop that doesn't actually draw? and other places? as well as after the actual draw command below in the real loop - } - return m_mainram[0x2079]; } -uint16_t pcp8718_state::ramcall_2434_logger_r() +void generalplus_gpl_unknown_state::machine_reset() { - if (!machine().side_effects_disabled()) + address_space& mem = m_maincpu->space(AS_PROGRAM); + for (int j = 0; j < 0x200000/2; j++) { - LOGMASKED(LOG_GPL_UNKNOWN,"call to 0x2434 in RAM (drawing related?)\n"); // [1d] as the tile / sprite number, [1e] as xpos, [1f] as ypos, [20] as 0. [21] as ff in some title drawing calls + uint16_t data = (m_spirom[(j*2)+1] << 8) | (m_spirom[(j*2)+0]); + mem.write_word(0x200000+j, data); } - return m_mainram[0x2434]; -} - -void pcp8718_state::machine_start() -{ -} - -void pcp8718_state::machine_reset() -{ - m_maincpu->space(AS_PROGRAM).install_read_handler(0xf000, 0xffff, read16sm_delegate(*this, FUNC(pcp8718_state::simulate_f000_r))); - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2060, 0x2060, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_2060_logger_r))); - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2079, 0x2079, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_2079_logger_r))); - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2189, 0x2189, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_2189_logger_r))); - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2434, 0x2434, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_2434_logger_r))); - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x2829, 0x2829, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_2829_logger_r))); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x287a, 0x287a, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_287a_logger_r))); - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x28f7, 0x28f7, read16smo_delegate(*this, FUNC(pcp8718_state::ramcall_28f7_logger_r))); - - m_spistate = SPI_STATE_READY; - m_spiaddress = 0; - - for (int i = 0; i < 320*240*2; i++) - m_displaybuffer[i] = 0x00; - - m_lcdaddr = 0; - - m_lcdstate = LCD_STATE_READY; - m_lastlcdcommand = 0; - - m_78a1 = 0; + m_maincpu->set_state_int(UNSP_PC, 0x1000); // this is not the boot code, everything in the SPI ROM seems like relatively small functions (that never touch internal registers) only the very last one in SPI ROM has no callers from in the SPI ROM code + m_maincpu->set_state_int(UNSP_SR, 0x0020); } -WRITE_LINE_MEMBER(pcp8718_state::screen_vblank) +void generalplus_gpl_unknown_state::generalplus_gpl_unknown(machine_config &config) { - if (state) - { - // probably a timer - m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); - m_78a1 |= 0x8000; - } - else - { - m_maincpu->set_input_line(UNSP_IRQ4_LINE, CLEAR_LINE); - } -} -void pcp8718_state::pcp8718(machine_config &config) -{ - - UNSP_20(config, m_maincpu, 96000000); // unknown CPU, unsp20 based, 96Mhz is listed as the maximum for most unSP2.0 chips, and appears correct here - m_maincpu->set_addrmap(AS_PROGRAM, &pcp8718_state::map); + UNSP_20(config, m_maincpu, 96000000); // unknown CPU, no unSP2.0 opcodes? + m_maincpu->set_addrmap(AS_PROGRAM, &generalplus_gpl_unknown_state::map); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(10)); m_screen->set_size(64*8, 32*8); m_screen->set_visarea(0*8, 320-1, 0*8, 240-1); - m_screen->set_screen_update(FUNC(pcp8718_state::screen_update)); - //m_screen->set_palette(m_palette); - m_screen->screen_vblank().set(FUNC(pcp8718_state::screen_vblank)); + m_screen->set_screen_update(FUNC(generalplus_gpl_unknown_state::screen_update)); + //m_screen->screen_vblank().set(FUNC(generalplus_gpl_unknown_state::screen_vblank)); PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x8000); } -// pcp8718 and pcp8728 both contain user data (player name?) and will need to be factory defaulted once they work -// the ROM code is slightly different between them - -ROM_START( pcp8718 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) - - ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) - //ROM_LOAD16_WORD_SWAP( "8718_en25f32.bin", 0x000000, 0x400000, CRC(cc138db4) SHA1(379af3d94ae840f52c06416d6cf32e25923af5ae) ) // bad dump, some blocks are corrupt - ROM_LOAD( "eyecare_25q32av1g_ef4016.bin", 0x000000, 0x400000, CRC(58415e10) SHA1(b1adcc03f2ad8d741544204671677740e904ce1a) ) -ROM_END - -ROM_START( pcp8728 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) +ROM_START( mapacman ) + //ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + //ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) - ROM_LOAD( "pcp 8728 788 in 1.bin", 0x000000, 0x400000, CRC(60115f21) SHA1(e15c39f11e442a76fae3823b6d510178f6166926) ) + ROM_LOAD( "fm25q16a.bin", 0x000000, 0x200000, CRC(aeb472ac) SHA1(500c24b725f6d3308ef8cbdf4259f5be556c7c92) ) ROM_END -ROM_START( unkunsp ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown +ROM_START( taspinv ) + //ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + //ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) - ROM_LOAD( "fm25q16a.bin", 0x000000, 0x200000, CRC(aeb472ac) SHA1(500c24b725f6d3308ef8cbdf4259f5be556c7c92) ) + ROM_LOAD( "tinyarcade_spaceinvaders.bin", 0x000000, 0x200000, CRC(11ac4c77) SHA1(398d5eff83a4e94487ed810819085a0e44582908) ) ROM_END -void pcp8718_state::spi_init() -{ -} - +// first 0x2000 bytes in ROM are blank, ROM data maps fully in RAM at 200000, but there are calls to lower regions +// is it possible the SunPlus here is only handling sound / graphics, not gameplay? -CONS( 200?, pcp8718, 0, 0, pcp8718, pcp8718, pcp8718_state, spi_init, "PCP", "PCP 8718 - HD 360 Degrees Rocker Palm Eyecare Console - 788 in 1", MACHINE_IS_SKELETON ) -CONS( 200?, pcp8728, 0, 0, pcp8718, pcp8718, pcp8718_state, spi_init, "PCP", "PCP 8728 - 788 in 1", MACHINE_IS_SKELETON ) // what name was this sold under? +CONS( 2017, mapacman, 0, 0, generalplus_gpl_unknown, generalplus_gpl_unknown, generalplus_gpl_unknown_state, empty_init, "Super Impulse", "Pac-Man (Micro Arcade)", MACHINE_IS_SKELETON ) -// maybe different hardware, first 0x2000 bytes in ROM is blank, so bootstrap pointers aren't there at least -CONS( 200?, unkunsp, 0, 0, pcp8718, pcp8718, pcp8718_state, empty_init, "<unknown>", "unknown unSP-based handheld", MACHINE_IS_SKELETON ) +// multiple different units appear to share the same ROM with a jumper to select game, it should be verified in each case that the external ROM was not changed. +CONS( 2017, taspinv, 0, 0, generalplus_gpl_unknown, generalplus_gpl_unknown, generalplus_gpl_unknown_state, empty_init, "Super Impulse", "Space Invaders (Tiny Arcade)", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/geniusiq.cpp b/src/mame/drivers/geniusiq.cpp index 9350d3c4989..b46c3df2457 100644 --- a/src/mame/drivers/geniusiq.cpp +++ b/src/mame/drivers/geniusiq.cpp @@ -275,7 +275,7 @@ uint32_t geniusiq_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for(int b=0; b<4; b++) { - bitmap.pix16(y, x*2 + b) = (data>>12) & 0x0f; + bitmap.pix(y, x*2 + b) = (data>>12) & 0x0f; data <<= 4; } } @@ -292,7 +292,7 @@ uint32_t geniusiq_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // I assume color 0 is transparent if(pen != 0 && screen.visible_area().contains(m_mouse_gfx_posx + x*4 + b, m_mouse_gfx_posy + y)) - bitmap.pix16(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; + bitmap.pix(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; data <<= 2; } } diff --git a/src/mame/drivers/gigatron.cpp b/src/mame/drivers/gigatron.cpp index 3261208786b..a6c86d2df37 100644 --- a/src/mame/drivers/gigatron.cpp +++ b/src/mame/drivers/gigatron.cpp @@ -103,7 +103,7 @@ void gigatron_state::video_start() void gigatron_state::video_reset() { - uint32_t *dest = &m_bitmap_render->pix32(0, 0); + uint32_t *dest = &m_bitmap_render->pix(0, 0); for(uint32_t i = 0; i < 640*480; i++) *dest++ = 0; } @@ -138,7 +138,7 @@ void gigatron_state::port_out(uint8_t data) uint8_t r = (out << 6) & 0xC0; uint8_t g = (out << 4) & 0xC0; uint8_t b = (out << 2) & 0xC0; - uint32_t *dest = &m_bitmap_render->pix32(m_row, m_col); + uint32_t *dest = &m_bitmap_render->pix(m_row, m_col); for(uint8_t i = 0; i < 4; i++) *dest++ = b|(g<<8)|(r<<16); } @@ -255,7 +255,7 @@ void gigatron_state::gigatron(machine_config &config) ROM_START( gigatron ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_SYSTEM_BIOS(0, "v5a", "Gigatron ROM v5a") - ROMX_LOAD( "gigrom5a.rom", 0x0000, 0x20000, CRC(DCC071A6) SHA1(F82059BA0227FF48E4C687B90C8445DA30213EE2),ROM_BIOS(0)) + ROMX_LOAD( "gigrom5a.rom", 0x0000, 0x20000, CRC(dcc071a6) SHA1(f82059ba0227ff48e4c687b90c8445da30213ee2),ROM_BIOS(0)) ROM_SYSTEM_BIOS(1, "v4", "Gigatron ROM v4") ROMX_LOAD( "gigrom4.rom", 0x0000, 0x20000, CRC(78995109) SHA1(2395fc48e64099836111f5aeca39ddbf4650ea4e),ROM_BIOS(1)) ROM_SYSTEM_BIOS(2, "v3", "Gigatron ROM v3") diff --git a/src/mame/drivers/ginganin.cpp b/src/mame/drivers/ginganin.cpp index 5b6263f22de..caa0b4c5027 100644 --- a/src/mame/drivers/ginganin.cpp +++ b/src/mame/drivers/ginganin.cpp @@ -82,7 +82,7 @@ f5d6 print 7 digit BCD number: d0.l to (a1)+ color $3000 void ginganin_state::main_map(address_map &map) { - // PC=0x408 ROM area 10000-13fff is written at POST with: 0000 0000 0000 0001, + // PC=0x408 ROM area 10000-13fff is written at POST with: 0000 0000 0000 0001, // looks a debugging left-over for GFX patching (causes state garbage if hooked as RAM write mirror) map(0x000000, 0x01ffff).rom().nopw(); map(0x020000, 0x023fff).ram(); @@ -360,10 +360,10 @@ void ginganin_state::init_ginganin() { // pending full removal of this patch ... /* main cpu patches */ -// u16 *rom = (u16 *)memregion("maincpu")->base(); +// u16 *rom = (u16 *)memregion("maincpu")->base(); /* avoid writes to rom getting to the log */ -// rom[0x408 / 2] = 0x6000; -// rom[0x40a / 2] = 0x001c; +// rom[0x408 / 2] = 0x6000; +// rom[0x40a / 2] = 0x001c; } diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 4dfd39519ce..4b670245d25 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -162,22 +162,18 @@ void igt_gameking_state::video_start() uint32_t igt_gameking_state::screen_update_igt_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - bitmap.fill(m_palette->black_pen(), cliprect); - for(y = 0; y < 480; y++) + for(int y = 0; y < 480; y++) { - for(x = 0; x < 640; x+=4) + for(int x = 0; x < 640; x+=4) { for(int xi=0;xi<4;xi++) { - uint32_t color; - - color = (m_vram[(x+y*1024)/4] >> (xi*8)) & 0xff; + uint32_t const color = (m_vram[(x+y*1024)/4] >> (xi*8)) & 0xff; if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(color); + bitmap.pix(y, x+xi) = m_palette->pen(color); } } diff --git a/src/mame/drivers/gmaster.cpp b/src/mame/drivers/gmaster.cpp index 76e5f116817..cd798155887 100644 --- a/src/mame/drivers/gmaster.cpp +++ b/src/mame/drivers/gmaster.cpp @@ -280,30 +280,20 @@ void gmaster_state::gmaster_palette(palette_device &palette) const uint32_t gmaster_state::screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - for (y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) + for (int y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) { - for (x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) + for (int x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) { - uint8_t d = m_video.pixels[y][x]; - uint16_t *line; - - line = &bitmap.pix16((y * 8), x); - line[0] = BIT(d, 0); - line = &bitmap.pix16((y * 8 + 1), x); - line[0] = BIT(d, 1); - line = &bitmap.pix16((y * 8 + 2), x); - line[0] = BIT(d, 2); - line = &bitmap.pix16((y * 8 + 3), x); - line[0] = BIT(d, 3); - line = &bitmap.pix16((y * 8 + 4), x); - line[0] = BIT(d, 4); - line = &bitmap.pix16((y * 8 + 5), x); - line[0] = BIT(d, 5); - line = &bitmap.pix16((y * 8 + 6), x); - line[0] = BIT(d, 6); - line = &bitmap.pix16((y * 8 + 7), x); - line[0] = BIT(d, 7); + uint8_t const d = m_video.pixels[y][x]; + + bitmap.pix((y * 8 + 0), x) = BIT(d, 0); + bitmap.pix((y * 8 + 1), x) = BIT(d, 1); + bitmap.pix((y * 8 + 2), x) = BIT(d, 2); + bitmap.pix((y * 8 + 3), x) = BIT(d, 3); + bitmap.pix((y * 8 + 4), x) = BIT(d, 4); + bitmap.pix((y * 8 + 5), x) = BIT(d, 5); + bitmap.pix((y * 8 + 6), x) = BIT(d, 6); + bitmap.pix((y * 8 + 7), x) = BIT(d, 7); } } return 0; diff --git a/src/mame/drivers/goldart.cpp b/src/mame/drivers/goldart.cpp index 975211b4e8c..d2b95d88a63 100644 --- a/src/mame/drivers/goldart.cpp +++ b/src/mame/drivers/goldart.cpp @@ -111,9 +111,9 @@ uint32_t goldart_state::screen_update_goldart(screen_device& screen, bitmap_ind1 { for (int x = 0; x < 192; x++) { - uint16_t* dstptr_bitmap = &bitmap.pix16(y); - uint8_t data = m_ram[count]; - uint8_t data2 = m_ram2[count]; + uint16_t *const dstptr_bitmap = &bitmap.pix(y); + uint8_t const data = m_ram[count]; + uint8_t const data2 = m_ram2[count]; count++; diff --git a/src/mame/drivers/goldngam.cpp b/src/mame/drivers/goldngam.cpp index c701d74f91e..27c0b483c20 100644 --- a/src/mame/drivers/goldngam.cpp +++ b/src/mame/drivers/goldngam.cpp @@ -300,8 +300,8 @@ uint32_t goldngam_state::screen_update_goldngam(screen_device &screen, bitmap_in for(int x = 0; x < 384; x += 2) { uint16_t word = m_videoram[index]; - bitmap.pix16(y, x) = word >> 8; - bitmap.pix16(y, x+1) = word & 0xff; + bitmap.pix(y, x) = word >> 8; + bitmap.pix(y, x+1) = word & 0xff; ++index; } } diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp index 38fc94e5cb2..b4bcae82f41 100644 --- a/src/mame/drivers/goupil.cpp +++ b/src/mame/drivers/goupil.cpp @@ -489,7 +489,7 @@ WRITE_LINE_MEMBER( goupil_g1_state::via_video_ca2_w ) MC6845_UPDATE_ROW(goupil_g2_state::crtc_update_row) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (uint8_t x = 0; x < x_count; ++x) { uint16_t const offset = ( 0x400 + ( ma + x ) ) & 0x7FF; diff --git a/src/mame/drivers/gp2x.cpp b/src/mame/drivers/gp2x.cpp index 2ff5addc312..7c2af984b7c 100644 --- a/src/mame/drivers/gp2x.cpp +++ b/src/mame/drivers/gp2x.cpp @@ -159,8 +159,7 @@ uint32_t gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bit // only support RGB still image layer for now if (m_vidregs[0x80/2] & 4) { - int x, y; - uint16_t *vram = (uint16_t *)&m_ram[0x2100000/4]; + uint16_t const *const vram = (uint16_t *)&m_ram[0x2100000/4]; /* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", (m_vidregs[(0xda/2)]>>9)&3, @@ -170,13 +169,13 @@ uint32_t gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bit m_vidregs[(0xe8/2)]);*/ - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 320; x++) + for (int x = 0; x < 320; x++) { - uint16_t pixel = vram[(320*y)+x]; + uint16_t const pixel = vram[(320*y)+x]; *scanline++ = rgb_t(0xff, (pixel>>11)<<3, ((pixel>>5)&0x3f)<<2, (pixel&0x1f)<<3); } diff --git a/src/mame/drivers/gp32.cpp b/src/mame/drivers/gp32.cpp index 34a80fedcda..189babc7069 100644 --- a/src/mame/drivers/gp32.cpp +++ b/src/mame/drivers/gp32.cpp @@ -143,21 +143,20 @@ uint32_t gp32_state::s3c240x_lcd_dma_read( ) void gp32_state::s3c240x_lcd_render_01( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 32; j++) + for (int j = 0; j < 32; j++) { *scanline++ = m_palette->pen_color((data >> 31) & 0x01); - data = data << 1; + data <<= 1; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 4)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -166,21 +165,20 @@ void gp32_state::s3c240x_lcd_render_01( ) void gp32_state::s3c240x_lcd_render_02( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 16; j++) + for (int j = 0; j < 16; j++) { *scanline++ = m_palette->pen_color((data >> 30) & 0x03); - data = data << 2; + data <<= 2; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 3)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -189,21 +187,20 @@ void gp32_state::s3c240x_lcd_render_02( ) void gp32_state::s3c240x_lcd_render_04( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read( ); - for (j = 0; j < 8; j++) + for (int j = 0; j < 8; j++) { *scanline++ = m_palette->pen_color((data >> 28) & 0x0F); - data = data << 4; + data <<= 4; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 2)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -212,21 +209,20 @@ void gp32_state::s3c240x_lcd_render_04( ) void gp32_state::s3c240x_lcd_render_08( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) { *scanline++ = m_palette->pen_color((data >> 24) & 0xFF); - data = data << 8; + data <<= 8; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 1)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -235,21 +231,20 @@ void gp32_state::s3c240x_lcd_render_08( ) void gp32_state::s3c240x_lcd_render_16( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 2; j++) + for (int j = 0; j < 2; j++) { *scanline++ = s3c240x_get_color_5551( (data >> 16) & 0xFFFF); - data = data << 16; + data <<= 16; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 0)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } diff --git a/src/mame/drivers/gpworld.cpp b/src/mame/drivers/gpworld.cpp index 0e717fe6fea..d9d008b31b7 100644 --- a/src/mame/drivers/gpworld.cpp +++ b/src/mame/drivers/gpworld.cpp @@ -138,7 +138,7 @@ void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,in } if (cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); } void gpworld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/grfd2301.cpp b/src/mame/drivers/grfd2301.cpp index 6767c3d543d..a17b1616455 100644 --- a/src/mame/drivers/grfd2301.cpp +++ b/src/mame/drivers/grfd2301.cpp @@ -82,21 +82,20 @@ void grfd2301_state::machine_reset() uint32_t grfd2301_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_p_videoram[x+ma]; + uint8_t chr = m_p_videoram[x+ma]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp index 63d41b12390..1deb3174053 100644 --- a/src/mame/drivers/gridcomp.cpp +++ b/src/mame/drivers/gridcomp.cpp @@ -246,18 +246,15 @@ uint8_t gridcomp_state::grid_dma_r(offs_t offset) uint32_t gridcomp_state::screen_update_generic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int px) { - int x, y, offset; - uint16_t gfx, *p; - - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - offset = y * (px / 16); + int const offset = y * (px / 16); - for (x = offset; x < offset + px / 16; x++) + for (int x = offset; x < offset + px / 16; x++) { - gfx = m_videoram[x]; + uint16_t const gfx = m_videoram[x]; for (int i = 15; i >= 0; i--) { diff --git a/src/mame/drivers/gstream.cpp b/src/mame/drivers/gstream.cpp index c5d88370663..95f27a7c4d4 100644 --- a/src/mame/drivers/gstream.cpp +++ b/src/mame/drivers/gstream.cpp @@ -587,10 +587,8 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & do { g_profiler.start(PROFILER_DRAWGFX); do { - const uint8_t *srcdata, *srcdata2; int32_t destendx, destendy; int32_t srcx, srcy; - int32_t curx, cury; int32_t dy; assert(dest.valid()); @@ -649,8 +647,8 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & } /* fetch the source data */ - srcdata = gfx->get_data(code); - srcdata2 = gfx2->get_data(code); + const uint8_t *srcdata = gfx->get_data(code); + const uint8_t *srcdata2 = gfx2->get_data(code); /* compute how many blocks of 4 pixels we have */ uint32_t leftovers = (destendx + 1 - destx); @@ -663,16 +661,16 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & if (!flipx) { /* iterate over pixels in Y */ - for (cury = desty; cury <= destendy; cury++) + for (int32_t cury = desty; cury <= destendy; cury++) { - uint32_t *destptr = &dest.pix32(cury, destx); + uint32_t *destptr = &dest.pix(cury, destx); const uint8_t *srcptr = srcdata; const uint8_t *srcptr2 = srcdata2; srcdata += dy; srcdata2 += dy; /* iterate over leftover pixels */ - for (curx = 0; curx < leftovers; curx++) + for (int32_t curx = 0; curx < leftovers; curx++) { uint32_t srcdata = (srcptr[0]); uint32_t srcdata2 = (srcptr2[0]); @@ -692,9 +690,9 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & else { /* iterate over pixels in Y */ - for (cury = desty; cury <= destendy; cury++) + for (int32_t cury = desty; cury <= destendy; cury++) { - uint32_t *destptr = &dest.pix32(cury, destx); + uint32_t *destptr = &dest.pix(cury, destx); const uint8_t *srcptr = srcdata; const uint8_t *srcptr2 = srcdata2; @@ -702,7 +700,7 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & srcdata2 += dy; /* iterate over leftover pixels */ - for (curx = 0; curx < leftovers; curx++) + for (int32_t curx = 0; curx < leftovers; curx++) { uint32_t srcdata = (srcptr[0]); uint32_t srcdata2 = (srcptr2[0]); diff --git a/src/mame/drivers/gsword.cpp b/src/mame/drivers/gsword.cpp index 47398823e39..472c6a80550 100644 --- a/src/mame/drivers/gsword.cpp +++ b/src/mame/drivers/gsword.cpp @@ -153,14 +153,14 @@ So far, the AA-016 and AA-017 MCUs have been dumped successfully. At least two Great Swordsman boards have been seen with a UVEPROM-based D8741A-8 MCU for AA-013 at 9.5A. This suggests the developers made some -last-minute change to the code that only the main CPU. +last-minute change to the code that only affects the main CPU. It appears that during development, the developers worked with three copies of what became the AA-016 MCU. Protection code was added to the I/O MCU program, and this became AA-017. At this point they intended to use two copies of AA-016 for communications, and one AA-017 for I/O. It -turned out that some last-minute change was required for the master CPU, -but it was too late to order new mask ROM MUCs. This resulted in the +turned out that some last-minute change was required for the main CPU, +but it was too late to order new mask ROM MCUs. This resulted in the use of UVEPROM parts for AA-013. There are problems with sound. Many effects aren't playing or are cut @@ -255,9 +255,9 @@ contained within a single page. The initialisation/self test and mode selection, the subroutine for receiving configuration, and an unused subroutine for sending a negated program byte to the host are in page 0. The subroutines that implement coin handling are in page 1. There are -three input handling and protection programs of increasing of increasing -complexity in page 2 and page 3. The host selects the input handling -program to use with the high nybble of the first command. +three input handling and protection programs of increasing complexity in +page 2 and page 3. The host selects the input handling program to use +with the high nybble of the first command. The subroutine for receiving configuration from the host is identical to the one in the AA-016 MCU besides being shifted to a different address. @@ -310,11 +310,11 @@ command: The MCU keeps an internal credit counter ($2D). Each time the MCU receives a polling command, if the credit counter is non-zero it will be decremented and bit 7 of the response will be set; if the credit counter -is zero, but 7 of the response will be clear. +is zero, bit 7 of the response will be clear. After terminating the setup phase, any byte written to the data port will cause the MCU to check the coin inputs, update the credit counter -if necessary, and return the desired data. A byte written to the +if necessary, and return the requested data. A byte written to the control port after the setup phase terminates causes the MCU to read a byte of program memory from page 2 using the received byte as the offset, twos-complement it, return it, and then immediately re-execute diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp index 49bf5252eec..74d251c5d58 100644 --- a/src/mame/drivers/gticlub.cpp +++ b/src/mame/drivers/gticlub.cpp @@ -909,7 +909,7 @@ uint32_t gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb3 for (x=0; x < 512; x++) { uint8_t pixel = rom[index + (y*512) + x]; - bitmap.pix32(y, x) = K001006_palette[tp][(pal * 256) + pixel]; + bitmap.pix(y, x) = K001006_palette[tp][(pal * 256) + pixel]; } } diff --git a/src/mame/drivers/gts1.cpp b/src/mame/drivers/gts1.cpp index 652f4dfad08..53e5496d3c1 100644 --- a/src/mame/drivers/gts1.cpp +++ b/src/mame/drivers/gts1.cpp @@ -905,6 +905,15 @@ ROM_END /*------------------------------------------------------------------- / Sahara Love (1984) /-------------------------------------------------------------------*/ +ROM_START(sahalove) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("u5_cf.bin", 0x0000, 0x0800, CRC(e0d4b405) SHA1(17aadd79c0dcbb336aadd5d203bc6ca866492345)) + ROM_LOAD("u4_ce.bin", 0x0800, 0x0800, CRC(4cd312dd) SHA1(31245daa9972ef8652caee69986585bb8239e86e)) + ROM_LOAD("412.cpu", 0x2000, 0x0400, CRC(84a86b83) SHA1(f331f2ffd7d1b279b4ffbb939aa8649e723f5fac)) + + ROM_REGION(0x2000, "audiocpu", 0) // extra Z80 for sound. TODO: emulate + ROM_LOAD("sahalove.bin", 0x0000, 0x2000, CRC(3512840a) SHA1(eb36bb78bbf2f8610bc1d71a6651b937db3a5c69)) +ROM_END /*------------------------------------------------------------------- / Sinbad (05/1978) #412 @@ -1023,4 +1032,5 @@ GAME(1980, roldisco, gts1s, gts1, gts1, gts1_state, empty_init, ROT0, "Got GAME(1980, astannie, gts1s, gts1, gts1, gts1_state, empty_init, ROT0, "Gottlieb", "Asteroid Annie and the Aliens", MACHINE_IS_SKELETON_MECHANICAL) // homebrew +GAME(1984, sahalove, sinbad, gts1, gts1, gts1_state, empty_init, ROT0, "Christian Tabart", "Sahara Love (France)", MACHINE_IS_SKELETON_MECHANICAL) // based on sinbad, 150 units produced, not sure it's 'homebrew' GAME(1986, hexagone, gts1s, gts1, gts1, gts1_state, empty_init, ROT0, "Christian Tabart", "L'Hexagone (France)", MACHINE_IS_SKELETON_MECHANICAL) diff --git a/src/mame/drivers/gts3a.cpp b/src/mame/drivers/gts3a.cpp index 2e2aeb056bd..86a613df8b3 100644 --- a/src/mame/drivers/gts3a.cpp +++ b/src/mame/drivers/gts3a.cpp @@ -321,14 +321,13 @@ void gts3a_state::palette_init(palette_device &palette) MC6845_UPDATE_ROW( gts3a_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t gfx=0; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0xfff;mem++; + uint16_t mem = (ma + x) & 0xfff;mem++; gfx = 4;//m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character */ diff --git a/src/mame/drivers/gts80a.cpp b/src/mame/drivers/gts80a.cpp index 6ed611719ac..84aa0c5ca58 100644 --- a/src/mame/drivers/gts80a.cpp +++ b/src/mame/drivers/gts80a.cpp @@ -430,10 +430,10 @@ uint32_t caveman_state::screen_update_caveman(screen_device &screen, bitmap_ind1 { uint8_t pix = m_vram[count]; - bitmap.pix16(y, x+0) = (pix >> 6)&0x3; - bitmap.pix16(y, x+1) = (pix >> 4)&0x3; - bitmap.pix16(y, x+2) = (pix >> 2)&0x3; - bitmap.pix16(y, x+3) = (pix >> 0)&0x3; + bitmap.pix(y, x+0) = (pix >> 6)&0x3; + bitmap.pix(y, x+1) = (pix >> 4)&0x3; + bitmap.pix(y, x+2) = (pix >> 2)&0x3; + bitmap.pix(y, x+3) = (pix >> 0)&0x3; count++; } diff --git a/src/mame/drivers/guab.cpp b/src/mame/drivers/guab.cpp index 193675652cc..d308bfb5e02 100644 --- a/src/mame/drivers/guab.cpp +++ b/src/mame/drivers/guab.cpp @@ -275,12 +275,12 @@ uint32_t guab_state::screen_update_guab(screen_device &screen, bitmap_ind16 &bit for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint8_t *src = &m_tms34061->m_display.vram[256 * y]; - uint16_t *dest = &bitmap.pix16(y); + uint8_t const *const src = &m_tms34061->m_display.vram[256 * y]; + uint16_t *dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - uint8_t pen = src[x >> 1]; + uint8_t const pen = src[x >> 1]; /* Draw two 4-bit pixels */ *dest++ = m_palette->pen(pen >> 4); diff --git a/src/mame/drivers/gunpey.cpp b/src/mame/drivers/gunpey.cpp index 9b79660e2aa..db35f1242dc 100644 --- a/src/mame/drivers/gunpey.cpp +++ b/src/mame/drivers/gunpey.cpp @@ -295,9 +295,6 @@ void gunpey_state::video_start() uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count,uint8_t scene_gradient) { - int x,y; - int bpp_sel; - int color; const int ZOOM_SHIFT = 15; // there doesn't seem to be a specific bit to mark compressed sprites (we currently have a hack to look at the first byte of the data) // do they get decompressed at blit time instead? of are there other registers we need to look at @@ -326,12 +323,12 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in if(!(m_wram[count+0] & 1)) { - x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); - y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); + int x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); + int y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); uint32_t zoomheight = (m_wram[count+5] >> 8); uint32_t zoomwidth = (m_wram[count+5] & 0xff); - bpp_sel = (m_wram[count+0] & 0x18); - color = (m_wram[count+0] >> 8); + int bpp_sel = (m_wram[count+0] & 0x18); + int color = (m_wram[count+0] >> 8); x-=0x160; y-=0x188; @@ -379,8 +376,6 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in int xi2 = xsourceoff>>ZOOM_SHIFT; uint8_t data = m_vram[((((ysource + yi2) & 0x7ff) * 0x800) + ((xsource + (xi2/2)) & 0x7ff))]; uint8_t pix; - uint32_t col_offs; - uint16_t color_data; if (xi2 & 1) { @@ -391,19 +386,17 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in pix = (data & 0x0f); } - col_offs = ((pix + color*0x10) & 0xff) << 1; + uint32_t col_offs = ((pix + color*0x10) & 0xff) << 1; col_offs+= ((pix + color*0x10) >> 8)*0x800; - color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); + uint16_t color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); if(!(color_data & 0x8000)) { if(scene_gradient & 0x40) { - int r,g,b; - - r = (color_data & 0x7c00) >> 10; - g = (color_data & 0x03e0) >> 5; - b = (color_data & 0x001f) >> 0; + int r = (color_data & 0x7c00) >> 10; + int g = (color_data & 0x03e0) >> 5; + int b = (color_data & 0x001f) >> 0; r-= (scene_gradient & 0x1f); g-= (scene_gradient & 0x1f); b-= (scene_gradient & 0x1f); @@ -418,11 +411,11 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in { if (alpha==0x00) // a value of 0x00 is solid { - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } else { - uint16_t basecolor = bitmap.pix16(y+yi, x+xi); + uint16_t basecolor = bitmap.pix(y+yi, x+xi); int base_r = ((basecolor >> 10)&0x1f)*alpha; int base_g = ((basecolor >> 5)&0x1f)*alpha; int base_b = ((basecolor >> 0)&0x1f)*alpha; @@ -433,7 +426,7 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in g = (base_g+g)/0x1f; b = (base_b+b)/0x1f; color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } } } @@ -460,24 +453,19 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in int xi2 = xsourceoff>>ZOOM_SHIFT; uint8_t data = m_vram[((((ysource+yi2)&0x7ff)*0x800) + ((xsource+xi2)&0x7ff))]; - uint8_t pix; - uint32_t col_offs; - uint16_t color_data; - pix = (data & 0xff); - col_offs = ((pix + color*0x100) & 0xff) << 1; + uint8_t pix = (data & 0xff); + uint32_t col_offs = ((pix + color*0x100) & 0xff) << 1; col_offs+= ((pix + color*0x100) >> 8)*0x800; - color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); + uint16_t color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); if(!(color_data & 0x8000)) { if(scene_gradient & 0x40) { - int r,g,b; - - r = (color_data & 0x7c00) >> 10; - g = (color_data & 0x03e0) >> 5; - b = (color_data & 0x001f) >> 0; + int r = (color_data & 0x7c00) >> 10; + int g = (color_data & 0x03e0) >> 5; + int b = (color_data & 0x001f) >> 0; r-= (scene_gradient & 0x1f); g-= (scene_gradient & 0x1f); b-= (scene_gradient & 0x1f); @@ -492,11 +480,11 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in { if (alpha==0x00) // a value of 0x00 is solid { - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } else { - uint16_t basecolor = bitmap.pix16(y+yi, x+xi); + uint16_t basecolor = bitmap.pix(y+yi, x+xi); int base_r = ((basecolor >> 10)&0x1f)*alpha; int base_g = ((basecolor >> 5)&0x1f)*alpha; int base_b = ((basecolor >> 0)&0x1f)*alpha; @@ -507,7 +495,7 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in g = (base_g+g)/0x1f; b = (base_b+b)/0x1f; color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } } } diff --git a/src/mame/drivers/h01x.cpp b/src/mame/drivers/h01x.cpp index 15a676a477b..6680a803a77 100644 --- a/src/mame/drivers/h01x.cpp +++ b/src/mame/drivers/h01x.cpp @@ -11,7 +11,7 @@ #include "emu.h" #include "includes/h01x.h" -static const int16_t speaker_levels[] = {-32768, 0, 32767, 0}; +static const double speaker_levels[] = {-1.0, 0.0, 1.0, 0.0}; void h01x_state::h01x(machine_config &config) { diff --git a/src/mame/drivers/h19.cpp b/src/mame/drivers/h19.cpp index e86e4948c1b..fc296c17392 100644 --- a/src/mame/drivers/h19.cpp +++ b/src/mame/drivers/h19.cpp @@ -192,7 +192,7 @@ static INPUT_PORTS_START( h19 ) PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LeftShift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) - PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RightShift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x100, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RightShift") PORT_CODE(KEYCODE_RSHIFT) PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F10) PORT_START("X1") @@ -208,8 +208,8 @@ static INPUT_PORTS_START( h19 ) PORT_BIT(0x200, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused") PORT_START("X2") - PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('.') - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("{") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Unused") @@ -475,8 +475,9 @@ MC6845_UPDATE_ROW( h19_state::crtc_update_row ) { if (!de) return; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) { @@ -491,7 +492,7 @@ MC6845_UPDATE_ROW( h19_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t const gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp index a4423bd304c..18b653d6908 100644 --- a/src/mame/drivers/halleys.cpp +++ b/src/mame/drivers/halleys.cpp @@ -1310,7 +1310,7 @@ void halleys_state::copy_scroll_op(bitmap_ind16 &bitmap, uint16_t *source, int s // draw top split for (int y=0; y != bch; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); memcpy(dest, src+sx, 2*rcw); memcpy(dest + rcw, src, 2*(CLIP_W - rcw)); src += SCREEN_WIDTH; @@ -1320,7 +1320,7 @@ void halleys_state::copy_scroll_op(bitmap_ind16 &bitmap, uint16_t *source, int s // draw bottom split for (int y = bch; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); memcpy(dest, src+sx, 2*rcw); memcpy(dest + rcw, src, 2*(CLIP_W - rcw)); src += SCREEN_WIDTH; @@ -1345,7 +1345,7 @@ void halleys_state::copy_scroll_xp(bitmap_ind16 &bitmap, uint16_t *source, int s // draw top split for (int y=0; y != bch; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); const uint16_t *src = src_base + sx; for(int x=0; x != rcw; x++) { uint16_t pixel = *src++; @@ -1370,7 +1370,7 @@ void halleys_state::copy_scroll_xp(bitmap_ind16 &bitmap, uint16_t *source, int s // draw bottom split for (int y = bch; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); const uint16_t *src = src_base + sx; for(int x=0; x != rcw; x++) { uint16_t pixel = *src++; @@ -1398,7 +1398,7 @@ void halleys_state::copy_fixed_xp(bitmap_ind16 &bitmap, uint16_t *source) { uint16_t *src = source + CLIP_SKIP; for(int y=0; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); for(int x=0; x != CLIP_W; x++) { uint16_t pixel = src[x]; @@ -1414,7 +1414,7 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, uint16_t *source) { uint16_t *src = source + CLIP_SKIP; for(int y=0; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); for(int x=0; x != CLIP_W; x++) { uint16_t pixel = src[x]; @@ -1436,7 +1436,7 @@ void halleys_state::filter_bitmap(bitmap_ind16 &bitmap, int mask) pal_ptr = m_internal_palette.get(); esi = mask | 0xffffff00; - edi = (uint32_t*)&bitmap.pix16(VIS_MINY, VIS_MINX + CLIP_W); + edi = (uint32_t*)&bitmap.pix(VIS_MINY, VIS_MINX + CLIP_W); dst_pitch = bitmap.rowpixels() >> 1; ecx = -(CLIP_W>>1); edx = CLIP_H; diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index 1055ae69d69..ba0ea2f53c3 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -269,11 +269,10 @@ uint32_t hazl1500_state::screen_update_hazl1500(screen_device &screen, bitmap_rg m_last_hpos = 0; m_last_vpos = 0; - uint32_t pixindex = 0; for (int y = 0; y < SCREEN_VTOTAL; y++) { - uint32_t *scanline = &bitmap.pix32(y); - pixindex = y * SCREEN_HTOTAL; + uint32_t *scanline = &bitmap.pix(y); + uint32_t pixindex = y * SCREEN_HTOTAL; for (int x = 0; x < SCREEN_HTOTAL; x++) //*scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 0.5) * 0x010101); *scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 63.0) * 0x010101); diff --git a/src/mame/drivers/hec2hrp.cpp b/src/mame/drivers/hec2hrp.cpp index a8a0fa64f45..8dfb44e1682 100644 --- a/src/mame/drivers/hec2hrp.cpp +++ b/src/mame/drivers/hec2hrp.cpp @@ -201,71 +201,71 @@ void hec2hrp_state::hecdisc2_io(address_map &map) static INPUT_PORTS_START( hec2hrp ) /* keyboard input */ PORT_START("KEY.0") /* [0] - port 3000 @ 0 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* buttons => 2 1 0 / . - , + */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('>') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('<') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('/') PORT_CHAR('@') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('.') PORT_CHAR('&') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR(',') PORT_CHAR('#') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('^') PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* buttons => .. 9 8 7 6 5 4 3 */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('!') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(39) PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* buttons => B A .. ? .. = .. ; */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('?') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('=') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR(';') PORT_START("KEY.4") /* [1] - port 3000 @ 4 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_START("KEY.5") /* [1] - port 3000 @ 5 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('M') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_START("KEY.6") /* [1] - port 3000 @ 6 */ - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_Z) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_START("KEY.7") /* [1] - port 3000 @ 7 JOYSTICK */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) @@ -278,7 +278,7 @@ static INPUT_PORTS_START( hec2hrp ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN") PORT_CODE(KEYCODE_2_PAD) PORT_START("KEY.8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) // crashes the machine PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE") PORT_CODE(KEYCODE_TILDE) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE") PORT_CODE(KEYCODE_PLUS_PAD) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT) @@ -288,6 +288,14 @@ static INPUT_PORTS_START( hec2hrp ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END +static INPUT_PORTS_START( interact ) + PORT_INCLUDE( hec2hrp ) + PORT_MODIFY("KEY.1") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('/') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('.') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR(',') +INPUT_PORTS_END + MACHINE_RESET_MEMBER(hec2hrp_state,interact) { hector_reset(0, 0); @@ -625,7 +633,7 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP(1979, interact, 0, 0, interact, hec2hrp, hec2hrp_state, init_interact, "Interact Electronics", "Interact Family Computer", MACHINE_IMPERFECT_SOUND) +COMP(1979, interact, 0, 0, interact, interact,hec2hrp_state, init_interact, "Interact Electronics", "Interact Family Computer", MACHINE_IMPERFECT_SOUND) COMP(1983, hector1, interact, 0, hector1, hec2hrp, hec2hrp_state, init_interact, "Micronique", "Hector 1", MACHINE_IMPERFECT_SOUND) COMP(1983, hec2hrp, 0, interact, hec2hr, hec2hrp, hec2hrp_state, init_interact, "Micronique", "Hector 2HR+", MACHINE_IMPERFECT_SOUND) COMP(1980, victor, hec2hrp, 0, hec2hr, hec2hrp, hec2hrp_state, init_victor, "Micronique", "Victor", MACHINE_IMPERFECT_SOUND) diff --git a/src/mame/drivers/hektor.cpp b/src/mame/drivers/hektor.cpp index 939896fcc0e..0342dc91160 100644 --- a/src/mame/drivers/hektor.cpp +++ b/src/mame/drivers/hektor.cpp @@ -215,14 +215,14 @@ MC6845_UPDATE_ROW(hektor3_state::crtc_update_row) uint8_t data = m_ram->pointer()[~offset & 0xffff]; if (x == cursor_x) data ^= 0xff; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/mame/drivers/hh_amis2k.cpp b/src/mame/drivers/hh_amis2k.cpp index 67778048e8a..051503c30f6 100644 --- a/src/mame/drivers/hh_amis2k.cpp +++ b/src/mame/drivers/hh_amis2k.cpp @@ -157,6 +157,8 @@ public: protected: virtual void machine_start() override; + + std::vector<double> m_speaker_levels; }; void wildfire_state::machine_start() @@ -255,10 +257,10 @@ void wildfire_state::wildfire(machine_config &config) TIMER(config, "speaker_decay").configure_periodic(FUNC(wildfire_state::speaker_decay_sim), attotime::from_usec(100)); // set volume levels (set_output_gain is too slow for sub-frame intervals) - static s16 speaker_levels[0x8000]; + m_speaker_levels.resize(0x8000); for (int i = 0; i < 0x8000; i++) - speaker_levels[i] = i; - m_speaker->set_levels(0x8000, speaker_levels); + m_speaker_levels[i] = double(i) / 32768.0; + m_speaker->set_levels(0x8000, &m_speaker_levels[0]); } // roms diff --git a/src/mame/drivers/hh_cop400.cpp b/src/mame/drivers/hh_cop400.cpp index 1a9d5ac7144..fd5e02571d6 100644 --- a/src/mame/drivers/hh_cop400.cpp +++ b/src/mame/drivers/hh_cop400.cpp @@ -555,7 +555,6 @@ public: void write_l(u8 data); u8 read_l(); - DECLARE_INPUT_CHANGED_MEMBER(position_changed) { update_display(); } void unkeinv(machine_config &config); }; @@ -563,17 +562,12 @@ public: void unkeinv_state::update_display() { - m_display->matrix(m_l, m_g << 4 | m_d, false); - - // positional led row is on L6,L7 - u16 wand = m_display->read_row(7) << 8 | m_display->read_row(6); - m_display->write_row(8 + m_inputs[1]->read(), wand); - m_display->update(); + m_display->matrix(m_g << 4 | m_d, m_l); } void unkeinv_state::write_g(u8 data) { - // G0-G3: led select part + // G0,G1: led select part // G2,G3: input mux m_g = ~data & 0xf; update_display(); @@ -619,7 +613,7 @@ static INPUT_PORTS_START( unkeinv ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_START("IN.1") - PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL ) PORT_POSITIONS(12) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) PORT_CHANGED_MEMBER(DEVICE_SELF, unkeinv_state, position_changed, 0) + PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL ) PORT_POSITIONS(12) PORT_SENSITIVITY(10) PORT_KEYDELTA(1) PORT_CENTERDELTA(0) INPUT_PORTS_END void unkeinv_state::unkeinv(machine_config &config) @@ -635,7 +629,7 @@ void unkeinv_state::unkeinv(machine_config &config) m_maincpu->write_so().set(m_speaker, FUNC(speaker_sound_device::level_w)); /* video hardware */ - PWM_DISPLAY(config, m_display).set_size(8+12, 8+8); + PWM_DISPLAY(config, m_display).set_size(6, 8); config.set_default_layout(layout_unkeinv); /* sound hardware */ diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp index d9f8bf63ce3..249a3c859c4 100644 --- a/src/mame/drivers/hh_hmcs40.cpp +++ b/src/mame/drivers/hh_hmcs40.cpp @@ -1926,6 +1926,8 @@ public: protected: virtual void machine_start() override; + + std::vector<double> m_speaker_levels; }; void cdkong_state::machine_start() @@ -2027,10 +2029,10 @@ void cdkong_state::cdkong(machine_config &config) TIMER(config, "speaker_decay").configure_periodic(FUNC(cdkong_state::speaker_decay_sim), attotime::from_msec(1)); // set volume levels (set_output_gain is too slow for sub-frame intervals) - static s16 speaker_levels[0x8000]; + m_speaker_levels.resize(0x8000); for (int i = 0; i < 0x8000; i++) - speaker_levels[i] = i; - m_speaker->set_levels(0x8000, speaker_levels); + m_speaker_levels[i] = double(i) / 32768.0; + m_speaker->set_levels(0x8000, &m_speaker_levels[0]); } // roms @@ -3668,7 +3670,7 @@ void mwcbaseb_state::mwcbaseb(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); - static const s16 speaker_levels[] = { 0, 0x3fff, -0x4000, 0, -0x4000, 0, -0x8000, -0x4000 }; + static const double speaker_levels[] = { 0.0, 0.5, -0.5, 0.0, -0.5, 0.0, -1.0, -0.5 }; m_speaker->set_levels(8, speaker_levels); } diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp index 8fb36a746c4..102111824bc 100644 --- a/src/mame/drivers/hh_pic16.cpp +++ b/src/mame/drivers/hh_pic16.cpp @@ -295,7 +295,7 @@ void touchme_state::touchme(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -626,7 +626,7 @@ void maniac_state::maniac(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -1336,7 +1336,7 @@ void rockpin_state::rockpin(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp index 7fc98eb6a76..01951558fa1 100644 --- a/src/mame/drivers/hh_sm510.cpp +++ b/src/mame/drivers/hh_sm510.cpp @@ -520,7 +520,7 @@ void hh_sm510_state::sm511_tiger2bit(machine_config &config, u16 width, u16 heig m_maincpu->write_r().set(FUNC(hh_sm510_state::piezo2bit_r1_w)); // R via 120K resistor, S1 via 39K resistor (eg. tsonic, tsonic2, tbatmana) - static const s16 speaker_levels[] = { 0, 0x7fff/3*1, 0x7fff/3*2, 0x7fff }; + static const double speaker_levels[] = { 0.0, 1.0/3.0, 2.0/3.0, 1.0 }; m_speaker->set_levels(4, speaker_levels); } diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 872d4e19568..3219fa5234b 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -494,7 +494,7 @@ void matchnum_state::matchnum(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -606,7 +606,7 @@ void arrball_state::arrball(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -2852,7 +2852,7 @@ void cnfball_state::cnfball(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -5755,7 +5755,7 @@ void elecdet_state::elecdet(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x3fff, 0x3fff, 0x7fff }; + static const double speaker_levels[4] = { 0.0, 0.5, 0.5, 1.0}; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -7469,7 +7469,7 @@ void bigtrak_state::bigtrak(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; + static const double speaker_levels[8] = { 0.0, 1.0/3.0, 1.0/3.0, 2.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0, 1.0 }; m_speaker->set_levels(8, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -7834,7 +7834,7 @@ void arcmania_state::arcmania(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; + static const double speaker_levels[8] = { 0.0, 1.0/3.0, 1.0/3.0, 2.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0, 1.0 }; m_speaker->set_levels(8, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -8096,7 +8096,7 @@ void merlin_state::merlin(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[8] = { 0, 0x7fff/3, 0x7fff/3, 0x7fff/3*2, 0x7fff/3, 0x7fff/3*2, 0x7fff/3*2, 0x7fff }; + static const double speaker_levels[8] = { 0.0, 1.0/3.0, 1.0/3.0, 2.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0, 1.0 }; m_speaker->set_levels(8, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -8413,7 +8413,7 @@ void stopthief_state::stopthief(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[7] = { 0x7fff/7, 0x7fff/6, 0x7fff/5, 0x7fff/4, 0x7fff/3, 0x7fff/2, 0x7fff/1 }; + static const double speaker_levels[7] = { 1.0/7.0, 1.0/6.0, 1.0/5.0, 1.0/4.0, 1.0/3.0, 1.0/2.0, 1.0 }; m_speaker->set_levels(7, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -8820,9 +8820,8 @@ void lostreas_state::lostreas(machine_config &config) m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); // set volume levels - static s16 speaker_levels[0x10]; - for (int i = 0; i < 0x10; i++) - speaker_levels[i] = 0x7fff / (0x10 - i); + static const double speaker_levels[0x10] = + { 1.0/16.0, 1.0/15.0, 1.0/14.0, 1.0/13.0, 1.0/12.0, 1.0/11.0, 1.0/10.0, 1.0/9.0, 1.0/8.0, 1.0/7.0, 1.0/6.0, 1.0/5.0, 1.0/4.0, 1.0/3.0, 1.0/2.0, 1.0 }; m_speaker->set_levels(16, speaker_levels); } @@ -11519,7 +11518,7 @@ void copycat_state::copycat(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -11609,7 +11608,7 @@ void copycatm2_state::copycatm2(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -11694,7 +11693,7 @@ void ditto_state::ditto(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[4] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index 33c68e23a51..c6c778bb9b3 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -323,7 +323,7 @@ void ufombs_state::ufombs(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -479,7 +479,7 @@ void ssfball_state::ssfball(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -902,7 +902,7 @@ void splasfgt_state::splasfgt(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker); - static const s16 speaker_levels[] = { 0, 0x7fff, -0x8000, 0 }; + static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 }; m_speaker->set_levels(4, speaker_levels); m_speaker->add_route(ALL_OUTPUTS, "mono", 0.25); } diff --git a/src/mame/drivers/hhtiger.cpp b/src/mame/drivers/hhtiger.cpp index e0d486317c3..24256624a91 100644 --- a/src/mame/drivers/hhtiger.cpp +++ b/src/mame/drivers/hhtiger.cpp @@ -184,18 +184,18 @@ GFXDECODE_END UPD7220_DISPLAY_PIXELS_MEMBER(hhtiger_state::display_pixels) { /* 96KB video RAM (32KB green + 32KB red + 32KB blue) */ - uint16_t green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; - uint16_t red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; - uint16_t blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; + uint16_t const green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; + uint16_t const red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; + uint16_t const blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; for (int xi = 0; xi<16; xi++) { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; + int const r = BIT(red, xi) ? 255 : 0; + int const g = BIT(green, xi) ? 255 : 0; + int const b = BIT(blue, xi) ? 255 : 0; if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + bitmap.pix(y, x + xi) = rgb_t(r, g, b); } } @@ -226,7 +226,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER(hhtiger_state::draw_text) pen = 0; if (!m_screen->visible_area().contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/highvdeo.cpp b/src/mame/drivers/highvdeo.cpp index 6fb110ad7d4..16c02ff3922 100644 --- a/src/mame/drivers/highvdeo.cpp +++ b/src/mame/drivers/highvdeo.cpp @@ -216,24 +216,22 @@ void highvdeo_state::machine_start() uint32_t highvdeo_state::screen_update_tourvisn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.min_y;y<=cliprect.max_y;y++) { - count = ((y * (screen.visible_area().max_x+1)) + cliprect.min_x) >> 1; - for(x=(cliprect.min_x>>1);x<=(cliprect.max_x>>1);x++) + int count = ((y * (screen.visible_area().max_x+1)) + cliprect.min_x) >> 1; + for(int x=(cliprect.min_x>>1);x<=(cliprect.max_x>>1);x++) { uint32_t color; color = ((m_blit_ram[count]) & 0x00ff)>>0; if(cliprect.contains((x*2)+0, y)) - bitmap.pix32(y, (x*2)+0) = m_palette->pen(color); + bitmap.pix(y, (x*2)+0) = m_palette->pen(color); color = ((m_blit_ram[count]) & 0xff00)>>8; if(cliprect.contains((x*2)+1, y)) - bitmap.pix32(y, (x*2)+1) = m_palette->pen(color); + bitmap.pix(y, (x*2)+1) = m_palette->pen(color); count++; } @@ -245,16 +243,14 @@ uint32_t highvdeo_state::screen_update_tourvisn(screen_device &screen, bitmap_rg /*Later HW, RGB565 instead of RAM-based pens (+ ramdac).*/ uint32_t highvdeo_state::screen_update_brasil(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - - const pen_t *rgb = m_palette->pens(); // 16 bit RGB + pen_t const *const rgb = m_palette->pens(); // 16 bit RGB - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.min_y;y<=cliprect.max_y;y++) { - count = (y * 400) + cliprect.min_x; - for(x=cliprect.min_x;x<=cliprect.max_x;x++) + int count = (y * 400) + cliprect.min_x; + for(int x=cliprect.min_x;x<=cliprect.max_x;x++) { - bitmap.pix32(y, x) = rgb[m_blit_ram[count++]]; + bitmap.pix(y, x) = rgb[m_blit_ram[count++]]; } } diff --git a/src/mame/drivers/hitme.cpp b/src/mame/drivers/hitme.cpp index 1c6e59f3742..33b65f0c945 100644 --- a/src/mame/drivers/hitme.cpp +++ b/src/mame/drivers/hitme.cpp @@ -80,26 +80,26 @@ uint32_t hitme_state::screen_update_hitme(screen_device &screen, bitmap_ind16 &b double dot_freq = 15750 * 336; /* the number of pixels is the duration times the frequency */ int width_pixels = width_duration * dot_freq; - int x, y, xx, inv; offs_t offs = 0; /* start by drawing the tilemap */ m_tilemap->draw(screen, bitmap, cliprect, 0, 0); /* now loop over and invert anything */ - for (y = 0; y < 19; y++) + for (int y = 0; y < 19; y++) { int dy = bitmap.rowpixels(); - for (inv = x = 0; x < 40; x++, offs++) + int inv = 0; + for (int x = 0; x < 40; x++, offs++) { /* if the high bit is set, reset the oneshot */ if (m_videoram[y * 40 + x] & 0x80) inv = width_pixels; /* invert pixels until we run out */ - for (xx = 0; xx < 8 && inv; xx++, inv--) + for (int xx = 0; xx < 8 && inv; xx++, inv--) { - uint16_t *dest = &bitmap.pix16(y * 10, x * 8 + xx); + uint16_t *const dest = &bitmap.pix(y * 10, x * 8 + xx); dest[0 * dy] ^= 1; dest[1 * dy] ^= 1; dest[2 * dy] ^= 1; diff --git a/src/mame/drivers/homelab.cpp b/src/mame/drivers/homelab.cpp index d19379c2e8d..4861ab08b83 100644 --- a/src/mame/drivers/homelab.cpp +++ b/src/mame/drivers/homelab.cpp @@ -622,19 +622,18 @@ u32 homelab_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co if (!m_cols) return 1; - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for(y = 0; y < m_rows; y++ ) + for (u8 y = 0; y < m_rows; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + m_cols; x++) + for (u16 x = ma; x < ma + m_cols; x++) { - chr = m_vram[x]; // get char in videoram - gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen + u8 const chr = m_vram[x]; // get char in videoram + u8 const gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/homez80.cpp b/src/mame/drivers/homez80.cpp index e84d42b71d6..c6e339af789 100644 --- a/src/mame/drivers/homez80.cpp +++ b/src/mame/drivers/homez80.cpp @@ -233,21 +233,20 @@ void homez80_state::machine_start() u32 homez80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++, 44); + uint16_t *p = &bitmap.pix(sy++, 44); - for (x = ma; x < ma+32; x++) + for (u16 x = ma; x < ma+32; x++) { - chr = m_vram[x]; + u8 const chr = m_vram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr<<3) | ra]; + u8 const gfx = m_p_chargen[ (chr<<3) | ra]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/hotblock.cpp b/src/mame/drivers/hotblock.cpp index 40f73692962..9aa225c38ca 100644 --- a/src/mame/drivers/hotblock.cpp +++ b/src/mame/drivers/hotblock.cpp @@ -159,7 +159,7 @@ uint32_t hotblock_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int count = (y * 320) + cliprect.left(); for(int x = cliprect.left(); x <= cliprect.right(); x++) { - bitmap.pix16(y, x) = m_vram[count++]; + bitmap.pix(y, x) = m_vram[count++]; } } diff --git a/src/mame/drivers/hotstuff.cpp b/src/mame/drivers/hotstuff.cpp index 446c4edbaab..05c1b1ffb77 100644 --- a/src/mame/drivers/hotstuff.cpp +++ b/src/mame/drivers/hotstuff.cpp @@ -40,11 +40,10 @@ void hotstuff_state::video_start() uint32_t hotstuff_state::screen_update_hotstuff(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int yyy,xxx; uint16_t row_palette_data[0x10]; rgb_t row_palette_data_as_rgb32_pen_data[0x10]; - yyy=512;xxx=512*2; + int yyy=512, xxx=512*2; int count = 0; for (int y = 0; y < yyy; y++) @@ -61,13 +60,13 @@ uint32_t hotstuff_state::screen_update_hotstuff(screen_device &screen, bitmap_rg for (int x = 0; x < xxx; ) { - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0xf000)>>12]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0xf000)>>12]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x0f00)>>8]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x0f00)>>8]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x00f0)>>4]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x00f0)>>4]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x000f)>>0]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x000f)>>0]; x++; count++; diff --git a/src/mame/drivers/hp16500.cpp b/src/mame/drivers/hp16500.cpp index f26bfda1e2d..654228a96db 100644 --- a/src/mame/drivers/hp16500.cpp +++ b/src/mame/drivers/hp16500.cpp @@ -143,12 +143,11 @@ WRITE_LINE_MEMBER( hp16500_state::vsync_changed ) MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); - int i, pos; + uint32_t *p = &bitmap.pix(y); - pos = y * 144; + int pos = y * 144; - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { *p++ = m_palette[m_vram[pos+0x00000]]; *p++ = m_palette[m_vram[pos+0x10000]]; @@ -165,12 +164,11 @@ MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) MC6845_UPDATE_ROW( hp16500_state::crtc_update_row_1650 ) { - uint32_t *p = &bitmap.pix32(y); - int i, pos; + uint32_t *p = &bitmap.pix(y); - pos = y * 148; + int pos = y * 148; - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { *p++ = m_palette[m_vram[pos+0x00000]]; *p++ = m_palette[m_vram[pos+0x10000]]; @@ -400,7 +398,7 @@ uint32_t hp16500_state::screen_update_hp16500(screen_device &screen, bitmap_rgb3 int pos = 0; for (int y = 0; y < 384; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 576; x+=4) { diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp index 618377674aa..55c26b3edd3 100644 --- a/src/mame/drivers/hp2640.cpp +++ b/src/mame/drivers/hp2640.cpp @@ -667,8 +667,8 @@ void hp2645_state::video_render_buffer(unsigned video_scanline , unsigned line_i } unsigned on_pen = BIT(attrs , 3) ? 1 : 2; for (unsigned x = 0; x < VIDEO_CHAR_WIDTH * 2; x += 2) { - m_bitmap.pix32(video_scanline , x_left + x) = m_palette->pen(BIT(pixels_e , 0) ? on_pen : 0); - m_bitmap.pix32(video_scanline , x_left + x + 1) = m_palette->pen(BIT(pixels_o , 0) ? on_pen : 0); + m_bitmap.pix(video_scanline , x_left + x) = m_palette->pen(BIT(pixels_e , 0) ? on_pen : 0); + m_bitmap.pix(video_scanline , x_left + x + 1) = m_palette->pen(BIT(pixels_o , 0) ? on_pen : 0); pixels_e >>= 1; pixels_o >>= 1; } diff --git a/src/mame/drivers/hp64k.cpp b/src/mame/drivers/hp64k.cpp index ba1e068e2a0..3d2e2ca4298 100644 --- a/src/mame/drivers/hp64k.cpp +++ b/src/mame/drivers/hp64k.cpp @@ -481,11 +481,9 @@ WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_vrtc_w) I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; - bool lvid , livid; uint16_t pixels_lvid , pixels_livid; - unsigned i; if (vsp) { pixels_lvid = pixels_livid = ~0; @@ -504,19 +502,19 @@ I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) pixels_livid = ~0; } - for (i = 0; i < 9; i++) { - lvid = (pixels_lvid & (1U << (8 - i))) != 0; - livid = (pixels_livid & (1U << (8 - i))) != 0; + for (unsigned i = 0; i < 9; i++) { + bool const lvid = (pixels_lvid & (1U << (8 - i))) != 0; + bool const livid = (pixels_livid & (1U << (8 - i))) != 0; if (!lvid) { // Normal brightness - bitmap.pix32(y , x + i) = palette[ 2 ]; + bitmap.pix(y , x + i) = palette[ 2 ]; } else if (livid) { // Black - bitmap.pix32(y , x + i) = palette[ 0 ]; + bitmap.pix(y , x + i) = palette[ 0 ]; } else { // Half brightness - bitmap.pix32(y , x + i) = palette[ 1 ]; + bitmap.pix(y , x + i) = palette[ 1 ]; } } diff --git a/src/mame/drivers/hp80.cpp b/src/mame/drivers/hp80.cpp index 6fa046d2822..7daea00a448 100644 --- a/src/mame/drivers/hp80.cpp +++ b/src/mame/drivers/hp80.cpp @@ -1107,7 +1107,7 @@ WRITE_LINE_MEMBER(hp85_state::vblank_w) uint8_t pixels = video_mem_r(video_start , GRAPH_MEM_SIZE / 2 - 1); video_start += 2; for (unsigned sub_x = 0; sub_x < 8; sub_x++) { - m_bitmap.pix32(y , x + sub_x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , x + sub_x) = m_palette->pen(BIT(pixels , 7)); pixels <<= 1; } } @@ -1130,7 +1130,7 @@ WRITE_LINE_MEMBER(hp85_state::vblank_w) pixels = 0; } for (unsigned sub_x = 0; sub_x < 8; sub_x++) { - m_bitmap.pix32(row + sub_row , col + sub_x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(row + sub_row , col + sub_x) = m_palette->pen(BIT(pixels , 7)); pixels <<= 1; } } @@ -1840,14 +1840,14 @@ WRITE_LINE_MEMBER(hp86_state::vblank_w) if (++video_ptr >= limit) { video_ptr = 0; } - m_bitmap.pix32(y , x) = m_palette->pen(BIT(pixels , 7)); - m_bitmap.pix32(y , x + 1) = m_palette->pen(BIT(pixels , 6)); - m_bitmap.pix32(y , x + 2) = m_palette->pen(BIT(pixels , 5)); - m_bitmap.pix32(y , x + 3) = m_palette->pen(BIT(pixels , 4)); - m_bitmap.pix32(y , x + 4) = m_palette->pen(BIT(pixels , 3)); - m_bitmap.pix32(y , x + 5) = m_palette->pen(BIT(pixels , 2)); - m_bitmap.pix32(y , x + 6) = m_palette->pen(BIT(pixels , 1)); - m_bitmap.pix32(y , x + 7) = m_palette->pen(BIT(pixels , 0)); + m_bitmap.pix(y , x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , x + 1) = m_palette->pen(BIT(pixels , 6)); + m_bitmap.pix(y , x + 2) = m_palette->pen(BIT(pixels , 5)); + m_bitmap.pix(y , x + 3) = m_palette->pen(BIT(pixels , 4)); + m_bitmap.pix(y , x + 4) = m_palette->pen(BIT(pixels , 3)); + m_bitmap.pix(y , x + 5) = m_palette->pen(BIT(pixels , 2)); + m_bitmap.pix(y , x + 6) = m_palette->pen(BIT(pixels , 1)); + m_bitmap.pix(y , x + 7) = m_palette->pen(BIT(pixels , 0)); } } } else { @@ -1880,14 +1880,14 @@ WRITE_LINE_MEMBER(hp86_state::vblank_w) pixels = ~pixels; } unsigned y = row * lines_per_row + sub_row; - m_bitmap.pix32(y , col) = m_palette->pen(BIT(pixels , 7)); - m_bitmap.pix32(y , col + 1) = m_palette->pen(BIT(pixels , 6)); - m_bitmap.pix32(y , col + 2) = m_palette->pen(BIT(pixels , 5)); - m_bitmap.pix32(y , col + 3) = m_palette->pen(BIT(pixels , 4)); - m_bitmap.pix32(y , col + 4) = m_palette->pen(BIT(pixels , 3)); - m_bitmap.pix32(y , col + 5) = m_palette->pen(BIT(pixels , 2)); - m_bitmap.pix32(y , col + 6) = m_palette->pen(BIT(pixels , 1)); - m_bitmap.pix32(y , col + 7) = m_palette->pen(BIT(pixels , 0)); + m_bitmap.pix(y , col) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , col + 1) = m_palette->pen(BIT(pixels , 6)); + m_bitmap.pix(y , col + 2) = m_palette->pen(BIT(pixels , 5)); + m_bitmap.pix(y , col + 3) = m_palette->pen(BIT(pixels , 4)); + m_bitmap.pix(y , col + 4) = m_palette->pen(BIT(pixels , 3)); + m_bitmap.pix(y , col + 5) = m_palette->pen(BIT(pixels , 2)); + m_bitmap.pix(y , col + 6) = m_palette->pen(BIT(pixels , 1)); + m_bitmap.pix(y , col + 7) = m_palette->pen(BIT(pixels , 0)); } } } diff --git a/src/mame/drivers/hp95lx.cpp b/src/mame/drivers/hp95lx.cpp index dc8b0ec5998..2c8df7ad204 100644 --- a/src/mame/drivers/hp95lx.cpp +++ b/src/mame/drivers/hp95lx.cpp @@ -188,20 +188,16 @@ void hp95lx_state::hp95lx_palette(palette_device &palette) const uint32_t hp95lx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, offset; - uint16_t gfx, *p; - uint8_t chr, attr; - if (m_graphics_mode) { - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - p = &bitmap.pix16(y); - offset = y * (240 / 8); + uint16_t *p = &bitmap.pix(y); + int const offset = y * (240 / 8); - for (x = offset; x < offset + (240 / 8); x++) + for (int x = offset; x < offset + (240 / 8); x++) { - gfx = m_p_videoram[x]; + uint16_t const gfx = m_p_videoram[x]; for (int i = 7; i >= 0; i--) { @@ -215,17 +211,17 @@ uint32_t hp95lx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap bool blink((m_screen->frame_number() % 10) > 4); // screen memory is normal MDA 80x25, but only a scrollable 40x16 window is displayed - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - p = &bitmap.pix16(y); - offset = (y / 8) * 160 + m_window_start_addr; + uint16_t *p = &bitmap.pix(y); + int const offset = (y / 8) * 160 + m_window_start_addr; - for (x = offset; x < offset + 80; x += 2) + for (int x = offset; x < offset + 80; x += 2) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x + 1]; + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x + 1]; - gfx = m_p_chargen[(chr)*8 + (y % 8)]; + uint16_t gfx = m_p_chargen[(chr)*8 + (y % 8)]; if ((x >> 1) == m_cursor_addr && blink && (y % 8) >= m_cursor_start_ras) { diff --git a/src/mame/drivers/hp9845.cpp b/src/mame/drivers/hp9845.cpp index 1543d81dfe1..400aeb02133 100644 --- a/src/mame/drivers/hp9845.cpp +++ b/src/mame/drivers/hp9845.cpp @@ -1032,7 +1032,7 @@ void hp9845b_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked) { // Blank scanline for (unsigned i = 0; i < VIDEO_HBSTART; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } else { bool cursor_line = line_in_row == 12; @@ -1065,7 +1065,7 @@ void hp9845b_state::video_render_buff(unsigned video_scanline , unsigned line_in for (unsigned j = 0; j < 9; j++) { bool pixel = (pixels & (1U << j)) != 0; - m_bitmap.pix32(video_scanline , i * 9 + j) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; + m_bitmap.pix(video_scanline , i * 9 + j) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; } } } @@ -1105,7 +1105,7 @@ void hp9845b_state::graphic_video_render(unsigned video_scanline) // Normal pixel pixel = (word & mask) != 0 ? PEN_GRAPHIC : PEN_BLACK; } - m_bitmap.pix32(video_scanline - GVIDEO_VBEND , x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline - GVIDEO_VBEND , x++) = pen[ pixel ]; } } } @@ -1693,15 +1693,15 @@ void hp9845ct_base_state::render_lp_cursor(unsigned video_scanline , unsigned pe const pen_t &pen = m_palette->pen(pen_idx); if (!yc) { if (m_gv_lp_cursor_x < VIDEO_TOT_HPIXELS) { - m_bitmap.pix32(video_scanline , m_gv_lp_cursor_x) = pen; + m_bitmap.pix(video_scanline , m_gv_lp_cursor_x) = pen; } } else if (m_gv_lp_cursor_fs) { for (unsigned x = 0; x < VIDEO_TOT_HPIXELS; x++) { - m_bitmap.pix32(video_scanline , x) = pen; + m_bitmap.pix(video_scanline , x) = pen; } } else { for (unsigned x = std::max(0 , (int)m_gv_lp_cursor_x - 24); x <= (m_gv_lp_cursor_x + 25) && x < VIDEO_TOT_HPIXELS; x++) { - m_bitmap.pix32(video_scanline , x) = pen; + m_bitmap.pix(video_scanline , x) = pen; } } } @@ -2216,15 +2216,15 @@ void hp9845c_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked || !m_alpha_sel) { // Blank scanline for (unsigned i = 0; i < VIDEO_770_ALPHA_L_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } if (!m_graphic_sel) { for (unsigned i = VIDEO_770_ALPHA_L_LIM; i < VIDEO_770_ALPHA_R_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } } for (unsigned i = VIDEO_770_ALPHA_R_LIM; i < VIDEO_TOT_HPIXELS; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } } else { bool cursor_line = line_in_row == 12; @@ -2272,11 +2272,11 @@ void hp9845c_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_graphic_sel && x >= VIDEO_770_ALPHA_L_LIM && x < VIDEO_770_ALPHA_R_LIM) { // alpha overlays graphics (non-dominating) if (pixel) { - m_bitmap.pix32(video_scanline , x) = pen[ pen_alpha(color) ]; + m_bitmap.pix(video_scanline , x) = pen[ pen_alpha(color) ]; } } else { // Graphics disabled or alpha-only zone - m_bitmap.pix32(video_scanline , x) = pen[ pixel ? pen_alpha(color) : pen_alpha(0) ]; + m_bitmap.pix(video_scanline , x) = pen[ pixel ? pen_alpha(color) : pen_alpha(0) ]; } } } @@ -2347,7 +2347,7 @@ void hp9845c_state::graphic_video_render(unsigned video_scanline) // Normal pixel pixel = pen_graphic(((word0 & mask) ? pen0 : 0) | ((word1 & mask) ? pen1 : 0) | ((word2 & mask) ? pen2 : 0)); } - m_bitmap.pix32(video_scanline , VIDEO_770_ALPHA_L_LIM + x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline , VIDEO_770_ALPHA_L_LIM + x++) = pen[ pixel ]; } } } @@ -2914,15 +2914,15 @@ void hp9845t_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked || !m_alpha_sel) { // Blank scanline for (unsigned i = 0; i < VIDEO_780_ALPHA_L_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } if (!m_graphic_sel) { for (unsigned i = VIDEO_780_ALPHA_L_LIM; i < VIDEO_780_ALPHA_R_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } for (unsigned i = VIDEO_780_ALPHA_R_LIM; i < VIDEO_TOT_HPIXELS; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } else { bool cursor_line = line_in_row == 12; @@ -2974,11 +2974,11 @@ void hp9845t_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_graphic_sel && x >= VIDEO_780_ALPHA_L_LIM && x < VIDEO_780_ALPHA_R_LIM) { // alpha overlays graphics (non-dominating) if (pixel) { - m_bitmap.pix32(video_scanline , x) = pen[ PEN_ALPHA ]; + m_bitmap.pix(video_scanline , x) = pen[ PEN_ALPHA ]; } } else { // Graphics disabled or alpha-only zone - m_bitmap.pix32(video_scanline , x) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; + m_bitmap.pix(video_scanline , x) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; } } } @@ -3042,7 +3042,7 @@ void hp9845t_state::graphic_video_render(unsigned video_scanline) else pixel = word & mask ? PEN_GRAPHIC : PEN_BLACK; } - m_bitmap.pix32(video_scanline , VIDEO_780_ALPHA_L_LIM + x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline , VIDEO_780_ALPHA_L_LIM + x++) = pen[ pixel ]; } } } diff --git a/src/mame/drivers/hp9k.cpp b/src/mame/drivers/hp9k.cpp index 1895babc4d1..ca89fd2a7bd 100644 --- a/src/mame/drivers/hp9k.cpp +++ b/src/mame/drivers/hp9k.cpp @@ -353,14 +353,13 @@ GFXDECODE_END void hp9k_state::putChar(uint8_t thec,int x,int y,bitmap_ind16 &bitmap) { - const uint8_t* pchar=m_gfxdecode->gfx(0)->get_data(thec); + uint8_t const *const pchar=m_gfxdecode->gfx(0)->get_data(thec); for (int py=0;py<HP9816_CHDIMY;py++) { for (int px=0;px<HP9816_CHDIMX;px++) { - uint16_t *dest=&bitmap.pix16((y*(HP9816_CHDIMY))+py,(x*(HP9816_CHDIMX))+px); - *dest=pchar[px+(py*8)]; + bitmap.pix((y*(HP9816_CHDIMY))+py,(x*(HP9816_CHDIMX))+px) = pchar[px+(py*8)]; } } } diff --git a/src/mame/drivers/hprot1.cpp b/src/mame/drivers/hprot1.cpp index 685bf8bc84f..feaff0856f5 100644 --- a/src/mame/drivers/hprot1.cpp +++ b/src/mame/drivers/hprot1.cpp @@ -236,12 +236,12 @@ HD44780_PIXEL_UPDATE(hprot1_state::hprot1_pixel_update) { if ( pos < 16 && line==0 ) { - bitmap.pix16(y, pos*6 + x) = state; + bitmap.pix(y, pos*6 + x) = state; } if ( pos >= 64 && pos < 80 && line==0 ) { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; + bitmap.pix(y+9,(pos-64)*6 + x) = state; } } diff --git a/src/mame/drivers/huebler.cpp b/src/mame/drivers/huebler.cpp index 8b3a6974097..56b5748d3d3 100644 --- a/src/mame/drivers/huebler.cpp +++ b/src/mame/drivers/huebler.cpp @@ -231,26 +231,25 @@ INPUT_PORTS_END uint32_t amu880_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y, sx, x, line; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - line = y % 10; + int const line = y % 10; - for (sx = 0; sx < 64; sx++) + for (int sx = 0; sx < 64; sx++) { - uint16_t videoram_addr = ((y / 10) * 64) + sx; - uint8_t videoram_data = m_video_ram[videoram_addr & 0x7ff]; + uint16_t const videoram_addr = ((y / 10) * 64) + sx; + uint8_t const videoram_data = m_video_ram[videoram_addr & 0x7ff]; - uint16_t charrom_addr = ((videoram_data & 0x7f) << 3) | line; + uint16_t const charrom_addr = ((videoram_data & 0x7f) << 3) | line; uint8_t data = m_char_rom->base()[charrom_addr & 0x3ff]; - for (x = 0; x < 6; x++) + for (int x = 0; x < 6; x++) { - int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); + int const color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); - bitmap.pix32(y, (sx * 6) + x) = pen[color]; + bitmap.pix(y, (sx * 6) + x) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/hunter16.cpp b/src/mame/drivers/hunter16.cpp index aadb3dcea92..1824bbc508c 100644 --- a/src/mame/drivers/hunter16.cpp +++ b/src/mame/drivers/hunter16.cpp @@ -169,12 +169,12 @@ void hunter16_state::palette_init_hunter16(palette_device &palette) MC6845_UPDATE_ROW(hunter16_state::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (int i = 0; i < x_count; i++) { - uint16_t offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); uint8_t data = m_videoram[offset]; for (int bit = 7; bit >= 0; bit--) diff --git a/src/mame/drivers/husky.cpp b/src/mame/drivers/husky.cpp index ba63742e0a2..84084b366cb 100644 --- a/src/mame/drivers/husky.cpp +++ b/src/mame/drivers/husky.cpp @@ -384,13 +384,13 @@ uint32_t husky_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, I'm drawing each character as 6x12 to form an overall screen of 192x48. */ - uint8_t data; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int y = 0; y < 48; y++) { for (int x = 0; x < 32; x++) { + uint8_t data; switch (y % 12) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: @@ -399,24 +399,24 @@ uint32_t husky_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int b = 0; b < 5; b++) { - bitmap.pix32(y, (x * 6) + b) = BIT(data, 0) ? pen[1] : pen[2]; + bitmap.pix(y, (x * 6) + b) = BIT(data, 0) ? pen[1] : pen[2]; data >>= 1; } - bitmap.pix32(y, (x * 6) + 5) = pen[0]; + bitmap.pix(y, (x * 6) + 5) = pen[0]; break; case 8: /* cursor */ for (int b = 0; b < 5; b++) { - bitmap.pix32(y, (x * 6) + b) = (!m_curinh && m_cursor == (y / 12) * 32 + x) ? pen[1] : pen[2]; + bitmap.pix(y, (x * 6) + b) = (!m_curinh && m_cursor == (y / 12) * 32 + x) ? pen[1] : pen[2]; } - bitmap.pix32(y, (x * 6) + 5) = pen[0]; + bitmap.pix(y, (x * 6) + 5) = pen[0]; break; default: /* blank */ for (int b = 0; b < 6; b++) { - bitmap.pix32(y, (x * 6) + b) = pen[0]; + bitmap.pix(y, (x * 6) + b) = pen[0]; } break; } diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp index 0f2ec3a18d1..26ae14be877 100644 --- a/src/mame/drivers/ibm6580.cpp +++ b/src/mame/drivers/ibm6580.cpp @@ -717,23 +717,24 @@ INPUT_PORTS_END uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx,fg,bg,chr,attr; - uint16_t sy=0,ma=25,x,ca; + uint16_t sy=0,ma=25; - fg = 1; bg = 0; + uint8_t fg = 1, bg = 0; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - // graphics mode - if (m_p_videoram[ma] & 0x100) { - for (x = ma; x < ma + 80; x++) + if (m_p_videoram[ma] & 0x100) + { + // graphics mode + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x] >> 8; + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x] >> 8; + uint8_t gfx; switch (ra >> 1) { @@ -764,13 +765,16 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma *p++ = BIT(gfx, i) ? fg : bg; } } - } else { - // text mode - for (x = ma; x < ma + 80; x++) + } + else + { + // text mode + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x] >> 8; - ca = (chr<<4); + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x] >> 8; + uint16_t ca = (chr<<4); + uint8_t gfx; // font 2 if (attr & 0x02) diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index 86f3f34e528..26ef951ef54 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -404,8 +404,7 @@ void pcjr_state::pcjr_fdc_dor_w(uint8_t data) else m_fdc->set_floppy(nullptr); - if((pdor^m_pcjr_dor) & 0x80) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(m_pcjr_dor, 7)); if(m_pcjr_dor & 0x20) { if((pdor & 0x40) && !(m_pcjr_dor & 0x40)) diff --git a/src/mame/drivers/icatel.cpp b/src/mame/drivers/icatel.cpp index e20cde566cb..151fd97ed80 100644 --- a/src/mame/drivers/icatel.cpp +++ b/src/mame/drivers/icatel.cpp @@ -228,12 +228,12 @@ HD44780_PIXEL_UPDATE(icatel_state::icatel_pixel_update) { if ( pos < 16 && line==0 ) { - bitmap.pix16(y, pos*6 + x) = state; + bitmap.pix(y, pos*6 + x) = state; } if ( pos >= 64 && pos < 80 && line==0 ) { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; + bitmap.pix(y+9,(pos-64)*6 + x) = state; } } diff --git a/src/mame/drivers/if800.cpp b/src/mame/drivers/if800.cpp index 0719bb7f354..26128d2aa91 100644 --- a/src/mame/drivers/if800.cpp +++ b/src/mame/drivers/if800.cpp @@ -43,18 +43,15 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - int xi,gfx; - uint8_t pen; + int gfx = m_video_ram[address >> 1]; - gfx = m_video_ram[address >> 1]; - - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - pen = ((gfx >> xi) & 1) ? 1 : 0; + uint8_t pen = BIT(gfx, xi); - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp index 284abb450fd..f6268c6800e 100644 --- a/src/mame/drivers/igs011.cpp +++ b/src/mame/drivers/igs011.cpp @@ -394,10 +394,10 @@ u32 igs011_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con #ifdef MAME_DEBUG if ((layer_enable != -1) && (pri_addr == 0xff)) - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x) = m_palette->black_pen(); else #endif - bitmap.pix16(y, x) = m_layer[l][scr_addr] | (l << 8); + bitmap.pix(y, x) = m_layer[l][scr_addr] | (l << 8); } } return 0; diff --git a/src/mame/drivers/igs017.cpp b/src/mame/drivers/igs017.cpp index c0ea5203336..5e3fe848760 100644 --- a/src/mame/drivers/igs017.cpp +++ b/src/mame/drivers/igs017.cpp @@ -26,6 +26,7 @@ Year + Game PCB CPU Sound Custom 99 Tarzan (V109C) NO-0248-1 Z180 M6295 IGS031 IGS025 Battery 00? Super Tarzan (V100I) NO-0230-1 Z180 M6295 IGS031 IGS025 Battery 01? Happy Skill (V611) NO-0281 Z180 M6295 (K668) IGS031 IGS025 Battery +01? unknown (V100A) unreadable Z180 M6295 IGS031 IGS025 Battery ?? Super Poker / Formosa NO-0187 Z180 M6295 YM2413 IGS017 IGS025 Battery ------------------------------------------------------------------------------------------------------------- * not present in one set @@ -94,6 +95,7 @@ public: auto out_pa_callback() { return m_out_pa_cb.bind(); } auto out_pb_callback() { return m_out_pb_cb.bind(); } auto out_pc_callback() { return m_out_pc_cb.bind(); } + auto out_pd_callback() { return m_out_pd_cb.bind(); } void address_w(u8 data); void data_w(u8 data); @@ -115,6 +117,7 @@ private: devcb_write8 m_out_pa_cb; devcb_write8 m_out_pb_cb; devcb_write8 m_out_pc_cb; + devcb_write8 m_out_pd_cb; u8 m_address, m_m3, m_mf; u16 m_val, m_word; @@ -172,7 +175,8 @@ igs_bitswap_device::igs_bitswap_device(const machine_config &mconfig, const char m_in_pc_cb(*this), m_out_pa_cb(*this), m_out_pb_cb(*this), - m_out_pc_cb(*this) + m_out_pc_cb(*this), + m_out_pd_cb(*this) { } @@ -185,6 +189,7 @@ void igs_bitswap_device::device_start() m_out_pa_cb.resolve(); m_out_pb_cb.resolve(); m_out_pc_cb.resolve(); + m_out_pd_cb.resolve(); // register for save states save_item(NAME(m_address)); @@ -230,6 +235,13 @@ void igs_bitswap_device::data_w(u8 data) return; } break; + case 0x03: + if (!m_out_pd_cb.isnull()) + { + m_out_pd_cb(data); + return; + } + break; case 0x40: // word { @@ -488,6 +500,7 @@ public: void starzan(machine_config &config); void spkrform(machine_config &config); void sdmg2(machine_config &config); + void tarzan(machine_config &config); void init_iqblocka(); void init_mgdh(); @@ -503,6 +516,7 @@ public: void init_lhzb2a(); void init_mgdha(); void init_happyskl(); + void init_unkigs(); protected: virtual void video_start() override; @@ -528,7 +542,7 @@ private: optional_ioport m_io_player2; optional_ioport m_io_hopper; optional_ioport_array<5> m_io_key; - optional_ioport_array<2> m_io_dsw; + optional_ioport_array<3> m_io_dsw; void igs025_to_igs022_callback(void); @@ -538,6 +552,7 @@ private: u8 m_scramble_data; u8 m_dsw_select; + u8 m_i8255_portc_mux; // IGS029 protection (communication) u8 m_igs029_send_data, m_igs029_recv_data; @@ -586,6 +601,8 @@ private: u16 slqz2_magic_r(); u8 mgcs_keys_r(); + u8 i8255_port_c_mux_r(); // starzan, happyskl, unkigs (maybe tarzanc and clones, too) + DECLARE_MACHINE_RESET(iqblocka); DECLARE_MACHINE_RESET(mgcs); DECLARE_MACHINE_RESET(lhzb2a); @@ -1046,9 +1063,34 @@ void igs017_state::init_happyskl() rom[i] = x; } - tarzan_decrypt_tiles(); // seems ok + tarzan_decrypt_tiles(); // enough for chars } + +void igs017_state::init_unkigs() +{ + u8 *rom = memregion("maincpu")->base(); + + for (int i = 0; i < 0x40000; i++) + { + u8 x = rom[i]; + + if ((i & 0x00011) == 0x00011) x ^= 0x01; + if ((i & 0x02180) == 0x00000) x ^= 0x01; + if ((i & 0x001a0) != 0x00020) x ^= 0x20; + if ((i & 0x00260) != 0x00020) x ^= 0x40; + if ((i & 0x00020) == 0x00020) x ^= 0x80; + if ((i & 0x00260) == 0x00240) x ^= 0x80; + + // this hasn't got split data / opcodes encryption like happyskl, but let's keep the same machine_config for easier testing + m_decrypted_opcodes[i] = x; + rom[i] = x; + } + + tarzan_decrypt_tiles(); // enough for chars +} + + // sdmg2 void igs017_state::init_sdmg2() @@ -2396,6 +2438,18 @@ void igs017_state::slqz2_map(address_map &map) map(0x910001, 0x910001).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); } +u8 igs017_state::i8255_port_c_mux_r() +{ + switch(m_i8255_portc_mux) + { + case 0x01: return m_io_dsw[2]->read(); + case 0x02: return m_io_dsw[1]->read(); + case 0x03: return m_io_dsw[0]->read(); + } + + return 0xff; +} + /*************************************************************************** Input Ports @@ -3511,7 +3565,245 @@ static INPUT_PORTS_START( spkrform ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END +static INPUT_PORTS_START( starzan ) + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "System Limit" ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, "Unlimited" ) + PORT_DIPSETTING( 0x00, "Limited" ) + PORT_DIPNAME( 0x04, 0x04, "W-Up Game" ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "Back Color" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x08, "Black" ) + PORT_DIPSETTING( 0x00, "Color" ) + PORT_DIPNAME( 0x10, 0x10, "Stop Status" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x10, "Non Stop" ) + PORT_DIPSETTING( 0x00, "Auto Stop" ) + PORT_DIPNAME( 0x20, 0x20, "Key" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x20, "Mode 1" ) + PORT_DIPSETTING( 0x00, "Mode 2" ) + PORT_DIPNAME( 0x40, 0x40, "Credit Level" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Odds Table" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x80, "Show" ) + PORT_DIPSETTING( 0x00, "No Show" ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "Normal Level" ) PORT_DIPLOCATION("SW2:1") + PORT_DIPSETTING( 0x01, DEF_STR( Low ) ) + PORT_DIPSETTING( 0x00, DEF_STR( High ) ) + PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "SW2:2") // not used from here on according to test mode, PCB does have 3 8-dip banks + PORT_DIPUNUSED_DIPLOC(0x04, 0x04, "SW2:3") + PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "SW2:4") + PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "SW2:5") + PORT_DIPUNUSED_DIPLOC(0x20, 0x20, "SW2:6") + PORT_DIPUNUSED_DIPLOC(0x40, 0x40, "SW2:7") + PORT_DIPUNUSED_DIPLOC(0x80, 0x80, "SW2:8") + + PORT_START("DSW3") + PORT_DIPUNUSED_DIPLOC(0x01, 0x01, "SW3:1") + PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "SW3:2") + PORT_DIPUNUSED_DIPLOC(0x04, 0x04, "SW3:3") + PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "SW3:4") + PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "SW3:5") + PORT_DIPUNUSED_DIPLOC(0x20, 0x20, "SW3:6") + PORT_DIPUNUSED_DIPLOC(0x40, 0x40, "SW3:7") + PORT_DIPUNUSED_DIPLOC(0x80, 0x80, "SW3:8") + + PORT_START("PLAYER1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "HP SW" ) // called like this in key test, not clear what it does + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SLOT_STOP_ALL ) + + PORT_START("PLAYER2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SLOT_STOP4 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + + PORT_START("COINS") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) // 'gettone C' + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5) // 'gettone A' + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) + PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW ) // keep pressed while booting + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // enters book-keeping menu + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + + PORT_START("BUTTONS") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test +INPUT_PORTS_END + +// Test mode is in Italian (probably machine translated given how literal it is). +static INPUT_PORTS_START( happyskl ) + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") // 'demo audio' + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "System Limit" ) PORT_DIPLOCATION("SW1:2") // 'lim. sistema' + PORT_DIPSETTING( 0x02, "Unlimited" ) + PORT_DIPSETTING( 0x00, "Limited" ) + PORT_DIPNAME( 0x04, 0x04, "W-Up Game" ) PORT_DIPLOCATION("SW1:3") // 'gioco radd.' + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "Game Speed" ) PORT_DIPLOCATION("SW1:4") // 'velocitá gioco' + PORT_DIPSETTING( 0x08, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, "Quick" ) + PORT_DIPNAME( 0x10, 0x10, "Replay Game" ) PORT_DIPLOCATION("SW1:5") // not translated for some reason + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "Show Table" ) PORT_DIPLOCATION("SW1:6") // 'vedi tabella' + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "Skill" ) PORT_DIPLOCATION("SW1:7") // 'abilitá' + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Payment Type" ) PORT_DIPLOCATION("SW1:8") // 'tipo pagam.' + PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, "Automatic" ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "Auto Payment" ) PORT_DIPLOCATION("SW2:1") // 'pagam. autom.' + PORT_DIPSETTING( 0x01, "1" ) + PORT_DIPSETTING( 0x00, "10" ) + PORT_DIPNAME( 0x06, 0x06, "Enable Payment" ) PORT_DIPLOCATION("SW2:2,3") // 'abilitá pagam.', they probably meant "abilita" instead of "abilitá" + PORT_DIPSETTING( 0x06, "Everything" ) // 'tutto' + PORT_DIPSETTING( 0x04, "1/Tickets" ) + PORT_DIPSETTING( 0x02, "10/Tickets" ) + PORT_DIPSETTING( 0x00, "1/Tickets" ) // same as 0x04, why? + PORT_DIPNAME( 0x08, 0x08, "Select Balls" ) PORT_DIPLOCATION("SW2:4") // 'sel. palloni' + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "Select Cubes" ) PORT_DIPLOCATION("SW2:5") // 'sel. cubi' + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "Select Cans" ) PORT_DIPLOCATION("SW2:6") // 'sel. lattine' + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "Select Cards" ) PORT_DIPLOCATION("SW2:7") // 'sel. carte' + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Credit Limit" ) PORT_DIPLOCATION("SW2:8") // 'lim. crediti' + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSW3") + PORT_DIPNAME( 0x01, 0x01, "Level Limit" ) PORT_DIPLOCATION("SW3:1") // 'lim. livello' + PORT_DIPSETTING( 0x01, DEF_STR( Low ) ) + PORT_DIPSETTING( 0x00, DEF_STR( High ) ) + PORT_DIPNAME( 0x02, 0x02, "Background" ) PORT_DIPLOCATION("SW3:2") // 'sfondo' + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC(0x04, 0x04, "SW3:3") // not used from here on according to test mode + PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "SW3:4") + PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "SW3:5") + PORT_DIPUNUSED_DIPLOC(0x20, 0x20, "SW3:6") + PORT_DIPUNUSED_DIPLOC(0x40, 0x40, "SW3:7") + PORT_DIPUNUSED_DIPLOC(0x80, 0x80, "SW3:8") + + PORT_START("PLAYER1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "HP SW" ) // called like this in key test, not clear what it does + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) + + PORT_START("PLAYER2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + + PORT_START("COINS") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) // 'gettone C' + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5) // 'gettone A' + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) + PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW ) // keep pressed while booting + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // enters book-keeping menu + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test + + PORT_START("BUTTONS") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no effects in key test +INPUT_PORTS_END + +static INPUT_PORTS_START( unkigs ) + PORT_INCLUDE(happyskl) + PORT_MODIFY("PLAYER1") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) + + PORT_MODIFY("PLAYER2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) + + // dips definitions taken from test mode, to be verified when the game will be playable + PORT_MODIFY("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "System Limit" ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, "Unlimited" ) + PORT_DIPSETTING( 0x00, "Limited" ) + PORT_DIPNAME( 0x04, 0x04, "W-Up Game" ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "W-Up Type" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x08, "Big-Small" ) + PORT_DIPSETTING( 0x00, "Red-Black" ) + PORT_DIPNAME( 0x10, 0x10, "Game Speed" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, "Quick" ) + PORT_DIPNAME( 0x20, 0x20, "Card Type" ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x20, "Poker" ) + PORT_DIPSETTING( 0x00, "Symbol" ) + PORT_DIPNAME( 0x40, 0x40, "Sexy Girl" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Title Name" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_MODIFY("DSW2") + PORT_DIPNAME( 0x01, 0x01, "Show Hold" ) PORT_DIPLOCATION("SW2:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "Number Type" ) PORT_DIPLOCATION("SW2:2") + PORT_DIPSETTING( 0x02, "Number" ) + PORT_DIPSETTING( 0x00, "AJQK" ) + PORT_DIPUNUSED_DIPLOC(0x04, 0x04, "SW2:3") // not used from here on according to test mode, PCB does have 3 8-dip banks + PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "SW2:4") + PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "SW2:5") + PORT_DIPUNUSED_DIPLOC(0x20, 0x20, "SW2:6") + PORT_DIPUNUSED_DIPLOC(0x40, 0x40, "SW2:7") + PORT_DIPUNUSED_DIPLOC(0x80, 0x80, "SW2:8") + + PORT_MODIFY("DSW3") + PORT_DIPUNUSED_DIPLOC(0x01, 0x01, "SW3:1") + PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "SW3:2") +INPUT_PORTS_END /*************************************************************************** Machine Drivers ***************************************************************************/ @@ -3602,12 +3894,25 @@ void igs017_state::genius6(machine_config &config) m_igs_bitswap->set_m3_bits<3>( 3, ~5, ~6, ~15); } -void igs017_state::starzan(machine_config &config) +void igs017_state::tarzan(machine_config &config) { iqblocka(config); + m_maincpu->set_addrmap(AS_OPCODES, &igs017_state::decrypted_opcodes_map); } +void igs017_state::starzan(machine_config &config) +{ + tarzan(config); + + subdevice<i8255_device>("ppi8255")->in_pa_callback().set_ioport("COINS"); + subdevice<i8255_device>("ppi8255")->in_pb_callback().set_ioport("PLAYER1"); + subdevice<i8255_device>("ppi8255")->in_pc_callback().set(FUNC(igs017_state::i8255_port_c_mux_r)); + + m_igs_bitswap->in_pa_callback().set_constant(0xff); + m_igs_bitswap->in_pc_callback().set_constant(0xff); + m_igs_bitswap->out_pd_callback().set([this](u8 data){ m_i8255_portc_mux = data >> 1; }); +} // mgcs @@ -4657,7 +4962,7 @@ ROM_START( happyskl ) ROM_REGION( 0x80000, "igs017_igs031:tilemaps", 0 ) ROM_LOAD( "happyskill_text.u11", 0x00000, 0x80000, CRC(c6f51041) SHA1(81a9a03e92c1c67f299113dec9e05ba77395ea31) ) - ROM_REGION( 0x80000, "oki", ROMREGION_ERASE ) + ROM_REGION( 0x80000, "oki", 0 ) ROM_LOAD( "igs_s2702_sp_v100.u8", 0x00000, 0x80000, CRC(0ec9b1b5) SHA1(b8c7e068ddf6777a184339e6796be33e442a3df4) ) ROM_REGION( 0x2dd * 2, "plds", 0 ) @@ -4665,6 +4970,30 @@ ROM_START( happyskl ) ROM_LOAD( "peel22cv10a.u20", 0x2dd, 0x2dd, NO_DUMP ) ROM_END + +// PCB was heavily corroded and not working +ROM_START( unkigs ) + ROM_REGION( 0x40000, "maincpu", 0 ) + ROM_LOAD( "u9.bin", 0x00000, 0x40000, CRC(8d79eb4d) SHA1(9cad09013f83335ec78c3ff78715bc5d9a989eb7) ) + + ROM_REGION( 0x480000, "igs017_igs031:sprites", ROMREGION_ERASE ) + ROM_LOAD( "u2", 0x00000, 0x080000, NO_DUMP ) // not populated. Never there or removed (more probable)? + // the following ROM wasn't readable on this PCB, but it's the same as the one in happyskl. Assuming same contents for now + ROM_LOAD( "igs_a2701_cg_v100.u3", 0x80000, 0x400000, BAD_DUMP CRC(f3756a51) SHA1(8dd4677584f309cec4b068be9f9370a7a172a031) ) // FIXED BITS (xxxxxxx0xxxxxxxx) - 1xxxxxxxxxxxxxxxxxxxxx = 0x00 + + ROM_REGION( 0x40000, "igs017_igs031:tilemaps", ROMREGION_ERASEFF ) + ROM_LOAD( "u11.bin", 0x00000, 0x40000, CRC(34475c83) SHA1(376ff68d89c25471483b074dcf7542f42f954e67) ) + ROM_IGNORE(0x040000) // 1xxxxxxxxxxxxxxxxxx = 0x00 + + ROM_REGION( 0x80000, "oki", 0 ) // same as happyskl + ROM_LOAD( "igs_s2702_sp_v100.u8", 0x00000, 0x80000, CRC(0ec9b1b5) SHA1(b8c7e068ddf6777a184339e6796be33e442a3df4) ) + + ROM_REGION( 0x2dd * 2, "plds", 0 ) + ROM_LOAD( "peel22cv10h.u10", 0x000, 0x2dd, NO_DUMP ) + ROM_LOAD( "peel22cv10h.u20", 0x2dd, 0x2dd, NO_DUMP ) +ROM_END + + /*************************************************************************** Super Poker (v100xD03) / Formosa @@ -4709,11 +5038,12 @@ GAME( 1998, mgcs, 0, mgcs, mgcs, igs017_state, init_mgcs, GAME( 1998, lhzb2, 0, lhzb2, lhzb2, igs017_state, init_lhzb2, ROT0, "IGS", "Mahjong Long Hu Zhengba 2 (set 1)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) GAME( 1998, lhzb2a, lhzb2, lhzb2a, lhzb2a, igs017_state, init_lhzb2a, ROT0, "IGS", "Mahjong Long Hu Zhengba 2 (VS221M)", 0 ) GAME( 1998, slqz2, 0, slqz2, slqz2, igs017_state, init_slqz2, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 2 (VS203J)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) -GAME( 1999, tarzanc, 0, starzan, iqblocka, igs017_state, init_tarzan, ROT0, "IGS", "Tarzan Chuang Tian Guan (V109C, set 1)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing -GAME( 1999, tarzan, tarzanc, starzan, iqblocka, igs017_state, init_tarzan, ROT0, "IGS", "Tarzan Chuang Tian Guan (V109C, set 2)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing -GAME( 1999, tarzana, tarzanc, starzan, iqblocka, igs017_state, init_tarzana, ROT0, "IGS", "Tarzan (V107)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) // IGS029 needs to be emulated, sprites' decryption missing -GAME( 2000?, starzan, 0, starzan, iqblocka, igs017_state, init_starzan, ROT0, "IGS (G.F. Gioca license)", "Super Tarzan (Italy, V100I)", MACHINE_NOT_WORKING ) -GAME( 2001?, happyskl, 0, starzan, iqblocka, igs017_state, init_happyskl, ROT0, "IGS", "Happy Skill (Italy, V611IT)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing +GAME( 1999, tarzanc, 0, tarzan, iqblocka, igs017_state, init_tarzan, ROT0, "IGS", "Tarzan Chuang Tian Guan (V109C, set 1)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing, inputs to be done +GAME( 1999, tarzan, tarzanc, tarzan, iqblocka, igs017_state, init_tarzan, ROT0, "IGS", "Tarzan Chuang Tian Guan (V109C, set 2)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing, inputs to be done +GAME( 1999, tarzana, tarzanc, tarzan, iqblocka, igs017_state, init_tarzana, ROT0, "IGS", "Tarzan (V107)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) // IGS029 needs to be emulated, sprites' decryption missing, inputs to be done +GAME( 2000?, starzan, 0, starzan, starzan, igs017_state, init_starzan, ROT0, "IGS (G.F. Gioca license)", "Super Tarzan (Italy, V100I)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, incomplete dump, sprites' decryption missing +GAME( 2001?, happyskl, 0, starzan, happyskl, igs017_state, init_happyskl, ROT0, "IGS", "Happy Skill (Italy, V611IT)", MACHINE_NOT_WORKING ) // IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing +GAME( 2001?, unkigs, happyskl, starzan, unkigs, igs017_state, init_unkigs, ROT0, "IGS", "unknown IGS game (V100A)", MACHINE_NOT_WORKING ) // possibly titled 'Champion 2', definitely derived from Happy Skill or vice versa, missing ROM, IGS031 protection's game specific parameters not emulated yet, sprites' decryption missing // Parent spk306us in driver spoker.cpp. Move this set to that driver? GAME( ????, spkrform, spk306us, spkrform, spkrform, igs017_state, init_spkrform, ROT0, "IGS", "Super Poker (v100xD03) / Formosa", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION ) diff --git a/src/mame/drivers/imolagp.cpp b/src/mame/drivers/imolagp.cpp index 67503390b3b..05b87fba010 100644 --- a/src/mame/drivers/imolagp.cpp +++ b/src/mame/drivers/imolagp.cpp @@ -182,7 +182,7 @@ uint32_t imolagp_state::screen_update_imolagp(screen_device &screen, bitmap_ind1 for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { uint8_t const *const source = &m_videoram[layer][(y & 0xff) * 0x40]; - uint16_t *const dest = &bitmap.pix16(y & 0xff); + uint16_t *const dest = &bitmap.pix(y & 0xff); for (int i = 0; i < 0x40; i++) { uint8_t const data = source[i]; diff --git a/src/mame/drivers/informer_207_100.cpp b/src/mame/drivers/informer_207_100.cpp index 00bdf4d1b0d..932eeccd41a 100644 --- a/src/mame/drivers/informer_207_100.cpp +++ b/src/mame/drivers/informer_207_100.cpp @@ -8,15 +8,15 @@ Hardware: - HD68B09EP - - 3x HM6116LP-4 (+ 3 empty sockets), 2x TC5517BPL-20 + - 3x HM6116LP-4 (+ 3 empty sockets), 2x TC5517BPL-20 - R6545-1AP CRTC - - MC2681P DUART + - MC2681P DUART - MC68B50P ACIA - M58321 RTC - - 19.7184 MHz XTAL, 3.6864 MHz XTAL + - 19.7184 MHz XTAL, 3.6864 MHz XTAL TODO: - - Redump ROM 207_100_2.bin + - Redump ROM 207_100_2.bin ***************************************************************************/ @@ -69,6 +69,7 @@ private: void mem_map(address_map &map); + MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); MC6845_UPDATE_ROW(crtc_update_row); }; @@ -81,6 +82,10 @@ void informer_207_100_state::mem_map(address_map &map) { map(0x0000, 0x27ff).ram().share("ram"); map(0xc000, 0xffff).rom().region("maincpu", 0); + map(0xff00, 0xff0f).rw(m_duart, FUNC(scn2681_device::read), FUNC(scn2681_device::write)); + map(0xff20, 0xff20).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w)); + map(0xff21, 0xff21).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); + map(0xff40, 0xff41).rw(m_acia, FUNC(acia6850_device::read), FUNC(acia6850_device::write)); } @@ -96,8 +101,34 @@ INPUT_PORTS_END // VIDEO EMULATION //************************************************************************** +MC6845_ON_UPDATE_ADDR_CHANGED( informer_207_100_state::crtc_addr ) +{ +// m_video_update_address = address; +} + MC6845_UPDATE_ROW( informer_207_100_state::crtc_update_row ) { + pen_t const *const pen = m_palette->pens(); + + for (int x = 0; x < x_count; x++) + { +// uint8_t attr = m_ram[ma + x * 2 + 0]; + uint8_t code = m_ram[ma + x * 2 + 1]; + uint8_t data = m_chargen[(code << 4) + ra]; + + if (x == cursor_x) + data = 0xff; + + // draw 8 pixels of the character + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; + } } static const gfx_layout char_layout = @@ -126,6 +157,8 @@ void informer_207_100_state::machine_start() void informer_207_100_state::machine_reset() { + // start executing somewhere sane + m_maincpu->set_pc(0xc000); } @@ -147,10 +180,7 @@ void informer_207_100_state::informer_207_100(machine_config &config) // video SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_color(rgb_t::green()); - m_screen->set_size(640, 480); - m_screen->set_visarea_full(); - m_screen->set_refresh_hz(60); -// m_screen->set_raw(19.7184_MHz_XTAL, 0, 0, 0, 0, 0, 0); + m_screen->set_raw(19.7184_MHz_XTAL, 832, 0, 640, 316, 0, 300); m_screen->set_screen_update("crtc", FUNC(mc6845_device::screen_update)); PALETTE(config, m_palette, palette_device::MONOCHROME); @@ -161,6 +191,7 @@ void informer_207_100_state::informer_207_100(machine_config &config) m_crtc->set_screen("screen"); m_crtc->set_show_border_area(false); m_crtc->set_char_width(8); + m_crtc->set_on_update_addr_change_callback(FUNC(informer_207_100_state::crtc_addr)); m_crtc->set_update_row_callback(FUNC(informer_207_100_state::crtc_update_row)); } @@ -178,7 +209,7 @@ ROM_START( in207100 ) ROM_REGION(0x1000, "chargen", 0) // 79496 REV 1.01 12-29-83 - ROM_LOAD("79496.bin", 0x0000, 0x1000, CRC(930AC23A) SHA1(74e6bf81b60e3504cb2b9f14a33e7c3e367dc825)) + ROM_LOAD("79496.bin", 0x0000, 0x1000, CRC(930ac23a) SHA1(74e6bf81b60e3504cb2b9f14a33e7c3e367dc825)) ROM_END diff --git a/src/mame/drivers/informer_207_376.cpp b/src/mame/drivers/informer_207_376.cpp index f4ed3c68f21..a10483728d3 100644 --- a/src/mame/drivers/informer_207_376.cpp +++ b/src/mame/drivers/informer_207_376.cpp @@ -8,17 +8,17 @@ Hardware: - M6809 - - 8253 PIT + - 8253 PIT - Z80SCC 8530 - 2x 6850 ACIA (up to 4) - 2x X2212P NOVRAM TODO: - - Dump keyboard controller and emulate it (currently HLE'd) - - Problably needs improvements to at least the Z80SCC to - properly support synchrous modes + - Dump keyboard controller and emulate it (currently HLE'd) + - Problably needs improvements to at least the Z80SCC to + properly support synchrous modes - Figure out the unknown bits at 0x8400 - - Verify clock speeds + - Verify clock speeds Notes: - Thanks to charcole and his zmachine3270 project at @@ -139,11 +139,11 @@ void informer_207_376_state::crt_brightness_w(uint8_t data) MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int x = 0; x < x_count; x++) { - uint8_t code = m_ram[ma + x]; + uint8_t const code = m_ram[ma + x]; uint8_t data = m_chargen[(code << 4) + ra]; if (x == cursor_x) @@ -154,14 +154,14 @@ MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row ) data = 0xff; // draw 8 pixels of the character - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; } } diff --git a/src/mame/drivers/informer_213.cpp b/src/mame/drivers/informer_213.cpp index 4c2551bfabf..f6d9268bbd8 100644 --- a/src/mame/drivers/informer_213.cpp +++ b/src/mame/drivers/informer_213.cpp @@ -3,30 +3,32 @@ /*************************************************************************** Informer 213 (IBM 374/SNA V.22) - Informer 213 AE (VT-100) + Informer 213 AE (VT-100) Hardware: - EF68B09EP - - 2x TC5564PL-15 [8k] (next to CG ROM) - - 1x TC5565APL-15 [8k] + 2x TMS4464-15NL [32k] (next to CPU) - - Z0853006PSC SCC - - ASIC (INFORMER 44223) - - 18.432 MHz XTAL + - 2x TC5564PL-15 [8k] (next to CG ROM) + - 1x TC5565APL-15 [8k] + 2x TMS4464-15NL [32k] (next to CPU) + - Z0853006PSC SCC + - ASIC (INFORMER 44223) + - 18.432 MHz XTAL TODO: - - Figure out the ASIC and how it's connected - - Notes: - - Debug tricks (AE): "b@42=ff" after startup to show setup screen 1 - "bp 81a1" then "b@42=ff" and "a=02" after the break to show screen 2 + - Figure out the ASIC and how it's connected ***************************************************************************/ #include "emu.h" #include "cpu/m6809/m6809.h" +#include "machine/nvram.h" #include "machine/z80scc.h" +#include "machine/informer_213_kbd.h" +#include "bus/rs232/rs232.h" +#include "bus/rs232/printer.h" +#include "sound/beep.h" #include "emupal.h" #include "screen.h" +#include "speaker.h" //************************************************************************** @@ -39,9 +41,12 @@ public: informer_213_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_nvram(*this, "nvram%u", 0U), m_screen(*this, "screen"), m_palette(*this, "palette"), m_scc(*this, "scc"), + m_beep(*this, "beep"), + m_nvram_bank(*this, "banked"), m_vram(*this, "vram"), m_aram(*this, "aram"), m_chargen(*this, "chargen") @@ -55,9 +60,12 @@ protected: private: required_device<cpu_device> m_maincpu; + required_device_array<nvram_device, 2> m_nvram; required_device<screen_device> m_screen; required_device<palette_device> m_palette; required_device<scc8530_device> m_scc; + required_device<beep_device> m_beep; + required_memory_bank m_nvram_bank; required_shared_ptr<uint8_t> m_vram; required_shared_ptr<uint8_t> m_aram; required_region_ptr<uint8_t> m_chargen; @@ -65,6 +73,30 @@ private: void mem_map(address_map &map); uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vblank_w(int state); + void vram_start_addr_w(offs_t offset, uint8_t data); + void vram_end_addr_w(offs_t offset, uint8_t data); + void vram_start_addr2_w(offs_t offset, uint8_t data); + void cursor_addr_w(offs_t offset, uint8_t data); + void cursor_start_w(uint8_t data); + void cursor_end_w(uint8_t data); + void screen_ctrl_w(uint8_t data); + + void bell_w(uint8_t data); + + void kbd_int_w(int state); + uint8_t firq_vector_r(); + + std::unique_ptr<uint8_t[]> m_banked_ram; + + uint16_t m_vram_start_addr; + uint16_t m_vram_end_addr; + uint16_t m_vram_start_addr2; + uint8_t m_cursor_start; + uint8_t m_cursor_end; + uint16_t m_cursor_addr; + uint8_t m_screen_ctrl; + uint8_t m_firq_vector; }; @@ -74,12 +106,24 @@ private: void informer_213_state::mem_map(address_map &map) { - map(0x0000, 0x1fff).ram(); - map(0x2000, 0x3fff).ram(); - map(0x4000, 0x5fff).ram(); + map(0x0000, 0x0000).rw("kbd", FUNC(informer_213_kbd_hle_device::read), FUNC(informer_213_kbd_hle_device::write)); + map(0x0006, 0x0007).unmapr().w(FUNC(informer_213_state::vram_start_addr_w)); + map(0x0008, 0x0009).unmapr().w(FUNC(informer_213_state::vram_end_addr_w)); + map(0x000a, 0x000b).unmapr().w(FUNC(informer_213_state::vram_start_addr2_w)); + map(0x000d, 0x000d).unmapr().w(FUNC(informer_213_state::cursor_start_w)); + map(0x000e, 0x000e).unmapr().w(FUNC(informer_213_state::cursor_end_w)); + map(0x000f, 0x0010).unmapr().w(FUNC(informer_213_state::cursor_addr_w)); + map(0x0021, 0x0021).w(FUNC(informer_213_state::screen_ctrl_w)); + map(0x0040, 0x0043).rw(m_scc, FUNC(scc85c30_device::ab_dc_r), FUNC(scc85c30_device::ab_dc_w)); + map(0x0060, 0x0060).w(FUNC(informer_213_state::bell_w)); + map(0x0100, 0x03ff).ram().share("nvram0"); // might not be all nvram + map(0x0400, 0x07ff).bankrw("banked"); // unknown size, data written 0x540 to 0x749 + map(0x0800, 0x5fff).ram(); map(0x6000, 0x6fff).ram().share("vram"); map(0x7000, 0x7fff).ram().share("aram"); map(0x8000, 0xffff).rom().region("maincpu", 0); + map(0xfff7, 0xfff7).r(FUNC(informer_213_state::firq_vector_r)); + map(0xfff9, 0xfff9).lr8(NAME([this] () { return m_scc->m1_r(); })); // irq vector } @@ -99,33 +143,71 @@ uint32_t informer_213_state::screen_update(screen_device &screen, bitmap_rgb32 & { offs_t chargen_base = (m_chargen.bytes() == 0x4000) ? 0x2000 : 0; + // line at which vram splits into two windows + int split = 24 - ((m_vram_start_addr2 - m_vram_start_addr) / 80); + for (int y = 0; y < 26; y++) { + uint8_t line_attr = 0; + for (int x = 0; x < 80; x++) { - // screen memory starts at 0x6820 - uint8_t code = m_vram[26 * 80 + y * 80 + x]; -// uint8_t attr = m_aram[26 * 80 + y * 80 + x]; + uint16_t addr; - // but status line is at top of vram - if (y > 23) - { - code = m_vram[(y - 24) * 80 + x]; -// attr = m_aram[(y - 24) * 80 + x]; - } + // vram is split into 3 areas: display window 1, display window 2, status bar + if (y >= 24) + addr = 0x6000 + (y - 24) * 80 + x; + else if (y >= split) + addr = m_vram_start_addr + (y - split) * 80 + x; + else + addr = m_vram_start_addr2 + y * 80 + x; + + uint8_t code = m_vram[addr - 0x6000]; + uint8_t attr = m_aram[addr - 0x6000]; + + if (code == 0xc0 || code == 0xe8) + line_attr = attr; // draw 9 lines for (int i = 0; i < 9; i++) { uint8_t data = m_chargen[chargen_base | ((code << 4) + i)]; + // conceal + if (line_attr & 0x08 || attr & 0x08) + data = 0x00; + + // reverse video + if (line_attr & 0x10 || attr & 0x10) + data ^= 0xff; + + // underline (not supported by terminal?) + if (line_attr & 0x20 || attr & 0x20) + data = +data; + + // blink (todo: timing) + if (line_attr & 0x40 || attr & 0x40) + data = m_screen->frame_number() & 0x20 ? 0x00 :data; + + if (code == 0xc0 || code == 0xe8) + data = 0; + + if (BIT(m_screen_ctrl, 5)) + data ^= 0xff; + + // cursor + if (BIT(m_cursor_start, 5) == 1 && addr == m_cursor_addr && y < 24) + if (i >= (m_cursor_start & 0x0f) && i < (m_cursor_end & 0x0f)) + if (!(BIT(m_screen_ctrl, 4) == 0 && (m_screen->frame_number() & 0x20))) + data = 0xff; + // 6 pixels of the character - bitmap.pix32(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 2) = BIT(data, 5) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 3) = BIT(data, 4) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 4) = BIT(data, 3) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 5) = BIT(data, 2) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 2) = BIT(data, 5) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 3) = BIT(data, 4) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 4) = BIT(data, 3) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 5) = BIT(data, 2) ? rgb_t::white() : rgb_t::black(); } } } @@ -133,6 +215,96 @@ uint32_t informer_213_state::screen_update(screen_device &screen, bitmap_rgb32 & return 0; } +void informer_213_state::vram_start_addr_w(offs_t offset, uint8_t data) +{ + if (offset) + m_vram_start_addr = (m_vram_start_addr & 0xff00) | (data << 0); + else + m_vram_start_addr = (m_vram_start_addr & 0x00ff) | (data << 8); + + if (offset) + logerror("vram_start_addr_w: %04x\n", m_vram_start_addr); +} + +void informer_213_state::vram_end_addr_w(offs_t offset, uint8_t data) +{ + if (offset) + m_vram_end_addr = (m_vram_end_addr & 0xff00) | (data << 0); + else + m_vram_end_addr = (m_vram_end_addr & 0x00ff) | (data << 8); + + if (offset) + logerror("vram_end_addr_w: %04x\n", m_vram_end_addr); +} + +void informer_213_state::vram_start_addr2_w(offs_t offset, uint8_t data) +{ + if (offset) + m_vram_start_addr2 = (m_vram_start_addr2 & 0xff00) | (data << 0); + else + m_vram_start_addr2 = (m_vram_start_addr2 & 0x00ff) | (data << 8); + + if (offset) + logerror("vram_start_addr2_w: %04x\n", m_vram_start_addr2); +} + +void informer_213_state::cursor_start_w(uint8_t data) +{ + logerror("cursor_start_w: %02x\n", data); + + // 76------ unknown + // --5----- cursor visible + // ---4---- unknown + // ----3210 cursor starting line, values seen: 0 (block/off), 6 (underline) + + m_cursor_start = data; +} + +void informer_213_state::cursor_end_w(uint8_t data) +{ + logerror("cursor_end_w: %02x\n", data); + + // 7654---- unknown + // ----3210 cursor ending line, values seen: 9 (block), 8 (underline), 1 (off) + + m_cursor_end = data; +} + +void informer_213_state::cursor_addr_w(offs_t offset, uint8_t data) +{ + if (offset) + m_cursor_addr = (m_cursor_addr & 0xff00) | (data << 0); + else + m_cursor_addr = (m_cursor_addr & 0x00ff) | (data << 8); + + if (offset) + logerror("cursor_addr_w: %04x\n", m_cursor_addr); +} + +void informer_213_state::screen_ctrl_w(uint8_t data) +{ + logerror("screen_ctrl_w: %02x\n", data); + + // 76------ unknown + // --5----- screen reverse + // ---4---- cursor blink/steady + // ----3210 unknown + + m_screen_ctrl = data; +} + +void informer_213_state::vblank_w(int state) +{ + if (state) + { + // real source if this interrupt is unknown, deactivated for now +#if 0 + m_firq_vector = 0x10; + m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); +#endif + } +} + static const gfx_layout char_layout = { 6,9, @@ -153,12 +325,52 @@ GFXDECODE_END // MACHINE EMULATION //************************************************************************** +void informer_213_state::bell_w(uint8_t data) +{ + logerror("bell_w: %02x\n", data); + + // 7654---- unknown + // ----3--- ram bank + // -----2-- beeper + // ------10 unknown + + m_beep->set_state(BIT(data, 2)); + m_nvram_bank->set_entry(BIT(data, 3)); +} + +void informer_213_state::kbd_int_w(int state) +{ + m_firq_vector = 0x14; + m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); +} + +uint8_t informer_213_state::firq_vector_r() +{ + uint8_t tmp = m_firq_vector; + m_firq_vector = 0x00; + + return tmp; +} + void informer_213_state::machine_start() { + m_banked_ram = make_unique_clear<uint8_t[]>(0x800); + membank("banked")->configure_entries(0, 2, m_banked_ram.get(), 0x400); + + m_nvram[1]->set_base(m_banked_ram.get(), 0x800); + + // register for save states + save_item(NAME(m_vram_start_addr)); + save_item(NAME(m_vram_start_addr2)); + save_item(NAME(m_vram_end_addr)); + save_item(NAME(m_cursor_addr)); + save_item(NAME(m_screen_ctrl)); + save_item(NAME(m_firq_vector)); } void informer_213_state::machine_reset() { + m_firq_vector = 0x00; } @@ -166,12 +378,32 @@ void informer_213_state::machine_reset() // MACHINE DEFINTIONS //************************************************************************** +void in213_printer_devices(device_slot_interface &device) +{ + device.option_add("printer", SERIAL_PRINTER); +} + void informer_213_state::informer_213(machine_config &config) { MC6809(config, m_maincpu, 18.432_MHz_XTAL / 4); // unknown clock m_maincpu->set_addrmap(AS_PROGRAM, &informer_213_state::mem_map); - SCC8530N(config, m_scc, 0); // unknown clock + NVRAM(config, m_nvram[0], nvram_device::DEFAULT_ALL_0); + NVRAM(config, m_nvram[1], nvram_device::DEFAULT_ALL_0); + + SCC8530N(config, m_scc, 18.432_MHz_XTAL / 5); + m_scc->out_txda_callback().set("host", FUNC(rs232_port_device::write_txd)); + m_scc->out_dtra_callback().set("host", FUNC(rs232_port_device::write_dtr)); + m_scc->out_rtsa_callback().set("host", FUNC(rs232_port_device::write_rts)); + m_scc->out_txdb_callback().set("printer", FUNC(rs232_port_device::write_txd)); + m_scc->out_int_callback().set_inputline(m_maincpu, M6809_IRQ_LINE); + + rs232_port_device &rs232_host(RS232_PORT(config, "host", default_rs232_devices, nullptr)); + rs232_host.rxd_handler().set(m_scc, FUNC(scc85c30_device::rxa_w)); + rs232_host.dcd_handler().set(m_scc, FUNC(scc85c30_device::dcda_w)); + rs232_host.cts_handler().set(m_scc, FUNC(scc85c30_device::ctsa_w)); + + RS232_PORT(config, "printer", in213_printer_devices, nullptr); // video SCREEN(config, m_screen, SCREEN_TYPE_LCD); @@ -179,12 +411,21 @@ void informer_213_state::informer_213(machine_config &config) m_screen->set_size(480, 234); m_screen->set_visarea_full(); m_screen->set_refresh_hz(60); -// m_screen->set_raw(18.432_MHz_XTAL, 0, 0, 0, 0, 0, 0); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate +// m_screen->set_raw(18.432_MHz_XTAL, 0, 0, 0, 0, 0, 0); m_screen->set_screen_update(FUNC(informer_213_state::screen_update)); + m_screen->screen_vblank().set(FUNC(informer_213_state::vblank_w)); PALETTE(config, m_palette, palette_device::MONOCHROME); GFXDECODE(config, "gfxdecode", m_palette, chars); + + // sound + SPEAKER(config, "mono").front_center(); + BEEP(config, "beep", 500).add_route(ALL_OUTPUTS, "mono", 0.50); // frequency unknown + + informer_213_kbd_hle_device &kbd(INFORMER_213_KBD_HLE(config, "kbd")); + kbd.int_handler().set(FUNC(informer_213_state::kbd_int_w)); } @@ -218,5 +459,5 @@ ROM_END //************************************************************************** // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1990, in213 , 0, 0, informer_213, informer_213, informer_213_state, empty_init, "Informer", "Informer 213", MACHINE_IS_SKELETON | MACHINE_SUPPORTS_SAVE ) -COMP( 1992, in213ae, 0, 0, informer_213, informer_213, informer_213_state, empty_init, "Informer", "Informer 213 AE", MACHINE_IS_SKELETON | MACHINE_SUPPORTS_SAVE ) +COMP( 1990, in213 , 0, 0, informer_213, informer_213, informer_213_state, empty_init, "Informer", "Informer 213", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1992, in213ae, 0, 0, informer_213, informer_213, informer_213_state, empty_init, "Informer", "Informer 213 AE", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/instruct.cpp b/src/mame/drivers/instruct.cpp index af29922cd67..9d57c095809 100644 --- a/src/mame/drivers/instruct.cpp +++ b/src/mame/drivers/instruct.cpp @@ -2,14 +2,14 @@ // copyright-holders:Robbbert /*************************************************************************** - Signetics Intructor 50 +Signetics Intructor 50 - 2010-04-08 Skeleton driver. - 2012-05-20 Connected digits, system boots. [Robbbert] - 2012-05-20 Connected keyboard, system mostly usable. [Robbbert] - 2013-10-15 Fixed various regressions. [Robbbert] +2010-04-08 Skeleton driver. +2012-05-20 Connected digits, system boots. [Robbbert] +2012-05-20 Connected keyboard, system mostly usable. [Robbbert] +2013-10-15 Fixed various regressions. [Robbbert] - From looking at a blurry picture of it, this is what I can determine: +From looking at a blurry picture of it, this is what I can determine: - Left side: 8 toggle switches, with a round red led above each one. - Below this is the Port Address Switch with choice of 'Non-Extended', 'Extended' or 'Memory'. - To the right of this is another toggle switch labelled 'Interrupt', the @@ -25,14 +25,18 @@ MIC and EAR cords to a cassette player. - At the back is a S100 interface. - Quick usage: +Quick usage: - Look at memory: Press minus key. Enter an address. Press UP key to see the next. - Look at registers: Press R. Press 0. Press UP key to see the next. - Set PC register: Press R. Press C. Type in new address, Press UP. - Load a tape: Press L, enter file number (1 digit), press UP. On completion of a successful load, HELLO will be displayed. - ToDO: +Pasting a test program: (page 2-4 of the user manual, modified) + - Paste this: QRF0^751120F005000620FA7EF97A84011F0003-0P + - You should see the LEDs flashing as they count upwards. + +ToDO: - Connect round led for Run. - Last Address Register - Initial Jump Logic diff --git a/src/mame/drivers/invqix.cpp b/src/mame/drivers/invqix.cpp index d25b321c04c..6a51d9e74c6 100644 --- a/src/mame/drivers/invqix.cpp +++ b/src/mame/drivers/invqix.cpp @@ -174,8 +174,6 @@ void invqix_state::video_start() uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - // this means freeze or blank or something if (m_vctl == 0x100) { @@ -184,45 +182,39 @@ uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap if (m_vctl == 0x0000) { - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t r,g,b; - int pen_data; - - pen_data = (m_vram[(x+y*256)]); - b = (pen_data & 0x001f); - g = (pen_data & 0x03e0) >> 5; - r = (pen_data & 0x7c00) >> 10; + int pen_data = (m_vram[(x+y*256)]); + uint8_t b = (pen_data & 0x001f); + uint8_t g = (pen_data & 0x03e0) >> 5; + uint8_t r = (pen_data & 0x7c00) >> 10; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } else if (m_vctl == 0x0001) // flip { - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t r,g,b; - int pen_data; - - pen_data = (m_vram[(256-x)+((256-y)*256)]); - b = (pen_data & 0x001f); - g = (pen_data & 0x03e0) >> 5; - r = (pen_data & 0x7c00) >> 10; + int pen_data = (m_vram[(256-x)+((256-y)*256)]); + uint8_t b = (pen_data & 0x001f); + uint8_t g = (pen_data & 0x03e0) >> 5; + uint8_t r = (pen_data & 0x7c00) >> 10; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/drivers/ipds.cpp b/src/mame/drivers/ipds.cpp index 1e25739e3f9..cd6379ed07e 100644 --- a/src/mame/drivers/ipds.cpp +++ b/src/mame/drivers/ipds.cpp @@ -92,8 +92,7 @@ void ipds_state::machine_reset() I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t *charmap = memregion("chargen")->base(); uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -106,8 +105,8 @@ I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + for(int i=0;i<6;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp index e986c5562c2..0a51a6b624e 100644 --- a/src/mame/drivers/irisha.cpp +++ b/src/mame/drivers/irisha.cpp @@ -207,17 +207,15 @@ INPUT_PORTS_END uint32_t irisha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx; - uint16_t y,ma=0,x; - uint16_t *p; + uint16_t ma=0; - for (y = 0; y < 200; y++) + for (uint16_t y = 0; y < 200; y++) { - p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = ma; x < ma+40; x++) + for (uint16_t x = ma; x < ma+40; x++) { - gfx = m_p_videoram[x]; + uint8_t const gfx = m_p_videoram[x]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/istellar.cpp b/src/mame/drivers/istellar.cpp index 687be6f0e79..1f546d3be55 100644 --- a/src/mame/drivers/istellar.cpp +++ b/src/mame/drivers/istellar.cpp @@ -26,7 +26,6 @@ Todo: #include "machine/gen_latch.h" #include "machine/ldv1000.h" #include "emupal.h" -#include "render.h" #include "speaker.h" diff --git a/src/mame/drivers/istrebiteli.cpp b/src/mame/drivers/istrebiteli.cpp index a1ba11ca972..065c5329159 100644 --- a/src/mame/drivers/istrebiteli.cpp +++ b/src/mame/drivers/istrebiteli.cpp @@ -45,7 +45,7 @@ protected: virtual void device_start() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state @@ -81,15 +81,15 @@ istrebiteli_sound_device::istrebiteli_sound_device(const machine_config &mconfig void istrebiteli_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, clock() / 2); + m_channel = stream_alloc(0, 1, clock() / 2); m_rom = machine().root_device().memregion("soundrom")->base(); } -void istrebiteli_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void istrebiteli_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *sample = outputs[0]; + auto &buffer = outputs[0]; - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int smpl = 0; if (m_rom_out_en) @@ -100,7 +100,7 @@ void istrebiteli_sound_device::sound_stream_update_legacy(sound_stream &stream, smpl &= machine().rand() & 1; smpl *= (m_prev_data & 0x80) ? 1000 : 4000; // b7 volume ? - *sample++ = smpl; + buffer.put_int(sampindex, smpl, 32768); m_rom_cnt = (m_rom_cnt + m_rom_incr) & 0x1ff; } } diff --git a/src/mame/drivers/itgambl2.cpp b/src/mame/drivers/itgambl2.cpp index 61b39d63c18..26d1107f089 100644 --- a/src/mame/drivers/itgambl2.cpp +++ b/src/mame/drivers/itgambl2.cpp @@ -145,7 +145,7 @@ uint32_t itgambl2_state::screen_update_itgambl2(screen_device &screen, bitmap_rg uint32_t const color = (blit_ram[count] & 0xff) >> 0; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/itgambl3.cpp b/src/mame/drivers/itgambl3.cpp index 894145657f8..ea119054d62 100644 --- a/src/mame/drivers/itgambl3.cpp +++ b/src/mame/drivers/itgambl3.cpp @@ -92,8 +92,7 @@ void itgambl3_state::video_start() /* (dirty) debug code for looking 8bpps blitter-based gfxs */ uint32_t itgambl3_state::screen_update_itgambl3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - const uint8_t *blit_ram = memregion("gfx1")->base(); + uint8_t const *const blit_ram = memregion("gfx1")->base(); if(machine().input().code_pressed(KEYCODE_Z)) m_test_x++; @@ -123,18 +122,16 @@ uint32_t itgambl3_state::screen_update_itgambl3(screen_device &screen, bitmap_rg bitmap.fill(m_palette->black_pen(), cliprect); - count = (m_start_offs); + int count = m_start_offs; - for(y=0;y<m_test_y;y++) + for(int y=0;y<m_test_y;y++) { - for(x=0;x<m_test_x;x++) + for(int x=0;x<m_test_x;x++) { - uint32_t color; - - color = (blit_ram[count] & 0xff)>>0; + uint32_t color = (blit_ram[count] & 0xff)>>0; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/itt1700.cpp b/src/mame/drivers/itt1700.cpp index ec993830f2d..f9d9cb41f04 100644 --- a/src/mame/drivers/itt1700.cpp +++ b/src/mame/drivers/itt1700.cpp @@ -51,7 +51,7 @@ private: MC6845_UPDATE_ROW(itt1700_state::update_row) { - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); u16 page = 0x800; for (int i = 0; i < x_count; i++) diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 789343aa3dc..7888971b5a2 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -193,7 +193,7 @@ uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); - uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); + uint16_t *dst = &m_tmp_bitmap->pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/drivers/jantotsu.cpp b/src/mame/drivers/jantotsu.cpp index 200b8339b36..41912c6a542 100644 --- a/src/mame/drivers/jantotsu.cpp +++ b/src/mame/drivers/jantotsu.cpp @@ -166,28 +166,23 @@ void jantotsu_state::video_start() uint32_t jantotsu_state::screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y, i; - int count = 0; - uint8_t pen_i; - if(!m_display_on) return 0; - for (y = 0; y < 256; y++) + int count = 0; + for (int y = 0; y < 256; y++) { - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - uint8_t color; - - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - color = m_col_bank; + uint8_t color = m_col_bank; - for(pen_i = 0;pen_i<4;pen_i++) + for (uint8_t pen_i = 0;pen_i<4;pen_i++) color |= (((m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << pen_i; if (cliprect.contains(x + i, y)) - bitmap.pix32(y, x + i) = m_palette->pen(color); + bitmap.pix(y, x + i) = m_palette->pen(color); } count++; diff --git a/src/mame/drivers/jchan.cpp b/src/mame/drivers/jchan.cpp index 37a642da4cc..412ef71848c 100644 --- a/src/mame/drivers/jchan.cpp +++ b/src/mame/drivers/jchan.cpp @@ -323,10 +323,10 @@ u32 jchan_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons // TODO : verify sprite-tile priorities from real hardware, Check what 15 bit of palette actually working for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16* src1 = &m_sprite_bitmap[0]->pix16(y); - const u16* src2 = &m_sprite_bitmap[1]->pix16(y); - u8 *tilepri = &tile_primap->pix8(y); - u16* dst = &bitmap.pix16(y); + u16 const *const src1 = &m_sprite_bitmap[0]->pix(y); + u16 const *const src2 = &m_sprite_bitmap[1]->pix(y); + u8 *const tilepri = &tile_primap->pix(y); + u16 *const dst = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/jollyjgr.cpp b/src/mame/drivers/jollyjgr.cpp index 4c2bfccea69..d413146df0f 100644 --- a/src/mame/drivers/jollyjgr.cpp +++ b/src/mame/drivers/jollyjgr.cpp @@ -514,13 +514,13 @@ void jollyjgr_state::draw_bitmap(bitmap_rgb32 &bitmap) if (color) { if (m_flip_x && m_flip_y) - bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color); + bitmap.pix(y, x * 8 + i) = m_bm_palette->pen_color(color); else if (m_flip_x && !m_flip_y) - bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); + bitmap.pix(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); else if (!m_flip_x && m_flip_y) - bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); + bitmap.pix(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); else - bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); + bitmap.pix(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); } } @@ -602,7 +602,7 @@ uint32_t jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_rgb if (sy>=cliprect.min_y && sy<=cliprect.max_y) for (int x=sx-4;x<sx;x++) if (x>=cliprect.min_x && x<=cliprect.max_x) - bitmap.pix32(sy, x) = m_bm_palette->pen_color(bc); + bitmap.pix(sy, x) = m_bm_palette->pen_color(bc); } return 0; diff --git a/src/mame/drivers/jongkyo.cpp b/src/mame/drivers/jongkyo.cpp index 1193f11fa83..98f8ed1d3b0 100644 --- a/src/mame/drivers/jongkyo.cpp +++ b/src/mame/drivers/jongkyo.cpp @@ -98,18 +98,10 @@ void jongkyo_state::video_start() uint32_t jongkyo_state::screen_update_jongkyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - - for (y = 0; y < 256; ++y) + for (int y = 0; y < 256; ++y) { - int x; - - for (x = 0; x < 256; x += 4) + for (int x = 0; x < 256; x += 4) { - int b; - int res_x,res_y; - uint8_t data1; - uint8_t data2; uint8_t data3; // data3 = m_videoram2[x/4 + y*64]; // wrong @@ -120,15 +112,14 @@ uint32_t jongkyo_state::screen_update_jongkyo(screen_device &screen, bitmap_ind1 // data3 = 0x00; // we're missing 2 bits.. there must be another piece of video ram somewhere or we can't use all the colours (6bpp).. banked somehow? + uint8_t data1 = m_videoram[0x4000 + x / 4 + y * 64]; + uint8_t data2 = m_videoram[x / 4 + y * 64]; - data1 = m_videoram[0x4000 + x / 4 + y * 64]; - data2 = m_videoram[x / 4 + y * 64]; - - for (b = 0; b < 4; ++b) + for (int b = 0; b < 4; ++b) { - res_x = m_flip_screen ? 255 - (x + b) : (x + b); - res_y = m_flip_screen ? 255 - y : y; - bitmap.pix16(res_y, res_x) = ((data2 & 0x01)) + ((data2 & 0x10) >> 3) + + int const res_x = m_flip_screen ? 255 - (x + b) : (x + b); + int const res_y = m_flip_screen ? 255 - y : y; + bitmap.pix(res_y, res_x) = ((data2 & 0x01)) + ((data2 & 0x10) >> 3) + ((data1 & 0x01) << 2) + ((data1 & 0x10) >> 1) + ((data3 & 0x01) << 4) + ((data3 & 0x10) << 1); data1 >>= 1; diff --git a/src/mame/drivers/jonos.cpp b/src/mame/drivers/jonos.cpp index 2009928dd76..ea499a758d3 100644 --- a/src/mame/drivers/jonos.cpp +++ b/src/mame/drivers/jonos.cpp @@ -124,23 +124,23 @@ void jonos_state::machine_reset() uint32_t jonos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_framecnt++; - u8 y,ra,chr,gfx,inv; - u16 sy=0,x; + u16 sy=0; u16 ma = (m_p_videoram[0x7da] + (m_p_videoram[0x7db] << 8)) & 0x7ff; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); u16 cpos = y << 8; - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - inv = (BIT(chr, 7) ^ ((cpos == m_curs_pos) && BIT(m_framecnt, 5))) ? 0xff : 0; + u8 chr = m_p_videoram[x]; + u8 inv = (BIT(chr, 7) ^ ((cpos == m_curs_pos) && BIT(m_framecnt, 5))) ? 0xff : 0; chr &= 0x7f; + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra ] ^ inv; else diff --git a/src/mame/drivers/joystand.cpp b/src/mame/drivers/joystand.cpp index 049ffbf1421..0fa58107e82 100644 --- a/src/mame/drivers/joystand.cpp +++ b/src/mame/drivers/joystand.cpp @@ -253,7 +253,7 @@ void joystand_state::bg2_w(offs_t offset, uint16_t data, uint16_t mem_mask) void joystand_state::bg15_0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { uint16_t val = COMBINE_DATA(&m_bg15_0_ram[offset]); - m_bg15_bitmap[0].pix32(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + m_bg15_bitmap[0].pix(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); } // tile-based @@ -268,7 +268,7 @@ void joystand_state::draw_bg15_tile(address_space &space, int x, int y, uint16_t for (int tx = 0; tx < 16; ++tx) { uint16_t val = space.read_word(srcaddr + ty * 16 * 2 + tx * 2); - m_bg15_bitmap[1].pix32(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + m_bg15_bitmap[1].pix(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); } } } diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp index b203c7d6330..a0f4bad7093 100644 --- a/src/mame/drivers/jpmsys5.cpp +++ b/src/mame/drivers/jpmsys5.cpp @@ -153,8 +153,6 @@ void jpmsys5v_state::ramdac_w(offs_t offset, uint16_t data) uint32_t jpmsys5v_state::screen_update_jpmsys5v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - m_tms34061->get_display_state(); if (m_tms34061->m_display.blanked) @@ -163,14 +161,14 @@ uint32_t jpmsys5v_state::screen_update_jpmsys5v(screen_device &screen, bitmap_rg return 0; } - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint8_t *src = &m_tms34061->m_display.vram[(m_tms34061->m_display.dispstart & 0xffff)*2 + 256 * y]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint8_t const *const src = &m_tms34061->m_display.vram[(m_tms34061->m_display.dispstart & 0xffff)*2 + 256 * y]; + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x +=2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x +=2) { - uint8_t pen = src[(x-cliprect.min_x)>>1]; + uint8_t const pen = src[(x-cliprect.min_x)>>1]; /* Draw two 4-bit pixels */ *dest++ = m_palette->pen((pen >> 4) & 0xf); diff --git a/src/mame/drivers/jr100.cpp b/src/mame/drivers/jr100.cpp index 8514b1f5f8d..748771028d0 100644 --- a/src/mame/drivers/jr100.cpp +++ b/src/mame/drivers/jr100.cpp @@ -170,10 +170,10 @@ INPUT_PORTS_START( jr100 ) PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE5") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y Locate") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U @ If") PORT_CODE(KEYCODE_U) PORT_CHAR('U') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U @ If") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('@') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I \xc2\xa5 Input") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [ Option") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ] Print") PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O [ Option") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('[') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ] Print") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR(']') PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE6") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H Poke") PORT_CODE(KEYCODE_H) PORT_CHAR('H') @@ -216,20 +216,19 @@ void jr100_state::machine_reset() uint32_t jr100_state::screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool attr; - u8 y,ra,gfx,chr; - u16 x,sy=0,ma=0; + u16 sy=0,ma=0; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - for (x = ma; x < ma + 32; x++) + uint16_t *p = &bitmap.pix(sy++); + for (u16 x = ma; x < ma + 32; x++) { - chr = m_vram[x]; - attr = BIT(chr, 7); + u8 chr = m_vram[x]; + bool const attr = BIT(chr, 7); chr &= 0x7f; + u8 gfx; // ATTR is inverted for normal char or use PCG in case of CMODE1 if (m_use_pcg && attr && (chr < 32)) gfx = m_pcg[(chr<<3) | ra]; @@ -401,7 +400,7 @@ void jr100_state::jr100(machine_config &config) m_via->irq_handler().set_inputline(m_maincpu, M6800_IRQ_LINE); SPEAKER(config, "mono").front_center(); - SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00); + SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50); CASSETTE(config, m_cassette, 0); m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED); diff --git a/src/mame/drivers/jr200.cpp b/src/mame/drivers/jr200.cpp index 80f08a50e21..eabbbd154b4 100644 --- a/src/mame/drivers/jr200.cpp +++ b/src/mame/drivers/jr200.cpp @@ -166,22 +166,21 @@ void jr200_state::video_start() uint32_t jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,xi,yi,pen; - bitmap.fill(m_border_col, cliprect); - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t tile = m_vram[x + y*32]; uint8_t attr = m_cram[x + y*32]; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - uint8_t *gfx_data; + const uint8_t *gfx_data; + int pen; if(attr & 0x80) //bitmap mode { @@ -209,7 +208,7 @@ uint32_t jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &b pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1) ? (attr & 0x7) : ((attr & 0x38) >> 3); } - bitmap.pix16(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); + bitmap.pix(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/jtc.cpp b/src/mame/drivers/jtc.cpp index ffd343f3f2c..7c425e7eb46 100644 --- a/src/mame/drivers/jtc.cpp +++ b/src/mame/drivers/jtc.cpp @@ -669,16 +669,14 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 i, y, sx; - - for (y = 0; y < 64; y++) + for (u8 y = 0; y < 64; y++) { - for (sx = 0; sx < 8; sx++) + for (u8 sx = 0; sx < 8; sx++) { - u8 data = m_video_ram[(y * 8) + sx]; + u8 const data = m_video_ram[(y * 8) + sx]; - for (i = 0; i < 8; i++) - bitmap.pix16(y, (sx * 8) + i) = BIT(data, 7-i); + for (u8 i = 0; i < 8; i++) + bitmap.pix(y, (sx * 8) + i) = BIT(data, 7-i); } } @@ -687,16 +685,14 @@ u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const u32 jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 i, y, sx; - - for (y = 0; y < 128; y++) + for (u8 y = 0; y < 128; y++) { - for (sx = 0; sx < 16; sx++) + for (u8 sx = 0; sx < 16; sx++) { - u8 data = m_video_ram[(y * 16) + sx]; + u8 const data = m_video_ram[(y * 16) + sx]; - for (i = 0; i < 8; i++) - bitmap.pix16(y, (sx * 8) + i) = BIT(data, 7-i); + for (u8 i = 0; i < 8; i++) + bitmap.pix(y, (sx * 8) + i) = BIT(data, 7-i); } } @@ -742,7 +738,7 @@ u32 jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co u8 const b = ~m_color_ram_b[ma + x]; for (int i = 0; i < 8; i++) - bitmap.pix16(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3); + bitmap.pix(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3); } ma+=40; } diff --git a/src/mame/drivers/juku.cpp b/src/mame/drivers/juku.cpp index 0ab5ca60f12..98ac5951af0 100644 --- a/src/mame/drivers/juku.cpp +++ b/src/mame/drivers/juku.cpp @@ -303,7 +303,7 @@ uint32_t juku_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (int y = 0; y < 240; y++) for (int x = 0; x < 320; x++) - bitmap.pix32(y, x) = BIT(m_ram[0xd800 + (y * (320 / 8) + x / 8)], 7 - (x % 8)) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = BIT(m_ram[0xd800 + (y * (320 / 8) + x / 8)], 7 - (x % 8)) ? rgb_t::white() : rgb_t::black(); return 0; } diff --git a/src/mame/drivers/jupace.cpp b/src/mame/drivers/jupace.cpp index 9c1d55bf969..455eef6f8c2 100644 --- a/src/mame/drivers/jupace.cpp +++ b/src/mame/drivers/jupace.cpp @@ -584,21 +584,19 @@ TIMER_DEVICE_CALLBACK_MEMBER(ace_state::clear_irq) uint32_t ace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=56,ma=0,x; - - for (y = 0; y < 24; y++) + uint16_t sy=56, ma=0; + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++, 40); + uint16_t *p = &bitmap.pix(sy++, 40); - for (x = ma; x < ma+32; x++) + for (uint16_t x = ma; x < ma+32; x++) { - chr = m_video_ram[x]; + uint8_t const chr = m_video_ram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + uint8_t const gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/jupiter.cpp b/src/mame/drivers/jupiter.cpp index 9c2692e6ebc..79ca7743019 100644 --- a/src/mame/drivers/jupiter.cpp +++ b/src/mame/drivers/jupiter.cpp @@ -202,21 +202,20 @@ void jupiter3_state::kbd_put(u8 data) uint32_t jupiter3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/k8915.cpp b/src/mame/drivers/k8915.cpp index 8e19debc68e..6f8f4bbd7d7 100644 --- a/src/mame/drivers/k8915.cpp +++ b/src/mame/drivers/k8915.cpp @@ -92,24 +92,23 @@ void k8915_state::machine_start() u32 k8915_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; /* Take care of flashing characters */ if ((chr & 0x80) && (m_framecnt & 0x08)) diff --git a/src/mame/drivers/karnov.cpp b/src/mame/drivers/karnov.cpp index 97b715a5fe0..776d40a70b3 100644 --- a/src/mame/drivers/karnov.cpp +++ b/src/mame/drivers/karnov.cpp @@ -202,45 +202,7 @@ void karnov_state::mcubl_p1_w(uint8_t data) // mcu simulation below -/* Emulation of the protected microcontroller - for coins & general protection */ -void karnov_state::karnov_i8751_w( int data ) -{ - /* Pending coin operations may cause protection commands to be queued */ - if (m_i8751_needs_ack) - { - m_i8751_command_queue = data; - return; - } - - m_i8751_return = 0; - - if (data == 0x100 && m_microcontroller_id == KARNOV) /* USA version */ - m_i8751_return = 0x56b; - - if (data == 0x100 && m_microcontroller_id == KARNOVJ) /* Japan version */ - m_i8751_return = 0x56a; - - if ((data & 0xf00) == 0x300) - m_i8751_return = (data & 0xff) * 0x12; /* Player sprite mapping */ - - /* I'm not sure the ones marked ^ appear in the right order */ - if (data == 0x400) m_i8751_return = 0x4000; /* Get The Map... */ - if (data == 0x402) m_i8751_return = 0x40a6; /* Ancient Ruins */ - if (data == 0x403) m_i8751_return = 0x4054; /* Forest... */ - if (data == 0x404) m_i8751_return = 0x40de; /* ^Rocky hills */ - if (data == 0x405) m_i8751_return = 0x4182; /* Sea */ - if (data == 0x406) m_i8751_return = 0x41ca; /* Town */ - if (data == 0x407) m_i8751_return = 0x421e; /* Desert */ - if (data == 0x401) m_i8751_return = 0x4138; /* ^Whistling wind */ - if (data == 0x408) m_i8751_return = 0x4276; /* ^Heavy Gates */ - -// if (!m_i8751_return && data != 0x300) logerror("%s - Unknown Write %02x intel\n", machine().describe_context(), data); - - m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ - m_i8751_needs_ack = 1; -} - -void karnov_state::wndrplnt_i8751_w( int data ) +void karnov_state::wndrplnt_mcu_w( uint16_t data ) { /* The last command hasn't been ACK'd (probably a conflict with coin command) */ if (m_i8751_needs_ack) @@ -305,7 +267,7 @@ void karnov_state::wndrplnt_i8751_w( int data ) * *************************************/ -void karnov_state::mcusim_ack_w(u16 data) +void karnov_state::wndrplnt_mcu_ack_w(u16 data) { m_maincpu->set_input_line(6, CLEAR_LINE); @@ -322,7 +284,7 @@ void karnov_state::mcusim_ack_w(u16 data) { /* Pending control command - just write it back as SECREQ */ m_i8751_needs_ack = 0; - mcusim_w(m_i8751_command_queue); + wndrplnt_mcu_w(m_i8751_command_queue); m_i8751_command_queue = 0; } else @@ -332,20 +294,12 @@ void karnov_state::mcusim_ack_w(u16 data) } } -u16 karnov_state::mcusim_r() +u16 karnov_state::wndrplnt_mcu_r() { return m_i8751_return; } -void karnov_state::mcusim_w(u16 data) -{ - if (m_microcontroller_id == KARNOV || m_microcontroller_id == KARNOVJ) - karnov_i8751_w(data); - if (m_microcontroller_id == WNDRPLNT) - wndrplnt_i8751_w(data); -} - -void karnov_state::mcusim_reset_w(u16 data) +void karnov_state::wndrplnt_mcu_reset_w(u16 data) { logerror("Reset i8751\n"); m_i8751_needs_ack = 0; @@ -376,23 +330,28 @@ void karnov_state::karnov_map(address_map &map) map(0x0a1000, 0x0a17ff).w(FUNC(karnov_state::playfield_w)).share("pf_data"); map(0x0a1800, 0x0a1fff).lw16([this](offs_t offset, u16 data, u16 mem_mask) { playfield_w(((offset & 0x1f) << 5) | ((offset & 0x3e0) >> 5), data, mem_mask); }, "pf_col_w"); - map(0x0c0000, 0x0c0001).portr("P1_P2").w(FUNC(karnov_state::mcusim_ack_w)); + map(0x0c0000, 0x0c0001).portr("P1_P2").w(FUNC(karnov_state::mcu_ack_w)); map(0x0c0002, 0x0c0003).portr("SYSTEM"); map(0x0c0003, 0x0c0003).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x0c0004, 0x0c0005).portr("DSW").w(m_spriteram, FUNC(buffered_spriteram16_device::write)); - map(0x0c0006, 0x0c0007).rw(FUNC(karnov_state::mcusim_r), FUNC(karnov_state::mcusim_w)); + map(0x0c0006, 0x0c0007).rw(FUNC(karnov_state::mcu_r), FUNC(karnov_state::mcu_w)); map(0x0c0008, 0x0c000b).writeonly().share("scroll"); - map(0x0c000c, 0x0c000d).w(FUNC(karnov_state::mcusim_reset_w)); - map(0x0c000e, 0x0c000f).w(FUNC(karnov_state::vint_ack_w)); + map(0x0c000e, 0x0c000f).nopr().w(FUNC(karnov_state::vint_ack_w)); } -void karnov_state::chelnov_map(address_map &map) +void karnov_state::karnovjbl_map(address_map &map) { karnov_map(map); - map(0x0c0000, 0x0c0001).portr("P1_P2").w(FUNC(karnov_state::mcu_ack_w)); - map(0x0c0006, 0x0c0007).rw(FUNC(karnov_state::mcu_r), FUNC(karnov_state::mcu_w)); - map(0x0c000c, 0x0c000d).unmaprw(); - map(0x0c000e, 0x0c000f).nopr(); + map(0x0c0000, 0x0c0001).portr("P1_P2").nopw(); + map(0x0c0006, 0x0c0007).lr16(NAME([]() { return 0x56a; })).lw16(NAME([this](u16 data) { m_maincpu->set_input_line(6, HOLD_LINE); })); +} + +void karnov_state::wndrplnt_map(address_map &map) +{ + karnov_map(map); + map(0x0c0000, 0x0c0001).portr("P1_P2").w(FUNC(karnov_state::wndrplnt_mcu_ack_w)); + map(0x0c0006, 0x0c0007).rw(FUNC(karnov_state::wndrplnt_mcu_r), FUNC(karnov_state::wndrplnt_mcu_w)); + map(0x0c000c, 0x0c000d).w(FUNC(karnov_state::wndrplnt_mcu_reset_w)); } void karnov_state::base_sound_map(address_map &map) @@ -457,10 +416,11 @@ INPUT_PORTS_END static INPUT_PORTS_START( karnov ) PORT_INCLUDE( common ) - PORT_START("COIN") /* Dummy input for i8751 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_START("COIN") + PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<0>) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<1>) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<2>) PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") @@ -505,6 +465,15 @@ static INPUT_PORTS_START( karnov ) PORT_DIPSETTING( 0x0000, "Fast" ) INPUT_PORTS_END +static INPUT_PORTS_START( karnovjbl ) + PORT_INCLUDE(karnov) + + PORT_MODIFY("COIN") + PORT_BIT(0x1f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_COIN1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_COIN2) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SERVICE1) +INPUT_PORTS_END /* verified from M68000 code */ static INPUT_PORTS_START( wndrplnt ) @@ -690,7 +659,7 @@ GFXDECODE_END * *************************************/ -WRITE_LINE_MEMBER(karnov_state::mcusim_vbint_w) +WRITE_LINE_MEMBER(karnov_state::wndrplnt_mcusim_vbint_w) { if (!state) return; @@ -698,10 +667,10 @@ WRITE_LINE_MEMBER(karnov_state::mcusim_vbint_w) uint8_t port = ioport("COIN")->read(); /* Coin input to the i8751 generates an interrupt to the main cpu */ - if (port == m_coin_mask) + if (port == 0) m_latch = 1; - if (port != m_coin_mask && m_latch) + if (port != 0 && m_latch) { if (m_i8751_needs_ack) { @@ -769,9 +738,22 @@ void karnov_state::karnov(machine_config &config) M68000(config, m_maincpu, 20_MHz_XTAL/2); /* 10 MHz */ m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::karnov_map); + // needs a tight sync with the mcu + config.set_perfect_quantum(m_maincpu); + M6502(config, m_audiocpu, 12_MHz_XTAL/8); /* Accurate */ m_audiocpu->set_addrmap(AS_PROGRAM, &karnov_state::karnov_sound_map); + I8751(config, m_mcu, 8_MHz_XTAL); + m_mcu->port_in_cb<0>().set([this](){ return m_mcu_p0; }); + m_mcu->port_out_cb<0>().set([this](u8 data){ m_mcu_p0 = data; }); + m_mcu->port_in_cb<1>().set([this](){ return m_mcu_p1; }); + m_mcu->port_out_cb<1>().set([this](u8 data){ m_mcu_p1 = data; }); + m_mcu->port_out_cb<2>().set(FUNC(karnov_state::mcu_p2_w)); + m_mcu->port_in_cb<3>().set_ioport("COIN"); + + INPUT_MERGER_ANY_LOW(config, "coin").output_handler().set(FUNC(karnov_state::mcu_coin_irq)); + /* video hardware */ BUFFERED_SPRITERAM16(config, m_spriteram); @@ -782,7 +764,7 @@ void karnov_state::karnov(machine_config &config) m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1); m_screen->set_screen_update(FUNC(karnov_state::screen_update)); m_screen->set_palette(m_palette); - m_screen->screen_vblank().set(FUNC(karnov_state::mcusim_vbint_w)); + m_screen->screen_vblank().set(FUNC(karnov_state::vbint_w)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_karnov); DECO_RMC3(config, m_palette, 0, 1024); // xxxxBBBBGGGGRRRR with custom weighting @@ -810,54 +792,44 @@ void karnov_state::karnov(machine_config &config) void karnov_state::karnovjbl(machine_config &config) { karnov(config); + /* X-TALs: Top board next to #9 is 20.000 MHz Top board next to the microcontroller is 6.000 MHz Bottom board next to the ribbon cable is 12.000 MHz*/ + + m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::karnovjbl_map); m_audiocpu->set_addrmap(AS_PROGRAM, &karnov_state::karnovjbl_sound_map); + // different MCU + config.device_remove("mcu"); + config.device_remove("coin"); + ym3812_device &ym2(YM3812(config.replace(), "ym2", 3000000)); ym2.irq_handler().set_inputline(m_audiocpu, M6502_IRQ_LINE); ym2.add_route(ALL_OUTPUTS, "mono", 1.0); } -void karnov_state::chelnov(machine_config &config) -{ - karnov(config); - m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::chelnov_map); - - I8751(config, m_mcu, 8_MHz_XTAL); // 8.000 MHz OSC next to MCU - m_mcu->port_in_cb<0>().set([this](){ return m_mcu_p0; }); - m_mcu->port_out_cb<0>().set([this](u8 data){ m_mcu_p0 = data; }); - m_mcu->port_in_cb<1>().set([this](){ return m_mcu_p1; }); - m_mcu->port_out_cb<1>().set([this](u8 data){ m_mcu_p1 = data; }); - m_mcu->port_out_cb<2>().set(FUNC(karnov_state::mcu_p2_w)); - m_mcu->port_in_cb<3>().set_ioport("COIN"); - - INPUT_MERGER_ANY_LOW(config, "coin").output_handler().set(FUNC(karnov_state::mcu_coin_irq)); - - m_screen->screen_vblank().set(FUNC(karnov_state::vbint_w)); -} - void karnov_state::chelnovjbl(machine_config &config) { karnov(config); - m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::chelnov_map); + m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::karnov_map); + + config.device_remove("mcu"); + config.device_remove("coin"); I8031(config, m_mcu, 8_MHz_XTAL); // info below states 8MHz for MCU m_mcu->set_addrmap(AS_PROGRAM, &karnov_state::chelnovjbl_mcu_map); m_mcu->set_addrmap(AS_IO, &karnov_state::chelnovjbl_mcu_io_map); m_mcu->port_out_cb<1>().set(FUNC(karnov_state::mcubl_p1_w)); m_mcu->port_in_cb<3>().set_ioport("COIN"); - - m_screen->screen_vblank().set(FUNC(karnov_state::vbint_w)); } void karnov_state::wndrplnt(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 20_MHz_XTAL/2); /* 10 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::karnov_map); + m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::wndrplnt_map); M6502(config, m_audiocpu, 12_MHz_XTAL/8); /* Accurate */ m_audiocpu->set_addrmap(AS_PROGRAM, &karnov_state::karnov_sound_map); @@ -872,7 +844,7 @@ void karnov_state::wndrplnt(machine_config &config) screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); screen.set_screen_update(FUNC(karnov_state::screen_update)); screen.set_palette(m_palette); - screen.screen_vblank().set(FUNC(karnov_state::mcusim_vbint_w)); + screen.screen_vblank().set(FUNC(karnov_state::wndrplnt_mcusim_vbint_w)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_karnov); DECO_RMC3(config, m_palette, 0, 1024); // xxxxBBBBGGGGRRRR with custom weighting @@ -916,8 +888,8 @@ ROM_START( karnov ) /* DE-0248-3 main board, DE-259-0 sub/rom board */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */ ROM_LOAD( "dn05-5.f3", 0x8000, 0x8000, CRC(fa1a31a8) SHA1(5007a625be03c546d2a78444d72c28761b10cdb0) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "dn-e.k14", 0x0000, 0x1000, NO_DUMP ) /* DN-E or DN-6? */ + ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU (Note: Dump taken from a Rev 5 board) + ROM_LOAD( "dn-5.k14", 0x0000, 0x1000, CRC(d056de4e) SHA1(621587ed949ff46e5ccb0d0603612655a38b69a3) ) ROM_REGION( 0x08000, "gfx1", 0 ) ROM_LOAD( "dn00-.c5", 0x00000, 0x08000, CRC(0ed77c6d) SHA1(4ec86ac56c01c158a580dc13dea3e5cbdf90d0e9) ) /* Characters */ @@ -955,8 +927,8 @@ ROM_START( karnova ) /* DE-0248-3 main board, DE-259-0 sub/rom board */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */ ROM_LOAD( "dn05-5.f3", 0x8000, 0x8000, CRC(fa1a31a8) SHA1(5007a625be03c546d2a78444d72c28761b10cdb0) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "dn-5.k14", 0x0000, 0x1000, NO_DUMP ) + ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU + ROM_LOAD( "dn-5.k14", 0x0000, 0x1000, CRC(d056de4e) SHA1(621587ed949ff46e5ccb0d0603612655a38b69a3) ) ROM_REGION( 0x08000, "gfx1", 0 ) ROM_LOAD( "dn00-.c5", 0x00000, 0x08000, CRC(0ed77c6d) SHA1(4ec86ac56c01c158a580dc13dea3e5cbdf90d0e9) ) /* Characters */ @@ -994,8 +966,8 @@ ROM_START( karnovj ) /* DE-0248-3 main board, DE-259-0 sub/rom board */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */ ROM_LOAD( "kar5.f3", 0x8000, 0x8000, CRC(7c9158f1) SHA1(dfba7b3abd6b8d6991f0207cd252ee652a6050c2) ) - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "karnovj_i8751.k14", 0x0000, 0x1000, NO_DUMP ) + ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU (BAD_DUMP because it was created from the US version) + ROM_LOAD( "karnovj_i8751.k14", 0x0000, 0x1000, BAD_DUMP CRC(5a8c4d28) SHA1(58cc912d91e569503d5a20fa3180fbdca595e39f) ) ROM_REGION( 0x08000, "gfx1", 0 ) ROM_LOAD( "dn00-.c5", 0x00000, 0x08000, CRC(0ed77c6d) SHA1(4ec86ac56c01c158a580dc13dea3e5cbdf90d0e9) ) /* Characters */ @@ -1306,42 +1278,17 @@ ROM_END /************************************* * - * Driver initialization - * - *************************************/ - -void karnov_state::init_karnov() -{ - m_microcontroller_id = KARNOV; - m_coin_mask = 0x07; -} - -void karnov_state::init_karnovj() -{ - m_microcontroller_id = KARNOVJ; - m_coin_mask = 0x07; -} - -void karnov_state::init_wndrplnt() -{ - m_microcontroller_id = WNDRPLNT; - m_coin_mask = 0x00; -} - - -/************************************* - * * Game driver(s) * *************************************/ -GAME( 1987, karnov, 0, karnov, karnov, karnov_state, init_karnov, ROT0, "Data East USA", "Karnov (US, rev 6)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, karnova, karnov, karnov, karnov, karnov_state, init_karnov, ROT0, "Data East USA", "Karnov (US, rev 5)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, karnovj, karnov, karnov, karnov, karnov_state, init_karnovj, ROT0, "Data East Corporation", "Karnov (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, karnovjbl, karnov, karnovjbl, karnov, karnov_state, init_karnovj, ROT0, "bootleg (K. J. Corporation)", "Karnov (Japan, bootleg with NEC D8748HD)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1987, wndrplnt, 0, wndrplnt, wndrplnt, karnov_state, init_wndrplnt, ROT270, "Data East Corporation", "Wonder Planet (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, chelnov, 0, chelnov, chelnov, karnov_state, empty_init, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, chelnovu, chelnov, chelnov, chelnovu, karnov_state, empty_init, ROT0, "Data East USA", "Chelnov - Atomic Runner (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, chelnovj, chelnov, chelnov, chelnovj, karnov_state, empty_init, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, chelnovjbl, chelnov, chelnovjbl, chelnovjbl, karnov_state, empty_init, ROT0, "bootleg", "Chelnov - Atomic Runner (Japan, bootleg with I8031, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, chelnovjbla, chelnov, chelnovjbl, chelnovjbl, karnov_state, empty_init, ROT0, "bootleg", "Chelnov - Atomic Runner (Japan, bootleg with I8031, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, karnov, 0, karnov, karnov, karnov_state, empty_init, ROT0, "Data East USA", "Karnov (US, rev 6)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, karnova, karnov, karnov, karnov, karnov_state, empty_init, ROT0, "Data East USA", "Karnov (US, rev 5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, karnovj, karnov, karnov, karnov, karnov_state, empty_init, ROT0, "Data East Corporation", "Karnov (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, karnovjbl, karnov, karnovjbl, karnovjbl, karnov_state, empty_init, ROT0, "bootleg (K. J. Corporation)", "Karnov (Japan, bootleg with NEC D8748HD)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +GAME( 1987, wndrplnt, 0, wndrplnt, wndrplnt, karnov_state, empty_init, ROT270, "Data East Corporation", "Wonder Planet (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, chelnov, 0, karnov, chelnov, karnov_state, empty_init, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, chelnovu, chelnov, karnov, chelnovu, karnov_state, empty_init, ROT0, "Data East USA", "Chelnov - Atomic Runner (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, chelnovj, chelnov, karnov, chelnovj, karnov_state, empty_init, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, chelnovjbl, chelnov, chelnovjbl, chelnovjbl, karnov_state, empty_init, ROT0, "bootleg", "Chelnov - Atomic Runner (Japan, bootleg with I8031, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, chelnovjbla, chelnov, chelnovjbl, chelnovjbl, karnov_state, empty_init, ROT0, "bootleg", "Chelnov - Atomic Runner (Japan, bootleg with I8031, set 2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/kaypro.cpp b/src/mame/drivers/kaypro.cpp index 84578280cdc..73c01b2ebb3 100644 --- a/src/mame/drivers/kaypro.cpp +++ b/src/mame/drivers/kaypro.cpp @@ -212,6 +212,8 @@ void kaypro_state::kayproii(machine_config &config) m_screen->set_screen_update(FUNC(kaypro_state::screen_update_kayproii)); m_screen->set_palette(m_palette); + TIMER(config, m_floppy_timer).configure_generic(FUNC(kaypro_state::floppy_timer)); + GFXDECODE(config, "gfxdecode", m_palette, gfx_kayproii); PALETTE(config, m_palette, palette_device::MONOCHROME); @@ -265,7 +267,7 @@ void kaypro_state::kayproii(machine_config &config) m_fdc->set_force_ready(true); FLOPPY_CONNECTOR(config, "fdc:0", kaypro_floppies, "525ssdd", floppy_image_device::default_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "fdc:1", kaypro_floppies, "525ssdd", floppy_image_device::default_floppy_formats).enable_sound(true); - SOFTWARE_LIST(config, "flop_list").set_original("kayproii"); + SOFTWARE_LIST(config, "flop_list").set_original("kaypro").set_filter("A"); } void kaypro_state::kayproiv(machine_config &config) @@ -276,6 +278,7 @@ void kaypro_state::kayproiv(machine_config &config) config.device_remove("fdc:1"); FLOPPY_CONNECTOR(config, "fdc:0", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "fdc:1", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true); + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("D"); } void kaypro_state::omni2(machine_config &config) @@ -300,6 +303,8 @@ void kaypro_state::kaypro484(machine_config &config) m_screen->set_visarea(0,80*8-1,0,25*16-1); m_screen->set_screen_update(FUNC(kaypro_state::screen_update_kaypro484)); + TIMER(config, m_floppy_timer).configure_generic(FUNC(kaypro_state::floppy_timer)); + GFXDECODE(config, "gfxdecode", m_palette, gfx_kaypro484); PALETTE(config, m_palette, FUNC(kaypro_state::kaypro_palette), 3); @@ -362,7 +367,19 @@ void kaypro_state::kaypro484(machine_config &config) m_fdc->set_force_ready(true); FLOPPY_CONNECTOR(config, "fdc:0", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "fdc:1", kaypro_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true); - SOFTWARE_LIST(config, "flop_list").set_original("kaypro484"); + SOFTWARE_LIST(config, "flop_list").set_original("kaypro").set_filter("C"); +} + +void kaypro_state::kaypro4x(machine_config &config) +{ + kaypro484(config); + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("F"); +} + +void kaypro_state::kaypro1(machine_config &config) +{ + kaypro484(config); + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("G"); } void kaypro_state::kaypro10(machine_config &config) @@ -370,12 +387,14 @@ void kaypro_state::kaypro10(machine_config &config) kaypro484(config); config.device_remove("fdc:1"); // only has 1 floppy drive // need to add hard drive & controller + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("E"); } void kaypro_state::kaypronew2(machine_config &config) { kaypro484(config); config.device_remove("fdc:1"); // only has 1 floppy drive + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("G"); } void kaypro_state::kaypro284(machine_config &config) @@ -385,6 +404,7 @@ void kaypro_state::kaypro284(machine_config &config) config.device_remove("fdc:1"); FLOPPY_CONNECTOR(config, "fdc:0", kaypro_floppies, "525ssdd", floppy_image_device::default_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "fdc:1", kaypro_floppies, "525ssdd", floppy_image_device::default_floppy_formats).enable_sound(true); + SOFTWARE_LIST(config.replace(), "flop_list").set_original("kaypro").set_filter("B"); } void kaypro_state::init_kaypro() @@ -647,18 +667,18 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP( 1982, kayproii, 0, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro II - 2/83" , MACHINE_SUPPORTS_SAVE ) -COMP( 1983, kayproiv, kayproii, 0, kayproiv, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro IV - 4/83" , MACHINE_SUPPORTS_SAVE ) // model 81-004 +COMP( 1982, kayproii, 0, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro II - 2/83", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, kayproiv, kayproii, 0, kayproiv, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro IV - 4/83", MACHINE_SUPPORTS_SAVE ) // model 81-004 COMP( 1983, kaypro10, 0, 0, kaypro10, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 10 - 1983", MACHINE_SUPPORTS_SAVE ) COMP( 1983, kayproiip88, kayproii, 0, kayproii, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4 plus88 - 4/83" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-004 with an added 8088 daughterboard and rom -COMP( 1984, kaypro484, 0, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4/84" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 -COMP( 1984, kaypro284, kaypro484, 0, kaypro284, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 2/84" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 +COMP( 1984, kaypro484, 0, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4/84", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 +COMP( 1984, kaypro284, kaypro484, 0, kaypro284, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 2/84", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 COMP( 1984, kaypro484p88, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4/84 plus88", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-015 with an added 8088 daughterboard and rom -COMP( 1984, kaypro1084, kaypro10, 0, kaypro10, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 10" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-005 -COMP( 1984, robie, 0, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro Robie" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1985, kaypro2x, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 2x" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-025 +COMP( 1984, kaypro1084, kaypro10, 0, kaypro10, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 10", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // model 81-005 +COMP( 1984, robie, 0, 0, kaypro4x, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro Robie", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1985, kaypro2x, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 2x", MACHINE_SUPPORTS_SAVE ) // model 81-025 COMP( 1985, kaypronew2, 0, 0, kaypronew2, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro New 2", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1985, kaypro4x, robie, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4x" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 1986, kaypro1, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 1", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -COMP( 198?, omni2, kayproii, 0, omni2, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Omni II Logic Analyzer" , MACHINE_SUPPORTS_SAVE ) -COMP( 198?, omni4, kaypro484, 0, kaypro484, kaypro, kaypro_state, init_kaypro, "Omni Logic Inc.", "Omni 4 Logic Analyzer" , MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1985, kaypro4x, robie, 0, kaypro4x, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 4x", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1986, kaypro1, kaypro484, 0, kaypro1, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Kaypro 1", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 198?, omni2, kayproii, 0, omni2, kaypro, kaypro_state, init_kaypro, "Non Linear Systems", "Omni II Logic Analyzer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 198?, omni4, kaypro484, 0, kaypro1, kaypro, kaypro_state, init_kaypro, "Omni Logic Inc.", "Omni 4 Logic Analyzer", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/kdt6.cpp b/src/mame/drivers/kdt6.cpp index abd0ff77dfd..5cb6a5b28cb 100644 --- a/src/mame/drivers/kdt6.cpp +++ b/src/mame/drivers/kdt6.cpp @@ -297,7 +297,7 @@ uint32_t kdt6_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -314,7 +314,7 @@ MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) for (int x = 0; x < 8; x++) { int color = BIT(data, 7 - x); - bitmap.pix32(y, x + i*8) = pen[blink ? 0 : (color ^ inverse)]; + bitmap.pix(y, x + i*8) = pen[blink ? 0 : (color ^ inverse)]; } } else @@ -324,7 +324,7 @@ MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) // draw 8 pixels of the cell for (int x = 0; x < 8; x++) - bitmap.pix32(y, x + i*8) = pen[BIT(data, 7 - x)]; + bitmap.pix(y, x + i*8) = pen[BIT(data, 7 - x)]; } } } diff --git a/src/mame/drivers/kim1.cpp b/src/mame/drivers/kim1.cpp index 06f481378b6..2eb52f01287 100644 --- a/src/mame/drivers/kim1.cpp +++ b/src/mame/drivers/kim1.cpp @@ -56,6 +56,11 @@ TODO: - hook up Single Step dip switch - slots for expansion & application ports - add TTY support + +Paste test: + N-0100=11^22^33^44^55^66^77^88^99^-0100= + Press UP to verify data. + ******************************************************************************/ #include "emu.h" @@ -175,14 +180,14 @@ static INPUT_PORTS_START( kim1 ) PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CODE(KEYCODE_MINUS_PAD) PORT_BIT( 0x08, 0x08, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') - PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR(' ') PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x04, 0x04, IPT_KEYBOARD ) PORT_NAME("+") PORT_CODE(KEYCODE_UP) PORT_CHAR('^') PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x02, 0x02, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') PORT_CODE(KEYCODE_ENTER_PAD) PORT_BIT( 0x01, 0x01, IPT_KEYBOARD ) PORT_NAME("PC") PORT_CODE(KEYCODE_F6) PORT_START("SPECIAL") PORT_BIT( 0x80, 0x00, IPT_UNUSED ) - PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("sw1: ST") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, kim1_state, trigger_nmi, 0) - PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("sw2: RS") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, kim1_state, trigger_reset, 0) + PORT_BIT( 0x40, 0x40, IPT_KEYBOARD ) PORT_NAME("sw1: ST") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, kim1_state, trigger_nmi, 0) PORT_CHAR('S') + PORT_BIT( 0x20, 0x20, IPT_KEYBOARD ) PORT_NAME("sw2: RS") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, kim1_state, trigger_reset, 0) PORT_CHAR('N') PORT_DIPNAME(0x10, 0x10, "sw3: SS") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE PORT_DIPSETTING( 0x00, "single step") PORT_DIPSETTING( 0x10, "run") diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp index bb9ed493ac3..a27fafc0d88 100644 --- a/src/mame/drivers/kinst.cpp +++ b/src/mame/drivers/kinst.cpp @@ -317,18 +317,18 @@ void kinst_state::machine_reset() uint32_t kinst_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); /* loop over rows and copy to the destination */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *src = &m_video_base[640/4 * y]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t const *src = &m_video_base[640/4 * y]; + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); /* loop over columns */ for (int x = cliprect.min_x; x < cliprect.max_x; x += 2) { - uint32_t data = *src++; + uint32_t const data = *src++; /* store two pixels */ *dest++ = pen[(data >> 0) & 0x7fff]; diff --git a/src/mame/drivers/konamigs.cpp b/src/mame/drivers/konamigs.cpp index 23c307b78ac..a0afaef7075 100644 --- a/src/mame/drivers/konamigs.cpp +++ b/src/mame/drivers/konamigs.cpp @@ -746,7 +746,7 @@ u32 gsan_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const if (!m_bg16bit) col = get_color(col); } - bitmap.pix32(y, x) = pal565(col, 11, 5, 0); + bitmap.pix(y, x) = pal565(col, 11, 5, 0); } } else diff --git a/src/mame/drivers/konamigv.cpp b/src/mame/drivers/konamigv.cpp index 650631c4fd8..36764c0063b 100644 --- a/src/mame/drivers/konamigv.cpp +++ b/src/mame/drivers/konamigv.cpp @@ -391,13 +391,13 @@ void konamigv_state::konamigv(machine_config &config) static INPUT_PORTS_START( konamigv ) PORT_START("P1") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_START1 ) @@ -677,19 +677,42 @@ INPUT_PORTS_END static INPUT_PORTS_START( weddingr ) PORT_INCLUDE( konamigv ) + // Control Type must match selection in service mode (no sense line to detect control panel type) + // Buttons 2 and 3 are shown in service mode, but not used by the game + // Button 1-3 inputs are read in service mode even when 4 Buttons is selected, but they could confuse users + + PORT_START("CFG") + PORT_CONFNAME( 0x01, 0x01, "Control Type" ) + PORT_CONFSETTING( 0x01, "4 Buttons" ) + PORT_CONFSETTING( 0x00, "Joystick and Button" ) + PORT_MODIFY("P1") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Answer 3/Zoom In") - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Answer 4/Zoom Out") - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Answer 1/Pan Left") - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Answer 2/Pan Right") - PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 3/Zoom In") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 4/Zoom Out") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 1/Pan Left") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 2/Pan Right") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) PORT_MODIFY("P2") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("Answer 3/Zoom In") - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("Answer 4/Zoom Out") - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("Answer 1/Pan Left") - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("Answer 2/Pan Right") - PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 3/Zoom In") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 4/Zoom Out") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 1/Pan Left") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 2/Pan Right") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) PORT_MODIFY("P3_P4") PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp index 02ce8da8538..862d6693ad3 100644 --- a/src/mame/drivers/konmedal68k.cpp +++ b/src/mame/drivers/konmedal68k.cpp @@ -152,8 +152,8 @@ void konmedal68k_state::fill_backcolor(bitmap_ind16 &bitmap, const rectangle &cl } else { - uint16_t *dst_ptr = &bitmap.pix16(cliprect.min_y); - int dst_pitch = bitmap.rowpixels(); + uint16_t *dst_ptr = &bitmap.pix(cliprect.min_y); + int const dst_pitch = bitmap.rowpixels(); if ((mode & 0x01) == 0) // vertical gradient fill { @@ -173,7 +173,7 @@ void konmedal68k_state::fill_backcolor(bitmap_ind16 &bitmap, const rectangle &cl { pen_idx += cliprect.min_x; dst_ptr += cliprect.min_x; - for(int y = cliprect.min_y; y<= cliprect.max_y; y++) + for (int y = cliprect.min_y; y<= cliprect.max_y; y++) { for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { @@ -500,8 +500,8 @@ ROM_END GAME( 1995, kzaurus, 0, kzaurus, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Pittanko Zaurus", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1996, dobouchn, 0, kzaurus, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Dobou-Chan (ver JAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -GAME( 199?, konslot, 0, slot, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Unknown Konami slot medal game (set 1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) -GAME( 199?, konslot2, 0, slot, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Unknown Konami slot medal game (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 199?, konslot, 0, slot, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "unknown Konami slot medal game (set 1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 199?, konslot2, 0, slot, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "unknown Konami slot medal game (set 2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, koropens, 0, koropens, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Korokoro Pensuke", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1998, kattobas, 0, koropens, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Kattobase Power Pro Kun", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1999, pwrchanc, 0, koropens, kzaurus, konmedal68k_state, empty_init, ROT0, "Konami", "Powerful Chance", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/kontest.cpp b/src/mame/drivers/kontest.cpp index 921ced6509f..c63d32404f4 100644 --- a/src/mame/drivers/kontest.cpp +++ b/src/mame/drivers/kontest.cpp @@ -106,29 +106,20 @@ void kontest_state::video_start() uint32_t kontest_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { - int x,y; - int xi,yi; - uint16_t tile; - uint8_t attr; - - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - for(x=0;x<64;x++) + for(int x=0;x<64;x++) { - tile = m_ram[(x+y*64)|0x800]; - attr = m_ram[(x+((y >> 1)*64))|0x000] & 7; - tile *= 0x10; - tile += 0x1000; + uint16_t const tile = (m_ram[(x+y*64)|0x800] * 0x10) + 0x1000; + uint8_t const attr = m_ram[(x+((y >> 1)*64))|0x000] & 7; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { uint8_t color,pen[2]; - uint8_t x_step; - int res_x,res_y; - x_step = xi >> 2; + uint8_t const x_step = xi >> 2; pen[0] = m_ram[(x_step+yi*2)|(tile)]; pen[0] >>= 3-((xi & 3)); @@ -140,11 +131,11 @@ uint32_t kontest_state::screen_update( screen_device &screen, bitmap_rgb32 &bitm color = pen[0]; color|= pen[1]<<1; - res_x = x*8+xi-256; - res_y = y*8+yi; + int const res_x = x*8+xi-256; + int const res_y = y*8+yi; if (cliprect.contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = m_palette->pen(color|attr*4); + bitmap.pix(res_y, res_x) = m_palette->pen(color|attr*4); } } } diff --git a/src/mame/drivers/korgds8.cpp b/src/mame/drivers/korgds8.cpp index f6d80b7b8d2..18fedea0b89 100644 --- a/src/mame/drivers/korgds8.cpp +++ b/src/mame/drivers/korgds8.cpp @@ -72,13 +72,13 @@ void korg_ds8_state::machine_start() HD44780_PIXEL_UPDATE(korg_ds8_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 40) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } HD44780_PIXEL_UPDATE(korg_ds8_state::korg707_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } u8 korg_ds8_state::kbd_sw_r() diff --git a/src/mame/drivers/korgdss1.cpp b/src/mame/drivers/korgdss1.cpp index eb6da9b2efe..317137c4a23 100644 --- a/src/mame/drivers/korgdss1.cpp +++ b/src/mame/drivers/korgdss1.cpp @@ -72,7 +72,6 @@ private: void bank_switch_w(u8 data); void panel_led_w(u8 data); - DECLARE_WRITE_LINE_MEMBER(fdc_reset_w); DECLARE_WRITE_LINE_MEMBER(fdc_tc_w); DECLARE_WRITE_LINE_MEMBER(sed9420c_trgin_w); u8 fdc_r(offs_t offset); @@ -141,7 +140,7 @@ void korg_dss1_state::machine_reset() HD44780_PIXEL_UPDATE(korg_dss1_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } @@ -156,12 +155,6 @@ void korg_dss1_state::panel_led_w(u8 data) // TODO } -WRITE_LINE_MEMBER(korg_dss1_state::fdc_reset_w) -{ - if (!state) - m_fdc->soft_reset(); -} - WRITE_LINE_MEMBER(korg_dss1_state::fdc_tc_w) { if (m_cpu1.found()) @@ -444,7 +437,7 @@ void korg_dss1_state::klm780(machine_config &config) m_io1->out_pc_callback().set(m_lcdc, FUNC(hd44780_device::e_w)).bit(0); m_io1->out_pc_callback().append(m_lcdc, FUNC(hd44780_device::rw_w)).bit(1); m_io1->out_pc_callback().append(m_lcdc, FUNC(hd44780_device::rs_w)).bit(2); - m_io1->out_pc_callback().append(FUNC(korg_dss1_state::fdc_reset_w)).bit(3); + m_io1->out_pc_callback().append(m_fdc, FUNC(upd765a_device::reset_w)).bit(3).invert(); m_io1->out_pc_callback().append(FUNC(korg_dss1_state::fdc_tc_w)).bit(4); m_io1->out_pc_callback().append(FUNC(korg_dss1_state::sed9420c_trgin_w)).bit(5); diff --git a/src/mame/drivers/korgm1.cpp b/src/mame/drivers/korgm1.cpp index c7fdc20825b..62e8d1dc1c0 100644 --- a/src/mame/drivers/korgm1.cpp +++ b/src/mame/drivers/korgm1.cpp @@ -66,7 +66,7 @@ void korgm1_state::video_start() HD44780_PIXEL_UPDATE(korgm1_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 40) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void korgm1_state::pio_pa_w(u8 data) diff --git a/src/mame/drivers/krokha.cpp b/src/mame/drivers/krokha.cpp index 10140b2755c..399f29c69a3 100644 --- a/src/mame/drivers/krokha.cpp +++ b/src/mame/drivers/krokha.cpp @@ -116,22 +116,19 @@ void krokha_state::machine_reset() uint32_t krokha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx; - uint16_t chr, ma = 0, x = 0; - - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - ma = 0xe0 + y; - for (ra = 0; ra < 8; ra++) + uint16_t ma = 0xe0 + y; + for (uint8_t ra = 0; ra < 8; ra++) { - for (x = ma; x < ma + 64*32; x += 32) + for (uint16_t x = ma; x < ma + 64*32; x += 32) { - chr = m_p_videoram[x] << 3; - gfx = m_p_chargen[chr | ra]; + uint16_t chr = m_p_videoram[x] << 3; + uint8_t gfx = m_p_chargen[chr | ra]; for (int i = 0; i < 8; i++) { - bitmap.pix16(y * 8 + ra, (x - ma) / 4 + i) = BIT(gfx, 7 - i); + bitmap.pix(y * 8 + ra, (x - ma) / 4 + i) = BIT(gfx, 7 - i); } } } diff --git a/src/mame/drivers/kron.cpp b/src/mame/drivers/kron.cpp index 34f2804fdf7..bb9cd9dc0d3 100644 --- a/src/mame/drivers/kron.cpp +++ b/src/mame/drivers/kron.cpp @@ -224,30 +224,26 @@ INPUT_PORTS_END /* Video TODO: find and understand the char table within main rom */ uint32_t kron180_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int vramad; - uint8_t *chardata; - uint8_t charcode; - LOGSCREEN("%s()\n", FUNCNAME); - vramad = 0; + int vramad = 0; for (int row = 0; row < 25 * 8; row += 8) { + uint8_t charcode; for (int col = 0; col < 80 * 8; col += 8) { /* look up the character data */ charcode = m_vram[vramad]; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %c at X=%d Y=%d: ", charcode, col, row); - chardata = &m_chargen[(charcode * 8) + 8]; + uint8_t const *chardata = &m_chargen[(charcode * 8) + 8]; /* plot the character */ - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { chardata--; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %02x: ", *chardata); - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; } } vramad += 2; diff --git a/src/mame/drivers/laser3k.cpp b/src/mame/drivers/laser3k.cpp index 9c3e20e49cf..f17caa47a11 100644 --- a/src/mame/drivers/laser3k.cpp +++ b/src/mame/drivers/laser3k.cpp @@ -496,32 +496,28 @@ uint8_t laser3k_state::io2_r(offs_t offset) void laser3k_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; int fg = m_fg_color; int bg = m_bg_color; - const uint8_t *chardata; - uint16_t color; /* look up the character data */ - chardata = &textgfx_data[(code * 8) % textgfx_datalen]; + uint8_t const *const chardata = &textgfx_data[(code * 8) % textgfx_datalen]; if (m_flash && (code >= 0x40) && (code <= 0x7f)) { /* we're flashing; swap */ - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -578,15 +574,6 @@ void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, con void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42] ; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -595,31 +582,32 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -629,14 +617,6 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[82]; - uint16_t v; - uint16_t *p; - uint32_t w; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -645,16 +625,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); if (col < 40) { vram_row[1+(col*2)+0] = vram[offset]; @@ -667,17 +648,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con } } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + uint16_t v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; } } @@ -830,10 +811,10 @@ static INPUT_PORTS_START( laser3k ) PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') @@ -859,8 +840,8 @@ static INPUT_PORTS_START( laser3k ) PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_START("X3") PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') @@ -876,7 +857,7 @@ static INPUT_PORTS_START( laser3k ) PORT_START("X4") PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') @@ -937,7 +918,7 @@ static INPUT_PORTS_START( laser3k ) PORT_START("keyb_special") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) diff --git a/src/mame/drivers/laserbas.cpp b/src/mame/drivers/laserbas.cpp index 10a009326dd..8412283fcac 100644 --- a/src/mame/drivers/laserbas.cpp +++ b/src/mame/drivers/laserbas.cpp @@ -150,8 +150,8 @@ MC6845_UPDATE_ROW( laserbas_state::crtc_update_row ) } int pixaddr = y << 8; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *b = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *const b = &bitmap.pix(y); while (x != x_max) { diff --git a/src/mame/drivers/lastfght.cpp b/src/mame/drivers/lastfght.cpp index 81b4a5a40e3..fd7749a3502 100644 --- a/src/mame/drivers/lastfght.cpp +++ b/src/mame/drivers/lastfght.cpp @@ -165,9 +165,7 @@ uint32_t lastfght_state::screen_update(screen_device &screen, bitmap_ind16 &bitm #ifdef MAME_DEBUG #if 1 // gfx roms viewer (toggle with enter, use pgup/down to browse) - int x, y, count = 0; - uint8_t *gfxdata = memregion("gfx1")->base(); - uint8_t data; + uint8_t const *const gfxdata = memregion("gfx1")->base(); if (machine().input().code_pressed_once(KEYCODE_ENTER)) m_view_roms ^= 1; if (m_view_roms) @@ -176,15 +174,15 @@ uint32_t lastfght_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (machine().input().code_pressed_once(KEYCODE_PGUP)) m_base -= 512 * 256; m_base %= memregion("gfx1")->bytes(); - count = m_base; + int count = m_base; bitmap.fill(m_palette->black_pen(), cliprect ); - for (y = 0 ; y < 256; y++) + for (int y = 0 ; y < 256; y++) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { - data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? m_palette->white_pen() : gfxdata[count]; // white grid or data - bitmap.pix16(y, x) = data; + uint8_t data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? m_palette->white_pen() : gfxdata[count]; // white grid or data + bitmap.pix(y, x) = data; count++; } } @@ -317,7 +315,6 @@ void lastfght_state::blit_w(offs_t offset, uint16_t data, uint16_t mem_mask) { if (ACCESSING_BITS_8_15) { - int x, y, addr; uint8_t *gfxdata = memregion( "gfx1" )->base(); bitmap_ind16 &dest = m_bitmap[m_dest]; @@ -330,18 +327,18 @@ void lastfght_state::blit_w(offs_t offset, uint16_t data, uint16_t mem_mask) data >> 8); #endif - for (y = 0; y <= m_h; y++) + for (int y = 0; y <= m_h; y++) { - for (x = 0; x <= m_w; x++) + for (int x = 0; x <= m_w; x++) { - addr = (((m_sx + m_sx1 + m_dsx * x) >> 6) & 0x1ff) + + int addr = (((m_sx + m_sx1 + m_dsx * x) >> 6) & 0x1ff) + (((m_sy + m_sy1 + m_dsy * y) >> 6) & 0xff) * 0x200 + m_sp * 0x200 * 0x100 + m_sr * 0x200000; data = gfxdata[addr]; if (data && (m_x + x >= 0) && (m_x + x < 512) && (m_y + y >= 0) && (m_y + y < 256)) - dest.pix16(m_y + y, m_x + x) = data; + dest.pix(m_y + y, m_x + x) = data; } } } diff --git a/src/mame/drivers/lbeach.cpp b/src/mame/drivers/lbeach.cpp index a2f77a19d7b..94c44d0f39b 100644 --- a/src/mame/drivers/lbeach.cpp +++ b/src/mame/drivers/lbeach.cpp @@ -189,8 +189,8 @@ u32 lbeach_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con { for (int x = sprite_x; x < (sprite_x + 16) && cliprect.contains(x, y); x++) { - m_collision_bg_car |= (bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1); - m_collision_fg_car |= (fg_bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1); + m_collision_bg_car |= (bitmap.pix(y, x) & m_colmap_car.pix(y, x) & 1); + m_collision_fg_car |= (fg_bitmap.pix(y, x) & m_colmap_car.pix(y, x) & 1); } } diff --git a/src/mame/drivers/lcmate2.cpp b/src/mame/drivers/lcmate2.cpp index 4c687df074c..f4a64bf1c4b 100644 --- a/src/mame/drivers/lcmate2.cpp +++ b/src/mame/drivers/lcmate2.cpp @@ -118,12 +118,14 @@ void lcmate2_state::io_map(address_map &map) } /* Input ports */ +// Alternate keyboard layout exists. Different keys are 7& `~ ? +/ ,< .> ON/RESET, with removal of Numlock and [{ ]} +// Machine starts up with capslock on - turn it off to access lowercase. Natural keyboard - use End key. static INPUT_PORTS_START( lcmate2 ) PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') @@ -132,7 +134,8 @@ static INPUT_PORTS_START( lcmate2 ) PORT_START("LINE1") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('/') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) + // Natural keyboard: UCHAR_MAMEKEY(CAPSLOCK) does not disengage capslock on the emulated machine, so using END instead + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPSLOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') @@ -161,7 +164,7 @@ static INPUT_PORTS_START( lcmate2 ) PORT_START("LINE4") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL),8) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') @@ -172,7 +175,7 @@ static INPUT_PORTS_START( lcmate2 ) PORT_START("LINE5") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') @@ -182,7 +185,7 @@ static INPUT_PORTS_START( lcmate2 ) PORT_START("LINE6") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') @@ -192,7 +195,7 @@ static INPUT_PORTS_START( lcmate2 ) PORT_START("LINE7") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLOck") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') diff --git a/src/mame/drivers/lft_craft.cpp b/src/mame/drivers/lft_craft.cpp index 3069c2172f2..6f6ce148570 100644 --- a/src/mame/drivers/lft_craft.cpp +++ b/src/mame/drivers/lft_craft.cpp @@ -174,7 +174,7 @@ uint32_t lft_craft_state::screen_update(screen_device &screen, bitmap_rgb32 &bit const pen_t *pens = m_palette->pens(); for(int y = 0; y < LINES_PER_FRAME; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); uint8_t *src = &m_pixels[y * LINE_CYCLES]; for(int x = 0; x < LINE_CYCLES; x++) { diff --git a/src/mame/drivers/lft_phasor.cpp b/src/mame/drivers/lft_phasor.cpp index 11335ca939b..2f18af496e3 100644 --- a/src/mame/drivers/lft_phasor.cpp +++ b/src/mame/drivers/lft_phasor.cpp @@ -186,7 +186,7 @@ uint32_t lft_phasor_state::screen_update(screen_device &screen, bitmap_rgb32 &bi const pen_t *pens = m_palette->pens(); for(int y = 0; y < 313; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); uint8_t *src = &m_samples[y * 1135]; for(int x = 0; x < 1135; x++) { diff --git a/src/mame/drivers/lgp.cpp b/src/mame/drivers/lgp.cpp index 67bc14514f8..9b76c5469de 100644 --- a/src/mame/drivers/lgp.cpp +++ b/src/mame/drivers/lgp.cpp @@ -69,7 +69,6 @@ Dumping Notes: #include "cpu/z80/z80.h" #include "machine/ldv1000.h" #include "emupal.h" -#include "render.h" #include "speaker.h" diff --git a/src/mame/drivers/limenko.cpp b/src/mame/drivers/limenko.cpp index ced23bf5779..1455aaa25f3 100644 --- a/src/mame/drivers/limenko.cpp +++ b/src/mame/drivers/limenko.cpp @@ -375,9 +375,9 @@ void limenko_state::draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &c { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * width; - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &m_sprites_bitmap_pri.pix8(y); + u8 const *const source = source_base + y_index * width; + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &m_sprites_bitmap_pri.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -452,10 +452,10 @@ void limenko_state::copy_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &sprites_bit { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *source = &sprites_bitmap.pix16(y); - u16 *dest = &bitmap.pix16(y); - u8 *dest_pri = &priority_bitmap.pix8(y); - u8 *source_pri = &m_sprites_bitmap_pri.pix8(y); + u16 const *const source = &sprites_bitmap.pix(y); + u16 *const dest = &bitmap.pix(y); + u8 const *const dest_pri = &priority_bitmap.pix(y); + u8 const *const source_pri = &m_sprites_bitmap_pri.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/llc1.cpp b/src/mame/drivers/llc1.cpp index a0117d521d8..29e900f8b1e 100644 --- a/src/mame/drivers/llc1.cpp +++ b/src/mame/drivers/llc1.cpp @@ -237,22 +237,21 @@ void llc1_state::machine_start() u32 llc1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - inv = (m_vram[x] & 0x80) ? 0xff : 0; - chr = m_vram[x] & 0x7f; + u8 const inv = (m_vram[x] & 0x80) ? 0xff : 0; + u8 const chr = m_vram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; + u8 const gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/llc2.cpp b/src/mame/drivers/llc2.cpp index b22de1b0774..cc00f24d67c 100644 --- a/src/mame/drivers/llc2.cpp +++ b/src/mame/drivers/llc2.cpp @@ -166,30 +166,29 @@ void llc2_state::machine_start() u32 llc2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv, inv1=m_rv ? 0xff : 0; - u16 sy=0,ma=0,x; + u8 const inv1 = m_rv ? 0xff : 0; + u16 sy = 0, ma = 0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - inv = 0; - u16 *p = &bitmap.pix16(sy++); + u8 inv = 0; + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - chr = m_vram[x]; + u8 chr = m_vram[x]; if (chr==0x11) // inverse on { inv=0xff; chr=0x0f; // must not show } - else - if (chr==0x10) // inverse off + else if (chr==0x10) // inverse off inv=0; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; + u8 const gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/lola8a.cpp b/src/mame/drivers/lola8a.cpp index f915bed8bfe..3ca470eb116 100644 --- a/src/mame/drivers/lola8a.cpp +++ b/src/mame/drivers/lola8a.cpp @@ -234,16 +234,14 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( lola8a_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 x,gfx; - u16 mem; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); ma &= 0x7ff; - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - mem = (x+ma)*8 + ra; - gfx = m_p_videoram[mem] ^ ((cursor_x == x) ? 0xff : 0); + u16 mem = (x+ma)*8 + ra; + u8 gfx = m_p_videoram[mem] ^ ((cursor_x == x) ? 0xff : 0); *p++ = palette[BIT(gfx, 7) ? 7 : 0]; *p++ = palette[BIT(gfx, 6) ? 7 : 0]; diff --git a/src/mame/drivers/lviv.cpp b/src/mame/drivers/lviv.cpp index 7aac9930b97..67f19c0392d 100644 --- a/src/mame/drivers/lviv.cpp +++ b/src/mame/drivers/lviv.cpp @@ -328,7 +328,7 @@ static INPUT_PORTS_START (lviv) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR(']') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR(':') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('H') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('Z') PORT_START("KEY2") /* 2nd PPI port A bit 2 low */ @@ -354,7 +354,7 @@ static INPUT_PORTS_START (lviv) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(G)") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(B)") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(164) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') diff --git a/src/mame/drivers/m14.cpp b/src/mame/drivers/m14.cpp index 5a40e118da5..99bedecc74c 100644 --- a/src/mame/drivers/m14.cpp +++ b/src/mame/drivers/m14.cpp @@ -161,33 +161,31 @@ void m14_state::video_start() void m14_state::draw_ball_and_paddle(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int xi,yi; //const rgb_t white_pen = rgb_t::white(); const uint8_t white_pen = 0x1f; const int xoffs = -8; // matches left-right wall bounces const int p_ybase = 184; // matches ball bounce to paddle - int resx,resy; // draw ball - for(xi=0;xi<4;xi++) - for(yi=0;yi<4;yi++) + for(int xi=0;xi<4;xi++) + for(int yi=0;yi<4;yi++) { - resx = flip_screen() ? 32*8-(m_ballx+xi+xoffs) : m_ballx+xi+xoffs; - resy = flip_screen() ? 28*8-(m_bally+yi) : m_bally+yi; + const int resx = flip_screen() ? 32*8-(m_ballx+xi+xoffs) : m_ballx+xi+xoffs; + const int resy = flip_screen() ? 28*8-(m_bally+yi) : m_bally+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_palette->pen(white_pen); + bitmap.pix(resy, resx) = m_palette->pen(white_pen); } // draw paddle - for(xi=0;xi<16;xi++) - for(yi=0;yi<4;yi++) + for(int xi=0;xi<16;xi++) + for(int yi=0;yi<4;yi++) { - resx = flip_screen() ? 32*8-(m_paddlex+xi+xoffs) : (m_paddlex+xi+xoffs); - resy = flip_screen() ? 28*8-(p_ybase+yi) : p_ybase+yi; + const int resx = flip_screen() ? 32*8-(m_paddlex+xi+xoffs) : (m_paddlex+xi+xoffs); + const int resy = flip_screen() ? 28*8-(p_ybase+yi) : p_ybase+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_palette->pen(white_pen); + bitmap.pix(resy, resx) = m_palette->pen(white_pen); } diff --git a/src/mame/drivers/m20.cpp b/src/mame/drivers/m20.cpp index 00c61f10ee6..557c4e684a1 100644 --- a/src/mame/drivers/m20.cpp +++ b/src/mame/drivers/m20.cpp @@ -130,16 +130,15 @@ private: MC6845_UPDATE_ROW( m20_state::update_row ) { - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ((ma | (ra << 1)) << 4) + i; uint16_t data = m_p_videoram[ offset ]; - for ( j = 15; j >= 0; j-- ) + for ( int j = 15; j >= 0; j-- ) { *p = palette[( data & 1 << j ) ? 1 : 0]; p++; diff --git a/src/mame/drivers/m3.cpp b/src/mame/drivers/m3.cpp index e97675a6e50..f40db77c10f 100644 --- a/src/mame/drivers/m3.cpp +++ b/src/mame/drivers/m3.cpp @@ -62,16 +62,14 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( m3_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + uint8_t inv = (x == cursor_x) ? 0xff : 0; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_p_videoram[mem]; if (BIT(chr, 7)) { inv ^= 0xff; @@ -79,7 +77,7 @@ MC6845_UPDATE_ROW( m3_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 6)]; diff --git a/src/mame/drivers/m5.cpp b/src/mame/drivers/m5.cpp index 79c405648a5..55f8679a087 100644 --- a/src/mame/drivers/m5.cpp +++ b/src/mame/drivers/m5.cpp @@ -832,7 +832,7 @@ static INPUT_PORTS_START( m5 ) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_ Triangle") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('\\') PORT_CHAR('|') // backslash ok for m5p, shows as ¥ on m5. PORT_START("Y6") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') diff --git a/src/mame/drivers/m72.cpp b/src/mame/drivers/m72.cpp index 5e35cf81fc9..98505de4549 100644 --- a/src/mame/drivers/m72.cpp +++ b/src/mame/drivers/m72.cpp @@ -597,16 +597,16 @@ static const u8 airduelm72_crc[CRC_LEN] = { 0x54,0x81,0xe6,0x8a, 0xc9,0x12,0 // Actual MCU is dumped, information for Air Duel (Japan, M72 hardware) for reference: static const u8 airduelm72_code[CODE_LEN] = { - 0x68,0x00,0xd0, // push 0d000h - 0x1f, // pop ds - // the game checks for - // "This game can only be played in Japan..." message in the video text buffer - // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu - 0xc6,0x06,0xc0,0x1c,0x57, // mov [1cc0h], byte 057h - 0xea,0x69,0x0b,0x00,0x00 // jmp 0000:$0b69 + 0x68,0x00,0xd0, // push 0d000h + 0x1f, // pop ds + // the game checks for + // "This game can only be played in Japan..." message in the video text buffer + // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu + 0xc6,0x06,0xc0,0x1c,0x57, // mov [1cc0h], byte 057h + 0xea,0x69,0x0b,0x00,0x00 // jmp 0000:$0b69 }; static const u8 airduelm72j_crc[CRC_LEN] = { 0x72,0x9c,0xca,0x85, 0xc9,0x12,0xcc,0xea, - 0x00,0x00 }; + 0x00,0x00 }; */ /* Daiku no Gensan */ diff --git a/src/mame/drivers/m79152pc.cpp b/src/mame/drivers/m79152pc.cpp index cf041466982..2f05839a30c 100644 --- a/src/mame/drivers/m79152pc.cpp +++ b/src/mame/drivers/m79152pc.cpp @@ -185,10 +185,10 @@ TIMER_CALLBACK_MEMBER(m79152pc_state::hsync_off) void m79152pc_state::screen_draw_line(bitmap_ind16 &bitmap, unsigned y) { - u16 ma = u16(m_line_base) << 4; - u8 ra = m_line_count & 0xf; + const u16 ma = u16(m_line_base) << 4; + const u8 ra = m_line_count & 0xf; - u16 *p = &bitmap.pix16(y++); + u16 *p = &bitmap.pix(y++); for (u16 x = ma; x < ma + 80; x++) { diff --git a/src/mame/drivers/m79amb.cpp b/src/mame/drivers/m79amb.cpp index 7baecaf457e..c855502faa1 100644 --- a/src/mame/drivers/m79amb.cpp +++ b/src/mame/drivers/m79amb.cpp @@ -75,20 +75,16 @@ void m79amb_state::ramtek_videoram_w(offs_t offset, uint8_t data) uint32_t m79amb_state::screen_update_ramtek(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t data = m_videoram[offs]; int y = offs >> 5; int x = (offs & 0x1f) << 3; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; x++; data <<= 1; diff --git a/src/mame/drivers/m92.cpp b/src/mame/drivers/m92.cpp index 63b4387b254..28883fe6c70 100644 --- a/src/mame/drivers/m92.cpp +++ b/src/mame/drivers/m92.cpp @@ -1465,83 +1465,83 @@ ROM_END ROM_START( inthunt ) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "ith-h0-d.bin", 0x000001, 0x040000, CRC(52f8e7a6) SHA1(26d9e272b01e7b82019812059dcc9fbb043c6129) ) - ROM_LOAD16_BYTE( "ith-l0-d.bin", 0x000000, 0x040000, CRC(5db79eb7) SHA1(ffd4228d7b88a44a82e639a5583753da183fcb23) ) - ROM_LOAD16_BYTE( "ith-h1-b.bin", 0x080001, 0x020000, CRC(fc2899df) SHA1(f811ff5fd55655afdb25950d317db85c8091b6d6) ) - ROM_LOAD16_BYTE( "ith-l1-b.bin", 0x080000, 0x020000, CRC(955a605a) SHA1(2515accc2f4a06b07418e45eb62e746d09c81720) ) + ROM_LOAD16_BYTE( "ith-h0-d.ic28", 0x000001, 0x040000, CRC(52f8e7a6) SHA1(26d9e272b01e7b82019812059dcc9fbb043c6129) ) + ROM_LOAD16_BYTE( "ith-l0-d.ic39", 0x000000, 0x040000, CRC(5db79eb7) SHA1(ffd4228d7b88a44a82e639a5583753da183fcb23) ) + ROM_LOAD16_BYTE( "ith-h1-b.ic38", 0x080001, 0x020000, CRC(fc2899df) SHA1(f811ff5fd55655afdb25950d317db85c8091b6d6) ) + ROM_LOAD16_BYTE( "ith-l1-b.ic27", 0x080000, 0x020000, CRC(955a605a) SHA1(2515accc2f4a06b07418e45eb62e746d09c81720) ) ROM_REGION( 0x20000, "soundcpu", 0 ) /* Irem D8000011A1 */ - ROM_LOAD16_BYTE( "ith-sh0.rom", 0x00001, 0x10000, CRC(209c8b7f) SHA1(eaf4a6d9222fe181df65cea1f13c3f2ebff2ec5b) ) - ROM_LOAD16_BYTE( "ith-sl0.rom", 0x00000, 0x10000, CRC(18472d65) SHA1(2705e94ee350ffda272c50ea3bf605826aa19978) ) + ROM_LOAD16_BYTE( "ith-sh0.ic30", 0x00001, 0x10000, CRC(209c8b7f) SHA1(eaf4a6d9222fe181df65cea1f13c3f2ebff2ec5b) ) + ROM_LOAD16_BYTE( "ith-sl0.ic31", 0x00000, 0x10000, CRC(18472d65) SHA1(2705e94ee350ffda272c50ea3bf605826aa19978) ) ROM_REGION( 0x200000, "gfx1", 0 ) /* Tiles */ - ROM_LOAD( "ith_ic26.rom", 0x000000, 0x080000, CRC(4c1818cf) SHA1(fc8c2ae640bc3504a52736be46febb92c998fd7d) ) - ROM_LOAD( "ith_ic25.rom", 0x080000, 0x080000, CRC(91145bae) SHA1(71b2695575f189a2fc72635831ba408f824d4928) ) - ROM_LOAD( "ith_ic24.rom", 0x100000, 0x080000, CRC(fc03fe3b) SHA1(7e34220b9b21b82e012dcbf3052cccb118e3c382) ) - ROM_LOAD( "ith_ic23.rom", 0x180000, 0x080000, CRC(ee156a0a) SHA1(4a303ed292ce79e3f990139c35b921213eb2711d) ) + ROM_LOAD( "ith_c0.ic26", 0x000000, 0x080000, CRC(4c1818cf) SHA1(fc8c2ae640bc3504a52736be46febb92c998fd7d) ) + ROM_LOAD( "ith_c1.ic25", 0x080000, 0x080000, CRC(91145bae) SHA1(71b2695575f189a2fc72635831ba408f824d4928) ) + ROM_LOAD( "ith_c2.ic24", 0x100000, 0x080000, CRC(fc03fe3b) SHA1(7e34220b9b21b82e012dcbf3052cccb118e3c382) ) + ROM_LOAD( "ith_c3.ic23", 0x180000, 0x080000, CRC(ee156a0a) SHA1(4a303ed292ce79e3f990139c35b921213eb2711d) ) ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */ - ROM_LOAD( "ith_ic34.rom", 0x000000, 0x100000, CRC(a019766e) SHA1(59012a41d152a471a95f1f86b6b1e0f9dd3f9711) ) - ROM_LOAD( "ith_ic35.rom", 0x100000, 0x100000, CRC(3fca3073) SHA1(bdae171cb7705647f28354ca83ecdea3a15f6e22) ) - ROM_LOAD( "ith_ic36.rom", 0x200000, 0x100000, CRC(20d1b28b) SHA1(290947d77242e837444766ff5d420bc9b53b5b01) ) - ROM_LOAD( "ith_ic37.rom", 0x300000, 0x100000, CRC(90b6fd4b) SHA1(99237ebab7cf4689e06965bd546cd80a825ab024) ) + ROM_LOAD( "ith_000.ic34", 0x000000, 0x100000, CRC(a019766e) SHA1(59012a41d152a471a95f1f86b6b1e0f9dd3f9711) ) + ROM_LOAD( "ith_010.ic35", 0x100000, 0x100000, CRC(3fca3073) SHA1(bdae171cb7705647f28354ca83ecdea3a15f6e22) ) + ROM_LOAD( "ith_020.ic36", 0x200000, 0x100000, CRC(20d1b28b) SHA1(290947d77242e837444766ff5d420bc9b53b5b01) ) + ROM_LOAD( "ith_030.ic37", 0x300000, 0x100000, CRC(90b6fd4b) SHA1(99237ebab7cf4689e06965bd546cd80a825ab024) ) ROM_REGION( 0x80000, "irem", 0 ) - ROM_LOAD( "ith_ic9.rom", 0x000000, 0x080000, CRC(318ee71a) SHA1(e6f49a7adf7155ba40c4f33a8fdc9553c00f5e3d) ) + ROM_LOAD( "ith_da.ic9", 0x000000, 0x080000, CRC(318ee71a) SHA1(e6f49a7adf7155ba40c4f33a8fdc9553c00f5e3d) ) ROM_END ROM_START( inthuntu ) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "ith-h0-c.bin", 0x000001, 0x040000, CRC(563dcec0) SHA1(0c7588ba603926fb0b490f2ba324ff73362a54d5) ) - ROM_LOAD16_BYTE( "ith-l0-c.bin", 0x000000, 0x040000, CRC(1638c705) SHA1(8ca7a12c2f75172d4c2c808ea666b2f2e969398c) ) - ROM_LOAD16_BYTE( "ith-h1-a.bin", 0x080001, 0x020000, CRC(0253065f) SHA1(a11e6bf014c19b2e317b75f01a7f0d7a9a85c7d3) ) - ROM_LOAD16_BYTE( "ith-l1-a.bin", 0x080000, 0x020000, CRC(a57d688d) SHA1(aa049de5c41097b6f1da31e9bf3bac132f67aa6c) ) + ROM_LOAD16_BYTE( "ith-h0-c.ic28", 0x000001, 0x040000, CRC(563dcec0) SHA1(0c7588ba603926fb0b490f2ba324ff73362a54d5) ) + ROM_LOAD16_BYTE( "ith-l0-c.ic39", 0x000000, 0x040000, CRC(1638c705) SHA1(8ca7a12c2f75172d4c2c808ea666b2f2e969398c) ) + ROM_LOAD16_BYTE( "ith-h1-a.ic38", 0x080001, 0x020000, CRC(0253065f) SHA1(a11e6bf014c19b2e317b75f01a7f0d7a9a85c7d3) ) + ROM_LOAD16_BYTE( "ith-l1-a.ic27", 0x080000, 0x020000, CRC(a57d688d) SHA1(aa049de5c41097b6f1da31e9bf3bac132f67aa6c) ) ROM_REGION( 0x20000, "soundcpu", 0 ) /* Irem D8000011A1 */ - ROM_LOAD16_BYTE( "ith-sh0.rom", 0x00001, 0x10000, CRC(209c8b7f) SHA1(eaf4a6d9222fe181df65cea1f13c3f2ebff2ec5b) ) - ROM_LOAD16_BYTE( "ith-sl0.rom", 0x00000, 0x10000, CRC(18472d65) SHA1(2705e94ee350ffda272c50ea3bf605826aa19978) ) + ROM_LOAD16_BYTE( "ith-sh0.ic30", 0x00001, 0x10000, CRC(209c8b7f) SHA1(eaf4a6d9222fe181df65cea1f13c3f2ebff2ec5b) ) + ROM_LOAD16_BYTE( "ith-sl0.ic31", 0x00000, 0x10000, CRC(18472d65) SHA1(2705e94ee350ffda272c50ea3bf605826aa19978) ) ROM_REGION( 0x200000, "gfx1", 0 ) /* Tiles */ - ROM_LOAD( "ith_ic26.rom", 0x000000, 0x080000, CRC(4c1818cf) SHA1(fc8c2ae640bc3504a52736be46febb92c998fd7d) ) - ROM_LOAD( "ith_ic25.rom", 0x080000, 0x080000, CRC(91145bae) SHA1(71b2695575f189a2fc72635831ba408f824d4928) ) - ROM_LOAD( "ith_ic24.rom", 0x100000, 0x080000, CRC(fc03fe3b) SHA1(7e34220b9b21b82e012dcbf3052cccb118e3c382) ) - ROM_LOAD( "ith_ic23.rom", 0x180000, 0x080000, CRC(ee156a0a) SHA1(4a303ed292ce79e3f990139c35b921213eb2711d) ) + ROM_LOAD( "ith_c0.ic26", 0x000000, 0x080000, CRC(4c1818cf) SHA1(fc8c2ae640bc3504a52736be46febb92c998fd7d) ) + ROM_LOAD( "ith_c1.ic25", 0x080000, 0x080000, CRC(91145bae) SHA1(71b2695575f189a2fc72635831ba408f824d4928) ) + ROM_LOAD( "ith_c2.ic24", 0x100000, 0x080000, CRC(fc03fe3b) SHA1(7e34220b9b21b82e012dcbf3052cccb118e3c382) ) + ROM_LOAD( "ith_c3.ic23", 0x180000, 0x080000, CRC(ee156a0a) SHA1(4a303ed292ce79e3f990139c35b921213eb2711d) ) ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */ - ROM_LOAD( "ith_ic34.rom", 0x000000, 0x100000, CRC(a019766e) SHA1(59012a41d152a471a95f1f86b6b1e0f9dd3f9711) ) - ROM_LOAD( "ith_ic35.rom", 0x100000, 0x100000, CRC(3fca3073) SHA1(bdae171cb7705647f28354ca83ecdea3a15f6e22) ) - ROM_LOAD( "ith_ic36.rom", 0x200000, 0x100000, CRC(20d1b28b) SHA1(290947d77242e837444766ff5d420bc9b53b5b01) ) - ROM_LOAD( "ith_ic37.rom", 0x300000, 0x100000, CRC(90b6fd4b) SHA1(99237ebab7cf4689e06965bd546cd80a825ab024) ) + ROM_LOAD( "ith_000.ic34", 0x000000, 0x100000, CRC(a019766e) SHA1(59012a41d152a471a95f1f86b6b1e0f9dd3f9711) ) + ROM_LOAD( "ith_010.ic35", 0x100000, 0x100000, CRC(3fca3073) SHA1(bdae171cb7705647f28354ca83ecdea3a15f6e22) ) + ROM_LOAD( "ith_020.ic36", 0x200000, 0x100000, CRC(20d1b28b) SHA1(290947d77242e837444766ff5d420bc9b53b5b01) ) + ROM_LOAD( "ith_030.ic37", 0x300000, 0x100000, CRC(90b6fd4b) SHA1(99237ebab7cf4689e06965bd546cd80a825ab024) ) ROM_REGION( 0x80000, "irem", 0 ) - ROM_LOAD( "ith_ic9.rom", 0x000000, 0x080000, CRC(318ee71a) SHA1(e6f49a7adf7155ba40c4f33a8fdc9553c00f5e3d) ) + ROM_LOAD( "ith_da.ic9", 0x000000, 0x080000, CRC(318ee71a) SHA1(e6f49a7adf7155ba40c4f33a8fdc9553c00f5e3d) ) ROM_END ROM_START( kaiteids ) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD16_BYTE( "ith-h0j.bin", 0x000001, 0x040000, CRC(dc1dec36) SHA1(f0a6e3be19752bffd9fd5f435405c8f591eab258) ) - ROM_LOAD16_BYTE( "ith-l0j.bin", 0x000000, 0x040000, CRC(8835d704) SHA1(42be25ccdc31824797a17e6f76bd06edfe853833) ) - ROM_LOAD16_BYTE( "ith-h1j.bin", 0x080001, 0x020000, CRC(5a7b212d) SHA1(50562d804a43aed7c34c19c8345782ac2f85caa7) ) - ROM_LOAD16_BYTE( "ith-l1j.bin", 0x080000, 0x020000, CRC(4c084494) SHA1(4f32003db32f13e19dd07c66996b4328ac2a671e) ) + ROM_LOAD16_BYTE( "ith-h0j.ic28", 0x000001, 0x040000, CRC(dc1dec36) SHA1(f0a6e3be19752bffd9fd5f435405c8f591eab258) ) + ROM_LOAD16_BYTE( "ith-l0j.ic39", 0x000000, 0x040000, CRC(8835d704) SHA1(42be25ccdc31824797a17e6f76bd06edfe853833) ) + ROM_LOAD16_BYTE( "ith-h1j.ic38", 0x080001, 0x020000, CRC(5a7b212d) SHA1(50562d804a43aed7c34c19c8345782ac2f85caa7) ) + ROM_LOAD16_BYTE( "ith-l1j.ic27", 0x080000, 0x020000, CRC(4c084494) SHA1(4f32003db32f13e19dd07c66996b4328ac2a671e) ) ROM_REGION( 0x20000, "soundcpu", 0 ) /* Irem D8000011A1 */ - ROM_LOAD16_BYTE( "ith-sh0.rom", 0x00001, 0x10000, CRC(209c8b7f) SHA1(eaf4a6d9222fe181df65cea1f13c3f2ebff2ec5b) ) - ROM_LOAD16_BYTE( "ith-sl0.rom", 0x00000, 0x10000, CRC(18472d65) SHA1(2705e94ee350ffda272c50ea3bf605826aa19978) ) + ROM_LOAD16_BYTE( "ith-sh0.ic30", 0x00001, 0x10000, CRC(209c8b7f) SHA1(eaf4a6d9222fe181df65cea1f13c3f2ebff2ec5b) ) + ROM_LOAD16_BYTE( "ith-sl0.ic31", 0x00000, 0x10000, CRC(18472d65) SHA1(2705e94ee350ffda272c50ea3bf605826aa19978) ) ROM_REGION( 0x200000, "gfx1", 0 ) /* Tiles */ - ROM_LOAD( "ith_ic26.rom", 0x000000, 0x080000, CRC(4c1818cf) SHA1(fc8c2ae640bc3504a52736be46febb92c998fd7d) ) - ROM_LOAD( "ith_ic25.rom", 0x080000, 0x080000, CRC(91145bae) SHA1(71b2695575f189a2fc72635831ba408f824d4928) ) - ROM_LOAD( "ith_ic24.rom", 0x100000, 0x080000, CRC(fc03fe3b) SHA1(7e34220b9b21b82e012dcbf3052cccb118e3c382) ) - ROM_LOAD( "ith_ic23.rom", 0x180000, 0x080000, CRC(ee156a0a) SHA1(4a303ed292ce79e3f990139c35b921213eb2711d) ) + ROM_LOAD( "ith_c0.ic26", 0x000000, 0x080000, CRC(4c1818cf) SHA1(fc8c2ae640bc3504a52736be46febb92c998fd7d) ) + ROM_LOAD( "ith_c1.ic25", 0x080000, 0x080000, CRC(91145bae) SHA1(71b2695575f189a2fc72635831ba408f824d4928) ) + ROM_LOAD( "ith_c2.ic24", 0x100000, 0x080000, CRC(fc03fe3b) SHA1(7e34220b9b21b82e012dcbf3052cccb118e3c382) ) + ROM_LOAD( "ith_c3.ic23", 0x180000, 0x080000, CRC(ee156a0a) SHA1(4a303ed292ce79e3f990139c35b921213eb2711d) ) ROM_REGION( 0x400000, "gfx2", 0 ) /* Sprites */ - ROM_LOAD( "ith_ic34.rom", 0x000000, 0x100000, CRC(a019766e) SHA1(59012a41d152a471a95f1f86b6b1e0f9dd3f9711) ) - ROM_LOAD( "ith_ic35.rom", 0x100000, 0x100000, CRC(3fca3073) SHA1(bdae171cb7705647f28354ca83ecdea3a15f6e22) ) - ROM_LOAD( "ith_ic36.rom", 0x200000, 0x100000, CRC(20d1b28b) SHA1(290947d77242e837444766ff5d420bc9b53b5b01) ) - ROM_LOAD( "ith_ic37.rom", 0x300000, 0x100000, CRC(90b6fd4b) SHA1(99237ebab7cf4689e06965bd546cd80a825ab024) ) + ROM_LOAD( "ith_000.ic34", 0x000000, 0x100000, CRC(a019766e) SHA1(59012a41d152a471a95f1f86b6b1e0f9dd3f9711) ) + ROM_LOAD( "ith_010.ic35", 0x100000, 0x100000, CRC(3fca3073) SHA1(bdae171cb7705647f28354ca83ecdea3a15f6e22) ) + ROM_LOAD( "ith_020.ic36", 0x200000, 0x100000, CRC(20d1b28b) SHA1(290947d77242e837444766ff5d420bc9b53b5b01) ) + ROM_LOAD( "ith_030.ic37", 0x300000, 0x100000, CRC(90b6fd4b) SHA1(99237ebab7cf4689e06965bd546cd80a825ab024) ) ROM_REGION( 0x80000, "irem", 0 ) - ROM_LOAD( "ith_ic9.rom", 0x000000, 0x080000, CRC(318ee71a) SHA1(e6f49a7adf7155ba40c4f33a8fdc9553c00f5e3d) ) + ROM_LOAD( "ith_da.ic9", 0x000000, 0x080000, CRC(318ee71a) SHA1(e6f49a7adf7155ba40c4f33a8fdc9553c00f5e3d) ) ROM_END ROM_START( hook ) diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp index 2db4d331526..925d4cb9bce 100644 --- a/src/mame/drivers/mac.cpp +++ b/src/mame/drivers/mac.cpp @@ -41,13 +41,13 @@ when the PC hits GetCPUID, the move.l (a2), d0 at PC = 0x10000 will cause an MMU fault (jump to 0xFFF00300). why? a2 = 0x5ffffffc (the CPU ID register). MMU is unable to resolve this; defect in the MMU emulation probable. - TODO: - - SE and Classic to own driver - - Portable and PowerBook 100 to own driver - - Remaining PowerBooks to own driver - - Quadra 700 to own driver - - V8 and friends to own driver - - LC3 / LC520 / IIvx / IIvi to own driver + TODO: + - SE and Classic to own driver + - Portable and PowerBook 100 to own driver + - Remaining PowerBooks to own driver + - Quadra 700 to own driver + - V8 and friends to own driver + - LC3 / LC520 / IIvx / IIvi to own driver ****************************************************************************/ @@ -779,26 +779,6 @@ void mac_state::macpd210_map(address_map &map) map(0x60000000, 0x6001ffff).ram().share("vram").mirror(0x0ffe0000); } -void mac_state::quadra700_map(address_map &map) -{ - map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000); - - map(0x50000000, 0x50001fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w)).mirror(0x00fc0000); - map(0x50002000, 0x50003fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w)).mirror(0x00fc0000); -// 50008000 = Ethernet MAC ID PROM -// 5000a000 = Sonic (DP83932) ethernet -// 5000f000 = SCSI cf96, 5000f402 = SCSI #2 cf96 - map(0x5000f000, 0x5000f3ff).rw(FUNC(mac_state::mac_5396_r), FUNC(mac_state::mac_5396_w)).mirror(0x00fc0000); - map(0x5000c000, 0x5000dfff).rw(FUNC(mac_state::mac_scc_r), FUNC(mac_state::mac_scc_2_w)).mirror(0x00fc0000); - map(0x50014000, 0x50015fff).rw(m_asc, FUNC(asc_device::read), FUNC(asc_device::write)).mirror(0x00fc0000); - map(0x5001e000, 0x5001ffff).rw(FUNC(mac_state::mac_iwm_r), FUNC(mac_state::mac_iwm_w)).mirror(0x00fc0000); - - // f9800000 = VDAC / DAFB - map(0xf9000000, 0xf91fffff).ram().share("vram"); - map(0xf9800000, 0xf98001ff).rw(FUNC(mac_state::dafb_r), FUNC(mac_state::dafb_w)); - map(0xf9800200, 0xf980023f).rw(FUNC(mac_state::dafb_dac_r), FUNC(mac_state::dafb_dac_w)); -} - void mac_state::pwrmac_map(address_map &map) { map(0x00000000, 0x007fffff).ram(); // 8 MB standard @@ -1537,54 +1517,6 @@ void mac_state::pwrmac(machine_config &config) add_cuda(config, CUDA_341S0060); } -void mac_state::macqd700(machine_config &config) -{ - /* basic machine hardware */ - M68040(config, m_maincpu, 25000000); - m_maincpu->set_addrmap(AS_PROGRAM, &mac_state::quadra700_map); - m_maincpu->set_dasm_override(FUNC(mac_state::mac_dasm_override)); - - SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_refresh_hz(75.08); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1260)); - m_screen->set_size(1152, 870); - m_screen->set_visarea(0, 1152-1, 0, 870-1); - m_screen->set_screen_update(FUNC(mac_state::screen_update_macdafb)); - - MCFG_VIDEO_START_OVERRIDE(mac_state,macdafb) - MCFG_VIDEO_RESET_OVERRIDE(mac_state,macdafb) - - PALETTE(config, m_palette).set_entries(256); - - add_asc(config, asc_device::asc_type::EASC); - add_base_devices(config, true, false); - - add_nubus(config, false, false); - NUBUS_SLOT(config, "nbd", "nubus", mac_nubus_cards, nullptr); - NUBUS_SLOT(config, "nbe", "nubus", mac_nubus_cards, nullptr); - - add_via1_adb(config, false); - m_via1->readpb_handler().set(FUNC(mac_state::mac_via_in_b)); - - add_via2(config); - - scsi_port_device &scsibus(SCSI_PORT(config, "scsi")); - scsibus.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_6)); - scsibus.set_slot_device(2, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_5)); - - NCR539X(config, m_539x_1, C7M); - m_539x_1->set_scsi_port("scsi"); - m_539x_1->irq_callback().set(FUNC(mac_state::irq_539x_1_w)); - m_539x_1->drq_callback().set(FUNC(mac_state::drq_539x_1_w)); - - /* internal ram */ - RAM(config, m_ram); - m_ram->set_default_size("4M"); - m_ram->set_extra_options("8M,16M,32M,64M,68M,72M,80M,96M,128M"); - - SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop"); -} - static INPUT_PORTS_START( macadb ) INPUT_PORTS_END @@ -1754,11 +1686,6 @@ ROM_START( macpb170 ) ROM_LOAD( "pmuv2.bin", 0x000000, 0x001800, CRC(1a32b5e5) SHA1(7c096324763cfc8d2024893b3e8493b7729b3a92) ) ROM_END -ROM_START( macqd700 ) - ROM_REGION32_BE(0x100000, "bootrom", 0) - ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) -ROM_END - ROM_START( macpb160 ) ROM_REGION32_BE(0x100000, "bootrom", 0) ROM_LOAD( "e33b2724.rom", 0x000000, 0x100000, CRC(536c60f4) SHA1(c0510682ae6d973652d7e17f3c3b27629c47afac) ) @@ -1816,7 +1743,6 @@ COMP( 1990, maciisi, 0, 0, maciisi, maciici, mac_state, init_maci COMP( 1991, macpb100, 0, 0, macprtb, macadb, mac_state, init_macprtb, "Apple Computer", "Macintosh PowerBook 100", MACHINE_NOT_WORKING ) COMP( 1991, macpb140, 0, 0, macpb140, macadb, mac_state, init_macpb140, "Apple Computer", "Macintosh PowerBook 140", MACHINE_NOT_WORKING ) COMP( 1991, macpb170, macpb140, 0, macpb170, macadb, mac_state, init_macpb140, "Apple Computer", "Macintosh PowerBook 170", MACHINE_NOT_WORKING ) -COMP( 1991, macqd700, macpb140, 0, macqd700, macadb, mac_state, init_macquadra700, "Apple Computer", "Macintosh Quadra 700", MACHINE_NOT_WORKING ) COMP( 1991, macclas2, 0, 0, macclas2, macadb, mac_state, init_macclassic2, "Apple Computer", "Macintosh Classic II", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND ) COMP( 1991, maclc2, 0, 0, maclc2, maciici, mac_state, init_maclc2, "Apple Computer", "Macintosh LC II", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_SOUND ) COMP( 1992, macpb145, macpb140, 0, macpb145, macadb, mac_state, init_macpb140, "Apple Computer", "Macintosh PowerBook 145", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp index de3e93a68d8..95540d9a50a 100644 --- a/src/mame/drivers/mac128.cpp +++ b/src/mame/drivers/mac128.cpp @@ -6,8 +6,8 @@ Original-style Macintosh family emulation The cutoff here is Macs with 128k-style video and audio. - We also include the SE and Classic, which are basically cost-reduced Mac Pluses with ADB - instead of the original keyboard/mouse hardware. + We also include the SE and Classic, which are basically cost-reduced Mac Pluses with ADB + instead of the original keyboard/mouse hardware. Nate Woods, Raphael Nabet, R. Belmont @@ -246,11 +246,8 @@ private: uint32_t m_overlay; int m_irq_count, m_ca1_data, m_ca2_data; - int m_mouse_bit_x; - int m_mouse_bit_y; - int last_mx, last_my; - int count_x, count_y; - int m_last_was_x; + uint8_t m_mouse_bit[2], m_mouse_last[2]; + int16_t m_mouse_last_m[2], m_mouse_count[2]; int m_screen_buffer; emu_timer *m_scan_timer; emu_timer *m_hblank_timer; @@ -288,13 +285,10 @@ void mac128_state::machine_start() save_item(NAME(m_irq_count)); save_item(NAME(m_ca1_data)); save_item(NAME(m_ca2_data)); - save_item(NAME(m_mouse_bit_x)); - save_item(NAME(m_mouse_bit_y)); - save_item(NAME(last_mx)); - save_item(NAME(last_my)); - save_item(NAME(count_x)); - save_item(NAME(count_y)); - save_item(NAME(m_last_was_x)); + save_item(NAME(m_mouse_bit)); + save_item(NAME(m_mouse_last)); + save_item(NAME(m_mouse_last_m)); + save_item(NAME(m_mouse_count)); save_item(NAME(m_screen_buffer)); save_item(NAME(m_scc_interrupt)); save_item(NAME(m_via_interrupt)); @@ -306,6 +300,9 @@ void mac128_state::machine_start() save_item(NAME(m_adb_irq_pending)); save_item(NAME(m_drive_select)); save_item(NAME(m_scsiirq_enable)); + + m_mouse_bit[0] = m_mouse_bit[1] = 0; + m_mouse_last[0] = m_mouse_last[1] = 0; } void mac128_state::machine_reset() @@ -314,7 +311,6 @@ void mac128_state::machine_reset() m_last_taken_interrupt = -1; m_overlay = 1; m_screen_buffer = 1; - m_mouse_bit_x = m_mouse_bit_y = 0; m_last_taken_interrupt = 0; m_snd_enable = false; m_main_buffer = true; @@ -336,7 +332,7 @@ uint16_t mac128_state::ram_r(offs_t offset) { if (m_overlay) { - return m_rom_ptr[offset]; + return m_rom_ptr[offset & 0x7ffff]; } return m_ram_ptr[offset & m_ram_mask]; @@ -379,7 +375,7 @@ void mac128_state::field_interrupts() take_interrupt = 1; } -// printf("field_interrupts: take %d\n", take_interrupt); +// printf("field_interrupts: take %d\n", take_interrupt); if (m_last_taken_interrupt > -1) { @@ -518,137 +514,32 @@ void mac128_state::macplus_scsi_w(offs_t offset, uint16_t data, uint16_t mem_mas void mac128_state::scc_mouse_irq(int x, int y) { - static int lasty = 0; - static int lastx = 0; - // DCD lines are active low in hardware but active high to software - if (x && y) + if (x) { - if (m_last_was_x) + m_scc->dcda_w(m_mouse_last[0] ? 1 : 0); + if (x < 0) { - if(x == 2) - { - if(lastx) - { - m_scc->dcda_w(1); - m_mouse_bit_x = 0; - } - else - { - m_scc->dcda_w(0); - m_mouse_bit_x = 1; - } - } - else - { - if(lastx) - { - m_scc->dcda_w(1); - m_mouse_bit_x = 1; - } - else - { - m_scc->dcda_w(0); - m_mouse_bit_x = 0; - } - } - lastx = !lastx; + m_mouse_bit[0] = m_mouse_last[0] ? 0 : 1; } else { - if(y == 2) - { - if(lasty) - { - m_scc->dcdb_w(1); - m_mouse_bit_y = 0; - } - else - { - m_scc->dcdb_w(0); - m_mouse_bit_y = 1; - } - } - else - { - if(lasty) - { - m_scc->dcdb_w(1); - m_mouse_bit_y = 1; - } - else - { - m_scc->dcdb_w(0); - m_mouse_bit_y = 0; - } - } - lasty = !lasty; + m_mouse_bit[0] = m_mouse_last[0] ? 1 : 0; } - - m_last_was_x ^= 1; + m_mouse_last[0] = !m_mouse_last[0]; } - else + if (y) { - if (x) + m_scc->dcdb_w(m_mouse_last[1] ? 1 : 0); + if (y < 0) { - if(x == 2) - { - if(lastx) - { - m_scc->dcda_w(1); - m_mouse_bit_x = 0; - } - else - { - m_scc->dcda_w(0); - m_mouse_bit_x = 1; - } - } - else - { - if(lastx) - { - m_scc->dcda_w(1); - m_mouse_bit_x = 1; - } - else - { - m_scc->dcda_w(0); - m_mouse_bit_x = 0; - } - } - lastx = !lastx; + m_mouse_bit[1] = m_mouse_last[1] ? 0 : 1; } else { - if(y == 2) - { - if(lasty) - { - m_scc->dcdb_w(1); - m_mouse_bit_y = 0; - } - else - { - m_scc->dcdb_w(0); - m_mouse_bit_y = 1; - } - } - else - { - if(lasty) - { - m_scc->dcdb_w(1); - m_mouse_bit_y = 1; - } - else - { - m_scc->dcdb_w(0); - m_mouse_bit_y = 0; - } - } - lasty = !lasty; + m_mouse_bit[1] = m_mouse_last[1] ? 1 : 0; } + m_mouse_last[1] = !m_mouse_last[1]; } } @@ -748,16 +639,13 @@ uint8_t mac128_state::mac_via_in_b() { int val = 0x40; - if (m_mouse_bit_y) /* Mouse Y2 */ - val |= 0x20; - if (m_mouse_bit_x) /* Mouse X2 */ - val |= 0x10; - if ((m_mouse0->read() & 0x01) == 0) - val |= 0x08; + val |= m_mouse_bit[1] << 5; // Mouse Y2 + val |= m_mouse_bit[0] << 4; // Mouse X2 + val |= BIT(~m_mouse0->read(), 0) << 3; val |= m_rtc->data_r(); -// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val); +// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val); return val; } @@ -849,79 +737,66 @@ void mac128_state::mac_via_out_b_se(uint8_t data) void mac128_state::mouse_callback() { - int new_mx, new_my; - int x_needs_update = 0, y_needs_update = 0; - - new_mx = m_mouse1->read(); - new_my = m_mouse2->read(); - - /* see if it moved in the x coord */ - if (new_mx != last_mx) + // see if it moved in the x coord + const int new_mx = m_mouse1->read(); + if (new_mx != m_mouse_last_m[0]) { - int diff = new_mx - last_mx; + int diff = new_mx - m_mouse_last_m[0]; - /* check for wrap */ + // check for wrap if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; + diff -= 0x100; + else if (diff < -0x80) + diff += 0x100; - count_x += diff; - - last_mx = new_mx; + m_mouse_count[0] += diff; + m_mouse_last_m[0] = new_mx; } - /* see if it moved in the y coord */ - if (new_my != last_my) + + // see if it moved in the y coord + const int new_my = m_mouse2->read(); + if (new_my != m_mouse_last_m[1]) { - int diff = new_my - last_my; + int diff = new_my - m_mouse_last_m[1]; - /* check for wrap */ + // check for wrap if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; - - count_y += diff; + diff -= 0x100; + else if (diff < -0x80) + diff += 0x100; - last_my = new_my; + m_mouse_count[1] += diff; + m_mouse_last_m[1] = new_my; } - /* update any remaining count and then return */ - if (count_x) + // update any remaining count and then return + int x_needs_update = 0; + if (m_mouse_count[0] < 0) { - if (count_x < 0) - { - count_x++; - m_mouse_bit_x = 0; - x_needs_update = 2; - } - else - { - count_x--; - m_mouse_bit_x = 1; - x_needs_update = 1; - } + m_mouse_count[0]++; + x_needs_update = -1; } - else if (count_y) + else if (m_mouse_count[0]) { - if (count_y < 0) - { - count_y++; - m_mouse_bit_y = 1; - y_needs_update = 1; - } - else - { - count_y--; - m_mouse_bit_y = 0; - y_needs_update = 2; - } + m_mouse_count[0]--; + x_needs_update = 1; + } + int y_needs_update = 0; + if (m_mouse_count[1] < 0) + { + m_mouse_count[1]++; + y_needs_update = 1; + } + else if (m_mouse_count[1]) + { + m_mouse_count[1]--; + y_needs_update = -1; } if (x_needs_update || y_needs_update) { - /* assert Port B External Interrupt on the SCC */ - scc_mouse_irq(x_needs_update, y_needs_update ); + // assert Port B External Interrupt on the SCC + scc_mouse_irq(x_needs_update, y_needs_update); } } @@ -938,23 +813,17 @@ void mac128_state::mac_driver_init(mac128model_t model) uint32_t mac128_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = m_ram_size - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const uint16_t *) (m_ram_ptr + video_base); + uint32_t const video_base = m_ram_size - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + uint16_t const *video_ram = (const uint16_t *) (m_ram_ptr + video_base); - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + uint16_t const word = *(video_ram++); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -1170,10 +1039,10 @@ static INPUT_PORTS_START( macplus ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) PORT_START("MOUSE1") /* Mouse - X AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_START("MOUSE2") /* Mouse - Y AXIS */ - PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) INPUT_PORTS_END static INPUT_PORTS_START( macadb ) diff --git a/src/mame/drivers/macquadra700.cpp b/src/mame/drivers/macquadra700.cpp new file mode 100644 index 00000000000..72a96568aed --- /dev/null +++ b/src/mame/drivers/macquadra700.cpp @@ -0,0 +1,936 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/**************************************************************************** + + drivers/macquadra700.cpp + Mac Quadra 700 emulation. (900/950 are IOP-based and closer to the IIfx) + + By R. Belmont + +****************************************************************************/ + +#include "emu.h" + +#include "machine/macrtc.h" +#include "cpu/m68000/m68000.h" +#include "machine/6522via.h" +#include "machine/applefdc.h" +#include "machine/ram.h" +#include "machine/sonydriv.h" +#include "machine/swim.h" +#include "machine/timer.h" +#include "machine/z80scc.h" +#include "machine/macadb.h" +#include "machine/dp83932c.h" +#include "sound/asc.h" +#include "formats/ap_dsk35.h" + +#include "bus/nubus/nubus.h" +#include "bus/nubus/nubus_48gc.h" +#include "bus/nubus/nubus_cb264.h" +#include "bus/nubus/nubus_vikbw.h" +#include "bus/nubus/nubus_specpdq.h" +#include "bus/nubus/nubus_m2hires.h" +#include "bus/nubus/nubus_spec8.h" +#include "bus/nubus/nubus_radiustpd.h" +#include "bus/nubus/nubus_wsportrait.h" +#include "bus/nubus/nubus_asntmc3b.h" +#include "bus/nubus/nubus_image.h" +#include "bus/nubus/nubus_m2video.h" +#include "bus/nubus/bootbug.h" +#include "bus/nubus/quadralink.h" +#include "bus/nubus/laserview.h" + +#include "emupal.h" +#include "screen.h" +#include "softlist.h" +#include "speaker.h" + +#define C7M (7833600) +#define C15M (C7M*2) +#define C32M (C15M*2) + +class macquadra_state : public driver_device +{ +public: + macquadra_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_via1(*this, "via1"), + m_via2(*this, "via2"), + m_macadb(*this, "macadb"), + m_ram(*this, RAM_TAG), + m_iwm(*this, "fdc"), + m_rtc(*this,"rtc"), + m_sonic(*this, "sonic"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_easc(*this, "easc"), + m_scc(*this, "scc"), + m_vram(*this, "vram") + { + } + + void macqd700(machine_config &config); + void quadra700_map(address_map &map); + + void init_macqd700(); + +private: + required_device<m68040_device> m_maincpu; + required_device<via6522_device> m_via1, m_via2; + optional_device<macadb_device> m_macadb; + required_device<ram_device> m_ram; + required_device<applefdc_base_device> m_iwm; + required_device<rtc3430042_device> m_rtc; + required_device<dp83932c_device> m_sonic; + required_device<screen_device> m_screen; + required_device<palette_device> m_palette; + required_device<asc_device> m_easc; + required_device<z80scc_device> m_scc; + required_shared_ptr<uint32_t> m_vram; + + virtual void machine_start() override; + virtual void machine_reset() override; + + uint32_t screen_update_dafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t dafb_r(offs_t offset, uint32_t mem_mask = ~0); + void dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); + uint32_t dafb_dac_r(offs_t offset, uint32_t mem_mask = ~0); + void dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); + void dafb_recalc_ints(); + + TIMER_CALLBACK_MEMBER(dafb_vbl_tick); + TIMER_CALLBACK_MEMBER(dafb_cursor_tick); + DECLARE_VIDEO_START(macdafb); + DECLARE_VIDEO_RESET(macdafb); + + u32 *m_ram_ptr, *m_rom_ptr; + u32 m_ram_mask, m_ram_size, m_rom_size; + + emu_timer *m_vbl_timer, *m_cursor_timer, *m_6015_timer; + + uint16_t m_cursor_line; + uint16_t m_dafb_int_status; + int m_dafb_scsi1_drq, m_dafb_scsi2_drq; + uint8_t m_dafb_mode; + uint32_t m_dafb_base, m_dafb_stride; + uint32_t m_dafb_colors[3], m_dafb_count, m_dafb_clutoffs, m_dafb_montype, m_dafb_vbltime; + uint32_t m_dafb_palette[256]; + + DECLARE_WRITE_LINE_MEMBER(nubus_irq_9_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_a_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_b_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_c_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_d_w); + DECLARE_WRITE_LINE_MEMBER(nubus_irq_e_w); + void nubus_slot_interrupt(uint8_t slot, uint32_t state); + int m_via2_ca1_hack, m_nubus_irq_state; + + WRITE_LINE_MEMBER(adb_irq_w) { m_adb_irq_pending = state; } + int m_adb_irq_pending; + + DECLARE_WRITE_LINE_MEMBER(irq_539x_1_w); + DECLARE_WRITE_LINE_MEMBER(irq_539x_2_w); + DECLARE_WRITE_LINE_MEMBER(drq_539x_1_w); + DECLARE_WRITE_LINE_MEMBER(drq_539x_2_w); + + uint16_t mac_via_r(offs_t offset); + void mac_via_w(offs_t offset, uint16_t data, uint16_t mem_mask); + uint16_t mac_via2_r(offs_t offset); + void mac_via2_w(offs_t offset, uint16_t data, uint16_t mem_mask); + uint8_t mac_via_in_a(); + uint8_t mac_via_in_b(); + void mac_via_out_a(uint8_t data); + void mac_via_out_b(uint8_t data); + uint8_t mac_via2_in_a(); + uint8_t mac_via2_in_b(); + void mac_via2_out_a(uint8_t data); + void mac_via2_out_b(uint8_t data); + void field_interrupts(); + DECLARE_WRITE_LINE_MEMBER(mac_via_irq); + DECLARE_WRITE_LINE_MEMBER(mac_via2_irq); + TIMER_CALLBACK_MEMBER(mac_6015_tick); + WRITE_LINE_MEMBER(via_cb2_w) { m_macadb->adb_data_w(state); } + int m_via_cycles, m_via_interrupt, m_via2_interrupt, m_scc_interrupt, m_last_taken_interrupt; + int m_irq_count, m_ca1_data, m_ca2_data; + + uint32_t rom_switch_r(offs_t offset); + bool m_overlay; + + uint16_t mac_scc_r(offs_t offset) + { + uint16_t result = m_scc->dc_ab_r(offset); + return (result << 8) | result; + } + void mac_scc_2_w(offs_t offset, uint16_t data) { m_scc->dc_ab_w(offset, data >> 8); } + + uint16_t mac_iwm_r(offs_t offset, uint16_t mem_mask) + { + uint16_t result = m_iwm->read(offset >> 8); + return (result << 8) | result; + } + void mac_iwm_w(offs_t offset, uint16_t data, uint16_t mem_mask) + { + if (ACCESSING_BITS_0_7) + m_iwm->write((offset >> 8), data & 0xff); + else + m_iwm->write((offset >> 8), data>>8); + } +}; + +void macquadra_state::field_interrupts() +{ + int take_interrupt = -1; + + if (m_scc_interrupt) + { + take_interrupt = 4; + } + else if (m_via2_interrupt) + { + take_interrupt = 2; + } + else if (m_via_interrupt) + { + take_interrupt = 1; + } + + if (m_last_taken_interrupt > -1) + { + m_maincpu->set_input_line(m_last_taken_interrupt, CLEAR_LINE); + m_last_taken_interrupt = -1; + } + + if (take_interrupt > -1) + { + m_maincpu->set_input_line(take_interrupt, ASSERT_LINE); + m_last_taken_interrupt = take_interrupt; + } +} + +void macquadra_state::machine_start() +{ + m_ram_ptr = (u32*)m_ram->pointer(); + m_ram_size = m_ram->size()>>1; + m_ram_mask = m_ram_size - 1; + m_rom_ptr = (u32*)memregion("bootrom")->base(); + m_rom_size = memregion("bootrom")->bytes(); + m_via_cycles = -50; + m_via_interrupt = m_via2_interrupt = m_scc_interrupt = 0; + m_last_taken_interrupt = -1; + m_irq_count = m_ca1_data = m_ca2_data = 0; + + m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::mac_6015_tick),this)); + m_6015_timer->adjust(attotime::never); +} + +void macquadra_state::machine_reset() +{ + m_nubus_irq_state = 0xff; + m_via2_ca1_hack = 1; + m_via2->write_ca1(1); + m_via2->write_cb1(1); + m_overlay = true; + m_via_interrupt = m_via2_interrupt = m_scc_interrupt = 0; + m_last_taken_interrupt = -1; + m_irq_count = m_ca1_data = m_ca2_data = 0; + + // put ROM mirror at 0 + address_space& space = m_maincpu->space(AS_PROGRAM); + const u32 memory_size = std::min((u32)0x3fffff, m_rom_size); + const u32 memory_end = memory_size - 1; + offs_t memory_mirror = memory_end & ~(memory_size - 1); + + space.unmap_write(0x00000000, memory_end); + space.install_read_bank(0x00000000, memory_end & ~memory_mirror, memory_mirror, "bank1"); + membank("bank1")->set_base(m_rom_ptr); + + // start 60.15 Hz timer + m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); +} + +void macquadra_state::init_macqd700() +{ +} + +void macquadra_state::nubus_slot_interrupt(uint8_t slot, uint32_t state) +{ + static const uint8_t masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 }; + uint8_t mask = 0xff; + + slot -= 9; + + if (state) + { + m_nubus_irq_state &= ~masks[slot]; + } + else + { + m_nubus_irq_state |= masks[slot]; + } + + if ((m_nubus_irq_state & mask) != mask) + { + // HACK: sometimes we miss an ack (possible misbehavior in the VIA?) + if (m_via2_ca1_hack == 0) + { + m_via2->write_ca1(1); + } + m_via2_ca1_hack = 0; + m_via2->write_ca1(0); + } + else + { + m_via2_ca1_hack = 1; + m_via2->write_ca1(1); + } +} + +WRITE_LINE_MEMBER(macquadra_state::nubus_irq_9_w) { nubus_slot_interrupt(9, state); } +WRITE_LINE_MEMBER(macquadra_state::nubus_irq_a_w) { nubus_slot_interrupt(0xa, state); } +WRITE_LINE_MEMBER(macquadra_state::nubus_irq_b_w) { nubus_slot_interrupt(0xb, state); } +WRITE_LINE_MEMBER(macquadra_state::nubus_irq_c_w) { nubus_slot_interrupt(0xc, state); } +WRITE_LINE_MEMBER(macquadra_state::nubus_irq_d_w) { nubus_slot_interrupt(0xd, state); } +WRITE_LINE_MEMBER(macquadra_state::nubus_irq_e_w) { nubus_slot_interrupt(0xe, state); } + +// DAFB: video for Quadra 700/900 + +void macquadra_state::dafb_recalc_ints() +{ + if (m_dafb_int_status != 0) + { + nubus_slot_interrupt(0xf, ASSERT_LINE); + } + else + { + nubus_slot_interrupt(0xf, CLEAR_LINE); + } +} + +TIMER_CALLBACK_MEMBER(macquadra_state::dafb_vbl_tick) +{ + m_dafb_int_status |= 1; + dafb_recalc_ints(); + + m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); +} + +TIMER_CALLBACK_MEMBER(macquadra_state::dafb_cursor_tick) +{ + m_dafb_int_status |= 4; + dafb_recalc_ints(); + + m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); +} + +VIDEO_START_MEMBER(macquadra_state,macdafb) +{ + m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::dafb_vbl_tick),this)); + m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macquadra_state::dafb_cursor_tick),this)); + + m_vbl_timer->adjust(attotime::never); + m_cursor_timer->adjust(attotime::never); +} + +VIDEO_RESET_MEMBER(macquadra_state,macdafb) +{ + m_dafb_count = 0; + m_dafb_clutoffs = 0; + m_dafb_montype = 6; + m_dafb_vbltime = 0; + m_dafb_int_status = 0; + m_dafb_mode = 0; + m_dafb_base = 0x1000; + m_dafb_stride = 256*4; + + memset(m_dafb_palette, 0, sizeof(m_dafb_palette)); +} + +uint32_t macquadra_state::dafb_r(offs_t offset, uint32_t mem_mask) +{ +// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); + + switch (offset<<2) + { + case 0x1c: // inverse of monitor sense + return 7; // 21" color 2-page + + case 0x24: // SCSI 539x #1 status + return m_dafb_scsi1_drq<<9; + + case 0x28: // SCSI 539x #2 status + return m_dafb_scsi2_drq<<9; + + case 0x108: // IRQ/VBL status + return m_dafb_int_status; + + case 0x10c: // clear cursor scanline int + m_dafb_int_status &= ~4; + dafb_recalc_ints(); + break; + + case 0x114: // clear VBL int + m_dafb_int_status &= ~1; + dafb_recalc_ints(); + break; + } + return 0; +} + +void macquadra_state::dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask) +{ +// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); + + switch (offset<<2) + { + case 0: // bits 20-9 of base + m_dafb_base &= 0x1ff; + m_dafb_base |= (data & 0xffff) << 9; +// printf("DAFB baseH: %x\n", m_dafb_base); + break; + + case 4: // bits 8-5 of base + m_dafb_base &= ~0x1ff; + m_dafb_base |= (data & 0xf) << 5; +// printf("DAFB baseL: %x\n", m_dafb_base); + break; + + case 8: + m_dafb_stride = data<<2; // stride in DWORDs +// printf("DAFB stride: %x %x\n", m_dafb_stride, data); + break; + + case 0x104: + if (data & 1) // VBL enable + { + m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); + } + else + { + m_vbl_timer->adjust(attotime::never); + m_dafb_int_status &= ~1; + dafb_recalc_ints(); + } + + if (data & 2) // aux scanline interrupt enable + { + fatalerror("DAFB: Aux scanline interrupt enable not supported!\n"); + } + + if (data & 4) // cursor scanline interrupt enable + { + m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); + } + else + { + m_cursor_timer->adjust(attotime::never); + m_dafb_int_status &= ~4; + dafb_recalc_ints(); + } + break; + + case 0x10c: // clear cursor scanline int + m_dafb_int_status &= ~4; + dafb_recalc_ints(); + break; + + case 0x114: // clear VBL int + m_dafb_int_status &= ~1; + dafb_recalc_ints(); + break; + } +} + +uint32_t macquadra_state::dafb_dac_r(offs_t offset, uint32_t mem_mask) +{ +// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); + return 0; +} + +void macquadra_state::dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask) +{ +// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); + + switch (offset<<2) + { + case 0: + m_dafb_clutoffs = data & 0xff; + m_dafb_count = 0; + break; + + case 0x10: + m_dafb_colors[m_dafb_count++] = data&0xff; + + if (m_dafb_count == 3) + { + m_palette->set_pen_color(m_dafb_clutoffs, rgb_t(m_dafb_colors[0], m_dafb_colors[1], m_dafb_colors[2])); + m_dafb_palette[m_dafb_clutoffs] = rgb_t(m_dafb_colors[0], m_dafb_colors[1], m_dafb_colors[2]); + m_dafb_clutoffs++; + m_dafb_count = 0; + } + break; + + case 0x20: + printf("%x to DAFB mode\n", data); + switch (data & 0x9f) + { + case 0x80: + m_dafb_mode = 0; // 1bpp + break; + + case 0x88: + m_dafb_mode = 1; // 2bpp + break; + + case 0x90: + m_dafb_mode = 2; // 4bpp + break; + + case 0x98: + m_dafb_mode = 3; // 8bpp + break; + + case 0x9c: + m_dafb_mode = 4; // 24bpp + break; + } + break; + } +} + +uint32_t macquadra_state::screen_update_dafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + switch (m_dafb_mode) + { + case 0: // 1bpp + { + uint8_t const *vram8 = (uint8_t *)m_vram.target(); + vram8 += m_dafb_base; + + for (int y = 0; y < 870; y++) + { + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x+=8) + { + uint8_t const pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; + + *scanline++ = m_dafb_palette[(pixels>>7)&1]; + *scanline++ = m_dafb_palette[(pixels>>6)&1]; + *scanline++ = m_dafb_palette[(pixels>>5)&1]; + *scanline++ = m_dafb_palette[(pixels>>4)&1]; + *scanline++ = m_dafb_palette[(pixels>>3)&1]; + *scanline++ = m_dafb_palette[(pixels>>2)&1]; + *scanline++ = m_dafb_palette[(pixels>>1)&1]; + *scanline++ = m_dafb_palette[(pixels&1)]; + } + } + } + break; + + case 1: // 2bpp + { + uint8_t const *vram8 = (uint8_t *)m_vram.target(); + vram8 += m_dafb_base; + + for (int y = 0; y < 870; y++) + { + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/4; x++) + { + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_dafb_palette[((pixels>>6)&3)]; + *scanline++ = m_dafb_palette[((pixels>>4)&3)]; + *scanline++ = m_dafb_palette[((pixels>>2)&3)]; + *scanline++ = m_dafb_palette[(pixels&3)]; + } + } + } + break; + + case 2: // 4bpp + { + uint8_t const *vram8 = (uint8_t *)m_vram.target(); + vram8 += m_dafb_base; + + for (int y = 0; y < 870; y++) + { + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/2; x++) + { + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_dafb_palette[(pixels>>4)]; + *scanline++ = m_dafb_palette[(pixels&0xf)]; + } + } + } + break; + + case 3: // 8bpp + { + uint8_t const *vram8 = (uint8_t *)m_vram.target(); + vram8 += m_dafb_base; + + for (int y = 0; y < 870; y++) + { + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x++) + { + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + *scanline++ = m_dafb_palette[pixels]; + } + } + } + break; + + case 4: // 24 bpp + for (int y = 0; y < 480; y++) + { + uint32_t *scanline = &bitmap.pix(y); + uint32_t const *base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; + for (int x = 0; x < 640; x++) + { + *scanline++ = *base++; + } + } + break; + } + + return 0; +} + +WRITE_LINE_MEMBER(macquadra_state::drq_539x_1_w) +{ +} + +WRITE_LINE_MEMBER(macquadra_state::drq_539x_2_w) +{ +} + +WRITE_LINE_MEMBER(macquadra_state::irq_539x_1_w) +{ + if (state) // make sure a CB1 transition occurs + { + m_via2->write_cb2(0); + m_via2->write_cb2(1); + } +} + +WRITE_LINE_MEMBER(macquadra_state::irq_539x_2_w) +{ +} + +uint16_t macquadra_state::mac_via_r(offs_t offset) +{ + uint16_t data; + + offset >>= 8; + offset &= 0x0f; + + data = m_via1->read(offset); + + m_maincpu->adjust_icount(m_via_cycles); + + return (data & 0xff) | (data << 8); +} + +void macquadra_state::mac_via_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + offset >>= 8; + offset &= 0x0f; + + if (ACCESSING_BITS_0_7) + m_via1->write(offset, data & 0xff); + if (ACCESSING_BITS_8_15) + m_via1->write(offset, (data >> 8) & 0xff); + + m_maincpu->adjust_icount(m_via_cycles); +} + +WRITE_LINE_MEMBER(macquadra_state::mac_via_irq) +{ + m_via_interrupt = state; + field_interrupts(); +} + +WRITE_LINE_MEMBER(macquadra_state::mac_via2_irq) +{ + m_via2_interrupt = state; + field_interrupts(); +} + +uint16_t macquadra_state::mac_via2_r(offs_t offset) +{ + int data; + + offset >>= 8; + offset &= 0x0f; + + data = m_via2->read(offset); + return (data & 0xff) | (data << 8); +} + +void macquadra_state::mac_via2_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + offset >>= 8; + offset &= 0x0f; + + if (ACCESSING_BITS_0_7) + m_via2->write(offset, data & 0xff); + if (ACCESSING_BITS_8_15) + m_via2->write(offset, (data >> 8) & 0xff); +} + +uint32_t macquadra_state::rom_switch_r(offs_t offset) +{ + // disable the overlay + if (m_overlay) + { + address_space& space = m_maincpu->space(AS_PROGRAM); + const u32 memory_end = m_ram->size() - 1; + void *memory_data = m_ram->pointer(); + offs_t memory_mirror = memory_end & ~memory_end; + + space.install_readwrite_bank(0x00000000, memory_end & ~memory_mirror, memory_mirror, "bank1"); + membank("bank1")->set_base(memory_data); + m_overlay = false; + } + + //printf("rom_switch_r: offset %08x ROM_size -1 = %08x, masked = %08x\n", offset, m_rom_size-1, offset & ((m_rom_size - 1)>>2)); + + return m_rom_ptr[offset & ((m_rom_size - 1)>>2)]; +} + +TIMER_CALLBACK_MEMBER(macquadra_state::mac_6015_tick) +{ + m_via1->write_ca1(0); + m_via1->write_ca1(1); + + /* handle ADB keyboard/mouse */ + m_macadb->adb_vblank(); + + /* signal VBlank on CA1 input on the VIA */ + m_ca1_data ^= 1; + m_via1->write_ca1(m_ca1_data); + + if (++m_irq_count == 60) + { + m_irq_count = 0; + + m_ca2_data ^= 1; + /* signal 1 Hz irq on CA2 input on the VIA */ + m_via1->write_ca2(m_ca2_data); + } +} + +/*************************************************************************** + ADDRESS MAPS +***************************************************************************/ +void macquadra_state::quadra700_map(address_map &map) +{ + map(0x40000000, 0x400fffff).r(FUNC(macquadra_state::rom_switch_r)).mirror(0x0ff00000); + + map(0x50000000, 0x50001fff).rw(FUNC(macquadra_state::mac_via_r), FUNC(macquadra_state::mac_via_w)).mirror(0x00fc0000); + map(0x50002000, 0x50003fff).rw(FUNC(macquadra_state::mac_via2_r), FUNC(macquadra_state::mac_via2_w)).mirror(0x00fc0000); +// 50008000 = Ethernet MAC ID PROM +// 5000a000 = Sonic (DP83932) ethernet +// 5000f000 = SCSI cf96, 5000f402 = SCSI #2 cf96 +// map(0x5000f000, 0x5000f3ff).rw(FUNC(macquadra_state::mac_5396_r), FUNC(macquadra_state::mac_5396_w)).mirror(0x00fc0000); + map(0x5000c000, 0x5000dfff).rw(FUNC(macquadra_state::mac_scc_r), FUNC(macquadra_state::mac_scc_2_w)).mirror(0x00fc0000); + map(0x50014000, 0x50015fff).rw(m_easc, FUNC(asc_device::read), FUNC(asc_device::write)).mirror(0x00fc0000); + map(0x5001e000, 0x5001ffff).rw(FUNC(macquadra_state::mac_iwm_r), FUNC(macquadra_state::mac_iwm_w)).mirror(0x00fc0000); + + // f9800000 = VDAC / DAFB + map(0xf9000000, 0xf91fffff).ram().share("vram"); + map(0xf9800000, 0xf98001ff).rw(FUNC(macquadra_state::dafb_r), FUNC(macquadra_state::dafb_w)); + map(0xf9800200, 0xf980023f).rw(FUNC(macquadra_state::dafb_dac_r), FUNC(macquadra_state::dafb_dac_w)); +} + +uint8_t macquadra_state::mac_via_in_a() +{ + return 0xc1; +} + +uint8_t macquadra_state::mac_via_in_b() +{ + int val = m_macadb->get_adb_state()<<4; + val |= m_rtc->data_r(); + + if (!m_adb_irq_pending) + { + val |= 0x08; + } + +// printf("%s VIA1 IN_B = %02x\n", machine().describe_context().c_str(), val); + + return val; +} + +void macquadra_state::mac_via_out_a(uint8_t data) +{ +// printf("%s VIA1 OUT A: %02x\n", machine().describe_context().c_str(), data); + sony_set_sel_line(m_iwm.target(), (data & 0x20) >> 5); +} + +void macquadra_state::mac_via_out_b(uint8_t data) +{ +// printf("%s VIA1 OUT B: %02x\n", machine().describe_context().c_str(), data); + m_macadb->mac_adb_newaction((data & 0x30) >> 4); + + m_rtc->ce_w((data & 0x04)>>2); + m_rtc->data_w(data & 0x01); + m_rtc->clk_w((data >> 1) & 0x01); +} + +uint8_t macquadra_state::mac_via2_in_a() +{ + return 0x80 | m_nubus_irq_state; +} + +uint8_t macquadra_state::mac_via2_in_b() +{ + return 0xcf; // indicate no NuBus transaction error +} + +void macquadra_state::mac_via2_out_a(uint8_t data) +{ +} + +void macquadra_state::mac_via2_out_b(uint8_t data) +{ + // chain 60.15 Hz to VIA1 + m_via1->write_ca1(data>>7); +} + +/*************************************************************************** + DEVICE CONFIG +***************************************************************************/ + +static const applefdc_interface mac_iwm_interface = +{ + sony_set_lines, + sony_set_enable_lines, + + sony_read_data, + sony_write_data, + sony_read_status +}; + +static const floppy_interface mac_floppy_interface = +{ + FLOPPY_STANDARD_3_5_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple35_mac), + "floppy_3_5" +}; + +static INPUT_PORTS_START( macadb ) +INPUT_PORTS_END + +/*************************************************************************** + MACHINE DRIVERS +***************************************************************************/ + +static void mac_nubus_cards(device_slot_interface &device) +{ + device.option_add("m2video", NUBUS_M2VIDEO); /* Apple Macintosh II Video Card */ + device.option_add("48gc", NUBUS_48GC); /* Apple 4*8 Graphics Card */ + device.option_add("824gc", NUBUS_824GC); /* Apple 8*24 Graphics Card */ + device.option_add("cb264", NUBUS_CB264); /* RasterOps ColorBoard 264 */ + device.option_add("vikbw", NUBUS_VIKBW); /* Moniterm Viking board */ + device.option_add("image", NUBUS_IMAGE); /* Disk Image Pseudo-Card */ + device.option_add("specpdq", NUBUS_SPECPDQ); /* SuperMac Spectrum PDQ */ + device.option_add("m2hires", NUBUS_M2HIRES); /* Apple Macintosh II Hi-Resolution Card */ + device.option_add("spec8s3", NUBUS_SPEC8S3); /* SuperMac Spectrum/8 Series III */ +// device.option_add("thundergx", NUBUS_THUNDERGX); /* Radius Thunder GX (not yet) */ + device.option_add("radiustpd", NUBUS_RADIUSTPD); /* Radius Two Page Display */ + device.option_add("asmc3nb", NUBUS_ASNTMC3NB); /* Asante MC3NB Ethernet card */ + device.option_add("portrait", NUBUS_WSPORTRAIT); /* Apple Macintosh II Portrait video card */ + device.option_add("enetnb", NUBUS_APPLEENET); /* Apple NuBus Ethernet */ + device.option_add("bootbug", NUBUS_BOOTBUG); /* Brigent BootBug debugger card */ + device.option_add("quadralink", NUBUS_QUADRALINK); /* AE Quadralink serial card */ + device.option_add("laserview", NUBUS_LASERVIEW); /* Sigma Designs LaserView monochrome video card */ +} + +void macquadra_state::macqd700(machine_config &config) +{ + /* basic machine hardware */ + M68040(config, m_maincpu, 25000000); + m_maincpu->set_addrmap(AS_PROGRAM, &macquadra_state::quadra700_map); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(75.08); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1260)); + m_screen->set_size(1152, 870); + m_screen->set_visarea(0, 1152-1, 0, 870-1); + m_screen->set_screen_update(FUNC(macquadra_state::screen_update_dafb)); + + MCFG_VIDEO_START_OVERRIDE(macquadra_state,macdafb) + MCFG_VIDEO_RESET_OVERRIDE(macquadra_state,macdafb) + + PALETTE(config, m_palette).set_entries(256); + + RTC3430042(config, m_rtc, XTAL(32'768)); + + LEGACY_IWM(config, m_iwm, &mac_iwm_interface); + sonydriv_floppy_image_device::legacy_2_drives_add(config, &mac_floppy_interface); + + SCC85C30(config, m_scc, C7M); +// m_scc->intrq_callback().set(FUNC(macquadra_state::set_scc_interrupt)); + + DP83932C(config, m_sonic, 20_MHz_XTAL); + m_sonic->set_bus(m_maincpu, 0); + + nubus_device &nubus(NUBUS(config, "nubus", 0)); + nubus.set_space(m_maincpu, AS_PROGRAM); + nubus.out_irq9_callback().set(FUNC(macquadra_state::nubus_irq_9_w)); + nubus.out_irqa_callback().set(FUNC(macquadra_state::nubus_irq_a_w)); + nubus.out_irqb_callback().set(FUNC(macquadra_state::nubus_irq_b_w)); + nubus.out_irqc_callback().set(FUNC(macquadra_state::nubus_irq_c_w)); + nubus.out_irqd_callback().set(FUNC(macquadra_state::nubus_irq_d_w)); + nubus.out_irqe_callback().set(FUNC(macquadra_state::nubus_irq_e_w)); + NUBUS_SLOT(config, "nbd", "nubus", mac_nubus_cards, nullptr); + NUBUS_SLOT(config, "nbe", "nubus", mac_nubus_cards, nullptr); + + VIA6522(config, m_via1, C7M/10); + m_via1->readpa_handler().set(FUNC(macquadra_state::mac_via_in_a)); + m_via1->readpb_handler().set(FUNC(macquadra_state::mac_via_in_b)); + m_via1->writepa_handler().set(FUNC(macquadra_state::mac_via_out_a)); + m_via1->writepb_handler().set(FUNC(macquadra_state::mac_via_out_b)); + m_via1->irq_handler().set(FUNC(macquadra_state::mac_via_irq)); + m_via1->cb2_handler().set(FUNC(macquadra_state::via_cb2_w)); + + VIA6522(config, m_via2, C7M/10); + m_via2->readpa_handler().set(FUNC(macquadra_state::mac_via2_in_a)); + m_via2->readpb_handler().set(FUNC(macquadra_state::mac_via2_in_b)); + m_via2->writepa_handler().set(FUNC(macquadra_state::mac_via2_out_a)); + m_via2->writepb_handler().set(FUNC(macquadra_state::mac_via2_out_b)); + m_via2->irq_handler().set(FUNC(macquadra_state::mac_via2_irq)); + + MACADB(config, m_macadb, C15M); + m_macadb->via_clock_callback().set(m_via1, FUNC(via6522_device::write_cb1)); + m_macadb->via_data_callback().set(m_via1, FUNC(via6522_device::write_cb2)); + m_macadb->adb_irq_callback().set(FUNC(macquadra_state::adb_irq_w)); + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + ASC(config, m_easc, C15M, asc_device::asc_type::EASC); +// m_easc->irqf_callback().set(FUNC(macquadra_state::mac_asc_irq)); + m_easc->add_route(0, "lspeaker", 1.0); + m_easc->add_route(1, "rspeaker", 1.0); + + /* internal ram */ + RAM(config, m_ram); + m_ram->set_default_size("4M"); + m_ram->set_extra_options("8M,16M,32M,64M,68M,72M,80M,96M,128M"); + + SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop"); +} + +ROM_START( macqd700 ) + ROM_REGION32_BE(0x100000, "bootrom", 0) + ROM_LOAD( "420dbff3.rom", 0x000000, 0x100000, CRC(88ea2081) SHA1(7a8ee468d16e64f2ad10cb8d1a45e6f07cc9e212) ) +ROM_END + +COMP( 1991, macqd700, 0, 0, macqd700, macadb, macquadra_state, init_macqd700, "Apple Computer", "Macintosh Quadra 700", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/macrossp.cpp b/src/mame/drivers/macrossp.cpp index 1202cbfcb02..cc8733ce38d 100644 --- a/src/mame/drivers/macrossp.cpp +++ b/src/mame/drivers/macrossp.cpp @@ -10,6 +10,7 @@ Driver by David Haywood TODO: - what is the 'BIOS' ROM for? it appears to be data tables and is very different between games but we don't map it anywhere - convert tilemaps to devices? + - quizmoon title gfx/sound in attract mode is incorrect? reference: https://youtu.be/925rRv2JG50 68020 interrupts lev 1 : 0x64 : 0000 084c - unknown.. diff --git a/src/mame/drivers/magicard.cpp b/src/mame/drivers/magicard.cpp index 20a74fe5b1e..eec8a48e058 100644 --- a/src/mame/drivers/magicard.cpp +++ b/src/mame/drivers/magicard.cpp @@ -646,43 +646,40 @@ void magicard_state::video_start() uint32_t magicard_state::screen_update_magicard(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint32_t count; - bitmap.fill(m_palette->black_pen(), cliprect); //TODO if(!(SCC_DE_VREG)) //display enable return 0; - count = ((SCC_VSR_VREG) / 2); + uint32_t count = ((SCC_VSR_VREG) / 2); if(SCC_FG_VREG) //4bpp gfx { - for(y = 0; y < 300; y++) + for(int y = 0; y < 300; y++) { - for(x = 0; x < 84; x++) + for(int x = 0; x < 84; x++) { uint32_t color; color = ((m_magicram[count]) & 0x000f) >> 0; if(cliprect.contains((x * 4) + 3, y)) - bitmap.pix32(y, (x * 4) + 3) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 3) = m_palette->pen(color); color = ((m_magicram[count]) & 0x00f0) >> 4; if(cliprect.contains((x * 4) + 2, y)) - bitmap.pix32(y, (x * 4) + 2) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 2) = m_palette->pen(color); color = ((m_magicram[count]) & 0x0f00) >> 8; if(cliprect.contains((x * 4) + 1, y)) - bitmap.pix32(y, (x * 4) + 1) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 1) = m_palette->pen(color); color = ((m_magicram[count]) & 0xf000) >> 12; if(cliprect.contains((x * 4) + 0, y)) - bitmap.pix32(y, (x * 4) + 0) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 0) = m_palette->pen(color); count++; } @@ -690,21 +687,21 @@ uint32_t magicard_state::screen_update_magicard(screen_device &screen, bitmap_rg } else //8bpp gfx { - for(y = 0; y < 300; y++) + for(int y = 0; y < 300; y++) { - for(x = 0; x < 168; x++) + for(int x = 0; x < 168; x++) { uint32_t color; color = ((m_magicram[count]) & 0x00ff) >> 0; if(cliprect.contains((x * 2) + 1, y)) - bitmap.pix32(y, (x * 2) + 1) = m_palette->pen(color); + bitmap.pix(y, (x * 2) + 1) = m_palette->pen(color); color = ((m_magicram[count]) & 0xff00) >> 8; if(cliprect.contains((x * 2) + 0, y)) - bitmap.pix32(y, (x * 2) + 0) = m_palette->pen(color); + bitmap.pix(y, (x * 2) + 0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/marinedt.cpp b/src/mame/drivers/marinedt.cpp index 79ed6144257..b0a4bdfdb75 100644 --- a/src/mame/drivers/marinedt.cpp +++ b/src/mame/drivers/marinedt.cpp @@ -205,8 +205,8 @@ void marinedt_state::init_seabitmap() if(blue_pen > 0x5f) blue_pen = 0x5f; - m_seabitmap[0]->pix16(y, x) = blue_pen; - m_seabitmap[1]->pix16(y, x) = blue_pen+0x20; + m_seabitmap[0]->pix(y, x) = blue_pen; + m_seabitmap[1]->pix(y, x) = blue_pen+0x20; } } } @@ -360,11 +360,11 @@ inline uint32_t marinedt_state::obj_to_obj_collision() resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix16(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) continue; // return value is never read most likely - if(m_obj[1].bitmap.pix16(resy,resx) != 0) + if(m_obj[1].bitmap.pix(resy,resx) != 0) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); } } @@ -387,14 +387,14 @@ inline uint32_t marinedt_state::obj_to_layer_collision() resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix16(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) continue; if(!m_screen_flip) resy -= 32; // TODO: non screen flip path doesn't work properly - if(m_tilemap->pixmap().pix16(resy,resx) != 0) + if(m_tilemap->pixmap().pix(resy,resx) != 0) { if(m_screen_flip) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); diff --git a/src/mame/drivers/maygayv1.cpp b/src/mame/drivers/maygayv1.cpp index 4459418d0cc..b0f686a348d 100644 --- a/src/mame/drivers/maygayv1.cpp +++ b/src/mame/drivers/maygayv1.cpp @@ -329,7 +329,6 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in uint16_t *atable = &i82716.dram[VREG(ATBA)]; uint16_t *otable = &i82716.dram[VREG(ODTBA) & 0xfc00]; // both must be bank 0 - int sl, sx; int slmask = 0xffff; // TODO: Save if using scanline callbacks int xbound = (VREG(DWBA) & 0x3f8) | 7; @@ -344,13 +343,12 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in } /* For every scanline... */ - for (sl = cliprect.min_x; sl <= cliprect.max_y; ++sl) + for (int sl = cliprect.min_x; sl <= cliprect.max_y; ++sl) { - int obj; uint16_t aflags = atable[sl]; uint16_t slmask_old = slmask; - uint16_t *bmp_ptr = &bitmap.pix16(sl); + uint16_t *bmp_ptr = &bitmap.pix(sl); slmask = 0xffff ^ (slmask ^ aflags); @@ -359,7 +357,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in memset(i82716.line_buf.get(), 0x22, 512); /* Parse the list of 16 objects */ - for (obj = 0; obj < 16; ++obj) + for (int obj = 0; obj < 16; ++obj) { int offs = obj * 4; @@ -367,7 +365,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in if ( !BIT(slmask, obj) ) { uint32_t objbase, trans, width; - int32_t x, xpos; + int32_t xpos; uint16_t w0, w1, w2; uint16_t *objptr; uint8_t *bmpptr; // ? @@ -419,7 +417,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in bmpptr = (uint8_t*)objptr; // 4bpp - for (x = xpos; x < std::min(xbound, int(xpos + width * 8)); ++x) + for (int x = xpos; x < std::min(xbound, int(xpos + width * 8)); ++x) { if (x >= 0) { @@ -441,7 +439,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in } // Write it out - for (sx = cliprect.min_x; sx < cliprect.max_x; sx += 2) + for (int sx = cliprect.min_x; sx < cliprect.max_x; sx += 2) { uint8_t pix = i82716.line_buf[sx / 2]; diff --git a/src/mame/drivers/mbc200.cpp b/src/mame/drivers/mbc200.cpp index 369cb6ee117..64e89698e6b 100644 --- a/src/mame/drivers/mbc200.cpp +++ b/src/mame/drivers/mbc200.cpp @@ -268,15 +268,13 @@ static void mbc200_floppies(device_slot_interface &device) MC6845_UPDATE_ROW( mbc200_state::update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma+x)*4+ra; - gfx = m_vram[mem & 0x7fff]; + u16 mem = (ma+x)*4+ra; + u8 gfx = m_vram[mem & 0x7fff]; *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; diff --git a/src/mame/drivers/mbee.cpp b/src/mame/drivers/mbee.cpp index b99e0220a08..3df643bf789 100644 --- a/src/mame/drivers/mbee.cpp +++ b/src/mame/drivers/mbee.cpp @@ -685,7 +685,7 @@ void mbee_state::mbee(machine_config &config) QUICKLOAD(config, "quickload", "mwb,com,bee", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_bee)); QUICKLOAD(config, "quickload2", "bin", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_bin)); - CENTRONICS(config, m_centronics, centronics_devices, "printer"); + CENTRONICS(config, m_centronics, centronics_devices, nullptr); m_centronics->ack_handler().set(m_pio, FUNC(z80pio_device::strobe_a)); OUTPUT_LATCH(config, m_cent_data_out); @@ -820,6 +820,7 @@ void mbee_state::mbee256(machine_config &config) config.device_remove("fdc:1"); FLOPPY_CONNECTOR(config, m_floppy0, mbee_floppies, "35dd", floppy_image_device::default_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppy1, mbee_floppies, "35dd", floppy_image_device::default_floppy_formats).enable_sound(true); + TIMER(config, "newkb_timer").configure_periodic(FUNC(mbee_state::newkb_timer), attotime::from_hz(50)); } void mbee_state::mbeett(machine_config &config) @@ -829,6 +830,7 @@ void mbee_state::mbeett(machine_config &config) m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeett_io); config.device_remove("quickload"); config.device_remove("quickload2"); + TIMER(config, "newkb_timer").configure_periodic(FUNC(mbee_state::newkb_timer), attotime::from_hz(50)); SCC8530(config, "scc", 4000000); // clock unknown } @@ -866,7 +868,7 @@ ROM_START( mbee ) ROM_RELOAD( 0x0800, 0x0800 ) ROM_REGION( 0x0020, "proms", 0 ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0000, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0000, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbeeic ) @@ -888,7 +890,7 @@ ROM_START( mbeeic ) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbeepc ) @@ -910,7 +912,7 @@ ROM_START( mbeepc ) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbeepc85 ) @@ -936,7 +938,7 @@ ROM_START( mbeepc85 ) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbeepc85b ) @@ -963,7 +965,7 @@ ROM_START( mbeepc85b ) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbeepc85s ) @@ -988,7 +990,7 @@ ROM_START( mbeepc85s ) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbeett ) @@ -1045,7 +1047,7 @@ ROM_START( mbee56 ) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbee128 ) // Standard 128k (CIAB is the same thing with half the ram) @@ -1060,7 +1062,7 @@ ROM_START( mbee128 ) // Standard 128k (CIAB is the same thing with half the ram) ROM_REGION( 0x0040, "proms", 0 ) ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) - ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ + ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(79fa1e9d) SHA1(0454051697b23e4561744466fb31e7a133d02246) ) /* video switching prom, not needed for emulation purposes */ ROM_END ROM_START( mbee128p ) // Premium 128K diff --git a/src/mame/drivers/mc8020.cpp b/src/mame/drivers/mc8020.cpp index 2a72b138d99..bcdd4f3c1fc 100644 --- a/src/mame/drivers/mc8020.cpp +++ b/src/mame/drivers/mc8020.cpp @@ -72,18 +72,18 @@ void mc8020_state::io_map(address_map &map) /* Input ports */ static INPUT_PORTS_START( mc8020 ) PORT_START("X0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('!') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('@') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('#') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('$') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('%') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('&') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\'') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('(') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(34) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_START("X1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR('\"') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('*') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('^') @@ -133,13 +133,13 @@ static INPUT_PORTS_START( mc8020 ) PORT_START("X6") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) INPUT_PORTS_END @@ -187,7 +187,7 @@ void mc8020_state::machine_start() // This is not a content of U402 510 // but order is fine static const uint8_t prom[] = { - 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ + 0x0e,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C @@ -263,20 +263,20 @@ static const uint8_t prom[] = { uint32_t mc8020_state::screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + u16 sy=0,ma=0; - for(y = 0; y < 8; y++ ) + for (u8 y = 0; y < 8; y++ ) { - for (ra = 0; ra < 16; ra++) + for (u8 ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 32; x++) + for (u16 x = ma; x < ma + 32; x++) { + u8 gfx; if (ra > 3 && ra < 12) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; gfx = prom[(chr<<3) | (ra-4)]; } else diff --git a/src/mame/drivers/mc8030.cpp b/src/mame/drivers/mc8030.cpp index a3b35bd5f2d..e8f0abcdfe1 100644 --- a/src/mame/drivers/mc8030.cpp +++ b/src/mame/drivers/mc8030.cpp @@ -145,27 +145,24 @@ uint8_t mc8030_state::asp_port_b_r() uint32_t mc8030_state::screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx; - uint16_t y=0,ma=0,x; + uint16_t ma=0; - for(y = 0; y < 256; y++ ) + for(uint16_t y = 0; y < 256; y++ ) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); + for (uint16_t x = ma; x < ma + 64; x++) { - for (x = ma; x < ma + 64; x++) - { - gfx = m_vram[x^0x3fff]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } + uint8_t const gfx = m_vram[x^0x3fff]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); } ma+=64; } diff --git a/src/mame/drivers/mdt60.cpp b/src/mame/drivers/mdt60.cpp index 63669bbf0f9..45623589d4f 100644 --- a/src/mame/drivers/mdt60.cpp +++ b/src/mame/drivers/mdt60.cpp @@ -108,7 +108,7 @@ TIMER_CALLBACK_MEMBER(mdt60_state::baud_timer) MC6845_UPDATE_ROW(mdt60_state::update_row) { - u32 *pix = &bitmap.pix32(y); + u32 *pix = &bitmap.pix(y); for (unsigned x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/mediagx.cpp b/src/mame/drivers/mediagx.cpp index 353f25ab02d..6e20ffb9e58 100644 --- a/src/mame/drivers/mediagx.cpp +++ b/src/mame/drivers/mediagx.cpp @@ -266,19 +266,17 @@ void mediagx_state::video_start() void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - const pen_t *pens = &m_palette->pen(0); + pen_t const *const pens = &m_palette->pen(0); - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint32_t *p = &bitmap.pix32(j); - for (i=x; i < x+8; i++) + uint32_t *const p = &bitmap.pix(j); + for (int i=x; i < x+8; i++) { - uint8_t pen = dp[index++]; + uint8_t const pen = dp[index++]; if (pen) p[i] = pens[gfx->colorbase() + (att & 0xf)]; else @@ -292,18 +290,16 @@ void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, g void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - int width, height; - int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; + int const line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; - width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1; + int width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1; if (m_disp_ctrl_reg[DC_TIMING_CFG] & 0x8000) // pixel double { width >>= 1; } width += 4; - height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1; + int height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1; if ( (width != m_frame_width || height != m_frame_height) && (width > 1 && height > 1 && width <= 640 && height <= 480) ) @@ -319,19 +315,19 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode { - uint8_t *framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; - uint8_t *pal = m_pal; + uint8_t const *const framebuf = (uint8_t const *)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint8_t const *const pal = m_pal; - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint8_t *si = &framebuf[j * line_delta]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint8_t const *si = &framebuf[j * line_delta]; + for (int i=0; i < m_frame_width; i++) { - int c = *si++; - int r = pal[(c*3)+0] << 2; - int g = pal[(c*3)+1] << 2; - int b = pal[(c*3)+2] << 2; + int const c = *si++; + int const r = pal[(c*3)+0] << 2; + int const g = pal[(c*3)+1] << 2; + int const b = pal[(c*3)+2] << 2; p[i] = r << 16 | g << 8 | b; } @@ -339,21 +335,21 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip } else // 16-bit { - uint16_t *framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint16_t const *const framebuf = (uint16_t const *)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; // RGB 5-6-5 mode if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0) { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { - uint16_t c = *si++; - int r = ((c >> 11) & 0x1f) << 3; - int g = ((c >> 5) & 0x3f) << 2; - int b = (c & 0x1f) << 3; + uint16_t const c = *si++; + int const r = ((c >> 11) & 0x1f) << 3; + int const g = ((c >> 5) & 0x3f) << 2; + int const b = (c & 0x1f) << 3; p[i] = r << 16 | g << 8 | b; } @@ -362,16 +358,16 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip // RGB 5-5-5 mode else { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { - uint16_t c = *si++; - int r = ((c >> 10) & 0x1f) << 3; - int g = ((c >> 5) & 0x1f) << 3; - int b = (c & 0x1f) << 3; + uint16_t const c = *si++; + int const r = ((c >> 10) & 0x1f) << 3; + int const g = ((c >> 5) & 0x1f) << 3; + int const b = (c & 0x1f) << 3; p[i] = r << 16 | g << 8 | b; } diff --git a/src/mame/drivers/megadriv_rad.cpp b/src/mame/drivers/megadriv_rad.cpp index e0abb5b2f6c..fb4c4d52d2f 100644 --- a/src/mame/drivers/megadriv_rad.cpp +++ b/src/mame/drivers/megadriv_rad.cpp @@ -195,7 +195,12 @@ ROM_START( rad_sonic ) ROM_LOAD16_WORD_SWAP( "supersonicgold.bin", 0x000000, 0x400000, CRC(853c9140) SHA1(cf70a9cdd3be4d8d1b6195698db3a941f4908791) ) ROM_END - +// once byteswapped this matches "outrun 2019 (usa) (beta).bin megadriv:outr2019up Out Run 2019 (USA, Prototype)" +// this was dumped from a PAL/UK unit, so maybe that 'beta' is really an alt Euro release, or was simply dumped from one of these Radica units and mislabeled? +ROM_START( rad_orun ) + ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "outrun.bin", 0x000000, 0x100000, CRC(4fd6d653) SHA1(57f0e4550ff883e4bb7857caef2c893c21f80b42) ) +ROM_END void megadriv_radica_state::init_megadriv_radica_6button_pal() @@ -224,3 +229,4 @@ CONS( 2004, rad_sf2p, rad_sf2,0, megadriv_radica_6button_pal, megadriv_radica_6 CONS( 2004, rad_ssoc, 0, 0, megadriv_radica_3button_pal, megadriv_radica_3button, megadriv_radica_state, init_megadrie, "Radica / Sensible Software / Sega", "Sensible Soccer plus [Cannon Fodder, Mega lo Mania] (Radica, Arcade Legends) (Europe)", 0) // still branded as Arcade Legends even if none of these were ever arcade games +CONS( 2004, rad_orun, 0, 0, megadriv_radica_3button_pal, megadriv_radica_3button_1player, megadriv_radica_state, init_megadrie, "Radica / Sega", "Out Run 2019 (Radica Plug & Play, Europe)", 0) diff --git a/src/mame/drivers/megaplay.cpp b/src/mame/drivers/megaplay.cpp index 8b0f4011e38..be3943762bd 100644 --- a/src/mame/drivers/megaplay.cpp +++ b/src/mame/drivers/megaplay.cpp @@ -633,9 +633,9 @@ uint32_t mplay_state::screen_update_megplay(screen_device &screen, bitmap_rgb32 const u32 width = sega315_5124_device::WIDTH - (sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); for (int y = 0; y < 224; y++) { - uint32_t* lineptr = &bitmap.pix32(y); - uint32_t* srcptr = &m_vdp1->get_bitmap().pix32(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); - uint8_t* y1ptr = &m_vdp1->get_y1_bitmap().pix8(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); + uint32_t *const lineptr = &bitmap.pix(y); + uint32_t const *const srcptr = &m_vdp1->get_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); + uint8_t const *const y1ptr = &m_vdp1->get_y1_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); for (int srcx = 0, xx = 0, dstx = 0; srcx < width; dstx++) { diff --git a/src/mame/drivers/megatech.cpp b/src/mame/drivers/megatech.cpp index d13980ffad6..5b1f42d7a66 100644 --- a/src/mame/drivers/megatech.cpp +++ b/src/mame/drivers/megatech.cpp @@ -627,8 +627,8 @@ uint32_t mtech_state::screen_update_main(screen_device &screen, bitmap_rgb32 &bi // when launching megatech + both sms and megadrive games, the following would be needed... for (int y = 0; y < 224; y++) { - uint32_t* lineptr = &bitmap.pix32(y); - uint32_t* srcptr = &m_vdp->get_bitmap().pix32(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT); + uint32_t* lineptr = &bitmap.pix(y); + uint32_t* srcptr = &m_vdp->get_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT); for (int x = 0; x < sega315_5124_device::WIDTH; x++) lineptr[x] = srcptr[x]; diff --git a/src/mame/drivers/meijinsn.cpp b/src/mame/drivers/meijinsn.cpp index 0778c284c18..09fc80ded0a 100644 --- a/src/mame/drivers/meijinsn.cpp +++ b/src/mame/drivers/meijinsn.cpp @@ -324,7 +324,7 @@ uint32_t meijinsn_state::screen_update_meijinsn(screen_device &screen, bitmap_in { color= BIT(data1, x) | (BIT(data1, x + 4) << 1); data = BIT(data2, x) | (BIT(data2, x + 4) << 1); - bitmap.pix16(sy, (sx * 4 + (3 - x))) = color * 4 + data; + bitmap.pix(sy, (sx * 4 + (3 - x))) = color * 4 + data; } } return 0; diff --git a/src/mame/drivers/mekd2.cpp b/src/mame/drivers/mekd2.cpp index b0f06299280..b46e73fbcde 100644 --- a/src/mame/drivers/mekd2.cpp +++ b/src/mame/drivers/mekd2.cpp @@ -89,11 +89,6 @@ TODO class mekd2_state : public driver_device { public: - enum - { - TIMER_TRACE - }; - mekd2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") @@ -101,6 +96,7 @@ public: , m_pia_u(*this, "pia_u") , m_acia(*this, "acia") , m_cass(*this, "cassette") + , m_trace_timer(*this, "trace_timer") , m_digits(*this, "digit%u", 0U) { } @@ -115,10 +111,10 @@ private: DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); TIMER_DEVICE_CALLBACK_MEMBER(kansas_w); TIMER_DEVICE_CALLBACK_MEMBER(kansas_r); + TIMER_DEVICE_CALLBACK_MEMBER(trace_timer); void mem_map(address_map &map); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; uint8_t m_cass_data[4]; uint8_t m_segment; uint8_t m_digit; @@ -131,6 +127,7 @@ private: required_device<pia6821_device> m_pia_u; required_device<acia6850_device> m_acia; required_device<cassette_image_device> m_cass; + required_device<timer_device> m_trace_timer; output_finder<6> m_digits; }; @@ -203,16 +200,9 @@ INPUT_PORTS_END ************************************************************/ -void mekd2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(mekd2_state::trace_timer) { - switch (id) - { - case TIMER_TRACE: - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - break; - default: - throw emu_fatalerror("Unknown id in mekd2_state::device_timer"); - } + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } @@ -221,7 +211,7 @@ WRITE_LINE_MEMBER( mekd2_state::nmi_w ) if (state) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); else - timer_set(attotime::from_usec(18), TIMER_TRACE); + m_trace_timer->adjust(attotime::from_usec(18)); } @@ -406,6 +396,7 @@ void mekd2_state::mekd2(machine_config &config) TIMER(config, "kansas_w").configure_periodic(FUNC(mekd2_state::kansas_w), attotime::from_hz(4800)); TIMER(config, "kansas_r").configure_periodic(FUNC(mekd2_state::kansas_r), attotime::from_hz(40000)); + TIMER(config, m_trace_timer).configure_generic(FUNC(mekd2_state::trace_timer)); QUICKLOAD(config, "quickload", "d2", attotime::from_seconds(1)).set_load_callback(FUNC(mekd2_state::quickload_cb)); } diff --git a/src/mame/drivers/mekd3.cpp b/src/mame/drivers/mekd3.cpp index aed68ab06ad..29105919019 100644 --- a/src/mame/drivers/mekd3.cpp +++ b/src/mame/drivers/mekd3.cpp @@ -837,31 +837,34 @@ MC6845_UPDATE_ROW(mekd3_state::update_row) uint8_t code = m_video_ram[(ma + column) & 0xfff]; int dcursor = (column == cursor_x); - if (BIT(code, 7)) { - /* Lores 6 pixel character. - ----------- - | D1 | D0 | - | D3 | D2 | - | D5 | D4 | - ----------- - D6 - 1 Grey tone, 0 brightness. - */ - int pixel = ((ra & 0x0c) >> 1) + 1; - int dout = BIT(code, pixel); - int grey = BIT(code, 6); - int color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - pixel--; - dout = BIT(code, pixel); - color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - } else { + if (BIT(code, 7)) + { + /* Lores 6 pixel character. + ----------- + | D1 | D0 | + | D3 | D2 | + | D5 | D4 | + ----------- + D6 - 1 Grey tone, 0 brightness. + */ + int pixel = ((ra & 0x0c) >> 1) + 1; + int dout = BIT(code, pixel); + int grey = BIT(code, 6); + int color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + pixel--; + dout = BIT(code, pixel); + color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + } + else + { offs_t address = ra < 8 ? ((code & 0x7f) << 3) | (ra & 0x07) : 0; uint8_t data = m_p_chargen[address]; @@ -870,7 +873,7 @@ MC6845_UPDATE_ROW(mekd3_state::update_row) int dout = BIT(data, 7); int color = ((dcursor ^ dout) && de) << 1; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/mekd4.cpp b/src/mame/drivers/mekd4.cpp index f03c8e3248f..d8856a11893 100644 --- a/src/mame/drivers/mekd4.cpp +++ b/src/mame/drivers/mekd4.cpp @@ -874,29 +874,29 @@ MC6845_UPDATE_ROW(mekd4_state::update_row) int dcursor = (column == cursor_x); if (BIT(code, 7)) { - /* Lores 6 pixel character. - ----------- - | D1 | D0 | - | D3 | D2 | - | D5 | D4 | - ----------- - D6 - 1 Grey tone, 0 brightness. - */ - int pixel = ((ra & 0x0c) >> 1) + 1; - int dout = BIT(code, pixel); - int grey = BIT(code, 6); - int color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - pixel--; - dout = BIT(code, pixel); - color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; + /* Lores 6 pixel character. + ----------- + | D1 | D0 | + | D3 | D2 | + | D5 | D4 | + ----------- + D6 - 1 Grey tone, 0 brightness. + */ + int pixel = ((ra & 0x0c) >> 1) + 1; + int dout = BIT(code, pixel); + int grey = BIT(code, 6); + int color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + pixel--; + dout = BIT(code, pixel); + color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } else { offs_t address = ra < 8 ? ((code & 0x7f) << 3) | (ra & 0x07) : 0; uint8_t data = m_p_chargen[address]; @@ -906,7 +906,7 @@ MC6845_UPDATE_ROW(mekd4_state::update_row) int dout = BIT(data, 7); int color = ((dcursor ^ dout) && de) << 1; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index f54de1f3f07..ffa8650e791 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -296,28 +296,23 @@ MC6845_BEGIN_UPDATE( merit_state::crtc_begin_update ) MC6845_UPDATE_ROW( merit_state::crtc_update_row ) { - uint8_t *gfx[2]; + uint8_t const *const gfx[2] = { memregion("gfx1")->base(), memregion("gfx2")->base() }; uint16_t x = 0; - int rlen; - gfx[0] = memregion("gfx1")->base(); - gfx[1] = memregion("gfx2")->base(); - rlen = memregion("gfx2")->bytes(); + int const rlen = memregion("gfx2")->bytes(); //ma = ma ^ 0x7ff; for (uint8_t cx = 0; cx < x_count; cx++) { - int i; int attr = m_ram_attr[ma & 0x7ff]; int region = (attr & 0x40) >> 6; int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (m_extra_video_bank_bit)) << 4) | (ra & 0x0f); int colour = (attr & 0x7f) << 3; - uint8_t *data; addr &= (rlen-1); - data = gfx[region]; + uint8_t const *const data = gfx[region]; - for (i = 7; i>=0; i--) + for (int i = 7; i>=0; i--) { int col = colour; @@ -331,7 +326,7 @@ MC6845_UPDATE_ROW( merit_state::crtc_update_row ) col |= 0x03; col = m_ram_palette[col & 0x3ff]; - bitmap.pix32(y, x) = m_pens[col ? col & (NUM_PENS-1) : (m_lscnblk ? 8 : 0)]; + bitmap.pix(y, x) = m_pens[col ? col & (NUM_PENS-1) : (m_lscnblk ? 8 : 0)]; x++; } diff --git a/src/mame/drivers/meritum.cpp b/src/mame/drivers/meritum.cpp index a91fc301bf8..c16a2514999 100644 --- a/src/mame/drivers/meritum.cpp +++ b/src/mame/drivers/meritum.cpp @@ -227,12 +227,11 @@ static INPUT_PORTS_START( meritum ) INPUT_PORTS_END u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -/* lores characters are in the character generator. Each character is 6x12 (basic characters are 6x7 excluding descenders/ascenders). */ { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; - u8 cols = m_mode ? 32 : 64; - u8 skip = m_mode ? 2 : 1; + // lores characters are in the character generator. Each character is 6x12 (basic characters are 6x7 excluding descenders/ascenders). + u16 sy=0,ma=0; + const u8 cols = m_mode ? 32 : 64; + const u8 skip = m_mode ? 2 : 1; if (m_mode != m_size_store) { @@ -240,28 +239,28 @@ u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x] & 0xbf; + const u8 chr = m_p_videoram[x] & 0xbf; + u8 gfx; // shift down comma and semicolon // not sure Meritum I got the circuit for this (like TRS80) // but position of ';' suggests most likely yes if ((chr == 0x2c) && (ra >= 2)) gfx = m_p_chargen[0x2be + ra]; - else - if ((chr == 0x3b) && (ra >= 1)) + else if ((chr == 0x3b) && (ra >= 1)) gfx = m_p_chargen[0x3af + ra]; else gfx = m_p_chargen[(chr<<4) | ra]; - /* Display a scanline of a character (6 pixels) */ + // Display a scanline of a character (6 pixels) *p++ = BIT(gfx, 5); *p++ = BIT(gfx, 4); *p++ = BIT(gfx, 3); @@ -277,10 +276,9 @@ u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &b u32 meritum_state::screen_update_meritum2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; - u8 cols = m_mode ? 32 : 64; - u8 skip = m_mode ? 2 : 1; + u16 sy=0,ma=0; + const u8 cols = m_mode ? 32 : 64; + const u8 skip = m_mode ? 2 : 1; if (m_mode != m_size_store) { @@ -288,20 +286,20 @@ u32 meritum_state::screen_update_meritum2(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + const u8 chr = m_p_videoram[x]; - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; + // get pattern of pixels for that character scanline + const u8 gfx = m_p_chargen[(chr<<4) | ra]; - /* Display a scanline of a character (6 pixels) */ + // Display a scanline of a character (6 pixels) *p++ = BIT(gfx, 5); *p++ = BIT(gfx, 4); *p++ = BIT(gfx, 3); @@ -343,7 +341,7 @@ void meritum_state::port_ff_w(u8 data) d1, d0 Cassette output */ static const double levels[4] = { 0.0, 1.0, -1.0, 0.0 }; - static bool init = 0; + static bool init = 0; // FIXME: static variable, breaks hard reset and multiple runs from system selection menu m_cassette->change_state(BIT(data, 2) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); m_cassette->output(levels[data & 3]); @@ -354,7 +352,7 @@ void meritum_state::port_ff_w(u8 data) if (!init) { init = 1; - static int16_t speaker_levels[4] = { 0, -32767, 0, 32767 }; + static double const speaker_levels[4] = { 0.0, -1.0, 0.0, 1.0 }; m_speaker->set_levels(4, speaker_levels); } } diff --git a/src/mame/drivers/mes.cpp b/src/mame/drivers/mes.cpp index 24b69b6866a..de379ba2a96 100644 --- a/src/mame/drivers/mes.cpp +++ b/src/mame/drivers/mes.cpp @@ -99,21 +99,20 @@ void mes_state::machine_reset() Also the screen dimensions are a guess. */ uint32_t mes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/metalmx.cpp b/src/mame/drivers/metalmx.cpp index 4fc9ec4f3a6..e1c5acfb595 100644 --- a/src/mame/drivers/metalmx.cpp +++ b/src/mame/drivers/metalmx.cpp @@ -290,7 +290,7 @@ uint32_t metalmx_state::screen_update_metalmx(screen_device &screen, bitmap_ind1 for (int y = (std::max)(0, cliprect.min_y); y <= (std::min)(383, cliprect.max_y); ++y) { - uint16_t *pix = &bitmap.pix16(y); + uint16_t *pix = &bitmap.pix(y); for (int x = 0; x < 256; x++) { *pix++ = src_base[256 * y + x] & 0xffff; diff --git a/src/mame/drivers/meyc8080.cpp b/src/mame/drivers/meyc8080.cpp index 7b63e7e117f..5ff1731fa36 100644 --- a/src/mame/drivers/meyc8080.cpp +++ b/src/mame/drivers/meyc8080.cpp @@ -113,12 +113,8 @@ private: uint32_t meyc8080_state::screen_update_meyc8080(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram_0.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram_0.bytes(); offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; @@ -132,15 +128,15 @@ uint32_t meyc8080_state::screen_update_meyc8080(screen_device &screen, bitmap_rg uint8_t data_g = (data2 & ~data0) | (data2 & data1) | (~data2 & ~data1 & data0); uint8_t data_b = data0 ^ data1; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x) = rgb_t(pal1bit(data_r >> 7), pal1bit(data_g >> 7), pal1bit(data_b >> 7)); + bitmap.pix(y, x) = rgb_t(pal1bit(data_r >> 7), pal1bit(data_g >> 7), pal1bit(data_b >> 7)); - data_r = data_r << 1; - data_g = data_g << 1; - data_b = data_b << 1; + data_r <<= 1; + data_g <<= 1; + data_b <<= 1; - x = x + 1; + x++; } } diff --git a/src/mame/drivers/meyc8088.cpp b/src/mame/drivers/meyc8088.cpp index 363eaffe16d..653ff3b757b 100644 --- a/src/mame/drivers/meyc8088.cpp +++ b/src/mame/drivers/meyc8088.cpp @@ -163,7 +163,7 @@ uint32_t meyc8088_state::screen_update(screen_device &screen, bitmap_ind16 &bitm v[3] = m_vram[offs|0x4001]; // video4: color prom d3 for (int i = 0; i < 8; i++) - bitmap.pix16(y, x | i) = ((v[0] << i) >> 7 & 1) | ((v[1] << i) >> 6 & 2) | ((v[2] << i) >> 5 & 4) | ((v[3] << i) >> 4 & 8) | v[4]; + bitmap.pix(y, x | i) = ((v[0] << i) >> 7 & 1) | ((v[1] << i) >> 6 & 2) | ((v[2] << i) >> 5 & 4) | ((v[3] << i) >> 4 & 8) | v[4]; } return 0; diff --git a/src/mame/drivers/micral.cpp b/src/mame/drivers/micral.cpp index 12c1c90f2af..692c61480b7 100644 --- a/src/mame/drivers/micral.cpp +++ b/src/mame/drivers/micral.cpp @@ -323,21 +323,20 @@ INPUT_PORTS_END uint32_t micral_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_vram[x+ma]; + uint8_t chr = m_vram[x+ma]; gfx = m_p_chargen[(chr<<4) | ra ]; if (((s_curpos & 0xff)==x) && ((s_curpos >> 8)==y)) gfx ^= 0xff; diff --git a/src/mame/drivers/microb.cpp b/src/mame/drivers/microb.cpp index 10544180c67..4feafb18f93 100644 --- a/src/mame/drivers/microb.cpp +++ b/src/mame/drivers/microb.cpp @@ -211,8 +211,8 @@ static INPUT_PORTS_START( microb ) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3pad") PORT_CODE(KEYCODE_3_PAD) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Show/Hide Status") - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0pad") PORT_CODE(KEYCODE_0_PAD) PORT_START("X9") @@ -223,10 +223,10 @@ static INPUT_PORTS_START( microb ) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cursor Blink On/Off") PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // carriage return - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_START("X10") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("XMIT") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) @@ -285,9 +285,9 @@ I8275_DRAW_CHARACTER_MEMBER(microb_state::draw_character) dots ^= 0xff; // HLGT is active on status line - rgb_t fg = hlgt ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); + rgb_t const fg = hlgt ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); - u32 *pix = &bitmap.pix32(y, x); + u32 *pix = &bitmap.pix(y, x); for (int i = 0; i < 8; i++) { *pix++ = BIT(dots, 7) ? fg : rgb_t::black(); diff --git a/src/mame/drivers/microtan.cpp b/src/mame/drivers/microtan.cpp index 2e155561761..51018495c05 100644 --- a/src/mame/drivers/microtan.cpp +++ b/src/mame/drivers/microtan.cpp @@ -142,7 +142,7 @@ static INPUT_PORTS_START( microtan ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_DEL) PORT_CHAR(3) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) @@ -162,7 +162,7 @@ static INPUT_PORTS_START( microtan ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') diff --git a/src/mame/drivers/microterm_f8.cpp b/src/mame/drivers/microterm_f8.cpp index 9d476def400..da4d83cd617 100644 --- a/src/mame/drivers/microterm_f8.cpp +++ b/src/mame/drivers/microterm_f8.cpp @@ -162,7 +162,7 @@ u32 microterm_f8_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma bool dot = (!BIT(ch, 8) && allow_underline) || ((BIT(ch, 10) || blink_on) && BIT(chdata, 8 - (x % 9))); if ((BIT(ch, 7) && cursor_on) == BIT(ch, 9)) dot = !dot; - bitmap.pix32(y, x) = dot ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = dot ? rgb_t::white() : rgb_t::black(); } y++; diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index 7957d16279d..324443a5366 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -267,7 +267,7 @@ uint32_t microvision_state::screen_update(screen_device &screen, bitmap_rgb32 &b p = (p > 255) ? 0 : p ^ 255; if (cliprect.contains(x, y)) - bitmap.pix32(y, x) = p << 16 | p << 8 | p; + bitmap.pix(y, x) = p << 16 | p << 8 | p; } } diff --git a/src/mame/drivers/mikro80.cpp b/src/mame/drivers/mikro80.cpp index 5501b6d0536..b49f864e6f6 100644 --- a/src/mame/drivers/mikro80.cpp +++ b/src/mame/drivers/mikro80.cpp @@ -184,7 +184,7 @@ u32 mikro80_state::screen_update_mikro80(screen_device &screen, bitmap_ind16 &bi { for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); for (u16 x = ma; x < ma + 64; x++) { diff --git a/src/mame/drivers/mikromik.cpp b/src/mame/drivers/mikromik.cpp index 75c4f6fa5dd..cddf5908c14 100644 --- a/src/mame/drivers/mikromik.cpp +++ b/src/mame/drivers/mikromik.cpp @@ -154,7 +154,7 @@ WRITE_LINE_MEMBER( mm1_state::recall_w ) { LOG("RECALL %u\n", state); m_recall = state; - if (state) m_fdc->soft_reset(); + m_fdc->reset_w(state); } diff --git a/src/mame/drivers/mikrosha.cpp b/src/mame/drivers/mikrosha.cpp index 6660e81c278..8442c3238b3 100644 --- a/src/mame/drivers/mikrosha.cpp +++ b/src/mame/drivers/mikrosha.cpp @@ -190,7 +190,7 @@ I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels) pixels ^= 0xff; for(int i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/milton6805.cpp b/src/mame/drivers/milton6805.cpp index efda2a0886d..1377e8d85a2 100644 --- a/src/mame/drivers/milton6805.cpp +++ b/src/mame/drivers/milton6805.cpp @@ -90,7 +90,7 @@ public: protected: virtual void device_start() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; @@ -108,25 +108,24 @@ milton_filter_device::milton_filter_device(const machine_config &mconfig, const void milton_filter_device::device_start() { - m_stream = stream_alloc_legacy(1, 1, machine().sample_rate()); + m_stream = stream_alloc(1, 1, machine().sample_rate()); m_led_out.resolve(); } -void milton_filter_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void milton_filter_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int level = 0; + stream_buffer::sample_t level = 0; - for (int i = 0; i < samples; i++) - { - level += abs(inputs[0][i]); - outputs[0][i] = inputs[0][i]; - } + for (int i = 0; i < outputs[0].samples(); i++) + level += fabsf(inputs[0].get(i)); + + outputs[0] = inputs[0]; - if (samples > 0) - level /= samples; + if (outputs[0].samples() > 0) + level /= outputs[0].samples(); // 2 leds connected to the audio circuit - const int threshold = 1500; + const stream_buffer::sample_t threshold = 1500.0 / 32768.0; m_led_out = (level > threshold) ? 1 : 0; } diff --git a/src/mame/drivers/mindset.cpp b/src/mame/drivers/mindset.cpp index 279ad92bbf8..d11e5291420 100644 --- a/src/mame/drivers/mindset.cpp +++ b/src/mame/drivers/mindset.cpp @@ -751,12 +751,12 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co if(ibm_mode) { if(large_pixels) { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; for(int field=0; field<2; field++) { for(u32 yy=0; yy<2; yy++) { const u16 *src = bank + 4096*yy; for(u32 y=yy; y<200; y+=2) { - u32 *dest = &bitmap.pix32(2*y+field+dy, dx); + u32 *dest = &bitmap.pix(2*y+field+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -770,12 +770,12 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co } return 0; } else { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; for(int field=0; field<2; field++) { for(u32 yy=0; yy<2; yy++) { const u16 *src = bank + 4096*yy; for(u32 y=yy; y<200; y+=2) { - u32 *dest = &bitmap.pix32(2*y+field+dy, dx); + u32 *dest = &bitmap.pix(2*y+field+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -795,8 +795,8 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 0: { const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=4) { u16 sv = sw(*src++); for(u32 xx=0; xx<4; xx++) { @@ -811,11 +811,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -832,8 +832,8 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 2: { const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -853,7 +853,7 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 0: { const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<320; x+=4) { u16 sv = sw(*src++); for(u32 xx=0; xx<4; xx++) { @@ -866,10 +866,10 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -887,11 +887,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co if(!interleave) { switch(pixels_per_byte_order) { case 0: { - static int palind[4] = { 0, 4, 8, 12 }; + static int const palind[4] = { 0, 4, 8, 12 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<640; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -904,11 +904,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -922,10 +922,10 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co } } } else { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp index 28f52c0aed3..9423a10432d 100644 --- a/src/mame/drivers/miniboy7.cpp +++ b/src/mame/drivers/miniboy7.cpp @@ -320,7 +320,7 @@ int miniboy7_state::get_color_offset(uint8_t tile, uint8_t attr, int ra, int px) MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (uint8_t cx = 0; cx < x_count; cx+=1) { @@ -332,9 +332,9 @@ MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row ) uint8_t color_b = m_proms[offset_b] & 0x0f; if (color_a && (m_gpri || !color_b)) // videoram A has priority - bitmap.pix32(y, (cx << 3) + px) = palette[offset_a]; + bitmap.pix(y, (cx << 3) + px) = palette[offset_a]; else if (color_b && (!m_gpri || !color_a)) // videoram B has priority - bitmap.pix32(y, (cx << 3) + px) = palette[offset_b]; + bitmap.pix(y, (cx << 3) + px) = palette[offset_b]; } } } diff --git a/src/mame/drivers/minivadr.cpp b/src/mame/drivers/minivadr.cpp index 0b0b1bd4c88..329d3c5fa15 100644 --- a/src/mame/drivers/minivadr.cpp +++ b/src/mame/drivers/minivadr.cpp @@ -65,23 +65,19 @@ private: uint32_t minivadr_state::screen_update_minivadr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - int y = offs >> 5; + const int y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data << 1; - x = x + 1; + data <<= 1; + x++; } } diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp index ca2f756d1c4..b4c1d9c0823 100644 --- a/src/mame/drivers/missile.cpp +++ b/src/mame/drivers/missile.cpp @@ -683,24 +683,21 @@ uint8_t missile_state::read_vram(address_space &space, offs_t address) uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; - int x, y; - // draw the bitmap to the screen, looping over Y - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); - int effy = m_flipscreen ? ((256+24 - y) & 0xff) : y; - uint8_t *src = &videoram[effy * 64]; - uint8_t *src3 = nullptr; + int const effy = m_flipscreen ? ((256+24 - y) & 0xff) : y; + uint8_t const *const src = &m_videoram[effy * 64]; + uint8_t const *src3 = nullptr; // compute the base of the 3rd pixel row if (effy >= 224) - src3 = &videoram[get_bit3_addr(effy << 8)]; + src3 = &m_videoram[get_bit3_addr(effy << 8)]; // loop over X - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pix = src[x / 4] >> (x & 3); pix = ((pix >> 2) & 4) | ((pix << 1) & 2); diff --git a/src/mame/drivers/mjsenpu.cpp b/src/mame/drivers/mjsenpu.cpp index f38ca081012..5d3954855ca 100644 --- a/src/mame/drivers/mjsenpu.cpp +++ b/src/mame/drivers/mjsenpu.cpp @@ -407,32 +407,26 @@ void mjsenpu_state::video_start() uint32_t mjsenpu_state::screen_update_mjsenpu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,count; - int color; + uint32_t const *const vram = (m_control & 0x01) ? m_vram0 : m_vram1; - uint32_t* vram; - - if (m_control & 0x01) vram = m_vram0; - else vram = m_vram1; - - - - count = 0; - for (y=0;y < 256;y++) + int count = 0; + for (int y=0;y < 256;y++) { - for (x=0;x < 512/4;x++) + for (int x=0;x < 512/4;x++) { + int color; + color = vram[count] & 0x000000ff; - bitmap.pix16(y, x*4 + 2) = color; + bitmap.pix(y, x*4 + 2) = color; color = (vram[count] & 0x0000ff00) >> 8; - bitmap.pix16(y, x*4 + 3) = color; + bitmap.pix(y, x*4 + 3) = color; color = (vram[count] & 0x00ff0000) >> 16; - bitmap.pix16(y, x*4 + 0) = color; + bitmap.pix(y, x*4 + 0) = color; color = (vram[count] & 0xff000000) >> 24; - bitmap.pix16(y, x*4 + 1) = color; + bitmap.pix(y, x*4 + 1) = color; count++; } diff --git a/src/mame/drivers/mjsister.cpp b/src/mame/drivers/mjsister.cpp index 79ea31be2ae..94f3f27cf69 100644 --- a/src/mame/drivers/mjsister.cpp +++ b/src/mame/drivers/mjsister.cpp @@ -139,8 +139,8 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row ) // background layer uint8_t data_bg = m_vram[0x400 + ((ma << 3) | (ra << 7) | i)]; - bitmap.pix32(y, x1) = pen[m_colorbank << 5 | ((data_bg & 0x0f) >> 0)]; - bitmap.pix32(y, x2) = pen[m_colorbank << 5 | ((data_bg & 0xf0) >> 4)]; + bitmap.pix(y, x1) = pen[m_colorbank << 5 | ((data_bg & 0x0f) >> 0)]; + bitmap.pix(y, x2) = pen[m_colorbank << 5 | ((data_bg & 0xf0) >> 4)]; // foreground layer uint8_t data_fg = m_vram[0x8000 | (0x400 + ((ma << 3) | (ra << 7) | i))]; @@ -149,8 +149,8 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row ) uint8_t c2 = ((data_fg & 0xf0) >> 4); // 0 is transparent - if (c1) bitmap.pix32(y, x1) = pen[m_colorbank << 5 | 0x10 | c1]; - if (c2) bitmap.pix32(y, x2) = pen[m_colorbank << 5 | 0x10 | c2]; + if (c1) bitmap.pix(y, x1) = pen[m_colorbank << 5 | 0x10 | c1]; + if (c2) bitmap.pix(y, x2) = pen[m_colorbank << 5 | 0x10 | c2]; } } diff --git a/src/mame/drivers/ml20.cpp b/src/mame/drivers/ml20.cpp index 413efc7ca99..d31a697b5a0 100644 --- a/src/mame/drivers/ml20.cpp +++ b/src/mame/drivers/ml20.cpp @@ -170,7 +170,7 @@ HD44780_PIXEL_UPDATE( ml20_state::lcd_pixel_update ) return; if (line < 2 && pos < 16) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } // 7654---- unknown (set to input) diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp index ef3b653a06a..1a7734e07c9 100644 --- a/src/mame/drivers/mlanding.cpp +++ b/src/mame/drivers/mlanding.cpp @@ -243,12 +243,12 @@ void mlanding_state::machine_reset() u32 mlanding_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_palette->pens(); + pen_t const *const pens = m_palette->pens(); for (u32 y = cliprect.min_y; y <= cliprect.max_y; ++y) { - u16 *src = &m_g_ram[(112 + y) * 512 + cliprect.min_x]; - u16 *dst = &bitmap.pix16(y, cliprect.min_x); + u16 const *src = &m_g_ram[(112 + y) * 512 + cliprect.min_x]; + u16 *dst = &bitmap.pix(y, cliprect.min_x); for (u32 x = cliprect.min_x; x <= cliprect.max_x; ++x) { diff --git a/src/mame/drivers/mmagic.cpp b/src/mame/drivers/mmagic.cpp index cd17c92e098..ac9eb64d633 100644 --- a/src/mame/drivers/mmagic.cpp +++ b/src/mame/drivers/mmagic.cpp @@ -229,15 +229,15 @@ uint32_t mmagic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap { uint8_t gfx = m_tiles[(code << 4) + tx]; - bitmap.pix32(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black() : m_palette->pen_color(color); - - bitmap.pix32(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black() : m_palette->pen_color(color); + + bitmap.pix(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black() : m_palette->pen_color(color); } } } diff --git a/src/mame/drivers/modellot.cpp b/src/mame/drivers/modellot.cpp index 8e8e710fe06..c33d1bc3460 100644 --- a/src/mame/drivers/modellot.cpp +++ b/src/mame/drivers/modellot.cpp @@ -166,25 +166,25 @@ GFXDECODE_END u32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (u8 ra = 0; ra < 16; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 64; x++) + for (u16 x = 0; x < 64; x++) { - inv = 0; + u8 inv = 0; - chr = m_p_videoram[x+ma]; + u8 chr = m_p_videoram[x+ma]; if (BIT(chr, 7)) inv = 0xff; chr &= 0x7f; // cursor + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra ]; else diff --git a/src/mame/drivers/monty.cpp b/src/mame/drivers/monty.cpp index 835c6119390..b0d096fed3d 100644 --- a/src/mame/drivers/monty.cpp +++ b/src/mame/drivers/monty.cpp @@ -106,7 +106,7 @@ u32 monty_state::screen_update(screen_device& screen, bitmap_rgb32& bitmap, cons // letters with width 5 with space in between them for (int y = 0; y < 32; y++) for (int x = 0; x < 40; x++) - bitmap.pix32(y + 1, x + x/5 + 1) = BIT(m_lcd_data[y], x) ? 0 : 0xffffff; + bitmap.pix(y + 1, x + x/5 + 1) = BIT(m_lcd_data[y], x) ? 0 : 0xffffff; return 0; } diff --git a/src/mame/drivers/monzagp.cpp b/src/mame/drivers/monzagp.cpp index e0af88f679e..5ef342070a1 100644 --- a/src/mame/drivers/monzagp.cpp +++ b/src/mame/drivers/monzagp.cpp @@ -247,9 +247,9 @@ uint32_t monzagp_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } if (cliprect.contains(x * 2, y)) - bitmap.pix16(y, x * 2) = color; + bitmap.pix(y, x * 2) = color; if (cliprect.contains(x * 2 + 1, y)) - bitmap.pix16(y, x * 2 + 1) = color; + bitmap.pix(y, x * 2 + 1) = color; // collisions uint8_t coll_prom_addr = bitswap<8>(tile_idx, 7, 6, 5, 4, 2, 0, 1, 3); diff --git a/src/mame/drivers/mpu4plasma.cpp b/src/mame/drivers/mpu4plasma.cpp index d392a1232f0..5e9e182fb30 100644 --- a/src/mame/drivers/mpu4plasma.cpp +++ b/src/mame/drivers/mpu4plasma.cpp @@ -56,31 +56,23 @@ void mpu4plasma_state::mpu4plasma_map(address_map &map) uint32_t mpu4plasma_state::screen_update_mpu4plasma(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // don't know if this really gets drawn straight from ram.. - int base = 0x1600 / 2; + int const base = 0x1600 / 2; - uint16_t* rambase = m_plasmaram; - uint16_t* dst_bitmap; + uint16_t const *const rambase = m_plasmaram; - int i,y,x,p; - i = 0; + int i = 0; - for (y=0;y<40;y++) + for (int y=0; y<40; y++) { - dst_bitmap = &bitmap.pix16(y); + uint16_t *const dst_bitmap = &bitmap.pix(y); - for (x=0;x<128/16;x++) + for (int x=0; x<128/16; x++) { - uint16_t pix = rambase[base+i]; - - for (p=0;p<16;p++) - { - uint16_t bit = (pix << p)&0x8000; - if (bit) dst_bitmap[x*16 + p] = 1; - else dst_bitmap[x*16 + p] = 0; - } + uint16_t const pix = rambase[base+i]; + for (int p=0; p<16; p++) + dst_bitmap[x*16 + p] = ((pix << p) & 0x8000) ? 1 : 0; i++; - } } diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp index 84cac95b732..cea0f4ea8ad 100644 --- a/src/mame/drivers/mpu4vid.cpp +++ b/src/mame/drivers/mpu4vid.cpp @@ -440,7 +440,7 @@ void mpu4vid_state::mpu4_vram(address_map &map) SCN2674_DRAW_CHARACTER_MEMBER(mpu4vid_state::display_pixels) { - if(!lg) + if (!lg) { uint16_t tile = m_vid_mainram[address & 0x7fff]; const uint8_t *line = m_gfxdecode->gfx(m_gfx_index+0)->get_data(tile & 0xfff); @@ -455,30 +455,29 @@ SCN2674_DRAW_CHARACTER_MEMBER(mpu4vid_state::display_pixels) { // TODO: calculate instead? static const uint8_t lookup[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, - 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, - 0, 0, 2, 2, 4, 4, 6, 6, 0, 0, 2, 2, 4, 4, 6, 6, - 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, - 0, 1, 0, 1, 0, 1, 0, 1, 8, 9, 8, 9, 8, 9, 8, 9, - 0, 0, 2, 2, 0, 0, 2, 2, 8, 8,10,10, 8, 8,10,10, - 0, 1, 2, 3, 0, 1, 2, 3, 8, 9,10,11, 8, 9,10,11, - 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8,12,12,12,12, - 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9,12,13,12,13, - 0, 0, 2, 2, 4, 4, 6, 6, 8, 8,10,10,12,12,14,14, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 - }; - - bitmap.pix32(y, x + i) = m_palette->pen(lookup[(extra << 4) | (pen & 0xf)]); + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, + 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, + 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, + 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, + 0, 0, 2, 2, 4, 4, 6, 6, 0, 0, 2, 2, 4, 4, 6, 6, + 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 1, 0, 1, 0, 1, 0, 1, 8, 9, 8, 9, 8, 9, 8, 9, + 0, 0, 2, 2, 0, 0, 2, 2, 8, 8,10,10, 8, 8,10,10, + 0, 1, 2, 3, 0, 1, 2, 3, 8, 9,10,11, 8, 9,10,11, + 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8,12,12,12,12, + 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9,12,13,12,13, + 0, 0, 2, 2, 4, 4, 6, 6, 8, 8,10,10,12,12,14,14, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 + }; + + bitmap.pix(y, x + i) = m_palette->pen(lookup[(extra << 4) | (pen & 0xf)]); } else { - bitmap.pix32(y, x + i) = m_palette->pen((extra<<4) | (pen & 0xf)); - + bitmap.pix(y, x + i) = m_palette->pen((extra<<4) | (pen & 0xf)); } } } diff --git a/src/mame/drivers/ms0515.cpp b/src/mame/drivers/ms0515.cpp index 33f2e059fb2..5adf16996ad 100644 --- a/src/mame/drivers/ms0515.cpp +++ b/src/mame/drivers/ms0515.cpp @@ -384,34 +384,33 @@ static void ms0515_floppies(device_slot_interface &device) uint32_t ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b; int addr = 0; if (BIT(m_sysregc, 3)) { uint8_t fg = m_sysregc & 7; uint8_t bg = fg ^ 7; - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { uint16_t code = (m_video_ram[addr++] << 8); - code += m_video_ram[addr++]; - for (b = 0; b < 16; b++) + code |= m_video_ram[addr++]; + for (int b = 0; b < 16; b++) { // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (15 - b)) & 0x01) ? bg : fg; + bitmap.pix(y, horpos++) = ((code >> (15 - b)) & 0x01) ? bg : fg; } } } } else { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { uint8_t code = m_video_ram[addr++]; uint8_t attr = m_video_ram[addr++]; @@ -424,11 +423,11 @@ uint32_t ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 bg = tmp; m_blink = -1; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; } } } diff --git a/src/mame/drivers/ms6102.cpp b/src/mame/drivers/ms6102.cpp index 6c52ac9c06d..5280a203381 100644 --- a/src/mame/drivers/ms6102.cpp +++ b/src/mame/drivers/ms6102.cpp @@ -183,7 +183,7 @@ u8 ms6102_state::memory_read_byte(offs_t offset) I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = (lten) ? 0xff : 0; if (!vsp) gfx = m_p_chargen[linecount | (charcode << 4)]; @@ -192,7 +192,7 @@ I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_pixels) gfx ^= 0xff; for(u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_attr) // TODO: attributes diff --git a/src/mame/drivers/msisaac.cpp b/src/mame/drivers/msisaac.cpp index 353133ac175..e17c5c2c581 100644 --- a/src/mame/drivers/msisaac.cpp +++ b/src/mame/drivers/msisaac.cpp @@ -6,11 +6,11 @@ driver by Jarek Burczynski - TODO: - - complete MCU simulation, several gameplay elements not properly right; - - sprites are probably banked differently (no way to be sure until MCU dump is available) - - TA7630 emulation needs filter support (characteristics depend on the frequency) - - TA7630 volume table is hand tuned to match the sample, but still slightly off. + TODO: + - complete MCU simulation, several gameplay elements not properly right; + - sprites are probably banked differently (no way to be sure until MCU dump is available) + - TA7630 emulation needs filter support (characteristics depend on the frequency) + - TA7630 volume table is hand tuned to match the sample, but still slightly off. ****************************************************************************/ diff --git a/src/mame/drivers/mstation.cpp b/src/mame/drivers/mstation.cpp index 517300b2ee5..c96c359ca65 100644 --- a/src/mame/drivers/mstation.cpp +++ b/src/mame/drivers/mstation.cpp @@ -155,7 +155,7 @@ uint32_t mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // columns are inverted (right to left) int col = ((x < 20) ? 19 : 59) - x; - bitmap.pix16(y, col*8 + b)= BIT(data, 0); + bitmap.pix(y, col*8 + b)= BIT(data, 0); data >>= 1; } } @@ -164,7 +164,7 @@ uint32_t mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitm //*************************************************************************** // Bankswitch -//***************************************************************************/ +//*************************************************************************** uint8_t mstation_state::bank1_r(offs_t offset) { diff --git a/src/mame/drivers/mtd1256.cpp b/src/mame/drivers/mtd1256.cpp index fdc73e30185..0c05033a071 100644 --- a/src/mame/drivers/mtd1256.cpp +++ b/src/mame/drivers/mtd1256.cpp @@ -63,9 +63,9 @@ HD44780_PIXEL_UPDATE(mtd1256_state::pixel_update) { // Is this the right layout? if (pos < 20) - bitmap.pix16(line * 16 + y, pos * 6 + x) = state; + bitmap.pix(line * 16 + y, pos * 6 + x) = state; else if (pos < 40) - bitmap.pix16(line * 16 + 8 + y, (pos - 20) * 6 + x) = state; + bitmap.pix(line * 16 + 8 + y, (pos - 20) * 6 + x) = state; } diff --git a/src/mame/drivers/multi16.cpp b/src/mame/drivers/multi16.cpp index 818a137d7cf..48ead99c97d 100644 --- a/src/mame/drivers/multi16.cpp +++ b/src/mame/drivers/multi16.cpp @@ -82,7 +82,7 @@ private: MC6845_UPDATE_ROW(multi16_state::crtc_update_row) { - uint8_t *vram = reinterpret_cast<uint8_t *>(m_vram.target()); + uint8_t const *const vram = reinterpret_cast<uint8_t *>(m_vram.target()); for (int i = 0; i < x_count; i++) { @@ -101,7 +101,7 @@ MC6845_UPDATE_ROW(multi16_state::crtc_update_row) color |= BIT(data_g, 7 - x) << 1; color |= BIT(data_b, 7 - x) << 2; - bitmap.pix32(y, x + i * 8) = m_palette->pens()[color]; + bitmap.pix(y, x + i * 8) = m_palette->pens()[color]; } } } diff --git a/src/mame/drivers/multi8.cpp b/src/mame/drivers/multi8.cpp index 05609efb6ec..819ddc3de4f 100644 --- a/src/mame/drivers/multi8.cpp +++ b/src/mame/drivers/multi8.cpp @@ -115,14 +115,13 @@ void multi8_state::video_start() MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t i,chr,gfx=0,color,pen,attr; - uint16_t mem = y*80,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u16 mem = y*80; + u32 *p = &bitmap.pix(y); - for(x = 0; x < x_count; x++) + for(u16 x = 0; x < x_count; x++) { - for(i = 0; i < 8; i++) + for(u8 i = 0; i < 8; i++) { u8 pen_b = BIT(m_p_vram[mem | 0x0000], 7-i); u8 pen_r = BIT(m_p_vram[mem | 0x4000], 7-i); @@ -143,18 +142,18 @@ MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) mem++; } - u8 x_width = BIT(m_display_reg, 6) ? 80 : 40; - u8 x_step = BIT(m_display_reg, 6) ? 1 : 2; + const u8 x_width = BIT(m_display_reg, 6) ? 80 : 40; + const u8 x_step = BIT(m_display_reg, 6) ? 1 : 2; mem = 0xc000 + ma; - p = &bitmap.pix32(y); + p = &bitmap.pix(y); - for(x = 0; x < x_width; x++) + for(u16 x = 0; x < x_width; x++) { - chr = m_p_vram[mem]; - attr = m_p_vram[mem | 0x800]; - color = (BIT(m_display_reg, 7)) ? 7 : (attr & 0x07); + const u8 chr = m_p_vram[mem]; + const u8 attr = m_p_vram[mem | 0x800]; + const u8 color = (BIT(m_display_reg, 7)) ? 7 : (attr & 0x07); - gfx = BIT(attr, 5); + u8 gfx = BIT(attr, 5); if (cursor_x >= 0) gfx ^= (x == (cursor_x / x_step)); @@ -165,9 +164,9 @@ MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) if (ra < 8) gfx ^= m_p_chargen[(chr << 3) | ra]; - for(i = 0; i < 8; i++) + for(u8 i = 0; i < 8; i++) { - pen = BIT(gfx, 7-i) ? color : 0; + u8 pen = BIT(gfx, 7-i) ? color : 0; if (x_step == 1) { diff --git a/src/mame/drivers/mx2178.cpp b/src/mame/drivers/mx2178.cpp index ef2d7160509..36950bf3ee5 100644 --- a/src/mame/drivers/mx2178.cpp +++ b/src/mame/drivers/mx2178.cpp @@ -84,18 +84,16 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( mx2178_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_p_videoram[mem]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7)]; diff --git a/src/mame/drivers/myb3k.cpp b/src/mame/drivers/myb3k.cpp index 720357451c9..ebfe5b95628 100644 --- a/src/mame/drivers/myb3k.cpp +++ b/src/mame/drivers/myb3k.cpp @@ -305,7 +305,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) { for (int pxl = 0; pxl < 8; pxl++) { - bitmap.pix32(y, ( x_pos * 8) + pxl) = rgb_t::black(); + bitmap.pix(y, ( x_pos * 8) + pxl) = rgb_t::black(); } } else @@ -332,7 +332,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) //pind ^= ((cursor_x != -1 && x_pos == cursor_x && ra == 7) ? 7 : 0); /* Create the grey scale */ - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; } } break; @@ -372,7 +372,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) pind ^= ((cursor_x != -1 && x_pos == cursor_x && ra == 7) ? 7 : 0); /* Pick up the color */ - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; } } break; @@ -394,11 +394,11 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) { if ((pdat & (0x80 >> pxl)) != 0) { - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[0x07]; } else { - bitmap.pix32(y, ( x_pos * 8) + pxl) = rgb_t::black(); + bitmap.pix(y, ( x_pos * 8) + pxl) = rgb_t::black(); } } } diff --git a/src/mame/drivers/mycom.cpp b/src/mame/drivers/mycom.cpp index cd6f3f66ecb..a7fdd4f6403 100644 --- a/src/mame/drivers/mycom.cpp +++ b/src/mame/drivers/mycom.cpp @@ -148,20 +148,17 @@ private: MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx=0,z; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); if (m_port0a & 0x40) { - for (x = 0; x < x_count; x++) // lores pixels + for (u16 x = 0; x < x_count; x++) // lores pixels { - u8 dbit=1; - if (x == cursor_x) dbit=0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - z = ra / 3; + u8 dbit = (x == cursor_x) ? 0 : 1; + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 z = ra / 3; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; @@ -175,16 +172,16 @@ MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) } else { - for (x = 0; x < x_count; x++) // text + for (u16 x = 0; x < x_count; x++) // text { - u8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0x7ff; + u8 inv = (x == cursor_x) ? 0xff : 0; + u16 mem = (ma + x) & 0x7ff; + u8 gfx; if (ra > 7) gfx = inv; // some blank spacing lines else { - chr = m_vram[mem]; + u8 chr = m_vram[mem]; gfx = m_p_chargen[(chr<<3) | ra] ^ inv; } diff --git a/src/mame/drivers/mz2000.cpp b/src/mame/drivers/mz2000.cpp index 36331ccade5..f227ea79c00 100644 --- a/src/mame/drivers/mz2000.cpp +++ b/src/mame/drivers/mz2000.cpp @@ -183,8 +183,8 @@ uint32_t mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 pen |= ((gvram[count+0xc000] >> (xi)) & 1) ? 4 : 0; //G pen &= m_gvram_mask; - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen); + bitmap.pix(y*2+0, x+xi) = m_palette->pen(pen); + bitmap.pix(y*2+1, x+xi) = m_palette->pen(pen); } count++; } @@ -224,27 +224,27 @@ uint32_t mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 { if(m_width80 == 0) { - bitmap.pix16(res_y, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y, res_x*2+1) = m_palette->pen(pen); } else { - bitmap.pix16(res_y, res_x) = m_palette->pen(pen); + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } else { if(m_width80 == 0) { - bitmap.pix16(res_y*2+0, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+0, res_x*2+1) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x*2+1) = m_palette->pen(pen); } else { - bitmap.pix16(res_y*2+0, res_x) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/mz2500.cpp b/src/mame/drivers/mz2500.cpp index c2a1c297686..055fc956233 100644 --- a/src/mame/drivers/mz2500.cpp +++ b/src/mame/drivers/mz2500.cpp @@ -6,6 +6,9 @@ driver by Angelo Salese + Computer box contains 2 floppy drives on the right, and a front-loading cassette player on the left. + Keyboard is separate, and the key layout is very similar to the fm7. + TODO: - Kanji text is cutted in half when font_size is 1 / interlace is disabled, different ROM used? (check Back to the Future); - Implement external ROM hook-up; @@ -69,23 +72,23 @@ void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,uint16_t { if(width && height) { - bitmap.pix16(y*2+0, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+0, x*2+1) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+1) = m_palette->pen(pen); + bitmap.pix(y*2+0, x*2+0) = m_palette->pen(pen); + bitmap.pix(y*2+0, x*2+1) = m_palette->pen(pen); + bitmap.pix(y*2+1, x*2+0) = m_palette->pen(pen); + bitmap.pix(y*2+1, x*2+1) = m_palette->pen(pen); } else if(width) { - bitmap.pix16(y, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y, x*2+1) = m_palette->pen(pen); + bitmap.pix(y, x*2+0) = m_palette->pen(pen); + bitmap.pix(y, x*2+1) = m_palette->pen(pen); } else if(height) { - bitmap.pix16(y*2+0, x) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x) = m_palette->pen(pen); + bitmap.pix(y*2+0, x) = m_palette->pen(pen); + bitmap.pix(y*2+1, x) = m_palette->pen(pen); } else - bitmap.pix16(y, x) = m_palette->pen(pen); + bitmap.pix(y, x) = m_palette->pen(pen); } void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,uint16_t map_addr) @@ -1274,18 +1277,18 @@ void mz2500_state::mz2500_io(address_map &map) /* Input ports */ static INPUT_PORTS_START( mz2500 ) PORT_START("KEY0") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_START("KEY1") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8 (PAD)") PORT_CODE(KEYCODE_8_PAD) PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9 (PAD)") PORT_CODE(KEYCODE_9_PAD) PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(", (PAD)") PORT_CODE(KEYCODE_COMMA_PAD) @@ -1304,91 +1307,91 @@ static INPUT_PORTS_START( mz2500 ) PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7 (PAD)") PORT_CODE(KEYCODE_7_PAD) PORT_START("KEY3") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") //PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CHAR(3) //PORT_CODE(KEYCODE_ESC) PORT_START("KEY4") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") //PORT_CODE(KEYCODE_SLASH) - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_START("KEY5") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_START("KEY6") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_START("KEY7") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) //Yen symbol - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("_") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(".") - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(",") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") PORT_CHAR(165) PORT_CHAR('|') //Yen symbol + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR('_') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_START("KEY8") PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_START("KEY9") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":") - PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") - PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) PORT_START("KEYA") - PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") + PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("COPY") PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CLR") PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INST") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(27) PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK) PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD) PORT_START("KEYB") PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SLOCK") - PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") - PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") + PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0xe0,IP_ACTIVE_LOW,IPT_UNUSED) PORT_START("KEYC") diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp index 0b9b537c340..d9689c2afa1 100644 --- a/src/mame/drivers/mz3500.cpp +++ b/src/mame/drivers/mz3500.cpp @@ -167,39 +167,29 @@ UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile; - int attr; - uint8_t tile_data; - uint8_t width80; - uint8_t char_size; - uint8_t hires; - uint8_t color_mode; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // popmessage("%02x",m_crtc[6]); - color_mode = m_crtc[4] & 1; - width80 = (m_crtc[5] & 2) >> 1; - hires = (m_crtc[6] & 1); - char_size = (hires) ? 16 : 8; + uint8_t color_mode = m_crtc[4] & 1; + uint8_t width80 = (m_crtc[5] & 2) >> 1; + uint8_t hires = (m_crtc[6] & 1); + uint8_t char_size = (hires) ? 16 : 8; - for( x = 0; x < pitch; x++ ) + for( int x = 0; x < pitch; x++ ) { - tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); - attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); + int tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); + int attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); //if(hires) // tile <<= 1; - for( yi = 0; yi < lr; yi++) + for( int yi = 0; yi < lr; yi++) { - tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; + uint8_t tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; - for( xi = 0; xi < 8; xi++) + for( int xi = 0; xi < 8; xi++) { - int res_x,res_y; int pen; if(yi >= char_size) @@ -227,18 +217,18 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) } } - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(pen != -1) { if(!width80) { - bitmap.pix32(res_y, res_x*2+0) = palette[pen]; - bitmap.pix32(res_y, res_x*2+1) = palette[pen]; + bitmap.pix(res_y, res_x*2+0) = palette[pen]; + bitmap.pix(res_y, res_x*2+1) = palette[pen]; } else - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/mz6500.cpp b/src/mame/drivers/mz6500.cpp index 76ba97cf42a..464cb888dd3 100644 --- a/src/mame/drivers/mz6500.cpp +++ b/src/mame/drivers/mz6500.cpp @@ -50,19 +50,14 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int gfx[3]; - u8 i,pen; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + int const gfx[3] = { m_vram[(address + 0x00000) >> 1], m_vram[(address + 0x10000) >> 1], m_vram[(address + 0x20000) >> 1] }; - gfx[0] = m_vram[(address + 0x00000) >> 1]; - gfx[1] = m_vram[(address + 0x10000) >> 1]; - gfx[2] = m_vram[(address + 0x20000) >> 1]; - - for(i=0; i<16; i++) + for(u8 i=0; i<16; i++) { - pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); + u8 pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); - bitmap.pix32(y, x + i) = palette[pen]; + bitmap.pix(y, x + i) = palette[pen]; } } diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp index a033f08bb83..8551fc700c6 100644 --- a/src/mame/drivers/nakajies.cpp +++ b/src/mame/drivers/nakajies.cpp @@ -685,7 +685,7 @@ uint32_t nakajies_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int px=0; px<8; px++) { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + bitmap.pix(y, (x * 8) + px) = BIT(data, 7); data <<= 1; } } diff --git a/src/mame/drivers/namcos10.cpp b/src/mame/drivers/namcos10.cpp index 65012edf71e..5aabe9b3387 100644 --- a/src/mame/drivers/namcos10.cpp +++ b/src/mame/drivers/namcos10.cpp @@ -407,7 +407,9 @@ earlier TK games, so it appears to be optional or is only used by the later TK51 #include "machine/ns10crypt.h" #include "cpu/psx/psx.h" +#include "cpu/tlcs900/tmp95c061.h" #include "machine/ram.h" +//#include "sound/spu.h" #include "video/psx.h" #include "screen.h" #include "speaker.h" @@ -417,12 +419,17 @@ class namcos10_state : public driver_device { public: namcos10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_exio_mcu(*this, "exio_mcu") + , m_memp3_mcu(*this, "memp3_mcu") + { } void namcos10_base(machine_config &config); void namcos10_memm(machine_config &config); void namcos10_memn(machine_config &config); + void namcos10_memn_exio(machine_config &config); + void namcos10_memp3(machine_config &config); void ns10_konotako(machine_config &config); void ns10_mrdrilr2(machine_config &config); void ns10_knpuzzle(machine_config &config); @@ -504,6 +511,8 @@ private: DECLARE_MACHINE_RESET(namcos10); void memn_driver_init( ); required_device<psxcpu_device> m_maincpu; + optional_device<tmp95c061_device> m_exio_mcu; + optional_device<tmp95c061_device> m_memp3_mcu; }; @@ -938,7 +947,7 @@ void namcos10_state::namcos10_base(machine_config &config) /* basic machine hardware */ CXD8606BQ(config, m_maincpu, XTAL(101'491'200)); m_maincpu->set_disable_rom_berr(true); - m_maincpu->subdevice<ram_device>("ram")->set_default_size("16M"); + m_maincpu->subdevice<ram_device>("ram")->set_default_size("16M"); // ->set_default_size("4M"); 2 IS41LV16100s // The bios first configures the ROM window as 80000-big, then // switches to 400000. If berr is active, the first configuration // wipes all handlers after 1fc80000, which kills the system @@ -947,13 +956,15 @@ void namcos10_state::namcos10_base(machine_config &config) MCFG_MACHINE_RESET_OVERRIDE(namcos10_state, namcos10) /* video hardware */ - CXD8561CQ(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); + CXD8561CQ(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); // 2 54V25632s SCREEN(config, "screen", SCREEN_TYPE_RASTER); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); + + // CXD2938Q; SPU with CD-ROM controller - also seen in PSone, 101.4912MHz / 3? } void namcos10_state::namcos10_memm(machine_config &config) @@ -968,6 +979,19 @@ void namcos10_state::namcos10_memn(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &namcos10_state::namcos10_memn_map); } +void namcos10_state::namcos10_memn_exio(machine_config &config) +{ + namcos10_memn(config); + TMP95C061(config, m_exio_mcu, XTAL(22'118'400)).set_disable(); // not hooked up +} + +void namcos10_state::namcos10_memp3(machine_config &config) +{ + namcos10_memn(config); + TMP95C061(config, m_memp3_mcu, XTAL(16'934'400)).set_disable(); // not hooked up + // LC82310 16.9344MHz +} + void namcos10_state::ns10_mrdrilr2(machine_config &config) { namcos10_memm(config); @@ -1315,26 +1339,26 @@ ROM_START( pacmball ) ROM_LOAD( "k9f2808u0c.8d", 0x1080000, 0x1080000, CRC(f79d7199) SHA1(4ef9b758ee778e12f7fef717e063597299fb8219) ) ROM_END -GAME( 2000, mrdrilr2, 0, ns10_mrdrilr2, namcos10, namcos10_state, init_mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks -GAME( 2000, mrdrlr2a, mrdrilr2, ns10_mrdrilr2, namcos10, namcos10_state, init_mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (World, DR22 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks -GAME( 2000, ptblank3, 0, namcos10_memn, namcos10, namcos10_state, init_gunbalna, ROT0, "Namco", "Point Blank 3 (World, GNN2 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2000, gunbalina, ptblank3, namcos10_memn, namcos10, namcos10_state, init_gunbalna, ROT0, "Namco", "Gunbalina (Japan, GNN1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2001, gjspace, 0, ns10_gjspace , namcos10, namcos10_state, init_gjspace, ROT0, "Namco / Metro", "Gekitoride-Jong Space (10011 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2001, g13jnc, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Eighting / Raizing / Namco", "Golgo 13: Juusei no Chinkonka (Japan, GLT1 VER.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2001, mrdrilrg, 0, namcos10_memn, namcos10, namcos10_state, init_mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks -GAME( 2001, mrdrilrga, mrdrilrg, namcos10_memn, namcos10, namcos10_state, init_mrdrilrg, ROT0, "Namco", "Mr. Driller G ALT (Japan, DRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks -GAME( 2001, knpuzzle, 0, ns10_knpuzzle, namcos10, namcos10_state, init_knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2001, kd2001, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Knock Down 2001 (Japan, KD11 Ver. B)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 2002, chocovdr, 0, ns10_chocovdr, namcos10, namcos10_state, init_chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2002, startrgn, 0, ns10_startrgn, namcos10, namcos10_state, init_startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 2002, panikuru, 0, namcos10_memn, namcos10, namcos10_state, init_panikuru, ROT0, "Namco", "Panicuru Panekuru (Japan, PPA1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2002, gamshara, 0, ns10_gamshara, namcos10, namcos10_state, init_gamshara, ROT0, "Mitchell", "Gamshara (World, 10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // Ver. 20020912A ETC -GAME( 2002, gamsharaj, gamshara, ns10_gamshara, namcos10, namcos10_state, init_gamshara, ROT0, "Mitchell", "Gamshara (Japan, 10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2003, nflclsfb, 0, ns10_nflclsfb, namcos10, namcos10_state, init_nflclsfb, ROT0, "Namco", "NFL Classic Football (US, NCF3 Ver.A.)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2003, pacmball, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Pacman BALL (PMB2 Ver.A.)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -GAME( 2003, konotako, 0, ns10_konotako, namcos10, namcos10_state, init_konotako, ROT0, "Mitchell", "Kono Tako (10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 2004, sekaikh, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Sekai Kaseki Hakken (Japan, SKH1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 2004, taiko6, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Taiko no Tatsujin 6 (Japan, TK61 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 2006, keroro, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Keroro Gunso Chikyu Shinryaku Shirei Dearimasu! (KRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // ケロロ軍曹 地球侵略指令…であります! -GAME( 2007, gegemdb, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Gegege no Kitaro Yokai Yokocho Matsuri De Batoru Ja (GYM1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // ゲゲゲの鬼太郎 妖怪横丁まつりでバトルじゃ -GAME( 200?, unks10md, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "unknown Namco System 10 medal game (MTL1 SPR0B)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 2000, mrdrilr2, 0, ns10_mrdrilr2, namcos10, namcos10_state, init_mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks +GAME( 2000, mrdrlr2a, mrdrilr2, ns10_mrdrilr2, namcos10, namcos10_state, init_mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (World, DR22 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks +GAME( 2000, ptblank3, 0, namcos10_memn_exio, namcos10, namcos10_state, init_gunbalna, ROT0, "Namco", "Point Blank 3 (World, GNN2 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // needs to hookup gun IO +GAME( 2000, gunbalina, ptblank3, namcos10_memn_exio, namcos10, namcos10_state, init_gunbalna, ROT0, "Namco", "Gunbalina (Japan, GNN1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // "" +GAME( 2001, gjspace, 0, ns10_gjspace, namcos10, namcos10_state, init_gjspace, ROT0, "Namco / Metro", "Gekitoride-Jong Space (10011 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2001, g13jnc, 0, namcos10_memp3, namcos10, namcos10_state, empty_init, ROT0, "Eighting / Raizing / Namco", "Golgo 13: Juusei no Chinkonka (Japan, GLT1 VER.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2001, mrdrilrg, 0, namcos10_memn, namcos10, namcos10_state, init_mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks +GAME( 2001, mrdrilrga, mrdrilrg, namcos10_memn, namcos10, namcos10_state, init_mrdrilrg, ROT0, "Namco", "Mr. Driller G ALT (Japan, DRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // PORT_4WAY joysticks +GAME( 2001, knpuzzle, 0, ns10_knpuzzle, namcos10, namcos10_state, init_knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2001, kd2001, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Knock Down 2001 (Japan, KD11 Ver. B)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 2002, chocovdr, 0, ns10_chocovdr, namcos10, namcos10_state, init_chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2002, startrgn, 0, ns10_startrgn, namcos10, namcos10_state, init_startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 2002, panikuru, 0, namcos10_memn, namcos10, namcos10_state, init_panikuru, ROT0, "Namco", "Panicuru Panekuru (Japan, PPA1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2002, gamshara, 0, ns10_gamshara, namcos10, namcos10_state, init_gamshara, ROT0, "Mitchell", "Gamshara (World, 10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // Ver. 20020912A ETC +GAME( 2002, gamsharaj, gamshara, ns10_gamshara, namcos10, namcos10_state, init_gamshara, ROT0, "Mitchell", "Gamshara (Japan, 10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2003, nflclsfb, 0, ns10_nflclsfb, namcos10, namcos10_state, init_nflclsfb, ROT0, "Namco", "NFL Classic Football (US, NCF3 Ver.A.)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2003, pacmball, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Pacman BALL (PMB2 Ver.A.)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 2003, konotako, 0, ns10_konotako, namcos10, namcos10_state, init_konotako, ROT0, "Mitchell", "Kono Tako (10021 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 2004, sekaikh, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Sekai Kaseki Hakken (Japan, SKH1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 2004, taiko6, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Taiko no Tatsujin 6 (Japan, TK61 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 2006, keroro, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Keroro Gunso Chikyu Shinryaku Shirei Dearimasu! (KRG1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // ケロロ軍曹 地球侵略指令…であります! +GAME( 2007, gegemdb, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "Gegege no Kitaro Yokai Yokocho Matsuri De Batoru Ja (GYM1 Ver.A)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // ゲゲゲの鬼太郎 妖怪横丁まつりでバトルじゃ +GAME( 200?, unks10md, 0, namcos10_memn, namcos10, namcos10_state, empty_init, ROT0, "Namco", "unknown Namco System 10 medal game (MTL1 SPR0B)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/drivers/namcos12.cpp b/src/mame/drivers/namcos12.cpp index 8a90913b3d5..29648ffb258 100644 --- a/src/mame/drivers/namcos12.cpp +++ b/src/mame/drivers/namcos12.cpp @@ -870,8 +870,8 @@ Type 2 SYSTEM12 COH716 PCB 8661962301 (8661972301) (manufactured by Namco, probably in 2001, under license from Sony) Component layout is identical to COH-700 PCB with some updated components. Generally - it has 2X the amount of video RAM and 4X the amount of program RAM that the COH-700 PCB has. - KM4132G271Q replaced with OKI 54V25632A 256k x 32-bit x 2 Banks SGRAM (x2, QFP100) + it has 4X the amount of program RAM that the COH-700 PCB has. + KM4132G271Q replaced with OKI 54V25632A 128k x 32-bit x 2 Banks SGRAM (x2, QFP100) KM416V1204 replaced with Samsung Electronics K4E6416120D 4M x16 EDO DRAM (x2, TSOP44) Updated Sony CXD8561CQ GPU (QFP208) Updated Sony CXD8606BQ R3000A-based CPU (QFP208) @@ -1761,11 +1761,11 @@ void namcos12_state::coh700(machine_config &config) /* basic machine hardware */ CXD8661R(config, m_maincpu, XTAL(100'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &namcos12_state::namcos12_map); - m_maincpu->subdevice<ram_device>("ram")->set_default_size("4M"); + m_maincpu->subdevice<ram_device>("ram")->set_default_size("4M"); // 2 KM416V1204s m_maincpu->subdevice<psxdma_device>("dma")->install_read_handler(5, psxdma_device::read_delegate(&namcos12_state::namcos12_rom_read, this)); /* video hardware */ - CXD8654Q(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); + CXD8654Q(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); // 2 KM4132G271Qs SCREEN(config, "screen", SCREEN_TYPE_RASTER).screen_vblank().set(FUNC(namcos12_state::namcos12_sub_irq)); } @@ -1777,11 +1777,11 @@ void namcos12_state::coh716(machine_config &config) /* basic machine hardware */ CXD8606BQ(config, m_maincpu, XTAL(100'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &namcos12_state::namcos12_map); - m_maincpu->subdevice<ram_device>("ram")->set_default_size("16M"); + m_maincpu->subdevice<ram_device>("ram")->set_default_size("16M"); // 2 K4E6416120Ds m_maincpu->subdevice<psxdma_device>("dma")->install_read_handler(5, psxdma_device::read_delegate(&namcos12_state::namcos12_rom_read, this)); /* video hardware */ - CXD8561CQ(config, "gpu", XTAL(53'693'175), 0x400000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); + CXD8561CQ(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); // 2 54V25632As SCREEN(config, "screen", SCREEN_TYPE_RASTER).screen_vblank().set(FUNC(namcos12_state::namcos12_sub_irq)); } diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index ee8177e023d..359c646a822 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -433,20 +433,19 @@ uint16_t namcos21_state::winrun_gpu_videoram_r(offs_t offset) void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_gpu_videoram.get(); + uint8_t const *const videoram = m_gpu_videoram.get(); //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.top(),cliprect.bottom(),m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]); - int yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; - int xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; - int base = 0x1000+0x100*(m_winrun_color&0xf); - int sx,sy; - for( sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) + int const yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; + int const xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; + int const base = 0x1000+0x100*(m_winrun_color&0xf); + for( int sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) { - const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; - uint16_t *pDest = &bitmap.pix16(sy); - for( sx=cliprect.left(); sx<=cliprect.right(); sx++ ) + uint8_t const *const pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; + uint16_t *const pDest = &bitmap.pix(sy); + for( int sx=cliprect.left(); sx<=cliprect.right(); sx++ ) { - int pen = pSource[(sx+xscroll) & 0x1ff]; + int const pen = pSource[(sx+xscroll) & 0x1ff]; switch( pen ) { case 0xff: diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index ca4b2eda839..12d30f9fe01 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -2060,16 +2060,16 @@ void namcos23_renderer::render_scanline(int32_t scanline, const extent_t& extent float u = extent.param[1].start; float v = extent.param[2].start; float l = extent.param[3].start; - float dw = extent.param[0].dpdx; - float du = extent.param[1].dpdx; - float dv = extent.param[2].dpdx; - float dl = extent.param[3].dpdx; + const float dw = extent.param[0].dpdx; + const float du = extent.param[1].dpdx; + const float dv = extent.param[2].dpdx; + const float dl = extent.param[3].dpdx; - uint32_t *img = &object.bitmap->pix32(scanline, extent.startx); + uint32_t *img = &object.bitmap->pix(scanline, extent.startx); for(int x = extent.startx; x < extent.stopx; x++) { - float z = w ? 1/w : 0; - uint32_t pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z); + const float z = w ? 1/w : 0; + const uint32_t pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z); float ll = l*z; *img = (light(pcol >> 16, ll) << 16) | (light(pcol >> 8, ll) << 8) | light(pcol, ll); diff --git a/src/mame/drivers/nanos.cpp b/src/mame/drivers/nanos.cpp index 792a3cc7053..1adfc64ad2f 100644 --- a/src/mame/drivers/nanos.cpp +++ b/src/mame/drivers/nanos.cpp @@ -264,8 +264,7 @@ INPUT_PORTS_END uint32_t nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // static uint8_t framecnt=0; - uint8_t gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; // framecnt++; @@ -273,13 +272,14 @@ uint32_t nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { + uint8_t gfx; if (ra < 8) { - uint8_t chr = m_vram[x]; + uint8_t const chr = m_vram[x]; /* get pattern of pixels for that character scanline */ gfx = m_p_chargen[(chr<<3) | ra ]; diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index d434971fdf6..eb322704257 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -704,8 +704,9 @@ Melty Blood Actress Again Version A (Rev A) 841-0061C 24455 6 /Mushiking The King Of Beetles \Mushiking II / III / III+ (Ver. 2.001) (World) 840-0164C 24357 2 (512Mb) present 317-0437-COM present IC4# is marked "18" /Mushiking The King Of Beetles -Mushiking The King Of Beetles 2006 First (Japan) 840-0167C not present 2 (512Mb) present 317-0444-JPN present requires 610-0669 barcode reader \Mushiking IV / V / VI (World) 840-0180C not present 2 (512Mb) present 317-0437-COM present IC2# is labeled "VER.1", IC4# is marked "8A", requires 610-0669 barcode reader, 838-14245-92 "MAPLE/232C CONVERT BD" (MIE-based), 838-14243 "RFID CHIP R/W BD" and RFID chip +Mushiking The King Of Beetles 2006 First (Japan) 840-0167C not present 2 (512Mb) present 317-0444-JPN present IC4# is marked "18", require 610-0669 barcode reader +Mushiking The King Of Beetles 2006 Second (Japan) 840-0171C not present 2 (512Mb) present 317-0444-JPN present IC4# is marked "18", require 610-0669 barcode reader Pokasuka Ghost! 840-0170C not present 5 (512Mb) present 317-0461-COM present requires 837-14672 sensor board (SH4 based) Radirgy Noa 841-0062C not present 4 (512Mb) present 317-5138-JPN present IC2# is labeled "VER.2" - IC4# is marked "8A" Rhythm Tengoku 841-0177C not present 4 (512Mb) present 317-0503-JPN present IC2# is labeled "VER.2" - IC4# is marked "8A" @@ -5055,6 +5056,20 @@ ROM_START( mushi2k5 ) ROM_PARAMETER( ":rom_board:segam2crypt:key", "-1") // 315-5881 not populated ROM_END +ROM_START( mushi2k62 ) + NAOMI_BIOS + NAOMI_DEFAULT_EEPROM + + ROM_REGION( 0x8000000, "rom_board", ROMREGION_ERASEFF) + ROM_LOAD( "fpr-24360.ic8", 0x0000000, 0x4000000, CRC(6e6c6633) SHA1(e5fd1ff643899067db7ebda6641852bd45c36b86) ) + ROM_LOAD( "fpr-24361.ic9", 0x4000000, 0x4000000, CRC(ce2a9720) SHA1(0a55d1c8a67288dbad374ab812d4720cdf78ded7) ) + + ROM_REGION( 0x800, "pic_readout", 0 ) + ROM_LOAD( "317-0444-jpn.ic3", 0, 0x800, CRC(6ded35a2) SHA1(0bb12bf6b090b865abd04d26d65f28c661464514) ) + + ROM_PARAMETER( ":rom_board:id", "5502" ) +ROM_END + ROM_START( crackndj ) NAOMI_BIOS NAOMI_DEFAULT_EEPROM @@ -11181,9 +11196,10 @@ ROM_START( vfurlong ) ROM_REGION( 0x9000000, "rom_board", ROMREGION_ERASE) ROM_LOAD( "ax2001p01.ic18", 0x0000000, 0x0800000, CRC(17ea9aa9) SHA1(c68500e9b3407a9d4b20f2678718ce475f179f7d) ) + ROM_LOAD( "ax2001p01_alt.ic18", 0x0000000, 0x0800000, CRC(845399dd) SHA1(21565b13292cead2b532861d2998e381df2672d5) ) // same as above except for Customer ID, included for reference ROM_LOAD( "ax2001m01.ic11", 0x1000000, 0x1000000, CRC(64460b24) SHA1(044857d6593897d303622e005a63ca7b3acd7453) ) ROM_LOAD( "ax2002m01.ic12", 0x2000000, 0x1000000, CRC(d4da357f) SHA1(c462cddec9a369a1a5595676de76499d56683ea9) ) - ROM_LOAD( "ax2003m01.ic13", 0x3000000, 0x1000000, CRC(ad046ad7) SHA1(ac7c46e458595714e327526354e1111fb25b44e0) ) + ROM_LOAD( "ax2003m01.ic13", 0x3000000, 0x1000000, CRC(aa1e1246) SHA1(788cc9c070f82aeff1704361e3c72116fd5c4c9d) ) ROM_LOAD( "ax2004m01.ic14", 0x4000000, 0x1000000, CRC(4d555d7c) SHA1(a5eccc920bdb7ad9cf57c0e1ef6a905c6b9eee45) ) ROM_LOAD( "ax2005m01.ic15", 0x5000000, 0x1000000, CRC(785208e2) SHA1(6ba5bd3901c5b1d71abcc8d833a011bd4abae6b6) ) ROM_LOAD( "ax2006m01.ic16", 0x6000000, 0x1000000, CRC(8134ec55) SHA1(843e473d4f99237ded641cce9515b7802cfe3742) ) @@ -11565,7 +11581,7 @@ ROM_END // 0167 Mushiking 2K6 1ST (Japan) /* 0170-01 */ GAME( 2007, manicpnc, naomi, naomim4, naomi, naomi_state, init_naomi, ROT0, "Sega", "Manic Panic Ghosts! (USA, Export)", GAME_FLAGS ) /* 0170 */ GAME( 2007, pokasuka, manicpnc, naomim4, naomi, naomi_state, init_naomi, ROT0, "Sega", "Pokasuka Ghost! (Japan)", GAME_FLAGS ) -// 0171 Mushiking 2K6 2ND (Japan) note: starting from ver 2K6 was moved to SystemSP platform and later to PC-based hardware +/* 0171 */ GAME( 2006, mushi2k62, naomi, naomim4, naomi, naomi_state, init_naomi, ROT0, "Sega", "Mushiking The King Of Beetles 2006 Second (Japan)", GAME_FLAGS ) /* 0175 */ GAME( 2007, asndynmt, naomi, naomim4, naomi, naomi_state, init_naomi, ROT0, "Sega", "Asian Dynamite / Dynamite Deka EX", GAME_FLAGS ) /* 0175 */ GAME( 2007, asndynmto, asndynmt, naomim4, naomi, naomi_state, init_naomi, ROT0, "Sega", "Asian Dynamite / Dynamite Deka EX (older)", GAME_FLAGS ) // no revision stickers, presumably older revision but might be release for Asian market /* 0177 */ GAME( 2007, rhytngk, naomi, naomim4, naomi, naomi_state, init_naomi, ROT0, "Sega / Nintendo - J.P ROOM", "Rhythm Tengoku (Japan)", GAME_FLAGS ) @@ -11846,7 +11862,7 @@ GAME( 2004, ggisuka, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, GAME( 2004, rumblefp, rumblef, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish (prototype)", GAME_FLAGS) // Feb 20 2004 09:15:34 GAME( 2004, rangrmsn, awbios, aw2c, aw1w, atomiswave_state, init_atomiswave, ROT0, "RIZ Inc./ Sammy", "Ranger Mission", GAME_FLAGS ) // Mar 01 2004 19:08:15 GAME( 2004, rumblef, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish", GAME_FLAGS) // Mar 10 2004 19:07:43 -GAME( 2004, salmankt, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Yuki Enterprise / Sammy", "Net Select: Salaryman Kintaro", GAME_FLAGS ) // Jun 14 2004 22:50:03 +GAME( 2004, salmankt, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Yuki Enterprise / Sammy", "Net@Select: Salaryman Kintaro", GAME_FLAGS ) // Jun 14 2004 22:50:03 GAME( 2004, kofnw, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave", GAME_FLAGS ) // Jul 09 2004 15:05:53 GAME( 2004, kofnwj, kofnw, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / SNK Playmore", "The King of Fighters Neowave (Japan)", GAME_FLAGS ) // Jul 09 2004 15:05:53 GAME( 2004, ftspeed, awbios, aw1c, aw1w, atomiswave_state, init_atomiswave, ROT0, "Sammy", "Faster Than Speed", GAME_FLAGS ) // Aug 24 2004 18:40:24 @@ -11856,7 +11872,7 @@ GAME( 2005, rumblf2p, rumblef2, aw2c, aw2c, atomiswave_state, init_atomiswave, GAME( 2005, anmlbskta, anmlbskt, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT270, "MOSS / Sammy", "Animal Basket (19 Jan 2005)", GAME_FLAGS ) // Jan 19 2005 13:09:07 GAME( 2005, anmlbskt, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT270, "MOSS / Sammy", "Animal Basket (24 Jan 2005)", GAME_FLAGS ) // Jan 24 2005 14:12:29 GAME( 2005, waidrive, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT270, "MOSS / Sammy", "WaiWai Drive", GAME_FLAGS ) // Jan 27 2005 16:21:21 -GAME( 2005, vfurlong, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Progress / Sammy", "Net Select Horse Racing: Victory Furlong", GAME_FLAGS ) // Mar 02 2005 22:10:33 +GAME( 2005, vfurlong, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Progress / Sammy", "Net@Select: Horse Racing - Victory Furlong", GAME_FLAGS ) // Mar 02 2005 22:10:33 GAME( 2005, rumblef2, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / Dimps", "The Rumble Fish 2", GAME_FLAGS ) // Mar 04 2005 19:26:32 GAME( 2005, ngbc, awbios, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / SNK Playmore", "NeoGeo Battle Coliseum", GAME_FLAGS ) // Jun 25 2005 17:00:38 GAME( 2005, ngbcj, ngbc, aw2c, aw2c, atomiswave_state, init_atomiswave, ROT0, "Sammy / SNK Playmore", "NeoGeo Battle Coliseum (Japan)", GAME_FLAGS ) // Jun 25 2005 17:00:38 diff --git a/src/mame/drivers/nc.cpp b/src/mame/drivers/nc.cpp index 3ac537f8601..f1e0e822cb6 100644 --- a/src/mame/drivers/nc.cpp +++ b/src/mame/drivers/nc.cpp @@ -873,9 +873,10 @@ Small note about natural keyboard support (both for nc100 and nc200): currently, - "Menu" is mapped to 'F4' */ +// 2020-09-21: not possible to select a menu item with natural keyboard. However, you can switch over to it after you enter an app. static INPUT_PORTS_START(nc100) PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT),UCHAR_SHIFT_1) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) PORT_BIT(0x04, 0x00, IPT_UNUSED) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Left (Red)") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) @@ -886,7 +887,7 @@ static INPUT_PORTS_START(nc100) PORT_START("LINE1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Function (Yellow)") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 5th row, 1st key on left (where 'fn' is on mac keyboards) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL),UCHAR_SHIFT_2) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x10, 0x00, IPT_UNUSED) @@ -931,8 +932,8 @@ static INPUT_PORTS_START(nc100) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('c') PORT_CHAR('C') - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_START("LINE6") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') @@ -967,7 +968,7 @@ static INPUT_PORTS_START(nc100) PORT_START("LINE9") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('8') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') diff --git a/src/mame/drivers/ncd68k.cpp b/src/mame/drivers/ncd68k.cpp index ecfeca15ddf..566ebcea5d0 100644 --- a/src/mame/drivers/ncd68k.cpp +++ b/src/mame/drivers/ncd68k.cpp @@ -210,7 +210,7 @@ u32 ncd16_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect { for (unsigned y = 0; y < 1024; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1024 / 8; x++) { u8 const pixels = m_vram->read(BYTE_XOR_BE(y * (1024 / 8) + x)); @@ -227,7 +227,7 @@ u32 ncd17c_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rec { for (unsigned y = 0; y < 768; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1024; x++) { u8 const pixels = m_vram->read((y * 1024) + BYTE4_XOR_BE(x)); @@ -242,7 +242,7 @@ u32 ncd19_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect { for (unsigned y = 0; y < 1024; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1280/8; x++) { u8 const pixels = m_vram->read((y * (2048/8)) + BYTE4_XOR_BE(x)); diff --git a/src/mame/drivers/nes_sh6578.cpp b/src/mame/drivers/nes_sh6578.cpp index caf03628290..53e3b06992f 100644 --- a/src/mame/drivers/nes_sh6578.cpp +++ b/src/mame/drivers/nes_sh6578.cpp @@ -714,16 +714,17 @@ ROM_START( max10in1 ) ROM_LOAD( "csmaxxcasino10.bin", 0x000000, 0x200000, CRC(2a05e9af) SHA1(fcf591c22ce8773f72e9d0fa0bae545f6a82a063) ) ROM_END -CONS( 1997, bandgpad, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Bandai", "Multi Game Player Gamepad", MACHINE_NOT_WORKING ) -CONS( 1997, bandggcn, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Bandai", "Go! Go! Connie-chan! Asobou Mouse", MACHINE_NOT_WORKING ) +ROM_START( vsmaxx15 ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD( "vsmaxx15n1_e28f008sa_89a2.bin", 0x00000, 0x100000, CRC(713955ce) SHA1(f5ff02055fd4574cedc2f056d19388207a7244c0) ) +ROM_END -// possibly newer than 2001 -CONS( 2001, ts_handy11, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Techno Source", "Handy Boy 11-in-1 (TV Play Power)", MACHINE_NOT_WORKING ) +ROM_START( vsmaxx25 ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD( "vsmaxx25_am29lv160dt_000122c4.bin", 0x00000, 0x200000, CRC(0efd1625) SHA1(34e83f748af3eee475c5b2b24ff03c00c1b5b8ed) ) +ROM_END -CONS( 200?, cpatrolm, 0, 0, nes_sh6578_pal, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "TimeTop", "City Patrolman", MACHINE_NOT_WORKING ) -// ROM is banked -CONS( 200?, ablwikid, 0, 0, nes_sh6578_pal, nes_sh6578, nes_sh6578_abl_wikid_state, init_nes_sh6578, "Advance Bright Ltd.", "Wikid Joystick", MACHINE_NOT_WORKING ) // or Wik!d Joystick CONS( 200?, maxx5in1, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Senario", "Vs Maxx 5-in-1 Casino / Senario Card & Casino Games", 0 ) // advertised on box as 'With Solitaire" (was there an even older version without it?) @@ -731,3 +732,25 @@ CONS( 200?, maxx6in1, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_ne CONS( 200?, max10in1, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_max10in1_state, init_nes_sh6578, "Senario", "Vs Maxx 10-in-1 Casino / Senario Card & Casino Games", 0 ) +// titles below have various issues (DMA, split interrupt timing etc.) + + // aka Wik!d Joystick, sometimes also called Air Blaster like the real Air Blaster game. Wik!d seems a rebranding (a 'gift' company) so did ABL reuse the Air Blaster name here instead? +CONS( 200?, ablwikid, 0, 0, nes_sh6578_pal, nes_sh6578, nes_sh6578_abl_wikid_state, init_nes_sh6578, "Advance Bright Ltd.", "Wikid Joystick 14-in-1", MACHINE_NOT_WORKING ) + +CONS( 2001?, ts_handy11, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Techno Source", "Handy Boy 11-in-1 (TV Play Power)", MACHINE_NOT_WORKING ) // possibly newer than 2001 + +// from a blue coloured unit, a yellow one exists, is it the same? +CONS( 2004?, vsmaxx15, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Senario", "Vs Maxx 15-in-1", MACHINE_NOT_WORKING ) + +// This is from the blue coloured unit with the 1p/2p slider (does it do anything / get read anywhere?) +// A version of the 25-in-1 on VT hardware also exists, with the downgraded version of Big Racing & removed copyrights etc. (probably the purple tinted version without the 1p/2p slider) +CONS( 2004?, vsmaxx25, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_max10in1_state, init_nes_sh6578, "Senario", "Vs Maxx 25-in-1", MACHINE_NOT_WORKING ) + +// titles below need inputs mapping to go further + +CONS( 1997, bandgpad, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Bandai", "Multi Game Player Gamepad", MACHINE_NOT_WORKING ) + +CONS( 1997, bandggcn, 0, 0, nes_sh6578, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "Bandai", "Go! Go! Connie-chan! Asobou Mouse", MACHINE_NOT_WORKING ) + +CONS( 200?, cpatrolm, 0, 0, nes_sh6578_pal, nes_sh6578, nes_sh6578_state, init_nes_sh6578, "TimeTop", "City Patrolman", MACHINE_NOT_WORKING ) + diff --git a/src/mame/drivers/nes_vt.cpp b/src/mame/drivers/nes_vt.cpp index 5b529698010..d6fafae4898 100644 --- a/src/mame/drivers/nes_vt.cpp +++ b/src/mame/drivers/nes_vt.cpp @@ -47,17 +47,12 @@ protected: void nes_vt_map(address_map& map); - optional_ioport m_io0; optional_ioport m_io1; + uint8_t m_latch0; uint8_t m_latch1; - - /* Misc */ - uint32_t m_ahigh; // external banking bits - uint8_t m_4242; - uint8_t m_411c; - uint8_t m_411d; + uint8_t m_previous_port0; optional_ioport m_cartsel; optional_ioport m_exin0; @@ -65,6 +60,12 @@ protected: optional_ioport m_exin2; optional_ioport m_exin3; + /* Misc */ + uint32_t m_ahigh; // external banking bits + uint8_t m_4242; + uint8_t m_411c; + uint8_t m_411d; + required_region_ptr<uint8_t> m_prgrom; uint8_t vt_rom_r(offs_t offset); @@ -84,7 +85,6 @@ private: uint8_t extrain_1_r(); uint8_t extrain_2_r(); uint8_t extrain_3_r(); - }; class nes_vt_state : public nes_vt_base_state @@ -105,6 +105,7 @@ public: void nes_vt_1mb_baddma(machine_config& config); void nes_vt_2mb_baddma(machine_config& config); void nes_vt_4mb_baddma(machine_config& config); + void nes_vt_4mb_baddma_rasterhack(machine_config& config); void nes_vt_4mb(machine_config& config); void nes_vt_8mb(machine_config& config); void nes_vt_16mb(machine_config& config); @@ -123,12 +124,13 @@ public: void vt_external_space_map_1mbyte(address_map& map); void vt_external_space_map_512kbyte(address_map& map); + void nes_vt_1mb_majkon(machine_config& config); + void vt_external_space_map_1mbyte_majkon(address_map& map); + void init_protpp(); protected: required_device<nes_vt_soc_device> m_soc; - - void vt03_8000_mapper_w(offs_t offset, uint8_t data) { m_soc->vt03_8000_mapper_w(offset, data); } }; @@ -141,6 +143,7 @@ public: void nes_vt_vh2009(machine_config& config); void nes_vt_vh2009_1mb(machine_config& config); + void nes_vt_vh2009_2mb(machine_config& config); void nes_vt_vh2009_4mb(machine_config& config); void nes_vt_vh2009_8mb(machine_config& config); @@ -168,6 +171,7 @@ public: { } void nes_vt_waixing_512kb(machine_config& config); + void nes_vt_waixing_512kb_rasterhack(machine_config& config); void nes_vt_waixing_2mb(machine_config& config); }; @@ -182,14 +186,14 @@ public: void nes_vt_waixing_alt_pal_8mb(machine_config& config); }; -class nes_vt_waixing_alt_duetpp_state : public nes_vt_waixing_alt_state +class nes_vt_waixing_alt_sporzpp_state : public nes_vt_waixing_alt_state { public: - nes_vt_waixing_alt_duetpp_state(const machine_config& mconfig, device_type type, const char* tag) : + nes_vt_waixing_alt_sporzpp_state(const machine_config& mconfig, device_type type, const char* tag) : nes_vt_waixing_alt_state(mconfig, type, tag) { } - void nes_vt_waixing_alt_4mb_duetpp(machine_config& config); + void nes_vt_waixing_alt_4mb_sporzpp(machine_config& config); private: uint8_t in1_r() override @@ -200,6 +204,21 @@ private: } }; +class nes_vt_wldsoctv_state : public nes_vt_state +{ +public: + nes_vt_wldsoctv_state(const machine_config& mconfig, device_type type, const char* tag) : + nes_vt_state(mconfig, type, tag) + { } + +private: + uint8_t in1_r() override + { + uint8_t i = machine().rand() & 0x18; + uint8_t ret = m_io1->read() & ~0x18; + return i | ret; + } +}; class nes_vt_timetp36_state : public nes_vt_state { @@ -275,7 +294,6 @@ class nes_vt_cy_lexibook_state : public nes_vt_cy_state public: nes_vt_cy_lexibook_state(const machine_config& mconfig, device_type type, const char* tag) : nes_vt_cy_state(mconfig, type, tag), - m_previous_port0(0), m_latch0_bit(0), m_latch1_bit(0) { } @@ -288,7 +306,6 @@ protected: virtual void in0_w(uint8_t data) override; private: - int m_previous_port0; uint8_t m_latch0_bit; uint8_t m_latch1_bit; }; @@ -349,12 +366,12 @@ public: void nes_vt_hh_8mb(machine_config& config); void nes_vt_vg(machine_config& config); + void nes_vt_vg_2mb(machine_config& config); void nes_vt_vg_4mb(machine_config& config); + void nes_vt_vg_4mb_rasterhack(machine_config& config); void nes_vt_vg_8mb(machine_config& config); void nes_vt_vg_16mb(machine_config& config); - - void nes_vt_vg_1mb_majkon(machine_config& config); void nes_vt_fp(machine_config& config); void nes_vt_fp_16mb(machine_config& config); void nes_vt_fp_32mb(machine_config& config); @@ -383,7 +400,7 @@ public: m_plunger(*this, "PLUNGER") { } - void nes_vt_waixing_alt_4mb_duetpp(machine_config& config); + void nes_vt_waixing_alt_4mb_sporzpp(machine_config& config); protected: virtual void machine_start() override; @@ -425,45 +442,51 @@ void nes_vt_base_state::vtspace_w(offs_t offset, uint8_t data) // VTxx can address 25-bit address space (32MB of ROM) so use maps with mirroring in depending on ROM size void nes_vt_state::vt_external_space_map_32mbyte(address_map &map) { - map(0x0000000, 0x1ffffff).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x1ffffff).r(FUNC(nes_vt_state::vt_rom_r)); } void nes_vt_state::vt_external_space_map_16mbyte(address_map &map) { - map(0x0000000, 0x0ffffff).mirror(0x1000000).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(nes_vt_state::vt_rom_r)); } void nes_vt_state::vt_external_space_map_8mbyte(address_map &map) { - map(0x0000000, 0x07fffff).mirror(0x1800000).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x07fffff).mirror(0x1800000).r(FUNC(nes_vt_state::vt_rom_r)); } void nes_vt_state::vt_external_space_map_4mbyte(address_map &map) { - map(0x0000000, 0x03fffff).mirror(0x1c00000).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x03fffff).mirror(0x1c00000).r(FUNC(nes_vt_state::vt_rom_r)); } void nes_vt_state::vt_external_space_map_2mbyte(address_map &map) { - map(0x0000000, 0x01fffff).mirror(0x1e00000).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x01fffff).mirror(0x1e00000).r(FUNC(nes_vt_state::vt_rom_r)); } void nes_vt_state::vt_external_space_map_1mbyte(address_map &map) { - map(0x0000000, 0x00fffff).mirror(0x1f00000).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x00fffff).mirror(0x1f00000).r(FUNC(nes_vt_state::vt_rom_r)); } void nes_vt_state::vt_external_space_map_512kbyte(address_map &map) { - map(0x0000000, 0x007ffff).mirror(0x1f80000).rw(FUNC(nes_vt_state::vt_rom_r), FUNC(nes_vt_state::vt03_8000_mapper_w)); + map(0x0000000, 0x007ffff).mirror(0x1f80000).r(FUNC(nes_vt_state::vt_rom_r)); } // Win Lose Draw has RAM as well as ROM void nes_vt_swap_op_d5_d6_state::vt_external_space_map_senwld_512kbyte(address_map &map) { - map(0x0000000, 0x007ffff).rw(FUNC(nes_vt_swap_op_d5_d6_state::vt_rom_r), FUNC(nes_vt_swap_op_d5_d6_state::vtspace_w)); + map(0x0000000, 0x007ffff).r(FUNC(nes_vt_swap_op_d5_d6_state::vt_rom_r)); map(0x0100000, 0x010ffff).ram(); - map(0x0180000, 0x01fffff).rw(FUNC(nes_vt_swap_op_d5_d6_state::vt_rom_r), FUNC(nes_vt_swap_op_d5_d6_state::vtspace_w)); + map(0x0180000, 0x01fffff).r(FUNC(nes_vt_swap_op_d5_d6_state::vt_rom_r)); +} + +void nes_vt_state::vt_external_space_map_1mbyte_majkon(address_map &map) +{ + map(0x0000000, 0x00fffff).mirror(0x1f00000).r(FUNC(nes_vt_state::vt_rom_r)); + map(0x1400000, 0x1401fff).ram(); // rush'n attack writes to chr space, after setting the program and character outer bank to a mirror, is the correct way to handle it? } // bitboy is 2 16Mbyte banks @@ -474,7 +497,7 @@ uint8_t nes_vt_cy_state::vt_rom_banked_r(offs_t offset) void nes_vt_cy_state::vt_external_space_map_bitboy_2x16mbyte(address_map &map) { - map(0x0000000, 0x0ffffff).mirror(0x1000000).rw(FUNC(nes_vt_cy_state::vt_rom_banked_r), FUNC(nes_vt_cy_state::vt03_8000_mapper_w)); + map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(nes_vt_cy_state::vt_rom_banked_r)); } // fapocket is 4 16Mbyte banks @@ -485,7 +508,7 @@ uint8_t nes_vt_dg_state::vt_rom_banked_r(offs_t offset) void nes_vt_dg_state::vt_external_space_map_fapocket_4x16mbyte(address_map &map) { - map(0x0000000, 0x0ffffff).mirror(0x1000000).rw(FUNC(nes_vt_dg_state::vt_rom_banked_r), FUNC(nes_vt_dg_state::vt03_8000_mapper_w)); + map(0x0000000, 0x0ffffff).mirror(0x1000000).r(FUNC(nes_vt_dg_state::vt_rom_banked_r)); } uint8_t nes_vt_hh_state::vt_rom_banked_r(offs_t offset) @@ -495,7 +518,7 @@ uint8_t nes_vt_hh_state::vt_rom_banked_r(offs_t offset) void nes_vt_hh_state::vt_external_space_map_fp_2x32mbyte(address_map &map) { - map(0x0000000, 0x1ffffff).rw(FUNC(nes_vt_hh_state::vt_rom_banked_r), FUNC(nes_vt_hh_state::vt03_8000_mapper_w)); + map(0x0000000, 0x1ffffff).r(FUNC(nes_vt_hh_state::vt_rom_banked_r)); } uint8_t nes_vt_base_state::extrain_0_r() @@ -565,11 +588,18 @@ uint8_t nes_vt_base_state::in1_r() void nes_vt_base_state::in0_w(uint8_t data) { //logerror("%s: in0_w %02x\n", machine().describe_context(), data); - if (data & 0x01) - return; - m_latch0 = m_io0->read(); - m_latch1 = m_io1->read(); + // need to check this or some games (eg cybar120 Aero Engine) won't have working inputs as they repeatedly write a pattern of 02 / 00 here between fetches which resets the latch + if ((data & 0x01) != (m_previous_port0 & 0x01)) + { + if (data & 0x01) + { + m_latch0 = m_io0->read(); + m_latch1 = m_io1->read(); + } + } + + m_previous_port0 = data; } /* Lexibook I/O handlers */ @@ -626,6 +656,23 @@ void nes_vt_ablping_state::ablping_extraio_w(uint8_t data) void nes_vt_base_state::machine_start() { + m_latch0 = 0; + m_latch1 = 0; + m_previous_port0 = 0; + + m_ahigh = 0; + m_4242 = 0; + m_411c = 0; + m_411d = 0; + + save_item(NAME(m_latch0)); + save_item(NAME(m_latch1)); + save_item(NAME(m_previous_port0)); + + save_item(NAME(m_ahigh)); + save_item(NAME(m_4242)); + save_item(NAME(m_411c)); + save_item(NAME(m_411d)); } void nes_vt_base_state::machine_reset() @@ -716,34 +763,6 @@ void nes_vt_ablpinb_state::in0_w(uint8_t data) } -/* not strictly needed, but helps us see where things are in ROM to aid with figuring out banking schemes*/ -static const gfx_layout helper_layout = -{ - 8,8, - RGN_FRAC(1,1), - 4, - { 0*64, 1*64, 2*64, 3*64 }, - { 0,1,2,3,4,5,6,7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 4*64 -}; - -static const gfx_layout helper2_layout = -{ - 8,8, - RGN_FRAC(1,1), - 4, - { 0*8, 1*8, 2*8, 3*8 }, - { 0,1,2,3,4,5,6,7 }, - { 0*16, 1*16, 2*16, 3*16,4*16,5*16,5*16,6*16,7*16 }, - 4*64 -}; - -static GFXDECODE_START( vt03_gfx_helper ) - GFXDECODE_ENTRY( "mainrom", 0, helper_layout, 0x0, 2 ) - GFXDECODE_ENTRY( "mainrom", 0, helper2_layout, 0x0, 2 ) -GFXDECODE_END - void nes_vt_base_state::configure_soc(nes_vt_soc_device* soc) { soc->set_addrmap(AS_PROGRAM, &nes_vt_state::vt_external_space_map_32mbyte); @@ -761,7 +780,6 @@ void nes_vt_vg_1mb_majgnc_state::nes_vt_vg_1mb_majgnc(machine_config &config) { NES_VT_SOC(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); - m_soc->set_default_palette_mode(PAL_MODE_NEW_VG); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_vg_1mb_majgnc_state::vt_external_space_map_1mbyte); } @@ -802,6 +820,13 @@ void nes_vt_state::nes_vt_4mb_baddma(machine_config& config) { nes_vt_4mb(config); m_soc->force_bad_dma(); + +} + +void nes_vt_state::nes_vt_4mb_baddma_rasterhack(machine_config& config) +{ + nes_vt_2mb_baddma(config); + m_soc->force_raster_timing_hack(); } @@ -862,6 +887,13 @@ void nes_vt_waixing_state::nes_vt_waixing_512kb(machine_config &config) m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); } +void nes_vt_waixing_state::nes_vt_waixing_512kb_rasterhack(machine_config &config) +{ + nes_vt_waixing_512kb(config); + m_soc->force_raster_timing_hack(); +} + + void nes_vt_waixing_state::nes_vt_waixing_2mb(machine_config &config) { NES_VT_SOC(config, m_soc, NTSC_APU_CLOCK); @@ -888,7 +920,7 @@ void nes_vt_waixing_alt_state::nes_vt_waixing_alt_pal_8mb(machine_config &config m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); } -void nes_vt_waixing_alt_duetpp_state::nes_vt_waixing_alt_4mb_duetpp(machine_config& config) +void nes_vt_waixing_alt_sporzpp_state::nes_vt_waixing_alt_4mb_sporzpp(machine_config& config) { NES_VT_SOC(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); @@ -896,8 +928,6 @@ void nes_vt_waixing_alt_duetpp_state::nes_vt_waixing_alt_4mb_duetpp(machine_conf m_soc->set_addrmap(AS_PROGRAM, &nes_vt_ablping_state::vt_external_space_map_4mbyte); m_soc->set_201x_descramble(0x3, 0x2, 0x7, 0x6, 0x5, 0x4); m_soc->set_8000_scramble(0x5, 0x4, 0x3, 0x2, 0x7, 0x6, 0x7, 0x8); - - GFXDECODE(config, "gfxdecode", "soc:ppu", vt03_gfx_helper); } @@ -908,7 +938,6 @@ void nes_vt_hum_state::nes_vt_hummer_2mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_2mbyte); m_soc->set_201x_descramble(0x7, 0x6, 0x5, 0x4, 0x2, 0x3); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); - GFXDECODE(config, "gfxdecode", "soc:ppu", vt03_gfx_helper); } void nes_vt_hum_state::nes_vt_hummer_4mb(machine_config& config) @@ -925,7 +954,6 @@ void nes_vt_pjoy_state::nes_vt_pjoy_4mb(machine_config &config) m_soc->set_201x_descramble(0x2, 0x3, 0x4, 0x5, 0x6, 0x7); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x8, 0x7); m_soc->set_410x_scramble(0x8, 0x7); - GFXDECODE(config, "gfxdecode", "soc:ppu", vt03_gfx_helper); } @@ -936,7 +964,6 @@ void nes_vt_sp69_state::nes_vt_4mb_sp69(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_sp69_state::vt_external_space_map_4mbyte); m_soc->set_201x_descramble(0x4, 0x7, 0x2, 0x6, 0x5, 0x3); m_soc->set_8000_scramble(0x6, 0x7, 0x2, 0x3, 0x4, 0x5, 0x7, 0x8); - GFXDECODE(config, "gfxdecode", "soc:ppu", vt03_gfx_helper); } void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) @@ -952,8 +979,6 @@ void nes_vt_ablping_state::nes_vt_2mb_ablping(machine_config &config) m_soc->extra_read_3_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_r)); m_soc->extra_write_2_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_w)); m_soc->extra_write_3_callback().set(FUNC(nes_vt_ablping_state::ablping_extraio_w)); - - GFXDECODE(config, "gfxdecode", "soc:ppu", vt03_gfx_helper); } uint8_t nes_vt_base_state::upper_412c_r() @@ -980,8 +1005,6 @@ void nes_vt_state::nes_vt_4k_ram(machine_config &config) NES_VT_SOC_4KRAM(config, m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); - GFXDECODE(config, "gfxdecode", "soc:ppu", vt03_gfx_helper); - dynamic_cast<nes_vt_soc_4kram_device&>(*m_soc).upper_read_412c_callback().set(FUNC(nes_vt_state::upper_412c_r)); dynamic_cast<nes_vt_soc_4kram_device&>(*m_soc).upper_read_412d_callback().set(FUNC(nes_vt_state::upper_412d_r)); dynamic_cast<nes_vt_soc_4kram_device&>(*m_soc).upper_write_412c_callback().set(FUNC(nes_vt_state::upper_412c_w)); @@ -1074,7 +1097,6 @@ void nes_vt_hh_state::nes_vt_vg(machine_config &config) NES_VT_SOC_8KRAM_DG(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); - m_soc->set_default_palette_mode(PAL_MODE_NEW_VG); m_soc->force_bad_dma(); } @@ -1084,24 +1106,29 @@ void nes_vt_hh_state::nes_vt_vg_8mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_8mbyte); } -void nes_vt_hh_state::nes_vt_vg_4mb(machine_config& config) +void nes_vt_hh_state::nes_vt_vg_2mb(machine_config& config) { nes_vt_vg(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_4mbyte); + m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_2mbyte); } -void nes_vt_hh_state::nes_vt_vg_16mb(machine_config& config) +void nes_vt_hh_state::nes_vt_vg_4mb(machine_config& config) { nes_vt_vg(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_16mbyte); + m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_4mbyte); } -void nes_vt_hh_state::nes_vt_vg_1mb_majkon(machine_config &config) +void nes_vt_hh_state::nes_vt_vg_4mb_rasterhack(machine_config& config) { - nes_vt_dg(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_1mbyte); + nes_vt_vg_4mb(config); + m_soc->force_raster_timing_hack(); +} - m_soc->set_default_palette_mode(PAL_MODE_NEW_VG); + +void nes_vt_hh_state::nes_vt_vg_16mb(machine_config& config) +{ + nes_vt_vg(config); + m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_16mbyte); } @@ -1139,6 +1166,16 @@ void nes_vt_hh_state::nes_vt_hh_4mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_4mbyte); } + +void nes_vt_state::nes_vt_1mb_majkon(machine_config& config) +{ + NES_VT_SOC(config, m_soc, NTSC_APU_CLOCK); + configure_soc(m_soc); + m_soc->set_addrmap(AS_PROGRAM, &nes_vt_state::vt_external_space_map_1mbyte_majkon); + m_soc->force_raster_timing_hack(); +} + + static INPUT_PORTS_START( nes_vt ) PORT_START("IO0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("A") @@ -1349,8 +1386,6 @@ void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009(machine_config &config) NES_VT_SOC_SCRAMBLE(config.replace(), m_soc, NTSC_APU_CLOCK); configure_soc(m_soc); - - //m_soc->set_default_palette_mode(PAL_MODE_NEW_VG); // gives better title screens, but worse ingame, must be able to switch } void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_1mb(machine_config& config) @@ -1359,6 +1394,11 @@ void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_1mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_1mbyte); } +void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_2mb(machine_config& config) +{ + nes_vt_vh2009(config); + m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_2mbyte); +} void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_4mb(machine_config& config) { nes_vt_vh2009(config); @@ -1376,7 +1416,6 @@ void nes_vt_swap_op_d5_d6_state::nes_vt_senwld_512kb(machine_config &config) { nes_vt_vh2009(config); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_senwld_512kbyte); - m_soc->set_default_palette_mode(PAL_MODE_NEW_VG); } static INPUT_PORTS_START( nes_vt_fp ) @@ -1421,7 +1460,7 @@ static INPUT_PORTS_START( ablpinb ) INPUT_PORTS_END -static INPUT_PORTS_START( duetpp ) +static INPUT_PORTS_START( sporzpp ) PORT_START("IO0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) @@ -1720,6 +1759,11 @@ ROM_START( cybar120 ) ROM_LOAD( "m2500p-vt09-epson,20091222ver05,_30r-sx1067-01_pcb,_12r0cob128m_12001-3d05_fw.bin", 0x00000, 0x1000000, CRC(f7138980) SHA1(de31264ee3a5a5c77a86733b2e2d6845fee91ea5) ) ROM_END +ROM_START( sen101 ) + ROM_REGION( 0x400000, "mainrom", 0 ) + ROM_LOAD( "101n1.bin", 0x00000, 0x400000, CRC(b03e1824) SHA1(c9ac4e16220414c1aa679133191140ced9986e9c) ) +ROM_END + ROM_START( mc_dg101 ) ROM_REGION( 0x400000, "mainrom", 0 ) @@ -1741,6 +1785,36 @@ ROM_START( mc_sp69 ) ROM_LOAD( "sports game 69-in-1.prg", 0x00000, 0x400000, CRC(1242da7f) SHA1(bb8f99b1f4a4783b3f7e54d74f1f2a6a628da154) ) ROM_END +ROM_START( vsmaxtx2 ) + ROM_REGION( 0x400000, "mainrom", 0 ) + ROM_LOAD( "tx2.bin", 0x00000, 0x400000, CRC(eddf0ca8) SHA1(b87c5c3e945d1efdcb953325425d4ddb0fded00a) ) +ROM_END + +ROM_START( vsmaxx17 ) + ROM_REGION( 0x200000, "mainrom", 0 ) + ROM_LOAD( "vsmaxx17.bin", 0x00000, 0x200000, CRC(f3fccbb9) SHA1(8b70b10d28f03e72f6b35199001955033a65fd5d) ) // M6MG3D641RB +ROM_END + +ROM_START( vsmaxx77 ) + ROM_REGION( 0x800000, "mainrom", 0 ) + ROM_LOAD( "vsmaxx77.bin", 0x00000, 0x800000, CRC(03f1f4b5) SHA1(13f7ecea3765cffcd3065de713abdabd24946b99) ) +ROM_END + +ROM_START( vsmaxxvd ) + ROM_REGION( 0x800000, "mainrom", 0 ) + ROM_LOAD( "vsmaxxvideo.bin", 0x00000, 0x800000, CRC(af365a77) SHA1(8119fcef3e1a2ade93d36740d5df451919f0e541) ) +ROM_END + +ROM_START( dturbogt ) + ROM_REGION( 0x800000, "mainrom", 0 ) + ROM_LOAD( "dgturbogt.bin", 0x00000, 0x800000, CRC(9532fb78) SHA1(cd188672f9b8e9c12069612ad0d0b70d3dd6c1b1) ) +ROM_END + +ROM_START( rcapnp ) + ROM_REGION( 0x200000, "mainrom", 0 ) + ROM_LOAD( "rcapnp_mx29lv160ab_00c22249.bin", 0x00000, 0x200000, CRC(8cc30a47) SHA1(815bfc26360b01ed3fa077016222939d2184408c) ) +ROM_END + ROM_START( polmega ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "megamax.bin", 0x00000, 0x400000, CRC(ef3aade3) SHA1(0c130080ace000cbe43e70a805d4301e05840294) ) @@ -1751,7 +1825,12 @@ ROM_START( silv35 ) ROM_LOAD( "silverlit35.bin", 0x00000, 0x400000, CRC(7540e350) SHA1(a0cb456136560fa4d8a365dd44d815ec0e9fc2e7) ) ROM_END -ROM_START( duetpp ) +ROM_START( ventur25 ) + ROM_REGION( 0x400000, "mainrom", 0 ) + ROM_LOAD( "25games_m5m29gt320vp_001c0020.bin", 0x00000, 0x400000, CRC(3f78a45a) SHA1(3e97333c13e09c580e66518dd2e1e031371d399c) ) +ROM_END + +ROM_START( sporzpp ) ROM_REGION( 0x400000, "mainrom", 0 ) ROM_LOAD( "gamesporzduetpingpong.bin", 0x00000, 0x400000, CRC(96af199b) SHA1(c14ff15683545c1edf03376cebcee7ac408da733) ) ROM_END @@ -1761,6 +1840,21 @@ ROM_START( sporzbx ) ROM_LOAD( "sporzboxing.bin", 0x00000, 0x400000, CRC(8b832c0b) SHA1(8193955a81e894a01308a80d5153f2ecfe134da6) ) ROM_END +ROM_START( sporztn ) + ROM_REGION( 0x400000, "mainrom", 0 ) + ROM_LOAD( "wirelesstennis.bin", 0x00000, 0x400000, CRC(e60f5ee1) SHA1(838ba7f4e9dcd0101eaaef5be883206d8856f45c) ) +ROM_END + +ROM_START( wldsoctv ) + ROM_REGION( 0x400000, "mainrom", 0 ) + ROM_LOAD( "worldsoccer.bin", 0x00000, 0x400000, CRC(8c0b184b) SHA1(fe1e7e83b9a2ae50dca1e7ea3bf7d691b8407511) ) +ROM_END + +ROM_START( solargm ) + ROM_REGION( 0x800000, "mainrom", 0 ) + ROM_LOAD( "solargames.bin", 0x00000, 0x800000, CRC(b49f0985) SHA1(68231614b333911c25168c533f1ae9bc79c36c38) ) +ROM_END + ROM_START( lpgm240 ) ROM_REGION( 0x800000, "mainrom", 0 ) ROM_LOAD( "w25q64jv.u1", 0x00000, 0x800000, CRC(b973e65b) SHA1(36ff137068ea56b4679c2db386ac0067de0a9eaf) ) @@ -2136,7 +2230,7 @@ CONS( 2016, msisinv, 0, 0, nes_vt_1mb_baddma, nes_vt_msi, nes_vt_state, emp // This is from the version with the same case type as the above MSI units. // MSI also issued a version in the original Majesco shell but with the updated case logos and boot logos in the software, the software on that revision might match this one. -CONS( 2016, msifrog, 0, 0, nes_vt_4mb_baddma, nes_vt_msi, nes_vt_state, empty_init, "MSI / Konami", "Frogger (MSI Plug & Play, white joystick)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // raster timing issues, mode change issues +CONS( 2016, msifrog, 0, 0, nes_vt_4mb_baddma_rasterhack, nes_vt_msi, nes_vt_state, empty_init, "MSI / Konami", "Frogger (MSI Plug & Play, white joystick)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // raster timing for need a hack // MSI Midway (Joust+Gauntlet 2 + Defender 2) has 2x Globs, rather than Glob + Flash ROM @@ -2145,9 +2239,13 @@ CONS( 2016, msifrog, 0, 0, nes_vt_4mb_baddma, nes_vt_msi, nes_vt_state, emp CONS( 2005, ablpinb, 0, 0, nes_vt_pal_2mb, ablpinb, nes_vt_ablpinb_state, empty_init, "Advance Bright Ltd", "Pinball (P8002, ABL TV Game)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // need to map 2 player controls for Ping Pong, 'Eat-Bean' (the PacMan hack) gets stuck during intermission? (same happens on hardware?) -CONS( 2004, duetpp, 0, 0, nes_vt_waixing_alt_4mb_duetpp, duetpp, nes_vt_waixing_alt_duetpp_state, empty_init, "Macro Winners", "Game Sporz Wireless Duet Play Ping-Pong", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) - -CONS( 2004, sporzbx, 0, 0, nes_vt_waixing_alt_4mb_duetpp, duetpp, nes_vt_waixing_alt_duetpp_state, empty_init, "Macro Winners", "Game Sporz Wireless Boxing", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 2004, sporzpp, 0, 0, nes_vt_waixing_alt_4mb_sporzpp, sporzpp, nes_vt_waixing_alt_sporzpp_state, empty_init, "Macro Winners", "Game Sporz Wireless Duet Play Ping-Pong", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// has some longer than expected delays when sounds should play on the Boxing part, but NES hacks are all functional +CONS( 2004, sporzbx, 0, 0, nes_vt_waixing_alt_4mb_sporzpp, sporzpp, nes_vt_waixing_alt_sporzpp_state, empty_init, "Macro Winners", "Game Sporz Wireless Boxing", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// has some longer than expected delays when sounds should play on the Tennis part, but NES hacks are all functional, US version is sold in DreamGear branded box. +CONS( 2004, sporztn, 0, 0, nes_vt_pal_4mb, sporzpp, nes_vt_wldsoctv_state, empty_init, "Macro Winners (Play Vision license)", "Wireless Tennis (PAL, Play Vision)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// missing PCM audio, but regular APU SFX work +CONS( 200?, wldsoctv, 0, 0, nes_vt_pal_4mb, nes_vt, nes_vt_wldsoctv_state, empty_init, "Taikee", "World Soccer TV Game 10-in-1 (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // should be VT03 based // for testing 'Shark', 'Octopus', 'Harbor', and 'Earth Fighter' use the extended colour modes, other games just seem to use standard NES modes @@ -2156,112 +2254,62 @@ CONS( 200?, mc_dgear, 0, 0, nes_vt_4mb, nes_vt, nes_vt_state, empty_init, // all software in this runs in the VT03 enhanced mode, it also includes an actual licensed VT03 port of Frogger. // all games work OK except Frogger which has serious graphical issues -CONS( 2006, vgtablet, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products (licensed by Konami)", "VG Pocket Tablet (VG-4000)", MACHINE_NOT_WORKING ) // raster timing is broken for Frogger +CONS( 2006, vgtablet, 0, 0, nes_vt_vg_4mb_rasterhack, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products (licensed by Konami) / JungleTac", "VG Pocket Tablet (VG-4000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // raster timing for Frogger needs a hack // There is a 2004 Majesco Frogger "TV game" that appears to contain the same version of Frogger as above but with no other games, so probably fits here. -CONS( 2004, majkon, 0, 0, nes_vt_vg_1mb_majkon, nes_vt, nes_vt_hh_state, empty_init, "Majesco (licensed from Konami)", "Konami Collector's Series Arcade Advanced", MACHINE_NOT_WORKING ) // raster timing is broken for Frogger, palette issues +CONS( 2004, majkon, 0, 0, nes_vt_1mb_majkon, nes_vt, nes_vt_state, empty_init, "Majesco (licensed from Konami) / JungleTac", "Konami Collector's Series Arcade Advanced", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // raster timing for Frogger needs a hack, Rush'n Attack also has raster timing issues on the status bar split -CONS( 200?, majgnc, 0, 0, nes_vt_vg_1mb_majgnc, majgnc, nes_vt_vg_1mb_majgnc_state, empty_init, "Majesco", "Golden Nugget Casino", MACHINE_NOT_WORKING ) +CONS( 200?, majgnc, 0, 0, nes_vt_vg_1mb_majgnc, majgnc, nes_vt_vg_1mb_majgnc_state, empty_init, "Majesco / JungleTac", "Golden Nugget Casino", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // small black unit, dpad on left, 4 buttons (A,B,X,Y) on right, Start/Reset/Select in middle, unit text "Sudoku Plug & Play TV Game" -CONS( 200?, sudopptv, 0, 0, nes_vt_waixing_512kb, nes_vt, nes_vt_waixing_state, empty_init, "Smart Planet", "Sudoku Plug & Play TV Game '6 Intelligent Games'", MACHINE_NOT_WORKING ) +CONS( 200?, sudopptv, 0, 0, nes_vt_waixing_512kb_rasterhack, nes_vt, nes_vt_waixing_state, empty_init, "Smart Planet", "Sudoku Plug & Play TV Game '6 Intelligent Games'", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) CONS( 200?, megapad, 0, 0, nes_vt_waixing_2mb, nes_vt, nes_vt_waixing_state, empty_init, "Waixing", "Megapad 31-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // Happy Biqi has broken sprites, investigate before promoting // 060303 date code on PCB CONS( 2006, ablmini, 0, 0, nes_vt_waixing_alt_pal_8mb, nes_vt, nes_vt_waixing_alt_state, empty_init, "Advance Bright Ltd", "Double Players Mini Joystick 80-in-1 (MJ8500, ABL TV Game)", MACHINE_IMPERFECT_GRAPHICS ) +CONS( 200?, solargm, 0, 0, nes_vt_waixing_alt_pal_8mb, nes_vt, nes_vt_waixing_alt_state, empty_init, "<unknown>", "Solar Games 80-in-1 (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // Solar Games logo is also found in the SunPlus based Millennium Arcade units + // silver 'N64' type controller design -CONS( 200?, zudugo, 0, 0, nes_vt_waixing_alt_4mb, nes_vt, nes_vt_waixing_alt_state, empty_init, "Macro Winners / Waixing", "Zudu-go / 2udu-go", MACHINE_IMPERFECT_GRAPHICS ) // the styling on the box looks like a '2' in places, a 'Z' in others. +CONS( 200?, zudugo, 0, 0, nes_vt_waixing_alt_4mb, nes_vt, nes_vt_waixing_alt_state, empty_init, "Macro Winners / Waixing", "Zudu-go / 2udu-go", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // the styling on the box looks like a '2' in places, a 'Z' in others. // needs PCM samples, Y button is not mapped (not used by any of the games? some sources indicate it's just a hardware autofire button) CONS( 200?, timetp36, 0, 0, nes_vt_pal_4mb, timetp36, nes_vt_timetp36_state, empty_init, "TimeTop", "Super Game 36-in-1 (TimeTop SuperGame) (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) CONS( 200?, timetp7, 0, 0, nes_vt_pal_2mb, timetp36, nes_vt_timetp36_state, empty_init, "TimeTop", "Super Game 7-in-1 (TimeTop SuperGame) (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -// this is VT09 based -// it boots, most games correct, but palette issues in some games still (usually they appear greyscale) -// and colors overall a bit off -CONS( 2009, cybar120, 0, 0, nes_vt_vg_16mb, nes_vt, nes_vt_hh_state, empty_init, "Defender", "Defender M2500P 120-in-1", MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 2005, vgpocket, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket (VG-2000)", MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 200?, vgpmini, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket Mini (VG-1500)", MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS ) -// VG Pocket Max (VG-2500) (blue case, 75 games) -// VG Pocket Max (VG-3000) (white case, 75 games) (does the game selection differ, or only the case?) -// VG Pocket Caplet is SunPlus hardware instead, see spg2xx_lexibook.cpp - // Runs fine, non-sport 121 in 1 games perfect, but minor graphical issues in // sport games, also no sound in menu or sport games due to missing PCM // emulation CONS( 200?, dgun2500, 0, 0, nes_vt_dg_baddma_16mb, nes_vt, nes_vt_dg_state, empty_init, "dreamGEAR", "dreamGEAR Wireless Motion Control with 130 games (DGUN-2500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) -// don't even get to menu. very enhanced chipset, VT368/9? -CONS( 2012, dgun2561, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "dreamGEAR", "My Arcade Portable Gaming System with 140 Games (DGUN-2561)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 2016, dgun2593, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "dreamGEAR", "My Arcade Retro Arcade Machine - 300 Handheld Video Games (DGUN-2593)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme - -CONS( 200?, lxcmcy, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxcmc250, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - 250-in-1 (JL2375)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcysw, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Star Wars Rebels", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcyfz, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Frozen", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcydp, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Disney Princess", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcysp, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Marvel Ultimate Spider-Man", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxcmcycr, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Cars", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -// the data order is swapped for this one, maybe other internal differences? -CONS( 200?, lxcmcypp, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, init_lxcmcypp, "Lexibook", "Lexibook Compact Cyber Arcade - Paw Patrol", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme - - -CONS( 200?, lxccminn, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Console Colour - Minnie Mouse", MACHINE_NOT_WORKING ) // 64Mbyte (used) ROM, must be externally banked, or different addressing scheme -CONS( 200?, lxccplan, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Console Colour - Disney's Planes", MACHINE_NOT_WORKING ) // 64Mbyte (used) ROM, must be externally banked, or different addressing scheme - - -// GB-NO13-Main-VT389-2 on PCBs -CONS( 2016, rtvgc300, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Retro TV Game Console - 300 Games", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme -CONS( 2017, rtvgc300fz,0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Retro TV Game Console - Frozen - 300 Games", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme - - -/* The following are also confirmed to be NES/VT derived units, most having a standard set of games with a handful of lazy graphic mods thrown in to fit the unit theme - - (handhekd units, use standard AAA batteries) - Lexibook Compact Cyber Arcade - Cars - Lexibook Compact Cyber Arcade - Barbie - Lexibook Compact Cyber Arcade - Finding Dory - Lexibook Compact Cyber Arcade - PJ Masks - - (Handheld units, but different form factor to Compact Cyber Arcade, charged via USB) - Lexibook Console Colour - Barbie - - (units for use with TV) - Lexibook Retro TV Game Console (300 Games) - Cars - Lexibook Retro TV Game Console (300 Games) - PJ Masks - - (more?) - - There are also updated 'Compact Cyber Arcade' branded units with a large + D-pad and internal battery / USB charger for - Spiderman - Frozen - (generic) - it isn't verified if these use the same ROMs as the original Compact Cyber Arcade releases, or if the software has been updated - -*/ - -// intial code isn't valid? scrambled? -CONS( 201?, red5mam, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Red5", "Mini Arcade Machine (Red5)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme - - - -CONS( 201?, denv150, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Denver", "Denver Game Console GMP-240C 150-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) - +// this is VT09 based +CONS( 2009, cybar120, 0, 0, nes_vt_vg_16mb,nes_vt, nes_vt_hh_state, empty_init, "Defender / JungleTac", "Defender M2500P 120-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 200?, vsmaxtx2, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Senario / JungleTac", "Vs Maxx TX-2 50-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 200?, rcapnp, 0, 0, nes_vt_vg_2mb, nes_vt, nes_vt_hh_state, empty_init, "RCA / JungleTac", "RCA NS-500 30-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // from a Green unit, '17 Classic & Racing Game' +CONS( 200?, dturbogt, 0, 0, nes_vt_vg_8mb, nes_vt, nes_vt_hh_state, empty_init, "dreamGEAR / JungleTac", "Turbo GT 50-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 200?, ventur25, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "<unknown> / JungleTac", "Venturer '25 Games' 25-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 2005, vgpocket, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products / JungleTac", "VG Pocket (VG-2000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 200?, vgpmini, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products / JungleTac", "VG Pocket Mini (VG-1500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// VG Pocket Max (VG-2500) (blue case, 75 games) +// VG Pocket Max (VG-3000) (white case, 75 games) (does the game selection differ, or only the case?) +// VG Pocket Caplet is SunPlus hardware instead, see spg2xx_lexibook.cpp // CPU die is marked 'VH2009' There's also a 62256 RAM chip on the PCB, some scrambled opcodes -CONS( 200?, polmega, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Polaroid", "Megamax GPD001SDG", MACHINE_NOT_WORKING ) -CONS( 200?, silv35, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "SilverLit", "35 in 1 Super Twins", MACHINE_NOT_WORKING ) +CONS( 2004, polmega, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Polaroid / JungleTac", "TV MegaMax active power game system 30-in-1 (MegaMax GPD001SDG)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 2004, vsmaxx17, 0, 0, nes_vt_vh2009_2mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario / JungleTac", "Vs Maxx 17-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // from a Green unit, '17 Classic & Racing Game' +CONS( 200?, silv35, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "SilverLit / JungleTac", "35 in 1 Super Twins", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // die is marked as VH2009, as above, but no scrambled opcodes here CONS( 201?, techni4, 0, 0, nes_vt_pal_2mb, nes_vt, nes_vt_state, empty_init, "Technigame", "Technigame Super 4-in-1 Sports (PAL)", MACHINE_IMPERFECT_GRAPHICS ) + +CONS( 2004, vsmaxxvd, 0, 0, nes_vt_vh2009_8mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario / JungleTac", "Vs Maxx Video Extreme 50-in-1 (with Speed Racer and Snood)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 2004, vsmaxx77, 0, 0, nes_vt_vh2009_8mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario / JungleTac", "Vs Maxx Wireless 77-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) + + // seems to use PCM for all sound, some garbage at bottom of screen, needs correct inputs (seems to respond to start, and any direction input for 'hit' - check if they're power related) CONS( 200?, protpp, 0, 0, nes_vt_vh2009_1mb, nes_vt, nes_vt_swap_op_d5_d6_state, init_protpp, "Protocol", "Virtual Ping Pong (Protocol)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -// same encryption as above, but seems like newer hardware (or the above aren't using most of the features) -CONS( 200?, lpgm240, 0, 0, nes_vt_vh2009_8mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "<unknown>", "Let's Play! Game Machine 240 in 1", MACHINE_NOT_WORKING ) // mini 'retro-arcade' style cabinet - // this has 'Shark' and 'Octopus' etc. like mc_dgear but uses scrambled bank registers // This was also often found in cart form with SunPlus / Famiclone hybrid systems to boost the game count, eg. the WiWi (ROM verified to match) CONS( 200?, mc_sp69, 0, 0, nes_vt_4mb_sp69, nes_vt, nes_vt_sp69_state, empty_init, "<unknown>", "Sports Game 69 in 1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) @@ -2303,6 +2351,9 @@ CONS( 2006, ddrstraw, 0, 0, nes_vt_2mb, nes_vt_ddr, nes_vt_state, empt // there is also a 'Spectra Light Edition' which could be a different ROM as the title screen on this one does show the unit type. CONS( 2006, dbdancem, 0, 0, nes_vt_2mb, dbdancem, nes_vt_state, empty_init, "Senario", "Double Dance Mania - Techno Light Edition", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// unlike other Senario products this one is mostly just NES games, it also appears to be one of the final Senario products. Some games aren't what they claim to be, Warpman is Soccer for example. +CONS( 2009, sen101, 0, 0, nes_vt_4mb, nes_vt, nes_vt_state, empty_init, "Senario", "101 Games in 1 (Senario)", MACHINE_IMPERFECT_GRAPHICS ) + // unsorted, these were all in nes.xml listed as ONE BUS systems CONS( 200?, mc_dg101, 0, 0, nes_vt_4mb, nes_vt, nes_vt_state, empty_init, "dreamGEAR", "dreamGEAR 101 in 1", MACHINE_IMPERFECT_GRAPHICS ) // dreamGear, but no enhanced games? CONS( 200?, mc_aa2, 0, 0, nes_vt_4mb, nes_vt, nes_vt_state, empty_init, "<unknown>", "100 in 1 Arcade Action II (AT-103)", MACHINE_IMPERFECT_GRAPHICS ) @@ -2315,7 +2366,6 @@ CONS( 200?, mc_8x6ss, 0, 0, nes_vt_1mb, nes_vt, nes_vt_state, empty CONS( 2004, mc_dcat8, 0, 0, nes_vt_8mb, nes_vt, nes_vt_state, empty_init, "<unknown>", "100 in 1 (D-CAT8 8bit Console, set 1) (v5.01.11-frd, BL 20041217)", MACHINE_IMPERFECT_GRAPHICS ) CONS( 2004, mc_dcat8a, mc_dcat8, 0, nes_vt_8mb, nes_vt, nes_vt_state, empty_init, "<unknown>", "100 in 1 (D-CAT8 8bit Console, set 2)", MACHINE_IMPERFECT_GRAPHICS ) - // Runs well, only issues in SMB3 which crashes CONS( 2017, bittboy, 0, 0, nes_vt_bt_2x16mb, nes_vt, nes_vt_cy_state, empty_init, "BittBoy", "BittBoy Mini FC 300 in 1", MACHINE_IMPERFECT_GRAPHICS ) // has external banking (2x 16mbyte banks) // Runs well, all games seem to work @@ -2332,24 +2382,17 @@ CONS( 201?, mc_tv200, 0, 0, nes_vt_8mb, nes_vt, nes_vt_state, empty // probably another Thumbs Up product? cursor doesn't work unless nes_vt_hh machine is used? possibly newer than VT02 as it runs from an SPI ROM, might just not use enhanced features. Some minor game name changes to above (eg Smackdown just becomes Wrestling) CONS( 201?, unkra200, mc_tv200, 0, nes_vt_hh_8mb, nes_vt, nes_vt_hh_state, empty_init, "<unknown>", "200 in 1 Retro Arcade", MACHINE_IMPERFECT_GRAPHICS ) - // available in a number of colours, with various brands, but likely all the same. // This was a red coloured pad, contains various unlicensed bootleg reskinned NES game eg Blob Buster is a hack of Dig Dug 2 and there are also hacks of Xevious, Donkey Kong Jr, Donkey Kong 3 and many others. CONS( 201?, ppgc200g, 0, 0, nes_vt_8mb, nes_vt, nes_vt_state, empty_init, "<unknown>", "Plug & Play Game Controller with 200 Games (Supreme 200)", MACHINE_IMPERFECT_GRAPHICS ) - // Probably VT09 or similar // Use DIP switch to select console or cartridge, as cartridge is fake and just toggles a ROM high address bit // (which can also be overriden by GPIO) CONS( 2017, fapocket, 0, 0, nes_vt_fa_4x16mb, nes_vt_fa, nes_vt_dg_fapocket_state, empty_init, "<unknown>", "Family Pocket 638 in 1", MACHINE_IMPERFECT_GRAPHICS ) // has external banking (4x 16mbyte banks) - -CONS( 2017, otrail, 0, 0, nes_vt_dg_1mb, nes_vt, nes_vt_dg_state, empty_init, "Basic Fun", "The Oregon Trail", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) - CONS( 2005, senwld, 0, 0, nes_vt_senwld_512kb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario", "Win, Lose or Draw (Senario)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) // needs RAM in banked space, Alpha display emulating, Touchpad emulating etc. - - // Runs well, minor GFX issues in intro CONS( 2017, sy889, 0, 0, nes_vt_hh_8mb, nes_vt, nes_vt_hh_state, empty_init, "SY Corp", "SY-889 300 in 1 Handheld", MACHINE_IMPERFECT_GRAPHICS ) CONS( 2016, sy888b, 0, 0, nes_vt_hh_4mb, nes_vt, nes_vt_hh_state, empty_init, "SY Corp", "SY-888B 288 in 1 Handheld", MACHINE_IMPERFECT_GRAPHICS ) @@ -2370,4 +2413,76 @@ CONS( 2015, rminitv, 0, 0, nes_vt_fp_pal_32mb, nes_vt, nes_vt_hh_state, empt // Use DIP switch to select console or cartridge, as cartridge is fake and just toggles a GPIO CONS( 2016, fcpocket, 0, 0, nes_vt_fp_4x16mb, nes_vt_fp, nes_vt_hh_state, empty_init, "<unknown>", "FC Pocket 600 in 1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // has external banking (2x 32mbyte banks) + +/**************************************************************************************************************** + + Things below seem on heavily enhanced hardware of unknown VT type + + It's possible some of these are the same as some of the ones above (sy889, rminitv, dgun2573 etc.) but with + more features used. + + In some cases these might be almost entirely different, and it is likely a number don't belong in this + driver at all. + +****************************************************************************************************************/ + +// don't even get to menu. very enhanced chipset, VT368/9? +CONS( 2012, dgun2561, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "dreamGEAR", "My Arcade Portable Gaming System with 140 Games (DGUN-2561)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 2016, dgun2593, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "dreamGEAR", "My Arcade Retro Arcade Machine - 300 Handheld Video Games (DGUN-2593)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme + +CONS( 200?, lxcmcy, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxcmc250, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - 250-in-1 (JL2375)", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxcmcysw, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Star Wars Rebels", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxcmcyfz, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Frozen", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxcmcydp, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Disney Princess", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxcmcysp, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Marvel Ultimate Spider-Man", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxcmcycr, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Compact Cyber Arcade - Cars", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +// the data order is swapped for this one, maybe other internal differences? +CONS( 200?, lxcmcypp, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, init_lxcmcypp, "Lexibook", "Lexibook Compact Cyber Arcade - Paw Patrol", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme + + +CONS( 200?, lxccminn, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Console Colour - Minnie Mouse", MACHINE_NOT_WORKING ) // 64Mbyte (used) ROM, must be externally banked, or different addressing scheme +CONS( 200?, lxccplan, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Console Colour - Disney's Planes", MACHINE_NOT_WORKING ) // 64Mbyte (used) ROM, must be externally banked, or different addressing scheme + + +// GB-NO13-Main-VT389-2 on PCBs +CONS( 2016, rtvgc300, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Retro TV Game Console - 300 Games", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme +CONS( 2017, rtvgc300fz,0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Lexibook", "Lexibook Retro TV Game Console - Frozen - 300 Games", MACHINE_NOT_WORKING ) // 64Mbyte ROM, must be externally banked, or different addressing scheme + + +/* The following are also confirmed to be NES/VT derived units, most having a standard set of games with a handful of lazy graphic mods thrown in to fit the unit theme + + (handhekd units, use standard AAA batteries) + Lexibook Compact Cyber Arcade - Cars + Lexibook Compact Cyber Arcade - Barbie + Lexibook Compact Cyber Arcade - Finding Dory + Lexibook Compact Cyber Arcade - PJ Masks + + (Handheld units, but different form factor to Compact Cyber Arcade, charged via USB) + Lexibook Console Colour - Barbie + + (units for use with TV) + Lexibook Retro TV Game Console (300 Games) - Cars + Lexibook Retro TV Game Console (300 Games) - PJ Masks + + (more?) + + There are also updated 'Compact Cyber Arcade' branded units with a large + D-pad and internal battery / USB charger for + Spiderman + Frozen + (generic) + it isn't verified if these use the same ROMs as the original Compact Cyber Arcade releases, or if the software has been updated + +*/ + +// intial code isn't valid? scrambled? +CONS( 201?, red5mam, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Red5", "Mini Arcade Machine (Red5)", MACHINE_NOT_WORKING ) // 128Mbyte ROM, must be externally banked or different addressing scheme + +CONS( 201?, denv150, 0, 0, nes_vt_cy_bigger, nes_vt, nes_vt_cy_lexibook_state, empty_init, "Denver", "Denver Game Console GMP-240C 150-in-1", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) + +// same encryption as above, but seems like newer hardware (or the above aren't using most of the features) +CONS( 200?, lpgm240, 0, 0, nes_vt_vh2009_8mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "<unknown>", "Let's Play! Game Machine 240 in 1", MACHINE_NOT_WORKING ) // mini 'retro-arcade' style cabinet + +CONS( 2017, otrail, 0, 0, nes_vt_dg_1mb, nes_vt, nes_vt_dg_state, empty_init, "Basic Fun", "The Oregon Trail", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS ) + CONS( 200?, zonefusn, 0, 0, nes_vt_fp_16mb, nes_vt, nes_vt_hh_state, empty_init, "Ultimate Products / Jungle's Soft", "Zone Fusion", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/newton.cpp b/src/mame/drivers/newton.cpp index d072a9788d8..bdad52420a7 100644 --- a/src/mame/drivers/newton.cpp +++ b/src/mame/drivers/newton.cpp @@ -47,13 +47,26 @@ public: protected: void mem_map(address_map &map); + uint32_t tick_count_r(); + required_device<arm7_cpu_device> m_maincpu; required_device<ram_device> m_ram; + + uint32_t m_ram_size; }; +uint32_t newton_state::tick_count_r() +{ + return (uint32_t)m_maincpu->total_cycles(); +} + void newton_state::mem_map(address_map &map) { - map(0x00000000, 0x007fffff).rom().region("maincpu", 0); + map(0x00000000, 0x007fffff).mirror(0x00800000).rom().region("maincpu", 0); + map(0x02000000, 0x023fffff).ram(); // Actually Flash + map(0x04000000, 0x04ffffff).rw(m_ram, FUNC(ram_device::read), FUNC(ram_device::write)); + map(0x0f181800, 0x0f181803).r(FUNC(newton_state::tick_count_r)); + map(0x0f001800, 0x0f001803).lrw32(NAME([this](){ return m_ram_size; }), NAME([this](uint32_t data) { m_ram_size = data; })); } static INPUT_PORTS_START( newton ) diff --git a/src/mame/drivers/nexus3d.cpp b/src/mame/drivers/nexus3d.cpp index a0bfc095328..81c218bb886 100644 --- a/src/mame/drivers/nexus3d.cpp +++ b/src/mame/drivers/nexus3d.cpp @@ -97,14 +97,14 @@ void nexus3d_state::video_start() uint32_t nexus3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *fbram = reinterpret_cast<uint16_t *>(m_fbram.target()); - const int width = 640; + uint16_t const *const fbram = reinterpret_cast<uint16_t *>(m_fbram.target()); + int const width = 640; - uint16_t *visible = fbram + (m_screen->frame_number() & 1) * (0x96000/2); + uint16_t const *const visible = fbram + (m_screen->frame_number() & 1) * (0x96000/2); uint32_t const dx = cliprect.left(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) - std::copy_n(&visible[(y * width) + dx], width, &bitmap.pix16(y, dx)); + std::copy_n(&visible[(y * width) + dx], width, &bitmap.pix(y, dx)); return 0; } diff --git a/src/mame/drivers/nforcepc.cpp b/src/mame/drivers/nforcepc.cpp index 06d2db89863..c6a73538d71 100644 --- a/src/mame/drivers/nforcepc.cpp +++ b/src/mame/drivers/nforcepc.cpp @@ -103,6 +103,9 @@ void crush11_host_device::device_start() io_window_end = 0xffff; io_offset = 0; status = 0x00b0; + command = 0x0000; + + add_map(64 * 1024 * 1024, M_MEM | M_PREF, FUNC(crush11_host_device::aperture_map)); } void crush11_host_device::reset_all_mappings() @@ -169,16 +172,16 @@ void crush11_memory_device::config_map(address_map &map) map(0xc8, 0xcb).nopr(); } -crush11_memory_device::crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, int ram_size) +crush11_memory_device::crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id, int ram_size) : crush11_memory_device(mconfig, tag, owner, clock) { + set_ids(0x10de01ac, 0xb2, 0x050000, subsystem_id); set_ram_size(ram_size); } crush11_memory_device::crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, CRUSH11_MEMORY, tag, owner, clock) { - set_ids(0x10de01ac, 0, 0, 0); } void crush11_memory_device::device_start() @@ -191,6 +194,7 @@ void crush11_memory_device::device_start() host = dynamic_cast<crush11_host_device *>(r); ram_space = host->get_cpu_space(AS_PROGRAM); status = 0x0020; + command = 0x0000; } void crush11_memory_device::device_reset() @@ -1159,7 +1163,7 @@ void nforcepc_state::nforcepc(machine_config &config) PCI_ROOT(config, ":pci", 0); CRUSH11(config, ":pci:00.0", 0, "maincpu", "bios"); // 10de:01a4 NVIDIA Corporation nForce CPU bridge - CRUSH11_MEMORY(config, ":pci:00.1", 0, 2); // 10de:01ac NVIDIA Corporation nForce 220/420 Memory Controller + CRUSH11_MEMORY(config, ":pci:00.1", 0, 0x10430c11, 2); // 10de:01ac NVIDIA Corporation nForce 220/420 Memory Controller // 10de:01ad NVIDIA Corporation nForce 220/420 Memory Controller // 10de:01ab NVIDIA Corporation nForce 420 Memory Controller (DDR) mcpx_isalpc_device &isa(MCPX_ISALPC(config, ":pci:01.0", 0, 0x10430c11)); // 10de:01b2 NVIDIA Corporation nForce ISA Bridge (LPC bus) @@ -1175,7 +1179,7 @@ void nforcepc_state::nforcepc(machine_config &config) ite.txd2().set("serport1", FUNC(rs232_port_device::write_txd)); ite.ndtr2().set("serport1", FUNC(rs232_port_device::write_dtr)); ite.nrts2().set("serport1", FUNC(rs232_port_device::write_rts)); - MCPX_SMBUS(config, ":pci:01.1", 0); // 10de:01b4 NVIDIA Corporation nForce PCI System Management (SMBus) + MCPX_SMBUS(config, ":pci:01.1", 0, 0x10430c11); // 10de:01b4 NVIDIA Corporation nForce PCI System Management (SMBus) SMBUS_ROM(config, ":pci:01.1:050", 0, test_spd_data, sizeof(test_spd_data)); // these 3 are on smbus number 0 SMBUS_LOGGER(config, ":pci:01.1:051", 0); SMBUS_LOGGER(config, ":pci:01.1:052", 0); @@ -1183,20 +1187,20 @@ void nforcepc_state::nforcepc(machine_config &config) AS99127F(config, ":pci:01.1:12d", 0); AS99127F_SENSOR2(config, ":pci:01.1:148", 0); AS99127F_SENSOR3(config, ":pci:01.1:149", 0); - mcpx_ohci_device &ohci(MCPX_OHCI(config, ":pci:02.0", 0)); // 10de:01c2 NVIDIA Corporation nForce USB Controller + mcpx_ohci_device &ohci(MCPX_OHCI(config, ":pci:02.0", 0, 0x10430c11)); // 10de:01c2 NVIDIA Corporation nForce USB Controller ohci.interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq1)); - MCPX_OHCI(config, ":pci:03.0", 0); // 10de:01c2 NVIDIA Corporation nForce USB Controller + MCPX_OHCI(config, ":pci:03.0", 0, 0x10430c11); // 10de:01c2 NVIDIA Corporation nForce USB Controller MCPX_ETH(config, ":pci:04.0", 0); // 10de:01c3 NVIDIA Corporation nForce Ethernet Controller - MCPX_APU(config, ":pci:05.0", 0, m_maincpu); // 10de:01b0 NVIDIA Corporation nForce Audio Processing Unit - MCPX_AC97_AUDIO(config, ":pci:06.0", 0); // 10de:01b1 NVIDIA Corporation nForce AC'97 Audio Controller - PCI_BRIDGE(config, ":pci:08.0", 0, 0x10de01b8, 0); // 10de:01b8 NVIDIA Corporation nForce PCI-to-PCI bridge + MCPX_APU(config, ":pci:05.0", 0, 0x10430c11, m_maincpu); // 10de:01b0 NVIDIA Corporation nForce Audio Processing Unit + MCPX_AC97_AUDIO(config, ":pci:06.0", 0, 0x10438384); // 10de:01b1 NVIDIA Corporation nForce AC'97 Audio Controller + PCI_BRIDGE(config, ":pci:08.0", 0, 0x10de01b8, 0xc2); // 10de:01b8 NVIDIA Corporation nForce PCI-to-PCI bridge // 10ec:8139 Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (behind bridge) - mcpx_ide_device &ide(MCPX_IDE(config, ":pci:09.0", 0)); // 10de:01bc NVIDIA Corporation nForce IDE + mcpx_ide_device &ide(MCPX_IDE(config, ":pci:09.0", 0, 0x10430c11)); // 10de:01bc NVIDIA Corporation nForce IDE ide.pri_interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq14)); ide.sec_interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq15)); ide.subdevice<ide_controller_32_device>("ide1")->options(ata_devices, "hdd", nullptr, true); ide.subdevice<ide_controller_32_device>("ide2")->options(ata_devices, "cdrom", nullptr, true); - NV2A_AGP(config, ":pci:1e.0", 0, 0x10de01b7, 0); // 10de:01b7 NVIDIA Corporation nForce AGP to PCI Bridge + NV2A_AGP(config, ":pci:1e.0", 0, 0x10de01b7, 0xb2); // 10de:01b7 NVIDIA Corporation nForce AGP to PCI Bridge VIRGEDX_PCI(config, ":pci:0a.0", 0); SST_49LF020(config, "bios", 0); diff --git a/src/mame/drivers/ngen.cpp b/src/mame/drivers/ngen.cpp index de4ee86a914..e0a18155ead 100644 --- a/src/mame/drivers/ngen.cpp +++ b/src/mame/drivers/ngen.cpp @@ -768,9 +768,9 @@ MC6845_UPDATE_ROW( ngen_state::crtc_update_row ) for(int z=0;z<9;z++) { if(BIT(m_fontram.read16(ch*16+ra),8-z)) - bitmap.pix32(y,x+z) = rgb_t(0,0xff,0); + bitmap.pix(y,x+z) = rgb_t(0,0xff,0); else - bitmap.pix32(y,x+z) = rgb_t(0,0,0); + bitmap.pix(y,x+z) = rgb_t(0,0,0); } } } diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 99b2428e3f1..8acac8fd461 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -175,14 +175,12 @@ void nightgal_state::video_start() uint32_t nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); - uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); + uint16_t *dst = &m_tmp_bitmap->pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint32_t srcpix = *src++; *dst++ = m_palette->pen((srcpix & 0xf) | m_pal_bank); diff --git a/src/mame/drivers/nightmare.cpp b/src/mame/drivers/nightmare.cpp index 5ea1c4ac209..5dda8921429 100644 --- a/src/mame/drivers/nightmare.cpp +++ b/src/mame/drivers/nightmare.cpp @@ -369,9 +369,9 @@ uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_ // combine two buffers (additive?) for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *const bitmap1 = &m_vdc2->get_bitmap().pix32(y); - uint32_t *const bitmap2 = &m_vdc->get_bitmap().pix32(y); - uint32_t *dst = &bitmap.pix32(y); + uint32_t const *const bitmap1 = &m_vdc2->get_bitmap().pix(y); + uint32_t const *const bitmap2 = &m_vdc->get_bitmap().pix(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -379,9 +379,9 @@ uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_ uint32_t p2 = bitmap2[x]; uint32_t result = 0; - for(int shift=0; shift<32;shift+=8) + for (int shift=0; shift<32;shift+=8) { - uint32_t data = ((p2>>shift)&0xff)+((p1>>shift)&0xff); + uint32_t const data = ((p2>>shift)&0xff)+((p1>>shift)&0xff); result|=((data>0xff)?0xff:data)<<shift; } dst[x]=result; diff --git a/src/mame/drivers/ninjaw.cpp b/src/mame/drivers/ninjaw.cpp index 3cff502baf7..d3eecd5df84 100644 --- a/src/mame/drivers/ninjaw.cpp +++ b/src/mame/drivers/ninjaw.cpp @@ -373,6 +373,7 @@ void ninjaw_state::pancontrol_w(offs_t offset, u8 data) { filter_volume_device *flt = nullptr; offset &= 3; + offset ^= 1; switch (offset) { @@ -618,7 +619,7 @@ protected: virtual void device_start(); // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state @@ -654,11 +655,12 @@ void subwoofer_device::device_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void subwoofer_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void subwoofer_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } diff --git a/src/mame/drivers/nmg5.cpp b/src/mame/drivers/nmg5.cpp index a657a5641b8..c887aaa54f1 100644 --- a/src/mame/drivers/nmg5.cpp +++ b/src/mame/drivers/nmg5.cpp @@ -315,7 +315,7 @@ uint8_t nmg5_state::pixmap_r(offs_t offset) int const sy = offset >> 8; int const sx = (offset & 0xff) << 1; - return ((m_pixmap->pix16(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix16(sy & 0xff, sx | 1) & 0xf); + return ((m_pixmap->pix(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix(sy & 0xff, sx | 1) & 0xf); } void nmg5_state::pixmap_w(offs_t offset, uint8_t data) @@ -323,8 +323,8 @@ void nmg5_state::pixmap_w(offs_t offset, uint8_t data) int const sy = offset >> 8; int const sx = (offset & 0xff) << 1; - m_pixmap->pix16(sy & 0xff, sx & ~1) = 0x300 + ((data & 0xf0) >> 4); - m_pixmap->pix16(sy & 0xff, sx | 1) = 0x300 + (data & 0x0f); + m_pixmap->pix(sy & 0xff, sx & ~1) = 0x300 + ((data & 0xf0) >> 4); + m_pixmap->pix(sy & 0xff, sx | 1) = 0x300 + (data & 0x0f); } template<int Layer> diff --git a/src/mame/drivers/nmk16.cpp b/src/mame/drivers/nmk16.cpp index 3cc0dc80a5d..e7034e36d79 100644 --- a/src/mame/drivers/nmk16.cpp +++ b/src/mame/drivers/nmk16.cpp @@ -1291,6 +1291,15 @@ void nmk16_state::macross2_sound_io_map(address_map &map) map(0x90, 0x97).w("nmk112", FUNC(nmk112_device::okibank_w)); } +void nmk16_state::tdragon3h_sound_io_map(address_map &map) +{ + map.global_mask(0xff); + //map(0x00, 0x01).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); // writes here since ROM is the same as the original, but no chip on PCB + //map(0x80, 0x80).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // same as above + map(0x88, 0x88).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write)); + map(0x90, 0x97).w("nmk112", FUNC(nmk112_device::okibank_w)); +} + void nmk16_state::bjtwin_map(address_map &map) { map(0x000000, 0x07ffff).rom(); @@ -4891,11 +4900,18 @@ void nmk16_state::tdragon2(machine_config &config) nmk112.set_rom1_tag("oki2"); } -// TODO : Sound system is different void nmk16_state::tdragon3h(machine_config &config) { tdragon2(config); m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragon3h_map); + + // No YM2203 and only one OKI, the PCB has a space for the YM2203, populated by a 7474 and a 74367. + // It's been verified that by removing them and putting the YM2203 in its place, the game can make use of it. + + m_audiocpu->set_addrmap(AS_IO, &nmk16_state::tdragon3h_sound_io_map); + + config.device_remove("ymsnd"); + config.device_remove("oki1"); } @@ -6918,36 +6934,34 @@ ROM_START( tdragon2 ) ROM_END ROM_START( tdragon3h ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "h.27c2001", 0x00000, 0x40000, CRC(0091f4a3) SHA1(025e5f7ff12eaa90c5cfe757c71d58ba7040cba7) ) ROM_LOAD16_BYTE( "l.27c020", 0x00001, 0x40000, CRC(4699c313) SHA1(1851a4b5ad9c2bac230126d195e239a5ebe827f9) ) - // Not from this PCB - ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 code */ - ROM_LOAD( "1.27c1000", 0x00000, 0x20000, BAD_DUMP CRC(b870be61) SHA1(ea5d45c3a3ab805e55806967f00167cf6366212e) ) /* banked */ + ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code + ROM_LOAD( "1.27c1000", 0x00000, 0x20000, CRC(b870be61) SHA1(ea5d45c3a3ab805e55806967f00167cf6366212e) ) // banked ROM_REGION( 0x020000, "fgtile", 0 ) - ROM_LOAD( "12.27c1000", 0x000000, 0x020000, CRC(f809d616) SHA1(c6a4d776fee770ec197204b855b85bcc719469a5) ) /* 8x8 tiles */ + ROM_LOAD( "12.27c1000", 0x000000, 0x020000, CRC(f809d616) SHA1(c6a4d776fee770ec197204b855b85bcc719469a5) ) // 8x8 tiles - // all other ROMs are mask parts marked 'CONNY' but weren't dumped from this PCB so content is only assumed to be the same + ROM_REGION( 0x200000, "bgtile", 0 ) // identical to tdragon2, only split + ROM_LOAD( "conny.3", 0x000000, 0x100000, CRC(5951c031) SHA1(c262aeda0befcf4ac30638d42f2d40ba54c66ea7) ) // 16x16 tiles + ROM_LOAD( "conny.4", 0x100000, 0x100000, CRC(a7772524) SHA1(fcf980272c5e4088f492b429cb288bc0c46cf5a2) ) - ROM_REGION( 0x200000, "bgtile", 0 ) - ROM_LOAD( "ww930914.2", 0x000000, 0x200000, CRC(f968c65d) SHA1(fd6d21bba53f945b1597d7d0735bc62dd44d5498) ) /* 16x16 tiles */ + ROM_REGION( 0x400000, "sprites", 0 ) // identical to tdragon2, only split + ROM_LOAD16_BYTE( "conny.2", 0x000000, 0x100000, CRC(fefe8384) SHA1(a68069691cef0454059bd383f6c85ce19af2c0e7) ) // Sprites + ROM_LOAD16_BYTE( "conny.1", 0x000001, 0x100000, CRC(37b32460) SHA1(7b689a7e23a9428c6d36f0791a64e7a9a41e7cfa) ) + ROM_LOAD16_WORD_SWAP( "conny.5", 0x200000, 0x200000, CRC(baee84b2) SHA1(b325b00e6147266dbdc840e03556004531dc2038) ) - ROM_REGION( 0x400000, "sprites", 0 ) - ROM_LOAD16_WORD_SWAP( "ww930917.7", 0x000000, 0x200000, CRC(b98873cb) SHA1(cc19200865176e940ff68e12de81f029b51c2084) ) /* Sprites */ - ROM_LOAD16_WORD_SWAP( "ww930918.8", 0x200000, 0x200000, CRC(baee84b2) SHA1(b325b00e6147266dbdc840e03556004531dc2038) ) + ROM_REGION( 0x240000, "oki1", ROMREGION_ERASEFF ) // only 1 oki on this PCB - // Not from this PCB - ROM_REGION( 0x240000, "oki1", 0 ) /* OKIM6295 samples */ - ROM_LOAD( "ww930916.4", 0x040000, 0x200000, BAD_DUMP CRC(07c35fe6) SHA1(33547bd88764704310f2ef8cf3bfe21ceb56d5b7) ) /* all banked */ + ROM_REGION( 0x240000, "oki2", 0 ) // OKIM6295 samples + ROM_LOAD( "conny.6", 0x040000, 0x100000, CRC(564f87ed) SHA1(010dd001fda28d9c15ca09a0d12cac438a46cd54) ) // all banked + ROM_LOAD( "conny.7", 0x140000, 0x100000, CRC(2e767f6f) SHA1(34e3f747716eb7a585340791c2cfbfde57681d69) ) - ROM_REGION( 0x240000, "oki2", 0 ) /* OKIM6295 samples */ - ROM_LOAD( "ww930915.3", 0x040000, 0x200000, BAD_DUMP CRC(82025bab) SHA1(ac6053700326ea730d00ec08193e2c8a2a019f0b) ) /* all banked */ - - ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) /* unknown */ - ROM_LOAD( "10.bpr", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) /* unknown */ + ROM_REGION( 0x0200, "proms", 0 ) // not dumped for this set + ROM_LOAD( "9.bpr", 0x0000, 0x0100, BAD_DUMP CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown + ROM_LOAD( "10.bpr", 0x0100, 0x0100, BAD_DUMP CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown ROM_END ROM_START( tdragon2a ) @@ -8574,7 +8588,7 @@ GAME( 1993, macross2k, macross2, macross2, macross2, nmk16_state, init_ GAME( 1993, tdragon2, 0, tdragon2, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Thunder Dragon 2 (9th Nov. 1993)", MACHINE_NO_COCKTAIL ) GAME( 1993, tdragon2a, tdragon2, tdragon2, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Thunder Dragon 2 (1st Oct. 1993)", MACHINE_NO_COCKTAIL ) GAME( 1993, bigbang, tdragon2, tdragon2, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Big Bang (9th Nov. 1993)", MACHINE_NO_COCKTAIL ) -GAME( 1996, tdragon3h, tdragon2, tdragon3h, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "bootleg (Conny Co Ltd.)", "Thunder Dragon 3 (bootleg of Thunder Dragon 2)", MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // based on 1st Oct. 1993 set, Sound system isn't hooked up correctly for this set +GAME( 1996, tdragon3h, tdragon2, tdragon3h, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "bootleg (Conny Co Ltd.)", "Thunder Dragon 3 (bootleg of Thunder Dragon 2)", MACHINE_NO_SOUND | MACHINE_NO_COCKTAIL ) // based on 1st Oct. 1993 set, needs emulation of the mechanism used to simulate the missing YM2203' IRQs GAME( 1994, arcadian, 0, raphero, raphero, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Arcadia (NMK)", 0 ) // 23rd July 1993 in test mode, (c)1994 on title screen GAME( 1994, raphero, arcadian, raphero, raphero, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Rapid Hero (NMK)", 0 ) // ^^ diff --git a/src/mame/drivers/nokia_3310.cpp b/src/mame/drivers/nokia_3310.cpp index 352513d8cc2..0007ecba6ed 100644 --- a/src/mame/drivers/nokia_3310.cpp +++ b/src/mame/drivers/nokia_3310.cpp @@ -422,7 +422,7 @@ PCD8544_SCREEN_UPDATE(noki3310_state::pcd8544_screen_update) for (int y = 0; y < 8; y++) { int p = BIT(gfx, y); - bitmap.pix16(r*8 + y, x) = p ^ inv; + bitmap.pix(r*8 + y, x) = p ^ inv; } } } diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 89b2ed4e811..abf39db27fb 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -282,28 +282,23 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit { // have to figure out what resolution we're drawing to here and draw appropriately to screen // code borrowed/stolen from video/mac.cpp - uint32_t video_base; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = (m_DispAddr << 3)&0x1FFFF; + uint32_t const video_base = (m_DispAddr << 3) & 0x1ffff; #ifdef DEBUG_VIDEO logerror("Video Base = 0x%05x\n", video_base); #endif - const uint16_t *video_ram_field1 = &m_mainram[video_base/2]; - const uint16_t *video_ram_field2 = &m_mainram[(video_base+0x4B00)/2]; + uint16_t const *video_ram_field1 = &m_mainram[video_base / 2]; + uint16_t const *video_ram_field2 = &m_mainram[(video_base + 0x4b00) / 2]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - if ((y&1)==0) word = *(video_ram_field1++); else word = *(video_ram_field2++); - for (b = 0; b < 16; b++) + uint16_t const word = *((y & 1) ? video_ram_field2 : video_ram_field1)++; + for (int b = 0; b < 16; b++) { - line[x + b] = (word >> (15 - b)) & 0x0001; + line[x + b] = BIT(word, 15 - b); } } } @@ -312,15 +307,15 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit void notetaker_state::IPConReg_w(uint16_t data) { - m_BootSeqDone = (data&0x80)?1:0; - m_ProcLock = (data&0x40)?1:0; // bus lock for this processor (hold other processor in wait state) - m_CharCtr = (data&0x20)?1:0; // battery charge control (incorrectly called 'Char counter' in source code) - m_DisableROM = (data&0x10)?1:0; // disable rom at 0000-0fff - m_CorrOn_q = (data&0x08)?1:0; // CorrectionOn (ECC correction enabled); also LedInd5 - m_LedInd6 = (data&0x04)?1:0; - m_LedInd7 = (data&0x02)?1:0; - m_LedInd8 = (data&0x01)?1:0; - popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", (data&0x04)>>2, (data&0x08)>>3, (data&0x02)>>1, (data&0x01)); // cr1 and 2 are in the reverse order as expected, according to the schematic + m_BootSeqDone = BIT(data, 7); + m_ProcLock = BIT(data, 6); // bus lock for this processor (hold other processor in wait state) + m_CharCtr = BIT(data, 5); // battery charge control (incorrectly called 'Char counter' in source code) + m_DisableROM = BIT(data, 4); // disable rom at 0000-0fff + m_CorrOn_q = BIT(data, 3); // CorrectionOn (ECC correction enabled); also LedInd5 + m_LedInd6 = BIT(data, 2); + m_LedInd7 = BIT(data, 1); + m_LedInd8 = BIT(data, 0); + popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", BIT(data, 2), BIT(data, 3), BIT(data, 1), BIT(data, 0)); // cr1 and 2 are in the reverse order as expected, according to the schematic } /* handlers for the two system hd6402s (ay-5-1013 equivalent) */ diff --git a/src/mame/drivers/novag_diablo.cpp b/src/mame/drivers/novag_diablo.cpp index 0c464c6ee2f..2f39f863df3 100644 --- a/src/mame/drivers/novag_diablo.cpp +++ b/src/mame/drivers/novag_diablo.cpp @@ -142,7 +142,7 @@ HD44780_PIXEL_UPDATE(diablo_state::lcd_pixel_update) if (line < 2 && pos < 8) { // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/novag_sexpert.cpp b/src/mame/drivers/novag_sexpert.cpp index c4eb02fd318..a983ba9567f 100644 --- a/src/mame/drivers/novag_sexpert.cpp +++ b/src/mame/drivers/novag_sexpert.cpp @@ -217,7 +217,7 @@ HD44780_PIXEL_UPDATE(sexpert_state::lcd_pixel_update) if (line < 2 && pos < 8) { // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/nyny.cpp b/src/mame/drivers/nyny.cpp index 4f86a5a9cb1..957e26e405b 100644 --- a/src/mame/drivers/nyny.cpp +++ b/src/mame/drivers/nyny.cpp @@ -316,7 +316,7 @@ MC6845_UPDATE_ROW( nyny_state::crtc_update_row ) else color = bit2 ? color2 : 0; - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); x += 1; } @@ -342,7 +342,7 @@ MC6845_END_UPDATE( nyny_state::crtc_end_update ) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* check if the star status */ - if (m_star_enable && (bitmap.pix32(y, x) == m_palette->pen_color(0)) && + if (m_star_enable && (bitmap.pix(y, x) == m_palette->pen_color(0)) && ((m_star_shift_reg & 0x80ff) == 0x00ff) && (((y & 0x01) ^ m_flipscreen) ^ (((x & 0x08) >> 3) ^ m_flipscreen))) { @@ -350,7 +350,7 @@ MC6845_END_UPDATE( nyny_state::crtc_end_update ) ((m_star_shift_reg & 0x0400) >> 9) | /* G */ ((m_star_shift_reg & 0x1000) >> 10); /* B */ - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); } if (delay_counter == 0) diff --git a/src/mame/drivers/octopus.cpp b/src/mame/drivers/octopus.cpp index 05d2d414baf..b33a13202de 100644 --- a/src/mame/drivers/octopus.cpp +++ b/src/mame/drivers/octopus.cpp @@ -863,7 +863,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(octopus_state::display_pixels) data = 0xff; } for (int z=0;z<8;z++) - bitmap.pix32(y,x + z) = BIT(data,z) ? fg : bg; + bitmap.pix(y,x + z) = BIT(data,z) ? fg : bg; } } diff --git a/src/mame/drivers/odyssey.cpp b/src/mame/drivers/odyssey.cpp index 628fe45caa9..312bd67e69c 100644 --- a/src/mame/drivers/odyssey.cpp +++ b/src/mame/drivers/odyssey.cpp @@ -85,7 +85,7 @@ private: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void odyssey_map(address_map &map); }; @@ -93,7 +93,7 @@ void odyssey_state::video_start() { } -uint32_t odyssey_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +u32 odyssey_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; } diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index 6aabae3acc8..da3a27a003b 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -78,8 +78,8 @@ TODO: - 4in1 and musician are not supposed to work on g7400, but work fine on MAME, caused by bus conflict or because they write to P2? - verify odyssey3 cpu/video clocks -- odyssey3 keyboard layout is not the same as g7400, but there is no software - to test the scancodes +- problems with natural keyboard: videopacp has two enter keys, odyssey3 has + alternate inputs for -, =, + - partial screen updates aren't shown when using MAME's debugger, this is caused by a forced full screen update and a reset_partial_updates in emu/video.cpp. For the same reason, collision detection also won't work properly when stepping @@ -142,9 +142,9 @@ protected: required_device<screen_device> m_screen; required_device<o2_cart_slot_device> m_cart; - uint8_t m_ram[0x80]; - uint8_t m_p1 = 0xff; - uint8_t m_p2 = 0xff; + u8 m_ram[0x80]; + u8 m_p1 = 0xff; + u8 m_p2 = 0xff; DECLARE_READ_LINE_MEMBER(t1_read); @@ -156,21 +156,21 @@ protected: required_ioport_array<8> m_keyboard; required_ioport_array<2> m_joysticks; - virtual uint8_t io_read(offs_t offset); - virtual void io_write(offs_t offset, uint8_t data); - uint8_t bus_read(); - void p1_write(uint8_t data); - uint8_t p2_read(); - void p2_write(uint8_t data); + virtual u8 io_read(offs_t offset); + virtual void io_write(offs_t offset, u8 data); + u8 bus_read(); + void p1_write(u8 data); + u8 p2_read(); + void p2_write(u8 data); private: - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; -class videopacp_state : public odyssey2_state +class vpp_state : public odyssey2_state { public: - videopacp_state(const machine_config &mconfig, device_type type, const char *tag) : + vpp_state(const machine_config &mconfig, device_type type, const char *tag) : odyssey2_state(mconfig, type, tag), m_i8243(*this, "i8243"), m_ef934x(*this, "ef934x") @@ -183,26 +183,26 @@ public: protected: virtual void machine_start() override; - virtual uint8_t io_read(offs_t offset) override; - virtual void io_write(offs_t offset, uint8_t data) override; + virtual u8 io_read(offs_t offset) override; + virtual void io_write(offs_t offset, u8 data) override; private: required_device<i8243_device> m_i8243; required_device<ef9340_1_device> m_ef934x; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void p2_write(uint8_t data); - uint8_t io_vpp(offs_t offset, uint8_t data); - template<int P> void i8243_port_w(uint8_t data); + void p2_write(u8 data); + u8 io_vpp(offs_t offset, u8 data); + template<int P> void i8243_port_w(u8 data); inline offs_t ef934x_extram_address(offs_t offset); - uint8_t ef934x_extram_r(offs_t offset); - void ef934x_extram_w(offs_t offset, uint8_t data); + u8 ef934x_extram_r(offs_t offset); + void ef934x_extram_w(offs_t offset, u8 data); - uint8_t m_mix_i8244 = 0xff; - uint8_t m_mix_ef934x = 0xff; - uint8_t m_ef934x_extram[0x800]; + u8 m_mix_i8244 = 0xff; + u8 m_mix_ef934x = 0xff; + u8 m_ef934x_extram[0x800]; }; void odyssey2_state::machine_start() @@ -214,7 +214,7 @@ void odyssey2_state::machine_start() save_item(NAME(m_p2)); } -void videopacp_state::machine_start() +void vpp_state::machine_start() { odyssey2_state::machine_start(); memset(m_ef934x_extram, 0, sizeof(m_ef934x_extram)); @@ -259,7 +259,7 @@ void odyssey2_state::odyssey2_palette(palette_device &palette) const } -uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_i8244->screen_update(screen, bitmap, cliprect); @@ -268,12 +268,12 @@ uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // apply external LUM setting for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix16(y, x) |= lum; + bitmap.pix(y, x) |= lum; return 0; } -uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 vpp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { u8 lum = ~m_p1 >> 4 & 0x08; bitmap_ind16 *ef934x_bitmap = m_ef934x->get_bitmap(); @@ -288,8 +288,8 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit for (int x = clip.min_x; x <= clip.max_x; x++) { - uint16_t d = bitmap.pix16(y, x) & 7; - uint16_t e = ef934x_bitmap->pix16(y, x); + u16 d = bitmap.pix(y, x) & 7; + u16 e = ef934x_bitmap->pix(y, x); // i8244 decoder enable is masked with cartridge pin B bool en = (e & 8) || !m_cart->b_read(); @@ -302,12 +302,12 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit if (en && BIT(m_mix_i8244, d)) { // Use i8245 input - bitmap.pix16(y, x) |= lum; + bitmap.pix(y, x) |= lum; } else { // Use EF934x input - bitmap.pix16(y, x) = e | (i2 ? 8 : 0); + bitmap.pix(y, x) = e | (i2 ? 8 : 0); } } } @@ -321,7 +321,7 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit I/O ******************************************************************************/ -uint8_t odyssey2_state::io_read(offs_t offset) +u8 odyssey2_state::io_read(offs_t offset) { u8 data = m_cart->io_read(offset); if (!(m_p1 & 0x10) && ~offset & 0x80) @@ -333,7 +333,7 @@ uint8_t odyssey2_state::io_read(offs_t offset) return data; } -void odyssey2_state::io_write(offs_t offset, uint8_t data) +void odyssey2_state::io_write(offs_t offset, u8 data) { if (!(m_p1 & 0x40)) { @@ -349,7 +349,7 @@ void odyssey2_state::io_write(offs_t offset, uint8_t data) // 8048 ports -void odyssey2_state::p1_write(uint8_t data) +void odyssey2_state::p1_write(u8 data) { // LUM changed if ((m_p1 ^ data) & 0x80) @@ -359,7 +359,7 @@ void odyssey2_state::p1_write(uint8_t data) m_cart->write_p1(m_p1 & 0x13); } -uint8_t odyssey2_state::p2_read() +u8 odyssey2_state::p2_read() { u8 data = 0xff; @@ -374,13 +374,13 @@ uint8_t odyssey2_state::p2_read() return data; } -void odyssey2_state::p2_write(uint8_t data) +void odyssey2_state::p2_write(u8 data) { m_p2 = data; m_cart->write_p2(m_p2 & 0x0f); } -uint8_t odyssey2_state::bus_read() +u8 odyssey2_state::bus_read() { u8 data = 0xff; @@ -402,40 +402,40 @@ READ_LINE_MEMBER(odyssey2_state::t1_read) // G7400-specific -uint8_t videopacp_state::io_read(offs_t offset) +u8 vpp_state::io_read(offs_t offset) { u8 data = odyssey2_state::io_read(offset); return io_vpp(offset, data); } -void videopacp_state::io_write(offs_t offset, uint8_t data) +void vpp_state::io_write(offs_t offset, u8 data) { odyssey2_state::io_write(offset, data); io_vpp(offset, data); } -uint8_t videopacp_state::io_vpp(offs_t offset, uint8_t data) +u8 vpp_state::io_vpp(offs_t offset, u8 data) { if (!(m_p1 & 0x20)) { // A2 to R/W pin if (offset & 4) - data &= m_ef934x->ef9341_read( offset & 0x02, offset & 0x01 ); + data &= m_ef934x->ef9341_read(offset & 0x02, offset & 0x01); else - m_ef934x->ef9341_write( offset & 0x02, offset & 0x01, data ); + m_ef934x->ef9341_write(offset & 0x02, offset & 0x01, data); } return data; } -void videopacp_state::p2_write(uint8_t data) +void vpp_state::p2_write(u8 data) { odyssey2_state::p2_write(data); m_i8243->p2_w(m_p2 & 0x0f); } template<int P> -void videopacp_state::i8243_port_w(uint8_t data) +void vpp_state::i8243_port_w(u8 data) { // P4,P5: color mix I8244 side (IC674) // P6,P7: color mix EF9340 side (IC678) @@ -457,7 +457,7 @@ void videopacp_state::i8243_port_w(uint8_t data) // EF9341 extended RAM -offs_t videopacp_state::ef934x_extram_address(offs_t offset) +offs_t vpp_state::ef934x_extram_address(offs_t offset) { u8 latch = (offset >> 12 & 0x80) | (offset >> 4 & 0x7f); u16 address = (latch & 0x1f) | (offset << 9 & 0x200) | (latch << 3 & 0x400); @@ -468,12 +468,12 @@ offs_t videopacp_state::ef934x_extram_address(offs_t offset) return address | (offset << 4 & 0x60) | (latch << 2 & 0x180); } -uint8_t videopacp_state::ef934x_extram_r(offs_t offset) +u8 vpp_state::ef934x_extram_r(offs_t offset) { return m_ef934x_extram[ef934x_extram_address(offset)]; } -void videopacp_state::ef934x_extram_w(offs_t offset, uint8_t data) +void vpp_state::ef934x_extram_w(offs_t offset, u8 data) { m_ef934x_extram[ef934x_extram_address(offset)] = data; } @@ -502,7 +502,7 @@ void odyssey2_state::odyssey2_io(address_map &map) Input Ports ******************************************************************************/ -static INPUT_PORTS_START( odyssey2 ) +static INPUT_PORTS_START( o2 ) PORT_START("KEY.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') @@ -589,8 +589,8 @@ static INPUT_PORTS_START( odyssey2 ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, odyssey2_state, reset_button, 0) INPUT_PORTS_END -static INPUT_PORTS_START( g7400 ) - PORT_INCLUDE( odyssey2 ) +static INPUT_PORTS_START( vpp ) + PORT_INCLUDE( o2 ) PORT_MODIFY("KEY.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 #") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('#') @@ -648,7 +648,7 @@ static INPUT_PORTS_START( g7400 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter _") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(10) PORT_CHAR('_') PORT_MODIFY("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ret") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ret") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) // clash with KEY.5 0x80 PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| @") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('@') @@ -664,6 +664,42 @@ static INPUT_PORTS_START( g7400 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) INPUT_PORTS_END +static INPUT_PORTS_START( o3 ) + PORT_INCLUDE( vpp ) + + PORT_MODIFY("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_MODIFY("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_MODIFY("KEY.4") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_MODIFY("KEY.5") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_MODIFY("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_PGDN) // clash with KEY.5 0x01 + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_PGUP) // clash with KEY.2 0x01 and KEY.5 0x08 + + PORT_MODIFY("KEY.7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) +INPUT_PORTS_END + /****************************************************************************** @@ -730,38 +766,38 @@ void odyssey2_state::videopacf(machine_config &config) } -void videopacp_state::g7400(machine_config &config) +void vpp_state::g7400(machine_config &config) { /* basic machine hardware */ I8048(config, m_maincpu, 5.911_MHz_XTAL); - m_maincpu->set_addrmap(AS_PROGRAM, &videopacp_state::odyssey2_mem); - m_maincpu->set_addrmap(AS_IO, &videopacp_state::odyssey2_io); - m_maincpu->p1_out_cb().set(FUNC(videopacp_state::p1_write)); - m_maincpu->p2_in_cb().set(FUNC(videopacp_state::p2_read)); - m_maincpu->p2_out_cb().set(FUNC(videopacp_state::p2_write)); - m_maincpu->bus_in_cb().set(FUNC(videopacp_state::bus_read)); + m_maincpu->set_addrmap(AS_PROGRAM, &vpp_state::odyssey2_mem); + m_maincpu->set_addrmap(AS_IO, &vpp_state::odyssey2_io); + m_maincpu->p1_out_cb().set(FUNC(vpp_state::p1_write)); + m_maincpu->p2_in_cb().set(FUNC(vpp_state::p2_read)); + m_maincpu->p2_out_cb().set(FUNC(vpp_state::p2_write)); + m_maincpu->bus_in_cb().set(FUNC(vpp_state::bus_read)); m_maincpu->t0_in_cb().set("cartslot", FUNC(o2_cart_slot_device::t0_read)); - m_maincpu->t1_in_cb().set(FUNC(videopacp_state::t1_read)); + m_maincpu->t1_in_cb().set(FUNC(vpp_state::t1_read)); m_maincpu->prog_out_cb().set(m_i8243, FUNC(i8243_device::prog_w)); /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_screen_update(FUNC(videopacp_state::screen_update)); + m_screen->set_screen_update(FUNC(vpp_state::screen_update)); m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); m_screen->set_palette("palette"); PALETTE(config, "palette", m_i8244, FUNC(i8244_device::i8244_palette), 16); I8243(config, m_i8243); - m_i8243->p4_out_cb().set(FUNC(videopacp_state::i8243_port_w<0>)); - m_i8243->p5_out_cb().set(FUNC(videopacp_state::i8243_port_w<1>)); - m_i8243->p6_out_cb().set(FUNC(videopacp_state::i8243_port_w<2>)); - m_i8243->p7_out_cb().set(FUNC(videopacp_state::i8243_port_w<3>)); + m_i8243->p4_out_cb().set(FUNC(vpp_state::i8243_port_w<0>)); + m_i8243->p5_out_cb().set(FUNC(vpp_state::i8243_port_w<1>)); + m_i8243->p6_out_cb().set(FUNC(vpp_state::i8243_port_w<2>)); + m_i8243->p7_out_cb().set(FUNC(vpp_state::i8243_port_w<3>)); EF9340_1(config, m_ef934x, (8.867_MHz_XTAL * 2) / 5, "screen"); m_ef934x->set_offsets(15, 5); - m_ef934x->read_exram().set(FUNC(videopacp_state::ef934x_extram_r)); - m_ef934x->write_exram().set(FUNC(videopacp_state::ef934x_extram_w)); + m_ef934x->read_exram().set(FUNC(vpp_state::ef934x_extram_r)); + m_ef934x->write_exram().set(FUNC(vpp_state::ef934x_extram_w)); I8245(config, m_i8244, (8.867_MHz_XTAL * 2) / 5); m_i8244->set_screen("screen"); @@ -776,7 +812,7 @@ void videopacp_state::g7400(machine_config &config) SOFTWARE_LIST(config, "cart_list").set_original("videopac").set_filter("VPP"); } -void videopacp_state::jo7400(machine_config &config) +void vpp_state::jo7400(machine_config &config) { g7400(config); @@ -785,7 +821,7 @@ void videopacp_state::jo7400(machine_config &config) m_ef934x->set_clock(3.5625_MHz_XTAL); } -void videopacp_state::odyssey3(machine_config &config) +void vpp_state::odyssey3(machine_config &config) { g7400(config); @@ -815,33 +851,33 @@ void videopacp_state::odyssey3(machine_config &config) ROM_START (videopac) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) + ROM_LOAD("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) ROM_END ROM_START (odyssey2) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) + ROM_LOAD("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) ROM_END ROM_START (videopacf) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("c52.rom", 0x0000, 0x0400, CRC(a318e8d6) SHA1(a6120aed50831c9c0d95dbdf707820f601d9452e)) + ROM_LOAD("c52.rom", 0x0000, 0x0400, CRC(a318e8d6) SHA1(a6120aed50831c9c0d95dbdf707820f601d9452e)) ROM_END ROM_START (videopacp) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("g7400.bin", 0x0000, 0x0400, CRC(e20a9f41) SHA1(5130243429b40b01a14e1304d0394b8459a6fbae)) + ROM_LOAD("g7400.bin", 0x0000, 0x0400, CRC(e20a9f41) SHA1(5130243429b40b01a14e1304d0394b8459a6fbae)) ROM_END ROM_START (jopac) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("jopac.bin", 0x0000, 0x0400, CRC(11647ca5) SHA1(54b8d2c1317628de51a85fc1c424423a986775e4)) + ROM_LOAD("jopac.bin", 0x0000, 0x0400, CRC(11647ca5) SHA1(54b8d2c1317628de51a85fc1c424423a986775e4)) ROM_END ROM_START (odyssey3) ROM_REGION(0x0400, "maincpu", 0) - ROM_LOAD ("odyssey3.bin", 0x0000, 0x0400, CRC(e2b23324) SHA1(0a38c5f2cea929d2fe0a23e5e1a60de9155815dc)) + ROM_LOAD("odyssey3.bin", 0x0000, 0x0400, CRC(e2b23324) SHA1(0a38c5f2cea929d2fe0a23e5e1a60de9155815dc)) ROM_END } // anonymous namespace @@ -852,11 +888,11 @@ ROM_END Drivers ******************************************************************************/ -// YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS -COMP( 1978, videopac, 0, 0, videopac, odyssey2, odyssey2_state, empty_init, "Philips", "Videopac G7000 (Europe)", MACHINE_SUPPORTS_SAVE ) -COMP( 1979, videopacf, videopac, 0, videopacf, odyssey2, odyssey2_state, empty_init, "Philips", "Videopac C52 (France)", MACHINE_SUPPORTS_SAVE ) -COMP( 1979, odyssey2, videopac, 0, odyssey2, odyssey2, odyssey2_state, empty_init, "Magnavox", "Odyssey 2 (US)", MACHINE_SUPPORTS_SAVE ) +// YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS +COMP( 1978, videopac, 0, 0, videopac, o2, odyssey2_state, empty_init, "Philips", "Videopac G7000 (Europe)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, videopacf, videopac, 0, videopacf, o2, odyssey2_state, empty_init, "Philips", "Videopac C52 (France)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, odyssey2, videopac, 0, odyssey2, o2, odyssey2_state, empty_init, "Magnavox", "Odyssey 2 (US)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, videopacp, 0, 0, g7400, g7400, videopacp_state, empty_init, "Philips", "Videopac+ G7400 (Europe)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, jopac, videopacp, 0, jo7400, g7400, videopacp_state, empty_init, "Philips (Brandt license)", "Jopac JO7400 (France)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, odyssey3, videopacp, 0, odyssey3, g7400, videopacp_state, empty_init, "Philips", "Odyssey 3 Command Center (US, prototype)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, videopacp, 0, 0, g7400, vpp, vpp_state, empty_init, "Philips", "Videopac+ G7400 (Europe)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, jopac, videopacp, 0, jo7400, vpp, vpp_state, empty_init, "Philips (Brandt license)", "Jopac JO7400 (France)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, odyssey3, videopacp, 0, odyssey3, o3, vpp_state, empty_init, "Philips", "Odyssey 3 Command Center (US, prototype)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp index 6ea860f4762..f024415038a 100644 --- a/src/mame/drivers/okean240.cpp +++ b/src/mame/drivers/okean240.cpp @@ -421,17 +421,14 @@ void okean240_state::machine_reset() u32 okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 gfx,ma; // ma must be 8bit - u16 x,y; - - for (y = 0; y < 256; y++) + for (u16 y = 0; y < 256; y++) { - ma = y + m_scroll; - u16 *p = &bitmap.pix16(y); + u8 const ma = y + m_scroll; // ma must be 8-bit + u16 *p = &bitmap.pix(y); - for (x = 0; x < 0x4000; x+=0x200) + for (u16 x = 0; x < 0x4000; x+=0x200) { - gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; + u8 const gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0); diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp index 82bc5696955..900f1f6960e 100644 --- a/src/mame/drivers/olyboss.cpp +++ b/src/mame/drivers/olyboss.cpp @@ -262,18 +262,15 @@ UPD3301_DRAW_CHARACTER_MEMBER( olyboss_state::olyboss_display_pixels ) data = m_vchrram[(data << 4) | lc]; else data = m_char_rom->base()[(data << 4) | lc]; - int i; //if (lc >= 8) return; if (csr) - { data = 0xff; - } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx * 8) + i) = color?0xffffff:0; + bitmap.pix(y, (sx * 8) + i) = color?0xffffff:0; data <<= 1; } } diff --git a/src/mame/drivers/ondra.cpp b/src/mame/drivers/ondra.cpp index aed29ede721..8b05048eeda 100644 --- a/src/mame/drivers/ondra.cpp +++ b/src/mame/drivers/ondra.cpp @@ -123,25 +123,24 @@ INPUT_CHANGED_MEMBER(ondra_state::nmi_button) u32 ondra_state::screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 *r = m_ram->pointer(); + u8 const *const r = m_ram->pointer(); u8 code1=0,code2=0; - int y, x, b; int Vaddr = 0x2800; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - for (y = 127; y >=0; y--) + for (int y = 127; y >=0; y--) { if (m_video_enable) { code1 = r[0xd700 + Vaddr + 0x80]; code2 = r[0xd700 + Vaddr + 0x00]; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - bitmap.pix16(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; - bitmap.pix16(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; + bitmap.pix(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; + bitmap.pix(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; } Vaddr++; } diff --git a/src/mame/drivers/orao.cpp b/src/mame/drivers/orao.cpp index d6ec83ef9b3..65cd7f81a71 100644 --- a/src/mame/drivers/orao.cpp +++ b/src/mame/drivers/orao.cpp @@ -266,7 +266,7 @@ u32 orao_state::screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, u8 code = m_vram[addr++]; for (u8 b = 0; b < 8; b++) { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + bitmap.pix(y, horpos++) = (code >> b) & 0x01; } } } diff --git a/src/mame/drivers/oric.cpp b/src/mame/drivers/oric.cpp index 3fd07906bb4..803a2feb0dd 100644 --- a/src/mame/drivers/oric.cpp +++ b/src/mame/drivers/oric.cpp @@ -235,7 +235,7 @@ uint32_t oric_state::screen_update_oric(screen_device &screen, bitmap_rgb32 &bit uint32_t fgcol = m_palette->pen_color(7); uint32_t bgcol = m_palette->pen_color(0); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for(int x=0; x<40; x++) { // Lookup the byte and, if needed, the pattern data diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 467ab3c0b7d..a1cb78acae9 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -465,7 +465,7 @@ TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) if ( y < 240 ) { uint16_t row_addr = ( y / 10 ) * 128; - uint16_t *p = &m_bitmap.pix16(y); + uint16_t *const p = &m_bitmap.pix(y); uint8_t char_line = y % 10; for ( int x = 0; x < 80; x++ ) diff --git a/src/mame/drivers/osi.cpp b/src/mame/drivers/osi.cpp index 526f0a6e745..9334a256333 100644 --- a/src/mame/drivers/osi.cpp +++ b/src/mame/drivers/osi.cpp @@ -158,11 +158,8 @@ Notes: U2C - PROTO? U6A - PROTO? -*/ - -/* - TODO: +TODO: - floppy PIA is actually a 6820 - break key @@ -177,9 +174,7 @@ Notes: - wemon? - rs232 -*/ - -/* Notes added 2012-05-11 [Robbbert] +Notes added 2012-05-11 [Robbbert] General - Added F1 key to toggle the sound on 'sb2m600b', to silence the awful screech. - Added F3 key to simulate the RESET / BREAK key on the real keyboard. @@ -202,9 +197,7 @@ Notes: not normally fitted. It appears that it would work the same as in the other systems in this driver. -*/ - -/* Notes added 2013-01-20 +Notes added 2013-01-20 Added a modified basic rom, which fixes the garbage collection problem. Try the following program with -bios 0 and -bios 1. It will work only with bios 1. You can copy/paste this code, but make sure you include the @@ -214,8 +207,24 @@ Notes: RUN PRINT FRE(0) -*/ +Keyboard notes and BTANBs: + +- Keyboards on all models are identical, except on UK101 where ^ replaces LINE FEED. + +- When run for the first time, the keyboard is in lowercase. Shift will correctly + select uppercase. Special keys do weird things, but come good when Shift pressed. + Since all input MUST be uppercase, the first thing to do is press Capslock (which + is SHIFT LOCK on the real machine). This is saved in your cfg file on exit. + +- After that, uppercase works correctly, as do the other keys. Pressing Shift will now + do odd things to the letters, and they become random symbols. + +- Natural keyboard is set up to take advantage of these oddities and get the maximum + symbols available, however lowercase is not available. Natural keyboard will only + work correctly when the SHIFT LOCK is engaged. + +*/ #include "emu.h" #include "includes/osi.h" @@ -511,17 +520,17 @@ void c1pmf_state::c1pmf_mem(address_map &map) static INPUT_PORTS_START( osi600 ) PORT_START("ROW0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_BACKSLASH) PORT_START("ROW1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('@') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') @@ -532,8 +541,8 @@ static INPUT_PORTS_START( osi600 ) PORT_START("ROW2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(']') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -541,7 +550,7 @@ static INPUT_PORTS_START( osi600 ) PORT_START("ROW3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('[') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') @@ -565,8 +574,8 @@ static INPUT_PORTS_START( osi600 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(10) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('_') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('\\') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_START("ROW6") @@ -598,14 +607,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( uk101 ) PORT_INCLUDE(osi600) - - PORT_MODIFY("ROW0") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') - PORT_MODIFY("ROW5") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_BACKSLASH) INPUT_PORTS_END /* Machine Start */ @@ -824,6 +827,7 @@ void c1p_state::c1p(machine_config &config) m_discrete->set_intf(osi600c_discrete_interface); m_discrete->add_route(ALL_OUTPUTS, "mono", 0.50); BEEP(config, "beeper", 300).add_route(ALL_OUTPUTS, "mono", 0.50); + TIMER(config, m_beep_timer).configure_generic(FUNC(c1p_state::beep_timer)); PIA6821(config, "pia_1", 0); PIA6821(config, "pia_2", 0); @@ -919,22 +923,15 @@ ROM_END /* Driver Initialization */ -void c1p_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(c1p_state::beep_timer) { - switch (id) - { - case TIMER_SETUP_BEEP: - m_beeper->set_state(0); - m_beeper->set_clock(300); - break; - default: - throw emu_fatalerror("Unknown id in c1p_state::device_timer"); - } + m_beeper->set_state(0); + m_beeper->set_clock(300); } void c1p_state::init_c1p() { - timer_set(attotime::zero, TIMER_SETUP_BEEP); + m_beep_timer->adjust(attotime::zero); } diff --git a/src/mame/drivers/othello.cpp b/src/mame/drivers/othello.cpp index b43707ae0c3..051dc56c002 100644 --- a/src/mame/drivers/othello.cpp +++ b/src/mame/drivers/othello.cpp @@ -132,9 +132,9 @@ private: MC6845_UPDATE_ROW( othello_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - const uint8_t *gfx = memregion("gfx")->base(); + uint8_t const *const gfx = memregion("gfx")->base(); for(int cx = 0; cx < x_count; ++cx) { @@ -143,7 +143,7 @@ MC6845_UPDATE_ROW( othello_state::crtc_update_row ) for(int x = 0; x < TILE_WIDTH; ++x) { - bitmap.pix32(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; + bitmap.pix(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; tmp >>= 4; } } diff --git a/src/mame/drivers/p2000t.cpp b/src/mame/drivers/p2000t.cpp index a473f49faba..9cba555622a 100644 --- a/src/mame/drivers/p2000t.cpp +++ b/src/mame/drivers/p2000t.cpp @@ -56,8 +56,8 @@ void p2000t_state::p2000t_mem(address_map &map) map(0x0000, 0x0fff).rom(); map(0x1000, 0x4fff).rom(); map(0x5000, 0x57ff).ram().share("videoram"); - map(0x5800, 0x9fff).ram(); - map(0xa000, 0xffff).noprw(); + map(0x5800, 0xdfff).ram(); + map(0xe000, 0xffff).bankrw(m_bank); } void p2000m_state::p2000m_mem(address_map &map) @@ -65,8 +65,8 @@ void p2000m_state::p2000m_mem(address_map &map) map(0x0000, 0x0fff).rom(); map(0x1000, 0x4fff).rom(); map(0x5000, 0x5fff).ram().share("videoram"); - map(0x6000, 0x9fff).ram(); - map(0xa000, 0xffff).noprw(); + map(0x6000, 0xdfff).ram(); + map(0xe000, 0xffff).bankrw(m_bank); } /* graphics output */ @@ -248,6 +248,9 @@ void p2000t_state::p2000t(machine_config &config) /* the mini cassette driver */ MDCR(config, m_mdcr, 0); + + /* internal ram */ + RAM(config, m_ram).set_default_size("16K").set_extra_options("16K,32K,48K,64K,80K,102K"); } @@ -276,6 +279,11 @@ void p2000m_state::p2000m(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); + + /* the mini cassette driver */ + MDCR(config, m_mdcr, 0); + /* internal ram */ + RAM(config, m_ram).set_default_size("16K").set_extra_options("16K,32K,48K,64K,80K,102K"); } diff --git a/src/mame/drivers/pacman.cpp b/src/mame/drivers/pacman.cpp index 56870f93846..118fb35df24 100644 --- a/src/mame/drivers/pacman.cpp +++ b/src/mame/drivers/pacman.cpp @@ -33,8 +33,6 @@ Known issues: * Mystery items in Ali Baba don't work correctly because of protection. - * Pacman Club controls need to be demultiplexed for 2-players simultaneous mode. - Also need 4-players extra inputs. Known to exist but dumps needed * Ms Pac Plus @@ -1094,6 +1092,28 @@ void pacman_state::woodpek_map(address_map &map) } +void clubpacm_state::clubpacm_map(address_map &map) +{ + map(0x0000, 0x3fff).rom(); + map(0x4000, 0x43ff).mirror(0xa000).ram().w(FUNC(clubpacm_state::pacman_videoram_w)).share("videoram"); + map(0x4400, 0x47ff).mirror(0xa000).ram().w(FUNC(clubpacm_state::pacman_colorram_w)).share("colorram"); + map(0x4800, 0x4bff).mirror(0xa000).r(FUNC(clubpacm_state::pacman_read_nop)).nopw(); + map(0x4c00, 0x4fef).mirror(0xa000).ram(); + map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram"); + map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0)); + map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w)); + map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2"); + map(0x5070, 0x507f).mirror(0xaf00).nopw(); + map(0x5080, 0x5080).mirror(0xaf3f).w(m_sublatch, FUNC(generic_latch_8_device::write)); + map(0x50c0, 0x50c0).mirror(0xaf3f).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); + map(0x5000, 0x5000).mirror(0xaf3f).portr("IN0"); + map(0x5040, 0x5040).mirror(0xaf3f).portr("IN1"); + map(0x5080, 0x5080).mirror(0xaf3f).portr("DSW1"); + map(0x50c0, 0x50c0).mirror(0xaf3f).r(m_sublatch, FUNC(generic_latch_8_device::read)); + map(0x8000, 0xbfff).rom(); +} + + void pacman_state::numcrash_map(address_map &map) { map(0x0000, 0x1fff).rom(); @@ -1718,6 +1738,86 @@ static INPUT_PORTS_START( mschamp ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) INPUT_PORTS_END +/* Pacman Club inputs are similar to Ms. Pac-Man, except: + - P1/P2 joystick inputs are multiplexed via $5004/5005 to allow 2P simultaneous play in "double command" mode + - no rack test switch + - different service mode inputs (bit 3 of DSW1 enables the test screen, bit 4 of IN1 just resets the game) + - different bonus life values and only two lives options + - difficulty switch is read, but has no effect. instead, higher difficulty is enabled in double command mode + - free play mode is bugged; game is supposed to set up pointers to $5080/50c0 in RAM for later, + but this only happens during the attract mode, which is skipped over if free play is enabled +*/ +static INPUT_PORTS_START( clubpacm ) + PORT_START("IN0") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(clubpacm_state, clubpacm_input_r) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) + + PORT_START("IN1") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(clubpacm_state, clubpacm_input_r) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) + + /* multiplexed player inputs */ + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2) + + PORT_START("DSW1") + PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x00, "Free Play (Invalid)" ) /* causes watchdog reset at title screen, see comments above */ + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x00, "3" ) + PORT_DIPSETTING( 0x04, "5" ) + PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) + PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) ) + PORT_DIPSETTING( 0x00, "40000" ) /* service mode incorrectly says 20000 */ + PORT_DIPSETTING( 0x10, "60000" ) /* service mode incorrectly says 40000 */ + PORT_DIPSETTING( 0x20, "80000" ) + PORT_DIPSETTING( 0x30, DEF_STR( None ) ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +/* Same as clubpacm, but Double Command mode is removed and normal inputs are used */ +static INPUT_PORTS_START( clubpacma ) + PORT_INCLUDE( clubpacm ) + + PORT_MODIFY("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY + + PORT_MODIFY("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL + + PORT_MODIFY("P1") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_MODIFY("P2") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + static INPUT_PORTS_START( superabc ) PORT_INCLUDE( pacman ) @@ -3643,6 +3743,18 @@ void pacman_state::woodpek(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &pacman_state::woodpek_map); } + +void clubpacm_state::clubpacm(machine_config &config) +{ + mspacman(config); + + /* basic machine hardware */ + m_maincpu->set_addrmap(AS_PROGRAM, &clubpacm_state::clubpacm_map); + + GENERIC_LATCH_8(config, m_sublatch); +} + + void pacman_state::numcrash(machine_config &config) { pacman(config); @@ -7648,7 +7760,19 @@ void pacman_state::init_pengomc1() romdata[i] = buf[i^0xff]; } -void pacman_state::init_clubpacma() +CUSTOM_INPUT_MEMBER(clubpacm_state::clubpacm_input_r) +{ + ioport_value data = 0x0f; + + if (!m_mainlatch->q5_r()) + data &= m_players[0]->read(); + if (!m_mainlatch->q4_r()) + data &= m_players[1]->read(); + + return data ^ 0x0f; +} + +void clubpacm_state::init_clubpacma() { uint8_t *rom = memregion("maincpu")->base(); @@ -7732,9 +7856,9 @@ GAME( 198?, pacmansp, puckman, pacman, pacmansp, pacman_state, empty_init, -GAME( 1989, clubpacm, 0, woodpek, mspacman, pacman_state, empty_init, ROT90, "Miky SRL", "Pacman Club / Club Lambada (Argentina)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -GAME( 1990, clubpacma, clubpacm, woodpek, mspacman, pacman_state, init_clubpacma,ROT90, "Miky SRL", "Pacman Club (set 1, Argentina)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // resets during at title screen -GAME( 1990, clubpacmb, clubpacm, woodpek, mspacman, pacman_state, empty_init, ROT90, "Miky SRL", "Pacman Club (set 2, Argentina)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // encrypted +GAME( 1989, clubpacm, 0, clubpacm,clubpacm, clubpacm_state,empty_init, ROT90, "Miky SRL", "Pacman Club / Club Lambada (Argentina)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, clubpacma, clubpacm, clubpacm,clubpacma,clubpacm_state,init_clubpacma,ROT90, "Miky SRL", "Pacman Club (set 1, Argentina)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, clubpacmb, clubpacm, clubpacm,clubpacma,clubpacm_state,empty_init, ROT90, "Miky SRL", "Pacman Club (set 2, Argentina)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) // encrypted GAME( 1985, jumpshot, 0, pacman, jumpshot, pacman_state, init_jumpshot, ROT90, "Bally Midway", "Jump Shot", MACHINE_SUPPORTS_SAVE ) GAME( 1985, jumpshotp,jumpshot, pacman, jumpshotp,pacman_state, init_jumpshot, ROT90, "Bally Midway", "Jump Shot Engineering Sample", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/panicr.cpp b/src/mame/drivers/panicr.cpp index 564e3803310..d6db1e8f59d 100644 --- a/src/mame/drivers/panicr.cpp +++ b/src/mame/drivers/panicr.cpp @@ -298,12 +298,12 @@ uint32_t panicr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y=0;y<256;y++) { - uint16_t* srcline = &m_temprender->pix16(y); - uint16_t* dstline = &bitmap.pix16(y); + uint16_t const *const srcline = &m_temprender->pix(y); + uint16_t *const dstline = &bitmap.pix(y); for (int x=0;x<256;x++) { - uint16_t dat = srcline[x]; + uint16_t const dat = srcline[x]; dstline[x] = ((dat & 0x00f) | ((dat & 0x1e0)>>0)) + 0x200; @@ -315,12 +315,12 @@ uint32_t panicr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y=0;y<256;y++) { - uint16_t* srcline = &m_temprender->pix16(y); - uint16_t* dstline = &bitmap.pix16(y); + uint16_t const *const srcline = &m_temprender->pix(y); + uint16_t *const dstline = &bitmap.pix(y); for (int x=0;x<256;x++) { - uint16_t dat = srcline[x]; + uint16_t const dat = srcline[x]; if (dat & 0x10) dstline[x] = ((dat & 0x00f) | ((dat & 0x1e0)>>0)) + 0x200; @@ -367,7 +367,7 @@ uint8_t panicr_state::collision_r(offs_t offset) uint8_t ret = 0; - uint16_t* srcline = &m_tempbitmap_1->pix16(actual_line); + uint16_t const *const srcline = &m_tempbitmap_1->pix(actual_line); ret |= (srcline[(actual_column+0)&0xff]&3) << 6; diff --git a/src/mame/drivers/partner.cpp b/src/mame/drivers/partner.cpp index 442e019c79f..c86cb285ff1 100644 --- a/src/mame/drivers/partner.cpp +++ b/src/mame/drivers/partner.cpp @@ -54,7 +54,7 @@ static INPUT_PORTS_START( partner ) PORT_START("LINE0") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) @@ -92,7 +92,7 @@ static INPUT_PORTS_START( partner ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(' ') PORT_CHAR('@') // without shift, this should be a Russian character, but we don't have yet these characters... + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -128,7 +128,7 @@ static INPUT_PORTS_START( partner ) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("LINE8") @@ -136,9 +136,9 @@ static INPUT_PORTS_START( partner ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) // Apparently in partner is Shift to switch between Latin and Russian Keyboard! - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) // This is a toggle to switch between Latin and Russian Keyboard! + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_1) // This is the real shift + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) // doesn't do anything useful PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END diff --git a/src/mame/drivers/pasha2.cpp b/src/mame/drivers/pasha2.cpp index 397354fb516..74735b174af 100644 --- a/src/mame/drivers/pasha2.cpp +++ b/src/mame/drivers/pasha2.cpp @@ -356,28 +356,25 @@ void pasha2_state::video_start() uint32_t pasha2_state::screen_update_pasha2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, count; - int color; - /* 2 512x256 bitmaps */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - count = cliprect.min_x | (y << 9); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + int count = cliprect.min_x | (y << 9); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - bitmap.pix16(y, x) = m_bitmap0[(m_vbuffer ^ 1)][count++] | 0x100; + bitmap.pix(y, x) = m_bitmap0[(m_vbuffer ^ 1)][count++] | 0x100; } } - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - count = cliprect.min_x | (y << 9); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + int count = cliprect.min_x | (y << 9); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - color = m_bitmap1[(m_vbuffer ^ 1)][count++]; + int color = m_bitmap1[(m_vbuffer ^ 1)][count++]; if (color != 0) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/drivers/paso1600.cpp b/src/mame/drivers/paso1600.cpp index 1f7b32468d3..0c156fdf7db 100644 --- a/src/mame/drivers/paso1600.cpp +++ b/src/mame/drivers/paso1600.cpp @@ -92,10 +92,7 @@ private: uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int xi,yi; - #if 0 - uint32_t count; +#if 0 static int test_x; if(machine().input().code_pressed(KEYCODE_Z)) @@ -106,49 +103,48 @@ uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_in popmessage("%d",test_x); - count = 0; + uint32_t count = 0; - for(y=0;y<475;y++) + for(int y=0;y<475;y++) { count &= 0xffff; - for(x=0;x<test_x/16;x++) + for(int x=0;x<test_x/16;x++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { int pen = (m_p_gvram[count] >> xi) & 1; if(y < 475 && x*16+xi < 640) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(pen); + bitmap.pix(y, x*16+xi) = m_palette->pen(pen); } count++; } } - #endif +#endif // popmessage("%d %d %d",mc6845_h_display,mc6845_v_display,mc6845_tile_height); - for(y=0;y<mc6845_v_display;y++) + for(int y=0;y<mc6845_v_display;y++) { - for(x=0;x<mc6845_h_display;x++) + for(int x=0;x<mc6845_h_display;x++) { int tile = m_p_vram[x+y*mc6845_h_display] & 0xff; int color = (m_p_vram[x+y*mc6845_h_display] & 0x700) >> 8; - int pen; - for(yi=0;yi<19;yi++) + for(int yi=0;yi<19;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; + int pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; if(yi & 0x10) pen = -1; if(pen != -1) if(y*19 < 475 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*19+yi, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y*19+yi, x*8+xi) = m_palette->pen(pen); } } } @@ -156,15 +152,15 @@ uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_in /* quick and dirty way to do the cursor */ if(0) - for(yi=0;yi<mc6845_tile_height;yi++) + for(int yi=0;yi<mc6845_tile_height;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { if((mc6845_cursor_y_start & 0x60) != 0x20 && mc6845_h_display) { - x = mc6845_cursor_addr % mc6845_h_display; - y = mc6845_cursor_addr / mc6845_h_display; - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(7); + int x = mc6845_cursor_addr % mc6845_h_display; + int y = mc6845_cursor_addr / mc6845_h_display; + bitmap.pix(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(7); } } } diff --git a/src/mame/drivers/pasogo.cpp b/src/mame/drivers/pasogo.cpp index dd08e9c4609..10092897b24 100644 --- a/src/mame/drivers/pasogo.cpp +++ b/src/mame/drivers/pasogo.cpp @@ -503,23 +503,22 @@ INPUT_CHANGED_MEMBER(pasogo_state::contrast) uint32_t pasogo_state::screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *vram = (uint8_t *)m_vram.target(); - int x, y; - for (y=0; y<240; y++) + uint8_t const *const vram = (uint8_t *)m_vram.target(); + for (int y=0; y<240; y++) { - for (x=0; x<(320/8); x++) + for (int x=0; x<(320/8); x++) { - int a = (y & 3) * 0x2000; - uint8_t d1 = vram[a + (y >> 2) * 80 + x]; - uint16_t *line = &bitmap.pix16(y, x << 3); - *line++ = ((d1 >> 7) & 1); - *line++ = ((d1 >> 6) & 1); - *line++ = ((d1 >> 5) & 1); - *line++ = ((d1 >> 4) & 1); - *line++ = ((d1 >> 3) & 1); - *line++ = ((d1 >> 2) & 1); - *line++ = ((d1 >> 1) & 1); - *line++ = ((d1 >> 0) & 1); + int const a = (y & 3) * 0x2000; + uint8_t const d1 = vram[a + (y >> 2) * 80 + x]; + uint16_t *line = &bitmap.pix(y, x << 3); + *line++ = BIT(d1, 7); + *line++ = BIT(d1, 6); + *line++ = BIT(d1, 5); + *line++ = BIT(d1, 4); + *line++ = BIT(d1, 3); + *line++ = BIT(d1, 2); + *line++ = BIT(d1, 1); + *line++ = BIT(d1, 0); } } return 0; diff --git a/src/mame/drivers/pasopia.cpp b/src/mame/drivers/pasopia.cpp index f0715ba3ac5..af79aa49211 100644 --- a/src/mame/drivers/pasopia.cpp +++ b/src/mame/drivers/pasopia.cpp @@ -125,9 +125,9 @@ TIMER_CALLBACK_MEMBER( pasopia_state::pio_timer ) MC6845_UPDATE_ROW( pasopia_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 fg=7,bg=0; // colours need to be determined - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (u16 x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp index 3dd0dabb6b8..b38f32be17b 100644 --- a/src/mame/drivers/pasopia7.cpp +++ b/src/mame/drivers/pasopia7.cpp @@ -191,15 +191,13 @@ void pasopia7_state::draw_cg4_line(bitmap_rgb32 &bitmap,int y,int yi,int width,i { for(int xi=0;xi<8;xi++) { - int pen_b,pen_r,pen_g,color; + int pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; + int pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; + int pen_g = 0;//(m_vram[count+yi+0x8000]>>(7-xi)) & 1; - pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; - pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = 0;//(m_vram[count+yi+0x8000]>>(7-xi)) & 1; + int color = pen_g<<2 | pen_r<<1 | pen_b<<0; - color = pen_g<<2 | pen_r<<1 | pen_b<<0; - - bitmap.pix32(y, x+xi) = m_palette->pen(color); + bitmap.pix(y, x+xi) = m_palette->pen(color); } count+=8; } @@ -217,7 +215,7 @@ void pasopia7_state::draw_tv_line(bitmap_rgb32 &bitmap,int y,int yi,int width,in { int pen = ((m_font_rom[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } // draw cursor @@ -225,7 +223,7 @@ void pasopia7_state::draw_tv_line(bitmap_rgb32 &bitmap,int y,int yi,int width,in { for(int xc=0;xc<8;xc++) { - bitmap.pix32(y, x*8+xc) = m_palette->pen(7); + bitmap.pix(y, x*8+xc) = m_palette->pen(7); } } count+=8; @@ -243,15 +241,13 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { for(int xi=0;xi<8;xi++) { - int pen,pen_b,pen_r,pen_g; - - pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; - pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = (m_vram[count+yi+0x8000]>>(7-xi)) & 1; + int pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; + int pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; + int pen_g = (m_vram[count+yi+0x8000]>>(7-xi)) & 1; - pen = pen_g<<2 | pen_r<<1 | pen_b<<0; + int pen = pen_g<<2 | pen_r<<1 | pen_b<<0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } } else @@ -262,7 +258,7 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { int pen = ((m_font_rom[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } } @@ -271,7 +267,7 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { for(int xc=0;xc<8;xc++) { - bitmap.pix32(y, x*8+xc) = m_palette->pen(7); + bitmap.pix(y, x*8+xc) = m_palette->pen(7); } } diff --git a/src/mame/drivers/pc100.cpp b/src/mame/drivers/pc100.cpp index c371415bc86..8cefae88466 100644 --- a/src/mame/drivers/pc100.cpp +++ b/src/mame/drivers/pc100.cpp @@ -164,40 +164,35 @@ void pc100_state::video_start() uint32_t pc100_state::screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int count; - int xi; - int dot; - int pen[4],pen_i; + int count = (m_crtc.vstart + 0x20) * 0x40; - count = ((m_crtc.vstart + 0x20) * 0x40); - - for(y=0;y<512;y++) + for(int y=0;y<512;y++) { count &= 0xffff; - for(x=0;x<1024/16;x++) + for(int x=0;x<1024/16;x++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { if(m_crtc.cmd != 0xffff) { - for(pen_i=0;pen_i<4;pen_i++) + int pen[4]; + for(int pen_i=0;pen_i<4;pen_i++) pen[pen_i] = (m_vram[count+pen_i*0x10000] >> xi) & 1; - dot = 0; - for(pen_i=0;pen_i<4;pen_i++) + int dot = 0; + for(int pen_i=0;pen_i<4;pen_i++) dot |= pen[pen_i]<<pen_i; if(y < 512 && x*16+xi < 768) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot); + bitmap.pix(y, x*16+xi) = m_palette->pen(dot); } else { - dot = (m_vram[count] >> xi) & 1; + int dot = (m_vram[count] >> xi) & 1; if(y < 512 && x*16+xi < 768) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot ? 15 : 0); + bitmap.pix(y, x*16+xi) = m_palette->pen(dot ? 15 : 0); } } diff --git a/src/mame/drivers/pc1500.cpp b/src/mame/drivers/pc1500.cpp index af40cda61af..09e63e71504 100644 --- a/src/mame/drivers/pc1500.cpp +++ b/src/mame/drivers/pc1500.cpp @@ -107,9 +107,9 @@ uint32_t pc1500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int b=0; b<8; b++) { if(b<4) - bitmap.pix16(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); + bitmap.pix(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); else - bitmap.pix16(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); + bitmap.pix(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); } } diff --git a/src/mame/drivers/pc1512.cpp b/src/mame/drivers/pc1512.cpp index 172db10ea9f..0ac54756ba3 100644 --- a/src/mame/drivers/pc1512.cpp +++ b/src/mame/drivers/pc1512.cpp @@ -995,12 +995,7 @@ void pc1512_base_state::drive_select_w(uint8_t data) img->mon_w((data & 0x03) == n && BIT(data, n + 4) ? 0 : 1); } - if (m_dreset != BIT(data, 2)) - { - m_dreset = BIT(data, 2); - m_fdc->soft_reset(); - } - + m_fdc->reset_w(!BIT(data, 2)); m_nden = BIT(data, 3); update_fdc_int(); update_fdc_drq(); @@ -1091,7 +1086,6 @@ void pc1512_base_state::machine_start() save_item(NAME(m_nden)); save_item(NAME(m_dint)); save_item(NAME(m_ddrq)); - save_item(NAME(m_dreset)); save_item(NAME(m_neop)); save_item(NAME(m_ack_int_enable)); save_item(NAME(m_centronics_ack)); diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp index d79cb645a09..fdf7b603a96 100644 --- a/src/mame/drivers/pc2000.cpp +++ b/src/mame/drivers/pc2000.cpp @@ -277,7 +277,7 @@ int gl3000s_state::sed1520_screen_update(bitmap_ind16 &bitmap, const rectangle & int py = 8 + y*8 + yi; if (cliprect.contains(px, py)) - bitmap.pix16(py, px) = (vram[addr % 0x140] >> yi) & 1; + bitmap.pix(py, px) = (vram[addr % 0x140] >> yi) & 1; } row_pos++; @@ -336,7 +336,7 @@ SED1520_UPDATE_CB(gl3000s_state::screen_update_left) else if (x < 74 && yi < 7) { int cx = x - 59; - bitmap.pix16(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; + bitmap.pix(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; } } } @@ -413,7 +413,7 @@ HD44780_PIXEL_UPDATE(pc1000_state::pc1000_pixel_update) for (int i=0; i<20; i++) if (pos == layout[i]) { - bitmap.pix16((line * 9) + y, (i * 6) + x) = state; + bitmap.pix((line * 9) + y, (i * 6) + x) = state; break; } } @@ -962,7 +962,7 @@ HD44780_PIXEL_UPDATE(gl4004_state::gl4000_pixel_update) }; uint8_t char_pos = gl4000_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + bitmap.pix((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; } } diff --git a/src/mame/drivers/pc4.cpp b/src/mame/drivers/pc4.cpp index 64a154884ad..1f2e19ee4fd 100644 --- a/src/mame/drivers/pc4.cpp +++ b/src/mame/drivers/pc4.cpp @@ -21,6 +21,9 @@ http://www.euskalnet.net/ingepal/images/Vtech_Laser_PC4_1988.jpg http://www.oldcomputermuseum.com/laser_pc4.html + Some characters are corrupted in MAME (ok on real machine). These + are ~ 4 \ @ + ****************************************************************************/ @@ -86,13 +89,13 @@ void pc4_state::pc4_io(address_map &map) static INPUT_PORTS_START( pc4 ) PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('|') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE1") @@ -102,43 +105,43 @@ static INPUT_PORTS_START( pc4 ) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR('`') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE2") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('?') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR('<') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_CHAR('~') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE3") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHAR('_') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR('>') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('&') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE4") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL),8) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('\\') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE5") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') @@ -148,7 +151,7 @@ static INPUT_PORTS_START( pc4 ) PORT_START("LINE6") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') @@ -156,9 +159,9 @@ static INPUT_PORTS_START( pc4 ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("LINE7") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NUMLOck") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') diff --git a/src/mame/drivers/pc8001.cpp b/src/mame/drivers/pc8001.cpp index 5cf12026495..a7478090cb7 100644 --- a/src/mame/drivers/pc8001.cpp +++ b/src/mame/drivers/pc8001.cpp @@ -307,9 +307,9 @@ static INPUT_PORTS_START( pc8001 ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0xA5) PORT_CHAR('|') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0xA5) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') @@ -331,27 +331,27 @@ static INPUT_PORTS_START( pc8001 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(" _") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0) PORT_CHAR('_') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(" _") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0xff) PORT_CHAR('_') PORT_START("Y8") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Clr Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(F7)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_LCONTROL) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_LCONTROL) PORT_TOGGLE PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_START("Y9") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(3) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) PORT_START("DSW1") INPUT_PORTS_END @@ -373,18 +373,17 @@ static const rgb_t PALETTE_PC8001[] = UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) { uint8_t data = m_char_rom->base()[(cc << 3) | lc]; - int i; if (lc >= 8) return; if (csr) data = 0xff; if (m_width80) { - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; data <<= 1; } @@ -393,12 +392,12 @@ UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) { if (sx % 2) return; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; - bitmap.pix32(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; data <<= 1; } diff --git a/src/mame/drivers/pc8801.cpp b/src/mame/drivers/pc8801.cpp index 9bb9f7b3e36..9683fe3b434 100644 --- a/src/mame/drivers/pc8801.cpp +++ b/src/mame/drivers/pc8801.cpp @@ -311,25 +311,18 @@ void pc8801_state::video_start() void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) { - int x,y,xi; - uint32_t count; - uint16_t y_size; - uint16_t y_double; + uint32_t count = 0; - count = 0; + uint16_t y_double = (pc8801_pixel_clock()); + uint16_t y_size = (y_double+1) * 200; - y_double = (pc8801_pixel_clock()); - y_size = (y_double+1) * 200; - - for(y=0;y<y_size;y+=(y_double+1)) + for(int y=0;y<y_size;y+=(y_double+1)) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = 0; + int pen = 0; /* note: layer masking doesn't occur in 3bpp mode, Bug Attack relies on this */ pen |= ((m_gvram[count+0x0000] >> (7-xi)) & 1) << 0; @@ -339,15 +332,15 @@ void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &clipre if(y_double) { if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y+0, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y+0, x+xi) = m_palette->pen(pen & 7); if(cliprect.contains(x+xi, y+1)) - bitmap.pix16(y+1, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y+1, x+xi) = m_palette->pen(pen & 7); } else { if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y, x+xi) = m_palette->pen(pen & 7); } } @@ -358,42 +351,35 @@ void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &clipre void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) { - int x,y,xi; - uint32_t count; - uint8_t color; - uint8_t is_cursor; - - count = 0; - color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; - is_cursor = 0; + uint32_t count = 0; + uint8_t color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; + uint8_t is_cursor = 0; - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { if(!(m_gfx_ctrl & 1)) is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); + int pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); if(is_cursor) pen^=1; if((m_gfx_ctrl & 1)) { if(cliprect.contains(x+xi, y*2+0)) - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); if(cliprect.contains(x+xi, y*2+1)) - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); } else { if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y, x+xi) = m_palette->pen(pen ? color : 0); } } @@ -405,23 +391,21 @@ void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &clipre { count = 0; - for(y=200;y<400;y++) + for(int y=200;y<400;y++) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { if(!(m_gfx_ctrl & 1)) is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); + int pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); if(is_cursor) pen^=1; if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? 7 : 0); + bitmap.pix(y, x+xi) = m_palette->pen(pen ? 7 : 0); } count++; @@ -496,84 +480,73 @@ uint8_t pc8801_state::extract_text_attribute(uint32_t address,int x, uint8_t wid void pc8801_state::pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,uint8_t gfx_mode,uint8_t reverse,uint8_t secret,uint8_t blink,uint8_t upper,uint8_t lower,int y_size,int width, uint8_t non_special) { - int xi,yi; uint8_t *vram = m_work_ram.get(); - uint8_t is_cursor; - uint8_t y_height, y_double; - uint8_t y_step; - y_height = lines_per_char; - y_double = (pc8801_pixel_clock()); - y_step = (non_special) ? 80 : 120; // trusted by Elthlead - is_cursor = 0; + uint8_t y_height = lines_per_char; + uint8_t y_double = (pc8801_pixel_clock()); + uint8_t y_step = (non_special) ? 80 : 120; // trusted by Elthlead + uint8_t is_cursor = 0; - for(yi=0;yi<y_height;yi++) + for(int yi=0;yi<y_height;yi++) { if(m_gfx_ctrl & 1) is_cursor = calc_cursor_pos(x,y,yi); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - int tile; - int color; + int tile = vram[x+(y*y_step)+m_dma_address[2]]; - { - tile = vram[x+(y*y_step)+m_dma_address[2]]; + int res_x = x*8+xi*(width+1); + int res_y = y*y_height+yi; - res_x = x*8+xi*(width+1); - res_y = y*y_height+yi; + if(!m_screen->visible_area().contains(res_x, res_y)) + continue; - if(!m_screen->visible_area().contains(res_x, res_y)) - continue; + int color; + if(gfx_mode) + { + uint8_t mask; - if(gfx_mode) - { - uint8_t mask; + mask = (xi & 4) ? 0x10 : 0x01; + mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); + color = (tile & mask) ? pal : -1; + } + else + { + uint8_t blink_mask = 0; + if(blink && ((m_screen->frame_number() / blink_speed) & 3) == 1) + blink_mask = 1; - mask = (xi & 4) ? 0x10 : 0x01; - mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); - color = (tile & mask) ? pal : -1; - } + uint8_t char_data; + if(yi >= (1 << (y_double+3)) || secret || blink_mask) + char_data = 0; else - { - uint8_t char_data; - uint8_t blink_mask; - - blink_mask = 0; - if(blink && ((m_screen->frame_number() / blink_speed) & 3) == 1) - blink_mask = 1; - - if(yi >= (1 << (y_double+3)) || secret || blink_mask) - char_data = 0; - else - char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; + char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; - if(yi == 0 && upper) - char_data = 1; + if(yi == 0 && upper) + char_data = 1; - if(yi == y_height && lower) - char_data = 1; + if(yi == y_height && lower) + char_data = 1; - if(is_cursor) - char_data^=1; + if(is_cursor) + char_data^=1; - if(reverse) - char_data^=1; + if(reverse) + char_data^=1; - color = char_data ? pal : -1; - } + color = char_data ? pal : -1; + } - if(color != -1) + if(color != -1) + { + bitmap.pix(res_y, res_x) = m_palette->pen(color); + if(width) { - bitmap.pix16(res_y, res_x) = m_palette->pen(color); - if(width) - { - if(!m_screen->visible_area().contains(res_x+1, res_y)) - continue; - - bitmap.pix16(res_y, res_x+1) = m_palette->pen(color); - } + if(!m_screen->visible_area().contains(res_x+1, res_y)) + continue; + + bitmap.pix(res_y, res_x+1) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp index 1f6cc8ea76c..a532443e380 100644 --- a/src/mame/drivers/pc88va.cpp +++ b/src/mame/drivers/pc88va.cpp @@ -39,26 +39,22 @@ void pc88va_state::video_start() void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *tvram = m_tvram; - int offs,i; + uint16_t const *const tvram = m_tvram; - offs = m_tsp.spr_offset; - for(i=0;i<(0x100);i+=(8)) + int offs = m_tsp.spr_offset; + for(int i=0;i<(0x100);i+=(8)) { - int xp,yp,sw,md,xsize,ysize,spda,fg_col,bc; - int x_i,y_i,x_s; int spr_count; - int pen; - - ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; - sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; - yp = (tvram[(offs + i + 0) / 2] & 0x1ff); - xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; - md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; - xp = (tvram[(offs + i + 2) / 2] & 0x3ff); - spda = (tvram[(offs + i + 4) / 2] & 0xffff); - fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; - bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; + + int ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; + int sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; + int yp = (tvram[(offs + i + 0) / 2] & 0x1ff); + int xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; + int md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; + int xp = (tvram[(offs + i + 2) / 2] & 0x3ff); + int spda = (tvram[(offs + i + 4) / 2] & 0xffff); + int fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; + int bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; if(!sw) continue; @@ -86,18 +82,18 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) spr_count = 0; - for(y_i=0;y_i<ysize;y_i++) + for(int y_i=0;y_i<ysize;y_i++) { - for(x_i=0;x_i<xsize;x_i+=16) + for(int x_i=0;x_i<xsize;x_i+=16) { - for(x_s=0;x_s<16;x_s++) + for(int x_s=0;x_s<16;x_s++) { - pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1; + int pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1; pen = pen & 1 ? fg_col : (bc) ? 8 : -1; if(pen != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + bitmap.pix(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); } spr_count+=2; } @@ -113,16 +109,16 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) spr_count = 0; - for(y_i=0;y_i<ysize;y_i++) + for(int y_i=0;y_i<ysize;y_i++) { - for(x_i=0;x_i<xsize;x_i+=2) + for(int x_i=0;x_i<xsize;x_i+=2) { - for(x_s=0;x_s<2;x_s++) + for(int x_s=0;x_s<2;x_s++) { - pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf; + int pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf; //if(bc != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + bitmap.pix(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); } spr_count+=2; } @@ -148,41 +144,31 @@ uint32_t pc88va_state::calc_kanji_rom_addr(uint8_t jis1,uint8_t jis2,int x,int y void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *tvram = m_tvram; + uint16_t const *const tvram = m_tvram; // TODO: PCG select won't work with this arrangement - uint8_t *kanji = memregion("kanji")->base(); - int xi,yi; - int x,y; - int res_x,res_y; - uint16_t lr_half_gfx; - uint8_t jis1,jis2; - uint32_t count; - uint32_t tile_num; - uint16_t attr; - uint8_t attr_mode; - uint8_t fg_col,bg_col,secret,reverse; - //uint8_t blink,dwidc,dwid,uline,hline; - uint8_t screen_fg_col,screen_bg_col; - - count = tvram[m_tsp.tvram_vreg_offset/2]; - - attr_mode = tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x1f; + uint8_t const *const kanji = memregion("kanji")->base(); + + uint32_t count = tvram[m_tsp.tvram_vreg_offset/2]; + + uint8_t attr_mode = tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x1f; /* Note: bug in docs has the following two reversed */ - screen_fg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0xf000) >> 12; - screen_bg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x0f00) >> 8; + uint8_t screen_fg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0xf000) >> 12; + uint8_t screen_bg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x0f00) >> 8; - for(y=0;y<13;y++) + for(int y=0;y<13;y++) { - for(x=0;x<80;x++) + for(int x=0;x<80;x++) { - jis1 = (tvram[count] & 0x7f) + 0x20; - jis2 = (tvram[count] & 0x7f00) >> 8; - lr_half_gfx = ((tvram[count] & 0x8000) >> 15); + uint8_t jis1 = (tvram[count] & 0x7f) + 0x20; + uint8_t jis2 = (tvram[count] & 0x7f00) >> 8; + uint16_t lr_half_gfx = ((tvram[count] & 0x8000) >> 15); - tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); + uint32_t tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); - attr = (tvram[count+(m_tsp.attr_offset/2)] & 0x00ff); + uint16_t attr = (tvram[count+(m_tsp.attr_offset/2)] & 0x00ff); + uint8_t fg_col,bg_col,secret,reverse; + //uint8_t blink,dwidc,dwid,uline,hline; fg_col = bg_col = reverse = secret = 0; //blink = dwidc = dwid = uline = hline = 0; switch(attr_mode) @@ -296,19 +282,17 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) return; } - for(yi=0;yi<16;yi++) + for(int yi=0;yi<16;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - res_x = x*8+xi; - res_y = y*16+yi; + int res_x = x*8+xi; + int res_y = y*16+yi; if(!cliprect.contains(res_x, res_y)) continue; - pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; + int pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; if(reverse) pen = pen & 1 ? bg_col : fg_col; @@ -318,7 +302,7 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) if(secret) { pen = 0; } //hide text if(pen != -1) //transparent - bitmap.pix32(res_y, res_x) = m_palette->pen(pen); + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 55edd570c65..558b06b916a 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -439,11 +439,9 @@ uint8_t pc9801_state::fdc_2hd_ctrl_r() void pc9801_state::fdc_2hd_ctrl_w(uint8_t data) { //logerror("%02x ctrl\n",data); - if(((m_fdc_2hd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2hd->soft_reset(); + m_fdc_2hd->reset_w(BIT(data, 7)); m_fdc_2hd_ctrl = data; - if(data & 0x40) { m_fdc_2hd->set_ready_line_connected(0); @@ -475,8 +473,7 @@ uint8_t pc9801_state::fdc_2dd_ctrl_r() void pc9801_state::fdc_2dd_ctrl_w(uint8_t data) { logerror("%02x ctrl\n",data); - if(((m_fdc_2dd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2dd->soft_reset(); + m_fdc_2dd->reset_w(BIT(data, 7)); m_fdc_2dd_ctrl = data; m_fdc_2dd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); diff --git a/src/mame/drivers/pce220.cpp b/src/mame/drivers/pce220.cpp index e2b08ae5149..fddfa2404ae 100644 --- a/src/mame/drivers/pce220.cpp +++ b/src/mame/drivers/pce220.cpp @@ -161,11 +161,11 @@ uint32_t pce220_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { //first 12 columns int panel1_addr = ((m_lcd_start_line>>3) + y)*0x40 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; + bitmap.pix(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; //last 12 columns int panel2_addr = ((m_lcd_start_line>>3) + y + 4)*0x40 + (59-row_pos); - bitmap.pix16(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; + bitmap.pix(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; } row_pos++; @@ -245,7 +245,7 @@ uint32_t pcg850v_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int yi = 0; yi < 8; yi++) { int addr = ((m_lcd_start_line>>3) + y)*0x100 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; + bitmap.pix(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; } row_pos++; diff --git a/src/mame/drivers/pcm.cpp b/src/mame/drivers/pcm.cpp index db992da93bf..a68ab28fcba 100644 --- a/src/mame/drivers/pcm.cpp +++ b/src/mame/drivers/pcm.cpp @@ -241,20 +241,19 @@ void pcm_state::machine_reset() u32 pcm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0x400,x; + u16 sy=0,ma=0x400; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - chr = m_vram[x]; + u8 const chr = m_vram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + u8 const gfx = m_p_chargen[(chr<<3) | ra]; *p++ = BIT(gfx, 7); *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp index e4d294675f2..9bd5cc80969 100644 --- a/src/mame/drivers/pcw.cpp +++ b/src/mame/drivers/pcw.cpp @@ -641,7 +641,7 @@ void pcw_state::pcw_printer_fire_pins(uint16_t pins) { line = x % PCW_PRINTER_HEIGHT; if((pins & 0x01) == 0) - m_prn_output->pix16(line, m_printer_headpos) = (uint16_t)(pins & 0x01); + m_prn_output->pix(line, m_printer_headpos) = (uint16_t)(pins & 0x01); pins >>= 1; } // if(m_printer_headpos < PCW_PRINTER_WIDTH) @@ -1049,7 +1049,7 @@ b0: f4 exit del> = 0 8 6 4 1 f6 &3FF0 &3FF1 &3FF2 &3FF3 &3FF4 &3FF5 &3FF6 &3FF7 &3FF8 &3FF9 &3FFA 2008-05 FP: -Small note about atural keyboard: currently, +Small note about Natural keyboard: currently, - "Paste" is mapped to 'F9' - "Exit" is mapped to 'F10' - "Ptr" is mapped to 'Print Screen' @@ -1077,7 +1077,7 @@ static INPUT_PORTS_START(pcw) PORT_START("LINE1") /* 0x03ff1 */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Exit") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(F10)) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ptr") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ptr") //PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(PRTSCR)) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cut") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) @@ -1092,7 +1092,7 @@ static INPUT_PORTS_START(pcw) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('>') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, 0xff, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR(189) PORT_CHAR('@') // (½ @) between slash and rshift PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[+]") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) // 1st key on the left from 'Spacebar' PORT_START("LINE3") /* 0x03ff3 */ diff --git a/src/mame/drivers/pcxt.cpp b/src/mame/drivers/pcxt.cpp index c180067a72e..dd25820e008 100644 --- a/src/mame/drivers/pcxt.cpp +++ b/src/mame/drivers/pcxt.cpp @@ -199,32 +199,27 @@ uint8_t isa8_cga_tetriskr_device::bg_bank_r() uint32_t isa8_cga_tetriskr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - int yi; - const uint8_t *bg_rom = memregion("gfx2")->base(); + uint8_t const *const bg_rom = memregion("gfx2")->base(); //popmessage("%04x",m_start_offs); bitmap.fill(rgb_t::black(), cliprect); - for(y=0;y<200/8;y++) + for(int y=0;y<200/8;y++) { - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(x=0;x<320/8;x++) + for(int x=0;x<320/8;x++) { - uint8_t color; - int xi,pen_i; - - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - color = 0; + uint8_t color = 0; /* TODO: first byte seems bogus? */ - for(pen_i = 0;pen_i<4;pen_i++) + for(int pen_i = 0;pen_i<4;pen_i++) color |= ((bg_rom[y*320/8+x+(pen_i*0x20000)+yi*0x400+m_bg_bank*0x2000+1] >> (7-xi)) & 1) << pen_i; if(cliprect.contains(x*8+xi, y*8+yi)) - bitmap.pix32(y*8+yi, x*8+xi) = m_palette->pen(color); + bitmap.pix(y*8+yi, x*8+xi) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/pda600.cpp b/src/mame/drivers/pda600.cpp index 31d0054973a..3435da028de 100644 --- a/src/mame/drivers/pda600.cpp +++ b/src/mame/drivers/pda600.cpp @@ -132,7 +132,7 @@ uint32_t pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int px=0; px<8; px++) { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + bitmap.pix(y, (x * 8) + px) = BIT(data, 7); data <<= 1; } } diff --git a/src/mame/drivers/pdp1.cpp b/src/mame/drivers/pdp1.cpp index a659ee9ed8f..384c86596b9 100644 --- a/src/mame/drivers/pdp1.cpp +++ b/src/mame/drivers/pdp1.cpp @@ -614,6 +614,7 @@ pdp1_readtape_image_device::pdp1_readtape_image_device(const machine_config &mco , device_image_interface(mconfig, *this) , m_maincpu(*this, "^maincpu") , m_st_ptr(*this) + , m_timer(nullptr) { } @@ -637,6 +638,7 @@ pdp1_punchtape_image_device::pdp1_punchtape_image_device(const machine_config &m , device_image_interface(mconfig, *this) , m_maincpu(*this, "^maincpu") , m_st_ptp(*this) + , m_timer(nullptr) { } @@ -661,6 +663,7 @@ pdp1_typewriter_device::pdp1_typewriter_device(const machine_config &mconfig, co , m_twr(*this, "^TWR.%u", 0) , m_st_tyo(*this) , m_st_tyi(*this) + , m_tyo_timer(nullptr) { } @@ -673,6 +676,8 @@ void pdp1_typewriter_device::device_resolve_objects() void pdp1_typewriter_device::device_start() { m_tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_typewriter_device::tyo_callback),this)); + + m_color = m_pos = m_case_shift = 0; } @@ -1764,7 +1769,7 @@ void pdp1_state::pdp1(machine_config &config) /* external iot handlers. 00, 50 to 56 and 74 are internal to the cpu core. */ /* I put a ? when the source is the handbook, since a) I have used the maintenance manual as the primary source (as it goes more into details) b) the handbook and the maintenance - manual occasionnally contradict each other. */ + manual occasionally contradict each other. */ /* (iot) rpa rpb tyo tyi ppa ppb dpy */ /* spacewar */ /* lag glf?/jsp? gpl?/gpr?/gcf? */ diff --git a/src/mame/drivers/pdp11.cpp b/src/mame/drivers/pdp11.cpp index 78ced764cb8..04464da0d13 100644 --- a/src/mame/drivers/pdp11.cpp +++ b/src/mame/drivers/pdp11.cpp @@ -372,7 +372,7 @@ void pdp11_state::kbd_put(u8 data) void pdp11_state::pdp11(machine_config &config) { /* basic machine hardware */ - T11(config, m_maincpu, XTAL(4'000'000)); // Need proper CPU here + T11(config, m_maincpu, 4'000'000); // Need proper CPU here m_maincpu->set_initial_mode(6 << 13); m_maincpu->set_addrmap(AS_PROGRAM, &pdp11_state::pdp11_mem); @@ -398,7 +398,7 @@ void pdp11_state::pdp11ub2(machine_config &config) void pdp11_state::pdp11qb(machine_config &config) { - pdp11(config); + pdp11(config); // FIXME: MXV11-B requires a F-11 or J-11 CPU MCFG_MACHINE_RESET_OVERRIDE(pdp11_state,pdp11qb) m_maincpu->set_initial_mode(0 << 13); @@ -509,8 +509,8 @@ ROM_END /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( ????, pdp11ub, 0, 0, pdp11, pdp11, pdp11_state, empty_init, "Digital Equipment Corporation", "PDP-11 [Unibus](M9301-YA)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( ????, pdp11ub2, pdp11ub, 0, pdp11ub2, pdp11, pdp11_state, empty_init, "Digital Equipment Corporation", "PDP-11 [Unibus](M9312)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( ????, pdp11qb, pdp11ub, 0, pdp11qb, pdp11, pdp11_state, empty_init, "Digital Equipment Corporation", "PDP-11 [Q-BUS] (M7195 - MXV11)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1987, sms1000, 0, 0, sms1000, pdp11, pdp11_state, empty_init, "Scientific Micro Systems", "SMS-1000", MACHINE_IS_SKELETON ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 197?, pdp11ub, 0, 0, pdp11, pdp11, pdp11_state, empty_init, "Digital Equipment Corporation", "PDP-11 [Unibus](M9301-YA)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 197?, pdp11ub2, pdp11ub, 0, pdp11ub2, pdp11, pdp11_state, empty_init, "Digital Equipment Corporation", "PDP-11 [Unibus](M9312)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 198?, pdp11qb, pdp11ub, 0, pdp11qb, pdp11, pdp11_state, empty_init, "Digital Equipment Corporation", "PDP-11 [Q-BUS] (M7195 - MXV11-B)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1987, sms1000, 0, 0, sms1000, pdp11, pdp11_state, empty_init, "Scientific Micro Systems", "SMS-1000", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp index b687074ea1f..55eae153890 100644 --- a/src/mame/drivers/pegasus.cpp +++ b/src/mame/drivers/pegasus.cpp @@ -314,20 +314,19 @@ static const u8 mcm6571a_shift[] = u32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; bool pcg_mode = BIT(m_control_bits, 1); - for(y = 0; y < 16; y++ ) + for(u8 y = 0; y < 16; y++ ) { - for(ra = 0; ra < 16; ra++ ) + for(u8 ra = 0; ra < 16; ra++ ) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for(x = ma; x < ma + 32; x++ ) + for(u16 x = ma; x < ma + 32; x++ ) { - inv = 0xff; - chr = m_vram[x]; + u8 inv = 0xff; + u8 chr = m_vram[x]; if (BIT(chr, 7)) { @@ -335,12 +334,12 @@ u32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co chr &= 0x7f; } + u8 gfx; if (pcg_mode) { gfx = m_pcg[(chr << 4) | ra] ^ inv; } - else - if (mcm6571a_shift[chr]) + else if (mcm6571a_shift[chr]) { if (ra < 3) gfx = inv; diff --git a/src/mame/drivers/peoplepc.cpp b/src/mame/drivers/peoplepc.cpp index 011535db098..9c25f9504e9 100644 --- a/src/mame/drivers/peoplepc.cpp +++ b/src/mame/drivers/peoplepc.cpp @@ -114,17 +114,16 @@ static const gfx_layout peoplepc_charlayout = MC6845_UPDATE_ROW(peoplepc_state::update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for(i = 0; i < x_count; i++) + for(int i = 0; i < x_count; i++) { if(BIT(m_p7c, 1)) { uint16_t data = m_gvram[((((ma / 40) * 16) + ra) * 64) + i]; - for(j = 15; j >= 0; j--) - bitmap.pix32(y, (i * 16) + j) = palette[BIT(data, j)]; + for(int j = 15; j >= 0; j--) + bitmap.pix(y, (i * 16) + j) = palette[BIT(data, j)]; } else { @@ -134,8 +133,8 @@ MC6845_UPDATE_ROW(peoplepc_state::update_row) chr ^= 0xff; if(((data & 0x800) && (ra > 14)) || (i == cursor_x)) chr = 0xff; - for(j = 0; j < 8; j++) - bitmap.pix32(y, (i * 8) + j) = palette[BIT(chr, j)]; + for(int j = 0; j < 8; j++) + bitmap.pix(y, (i * 8) + j) = palette[BIT(chr, j)]; } } } diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp index bf020d6c52e..77a2b3bc43e 100644 --- a/src/mame/drivers/pet.cpp +++ b/src/mame/drivers/pet.cpp @@ -1344,24 +1344,24 @@ TIMER_CALLBACK_MEMBER( pet_state::sync_tick ) uint32_t pet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int y = 0; y < 200; y++) { for (int sx = 0; sx < 40; sx++) { - int sy = y / 8; - offs_t video_addr = (sy * 40) + sx; - uint8_t lsd = m_video_ram[video_addr]; + int const sy = y / 8; + offs_t const video_addr = (sy * 40) + sx; + uint8_t const lsd = m_video_ram[video_addr]; - int ra = y & 0x07; - offs_t char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; + int const ra = y & 0x07; + offs_t const char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; uint8_t data = m_char_rom->base()[char_addr]; for (int x = 0; x < 8; x++, data <<= 1) { - int color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; - bitmap.pix32(y, (sx * 8) + x) = pen[color]; + int const color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; + bitmap.pix(y, (sx * 8) + x) = pen[color]; } } } @@ -1403,8 +1403,8 @@ MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } // odd character @@ -1416,8 +1416,8 @@ MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } @@ -1449,8 +1449,8 @@ MC6845_UPDATE_ROW( pet_state::pet40_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } @@ -1485,8 +1485,8 @@ MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } // odd character @@ -1498,8 +1498,8 @@ MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index 998d9831fe7..b71f5d74306 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -339,13 +339,12 @@ void pg685_state::video_start() MC6845_UPDATE_ROW( pg685_state::crtc_update_row ) { static const uint32_t palette[2] = { 0x00d000, 0 }; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - uint8_t *vram = (uint8_t *)m_vram.target(); - uint8_t *fontram = (uint8_t *)m_fontram.target(); + uint8_t const *const vram = (uint8_t *)m_vram.target(); + uint8_t const *const fontram = (uint8_t *)m_fontram.target(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ) & 0x7ff; uint8_t chr = vram[ offset ]; @@ -353,27 +352,26 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row ) uint8_t fg = 1; uint8_t bg = 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[( data & 0x80 ) ? fg : bg]; + *p++ = palette[( data & 0x40 ) ? fg : bg]; + *p++ = palette[( data & 0x20 ) ? fg : bg]; + *p++ = palette[( data & 0x10 ) ? fg : bg]; + *p++ = palette[( data & 0x08 ) ? fg : bg]; + *p++ = palette[( data & 0x04 ) ? fg : bg]; + *p++ = palette[( data & 0x02 ) ? fg : bg]; + *p++ = palette[( data & 0x01 ) ? fg : bg]; } } MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) { static const uint32_t palette[2] = { 0x00d000, 0 }; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - uint16_t *vram = (uint16_t *)m_vram16.target(); - uint8_t *fontram = (uint8_t *)memregion("chargen")->base(); + uint16_t const *const vram = (uint16_t *)m_vram16.target(); + uint8_t const *const fontram = (uint8_t *)memregion("chargen")->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ) & 0x7ff; uint16_t chr = vram[ offset ] & 0xff; @@ -381,14 +379,14 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) uint8_t fg = 1; uint8_t bg = 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[( data & 0x80 ) ? fg : bg]; + *p++ = palette[( data & 0x40 ) ? fg : bg]; + *p++ = palette[( data & 0x20 ) ? fg : bg]; + *p++ = palette[( data & 0x10 ) ? fg : bg]; + *p++ = palette[( data & 0x08 ) ? fg : bg]; + *p++ = palette[( data & 0x04 ) ? fg : bg]; + *p++ = palette[( data & 0x02 ) ? fg : bg]; + *p++ = palette[( data & 0x01 ) ? fg : bg]; } } diff --git a/src/mame/drivers/pgm2.cpp b/src/mame/drivers/pgm2.cpp index 4cecf239972..b5eaa903469 100644 --- a/src/mame/drivers/pgm2.cpp +++ b/src/mame/drivers/pgm2.cpp @@ -760,7 +760,7 @@ void pgm2_state::pgm2(machine_config &config) /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_refresh(HZ_TO_ATTOSECONDS(60)); + m_screen->set_refresh(HZ_TO_ATTOSECONDS(59.08)); // 59.08Hz, 264 total lines @ 15.59KHz m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); m_screen->set_size(64*8, 32*8); m_screen->set_visarea(0, 448-1, 0, 224-1); diff --git a/src/mame/drivers/phc25.cpp b/src/mame/drivers/phc25.cpp index 2c9011c54ea..a134bc83e21 100644 --- a/src/mame/drivers/phc25.cpp +++ b/src/mame/drivers/phc25.cpp @@ -408,5 +408,5 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1983, phc25, 0, 0, pal, phc25, phc25_state, empty_init, "Sanyo", "PHC-25 (Europe)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -COMP( 1983, phc25j, phc25, 0, ntsc, phc25j, phc25_state, empty_init, "Sanyo", "PHC-25 (Japan)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1983, phc25, 0, 0, pal, phc25, phc25_state, empty_init, "Sanyo", "PHC-25 (Europe)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1983, phc25j, phc25, 0, ntsc, phc25j, phc25_state, empty_init, "Sanyo", "PHC-25 (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/photon2.cpp b/src/mame/drivers/photon2.cpp index bd10463a35e..6994861ad22 100644 --- a/src/mame/drivers/photon2.cpp +++ b/src/mame/drivers/photon2.cpp @@ -163,48 +163,46 @@ WRITE_LINE_MEMBER(photon2_state::screen_vblank_spectrum) static inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t photon2_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* for now do a full-refresh */ - int x, y, b, scrx, scry; - unsigned short ink, pap; - unsigned char *attr, *scr; // int full_refresh = 1; - scr=m_spectrum_video_ram; + unsigned char const *scr=m_spectrum_video_ram; bitmap.fill(m_spectrum_port_fe & 0x07, cliprect); - for (y=0; y<192; y++) + for (int y=0; y<192; y++) { - scrx=SPEC_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; + int scrx=SPEC_LEFT_BORDER; + int scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + unsigned char const *attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; - for (x=0;x<32;x++) + for (int x=0;x<32;x++) { - /* Get ink and paper colour with bright */ - if (m_spectrum_flash_invert && (*attr & 0x80)) - { - ink=((*attr)>>3) & 0x0f; - pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - } + /* Get ink and paper colour with bright */ + unsigned short ink, pap; + if (m_spectrum_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (int b=0x80;b!=0;b>>=1) + { + if (*scr&b) + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); else - { - ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - pap=((*attr)>>3) & 0x0f; - } - - for (b=0x80;b!=0;b>>=1) - { - if (*scr&b) - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); - else - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); - } + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); + } scr++; attr++; } diff --git a/src/mame/drivers/photoply.cpp b/src/mame/drivers/photoply.cpp index d5034bb378a..85a86e3e22f 100644 --- a/src/mame/drivers/photoply.cpp +++ b/src/mame/drivers/photoply.cpp @@ -340,7 +340,7 @@ ROM_START(photoply98sp) ROM_REGION(0x20000, "bios", 0) // Motherboard BIOS ROM_LOAD("funworld_award_486e_w83787.bin", 0x000000, 0x20000, CRC(af7ff1d4) SHA1(72eeecf798a03817ce7ba4d65cd4128ed3ef7e68) ) // 486E 96/7/19 W83787 PLUG & PLAY BIOS, AT27C010, Funworld sticker: Sept 1998 - ROM_REGION(0x8000, "ex_bios", ROMREGION_ERASE00 ) // Multifunction board with a ESS AudioDrive chip, Funworld sticker: Sept 1998 + ROM_REGION(0x8000, "ex_bios", ROMREGION_ERASE00 ) // Multifunction board with a ESS AudioDrive chip, Funworld sticker: Sept 1998 ROM_LOAD("enhanced_bios_centos.bin", 0x000000, 0x8000, CRC(ee8ad003) SHA1(4814385117599a98da02155785d1e3fce4e485bd) ) // Centos CI-8000/PP2000 ROM BIOS Version 1.06, 27C256B ROM_REGION(0x8000, "video_bios", 0 ) diff --git a/src/mame/drivers/phunsy.cpp b/src/mame/drivers/phunsy.cpp index 1ff20267bb1..fc5c5776fa5 100644 --- a/src/mame/drivers/phunsy.cpp +++ b/src/mame/drivers/phunsy.cpp @@ -218,19 +218,19 @@ void phunsy_state::phunsy_palette(palette_device &palette) const uint32_t phunsy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,col; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+64; x++) + for (uint16_t x = ma; x < ma+64; x++) { - chr = m_p_videoram[x]; + uint8_t const chr = m_p_videoram[x]; + uint8_t gfx,col; if (BIT(chr, 7)) { /* Graphics mode */ diff --git a/src/mame/drivers/piggypas.cpp b/src/mame/drivers/piggypas.cpp index c816a490e07..1a144a47e39 100644 --- a/src/mame/drivers/piggypas.cpp +++ b/src/mame/drivers/piggypas.cpp @@ -184,7 +184,7 @@ void piggypas_state::machine_reset() HD44780_PIXEL_UPDATE(piggypas_state::piggypas_pixel_update) { if (pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } void piggypas_state::piggypas(machine_config &config) diff --git a/src/mame/drivers/pinball2k.cpp b/src/mame/drivers/pinball2k.cpp index 56ef596d861..fe6160b1543 100644 --- a/src/mame/drivers/pinball2k.cpp +++ b/src/mame/drivers/pinball2k.cpp @@ -165,19 +165,17 @@ void pinball2k_state::video_start() void pinball2k_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - const pen_t *pens = m_palette->pens(); + pen_t const *const pens = m_palette->pens(); - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint32_t *p = &bitmap.pix32(j); - for (i=x; i < x+8; i++) + uint32_t *const p = &bitmap.pix(j); + for (int i=x; i < x+8; i++) { - uint8_t pen = dp[index++]; + uint8_t const pen = dp[index++]; if (pen) p[i] = pens[gfx->colorbase() + (att & 0xf)]; else @@ -191,7 +189,6 @@ void pinball2k_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; int width, height; int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; @@ -218,14 +215,14 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode { - uint8_t *framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; - uint8_t *pal = m_pal; + uint8_t const *const framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint8_t const *const pal = m_pal; - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint8_t *si = &framebuf[j * line_delta]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint8_t const *si = &framebuf[j * line_delta]; + for (int i=0; i < m_frame_width; i++) { int c = *si++; int r = pal[(c*3)+0] << 2; @@ -238,16 +235,16 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl } else // 16-bit { - uint16_t *framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint16_t const *const framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; // RGB 5-6-5 mode if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0) { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { uint16_t c = *si++; int r = ((c >> 11) & 0x1f) << 3; @@ -261,11 +258,11 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl // RGB 5-5-5 mode else { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { uint16_t c = *si++; int r = ((c >> 10) & 0x1f) << 3; @@ -281,14 +278,13 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl void pinball2k_state::draw_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; gfx_element *gfx = m_gfxdecode->gfx(0); - uint32_t *cga = m_cga_ram; + uint32_t const *const cga = m_cga_ram; int index = 0; - for (j=0; j < 25; j++) + for (int j=0; j < 25; j++) { - for (i=0; i < 80; i+=2) + for (int i=0; i < 80; i+=2) { int att0 = (cga[index] >> 8) & 0xff; int ch0 = (cga[index] >> 0) & 0xff; diff --git a/src/mame/drivers/plan80.cpp b/src/mame/drivers/plan80.cpp index 534a1cb9cfb..d1de5e6ce91 100644 --- a/src/mame/drivers/plan80.cpp +++ b/src/mame/drivers/plan80.cpp @@ -122,7 +122,7 @@ static INPUT_PORTS_START( plan80 ) // Keyboard was worked out by trial & error;' PORT_START("LINE0") /* FE */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F1) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A -") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('-') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q ! 1") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('!') PORT_CHAR('1') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F-shift") PORT_CODE(KEYCODE_RSHIFT) @@ -130,7 +130,7 @@ static INPUT_PORTS_START( plan80 ) // Keyboard was worked out by trial & error;' PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P ?? 0") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('0') PORT_START("LINE1") /* FD */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Numbers") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Numbers") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X /") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('/') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D =") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('=') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E # 3") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('#') PORT_CHAR('3') @@ -195,19 +195,18 @@ void plan80_state::machine_start() u32 plan80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma+48; x++) + for (u16 x = ma; x < ma+48; x++) { - chr = m_vram[x]; - gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + u8 chr = m_vram[x]; + u8 gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); /* Display a scanline of a character */ *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/pmd85.cpp b/src/mame/drivers/pmd85.cpp index b8eab04d666..07c15748cb8 100644 --- a/src/mame/drivers/pmd85.cpp +++ b/src/mame/drivers/pmd85.cpp @@ -245,12 +245,12 @@ uint32_t pmd85_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { int pen = BIT(line[x], 7) ? 1 : 2; - bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; - bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; - bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; - bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; - bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; - bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; + bitmap.pix(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; + bitmap.pix(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; + bitmap.pix(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; + bitmap.pix(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; + bitmap.pix(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; + bitmap.pix(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; } } diff --git a/src/mame/drivers/pmi80.cpp b/src/mame/drivers/pmi80.cpp index a76f2b2d552..2c7a5d8c698 100644 --- a/src/mame/drivers/pmi80.cpp +++ b/src/mame/drivers/pmi80.cpp @@ -27,6 +27,9 @@ Notes: press = to increment to next address or to scan through them. - PPI1 is programmed to mode 0, Port A output, Port B input, PC0-3 output, PC4-7 input. +Paste test: + Paste --1C00^11^22^33^44^55^66^77^88^99^---1C00^ + Press = to verify the data that was entered. *******************************************************************************************/ @@ -144,44 +147,44 @@ void pmi80_state::io_map(address_map &map) /* Input ports */ static INPUT_PORTS_START( pmi80 ) PORT_START("SP") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RE") PORT_CODE(KEYCODE_LALT) PORT_CHANGED_MEMBER(DEVICE_SELF, pmi80_state, reset_button, 0) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, pmi80_state, int_button, 0) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RE") PORT_CODE(KEYCODE_LALT) PORT_CHANGED_MEMBER(DEVICE_SELF, pmi80_state, reset_button, 0) PORT_CHAR('W') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHANGED_MEMBER(DEVICE_SELF, pmi80_state, int_button, 0) PORT_CHAR('I') PORT_START("X0") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_START("X1") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_START("X2") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B BC") PORT_CODE(KEYCODE_B) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 HL") PORT_CODE(KEYCODE_9) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B BC") PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 HL") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_START("X3") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) // Memory mode - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('-')// Memory mode + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_START("X4") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BR") PORT_CODE(KEYCODE_Q) // Breakpoint - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DE") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BR") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') // Breakpoint + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D DE") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_START("X5") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) // Registers - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_G) // Go + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') // Registers + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EX") PORT_CODE(KEYCODE_G) PORT_CHAR('X') // Go PORT_START("X6") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) // Load tape - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AF") PORT_CODE(KEYCODE_A) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 SP") PORT_CODE(KEYCODE_8) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') // Load tape + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A AF") PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 SP") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_START("X7") - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) // Save tape - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') // Save tape + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_START("X8") PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') INPUT_PORTS_END INPUT_CHANGED_MEMBER(pmi80_state::reset_button) diff --git a/src/mame/drivers/pockstat.cpp b/src/mame/drivers/pockstat.cpp index 3820b1fc410..551f48b3a3f 100644 --- a/src/mame/drivers/pockstat.cpp +++ b/src/mame/drivers/pockstat.cpp @@ -940,7 +940,7 @@ uint32_t pockstat_state::screen_update_pockstat(screen_device &screen, bitmap_rg { for (int y = 0; y < 32; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *const scanline = &bitmap.pix(y); for (int x = 0; x < 32; x++) { if (m_lcd_control != 0) // Hack diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp index 9bd74e066e2..6e988f870e9 100644 --- a/src/mame/drivers/poisk1.cpp +++ b/src/mame/drivers/poisk1.cpp @@ -323,15 +323,13 @@ void p1_state::set_palette_luts(void) POISK1_UPDATE_ROW(p1_state::cga_gfx_2bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); - uint16_t odd, offset; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); if (ra == 0) LOG("cga_gfx_2bpp_update_row\n"); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; @@ -350,16 +348,14 @@ POISK1_UPDATE_ROW(p1_state::cga_gfx_2bpp_update_row) POISK1_UPDATE_ROW(p1_state::cga_gfx_1bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); uint8_t fg = 15, bg = BG_COLOR(m_video.color_select_68); - uint16_t odd, offset; - int i; if (ra == 0) LOG("cga_gfx_1bpp_update_row bg %d\n", bg); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; @@ -382,20 +378,18 @@ POISK1_UPDATE_ROW(p1_state::cga_gfx_1bpp_update_row) POISK1_UPDATE_ROW(p1_state::poisk1_gfx_1bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); - uint8_t fg, bg = BG_COLOR(m_video.color_select_68); - uint16_t odd, offset; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); + uint8_t bg = BG_COLOR(m_video.color_select_68); if (ra == 0) LOG("poisk1_gfx_1bpp_update_row bg %d\n", bg); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; - fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX + uint8_t fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX *p = palette[bg]; p++; *p = palette[( data & 0x40 ) ? fg : bg ]; p++; *p = palette[( data & 0x20 ) ? fg : bg ]; p++; diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp index 34a62148174..d99f74beb14 100644 --- a/src/mame/drivers/pokemini.cpp +++ b/src/mame/drivers/pokemini.cpp @@ -1554,12 +1554,10 @@ void pokemini_state::prc_counter_callback() /* Check if the background should be drawn */ if ( m_prc.background_enabled ) { - int x, y; - for ( y = 0; y < 8; y++ ) { - for ( x = 0; x < 12; x++ ) { + for ( int y = 0; y < 8; y++ ) { + for ( int x = 0; x < 12; x++ ) { uint8_t tile = m_p_ram[ 0x360 + ( y * m_prc.map_size_x ) + x ]; - int i; - for( i = 0; i < 8; i++ ) { + for( int i = 0; i < 8; i++ ) { m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( m_prc.bg_tiles + ( tile * 8 ) + i ); } } @@ -1569,9 +1567,7 @@ void pokemini_state::prc_counter_callback() /* Check if the sprites should be drawn */ if ( m_prc.sprites_enabled ) { - uint16_t spr; - - for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) + for ( uint16_t spr = 0x35C; spr >= 0x300; spr -= 4 ) { int spr_x = ( m_p_ram[ spr + 0 ] & 0x7F ) - 16; int spr_y = ( m_p_ram[ spr + 1 ] & 0x7F ) - 16; @@ -1580,19 +1576,17 @@ void pokemini_state::prc_counter_callback() if ( spr_flag & 0x08 ) { - uint16_t gfx, mask; uint32_t spr_base = m_prc.spr_tiles + spr_tile * 64; - int i, j; - for ( i = 0; i < 16; i++ ) + for ( int i = 0; i < 16; i++ ) { if ( spr_x + i >= 0 && spr_x + i < 96 ) { int rel_x = ( spr_flag & 0x01 ) ? 15 - i : i; uint32_t s = spr_base + ( ( rel_x & 0x08 ) << 2 ) + ( rel_x & 0x07 ); - mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); - gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); + uint16_t mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); + uint16_t gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); /* Are the colors inverted? */ if ( spr_flag & 0x04 ) @@ -1600,7 +1594,7 @@ void pokemini_state::prc_counter_callback() gfx = ~gfx; } - for ( j = 0; j < 16; j++ ) + for ( int j = 0; j < 16; j++ ) { if ( spr_y + j >= 0 && spr_y + j < 64 ) { @@ -1647,20 +1641,18 @@ void pokemini_state::prc_counter_callback() /* Check if the rendered data should be copied to the LCD */ if ( m_prc.copy_enabled ) { - int x, y; - - for( y = 0; y < 64; y += 8 ) { - for( x = 0; x < 96; x++ ) { + for( int y = 0; y < 64; y += 8 ) { + for( int x = 0; x < 96; x++ ) { uint8_t data = m_p_ram[ ( y * 12 ) + x ]; - m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; - m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; - m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; - m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; - m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; - m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; - m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; - m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; + m_bitmap.pix(y + 0, x) = ( data & 0x01 ) ? 3 : 0; + m_bitmap.pix(y + 1, x) = ( data & 0x02 ) ? 3 : 0; + m_bitmap.pix(y + 2, x) = ( data & 0x04 ) ? 3 : 0; + m_bitmap.pix(y + 3, x) = ( data & 0x08 ) ? 3 : 0; + m_bitmap.pix(y + 4, x) = ( data & 0x10 ) ? 3 : 0; + m_bitmap.pix(y + 5, x) = ( data & 0x20 ) ? 3 : 0; + m_bitmap.pix(y + 6, x) = ( data & 0x40 ) ? 3 : 0; + m_bitmap.pix(y + 7, x) = ( data & 0x80 ) ? 3 : 0; } } @@ -1747,7 +1739,7 @@ void pokemini_state::device_timer(emu_timer &timer, device_timer_id id, int para } -static const int16_t speaker_levels[] = {-32768, 0, 32767}; +static const double speaker_levels[] = {-1.0, 0.0, 1.0}; void pokemini_state::video_start() { diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp index c0ffcf1f21c..80a6ec1e430 100644 --- a/src/mame/drivers/popobear.cpp +++ b/src/mame/drivers/popobear.cpp @@ -343,7 +343,7 @@ void popobear_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect // colours on game over screen are still wrong without the weird param kludge above if (pix&0x3f) { - bitmap.pix16(y_draw, x_draw) = m_palette->pen(((pix+(add_it))&0xff)+0x100); + bitmap.pix(y_draw, x_draw) = m_palette->pen(((pix+(add_it))&0xff)+0x100); } } diff --git a/src/mame/drivers/pp.cpp b/src/mame/drivers/pp.cpp index 72a4edca6bf..a029c2acb70 100644 --- a/src/mame/drivers/pp.cpp +++ b/src/mame/drivers/pp.cpp @@ -183,11 +183,11 @@ SCN2672_DRAW_CHARACTER_MEMBER(pp_state::display_char) for (int i = 0; i < 7; i++) { - bitmap.pix32(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); dots <<= 1; } if (!BIT(m_mode, 6)) - bitmap.pix32(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); } diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp index 2e12d7db1dc..4cd781a74fd 100644 --- a/src/mame/drivers/prestige.cpp +++ b/src/mame/drivers/prestige.cpp @@ -734,7 +734,7 @@ uint32_t prestige_state::screen_update(int bpp, screen_device &screen, bitmap_in pix |= BIT(data, 7 - b) << b; if (cliprect.contains(sx * 8 / bpp + x, y)) - bitmap.pix16(y, sx * 8 / bpp + x) = pix; + bitmap.pix(y, sx * 8 / bpp + x) = pix; data <<= bpp; } diff --git a/src/mame/drivers/primo.cpp b/src/mame/drivers/primo.cpp index 65b9e2b44c9..0bdd213fb82 100644 --- a/src/mame/drivers/primo.cpp +++ b/src/mame/drivers/primo.cpp @@ -244,7 +244,7 @@ static INPUT_PORTS_START( primo ) PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) INPUT_PORTS_END -static const struct CassetteOptions primo_cassette_options = { +static const cassette_image::Options primo_cassette_options = { 1, /* channels */ 16, /* bits per sample */ 22050 /* sample frequency */ diff --git a/src/mame/drivers/prof80.cpp b/src/mame/drivers/prof80.cpp index 703cba82c62..f9111ba0088 100644 --- a/src/mame/drivers/prof80.cpp +++ b/src/mame/drivers/prof80.cpp @@ -94,15 +94,9 @@ WRITE_LINE_MEMBER(prof80_state::select_w) } -WRITE_LINE_MEMBER(prof80_state::resf_w) -{ - if (state) - m_fdc->soft_reset(); -} - - WRITE_LINE_MEMBER(prof80_state::mini_w) { + m_fdc->set_unscaled_clock(16_MHz_XTAL / (state ? 4 : 2)); } @@ -453,7 +447,7 @@ void prof80_state::machine_start() void prof80_state::prof80(machine_config &config) { // basic machine hardware - Z80(config, m_maincpu, XTAL(6'000'000)); + Z80(config, m_maincpu, 6_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &prof80_state::prof80_mem); m_maincpu->set_addrmap(AS_IO, &prof80_state::prof80_io); @@ -465,7 +459,7 @@ void prof80_state::prof80(machine_config &config) UPD1990A(config, m_rtc); // FDC - UPD765A(config, m_fdc, 8'000'000, true, true); + UPD765A(config, m_fdc, 16_MHz_XTAL / 2, true, true); // clocked through FDC9229B FLOPPY_CONNECTOR(config, UPD765_TAG ":0", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats); FLOPPY_CONNECTOR(config, UPD765_TAG ":1", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats); FLOPPY_CONNECTOR(config, UPD765_TAG ":2", prof80_floppies, nullptr, floppy_image_device::default_floppy_formats); @@ -483,7 +477,7 @@ void prof80_state::prof80(machine_config &config) m_flra->q_out_cb<6>().set(FUNC(prof80_state::motor_w)); // _MOTOR m_flra->q_out_cb<7>().set(FUNC(prof80_state::select_w)); // SELECT LS259(config, m_flrb); - m_flrb->q_out_cb<0>().set(FUNC(prof80_state::resf_w)); // RESF + m_flrb->q_out_cb<0>().set(m_fdc, FUNC(upd765a_device::reset_w)); // RESF m_flrb->q_out_cb<1>().set(FUNC(prof80_state::mini_w)); // MINI m_flrb->q_out_cb<2>().set(m_rs232a, FUNC(rs232_port_device::write_rts)); // _RTS m_flrb->q_out_cb<3>().set(m_rs232a, FUNC(rs232_port_device::write_txd)); // TX diff --git a/src/mame/drivers/progolf.cpp b/src/mame/drivers/progolf.cpp index 7ef19a14771..d77ca7444f0 100644 --- a/src/mame/drivers/progolf.cpp +++ b/src/mame/drivers/progolf.cpp @@ -224,18 +224,16 @@ void progolf_state::video_start() uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count,color,x,y,xi,yi; - { - int scroll = (m_scrollx_lo | ((m_scrollx_hi & 0x03) << 8)); + int const scroll = (m_scrollx_lo | ((m_scrollx_hi & 0x03) << 8)); - count = 0; + int count = 0; - for(x=0;x<128;x++) + for(int x=0;x<128;x++) { - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - int tile = m_videoram[count]; + int const tile = m_videoram[count]; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,tile,1,0,0,(256-x*8)+scroll,y*8); /* wrap-around */ @@ -248,20 +246,20 @@ uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // framebuffer is 8x8 chars arranged like a bitmap + a register that controls the pen handling. { - count = 0; + int count = 0; - for(y=0;y<256;y+=8) + for(int y=0;y<256;y+=8) { - for(x=0;x<256;x+=8) + for(int x=0;x<256;x+=8) { - for (yi=0;yi<8;yi++) + for (int yi=0;yi<8;yi++) { - for (xi=0;xi<8;xi++) + for (int xi=0;xi<8;xi++) { - color = m_fg_fb[(xi+yi*8)+count*0x40]; + int const color = m_fg_fb[(xi+yi*8)+count*0x40]; if(color != 0 && cliprect.contains(x+yi, 256-y+xi)) - bitmap.pix32(x+yi, 256-y+xi) = m_palette->pen((color & 0x7)); + bitmap.pix(x+yi, 256-y+xi) = m_palette->pen((color & 0x7)); } } diff --git a/src/mame/drivers/proteus3.cpp b/src/mame/drivers/proteus3.cpp index 5717d4125f9..25b11c513ca 100644 --- a/src/mame/drivers/proteus3.cpp +++ b/src/mame/drivers/proteus3.cpp @@ -300,26 +300,24 @@ WRITE_LINE_MEMBER( proteus3_state::ca2_w ) u32 proteus3_state::screen_update_proteus3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_flashcnt++; - for(y = 0; y < 16; y++ ) + for (u8 y = 0; y < 16; y++ ) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]; // get char in videoram + u8 chr = m_vram[x]; // get char in videoram gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen } - else - if ((ra == 9) && (m_curs_pos == x) && BIT(m_flashcnt, 4)) + else if ((ra == 9) && (m_curs_pos == x) && BIT(m_flashcnt, 4)) gfx = 0xff; /* Display a scanline of a character */ diff --git a/src/mame/drivers/ps2sony.cpp b/src/mame/drivers/ps2sony.cpp index 548af45ab0c..0d54917ae9e 100644 --- a/src/mame/drivers/ps2sony.cpp +++ b/src/mame/drivers/ps2sony.cpp @@ -914,6 +914,12 @@ ROM_START( ps2 ) ROMX_LOAD( "scph_bios_v12_rus_200.bin", 0x000000, 0x400000, CRC(92aa71a2) SHA1(cce6fac0f7e682ad167e1e828b2d53192c3d5051), ROM_BIOS(59) ) ROM_SYSTEM_BIOS( 60, "unknown6", "Unknown6" ) ROMX_LOAD( "scph_bios_v15_jap_220.bin", 0x000000, 0x400000, CRC(493c1e58) SHA1(d9a7537fa463fcdd3e270af14a93731736cafc4a), ROM_BIOS(60) ) + + // These came from Guru + ROM_SYSTEM_BIOS( 61, "scph50000_j2", "SCPH-50000 (Version 5.0 08/22/03 J)" ) + ROMX_LOAD( "ps2-0190j-20030822.bin", 0x000000, 0x400000, CRC(79d60546) SHA1(0ea98a25a32145dda514de2f0d4bfbbd806bd00c), ROM_BIOS(61) ) + ROM_SYSTEM_BIOS( 62, "scph70002_a", "SCPH-70002/SCPH-75002 (Version 5.0 06/14/04 A)" ) + ROMX_LOAD( "ps2-0200a-20040614_alt.bin", 0x000000, 0x400000, CRC(3e0aa788) SHA1(597841bfea6e334f5ec4116299091ae2ed3da479), ROM_BIOS(62) ) ROM_END CONS( 2000, ps2, 0, 0, ps2sony, ps2sony, ps2sony_state, empty_init, "Sony", "PlayStation 2", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/psikyo.cpp b/src/mame/drivers/psikyo.cpp index 678e4cea91c..7de0ddb99b6 100644 --- a/src/mame/drivers/psikyo.cpp +++ b/src/mame/drivers/psikyo.cpp @@ -115,7 +115,8 @@ READ_LINE_MEMBER(psikyo_state::mcu_status_r) if (m_mcu_status) ret = 0x01; - m_mcu_status = !m_mcu_status; /* hack */ + if (!machine().side_effects_disabled()) + m_mcu_status = !m_mcu_status; /* hack */ return ret; } @@ -207,12 +208,14 @@ u32 psikyo_state::s1945_mcu_data_r() if (m_s1945_mcu_control & 16) { res = m_s1945_mcu_latching & 4 ? 0x0000ff00 : m_s1945_mcu_latch1 << 8; - m_s1945_mcu_latching |= 4; + if (!machine().side_effects_disabled()) + m_s1945_mcu_latching |= 4; } else { res = m_s1945_mcu_latching & 1 ? 0x0000ff00 : m_s1945_mcu_latch2 << 8; - m_s1945_mcu_latching |= 1; + if (!machine().side_effects_disabled()) + m_s1945_mcu_latching |= 1; } res |= m_s1945_mcu_bctrl & 0xf0; return res; @@ -442,7 +445,8 @@ READ_LINE_MEMBER(psikyo_state::z80_nmi_r) /* main CPU might be waiting for sound CPU to finish NMI, so set a timer to give sound CPU a chance to run */ - machine().scheduler().synchronize(); + if (!machine().side_effects_disabled()) + machine().scheduler().synchronize(); // logerror("%s - Read coin port during Z80 NMI\n", machine().describe_context()); } diff --git a/src/mame/drivers/psion.cpp b/src/mame/drivers/psion.cpp index 32614e2e5b0..047c8b13424 100644 --- a/src/mame/drivers/psion.cpp +++ b/src/mame/drivers/psion.cpp @@ -518,14 +518,14 @@ HD44780_PIXEL_UPDATE(psion_state::lz_pixel_update) }; uint8_t char_pos = psion_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + bitmap.pix((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; } } HD44780_PIXEL_UPDATE(psion1_state::psion1_pixel_update) { if (pos < 8 && line < 2) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } void psion_state::psion_palette(palette_device &palette) const diff --git a/src/mame/drivers/psion5.cpp b/src/mame/drivers/psion5.cpp index 88263c4d814..677aa1d387e 100644 --- a/src/mame/drivers/psion5.cpp +++ b/src/mame/drivers/psion5.cpp @@ -854,22 +854,22 @@ INPUT_PORTS_START( psion5mx ) PORT_BIT(0xfffe, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("COL0") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR('>') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_CHAR('<') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(163) PORT_CHAR('\\') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_CHAR('#') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_CHAR('_') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Dictaphone Record") PORT_CODE(KEYCODE_INSERT) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("COL1") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('~') PORT_CHAR(':') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del<-") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_CHAR('}') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_CHAR(']') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') PORT_CHAR('[') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Dictaphone Play") PORT_CODE(KEYCODE_HOME) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) @@ -877,18 +877,18 @@ INPUT_PORTS_START( psion5mx ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(128) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("COL3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(';') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('=') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR('-') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR('+') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Menu") PORT_CODE(KEYCODE_END) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) @@ -900,17 +900,17 @@ INPUT_PORTS_START( psion5mx ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("COL5") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down Arrow") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('?') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Func") PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Fn") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("COL6") @@ -920,14 +920,14 @@ INPUT_PORTS_START( psion5mx ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') - PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("COL7") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Arrow") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Arrow") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up Arrow") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('/') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Dictaphone Stop") PORT_CODE(KEYCODE_PGUP) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) diff --git a/src/mame/drivers/ptcsol.cpp b/src/mame/drivers/ptcsol.cpp index 3e618a94e8c..be55ca24bf9 100644 --- a/src/mame/drivers/ptcsol.cpp +++ b/src/mame/drivers/ptcsol.cpp @@ -469,10 +469,10 @@ void sol20_state::io_map(address_map &map) /* Input ports */ static INPUT_PORTS_START( sol20 ) PORT_START("ARROWS") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("S1") @@ -650,8 +650,7 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons // any character with bit 7 set will blink. With DPMON, do DA C000 C2FF to see what happens u16 which = (m_iop_config->read() & 2) << 10; u8 s1 = m_iop_s1->read(); - u8 y,ra,chr,gfx; - u16 sy=0,ma,x,inv; + u16 sy=0; u8 polarity = (s1 & 8) ? 0xff : 0; bool cursor_inv = false; @@ -660,18 +659,18 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons m_framecnt++; - ma = m_sol20_fe << 6; // scroll register + u16 ma = m_sol20_fe << 6; // scroll register - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 13; ra++) + for (u8 ra = 0; ra < 13; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - inv = polarity; - chr = m_vram[x & 0x3ff]; + u16 inv = polarity; + u8 chr = m_vram[x & 0x3ff]; // cursor if (BIT(chr, 7) && cursor_inv) @@ -679,10 +678,10 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons chr &= 0x7f; + u8 gfx; if ((ra == 0) || ((s1 & 4) && (chr < 0x20))) gfx = inv; - else - if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) + else if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) { if (ra < 4) gfx = inv; diff --git a/src/mame/drivers/pv1000.cpp b/src/mame/drivers/pv1000.cpp index a78004c2ad4..63b19c16975 100644 --- a/src/mame/drivers/pv1000.cpp +++ b/src/mame/drivers/pv1000.cpp @@ -31,7 +31,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: @@ -60,7 +60,7 @@ pv1000_sound_device::pv1000_sound_device(const machine_config &mconfig, const ch void pv1000_sound_device::device_start() { - m_sh_channel = stream_alloc_legacy(0, 1, clock() / 1024); + m_sh_channel = stream_alloc(0, 1, clock() / 1024); save_item(NAME(m_voice[0].count)); save_item(NAME(m_voice[0].period)); @@ -84,7 +84,7 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- @@ -98,20 +98,20 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data) Note: the register periods are inverted. */ -void pv1000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void pv1000_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - while (samples > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer=0; + s32 sum = 0; for (int i = 0; i < 3; i++) { uint32_t per = (0x3f - (m_voice[i].period & 0x3f)); if (per != 0) //OFF! - *buffer += m_voice[i].val * 8192; + sum += m_voice[i].val * 8192; m_voice[i].count++; @@ -122,8 +122,7 @@ void pv1000_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } } - buffer++; - samples--; + buffer.put_int(sampindex, sum, 32768); } } diff --git a/src/mame/drivers/px4.cpp b/src/mame/drivers/px4.cpp index 0bddf1212b4..2f539d2c1e6 100644 --- a/src/mame/drivers/px4.cpp +++ b/src/mame/drivers/px4.cpp @@ -1177,26 +1177,24 @@ uint32_t px4_state::screen_update_px4(screen_device &screen, bitmap_ind16 &bitma // display enabled? if (BIT(m_yoff, 7)) { - int y, x; - // get vram start address - uint8_t *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; + uint8_t const *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { // adjust against y-offset uint8_t row = (y - (m_yoff & 0x3f)) & 0x3f; - for (x = 0; x < 240/8; x++) + for (int x = 0; x < 240/8; x++) { - bitmap.pix16(row, x * 8 + 0) = BIT(*vram, 7); - bitmap.pix16(row, x * 8 + 1) = BIT(*vram, 6); - bitmap.pix16(row, x * 8 + 2) = BIT(*vram, 5); - bitmap.pix16(row, x * 8 + 3) = BIT(*vram, 4); - bitmap.pix16(row, x * 8 + 4) = BIT(*vram, 3); - bitmap.pix16(row, x * 8 + 5) = BIT(*vram, 2); - bitmap.pix16(row, x * 8 + 6) = BIT(*vram, 1); - bitmap.pix16(row, x * 8 + 7) = BIT(*vram, 0); + bitmap.pix(row, x * 8 + 0) = BIT(*vram, 7); + bitmap.pix(row, x * 8 + 1) = BIT(*vram, 6); + bitmap.pix(row, x * 8 + 2) = BIT(*vram, 5); + bitmap.pix(row, x * 8 + 3) = BIT(*vram, 4); + bitmap.pix(row, x * 8 + 4) = BIT(*vram, 3); + bitmap.pix(row, x * 8 + 5) = BIT(*vram, 2); + bitmap.pix(row, x * 8 + 6) = BIT(*vram, 1); + bitmap.pix(row, x * 8 + 7) = BIT(*vram, 0); vram++; } diff --git a/src/mame/drivers/pyl601.cpp b/src/mame/drivers/pyl601.cpp index e20146877e1..52270235c3e 100644 --- a/src/mame/drivers/pyl601.cpp +++ b/src/mame/drivers/pyl601.cpp @@ -414,27 +414,26 @@ void pyl601_state::machine_start() MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charrom = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charrom = memregion("chargen")->base(); - int column, bit, i; - uint8_t data; if (BIT(m_video_mode, 5) == 0) { - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { uint8_t code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; code = ((code << 1) | (code >> 7)) & 0xff; + uint8_t data; if (column == cursor_x-2) data = 0xff; else data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff]; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; - bitmap.pix32(y, x) = palette[BIT(data, 7)]; + bitmap.pix(y, x) = palette[BIT(data, 7)]; data <<= 1; } @@ -442,12 +441,12 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) } else { - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) + uint8_t data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (int bit = 0; bit < 8; bit++) { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + bitmap.pix(y, (i * 8) + bit) = palette[BIT(data, 7)]; data <<= 1; } } @@ -456,25 +455,23 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charrom = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charrom = memregion("chargen")->base(); - int column, bit, i; - uint8_t data; if (BIT(m_video_mode, 5) == 0) { - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { - uint8_t code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; - data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; + uint8_t const code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; + uint8_t data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; if (column == cursor_x) data = 0xff; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; - bitmap.pix32(y, x) = palette[BIT(data, 7)]; + bitmap.pix(y, x) = palette[BIT(data, 7)]; data <<= 1; } @@ -482,12 +479,12 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) } else { - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) + uint8_t data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (int bit = 0; bit < 8; bit++) { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + bitmap.pix(y, (i * 8) + bit) = palette[BIT(data, 7)]; data <<= 1; } } diff --git a/src/mame/drivers/pzletime.cpp b/src/mame/drivers/pzletime.cpp index 856ad762bc3..60c7cbc6caa 100644 --- a/src/mame/drivers/pzletime.cpp +++ b/src/mame/drivers/pzletime.cpp @@ -117,9 +117,6 @@ void pzletime_state::video_start() uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count; - int y, x; - bitmap.fill(m_palette[0]->pen(0), cliprect); //bg pen m_txt_tilemap->set_scrolly(0, m_tilemap_regs[0] - 3); @@ -130,14 +127,14 @@ uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rg if (m_video_regs[2] & 1) { - count = 0; + int count = 0; - for (y = 255; y >= 0; y--) + for (int y = 255; y >= 0; y--) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { if (m_bg_videoram[count] & 0x8000) - bitmap.pix32((y - 18) & 0xff, (x - 32) & 0x1ff) = m_palette[1]->pen(m_bg_videoram[count] & 0x7fff); + bitmap.pix((y - 18) & 0xff, (x - 32) & 0x1ff) = m_palette[1]->pen(m_bg_videoram[count] & 0x7fff); count++; } @@ -146,24 +143,20 @@ uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rg m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 0); + uint16_t const *const spriteram = m_spriteram; + for (int offs = 0; offs < 0x2000 / 2; offs += 4) { - uint16_t *spriteram = m_spriteram; - int offs, spr_offs, colour, sx, sy; - - for(offs = 0; offs < 0x2000 / 2; offs += 4) - { - if(spriteram[offs + 0] == 8) - break; + if(spriteram[offs + 0] == 8) + break; - spr_offs = spriteram[offs + 3] & 0x0fff; - sy = 0x200 - (spriteram[offs + 0] & 0x1ff) - 35; - sx = (spriteram[offs + 1] & 0x1ff) - 30; - colour = (spriteram[offs + 0] & 0xf000) >> 12; + int spr_offs = spriteram[offs + 3] & 0x0fff; + int sy = 0x200 - (spriteram[offs + 0] & 0x1ff) - 35; + int sx = (spriteram[offs + 1] & 0x1ff) - 30; + int colour = (spriteram[offs + 0] & 0xf000) >> 12; - // is spriteram[offs + 0] & 0x200 flipy? it's always set + // is spriteram[offs + 0] & 0x200 flipy? it's always set - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, spr_offs, colour, 0, 1, sx, sy, 0); - } + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, spr_offs, colour, 0, 1, sx, sy, 0); } m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0); diff --git a/src/mame/drivers/quickpick5.cpp b/src/mame/drivers/quickpick5.cpp index c0ae86e466e..b29d56b6861 100644 --- a/src/mame/drivers/quickpick5.cpp +++ b/src/mame/drivers/quickpick5.cpp @@ -5,10 +5,11 @@ quickpick5.cpp: Konami "Quick Pick 5" medal game Quick Pick 5 - (c) 199? Konami + (c) 1991 Konami Driver by R. Belmont + PWB(A)352878A Rundown of PCB: Main CPU: Z80 @@ -29,6 +30,7 @@ #include "video/konami_helper.h" #include "machine/k053252.h" #include "machine/nvram.h" +#include "machine/ticket.h" #include "machine/timer.h" #include "emupal.h" #include "screen.h" @@ -47,31 +49,33 @@ public: m_k053252(*this, "k053252"), m_gfxdecode(*this, "gfxdecode"), m_oki(*this, "oki"), + m_outport(*this, "OUT"), + m_sio_ports(*this, "SIO%u", 1U), m_ttlrom_offset(0) { } void quickpick5(machine_config &config); + void waijockey(machine_config &config); + DECLARE_READ_LINE_MEMBER(serial_io_r); private: - uint32_t screen_update_quickpick5(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_quickpick5(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); K05324X_CB_MEMBER(sprite_callback); TILE_GET_INFO_MEMBER(ttl_get_tile_info); - void ccu_int_time_w(uint8_t data); + void ccu_int_time_w(u8 data); TIMER_DEVICE_CALLBACK_MEMBER(scanline); - uint8_t control_r() { return m_control; } - WRITE_LINE_MEMBER(vbl_ack_w) { m_maincpu->set_input_line(0, CLEAR_LINE); } WRITE_LINE_MEMBER(nmi_ack_w) { m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } // A0 is inverted to match the Z80's endianness. Typical Konami. - uint8_t k244_r(offs_t offset) { return m_k053245->k053244_r(offset^1); } - void k244_w(offs_t offset, uint8_t data) { m_k053245->k053244_w(offset^1, data); } - uint8_t k245_r(offs_t offset) { return m_k053245->k053245_r(offset^1); } - void k245_w(offs_t offset, uint8_t data) { m_k053245->k053245_w(offset^1, data); } + u8 k244_r(offs_t offset) { return m_k053245->k053244_r(offset^1); } + void k244_w(offs_t offset, u8 data) { m_k053245->k053244_w(offset^1, data); } + u8 k245_r(offs_t offset) { return m_k053245->k053245_r(offset^1); } + void k245_w(offs_t offset, u8 data) { m_k053245->k053245_w(offset^1, data); } - void control_w(uint8_t data) + void control_w(u8 data) { membank("bank1")->set_entry(data&0x1); if (((m_control & 0x60) != 0x60) && ((data & 0x60) == 0x60)) @@ -81,10 +85,15 @@ private: m_control = data; } - uint8_t vram_r(offs_t offset); - void vram_w(offs_t offset, uint8_t data); + u8 vram_r(offs_t offset); + void vram_w(offs_t offset, u8 data); + + void serial_io_w(u8 data); + void out_w(u8 data); + void common_map(address_map &map); void quickpick5_main(address_map &map); + void waijockey_main(address_map &map); virtual void machine_start() override; virtual void machine_reset() override; @@ -97,23 +106,88 @@ private: required_device<k053252_device> m_k053252; required_device<gfxdecode_device> m_gfxdecode; required_device<okim6295_device> m_oki; + required_ioport m_outport; + optional_ioport_array<3> m_sio_ports; int m_ttl_gfx_index; tilemap_t *m_ttl_tilemap; - uint8_t m_control; + u8 m_control; int m_ttlrom_offset; - uint8_t m_vram[0x1000]; + u8 m_vram[0x1000]; bool m_title_hack; int m_ccu_int_time, m_ccu_int_time_count; + + u16 m_sio_out, m_sio_in0, m_sio_in1; + u8 m_sio_prev; }; -void quickpick5_state::ccu_int_time_w(uint8_t data) +void quickpick5_state::serial_io_w(u8 data) +{ + // bit 7 - coin counter OUT + // bit 6 - coin counter IN + // bits 0-4 - serial I/O device + + if (BIT(data, 1) && !BIT(m_sio_prev, 1)) + { + switch (data & 0x1c) + { + case 0x00: // latch m_sio_in1 (lamps) value + break; + case 0x10: + m_sio_out = 0; + for (int i = 0; i < 3; i++) + if (BIT(m_sio_in0, i)) + m_sio_out |= m_sio_ports[2 - i]->read(); + + m_sio_in1 = (m_sio_in1 << 1) | BIT(data, 0); + break; + case 0x18: + m_sio_out >>= 1; + break; + case 0x1c: + m_sio_in0 = (m_sio_in0 << 1) | BIT(data, 0); + break; + default: + logerror("serial_io: unhandled command %02X\n", data & 0x1f); + break; + } + } + m_sio_prev = data; +} + +READ_LINE_MEMBER(quickpick5_state::serial_io_r) +{ + return BIT(m_sio_out, 0); +} + +void quickpick5_state::out_w(u8 data) { - logerror("ccu_int_time rewritten with value of %02x\n", data); + /* + quickpick5: + bit 7 - patlite? + bit 1 - hopper + bit 0 - ~coin blocker + + waijokey: + bit 6 - ??? (toggle all the time) + Bit 3 - coin counter In + Bit 2 - lock medal + Bit 1 - ??? + Bit 0 - hopper + + should be split into 2 handlers later + */ + m_outport->write(data); +} + +void quickpick5_state::ccu_int_time_w(u8 data) +{ + if (m_ccu_int_time != data) + logerror("ccu_int_time rewritten with value of %02x\n", data); m_ccu_int_time = data; } -uint8_t quickpick5_state::vram_r(offs_t offset) +u8 quickpick5_state::vram_r(offs_t offset) { if ((m_control & 0x10) == 0x10) { @@ -130,14 +204,14 @@ uint8_t quickpick5_state::vram_r(offs_t offset) if ((m_control & 0x60) == 0x60) { - uint8_t *ROM = memregion("ttl")->base(); + u8 *ROM = memregion("ttl")->base(); return ROM[m_ttlrom_offset++]; } return m_vram[offset]; } -void quickpick5_state::vram_w(offs_t offset, uint8_t data) +void quickpick5_state::vram_w(offs_t offset, u8 data) { if ((m_control & 0x10) == 0x10) { @@ -209,7 +283,7 @@ void quickpick5_state::video_start() TILE_GET_INFO_MEMBER(quickpick5_state::ttl_get_tile_info) { - uint8_t *lvram = &m_vram[0]; + u8 *lvram = &m_vram[0]; int attr, code; attr = lvram[BYTE_XOR_LE((tile_index<<1)+1)]; @@ -220,7 +294,7 @@ TILE_GET_INFO_MEMBER(quickpick5_state::ttl_get_tile_info) tileinfo.set(m_ttl_gfx_index, code, attr, 0); } -uint32_t quickpick5_state::screen_update_quickpick5(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 quickpick5_state::screen_update_quickpick5(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(0, cliprect); screen.priority().fill(0, cliprect); @@ -260,145 +334,248 @@ TIMER_DEVICE_CALLBACK_MEMBER(quickpick5_state::scanline) // the following code is emulating INT_TIME of the k053252, this code will go away // when the new konami branch is merged. m_ccu_int_time_count--; - if (m_ccu_int_time_count <= 0) + if (m_ccu_int_time_count < 0) { m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); m_ccu_int_time_count = m_ccu_int_time; } } -void quickpick5_state::quickpick5_main(address_map &map) +void quickpick5_state::common_map(address_map &map) { map(0x0000, 0x7fff).rom().region("maincpu", 0); map(0x8000, 0xbfff).bankr("bank1"); map(0xc000, 0xdbff).ram().share("nvram"); map(0xdc00, 0xdc0f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)); map(0xdc40, 0xdc4f).rw(FUNC(quickpick5_state::k244_r), FUNC(quickpick5_state::k244_w)); - map(0xdc80, 0xdc80).portr("DSW3"); - map(0xdc81, 0xdc81).portr("DSW4"); - map(0xdcc0, 0xdcc0).portr("DSW1"); - map(0xdcc1, 0xdcc1).portr("DSW2"); + map(0xdc80, 0xdc80).portr("DSW1"); + map(0xdc81, 0xdc81).portr("DSW2"); + map(0xdcc0, 0xdcc0).portr("IN1"); + map(0xdcc1, 0xdcc1).portr("IN2"); map(0xdd00, 0xdd00).nopw(); - map(0xdd40, 0xdd40).noprw(); - map(0xdd80, 0xdd80).rw(FUNC(quickpick5_state::control_r), FUNC(quickpick5_state::control_w)); - map(0xddc0, 0xddc0).nopw(); - map(0xde00, 0xde00).nopw(); - map(0xde40, 0xde40).w(m_oki, FUNC(okim6295_device::write)); + map(0xdd40, 0xdd40).portr("IN3"); + map(0xdd80, 0xdd80).w(FUNC(quickpick5_state::control_w)); + map(0xde40, 0xde40).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0xe000, 0xefff).rw(FUNC(quickpick5_state::vram_r), FUNC(quickpick5_state::vram_w)); map(0xf000, 0xf7ff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0xf800, 0xffff).rw(FUNC(quickpick5_state::k245_r), FUNC(quickpick5_state::k245_w)); } +void quickpick5_state::quickpick5_main(address_map &map) +{ + common_map(map); + map(0xddc0, 0xddc0).w(FUNC(quickpick5_state::serial_io_w)); + map(0xde00, 0xde00).w(FUNC(quickpick5_state::out_w)); +} + +void quickpick5_state::waijockey_main(address_map &map) +{ + common_map(map); + map(0xdd41, 0xdd41).nopr(); // DSW3? + map(0xddc0, 0xddc0).nopw(); // bit 6 - coin counter OUT + map(0xde00, 0xde00).w(FUNC(quickpick5_state::out_w)); + //map(0xde80, 0xdfff).nopw(); +} + static INPUT_PORTS_START( quickpick5 ) + PORT_START("IN1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_SERVICE1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_READ_LINE_DEVICE_MEMBER("hopper", hopper_device, line_r) + PORT_SERVICE_NO_TOGGLE(0x08, IP_ACTIVE_LOW) + PORT_BIT(0xd0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("IN2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Reset Switch") PORT_TOGGLE + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Global Stats") PORT_TOGGLE + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Last Game Stats") PORT_TOGGLE + PORT_BIT(0xd8, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("DSW1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6") - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIPSW1:1,2,3") + PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_7C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW1:4") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPNAME( 0x30, 0x30, "Jack Pot" ) PORT_DIPLOCATION("DIPSW1:5,6") + PORT_DIPSETTING( 0x30, "300" ) + PORT_DIPSETTING( 0x20, "500" ) + PORT_DIPSETTING( 0x10, "700" ) + PORT_DIPSETTING( 0x00, "1000" ) + PORT_DIPNAME( 0xc0, 0xc0, "Max Pay" ) PORT_DIPLOCATION("DIPSW1:7,8") + PORT_DIPSETTING( 0xc0, "400" ) + PORT_DIPSETTING( 0x80, "500" ) + PORT_DIPSETTING( 0x40, "700" ) + PORT_DIPSETTING( 0x00, "1000" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x00, "Reset Switch" ) PORT_DIPLOCATION("SW2:1") - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x02, 0x00, "Global Stats" ) PORT_DIPLOCATION("SW2:2") - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x04, 0x00, "Last Game Stats" ) PORT_DIPLOCATION("SW2:3") - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - - PORT_START("DSW3") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:1") - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:2") - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:3") - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:4") - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:5") - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:6") - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:7") - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:8") - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - - PORT_START("DSW4") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:1") - PORT_DIPSETTING( 0x01, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:2") - PORT_DIPSETTING( 0x02, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:3") - PORT_DIPSETTING( 0x04, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:4") - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:5") - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:6") - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:7") - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW4:8") - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPNAME( 0x0f, 0x0f, "Max Payout" ) PORT_DIPLOCATION("DIPSW2:1,2,3,4") + PORT_DIPSETTING( 0x00, "94%" ) + PORT_DIPSETTING( 0x01, "92%" ) + PORT_DIPSETTING( 0x02, "91%" ) + PORT_DIPSETTING( 0x03, "90%" ) + PORT_DIPSETTING( 0x04, "89%" ) + PORT_DIPSETTING( 0x05, "88%" ) + PORT_DIPSETTING( 0x06, "87%" ) + PORT_DIPSETTING( 0x07, "86%" ) + PORT_DIPSETTING( 0x08, "85%" ) + PORT_DIPSETTING( 0x09, "84%" ) + PORT_DIPSETTING( 0x0a, "83%" ) + PORT_DIPSETTING( 0x0b, "82%" ) + PORT_DIPSETTING( 0x0c, "80%" ) + PORT_DIPSETTING( 0x0d, "75%" ) + PORT_DIPSETTING( 0x0e, "70%" ) + PORT_DIPSETTING( 0x0f, "65%" ) + PORT_DIPNAME( 0x30, 0x30, "Button Time" ) PORT_DIPLOCATION("DIPSW2:5,6") + PORT_DIPSETTING( 0x00, "40 Seconds" ) + PORT_DIPSETTING( 0x10, "30 Seconds" ) + PORT_DIPSETTING( 0x20, "20 Seconds" ) + PORT_DIPSETTING( 0x30, "15 Seconds" ) + PORT_DIPNAME( 0x40, 0x00, "Backup Memory" ) PORT_DIPLOCATION("DIPSW2:7") + PORT_DIPSETTING( 0x00, "Clear" ) + PORT_DIPSETTING( 0x40, "Keep" ) + PORT_DIPNAME( 0x80, 0x00, "Attract Sound" ) PORT_DIPLOCATION("DIPSW2:8") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + + PORT_START("IN3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_READ_LINE_MEMBER(quickpick5_state, serial_io_r) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") // guess + PORT_BIT(0x7e, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("SIO1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_W) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_E) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_R) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_T) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_GAMBLE_TAKE) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_GAMBLE_BET) + PORT_BIT(0x540, IP_ACTIVE_HIGH, IPT_UNKNOWN) + + PORT_START("SIO2") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6") PORT_CODE(KEYCODE_A) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7") PORT_CODE(KEYCODE_S) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("8") PORT_CODE(KEYCODE_D) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("9") PORT_CODE(KEYCODE_F) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10") PORT_CODE(KEYCODE_G) + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Clear") + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("A.S") + PORT_BIT(0x2e0, IP_ACTIVE_HIGH, IPT_UNKNOWN) + + PORT_START("SIO3") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("11") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("12") PORT_CODE(KEYCODE_X) + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("13") PORT_CODE(KEYCODE_C) + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("14") PORT_CODE(KEYCODE_V) + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("15") PORT_CODE(KEYCODE_B) + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_GAMBLE_HIGH) + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_GAMBLE_LOW) + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP) + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_START1) + PORT_BIT(0x500, IP_ACTIVE_HIGH, IPT_UNKNOWN) + + PORT_START("OUT") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("hopper", hopper_device, motor_w) +INPUT_PORTS_END + +// Control panel buttons layout: +// Payout 1 2 1-2 1-3 1-4 +// 3 4 2-3 2-4 3-4 Start +static INPUT_PORTS_START( waijockey ) + PORT_START("IN1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_READ_LINE_DEVICE_MEMBER("hopper", hopper_device, line_r) + PORT_SERVICE_NO_TOGGLE(0x02, IP_ACTIVE_LOW) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) // * B16 + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1) PORT_NAME("Medal") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN2) PORT_NAME("100 Yen") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_SERVICE1) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) // * B19 + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 1-2") PORT_CODE(KEYCODE_D) + + PORT_START("IN2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 3-4") PORT_CODE(KEYCODE_B) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 2-4") PORT_CODE(KEYCODE_V) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 2-3") PORT_CODE(KEYCODE_C) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 4") PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 3") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 1") PORT_CODE(KEYCODE_A) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 2") PORT_CODE(KEYCODE_S) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 1-4") PORT_CODE(KEYCODE_G) + + PORT_START("DSW1") + PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIPSW1:1,2,3,4") + PORT_DIPNAME( 0xf0, 0xf0, "Standard of Payout" ) PORT_DIPLOCATION("DIPSW1:5,6,7,8") + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:1") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:2") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:3") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:4") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPNAME( 0x10, 0x10, "Game Play Mode" ) PORT_DIPLOCATION("DIPSW2:5") // more like gameplay test mode + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPNAME( 0x20, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DIPSW2:6") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x40, 0x00, "Attract Sound" ) PORT_DIPLOCATION("DIPSW2:7") + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x00, "Backup Memory" ) PORT_DIPLOCATION("DIPSW2:8") + PORT_DIPSETTING( 0x00, "Clear" ) + PORT_DIPSETTING( 0x80, "Keep" ) + + PORT_START("IN3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) // * B14 + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_START1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 1-3") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x60, IP_ACTIVE_LOW, IPT_UNUSED) // battery sensor + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_VBLANK("screen") // guess + + PORT_START("OUT") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("hopper", hopper_device, motor_w) INPUT_PORTS_END void quickpick5_state::machine_start() { membank("bank1")->configure_entries(0, 0x2, memregion("maincpu")->base()+0x8000, 0x4000); - membank("bank1")->set_entry(0); + + save_item(NAME(m_control)); + save_item(NAME(m_ccu_int_time)); + save_item(NAME(m_ccu_int_time_count)); + save_item(NAME(m_sio_out)); + save_item(NAME(m_sio_in0)); + save_item(NAME(m_sio_in1)); + save_item(NAME(m_sio_prev)); } void quickpick5_state::machine_reset() { + membank("bank1")->set_entry(0); + + m_control = 0; + m_ccu_int_time = 0; + m_ccu_int_time_count = 0; + m_sio_out = m_sio_in0 = m_sio_in1 = 0; + m_sio_prev = 0; } void quickpick5_state::quickpick5(machine_config &config) @@ -407,6 +584,7 @@ void quickpick5_state::quickpick5(machine_config &config) Z80(config, m_maincpu, XTAL(32'000'000)/4); // z84c0008pec 8mhz part, 32Mhz xtal verified on PCB, divisor unknown m_maincpu->set_addrmap(AS_PROGRAM, &quickpick5_state::quickpick5_main); TIMER(config, "scantimer").configure_scanline(FUNC(quickpick5_state::scanline), "screen", 0, 1); + HOPPER(config, "hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW); K053252(config, m_k053252, XTAL(32'000'000)/4); /* K053252, xtal verified, divider not verified */ m_k053252->int1_ack().set(FUNC(quickpick5_state::vbl_ack_w)); @@ -444,6 +622,13 @@ void quickpick5_state::quickpick5(machine_config &config) m_oki->add_route(1, "mono", 1.0); } +void quickpick5_state::waijockey(machine_config &config) +{ + quickpick5(config); + m_maincpu->set_addrmap(AS_PROGRAM, &quickpick5_state::waijockey_main); +} + + ROM_START( quickp5 ) ROM_REGION( 0x10000, "maincpu", 0 ) /* main program */ ROM_LOAD( "117.10e.bin", 0x000000, 0x010000, CRC(3645e1a5) SHA1(7d0d98772f3732510e7a58f50a622fcec74087c3) ) @@ -466,5 +651,24 @@ ROM_START( quickp5 ) ROM_END -GAME( 1995, quickp5, 0, quickpick5, quickpick5, quickpick5_state, empty_init, ROT0, "Konami", "Quick Pick 5", MACHINE_NOT_WORKING) +// Konami PWB353330 +ROM_START( waijockey ) + ROM_REGION( 0x10000, "maincpu", 0 ) // main program + ROM_LOAD( "gs-257-a02.7n", 0x000000, 0x010000, CRC(e9a5f416) SHA1(b762b393bbe394339904636ff1d31d8eeb8b8d05) ) + + ROM_REGION( 0x80000, "k053245", 0 ) // sprites + ROM_LOAD32_BYTE( "gs-257-a03.3t", 0x000000, 0x020000, CRC(4aa2376b) SHA1(30e472457d10504fb805882a5eea7e548e812ff6) ) + ROM_LOAD32_BYTE( "gs-257-a05.3u", 0x000001, 0x020000, CRC(a5b18792) SHA1(d5ee5e6a8040a2297073ad4b42b8978c9865cceb) ) + ROM_LOAD32_BYTE( "gs-257-a04.10t", 0x000002, 0x020000, CRC(58c3ce20) SHA1(8d6df373a37770602d104325e27015611fdaaaff) ) + ROM_LOAD32_BYTE( "gs-257-a06.10u", 0x000003, 0x020000, CRC(260f7a2f) SHA1(3922ba8bffe7c37c6895a826e0a067627d0f3ff8) ) + + ROM_REGION( 0x80000, "ttl", 0 ) // TTL text tilemap characters? + ROM_LOAD( "gs-257-a07.28t", 0x000000, 0x020000, CRC(26e3afa6) SHA1(dba5f321b523717b9dd3f1e22ef15c1301af403b) ) + + ROM_REGION( 0x20000, "oki", 0 ) // OKIM6295 samples + ROM_LOAD( "gs-257-a01.1g", 0x000000, 0x020000, CRC(8ce0e693) SHA1(fad19ba37c7987a4d2797200b96ac9c050eb5d94) ) +ROM_END + +GAME( 1991, quickp5, 0, quickpick5, quickpick5, quickpick5_state, empty_init, ROT0, "Konami", "Quick Pick 5", MACHINE_IMPERFECT_GRAPHICS) +GAME( 1993, waijockey, 0, waijockey, waijockey, quickpick5_state, empty_init, ROT0, "Konami", "Wai Wai Jockey", MACHINE_NOT_WORKING) // works but not playable due to bad gfx diff --git a/src/mame/drivers/quizo.cpp b/src/mame/drivers/quizo.cpp index 1e3e27e9f0b..835d42e31ed 100644 --- a/src/mame/drivers/quizo.cpp +++ b/src/mame/drivers/quizo.cpp @@ -104,10 +104,10 @@ uint32_t quizo_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, uint8_t data2 = m_vram[y * 80 + x + 0x4000]; // draw 4 pixels - bitmap.pix32(y, x * 4 + 0) = m_palette->pen((BIT(data2, 7) << 3) | (BIT(data2, 3) << 2) | (BIT(data1, 7) << 1) | BIT(data1, 3)); - bitmap.pix32(y, x * 4 + 1) = m_palette->pen((BIT(data2, 6) << 3) | (BIT(data2, 2) << 2) | (BIT(data1, 6) << 1) | BIT(data1, 2)); - bitmap.pix32(y, x * 4 + 2) = m_palette->pen((BIT(data2, 5) << 3) | (BIT(data2, 1) << 2) | (BIT(data1, 5) << 1) | BIT(data1, 1)); - bitmap.pix32(y, x * 4 + 3) = m_palette->pen((BIT(data2, 4) << 3) | (BIT(data2, 0) << 2) | (BIT(data1, 4) << 1) | BIT(data1, 0)); + bitmap.pix(y, x * 4 + 0) = m_palette->pen((BIT(data2, 7) << 3) | (BIT(data2, 3) << 2) | (BIT(data1, 7) << 1) | BIT(data1, 3)); + bitmap.pix(y, x * 4 + 1) = m_palette->pen((BIT(data2, 6) << 3) | (BIT(data2, 2) << 2) | (BIT(data1, 6) << 1) | BIT(data1, 2)); + bitmap.pix(y, x * 4 + 2) = m_palette->pen((BIT(data2, 5) << 3) | (BIT(data2, 1) << 2) | (BIT(data1, 5) << 1) | BIT(data1, 1)); + bitmap.pix(y, x * 4 + 3) = m_palette->pen((BIT(data2, 4) << 3) | (BIT(data2, 0) << 2) | (BIT(data1, 4) << 1) | BIT(data1, 0)); } } diff --git a/src/mame/drivers/qvt102.cpp b/src/mame/drivers/qvt102.cpp index 78ebd367020..c2be43eccd9 100644 --- a/src/mame/drivers/qvt102.cpp +++ b/src/mame/drivers/qvt102.cpp @@ -491,7 +491,7 @@ MC6845_UPDATE_ROW( qvt102_state::crtc_update_row ) p = !(p & !((BIT(attr, 3) & (ra == 11)))); // underline p = p ^ (BIT(attr, 2) ^ ((x == cursor_x) | BIT(m_latch, 2))); // reverse - bitmap.pix32(y, x*9 + (8-i)) = palette[p ? 2 - half : 0]; + bitmap.pix(y, x*9 + (8-i)) = palette[p ? 2 - half : 0]; } } diff --git a/src/mame/drivers/qvt103.cpp b/src/mame/drivers/qvt103.cpp index 553d6f2d8c8..020b2981d50 100644 --- a/src/mame/drivers/qvt103.cpp +++ b/src/mame/drivers/qvt103.cpp @@ -52,7 +52,7 @@ u32 qvt103_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con uint16_t gfx = m_p_chargen[code << 4 | y]; for (int x = 0; x < 8; x++) - bitmap.pix32(col*12 + y, row*8 + (7 - x)) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(col*12 + y, row*8 + (7 - x)) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/qvt190.cpp b/src/mame/drivers/qvt190.cpp index 0e4778308e0..03cbf1316f5 100644 --- a/src/mame/drivers/qvt190.cpp +++ b/src/mame/drivers/qvt190.cpp @@ -64,7 +64,7 @@ MC6845_UPDATE_ROW(qvt190_state::update_row) gfx = ~gfx; for (int i = 0; i < 9; i++) - bitmap.pix32(y, x*9 + (8-i)) = palette[BIT(gfx, i) ? 2 : 0]; + bitmap.pix(y, x*9 + (8-i)) = palette[BIT(gfx, i) ? 2 : 0]; } } diff --git a/src/mame/drivers/qvt70.cpp b/src/mame/drivers/qvt70.cpp index e4cd22ee6fe..2e40ec44d68 100644 --- a/src/mame/drivers/qvt70.cpp +++ b/src/mame/drivers/qvt70.cpp @@ -226,7 +226,7 @@ uint32_t qvt70_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // 8 pixels of the character for (int p = 0; p < 8; p++) - bitmap.pix32(y * 16 + i, x * 8 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 16 + i, x * 8 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index eecc0c61e84..a1ac1e0557f 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -173,9 +173,8 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,gfx[3]; - uint8_t pen; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + int gfx[3]; if(m_color_mode) { @@ -190,13 +189,14 @@ UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) gfx[2] = 0; } - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { + uint8_t pen; pen = ((gfx[0] >> xi) & 1) ? 1 : 0; pen|= ((gfx[1] >> xi) & 1) ? 2 : 0; pen|= ((gfx[2] >> xi) & 1) ? 4 : 0; - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } @@ -239,7 +239,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) pen = ((tile_data >> xi) & 1) ? color : 0; if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/r2dtank.cpp b/src/mame/drivers/r2dtank.cpp index 1c9adc338d7..11fdb0c0802 100644 --- a/src/mame/drivers/r2dtank.cpp +++ b/src/mame/drivers/r2dtank.cpp @@ -279,8 +279,6 @@ MC6845_UPDATE_ROW( r2dtank_state::crtc_update_row ) for (uint8_t cx = 0; cx < x_count; cx++) { - uint8_t data, fore_color; - /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 3) & 0x1f00) | ((ra << 5) & 0x00e0) | @@ -289,31 +287,31 @@ MC6845_UPDATE_ROW( r2dtank_state::crtc_update_row ) if (m_flipscreen) offs = offs ^ 0x1fff; - data = m_videoram[offs]; - fore_color = (m_colorram[offs] >> 5) & 0x07; + uint8_t data = m_videoram[offs]; + uint8_t fore_color = (m_colorram[offs] >> 5) & 0x07; for (int i = 0; i < 8; i++) { - uint8_t bit, color; + uint8_t bit; if (m_flipscreen) { bit = data & 0x01; - data = data >> 1; + data >>= 1; } else { bit = data & 0x80; - data = data << 1; + data <<= 1; } - color = bit ? fore_color : 0; - bitmap.pix32(y, x) = m_palette->pen_color(color); + uint8_t const color = bit ? fore_color : 0; + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } - ma = ma + 1; + ma++; } } diff --git a/src/mame/drivers/rabbit.cpp b/src/mame/drivers/rabbit.cpp index 17335829a49..182773d4a09 100644 --- a/src/mame/drivers/rabbit.cpp +++ b/src/mame/drivers/rabbit.cpp @@ -340,26 +340,21 @@ void rabbit_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* the sprite bitmap can probably be handled better than this ... */ void rabbit_state::clearspritebitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int startx, starty; - int y; - int amountx,amounty; - uint16_t *dstline; - /* clears a *sensible* amount of the sprite bitmap */ - startx = (m_spriteregs[0]&0x00000fff); - starty = (m_spriteregs[1]&0x0fff0000)>>16; + int startx = (m_spriteregs[0]&0x00000fff); + int starty = (m_spriteregs[1]&0x0fff0000)>>16; startx-=200; starty-=200; - amountx =650; - amounty =600; + int amountx =650; + int amounty =600; if (startx < 0) { amountx += startx; startx = 0; } if ((startx+amountx)>=0x1000) amountx-=(0x1000-(startx+amountx)); - for (y=0; y<amounty;y++) + for (int y=0; y<amounty;y++) { - dstline = &m_sprite_bitmap->pix16((starty+y)&0xfff); + uint16_t *const dstline = &m_sprite_bitmap->pix((starty+y)&0xfff); memset(dstline+startx,0x00,amountx*2); } } @@ -367,17 +362,11 @@ void rabbit_state::clearspritebitmap( bitmap_ind16 &bitmap, const rectangle &cli /* todo: fix zoom, it's inaccurate and this code is ugly */ void rabbit_state::draw_sprite_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint32_t x,y; - uint16_t *srcline; - uint16_t *dstline; - uint16_t pixdata; uint32_t xsize, ysize; - uint32_t xdrawpos, ydrawpos; uint32_t xstep,ystep; - int startx, starty; - startx = ((m_spriteregs[0]&0x00000fff)); - starty = ((m_spriteregs[1]&0x0fff0000)>>16); + int startx = ((m_spriteregs[0]&0x00000fff)); + int starty = ((m_spriteregs[1]&0x0fff0000)>>16); /* zoom compensation? */ startx-=((m_spriteregs[1]&0x000001ff)>>1); @@ -390,22 +379,21 @@ void rabbit_state::draw_sprite_bitmap( bitmap_ind16 &bitmap, const rectangle &cl ysize+=0x80; xstep = ((320*128)<<16) / xsize; ystep = ((224*128)<<16) / ysize; - ydrawpos = 0; - for (y=0;y<ysize;y+=0x80) + for (uint32_t y=0;y<ysize;y+=0x80) { - ydrawpos = ((y>>7)*ystep); + uint32_t ydrawpos = ((y>>7)*ystep); ydrawpos >>=16; if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - srcline = &m_sprite_bitmap->pix16((starty+(y>>7))&0xfff); - dstline = &bitmap.pix16(ydrawpos); + uint16_t const *const srcline = &m_sprite_bitmap->pix((starty+(y>>7))&0xfff); + uint16_t *const dstline = &bitmap.pix(ydrawpos); - for (x=0;x<xsize;x+=0x80) + for (uint32_t x=0;x<xsize;x+=0x80) { - xdrawpos = ((x>>7)*xstep); + uint32_t xdrawpos = ((x>>7)*xstep); xdrawpos >>=16; - pixdata = srcline[(startx+(x>>7))&0xfff]; + uint16_t const pixdata = srcline[(startx+(x>>7))&0xfff]; if (pixdata) if ((xdrawpos >= cliprect.min_x) && (xdrawpos <= cliprect.max_x)) diff --git a/src/mame/drivers/radio86.cpp b/src/mame/drivers/radio86.cpp index 81588e076c0..882f4a46867 100644 --- a/src/mame/drivers/radio86.cpp +++ b/src/mame/drivers/radio86.cpp @@ -176,7 +176,7 @@ INPUT_PORTS_START( radio86 ) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("LINE8") @@ -195,7 +195,7 @@ INPUT_PORTS_END INPUT_PORTS_START( kr03 ) PORT_START("LINE0") PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 1b28e1aa030..15889f0a18d 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -830,7 +830,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_base_state::hgdc_display_pixels ) for (int xi = 0; xi < 16; xi++) // blank screen when VT102 output active (..) { if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = 0; + bitmap.pix(y, x + xi) = 0; } return; // no output from graphics option } @@ -864,7 +864,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_base_state::hgdc_display_pixels ) (BIT(plane3 ,xi) << 3); if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = paletteX[mono ? (pen + 16) : pen]; + bitmap.pix(y, x + xi) = paletteX[mono ? (pen + 16) : pen]; } } diff --git a/src/mame/drivers/rastersp.cpp b/src/mame/drivers/rastersp.cpp index eddccf092e9..b5925895b1a 100644 --- a/src/mame/drivers/rastersp.cpp +++ b/src/mame/drivers/rastersp.cpp @@ -244,7 +244,7 @@ void rastersp_state::dpylist_w(uint32_t data) int y = 0; int x = 0; - uint16_t *bmpptr = &m_update_bitmap.pix16(0, 0); + uint16_t *bmpptr = &m_update_bitmap.pix(0, 0); while (y < 240) { diff --git a/src/mame/drivers/rc702.cpp b/src/mame/drivers/rc702.cpp index 2f54c89d024..31c43417c83 100644 --- a/src/mame/drivers/rc702.cpp +++ b/src/mame/drivers/rc702.cpp @@ -281,13 +281,13 @@ I8275_DRAW_CHARACTER_MEMBER( rc702_state::display_pixels ) gfx ^= 0xff; // Highlight not used - bitmap.pix32(y, x++) = palette[BIT(gfx, 1) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 2) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 3) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 4) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 5) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 6) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 7) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 1) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 2) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 3) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 4) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 5) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 6) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 7) ? 1 : 0]; } // Baud rate generator. All inputs are 0.614MHz. diff --git a/src/mame/drivers/rc759.cpp b/src/mame/drivers/rc759.cpp index 35dac7a1991..4867bb84cf7 100644 --- a/src/mame/drivers/rc759.cpp +++ b/src/mame/drivers/rc759.cpp @@ -356,7 +356,7 @@ I82730_UPDATE_ROW( rc759_state::txt_update_row ) width = 15 - width; for (int p = 0; p < width; p++) - bitmap.pix32(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white() : rgb_t::black(); } } diff --git a/src/mame/drivers/rd100.cpp b/src/mame/drivers/rd100.cpp index 7f9cb4ea167..2e71d92b050 100644 --- a/src/mame/drivers/rd100.cpp +++ b/src/mame/drivers/rd100.cpp @@ -77,7 +77,7 @@ void rd100_state::machine_reset() HD44780_PIXEL_UPDATE(rd100_state::pixel_update) { if (pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } uint8_t rd100_state::keys_r() diff --git a/src/mame/drivers/rex6000.cpp b/src/mame/drivers/rex6000.cpp index 81812f8a1c0..acf8a15ae3e 100644 --- a/src/mame/drivers/rex6000.cpp +++ b/src/mame/drivers/rex6000.cpp @@ -623,7 +623,7 @@ void oz750_state::machine_reset() uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); + uint16_t const lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); if (m_lcd_enabled) { @@ -634,7 +634,7 @@ uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int b=0; b<8; b++) { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 7); + bitmap.pix(y, (x * 8) + b) = BIT(data, 7); data <<= 1; } } @@ -649,7 +649,7 @@ uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitma uint32_t oz750_state::screen_update_oz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); + uint16_t const lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); if (m_lcd_enabled && m_power_on) { @@ -660,7 +660,7 @@ uint32_t oz750_state::screen_update_oz(screen_device &screen, bitmap_ind16 &bitm for (int b=0; b<8; b++) { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 0); + bitmap.pix(y, (x * 8) + b) = BIT(data, 0); data >>= 1; } } diff --git a/src/mame/drivers/rltennis.cpp b/src/mame/drivers/rltennis.cpp index 7578ddd8df5..7ace25a62eb 100644 --- a/src/mame/drivers/rltennis.cpp +++ b/src/mame/drivers/rltennis.cpp @@ -74,11 +74,11 @@ player - when there's nothing to play - first, empty 2k of ROMs are selected. #define RLT_REFRESH_RATE 60 #define RLT_TIMER_FREQ (RLT_REFRESH_RATE*256) -#define RLT_XTAL XTAL(12'000'000) +#define RLT_XTAL XTAL(32'000'000) uint16_t rltennis_state::io_r() { - return (ioport("P1" )->read()&0x1fff) | (m_unk_counter<<13); /* top 3 bits controls smaple address update */ + return (ioport("P1" )->read()&0x1fff) | (m_unk_counter<<13); // Top 3 bits control sample address update } void rltennis_state::snd1_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -102,8 +102,8 @@ void rltennis_state::rltennis_main(address_map &map) map(0x720007, 0x720007).w("ramdac", FUNC(ramdac_device::index_r_w)); map(0x740000, 0x740001).w(FUNC(rltennis_state::snd1_w)); map(0x760000, 0x760001).w(FUNC(rltennis_state::snd2_w)); - map(0x780000, 0x780001).nopw(); /* sound control, unknown, usually = 0x0044 */ - map(0x7a0000, 0x7a0003).nopr(); /* unknown, read only at boot time*/ + map(0x780000, 0x780001).nopw(); // Sound control, unknown, usually = 0x0044 + map(0x7a0000, 0x7a0003).nopr(); // Unknown, read only at boot time map(0x7e0000, 0x7e0001).r(FUNC(rltennis_state::io_r)); map(0x7e0002, 0x7e0003).portr("P2"); } @@ -139,13 +139,13 @@ INPUT_PORTS_END TIMER_CALLBACK_MEMBER(rltennis_state::sample_player) { - if((m_dac_counter&0x7ff) == 0x7ff) /* reload top address bits */ + if((m_dac_counter&0x7ff) == 0x7ff) // Reload top address bits { m_sample_rom_offset[0]=(( m_data740000 >> m_offset_shift ) & 0xff )<<11; m_sample_rom_offset[1]=(( m_data760000 >> m_offset_shift ) & 0xff )<<11; - m_offset_shift^=8; /* switch between MSB and LSB */ + m_offset_shift^=8; // Switch between MSB and LSB } - ++m_dac_counter; /* update low address bits */ + ++m_dac_counter; // Update low address bits m_dac[0]->write(m_samples[0][m_sample_rom_offset[0] + (m_dac_counter & 0x7ff)]); m_dac[1]->write(m_samples[1][m_sample_rom_offset[1] + (m_dac_counter & 0x7ff)]); @@ -154,9 +154,9 @@ TIMER_CALLBACK_MEMBER(rltennis_state::sample_player) INTERRUPT_GEN_MEMBER(rltennis_state::interrupt) { - ++m_unk_counter; /* frame counter? verify */ + ++m_unk_counter; // Frame counter? verify device.execute().set_input_line(4, HOLD_LINE); - device.execute().set_input_line(1, HOLD_LINE); /* hack, to avoid dead loop */ + device.execute().set_input_line(1, HOLD_LINE); // Hack, to avoid dead loop } void rltennis_state::machine_start() @@ -183,7 +183,7 @@ void rltennis_state::ramdac_map(address_map &map) void rltennis_state::rltennis(machine_config &config) { - M68000(config, m_maincpu, RLT_XTAL/2); /* 68000P8 ??? */ + M68000(config, m_maincpu, RLT_XTAL/8); // MC68000P8, divider is a guess m_maincpu->set_addrmap(AS_PROGRAM, &rltennis_state::rltennis_main); m_maincpu->set_vblank_int("screen", FUNC(rltennis_state::interrupt)); @@ -204,8 +204,8 @@ void rltennis_state::rltennis(machine_config &config) SPEAKER(config, "speaker").front_center(); - DAC_8BIT_R2R(config, "dac1", 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC - DAC_8BIT_R2R(config, "dac2", 0).add_route(ALL_OUTPUTS, "speaker", 0.25); // unknown DAC + DAC_8BIT_R2R(config, "dac1", 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // Unknown DAC + DAC_8BIT_R2R(config, "dac2", 0).add_route(ALL_OUTPUTS, "speaker", 0.25); // Unknown DAC voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref")); vref.add_route(0, "dac1", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "dac1", -1.0, DAC_VREF_NEG_INPUT); vref.add_route(0, "dac2", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "dac2", -1.0, DAC_VREF_NEG_INPUT); @@ -233,6 +233,40 @@ ROM_START( rltennis ) ROM_REGION( 0x080000, "samples2", 0 ) ROM_LOAD( "tennis_3.u52", 0x00000, 0x80000, CRC(517dcd0e) SHA1(b2703e185ee8cf7e115ea07151e7bee8be34948b) ) + + ROM_REGION( 0x2e5, "plds", 0 ) + ROM_LOAD( "realitytennis_gal22v10.u20", 0x000, 0x2e5, BAD_DUMP CRC(13be6cec) SHA1(5a07ed3ac6a1993196e0e76b852d0ba132f5ddb9) ) // Bruteforced but verified +ROM_END + +// PCB marked as "TCH-MAVIR.001 +// Two TI TPC1020AF instead of two Actel A1020B, also labeled as JOAQUIN (A) and JUANA (B) +ROM_START( rltennisa ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "tennis_1_a.bin", 0x00001, 0x80000, CRC(30bd9f1d) SHA1(52225793fb1fee4d395f21c45756e9244cf60b9e) ) + ROM_LOAD16_BYTE( "tennis_2_a.bin", 0x00000, 0x80000, CRC(f2997957) SHA1(c2ccaecd337c46cd9e4a40d43f30f203efc10111) ) + + ROM_REGION( 0x1000000, "gfx", ROMREGION_ERASE00 ) + ROM_LOAD( "tennis_5.u33", 0x000000, 0x80000, CRC(067a2e4b) SHA1(ab5a227de2b0c51b17aeca68c8af1bf224904ac8) ) + ROM_LOAD( "tennis_6.u34", 0x080000, 0x80000, CRC(901df2c1) SHA1(7e57d7c7e281ddc02a3e34178d3e471bd8e1d572) ) + ROM_LOAD( "tennis_7.u35", 0x100000, 0x80000, CRC(8d70fb37) SHA1(250c4c3d32e5a7e17413ee41e1abccb0492b63fd) ) + ROM_LOAD( "tennis_8.u36", 0x180000, 0x80000, CRC(26d202ba) SHA1(0e841e35de328f23624a19780a734a18f5409d69) ) + ROM_LOAD( "tennis_9.u37", 0x200000, 0x80000, CRC(1d164ee0) SHA1(b9c80b3c0dadbff36a04141b8995a5282a8d10f7) ) + ROM_LOAD( "tennis_10.u38",0x280000, 0x80000, CRC(fd2c6647) SHA1(787f236d5b72ee24d39e783eb2453bea58f07290) ) + ROM_LOAD( "tennis_11.u39",0x300000, 0x80000, CRC(a59dc0c8) SHA1(48f258e74fbb64b7538c9777d7598774ca8396eb) ) + ROM_LOAD( "tennis_12.u40",0x380000, 0x80000, CRC(b9677887) SHA1(84b79864555d3d6e9c443913910a055e27d30d08) ) + ROM_LOAD( "tennis_13.u41",0x400000, 0x80000, CRC(3d4fbcac) SHA1(e01f479d7d516ff83cbbd82d83617146d7a242d3) ) + ROM_LOAD( "tennis_14.u42",0x480000, 0x80000, CRC(37fe0f5d) SHA1(7593f1ea07bc0a741c952e6850bed1bf0a824510) ) + + ROM_REGION( 0x080000, "samples1", 0 ) + ROM_LOAD( "tennis_4.u59", 0x00000, 0x80000, CRC(f56462ea) SHA1(638777e12f2649a5b4366f034f0ba721fc4580a8) ) + + ROM_REGION( 0x080000, "samples2", 0 ) + ROM_LOAD( "tennis_3.u52", 0x00000, 0x80000, CRC(517dcd0e) SHA1(b2703e185ee8cf7e115ea07151e7bee8be34948b) ) + + ROM_REGION( 0x3fc, "plds", 0 ) + ROM_LOAD( "gal16v8.ic23", 0x000, 0x117, CRC(7bc89e80) SHA1(6b34527121e4dbac37fbbd79c57a7eab81de0198) ) + ROM_LOAD( "gal22v10.ic2", 0x117, 0x2e5, CRC(b5a7cb92) SHA1(05d6e8c8208ac486e849de3322f049bcd38561e1) ) ROM_END -GAME( 1993, rltennis, 0, rltennis, rltennis, rltennis_state, empty_init, ROT0, "TCH", "Reality Tennis", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1993, rltennis, 0, rltennis, rltennis, rltennis_state, empty_init, ROT0, "TCH", "Reality Tennis (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1993, rltennisa, rltennis, rltennis, rltennis, rltennis_state, empty_init, ROT0, "TCH", "Reality Tennis (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/roland_cm32p.cpp b/src/mame/drivers/roland_cm32p.cpp index 9229131cd89..2c3da094385 100644 --- a/src/mame/drivers/roland_cm32p.cpp +++ b/src/mame/drivers/roland_cm32p.cpp @@ -333,20 +333,19 @@ cm32p_state::cm32p_state(const machine_config &mconfig, device_type type, const // screen update function from Roland D-110 uint32_t cm32p_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,gfx; - uint16_t sy=0,x; - const u8 *data = lcd->render(); + u16 sy=0; + u8 const *const data = lcd->render(); bitmap.fill(0); - for (y = 0; y < 2; y++) + for (u8 y = 0; y < 2; y++) { - for (ra = 0; ra < 9; ra++) + for (u8 ra = 0; ra < 9; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 16; x++) + for (u16 x = 0; x < 16; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) gfx = data[x*16 + y*640 + ra]; diff --git a/src/mame/drivers/roland_d10.cpp b/src/mame/drivers/roland_d10.cpp index c6f952eb399..3df347a0777 100644 --- a/src/mame/drivers/roland_d10.cpp +++ b/src/mame/drivers/roland_d10.cpp @@ -109,20 +109,19 @@ private: uint32_t roland_d10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx; - uint16_t sy=0,x; - const uint8_t *data = m_lcd->render(); + uint16_t sy=0; + uint8_t const *const data = m_lcd->render(); bitmap.fill(0); - for (y = 0; y < 2; y++) + for (uint8_t y = 0; y < 2; y++) { - for (ra = 0; ra < 9; ra++) + for (uint8_t ra = 0; ra < 9; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 16; x++) + for (uint16_t x = 0; x < 16; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 8) gfx = data[x*16 + y*640 + ra]; diff --git a/src/mame/drivers/roland_mt32.cpp b/src/mame/drivers/roland_mt32.cpp index 73da136698d..7e1da5e0e19 100644 --- a/src/mame/drivers/roland_mt32.cpp +++ b/src/mame/drivers/roland_mt32.cpp @@ -249,7 +249,7 @@ uint32_t mt32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for(int y=0; y<8; y++) { uint8_t v = data[c*8+y]; for(int x=0; x<5; x++) - bitmap.pix16(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; + bitmap.pix(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; } return 0; } diff --git a/src/mame/drivers/roland_s10.cpp b/src/mame/drivers/roland_s10.cpp index 7b063794a06..7c198ac45b5 100644 --- a/src/mame/drivers/roland_s10.cpp +++ b/src/mame/drivers/roland_s10.cpp @@ -90,13 +90,13 @@ private: HD44780_PIXEL_UPDATE(roland_s10_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } HD44780_PIXEL_UPDATE(roland_s220_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } u8 roland_s10_state::qdd_r(offs_t offset) diff --git a/src/mame/drivers/rollext.cpp b/src/mame/drivers/rollext.cpp index 28dc8130117..d7ce3409478 100644 --- a/src/mame/drivers/rollext.cpp +++ b/src/mame/drivers/rollext.cpp @@ -123,7 +123,7 @@ void rollext_renderer::render_texture_scan(int32_t scanline, const extent_t &ext float du = extent.param[0].dpdx; float dv = extent.param[1].dpdx; - uint32_t *fb = &m_fb->pix32(scanline); + uint32_t *fb = &m_fb->pix(scanline); uint32_t texbot = extradata.tex_bottom; uint32_t texleft = extradata.tex_left; @@ -361,7 +361,7 @@ uint32_t rollext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma int ii=0; for (int j=0; j < 384; j++) { - uint32_t *fb = &bitmap.pix32(j); + uint32_t *fb = &bitmap.pix(j); for (int i=0; i < 512; i++) { uint8_t p = m_texture[ii++]; diff --git a/src/mame/drivers/rotaryf.cpp b/src/mame/drivers/rotaryf.cpp index 2b288225fd6..fd7da906eda 100644 --- a/src/mame/drivers/rotaryf.cpp +++ b/src/mame/drivers/rotaryf.cpp @@ -166,24 +166,20 @@ TIMER_DEVICE_CALLBACK_MEMBER(rotaryf_state::rotaryf_interrupt) uint32_t rotaryf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - pen_t pens[2]; - pens[0] = rgb_t::black(); - pens[1] = rgb_t::white(); - uint8_t i,x,y,data; + pen_t const pens[2] = { rgb_t::black(), rgb_t::white() }; - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - x = offs << 3; - y = offs >> 5; - data = m_videoram[offs]; + uint8_t x = offs << 3; + uint8_t y = offs >> 5; + uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) { if (m_flipscreen) - bitmap.pix32(255-y, 247-(x|i)) = pens[data & 1]; + bitmap.pix(255-y, 247-(x|i)) = pens[data & 1]; else - bitmap.pix32(y, x|i) = pens[data & 1]; + bitmap.pix(y, x|i) = pens[data & 1]; data >>= 1; } diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp index d6d9188f32e..4bee2a01fbc 100644 --- a/src/mame/drivers/roul.cpp +++ b/src/mame/drivers/roul.cpp @@ -255,10 +255,9 @@ void roul_state::video_start() uint32_t roul_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i,j; - for (i = 0; i < 256; i++) - for (j = 0; j < 256; j++) - bitmap.pix16(j, i) = m_videobuf[j * 256 + 255 - i]; + for (int i = 0; i < 256; i++) + for (int j = 0; j < 256; j++) + bitmap.pix(j, i) = m_videobuf[j * 256 + 255 - i]; return 0; } diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp index 7fcb6e4df24..6cc15457f04 100644 --- a/src/mame/drivers/royalmah.cpp +++ b/src/mame/drivers/royalmah.cpp @@ -441,7 +441,7 @@ uint32_t royalmah_state::screen_update_royalmah(screen_device &screen, bitmap_rg { uint8_t pen = ((data2 >> 1) & 0x08) | ((data2 << 2) & 0x04) | ((data1 >> 3) & 0x02) | ((data1 >> 0) & 0x01); - bitmap.pix32(y, x) = m_palette->pen((m_palette_base << 4) | pen); + bitmap.pix(y, x) = m_palette->pen((m_palette_base << 4) | pen); x = (m_flip_screen) ? x - 1 : x + 1; data1 = data1 >> 1; diff --git a/src/mame/drivers/rt1715.cpp b/src/mame/drivers/rt1715.cpp index 271d03ded1c..8e7c10ca402 100644 --- a/src/mame/drivers/rt1715.cpp +++ b/src/mame/drivers/rt1715.cpp @@ -424,7 +424,7 @@ WRITE_LINE_MEMBER(rt1715_state::crtc_drq_w) I8275_DRAW_CHARACTER_MEMBER(rt1715_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = (lten) ? 0xff : 0; if (!vsp) @@ -434,7 +434,7 @@ I8275_DRAW_CHARACTER_MEMBER(rt1715_state::crtc_display_pixels) gfx ^= 0xff; for (u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/rx78.cpp b/src/mame/drivers/rx78.cpp index dcc51357c52..0fb4bb262e3 100644 --- a/src/mame/drivers/rx78.cpp +++ b/src/mame/drivers/rx78.cpp @@ -160,7 +160,7 @@ uint32_t rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, color |= ((pen[2] & 1) << 2); if(color) - bitmap.pix16(y+bordery, x+i+borderx) = color | 8; + bitmap.pix(y+bordery, x+i+borderx) = color | 8; /* fg color */ pen[0] = (m_pri_mask & 0x01) ? (m_vram[count + 0x0000] >> (i)) : 0x00; @@ -172,7 +172,7 @@ uint32_t rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, color |= ((pen[2] & 1) << 2); if(color) - bitmap.pix16(y+bordery, x+i+borderx) = color; + bitmap.pix(y+bordery, x+i+borderx) = color; } count++; } diff --git a/src/mame/drivers/rz1.cpp b/src/mame/drivers/rz1.cpp index c90929eca84..2bd594b568b 100644 --- a/src/mame/drivers/rz1.cpp +++ b/src/mame/drivers/rz1.cpp @@ -206,7 +206,7 @@ HD44780_PIXEL_UPDATE( rz1_state::lcd_pixel_update ) return; if (line < 1 && pos < 16) - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } uint8_t rz1_state::upd934g_c_data_r(offs_t offset) diff --git a/src/mame/drivers/s11.cpp b/src/mame/drivers/s11.cpp index d1c655aa888..e6219180c92 100644 --- a/src/mame/drivers/s11.cpp +++ b/src/mame/drivers/s11.cpp @@ -466,13 +466,23 @@ void s11_state::s11(machine_config &config) m_audiocpu->set_addrmap(AS_PROGRAM, &s11_state::s11_audio_map); INPUT_MERGER_ANY_HIGH(config, m_audioirq).output_handler().set_inputline(m_audiocpu, M6808_IRQ_LINE); - SPEAKER(config, "speaker").front_center(); - MC1408(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25); + MC1408(config, m_dac, 0); voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref")); vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT); - SPEAKER(config, "speech").front_center(); - HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, "speech", 0.5); + // common CVSD filter for system 11 and 11a, this is also the same filter circuit as Sinistar/System 6 uses, and is ALMOST the same filter from the s11 bg sound boards, see /mame/audio/s11c_bg.cpp + // The CVSD filter has a large gain, about 4.6x + // The filter is boosting the ~5vpp audio signal from the CVSD chip to a ~23vpp (really ~17vpp) theoretical audio signal that the s11 + // mainboard outputs on its volume control-repurposed-as-audio-out connector. + // In reality, the S11 mainboard outputs audio at a virtual ground level between +5v and -12v (so, 17VPP balanced around -7VDC), but since + // the CVSD chip's internal DAC can only output between a bit over +0x180/-0x180 out of 0x200, the most voltage it can ever output is + // between (assuming 0x1ff is 5VDC and 0x300 is 0VDC) a max of 4.375VDC and a min of 0.625VDC, i.e. 3.75VPP centered on 2.5VDC. + // In reality, the range is likely less than that. + // This means multiplying a 3.75VPP signal by 4.6 is 17.25VPP, which is almost exactly the expected 17V (12v+5v) VPP the output should have. + FILTER_BIQUAD(config, m_cvsd_filter2).opamp_mfb_lowpass_setup(RES_K(27), RES_K(15), RES_K(27), CAP_P(4700), CAP_P(1200)); + FILTER_BIQUAD(config, m_cvsd_filter).opamp_mfb_lowpass_setup(RES_K(43), RES_K(36), RES_K(180), CAP_P(1800), CAP_P(180)); + m_cvsd_filter->add_route(ALL_OUTPUTS, m_cvsd_filter2, 1.0); + HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, m_cvsd_filter, 1.0); PIA6821(config, m_pias, 0); m_pias->readpa_handler().set(FUNC(s11_state::sound_r)); @@ -489,26 +499,37 @@ void s11_state::s11_bgs(machine_config &config) { s11(config); /* Add the background sound card */ - SPEAKER(config, "bgspk").front_center(); S11_BGS(config, m_bg); + m_dac->add_route(ALL_OUTPUTS, m_bg, 0.5/2.0); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_bg, 0.5/2.0); m_pia34->ca2_handler().set(m_bg, FUNC(s11_bgs_device::resetq_w)); m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w)); m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w)); - m_bg->add_route(ALL_OUTPUTS, "bgspk", 0.5); + SPEAKER(config, "speaker").front_center(); + m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0); } void s11_state::s11_bgm(machine_config &config) { s11(config); /* Add the background music card */ - SPEAKER(config, "bgspk").front_center(); S11_BGM(config, m_bg); + m_dac->add_route(ALL_OUTPUTS, m_bg, 0.5319/2.0); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_bg, 0.5319/2.0); m_pia34->ca2_handler().set(m_bg, FUNC(s11_bgm_device::resetq_w)); m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w)); m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w)); - m_bg->add_route(ALL_OUTPUTS, "bgspk", 1.0); + SPEAKER(config, "speaker").front_center(); + m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0); } +void s11_state::s11_only(machine_config &config) +{ + s11(config); + SPEAKER(config, "speaker").front_center(); + m_dac->add_route(ALL_OUTPUTS, "speaker", 0.25); + m_cvsd_filter2->add_route(ALL_OUTPUTS, "speaker", 0.25); +} /*---------------------------- / Grand Lizard 04/86 (#523) @@ -709,8 +730,8 @@ GAME( 1986, rdkng_l1, rdkng_l4, s11_bgm, s11, s11_state, init_s11, ROT0, "Willia GAME( 1986, rdkng_l2, rdkng_l4, s11_bgm, s11, s11_state, init_s11, ROT0, "Williams", "Road Kings (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) GAME( 1986, rdkng_l3, rdkng_l4, s11_bgm, s11, s11_state, init_s11, ROT0, "Williams", "Road Kings (L-3)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) -GAME( 1986, tts_l2, 0, s11, s11, s11_state, init_s11, ROT0, "Williams", "Tic-Tac-Strike (Shuffle) (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 1986, tts_l1, tts_l2, s11, s11, s11_state, init_s11, ROT0, "Williams", "Tic-Tac-Strike (Shuffle) (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -GAME( 1987, gmine_l2, 0, s11, s11, s11_state, init_s11, ROT0, "Williams", "Gold Mine (Shuffle) (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) -GAME( 1987, tdawg_l1, 0, s11, s11, s11_state, init_s11, ROT0, "Williams", "Top Dawg (Shuffle) (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) -GAME( 1987, shfin_l1, 0, s11, s11, s11_state, init_s11, ROT0, "Williams", "Shuffle Inn (Shuffle) (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) +GAME( 1986, tts_l2, 0, s11_only, s11, s11_state, init_s11, ROT0, "Williams", "Tic-Tac-Strike (Shuffle) (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 1986, tts_l1, tts_l2, s11_only, s11, s11_state, init_s11, ROT0, "Williams", "Tic-Tac-Strike (Shuffle) (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +GAME( 1987, gmine_l2, 0, s11_only, s11, s11_state, init_s11, ROT0, "Williams", "Gold Mine (Shuffle) (L-2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) +GAME( 1987, tdawg_l1, 0, s11_only, s11, s11_state, init_s11, ROT0, "Williams", "Top Dawg (Shuffle) (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) +GAME( 1987, shfin_l1, 0, s11_only, s11, s11_state, init_s11, ROT0, "Williams", "Shuffle Inn (Shuffle) (L-1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/s11a.cpp b/src/mame/drivers/s11a.cpp index 8b2aea080b8..9a8b8f6a001 100644 --- a/src/mame/drivers/s11a.cpp +++ b/src/mame/drivers/s11a.cpp @@ -218,13 +218,24 @@ void s11a_state::s11a_base(machine_config &config) m_audiocpu->set_addrmap(AS_PROGRAM, &s11_state::s11_audio_map); INPUT_MERGER_ANY_HIGH(config, m_audioirq).output_handler().set_inputline(m_audiocpu, M6802_IRQ_LINE); - SPEAKER(config, "speaker").front_center(); - MC1408(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25); + MC1408(config, m_dac, 0); voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref")); vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT); - SPEAKER(config, "speech").front_center(); - HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, "speech", 0.50); + // common CVSD filter for system 11 and 11a, this is also the same filter circuit as Sinistar/System 6 uses, + // and is ALMOST the same filter from the s11 bg sound boards, see /mame/audio/s11c_bg.cpp + // The CVSD filter has a large gain, about 4.6x + // The filter is boosting the ~5vpp audio signal from the CVSD chip to a ~23vpp (really ~17vpp) theoretical audio signal that the s11 + // mainboard outputs on its volume control-repurposed-as-audio-out connector. + // In reality, the S11 mainboard outputs audio at a virtual ground level between +5v and -12v (so, 17VPP balanced around -7VDC), but since + // the CVSD chip's internal DAC can only output between a bit over +0x180/-0x180 out of 0x200, the most voltage it can ever output is + // between (assuming 0x1ff is 5VDC and 0x300 is 0VDC) a max of 4.375VDC and a min of 0.625VDC, i.e. 3.75VPP centered on 2.5VDC. + // In reality, the range is likely less than that. + // This means multiplying a 3.75VPP signal by 4.6 is 17.25VPP, which is almost exactly the expected 17V (12v+5v) VPP the output should have. + FILTER_BIQUAD(config, m_cvsd_filter2).opamp_mfb_lowpass_setup(RES_K(27), RES_K(15), RES_K(27), CAP_P(4700), CAP_P(1200)); + FILTER_BIQUAD(config, m_cvsd_filter).opamp_mfb_lowpass_setup(RES_K(43), RES_K(36), RES_K(180), CAP_P(1800), CAP_P(180)); + m_cvsd_filter->add_route(ALL_OUTPUTS, m_cvsd_filter2, 1.0); + HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, m_cvsd_filter, 1.0); PIA6821(config, m_pias, 0); m_pias->readpa_handler().set(FUNC(s11_state::sound_r)); @@ -241,24 +252,28 @@ void s11a_state::s11a(machine_config &config) { s11a_base(config); /* Add the background music card */ - SPEAKER(config, "bgspk").front_center(); S11_BG(config, m_bg); + m_dac->add_route(ALL_OUTPUTS, m_bg, 0.4484/2.0); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_bg, 0.4484/2.0); m_pia34->ca2_handler().set(m_bg, FUNC(s11_bg_device::resetq_w)); m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w)); m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w)); - m_bg->add_route(ALL_OUTPUTS, "bgspk", 1.0); + SPEAKER(config, "speaker").front_center(); + m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0); } void s11a_state::s11a_obg(machine_config &config) { s11a_base(config); /* Add the older-style background music card */ - SPEAKER(config, "bgspk").front_center(); S11_OBG(config, m_bg); + m_dac->add_route(ALL_OUTPUTS, m_bg, 0.5319/2.0); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_bg, 0.5319/2.0); m_pia34->ca2_handler().set(m_bg, FUNC(s11_obg_device::resetq_w)); m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w)); m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w)); - m_bg->add_route(ALL_OUTPUTS, "bgspk", 1.0); + SPEAKER(config, "speaker").front_center(); + m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0); } /*------------------------ diff --git a/src/mame/drivers/s11b.cpp b/src/mame/drivers/s11b.cpp index bcc1965354d..a91622b7e22 100644 --- a/src/mame/drivers/s11b.cpp +++ b/src/mame/drivers/s11b.cpp @@ -27,7 +27,7 @@ - Bad Cats: "H" "Enter" - Banzai Run: "S" "D" "F" (won't start due to calibration? needs more investigation, try hitting E and / and lots of keys until calibration finishes); - starts music - Big Guns: "D" "F" "U" - - Black Knight 2000: "D" "F" "Y"; 'x' starts music + - Black Knight 2000: "D" "F" "Y"; 'x' starts music; 'enter' 'left' and 'right' lock the 3 balls in the upper playfield to start the multiball. hold keypad '.' to activate the lightning wheel. '=' is the after-drawbridge target to score jackpots etc - Cyclone: Nothing, game does not have switches to check for balls in the trough. - Earthshaker: "D" "F" "W" - Elvira and the Party Monsters: "D" "F" "U" @@ -300,13 +300,24 @@ void s11b_state::s11b_base(machine_config &config) m_audiocpu->set_addrmap(AS_PROGRAM, &s11_state::s11_audio_map); INPUT_MERGER_ANY_HIGH(config, m_audioirq).output_handler().set_inputline(m_audiocpu, M6802_IRQ_LINE); - SPEAKER(config, "speaker").front_center(); - MC1408(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25); + MC1408(config, m_dac, 0); voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref")); vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT); - SPEAKER(config, "speech").front_center(); - HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, "speech", 0.50); + // this CVSD filter differs from the one on system 11 and 11a, possibly simplified so it uses more of the same components, or so it has a different + // shape/cutoff than the filter on the bg music/speech board, on purpose. + // The CVSD filter has a large gain, about 4.6x + // The filter is boosting the ~5vpp audio signal from the CVSD chip to a ~23vpp (really ~17vpp) theoretical audio signal that the s11 + // mainboard outputs on its volume control-repurposed-as-audio-out connector. + // In reality, the S11 mainboard outputs audio at a virtual ground level between +5v and -12v (so, 17VPP balanced around -7VDC), but since + // the CVSD chip's internal DAC can only output between a bit over +0x180/-0x180 out of 0x200, the most voltage it can ever output is + // between (assuming 0x1ff is 5VDC and 0x300 is 0VDC) a max of 4.375VDC and a min of 0.625VDC, i.e. 3.75VPP centered on 2.5VDC. + // In reality, the range is likely less than that. + // This means multiplying a 3.75VPP signal by 4.6 is 17.25VPP, which is almost exactly the expected 17V (12v+5v) VPP the output should have. + FILTER_BIQUAD(config, m_cvsd_filter2).opamp_mfb_lowpass_setup(RES_K(12), RES_K(12), RES_K(56), CAP_P(4700), CAP_P(470)); + FILTER_BIQUAD(config, m_cvsd_filter).opamp_mfb_lowpass_setup(RES_K(180), RES_K(180), RES_K(180), CAP_P(470), CAP_P(100)); + m_cvsd_filter->add_route(ALL_OUTPUTS, m_cvsd_filter2, 1.0); + HC55516(config, m_hc55516, 0).add_route(ALL_OUTPUTS, m_cvsd_filter, 1.0/4.0); // to prevent massive clipping issues, we divide the signal by 4 here before going into the filters, then multiply it by 4 after it comes out the other end PIA6821(config, m_pias, 0); m_pias->readpa_handler().set(FUNC(s11_state::sound_r)); @@ -324,11 +335,13 @@ void s11b_state::s11b(machine_config &config) s11b_base(config); /* Add the background music card */ S11_BG(config, m_bg); + m_dac->add_route(ALL_OUTPUTS, m_bg, 0.4484/2.0); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_bg, (0.4484*4.0)/2.0); m_pia34->ca2_handler().set(m_bg, FUNC(s11_bg_device::resetq_w)); m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w)); m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w)); - SPEAKER(config, "bgspk").front_center(); - m_bg->add_route(ALL_OUTPUTS, "bgspk", 1.0); + SPEAKER(config, "speaker").front_center(); + m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0); } void s11b_state::s11b_jokerz(machine_config &config) @@ -336,6 +349,12 @@ void s11b_state::s11b_jokerz(machine_config &config) s11b_base(config); /* Add the pin sound 88 music card */ PINSND88(config, m_ps88); + // the dac and cvsd volumes should be equally mixed on the s11 board send to the audio board, whatever type it is + // the 4 gain values in the add_route statements are actually irrelevant, the ps88 device will override them + m_dac->add_route(ALL_OUTPUTS, m_ps88, 0.29, AUTO_ALLOC_INPUT, 0); + m_dac->add_route(ALL_OUTPUTS, m_ps88, 0.25, AUTO_ALLOC_INPUT, 1); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_ps88, (0.29*4.0), AUTO_ALLOC_INPUT, 0); + m_cvsd_filter2->add_route(ALL_OUTPUTS, m_ps88, (0.25*4.0), AUTO_ALLOC_INPUT, 1); m_pia34->ca2_handler().set(m_ps88, FUNC(pinsnd88_device::resetq_w)); m_ps88->syncq_cb().set(m_pia34, FUNC(pia6821_device::ca1_w)); // the sync connection comes from sound connector pin 16 to MCA1, not the usual pin 12 to MCB1 SPEAKER(config, "cabinet").front_floor(); // the cabinet speaker is aimed down underneath the pinball table itself diff --git a/src/mame/drivers/s11c.cpp b/src/mame/drivers/s11c.cpp index 860814017c7..bbe95db10c6 100644 --- a/src/mame/drivers/s11c.cpp +++ b/src/mame/drivers/s11c.cpp @@ -190,7 +190,7 @@ void s11c_state::s11c(machine_config &config) m_pia34->ca2_handler().set(m_bg, FUNC(s11c_bg_device::resetq_w)); m_bg->pb_cb().set(m_pia34, FUNC(pia6821_device::portb_w)); m_bg->cb2_cb().set(m_pia34, FUNC(pia6821_device::cb1_w)); - m_bg->add_route(ALL_OUTPUTS, "speaker", 1.0); + m_bg->add_route(ALL_OUTPUTS, "speaker", 1.5638); } // Unless otherwise noted, assume S11 Background Sound Board jumpers W2/W3 are diff --git a/src/mame/drivers/saitek_intchess.cpp b/src/mame/drivers/saitek_intchess.cpp index 7a65f4aa0f7..3e7d65bf3f8 100644 --- a/src/mame/drivers/saitek_intchess.cpp +++ b/src/mame/drivers/saitek_intchess.cpp @@ -136,7 +136,7 @@ u32 intchess_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c // draw chessboard background for (int y = cliprect.top(); y <= cliprect.bottom(); y++) for (int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix16(y, x) = ((x / 20) ^ (y / 16)) << 1 & 2; + bitmap.pix(y, x) = ((x / 20) ^ (y / 16)) << 1 & 2; // draw the sprites for (int i = 0; i < 64; i++) diff --git a/src/mame/drivers/saitek_risc2500.cpp b/src/mame/drivers/saitek_risc2500.cpp index 1126bfb9e94..6ac03d1ae67 100644 --- a/src/mame/drivers/saitek_risc2500.cpp +++ b/src/mame/drivers/saitek_risc2500.cpp @@ -119,7 +119,7 @@ uint32_t risc2500_state::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t gfx = bitswap<8>(m_vram[c*5 + x], 6,5,0,1,2,3,4,7); for(int y=0; y<7; y++) - bitmap.pix16(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; + bitmap.pix(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; } // LCD digits and symbols diff --git a/src/mame/drivers/samcoupe.cpp b/src/mame/drivers/samcoupe.cpp index 6f9032e9052..d6d86d434b2 100644 --- a/src/mame/drivers/samcoupe.cpp +++ b/src/mame/drivers/samcoupe.cpp @@ -383,15 +383,15 @@ uint32_t samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitm void samcoupe_state::draw_mode4_line(int y, int hpos) { /* get start address */ - uint8_t *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + uint8_t const *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 2 pixels (doublewidth) */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; /* move to next address */ vram++; @@ -405,15 +405,15 @@ void samcoupe_state::draw_mode4_line(int y, int hpos) void samcoupe_state::draw_mode3_line(int y, int hpos) { /* get start address */ - uint8_t *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + uint8_t const *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 4 pixels */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; /* move to next address */ vram++; @@ -433,8 +433,8 @@ void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, /* draw block of 8 pixels (doubled to 16) */ for (int i = 0; i < SAM_BLOCK; i++) { - bitmap.pix16(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; - bitmap.pix16(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; } } diff --git a/src/mame/drivers/sapi1.cpp b/src/mame/drivers/sapi1.cpp index 0dd6efdc9c2..ef319a6012b 100644 --- a/src/mame/drivers/sapi1.cpp +++ b/src/mame/drivers/sapi1.cpp @@ -383,24 +383,20 @@ INPUT_PORTS_END uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool val; - uint16_t addr,xpos; - uint8_t chr,attr,ra,x,y,b; - - for(y = 0; y < 24; y++ ) + for(uint8_t y = 0; y < 24; y++ ) { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) + uint16_t addr = y*64; + uint16_t xpos = 0; + for(uint8_t x = 0; x < 40; x++ ) { - chr = m_p_videoram[addr + x]; - attr = (chr >> 6) & 3; + uint8_t chr = m_p_videoram[addr + x]; + uint8_t attr = (chr >> 6) & 3; chr &= 0x3f; - for(ra = 0; ra < 9; ra++ ) + for(uint8_t ra = 0; ra < 9; ra++ ) { - for(b = 0; b < 6; b++ ) + for(uint8_t b = 0; b < 6; b++ ) { - val = 0; + bool val = 0; if (ra==8) { @@ -416,12 +412,12 @@ uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bi if(attr==3) { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + bitmap.pix(y*9+ra, xpos+2*b ) = val; + bitmap.pix(y*9+ra, xpos+2*b+1 ) = val; } else { - bitmap.pix16(y*9+ra, xpos+b ) = val; + bitmap.pix(y*9+ra, xpos+b ) = val; } } } @@ -436,26 +432,22 @@ uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bi // The attributes seem to be different on this one, they need to be understood, so disabled for now uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool val; - uint16_t addr,xpos; - uint8_t chr,attr,ra,x,y,b; - - for(y = 0; y < 20; y++ ) + for(uint8_t y = 0; y < 20; y++ ) { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) + uint16_t addr = y*64; + uint16_t xpos = 0; + for(uint8_t x = 0; x < 40; x++ ) { - chr = m_p_videoram[addr + x]; - attr = 0;//(chr >> 6) & 3; + uint8_t chr = m_p_videoram[addr + x]; + uint8_t attr = 0;//(chr >> 6) & 3; if (chr > 0x3f) chr &= 0x1f; - for(ra = 0; ra < 9; ra++ ) + for(uint8_t ra = 0; ra < 9; ra++ ) { - for(b = 0; b < 6; b++ ) + for(uint8_t b = 0; b < 6; b++ ) { - val = 0; + bool val = 0; if (ra==8) { @@ -471,12 +463,12 @@ uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bi if(attr==3) { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + bitmap.pix(y*9+ra, xpos+2*b ) = val; + bitmap.pix(y*9+ra, xpos+2*b+1 ) = val; } else { - bitmap.pix16(y*9+ra, xpos+b ) = val; + bitmap.pix(y*9+ra, xpos+b ) = val; } } } @@ -490,17 +482,15 @@ uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bi MC6845_UPDATE_ROW( sapi_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = gfx = 0; + uint8_t inv = 0, gfx = 0; if (x == cursor_x) inv ^= 0xff; - mem = (2*(ma + x)) & 0xfff; - chr = m_p_videoram[mem] & 0x3f; + uint16_t mem = (2*(ma + x)) & 0xfff; + uint8_t chr = m_p_videoram[mem] & 0x3f; if (ra < 8) gfx = MHB2501[(chr<<3) | ra] ^ inv; diff --git a/src/mame/drivers/sbc6510.cpp b/src/mame/drivers/sbc6510.cpp index d8222e2c1fe..bf09b5276e2 100644 --- a/src/mame/drivers/sbc6510.cpp +++ b/src/mame/drivers/sbc6510.cpp @@ -47,6 +47,8 @@ ToDo: - No software to test with. +- Natural keyboard & Paste do not work when shift is involved. + ****************************************************************************/ @@ -137,42 +139,42 @@ static INPUT_PORTS_START( sbc6510 ) // cbm keyboard PORT_START( "X1" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') PORT_START( "X2" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_START( "X3" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_START( "X4" ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_START( "X5" ) @@ -181,15 +183,15 @@ static INPUT_PORTS_START( sbc6510 ) // cbm keyboard PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_START( "X6" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') @@ -197,12 +199,12 @@ static INPUT_PORTS_START( sbc6510 ) // cbm keyboard PORT_START( "X7" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) // newline PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_START( "X8" ) /* unused */ diff --git a/src/mame/drivers/sbowling.cpp b/src/mame/drivers/sbowling.cpp index 8e279a63412..96afdf9cba8 100644 --- a/src/mame/drivers/sbowling.cpp +++ b/src/mame/drivers/sbowling.cpp @@ -116,7 +116,7 @@ static void plot_pixel_sbw(bitmap_ind16 *tmpbitmap, int x, int y, int col, int f x = 255 - x; } - tmpbitmap->pix16(y, x) = col; + tmpbitmap->pix(y, x) = col; } void sbowling_state::videoram_w(offs_t offset, uint8_t data) diff --git a/src/mame/drivers/sbrain.cpp b/src/mame/drivers/sbrain.cpp index 19fa3f5d163..d1bdf6adeed 100644 --- a/src/mame/drivers/sbrain.cpp +++ b/src/mame/drivers/sbrain.cpp @@ -624,8 +624,7 @@ u32 sbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con return 0; } - u8 y,ra,chr,gfx; - uint16_t sy=0,x; + uint16_t sy=0; // Where attributes come from: // - Most systems use ram for character-based attributes, but this one uses strictly hardware which would seem cumbersome @@ -639,18 +638,18 @@ u32 sbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con uint16_t ma = m_crtc->top_of_page(); uint16_t cr = m_crtc->cursor_address(); uint8_t *videoram = &m_ram->pointer()[m_ram->size() - 0x800]; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra > 0) { - chr = videoram[(x + ma) & 0x7ff]; + uint8_t chr = videoram[(x + ma) & 0x7ff]; if (!BIT(chr, 7) || BIT(m_framecnt, 5)) { diff --git a/src/mame/drivers/scopus.cpp b/src/mame/drivers/scopus.cpp index 8ec7a778a4b..373e23dafaa 100644 --- a/src/mame/drivers/scopus.cpp +++ b/src/mame/drivers/scopus.cpp @@ -94,11 +94,10 @@ GFXDECODE_END I8275_DRAW_CHARACTER_MEMBER(sagitta180_state::crtc_display_pixels) { - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; - uint8_t pixels; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + uint8_t pixels; if (lten) { pixels = ~0; } else if (vsp != 0 || (linecount & 8) != 0) { @@ -111,8 +110,8 @@ I8275_DRAW_CHARACTER_MEMBER(sagitta180_state::crtc_display_pixels) pixels = ~pixels; } - for (i = 0; i < 7; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (7 - i))) != 0 ]; + for (unsigned i = 0; i < 7; i++) { + bitmap.pix(y, x + i) = palette[ BIT(pixels, 7 - i) ]; } } diff --git a/src/mame/drivers/scv.cpp b/src/mame/drivers/scv.cpp index 3a69a469bee..e9079dd40d7 100644 --- a/src/mame/drivers/scv.cpp +++ b/src/mame/drivers/scv.cpp @@ -300,16 +300,16 @@ inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, uint8_t x, uint8_ x -= 4; if (pat & 0x08) - bitmap.pix16(y + 2, x) = col; + bitmap.pix(y + 2, x) = col; if (pat & 0x04 && x < 255 ) - bitmap.pix16(y + 2, x + 1) = col; + bitmap.pix(y + 2, x + 1) = col; if (pat & 0x02 && x < 254) - bitmap.pix16(y + 2, x + 2) = col; + bitmap.pix(y + 2, x + 2) = col; if (pat & 0x01 && x < 253) - bitmap.pix16(y + 2, x + 3) = col; + bitmap.pix(y + 2, x + 3) = col; } } @@ -354,32 +354,30 @@ inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, inline void scv_state::draw_text( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t *char_data, uint8_t fg, uint8_t bg ) { - int i; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - uint8_t d = char_data[i]; - - bitmap.pix16(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; - bitmap.pix16(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; - bitmap.pix16(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; - bitmap.pix16(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; - bitmap.pix16(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; - bitmap.pix16(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; - bitmap.pix16(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; - bitmap.pix16(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; + uint8_t const d = char_data[i]; + + bitmap.pix(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; + bitmap.pix(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; + bitmap.pix(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; + bitmap.pix(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; + bitmap.pix(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; + bitmap.pix(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; + bitmap.pix(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; + bitmap.pix(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; } - for ( i = 8; i < 16; i++ ) + for ( int i = 8; i < 16; i++ ) { - bitmap.pix16(y + i, x + 0 ) = bg; - bitmap.pix16(y + i, x + 1 ) = bg; - bitmap.pix16(y + i, x + 2 ) = bg; - bitmap.pix16(y + i, x + 3 ) = bg; - bitmap.pix16(y + i, x + 4 ) = bg; - bitmap.pix16(y + i, x + 5 ) = bg; - bitmap.pix16(y + i, x + 6 ) = bg; - bitmap.pix16(y + i, x + 7 ) = bg; + bitmap.pix(y + i, x + 0 ) = bg; + bitmap.pix(y + i, x + 1 ) = bg; + bitmap.pix(y + i, x + 2 ) = bg; + bitmap.pix(y + i, x + 3 ) = bg; + bitmap.pix(y + i, x + 4 ) = bg; + bitmap.pix(y + i, x + 5 ) = bg; + bitmap.pix(y + i, x + 6 ) = bg; + bitmap.pix(y + i, x + 7 ) = bg; } } @@ -387,35 +385,31 @@ inline void scv_state::draw_text( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, ui inline void scv_state::draw_semi_graph( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t data, uint8_t fg ) { - int i; - if ( ! data ) return; - for ( i = 0; i < 4; i++ ) + for ( int i = 0; i < 4; i++ ) { - bitmap.pix16(y + i, x + 0) = fg; - bitmap.pix16(y + i, x + 1) = fg; - bitmap.pix16(y + i, x + 2) = fg; - bitmap.pix16(y + i, x + 3) = fg; + bitmap.pix(y + i, x + 0) = fg; + bitmap.pix(y + i, x + 1) = fg; + bitmap.pix(y + i, x + 2) = fg; + bitmap.pix(y + i, x + 3) = fg; } } inline void scv_state::draw_block_graph( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t col ) { - int i; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - bitmap.pix16(y + i, x + 0) = col; - bitmap.pix16(y + i, x + 1) = col; - bitmap.pix16(y + i, x + 2) = col; - bitmap.pix16(y + i, x + 3) = col; - bitmap.pix16(y + i, x + 4) = col; - bitmap.pix16(y + i, x + 5) = col; - bitmap.pix16(y + i, x + 6) = col; - bitmap.pix16(y + i, x + 7) = col; + bitmap.pix(y + i, x + 0) = col; + bitmap.pix(y + i, x + 1) = col; + bitmap.pix(y + i, x + 2) = col; + bitmap.pix(y + i, x + 3) = col; + bitmap.pix(y + i, x + 4) = col; + bitmap.pix(y + i, x + 5) = col; + bitmap.pix(y + i, x + 6) = col; + bitmap.pix(y + i, x + 7) = col; } } diff --git a/src/mame/drivers/scyclone.cpp b/src/mame/drivers/scyclone.cpp index cedb403dc5d..113d0d23104 100644 --- a/src/mame/drivers/scyclone.cpp +++ b/src/mame/drivers/scyclone.cpp @@ -234,9 +234,9 @@ uint32_t scyclone_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bit if (y == star && star != 0 && noclipped) - bitmap.pix32(ypos, x) = paldata[7]; + bitmap.pix(ypos, x) = paldata[7]; else - bitmap.pix32(ypos, x) = paldata[0]; + bitmap.pix(ypos, x) = paldata[0]; } } } @@ -273,13 +273,13 @@ uint32_t scyclone_state::draw_bitmap_and_sprite(screen_device &screen, bitmap_rg uint8_t pal = get_bitmap_pixel(realx, realy); - if (pal) bitmap.pix32(y, (x*8)+i) = paldata[pal]; + if (pal) bitmap.pix(y, (x*8)+i) = paldata[pal]; uint8_t pal2 = get_sprite_pixel(realx, realy); if (pal2 & 0x3) { - bitmap.pix32(y, (x*8)+i) = paldata[8+pal2]; + bitmap.pix(y, (x*8)+i) = paldata[8+pal2]; if (pal == 0x7) m_hascollided = 1; } } diff --git a/src/mame/drivers/sdk86.cpp b/src/mame/drivers/sdk86.cpp index 57fc3891182..cef0f11989d 100644 --- a/src/mame/drivers/sdk86.cpp +++ b/src/mame/drivers/sdk86.cpp @@ -14,6 +14,11 @@ The user manual is available from: http://www.bitsavers.org/pdf/intel/8086/98006 2009-11-29 Some fleshing out by Lord Nightmare 2011-06-22 Working [Robbbert] + +Paste Test: + N0100^11^22^33^44^55^66^77^88^99^X0100^ + Press UP to verify the data. + ToDo: - Add optional 2x 8255A port read/write logging @@ -83,18 +88,18 @@ void sdk86_state::io_map(address_map &map) /* Input ports */ static INPUT_PORTS_START( sdk86 ) PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 EB/AX") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ER/BX") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 GO/CX") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 ST/DX") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 IB/SP") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 OB/BP") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 MV/SI") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 EW/DI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 EB/AX") PORT_CODE(KEYCODE_0) PORT_CHAR('0') // examine/modify bytes + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ER/BX") PORT_CODE(KEYCODE_1) PORT_CHAR('1') // examine/modify register + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 GO/CX") PORT_CODE(KEYCODE_2) PORT_CHAR('2') // go + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 ST/DX") PORT_CODE(KEYCODE_3) PORT_CHAR('3') // step + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 IB/SP") PORT_CODE(KEYCODE_4) PORT_CHAR('4') // read a byte from port + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 OB/BP") PORT_CODE(KEYCODE_5) PORT_CHAR('5') // output byte to port + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 MV/SI") PORT_CODE(KEYCODE_6) PORT_CHAR('6') // copy memory block + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 EW/DI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') // examine/modify words PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IW/CS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 OW/DS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IW/CS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') // read a word from port + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 OW/DS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') // output a word to port PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A SS") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ES") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C IP") PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -103,17 +108,17 @@ static INPUT_PORTS_START( sdk86 ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') // end current command + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') // enter data and increment address + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('M') // subtract one number from another + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('P') // add two numbers + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR('S') // separator between segment and offset + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') // registers PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, nmi_button, 0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Systm Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, reset_button, 0) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, nmi_button, 0) PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Systm Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, reset_button, 0) PORT_CHAR('N') INPUT_PORTS_END INPUT_CHANGED_MEMBER(sdk86_state::nmi_button) @@ -186,7 +191,8 @@ void sdk86_state::sdk86(machine_config &config) m_uart->dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); m_uart->rts_handler().set(m_uart, FUNC(i8251_device::write_cts)); - rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + // it's meant to interface with an intellec unit, and you need floppy disks & drives for that + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); rs232.rxd_handler().set(m_uart, FUNC(i8251_device::write_rxd)); rs232.dsr_handler().set(m_uart, FUNC(i8251_device::write_dsr)); rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp index 0ef43817215..c9556c8abe3 100644 --- a/src/mame/drivers/seabattl.cpp +++ b/src/mame/drivers/seabattl.cpp @@ -160,14 +160,12 @@ void seabattl_state::seabattl_colorram_w(offs_t offset, uint8_t data) uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y, offset; - // wave if ( m_waveenable ) { - for ( y = 0; y < 32; y++ ) + for ( int y = 0; y < 32; y++ ) { - for ( x = 0; x < 32; x++ ) + for ( int x = 0; x < 32; x++ ) { m_gfxdecode->gfx(2)->opaque(bitmap,cliprect, (y & 0x0f) + (((x & 0x0f) + ((screen.frame_number() & 0xe0) >> 4)) << 4), 0, 0, 0, x*8, y*8 ); } @@ -183,7 +181,7 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in m_bg_tilemap->draw(screen, m_collision_bg, cliprect, TILEMAP_DRAW_OPAQUE, 0); // sprites (m.obj) - for ( offset = 0; offset < 256; offset++ ) + for ( int offset = 0; offset < 256; offset++ ) { // bits 0-3: sprite num // bits 4-7: x coordinate @@ -200,15 +198,15 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in bitmap_ind16 const &s2636_0_bitmap = m_s2636->update(cliprect); // collisions - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { // bit 0: m.obj - pvi-bkg // bit 1: pvi-bkg - scr.sm.obj // bit 2: m.obj - scr.sm.obj bool obj = (bitmap.pix(y,x) > 0) && (bitmap.pix(y,x) < 8); - bool pvi = S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix16(y, x)); + bool pvi = S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix(y, x)); bool scr = (m_collision_bg.pix(y,x) & 1) != 0; if (obj && pvi) @@ -223,14 +221,14 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in } // s2636 layer - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int pixel = s2636_0_bitmap.pix16(y, x); + int pixel = s2636_0_bitmap.pix(y, x); if (S2636_IS_PIXEL_DRAWN(pixel)) { - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel); } } } diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp index dda7283b45f..15fb868b587 100644 --- a/src/mame/drivers/segac2.cpp +++ b/src/mame/drivers/segac2.cpp @@ -1513,10 +1513,8 @@ uint32_t segac2_state::screen_update_segac2_new(screen_device &screen, bitmap_rg /* Copy our screen buffer here */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t* desty = &bitmap.pix32(y, 0); - uint16_t* srcy; - - srcy = m_vdp->m_render_line_raw.get(); + uint32_t *const desty = &bitmap.pix(y, 0); + uint16_t const *const srcy = m_vdp->m_render_line_raw.get(); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 1ab6b3be2f9..e9d547ebe07 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -858,16 +858,16 @@ INPUT_PORTS_END uint32_t systeme_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - bitmap_rgb32 &vdp1_bitmap = m_vdp1->get_bitmap(); - bitmap_rgb32 &vdp2_bitmap = m_vdp2->get_bitmap(); - bitmap_ind8 &vdp2_y1 = m_vdp2->get_y1_bitmap(); + bitmap_rgb32 const &vdp1_bitmap = m_vdp1->get_bitmap(); + bitmap_rgb32 const &vdp2_bitmap = m_vdp2->get_bitmap(); + bitmap_ind8 const &vdp2_y1 = m_vdp2->get_y1_bitmap(); for( int y = cliprect.min_y; y <= cliprect.max_y; y++ ) { - uint32_t *dest_ptr = &bitmap.pix32(y); - uint32_t *vdp1_ptr = &vdp1_bitmap.pix32(y); - uint32_t *vdp2_ptr = &vdp2_bitmap.pix32(y); - uint8_t *y1_ptr = &vdp2_y1.pix8(y); + uint32_t *const dest_ptr = &bitmap.pix(y); + uint32_t const *const vdp1_ptr = &vdp1_bitmap.pix(y); + uint32_t const *const vdp2_ptr = &vdp2_bitmap.pix(y); + uint8_t const *const y1_ptr = &vdp2_y1.pix(y); for ( int x = cliprect.min_x; x <= cliprect.max_x; x++ ) { diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp index 533ee43debe..155be049a30 100644 --- a/src/mame/drivers/segahang.cpp +++ b/src/mame/drivers/segahang.cpp @@ -1148,6 +1148,71 @@ ROM_START( hangon2 ) ROM_END //************************************************************************************************************************* +// # VF # +// Hang On spanish bootleg. +// Some customs were replaced with logic components. +// +ROM_START( hangonvf ) + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "9.3n", 0x000000, 0x8000, CRC(20b1c2b0) SHA1(01b4f5105e2bbeb6ec6dbd18bfb728e3a973e0ca) ) + ROM_LOAD16_BYTE( "11.1n", 0x000001, 0x8000, CRC(7d9db1bf) SHA1(952ee3e7a0d57ec1bb3385e0e6675890b8378d31) ) + ROM_LOAD16_BYTE( "8.3k", 0x010000, 0x8000, CRC(fea12367) SHA1(9a1ce5863c562160b657ad948812b43f42d7d0cc) ) + ROM_LOAD16_BYTE( "10.1k", 0x010001, 0x8000, CRC(ac883240) SHA1(f943341ae13e062f3d12c6221180086ce8bdb8c4) ) + + ROM_REGION( 0x40000, "subcpu", 0 ) // second 68000 CPU + ROM_LOAD16_BYTE( "6.6l", 0x0000, 0x8000, CRC(1c95013e) SHA1(8344ac953477279c2c701f984d98292a21dd2f7d) ) + ROM_LOAD16_BYTE( "7.5l", 0x0001, 0x8000, CRC(6ca30d69) SHA1(ed933351883ebf6d9ef9428a81d09749b609cd60) ) + + ROM_REGION( 0x18000, "gfx1", 0 ) // tiles + ROM_LOAD( "2.3j", 0x00000, 0x08000, CRC(255a3a58) SHA1(980372ab94949d1476282c83af0a08cc0555f1cd) ) + ROM_LOAD( "3.2j", 0x08000, 0x08000, CRC(88b9ffd9) SHA1(7ecfab266f05d5f919806f195fb2572f220fdf68) ) + ROM_LOAD( "4.1j", 0x10000, 0x08000, CRC(18882328) SHA1(737c025701877845fad63af145506a57c775f8e0) ) + + ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites + ROM_LOAD16_BYTE( "19.5b", 0x000001, 0x8000, CRC(469dad07) SHA1(6d01c0b3506e28832928ad74d518577ff5be323b) ) + ROM_LOAD16_BYTE( "25.6b", 0x000000, 0x8000, CRC(87cbc6de) SHA1(b64652e062e1b88c6f6ae8dd2ffe4533bb27ba45) ) + ROM_LOAD16_BYTE( "18.5c", 0x010001, 0x8000, CRC(15792969) SHA1(b061dbf24e8b511116446794753c8b0cc49e2149) ) + ROM_LOAD16_BYTE( "24.6c", 0x010000, 0x8000, CRC(e9718de5) SHA1(30e3a7d5b33504da03c5780b4a946b977e46098a) ) + ROM_LOAD16_BYTE( "17.5d", 0x020001, 0x8000, CRC(49422691) SHA1(caee2a4a3f4587ae27dec330214edaa1229012af) ) + ROM_LOAD16_BYTE( "23.6d", 0x020000, 0x8000, CRC(701deaa4) SHA1(053032ef886b85a4cb4753d17b3c27d228695157) ) + ROM_LOAD16_BYTE( "16.5e", 0x030001, 0x8000, CRC(f003a000) SHA1(da7fc41d3116ebb108effcd9ffa86e873e8ff6e7) ) + ROM_LOAD16_BYTE( "22.6e", 0x030000, 0x8000, CRC(08b007e2) SHA1(db63d38472c8df13f0bbabb20b6e33c9c6c46664) ) + ROM_LOAD16_BYTE( "15.5f", 0x040001, 0x8000, CRC(7fa1bfb6) SHA1(a27b54c93613372f59050f0b2182d2984a8d2efe) ) + ROM_LOAD16_BYTE( "21.6f", 0x040000, 0x8000, CRC(8e880c93) SHA1(8c55deec065daf09a5d1c1c1f3f3f7bc1aeaf563) ) + ROM_LOAD16_BYTE( "14.5h", 0x050001, 0x8000, CRC(47e63dd1) SHA1(40fb4400e1e8c8193c69154c5c08a9a69a8bca0d) ) + ROM_LOAD16_BYTE( "20.6h", 0x050000, 0x8000, CRC(33d1aa6e) SHA1(1bd78d442cce2a39f1186b142d8a24bce286ad64) ) + ROM_LOAD16_BYTE( "12.3f", 0x060001, 0x8000, CRC(22fc088e) SHA1(d84570a802e696b67a587bee154620d97d75a7aa) ) + ROM_LOAD16_BYTE( "13.4f", 0x060000, 0x8000, CRC(032738ba) SHA1(6b8e7e229d04f852e72acfdfa8721b4b22681208) ) + + ROM_REGION( 0x8000, "segaic16road", 0 ) // road gfx + ROM_LOAD( "5.9r", 0x0000, 0x8000, CRC(581230e3) SHA1(954eab35059322a12a197bba04bf85f816132f20) ) + + ROM_REGION( 0x10000, "soundcpu", 0 ) // sound CPU + ROM_LOAD( "28.12h", 0x00000, 0x4000, CRC(3b942f5f) SHA1(4384b5c090954e69de561dde0ef32104aa11399a) ) + + ROM_REGION( 0x10000, "pcm", 0 ) // Sega PCM sound data + ROM_LOAD( "26.1e", 0x00000, 0x8000, CRC(cfef5481) SHA1(c04b302fee58f0e59a097b2be2b61e5d03df7c91) ) + ROM_LOAD( "27.1g", 0x08000, 0x8000, CRC(4165aea5) SHA1(be05c6d295807af2f396a1ff72d5a3d2a1e6054d) ) + + ROM_REGION( 0x2000, "sprites:zoom", 0 ) // zoom table + ROM_LOAD( "1.9d", 0x0000, 0x2000, CRC(e3ec7bd6) SHA1(feec0fe664e16fac0fde61cf64b401b9b0575323) ) + + ROM_REGION( 0x1400, "plds", 0 ) + ROM_LOAD( "a_pal16r4a.9e", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "b_pls153an.9f", 0x0200, 0x00eb, NO_DUMP ) + ROM_LOAD( "c_pal16r6a.7m", 0x0400, 0x0104, NO_DUMP ) + ROM_LOAD( "d_pal16r6a.7r", 0x0600, 0x0104, NO_DUMP ) + ROM_LOAD( "e_pal16r6a.7s", 0x0800, 0x0104, NO_DUMP ) + ROM_LOAD( "f_pls153n.6s", 0x0a00, 0x00eb, NO_DUMP ) + ROM_LOAD( "g_pal16l8a.3r", 0x0c00, 0x0104, NO_DUMP ) + // no PLD marked 'H' + ROM_LOAD( "i_pls153n_snd.6f", 0x0e00, 0x00eb, NO_DUMP ) + ROM_LOAD( "j_pal16l8a_db.bin", 0x1000, 0x0104, NO_DUMP ) + ROM_LOAD( "k_pal16r4a_db.bin", 0x1200, 0x0104, NO_DUMP ) +ROM_END + + +//************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Super Hang-On (Japan Ver.) @@ -2195,26 +2260,27 @@ void segahang_state::init_endurob2() // GAME DRIVERS //************************************************************************** -// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS -GAME( 1985, hangon, 0, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A)", 0 ) -GAME( 1985, hangon1, hangon, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On", 0 ) -GAME( 1985, hangon2, hangon, hangon, hangon2, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A, ride-on)", 0 ) +// YEAR, NAME, PARENT, MACHINE, INPUT, STATE INIT, ROT, COMPANY, FULLNAME, FLAGS +GAME( 1985, hangon, 0, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A)", 0 ) +GAME( 1985, hangon1, hangon, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On", 0 ) +GAME( 1985, hangon2, hangon, hangon, hangon2, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A, ride-on)", 0 ) +GAME( 1985, hangonvf, hangon, hangon, hangon, segahang_state, init_generic, ROT0, "bootleg", "VF (bootleg of Hang-On)", 0 ) -GAME( 1987, shangonro, shangon, shangonro,shangonro, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, ride-on, Japan, FD1094 317-0038)", 0 ) -GAME( 1987, shangonho, shangon, shangonro,shangupb, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, Japan, FD1094 317-0039)", 0 ) -GAME( 1992, shangonrb, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg", "Super Hang-On (Hang-On conversion, bootleg)", 0 ) -GAME( 1987, shangonrb2, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg (Beta)", "Super Hang-On (Hang-On conversion, Beta bootleg)", 0 ) +GAME( 1987, shangonro, shangon, shangonro,shangonro, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, ride-on, Japan, FD1094 317-0038)", 0 ) +GAME( 1987, shangonho, shangon, shangonro,shangupb, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, Japan, FD1094 317-0039)", 0 ) +GAME( 1992, shangonrb, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg", "Super Hang-On (Hang-On conversion, bootleg)", 0 ) +GAME( 1987, shangonrb2, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg (Beta)", "Super Hang-On (Hang-On conversion, Beta bootleg)", 0 ) -GAME( 1985, sharrier, 0, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (Rev A, 8751 315-5163A)", 0 ) -GAME( 1985, sharrier1, sharrier, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (8751 315-5163)", 0 ) +GAME( 1985, sharrier, 0, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (Rev A, 8751 315-5163A)", 0 ) +GAME( 1985, sharrier1, sharrier, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (8751 315-5163)", 0 ) -GAME( 1986, enduror, 0, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, FD1089B 317-0013A)", 0 ) -GAME( 1986, endurora, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, mask ROM sprites, FD1089B 317-0013A)", 0 ) -GAME( 1986, endurorb, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2151, FD1089B 317-0013A)", 0 ) -GAME( 1986, enduror1, enduror, enduror1, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2203, FD1089B 317-0013A)", 0 ) -GAME( 1986, endurobl, enduror, endurobl, enduror, segahang_state, init_endurobl, ROT0, "bootleg", "Enduro Racer (bootleg set 1)", 0 ) -GAME( 1986, endurob2, enduror, endurob2, enduror, segahang_state, init_endurob2, ROT0, "bootleg", "Enduro Racer (bootleg set 2)", MACHINE_NOT_WORKING ) +GAME( 1986, enduror, 0, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, FD1089B 317-0013A)", 0 ) +GAME( 1986, endurora, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, mask ROM sprites, FD1089B 317-0013A)", 0 ) +GAME( 1986, endurorb, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2151, FD1089B 317-0013A)", 0 ) +GAME( 1986, enduror1, enduror, enduror1, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2203, FD1089B 317-0013A)", 0 ) +GAME( 1986, endurobl, enduror, endurobl, enduror, segahang_state, init_endurobl, ROT0, "bootleg", "Enduro Racer (bootleg set 1)", 0 ) +GAME( 1986, endurob2, enduror, endurob2, enduror, segahang_state, init_endurob2, ROT0, "bootleg", "Enduro Racer (bootleg set 2)", MACHINE_NOT_WORKING ) -GAME( 1986, endurord, enduror, endurord, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of Rev A, YM2151, FD1089B 317-0013A set)", 0 ) -GAME( 1986, enduror1d, enduror, enduror1d, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of YM2203, FD1089B 317-0013A set)", 0 ) +GAME( 1986, endurord, enduror, endurord, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of Rev A, YM2151, FD1089B 317-0013A set)", 0 ) +GAME( 1986, enduror1d, enduror, enduror1d, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of YM2203, FD1089B 317-0013A set)", 0 ) diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index 4dfaac8ae8c..e18eddcfe9c 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -7578,7 +7578,8 @@ ROM_END //************************************************************************************************************************* // Passing Shot (World, 4 Players), Sega System 16B // CPU: FD1094 No. 317-0074 -// ROM Board No. 171-5358 +// ROM Board No. 171-5358 +// I/O Board: 834-6523 (for Players 3 & 4) // ROM_START( passshta ) ROM_REGION( 0x20000, "maincpu", 0 ) // 68000 code @@ -7638,7 +7639,10 @@ ROM_END //************************************************************************************************************************* // Passing Shot (Japan, 4 Players), Sega System 16B // CPU: FD1094 No. 317-0070 -// ROM Board No. 171-5358 +// ROM Board No. 171-5358 +// I/O Board: 834-6523 (for Players 3 & 4) +// Game Number: 833-6714 PASSING SHOT +// // // J1 - - // J2 --- diff --git a/src/mame/drivers/segasp.cpp b/src/mame/drivers/segasp.cpp index 0053db4cc28..c5494820783 100644 --- a/src/mame/drivers/segasp.cpp +++ b/src/mame/drivers/segasp.cpp @@ -72,7 +72,7 @@ Tetris Giant / Tetris Dekaris 834-14970 G MDA-C0076 CF ANY Tetris Giant / Tetris Dekaris Ver.2.000 834-14970 G ROM ANY 253-5508-0604 AAFE-xxxxxxxxxxx Thomas: The Tank Engine ???-????? no ???-????-???? AAFE-xxxxxxxxxxx UNO the Medal (Medalink) ???-????? ROM JP 253-5508-0526J AAFE-01G00225212, Satellite Medal -Yataimura Kingyosukui (4-player, China) ???-????? CF EXP unknown AAFE-xxxxxxxxxxx +Yataimura Kingyosukui (4-player, China) 837-14875 CF EXP 253-5508-0563J AAFE-xxxxxxxxxxx Unknown 834-14865 JAP REV PCB IC6s Flash AU1500 @@ -680,7 +680,7 @@ ROM_START( kingyoch ) ROM_REGION( 0x800, "pic_readout", 0 ) // no PIC was provided with CF card, brute forced key - ROM_LOAD( "317-unknown.ic15", 0, 0x800, BAD_DUMP CRC(8af67833) SHA1(0b79abf9182c249a6d4976d6fd3b90101d66354f) ) + ROM_LOAD( "317-0563-jpn.ic15", 0, 0x800, BAD_DUMP CRC(8af67833) SHA1(0b79abf9182c249a6d4976d6fd3b90101d66354f) ) ROM_END ROM_START( loveber3 ) @@ -743,7 +743,7 @@ ROM_START( tetgiano ) ROM_END -#define GAME_FLAGS (MACHINE_NO_SOUND|MACHINE_NOT_WORKING) +#define GAME_FLAGS (MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND) GAME( 2004, segasp, 0, segasp, segasp, segasp_state, init_segasp, ROT0, "Sega", "Sega System SP (Spider) BIOS", GAME_FLAGS | MACHINE_IS_BIOS_ROOT ) // These use ROMs diff --git a/src/mame/drivers/seibucats.cpp b/src/mame/drivers/seibucats.cpp index b2bb9d15a6b..37e6cf48d50 100644 --- a/src/mame/drivers/seibucats.cpp +++ b/src/mame/drivers/seibucats.cpp @@ -12,7 +12,7 @@ - mahjong keyboard inputs (and JAMMA adapter for some games); - emulate YMF721-S or at least do something about MIDI sound; - verify interrupt table; - - verify coin inputs; + - verify coin inputs; - Any other port lingering in the 0x400-0x7ff area? =========================================================================================================================== @@ -38,14 +38,14 @@ ROM: - Program ROMs: MX27C40000C-12 or MBM27C4001-12Z or TMS27C040-10 x4 (U011, U015-U017 = "PRG0-PRG3" on ROM board) - Sprite ROMs: MX29F8100MC-12 or "MX29F1610" x4 (U0231-U0234 = "OBJ1-OBJ4" on ROM board). - Only three ROMs appear to be populated on any game. - This means sprites should be 6bpp, even though they could potentially have been 8bpp. + Only three ROMs appear to be populated on any game. + This means sprites should be 6bpp, even though they could potentially have been 8bpp. EEPROM/NVRAM: - ST93C46AF Serial EEPROM (U0512; towards left center of board) - Toshiba TC55257DFL-70L (U0144 on ROM board) with Maxell CR2032 battery (BT011 on ROM board). - The ROM board type used by Marumie Network lacks NVRAM and RTC; - their locations are not populated on Pakkun Ball TV. + The ROM board type used by Marumie Network lacks NVRAM and RTC; + their locations are not populated on Pakkun Ball TV. RTC: - JRC 6355E/NJU6355 Real Time Clock (U0513, above YMF721) @@ -54,8 +54,8 @@ Serial ports: - NEC uPD71051GB USART x2 (U1133, U1134; lined up with DB9 ports) - MAXZ32 Serial Line Driver x2 (U1138, U1141; between USARTs and DB9 ports) - - Two DB9 ports, one marked "DVD" and the other "Touch Panel." - The latter also uses a separate 2-pin Molex power connector (CN114). + - Two DB9 ports, one marked "DVD" and the other "Touch Panel." + The latter also uses a separate 2-pin Molex power connector (CN114). Sound and linear miscellany: - Yamaha YMF721-S General MIDI OPL4-ML2 (U0274; to right of USARTs) diff --git a/src/mame/drivers/seibuspi.cpp b/src/mame/drivers/seibuspi.cpp index 495b44ca4f0..c970d99cd1d 100644 --- a/src/mame/drivers/seibuspi.cpp +++ b/src/mame/drivers/seibuspi.cpp @@ -1778,6 +1778,12 @@ MACHINE_RESET_MEMBER(seibuspi_state,spi) m_z80_bank->set_entry(0); m_z80_lastbank = 0; m_z80_prg_transfer_pos = 0; + + // fix the magic ID byte so users can't "brick" the machine + if (m_soundflash1 && m_soundflash1_region) + { + m_soundflash1->write_raw(0, m_soundflash1_region[0]); + } } void seibuspi_state::spi(machine_config &config) diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp index 6450e7079d1..0f582a324d8 100644 --- a/src/mame/drivers/sfbonus.cpp +++ b/src/mame/drivers/sfbonus.cpp @@ -1036,17 +1036,15 @@ uint32_t sfbonus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* render reels to bitmap */ draw_reel_layer(screen,*m_temp_reel_bitmap,cliprect,0); + for (int y = 0; y < 288; y++) { - for (int y = 0; y < 288; y++) + uint16_t const *const src = &m_temp_reel_bitmap->pix(y); + uint16_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 512; x++) { - for (int x = 0; x < 512; x++) - { - uint16_t* src = &m_temp_reel_bitmap->pix16(y, x); - uint16_t* dst = &bitmap.pix16(y, x); - - if ((src[0]&0x100)==0x000) - dst[0] = src[0]; - } + if ((src[x]&0x100)==0x000) + dst[x] = src[x]; } } @@ -1059,17 +1057,15 @@ uint32_t sfbonus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } m_tilemap->draw(screen, bitmap, cliprect, 0,0); + for (int y = 0; y < 288; y++) { - for (int y = 0; y < 288; y++) + uint16_t const *const src = &m_temp_reel_bitmap->pix(y); + uint16_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 512; x++) { - for (int x = 0; x < 512; x++) - { - uint16_t* src = &m_temp_reel_bitmap->pix16(y, x); - uint16_t* dst = &bitmap.pix16(y, x); - - if ((src[0]&0x100)==0x100) - dst[0] = src[0]-0x100; - } + if ((src[x]&0x100)==0x100) + dst[x] = src[x]-0x100; } } #if 0 diff --git a/src/mame/drivers/shine.cpp b/src/mame/drivers/shine.cpp index 3a5bd66a724..4988a4e449a 100644 --- a/src/mame/drivers/shine.cpp +++ b/src/mame/drivers/shine.cpp @@ -165,8 +165,8 @@ static INPUT_PORTS_START( shine ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('[') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_TILDE) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_START("Y7") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_TAB) diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp index 625c19ff817..4dc39adc9fb 100644 --- a/src/mame/drivers/shougi.cpp +++ b/src/mame/drivers/shougi.cpp @@ -217,7 +217,7 @@ uint32_t shougi_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap color= ((data1>>x) & 1) | (((data1>>(4+x)) & 1)<<1); data = ((data2>>x) & 1) | (((data2>>(4+x)) & 1)<<1); - bitmap.pix16(255-sy, 255-(sx*4 + x)) = color*4 + data; + bitmap.pix(255-sy, 255-(sx*4 + x)) = color*4 + data; } } diff --git a/src/mame/drivers/sidepckt.cpp b/src/mame/drivers/sidepckt.cpp index 99aa908a819..ca1b2cf24c6 100644 --- a/src/mame/drivers/sidepckt.cpp +++ b/src/mame/drivers/sidepckt.cpp @@ -15,7 +15,7 @@ i8751 protection simulation and other fixes by Bryan McPhail, 15/10/00. ToDo: -- sidepcktj: Intermission screen's background for player 2 is completely screwed (Maybe wrong/missing I8751 simulation for "cocktail mode" ?) +- sidepcktj: Intermission screen's background for player 2 is completely screwed (Cause is currently unknown) Stephh's notes (based on the games M6809 code and some tests) : @@ -142,59 +142,50 @@ Additional notes: #include "speaker.h" -// protection tables -static const uint8_t sidepckt_prot_table_1[0x10]={0x05,0x03,0x02,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; -static const uint8_t sidepckt_prot_table_2[0x10]={0x8e,0x42,0xad,0x58,0xec,0x85,0xdd,0x4c,0xad,0x9f,0x00,0x4c,0x7e,0x42,0xa2,0xff}; -static const uint8_t sidepckt_prot_table_3[0x10]={0xbd,0x73,0x80,0xbd,0x73,0xa7,0xbd,0x73,0xe0,0x7e,0x72,0x56,0xff,0xff,0xff,0xff}; +//************************************************************************** +// PROTECTION MCU +//************************************************************************** -static const uint8_t sidepcktj_prot_table_1[0x10]={0x05,0x03,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; -static const uint8_t sidepcktj_prot_table_2[0x10]={0x8e,0x42,0xb2,0x58,0xec,0x85,0xdd,0x4c,0xad,0x9f,0x00,0x4c,0x7e,0x42,0xa7,0xff}; -static const uint8_t sidepcktj_prot_table_3[0x10]={0xbd,0x71,0xc8,0xbd,0x71,0xef,0xbd,0x72,0x28,0x7e,0x70,0x9e,0xff,0xff,0xff,0xff}; +uint8_t sidepckt_state::mcu_r() +{ + return m_mcu_p1; +} +void sidepckt_state::mcu_w(uint8_t data) +{ + m_mcu_p2 = data; + m_mcu->set_input_line(MCS51_INT0_LINE, ASSERT_LINE); +} -uint8_t sidepckt_state::i8751_r() +void sidepckt_state::mcu_p1_w(uint8_t data) { - return m_i8751_return; + m_mcu_p1 = data; } -void sidepckt_state::i8751_w(uint8_t data) +uint8_t sidepckt_state::mcu_p2_r() { - m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */ - - /* This function takes multiple parameters */ - if (m_in_math == 1) - { - m_in_math = 2; - m_math_param = data; - m_i8751_return = m_math_param; - } - else if (m_in_math == 2) - { - m_in_math = 0; - m_i8751_return = (data) ? (m_math_param / data) : 0; - } - else switch (data) - { - case 1: /* ID Check */ - case 2: /* Protection data (executable code) */ - case 3: /* Protection data (executable code) */ - m_current_table = data - 1; - m_current_ptr = 0; - case 6: /* Read table data */ - m_i8751_return = m_prot_table[m_current_table][m_current_ptr]; - m_current_ptr = (m_current_ptr + 1) & 0x0f; - break; - - case 4: /* Divide function - multiple parameters */ - m_in_math = 1; - m_i8751_return = 4; - break; - - default: - break; - } + return m_mcu_p2; +} + +void sidepckt_state::mcu_p3_w(uint8_t data) +{ + // 765432-- unused + // ------1- mcu int ack + // -------0 cpu firq + + if (BIT(data, 0) == 0 && BIT(m_mcu_p3, 0) == 1) + m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); + + if (BIT(data, 0) == 1 && BIT(m_mcu_p3, 0) == 0) + m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE); + + if (BIT(data, 1) == 0 && BIT(m_mcu_p3, 1) == 1) + m_mcu->set_input_line(MCS51_INT0_LINE, CLEAR_LINE); + + m_mcu_p3 = data; } + /******************************************************************************/ void sidepckt_state::sidepckt_map(address_map &map) @@ -210,8 +201,8 @@ void sidepckt_state::sidepckt_map(address_map &map) map(0x3003, 0x3003).portr("DSW2"); map(0x3004, 0x3004).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x300c, 0x300c).rw(FUNC(sidepckt_state::scroll_y_r), FUNC(sidepckt_state::scroll_y_w)); - map(0x3014, 0x3014).r(FUNC(sidepckt_state::i8751_r)); - map(0x3018, 0x3018).w(FUNC(sidepckt_state::i8751_w)); + map(0x3014, 0x3014).r(FUNC(sidepckt_state::mcu_r)); + map(0x3018, 0x3018).w(FUNC(sidepckt_state::mcu_w)); map(0x4000, 0xffff).rom(); } @@ -361,12 +352,7 @@ GFXDECODE_END void sidepckt_state::machine_reset() { - m_i8751_return = 0; - m_current_ptr = 0; - m_current_table = 0; - m_in_math = 0; - m_math_param = 0; - m_scroll_y = 0; + m_scroll_y = 0; } void sidepckt_state::sidepckt(machine_config &config) @@ -378,18 +364,13 @@ void sidepckt_state::sidepckt(machine_config &config) M6502(config, m_audiocpu, 12_MHz_XTAL/8); /* 1.5 MHz */ m_audiocpu->set_addrmap(AS_PROGRAM, &sidepckt_state::sound_map); -/* - -Ports to be corrected once MCU is dumped + I8751(config, m_mcu, 8_MHz_XTAL); // 8.0MHz OSC on PCB + m_mcu->port_out_cb<1>().set(FUNC(sidepckt_state::mcu_p1_w)); + m_mcu->port_in_cb<2>().set(FUNC(sidepckt_state::mcu_p2_r)); + m_mcu->port_out_cb<3>().set(FUNC(sidepckt_state::mcu_p3_w)); - I8751(config, m_mcu, 8_MHz_XTAL); // 8.0MHz OSC on PCB - m_mcu->port_in_cb<0>().set([this](){ return m_mcu_p0; }); - m_mcu->port_out_cb<0>().set([this](u8 data){ m_mcu_p0 = data; }); - m_mcu->port_in_cb<1>().set([this](){ return m_mcu_p1; }); - m_mcu->port_out_cb<1>().set([this](u8 data){ m_mcu_p1 = data; }); - m_mcu->port_out_cb<2>().set(FUNC(karnov_state::mcu_p2_w)); - m_mcu->port_in_cb<3>().set_ioport("COIN"); -*/ + // needs a tight sync with the mcu + config.set_perfect_quantum(m_maincpu); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -424,6 +405,7 @@ void sidepckt_state::sidepcktb(machine_config &config) /* basic machine hardware */ m_maincpu->set_addrmap(AS_PROGRAM, &sidepckt_state::sidepcktb_map); + config.device_remove("mcu"); } @@ -433,54 +415,54 @@ void sidepckt_state::sidepcktb(machine_config &config) ***************************************************************************/ -ROM_START( sidepckt ) /* DE-0245-2 */ +ROM_START( sidepckt ) // DE-0245-2 ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "dh00-e.3c", 0x00000, 0x10000, CRC(251b316e) SHA1(c777d87621b8fefe0e33156be03da8aed733db9a) ) ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "dh04.3h", 0x08000, 0x8000, CRC(d076e62e) SHA1(720ff1a6a58697b4a9c7c4f31c24a2cf8a04900a) ) + ROM_LOAD( "dh04.3h", 0x08000, 0x8000, CRC(d076e62e) SHA1(720ff1a6a58697b4a9c7c4f31c24a2cf8a04900a) ) // is this really DH-04-E?? - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "dh.6d", 0x00000, 0x1000, NO_DUMP ) + ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU (BAD_DUMP because it was created from the Japanese version) + ROM_LOAD( "dh-e.6d", 0x0000, 0x1000, BAD_DUMP CRC(00654574) SHA1(7d775e7b7cbb548c50b9b838a525a12bf7a32f8e) ) ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) /* characters */ + ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) // characters ROM_LOAD( "dh06-e.13j", 0x08000, 0x8000, CRC(580e4e43) SHA1(de152a5d4fbc52d80e3eb9af17835ecb6258d45e) ) ROM_LOAD( "dh05-e.13h", 0x10000, 0x8000, CRC(05ab71d2) SHA1(6f06d1d1440a5fb05c01f712457d0bb167e93099) ) ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) /* sprites */ + ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) // sprites ROM_LOAD( "dh02.15a", 0x08000, 0x8000, CRC(eeb5c3e7) SHA1(57eda1cc29124e04fe5025a904634d8ca52c0f12) ) ROM_LOAD( "dh03.17a", 0x10000, 0x8000, CRC(8e18d21d) SHA1(74f0ddf1fcbed386332eba882b4136295b4f096d) ) - ROM_REGION( 0x0200, "proms", 0 ) /* color PROMs */ - ROM_LOAD( "dh-09.16l", 0x0000, 0x0100, CRC(ce049b4f) SHA1(e4918cef7b319dd40cf1722eb8bf5e79be04fd6c) ) - ROM_LOAD( "dh-08.15l", 0x0100, 0x0100, CRC(cdf2180f) SHA1(123215d096f88b66396d40d7a579380d0b5b2b89) ) + ROM_REGION( 0x0200, "proms", 0 ) // color PROMs + ROM_LOAD( "dh-09.16l", 0x0000, 0x0100, CRC(ce049b4f) SHA1(e4918cef7b319dd40cf1722eb8bf5e79be04fd6c) ) // MMI 6309-1N BPROM + ROM_LOAD( "dh-08.15l", 0x0100, 0x0100, CRC(cdf2180f) SHA1(123215d096f88b66396d40d7a579380d0b5b2b89) ) // MMI 6303-1N BPROM ROM_END -ROM_START( sidepcktj ) +ROM_START( sidepcktj ) // DE-0245-1 ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "dh00.3c", 0x00000, 0x10000, CRC(a66bc28d) SHA1(cd62ce1dce6fe42d9745eec50d11e86b076d28e1) ) + ROM_LOAD( "dh00-1.3c", 0x00000, 0x10000, CRC(a66bc28d) SHA1(cd62ce1dce6fe42d9745eec50d11e86b076d28e1) ) ROM_REGION( 0x10000, "audiocpu", 0 ) - ROM_LOAD( "dh04.3h", 0x08000, 0x8000, CRC(d076e62e) SHA1(720ff1a6a58697b4a9c7c4f31c24a2cf8a04900a) ) + ROM_LOAD( "dh04_6-19.3h", 0x08000, 0x8000, CRC(053ff83a) SHA1(e6e3ce15a86172bdc6094b4999e52d1aafc0ae10) ) // handwritten 6-19 on label - ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "dh.6d", 0x00000, 0x1000, NO_DUMP ) + ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU + ROM_LOAD( "dh.6d", 0x0000, 0x1000, CRC(f7e099b6) SHA1(8e718384489a589acebc19ca361e0aa8a4c6b63b) ) ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "dh07.13k", 0x00000, 0x8000, CRC(7d0ce858) SHA1(3a158f218a762e6841d2611f41ace67a1afefb35) ) /* characters */ + ROM_LOAD( "dh07.13k", 0x00000, 0x8000, CRC(7d0ce858) SHA1(3a158f218a762e6841d2611f41ace67a1afefb35) ) // characters ROM_LOAD( "dh06.13j", 0x08000, 0x8000, CRC(b86ddf72) SHA1(7596dd1b646971d8df1bc4fd157ccf161a712d59) ) ROM_LOAD( "dh05.13h", 0x10000, 0x8000, CRC(df6f94f2) SHA1(605796191f37cb76d496aa459243655070bb90c0) ) ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) /* sprites */ + ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) // sprites ROM_LOAD( "dh02.15a", 0x08000, 0x8000, CRC(eeb5c3e7) SHA1(57eda1cc29124e04fe5025a904634d8ca52c0f12) ) ROM_LOAD( "dh03.17a", 0x10000, 0x8000, CRC(8e18d21d) SHA1(74f0ddf1fcbed386332eba882b4136295b4f096d) ) - ROM_REGION( 0x0200, "proms", 0 ) /* color PROMs */ - ROM_LOAD( "dh-09.16l", 0x0000, 0x0100, CRC(ce049b4f) SHA1(e4918cef7b319dd40cf1722eb8bf5e79be04fd6c) ) - ROM_LOAD( "dh-08.15l", 0x0100, 0x0100, CRC(cdf2180f) SHA1(123215d096f88b66396d40d7a579380d0b5b2b89) ) + ROM_REGION( 0x0200, "proms", 0 ) // color PROMs + ROM_LOAD( "dh-09.16l", 0x0000, 0x0100, CRC(ce049b4f) SHA1(e4918cef7b319dd40cf1722eb8bf5e79be04fd6c) ) // MMI 6309-1N BPROM + ROM_LOAD( "dh-08.15l", 0x0100, 0x0100, CRC(cdf2180f) SHA1(123215d096f88b66396d40d7a579380d0b5b2b89) ) // MMI 6303-1N BPROM ROM_END ROM_START( sidepcktb ) @@ -492,16 +474,16 @@ ROM_START( sidepcktb ) ROM_LOAD( "dh04.3h", 0x08000, 0x8000, CRC(d076e62e) SHA1(720ff1a6a58697b4a9c7c4f31c24a2cf8a04900a) ) ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) /* characters */ + ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) // characters ROM_LOAD( "dh06-e.13j", 0x08000, 0x8000, CRC(580e4e43) SHA1(de152a5d4fbc52d80e3eb9af17835ecb6258d45e) ) ROM_LOAD( "dh05-e.13h", 0x10000, 0x8000, CRC(05ab71d2) SHA1(6f06d1d1440a5fb05c01f712457d0bb167e93099) ) ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) /* sprites */ + ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) // sprites ROM_LOAD( "dh02.15a", 0x08000, 0x8000, CRC(eeb5c3e7) SHA1(57eda1cc29124e04fe5025a904634d8ca52c0f12) ) ROM_LOAD( "dh03.17a", 0x10000, 0x8000, CRC(8e18d21d) SHA1(74f0ddf1fcbed386332eba882b4136295b4f096d) ) - ROM_REGION( 0x0200, "proms", 0 ) /* color PROMs */ + ROM_REGION( 0x0200, "proms", 0 ) // color PROMs ROM_LOAD( "dh-09.16l", 0x0000, 0x0100, CRC(ce049b4f) SHA1(e4918cef7b319dd40cf1722eb8bf5e79be04fd6c) ) ROM_LOAD( "dh-08.15l", 0x0100, 0x0100, CRC(cdf2180f) SHA1(123215d096f88b66396d40d7a579380d0b5b2b89) ) ROM_END @@ -509,33 +491,12 @@ ROM_END void sidepckt_state::init_sidepckt() { - m_prot_table[0] = sidepckt_prot_table_1; - m_prot_table[1] = sidepckt_prot_table_2; - m_prot_table[2] = sidepckt_prot_table_3; - - save_item(NAME(m_i8751_return)); - save_item(NAME(m_current_ptr)); - save_item(NAME(m_current_table)); - save_item(NAME(m_in_math)); - save_item(NAME(m_math_param)); - save_item(NAME(m_scroll_y)); -} - -void sidepckt_state::init_sidepcktj() -{ - m_prot_table[0] = sidepcktj_prot_table_1; - m_prot_table[1] = sidepcktj_prot_table_2; - m_prot_table[2] = sidepcktj_prot_table_3; - - save_item(NAME(m_i8751_return)); - save_item(NAME(m_current_ptr)); - save_item(NAME(m_current_table)); - save_item(NAME(m_in_math)); - save_item(NAME(m_math_param)); - save_item(NAME(m_scroll_y)); + save_item(NAME(m_mcu_p1)); + save_item(NAME(m_mcu_p2)); + save_item(NAME(m_mcu_p3)); } -GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, init_sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, init_sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, sidepckt_state, empty_init, ROT0, "bootleg", "Side Pocket (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, init_sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, init_sidepckt, ROT0, "Data East Corporation", "Side Pocket (Japan, Cocktail)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, sidepckt_state, empty_init, ROT0, "bootleg", "Side Pocket (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp index 99fdfb37bbd..0ec089f9b74 100644 --- a/src/mame/drivers/sigmab98.cpp +++ b/src/mame/drivers/sigmab98.cpp @@ -528,8 +528,8 @@ void sigmab98_base_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl dstdyy /= 2; // Transform the source image while drawing to the screen - uint16_t *src = &m_sprite_bitmap->pix16(0); - uint16_t *dst = &bitmap.pix16(0); + uint16_t const *const src = &m_sprite_bitmap->pix(0); + uint16_t *const dst = &bitmap.pix(0); int src_rowpixels = m_sprite_bitmap->rowpixels(); int dst_rowpixels = bitmap.rowpixels(); diff --git a/src/mame/drivers/sk101bl.cpp b/src/mame/drivers/sk101bl.cpp index 0e60fa81c86..8abd709bea2 100644 --- a/src/mame/drivers/sk101bl.cpp +++ b/src/mame/drivers/sk101bl.cpp @@ -87,7 +87,7 @@ void sk101bl_state::machine_reset() HD44780_PIXEL_UPDATE(sk101bl_state::pixel_update) { if (pos < 16 && line == 0) - bitmap.pix16(line * 10 + y, pos * 6 + x) = state; + bitmap.pix(line * 10 + y, pos * 6 + x) = state; } u8 sk101bl_state::p1_r() diff --git a/src/mame/drivers/skeetsht.cpp b/src/mame/drivers/skeetsht.cpp index 4ffb1851f85..1d468709110 100644 --- a/src/mame/drivers/skeetsht.cpp +++ b/src/mame/drivers/skeetsht.cpp @@ -90,13 +90,12 @@ void skeetsht_state::video_start() TMS340X0_SCANLINE_RGB32_CB_MEMBER(skeetsht_state::scanline_update) { - const pen_t *const pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); uint16_t *vram = &m_tms_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint32_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/skimaxx.cpp b/src/mame/drivers/skimaxx.cpp index f50ead130f9..d7d4b13cb00 100644 --- a/src/mame/drivers/skimaxx.cpp +++ b/src/mame/drivers/skimaxx.cpp @@ -224,9 +224,9 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(skimaxx_state::scanline_update) if (params->rowaddr >= 0x220) { u32 const rowaddr = (params->rowaddr - 0x220); - u16 *fg = &m_fg_buffer[rowaddr << 8]; - u32 *bg = &m_bg_buffer_front[rowaddr/2 * 1024/2]; - u16 *dest = &bitmap.pix16(scanline); + u16 const *fg = &m_fg_buffer[rowaddr << 8]; + u32 const *bg = &m_bg_buffer_front[rowaddr/2 * 1024/2]; + u16 *dest = &bitmap.pix(scanline); //int coladdr = params->coladdr; //coladdr = 0; diff --git a/src/mame/drivers/sliver.cpp b/src/mame/drivers/sliver.cpp index 9aec09572d3..13110011ade 100644 --- a/src/mame/drivers/sliver.cpp +++ b/src/mame/drivers/sliver.cpp @@ -169,21 +169,19 @@ void sliver_state::plot_pixel_rgb(int x, int y, uint32_t r, uint32_t g, uint32_t if (y < 0 || x < 0 || x > 383 || y > 255) return; - m_bitmap_bg.pix32(y, x) = r | (g<<8) | (b<<16); + m_bitmap_bg.pix(y, x) = r | (g<<8) | (b<<16); } void sliver_state::plot_pixel_pal(int x, int y, int addr) { - uint32_t r,g,b; - if (y < 0 || x < 0 || x > 383 || y > 255) return; - b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3); - g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3); - r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3); + uint32_t b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3); + uint32_t g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3); + uint32_t r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3); - m_bitmap_fg.pix32(y, x) = r | (g<<8) | (b<<16); + m_bitmap_fg.pix(y, x) = r | (g<<8) | (b<<16); } void sliver_state::fifo_data_w(offs_t offset, uint16_t data, uint16_t mem_mask) diff --git a/src/mame/drivers/slotcarn.cpp b/src/mame/drivers/slotcarn.cpp index 937273676ac..436dae1b6f0 100644 --- a/src/mame/drivers/slotcarn.cpp +++ b/src/mame/drivers/slotcarn.cpp @@ -115,28 +115,23 @@ MC6845_UPDATE_ROW( slotcarn_state::crtc_update_row ) int extra_video_bank_bit = 0; // not used? int lscnblk = 0; // not used? - uint8_t *gfx[2]; uint16_t x = 0; - int rlen; - gfx[0] = memregion("gfx1")->base(); - gfx[1] = memregion("gfx2")->base(); - rlen = memregion("gfx2")->bytes(); + uint8_t const *const gfx[2] = { memregion("gfx1")->base(), memregion("gfx2")->base() }; + int const rlen = memregion("gfx2")->bytes(); //ma = ma ^ 0x7ff; for (uint8_t cx = 0; cx < x_count; cx++) { - int i; int attr = m_ram_attr[ma & 0x7ff]; int region = (attr & 0x40) >> 6; int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f); int colour = (attr & 0x7f) << 3; - uint8_t *data; addr &= (rlen-1); - data = gfx[region]; + uint8_t const *const data = gfx[region]; - for (i = 7; i>=0; i--) + for (int i = 7; i>=0; i--) { int col = colour; @@ -150,7 +145,7 @@ MC6845_UPDATE_ROW( slotcarn_state::crtc_update_row ) col |= 0x03; col = m_ram_palette[col & 0x3ff]; - bitmap.pix32(y, x) = m_pens[col ? col & (NUM_PENS-1) : (lscnblk ? 8 : 0)]; + bitmap.pix(y, x) = m_pens[col ? col & (NUM_PENS-1) : (lscnblk ? 8 : 0)]; x++; } diff --git a/src/mame/drivers/sm1800.cpp b/src/mame/drivers/sm1800.cpp index 342991fa81c..949ceb2f7c2 100644 --- a/src/mame/drivers/sm1800.cpp +++ b/src/mame/drivers/sm1800.cpp @@ -99,9 +99,8 @@ INTERRUPT_GEN_MEMBER(sm1800_state::vblank_interrupt) I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charmap = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charmap = memregion("chargen")->base(); uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; @@ -112,8 +111,8 @@ I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - for(i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + for(int i=0;i<8;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } void sm1800_state::portb_w(uint8_t data) diff --git a/src/mame/drivers/sm7238.cpp b/src/mame/drivers/sm7238.cpp index 636ad4e0c7b..037dbee0c1f 100644 --- a/src/mame/drivers/sm7238.cpp +++ b/src/mame/drivers/sm7238.cpp @@ -228,30 +228,30 @@ void sm7238_state::recompute_parameters() uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx, fg, bg, attr, ctl1, ctl2 = 0; - uint16_t chr, chraddr, sy = 0, ma = 0, x = 0; - bool double_width = false, double_height = false, bottom_half = false; - bool blink((m_screen->frame_number() % 30) > 14); // XXX guess - if (!BIT(m_video.control, 3)) { bitmap.fill(0); return 0; } - for (y = 0; y < 26; y++) + uint8_t ctl2 = 0; + uint16_t sy = 0, ma = 0; + bool double_width = false, double_height = false, bottom_half = false; + bool blink((m_screen->frame_number() % 30) > 14); // XXX guess + + for (uint8_t y = 0; y < 26; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { if (y == 1 && ctl2 && ra < ctl2) continue; - uint16_t *p = &bitmap.pix16(sy++, 0); + uint16_t *p = &bitmap.pix(sy++, 0); - for (x = ma; x < ma + m_video.stride; x++) + for (uint16_t x = ma; x < ma + m_video.stride; x++) { - chr = m_p_videoram[x] << 4; - attr = m_p_videoram[x + 0x1000]; + uint16_t chr = m_p_videoram[x] << 4; + uint8_t const attr = m_p_videoram[x + 0x1000]; // alternate font 1 if (BIT(attr, 6)) @@ -259,9 +259,10 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap chr += 0x1000; } - bg = 0; - fg = 1; + uint8_t bg = 0; + uint8_t fg = 1; + uint16_t chraddr; if (double_height) { chraddr = chr | (bottom_half ? (5 + (ra >> 1)) : (ra >> 1)); @@ -272,6 +273,7 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } // alternate font 2 (downloadable font) -- only in models .05 and .06 + uint8_t gfx; if (BIT(attr, 7) && m_p_charram[chr + 15]) { gfx = m_p_charram[chraddr] ^ 255; @@ -318,7 +320,7 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (double_width) x++; } } - ctl1 = m_p_videoram[ma + 0x1000 + m_video.stride]; + uint8_t const ctl1 = m_p_videoram[ma + 0x1000 + m_video.stride]; double_width = BIT(ctl1, 6); double_height = BIT(ctl1, 7); bottom_half = BIT(ctl1, 5); diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp index ab95effa741..980990dc82d 100644 --- a/src/mame/drivers/smc777.cpp +++ b/src/mame/drivers/smc777.cpp @@ -164,47 +164,44 @@ void smc777_state::video_start() uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,yi; uint16_t count; - int x_width; // popmessage("%d %d %d %d",mc6845_v_char_total,mc6845_v_total_adj,mc6845_v_display,mc6845_v_sync_pos); bitmap.fill(m_palette->pen(m_backdrop_pen), cliprect); - x_width = ((m_display_reg & 0x80) >> 7); + int x_width = ((m_display_reg & 0x80) >> 7); count = 0x0000; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(y=0;y<200;y+=8) + for(int y=0;y<200;y+=8) { - for(x=0;x<160;x++) + for(int x=0;x<160;x++) { - uint16_t color; + uint16_t color = (m_gvram[count] & 0xf0) >> 4; - color = (m_gvram[count] & 0xf0) >> 4; /* todo: clean this up! */ //if(x_width) { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); } //else //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); + // bitmap.pix(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); //} color = (m_gvram[count] & 0x0f) >> 0; //if(x_width) { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); } //else //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); + // bitmap.pix(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); //} count++; @@ -216,9 +213,9 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 count = 0x0000; - for(y=0;y<25;y++) + for(int y=0;y<25;y++) { - for(x=0;x<80/(x_width+1);x++) + for(int x=0;x<80/(x_width+1);x++) { /* -x-- ---- blink @@ -229,11 +226,9 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 int color = m_attr[count] & 7; int bk_color = (m_attr[count] & 0x18) >> 3; int blink = m_attr[count] & 0x40; - int xi; - int bk_pen; //int bk_struct[4] = { -1, 0x10, 0x11, (color & 7) ^ 8 }; - bk_pen = -1; + int bk_pen = -1; switch(bk_color & 3) { case 0: bk_pen = -1; break; //transparent @@ -245,23 +240,21 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 if(blink && m_screen->frame_number() & 0x10) //blinking, used by Dragon's Alphabet color = bk_pen; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; + int pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; if (pen != -1) { if(x_width) { - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); } else - bitmap.pix16(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); } } } @@ -269,9 +262,7 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 // draw cursor if(mc6845_cursor_addr == count) { - int xc,yc,cursor_on; - - cursor_on = 0; + int cursor_on = 0; switch(mc6845_cursor_y_start & 0x60) { case 0x00: cursor_on = 1; break; //always on @@ -282,17 +273,17 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 if(cursor_on) { - for(yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) + for(int yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) { - for(xc=0;xc<8;xc++) + for(int xc=0;xc<8;xc++) { if(x_width) { - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); } else - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); } } } diff --git a/src/mame/drivers/smotor.cpp b/src/mame/drivers/smotor.cpp index 0479bb8b41b..7bca82cc50d 100644 --- a/src/mame/drivers/smotor.cpp +++ b/src/mame/drivers/smotor.cpp @@ -233,7 +233,7 @@ uint32_t smotor_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_bg_tilemap->set_scrolly((m_videoreg[3] + (m_videoreg[5] << 8))); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); } else { - bitmap.fill(rgb_t::black(), cliprect); + bitmap.fill(0, cliprect); } m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); diff --git a/src/mame/drivers/smsmcorp.cpp b/src/mame/drivers/smsmcorp.cpp index c89f7cfce31..d67da1b4289 100644 --- a/src/mame/drivers/smsmcorp.cpp +++ b/src/mame/drivers/smsmcorp.cpp @@ -448,7 +448,6 @@ void smsmfg_state::video_w(offs_t offset, uint8_t data) m_vid_regs[offset] = data; if ( offset == 5 ) { - int x,y; int xstart = m_vid_regs[0] + m_vid_regs[1]*256; int width = m_vid_regs[2]; int ystart = m_vid_regs[3]; @@ -461,12 +460,12 @@ void smsmfg_state::video_w(offs_t offset, uint8_t data) if ( width == 0 ) width = 256; - for ( y = ystart; y < ystart + height; y++ ) + for ( int y = ystart; y < ystart + height; y++ ) { - for ( x = xstart; x < xstart + width; x++ ) + for ( int x = xstart; x < xstart + width; x++ ) { if ( y < 256 ) - m_bitmap.pix16(y, x) = color; + m_bitmap.pix(y, x) = color; } } } diff --git a/src/mame/drivers/snesb.cpp b/src/mame/drivers/snesb.cpp index a8a8cf89916..f6c028b4236 100644 --- a/src/mame/drivers/snesb.cpp +++ b/src/mame/drivers/snesb.cpp @@ -324,7 +324,7 @@ uint8_t snesb_state::wldgunsb_722262_r() { // PC 2e2f6 return 0x2b; -} +} uint8_t snesb_state::wldgunsb_723364_r() { @@ -1412,7 +1412,7 @@ void snesb_state::init_wldgunsb() static uint8_t address_tab_high[0x20] = { 0x0b, 0x1d, 0x05, 0x15, 0x09, 0x19, 0x04, 0x13, 0x02, 0x1f, 0x07, 0x17, 0x0d, 0x11, 0x0a, 0x1a, - 0x14, 0x0e, 0x18, 0x06, 0x1e, 0x01, 0x10, 0x0c, 0x1b, 0x0f, 0x16, 0x00, 0x12, 0x08, 0x1c, 0x03 + 0x14, 0x0e, 0x18, 0x06, 0x1e, 0x01, 0x10, 0x0c, 0x1b, 0x0f, 0x16, 0x00, 0x12, 0x08, 0x1c, 0x03 }; static uint8_t address_tab_low[0x40] = { @@ -1465,7 +1465,7 @@ void snesb_state::init_wldgunsb() m_maincpu->space(AS_PROGRAM).install_read_handler(0x770071, 0x770071, read8smo_delegate(*this, FUNC(snesb_state::snesb_dsw1_r))); m_maincpu->space(AS_PROGRAM).install_read_handler(0x770072, 0x770072, read8smo_delegate(*this, FUNC(snesb_state::snesb_dsw2_r))); m_maincpu->space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8smo_delegate(*this, FUNC(snesb_state::snesb_coin_r))); - + // protection overlays // counter (PC=0x2dfe7 / 0x2dfee) m_maincpu->space(AS_PROGRAM).install_read_handler(0x7bf45b, 0x7bf45b, read8smo_delegate(*this, FUNC(snesb_state::sb2b_75bd37_r))); @@ -1627,6 +1627,18 @@ ROM_START( endless ) ROM_LOAD( "endlessduel.unknownposition4", 0x180000, 0x80000, CRC(9a9493ad) SHA1(82ee4fce9cc2014cb8404fd43eebb7941cdb9ac1) ) ROM_END +ROM_START( endlessa ) + ROM_REGION( 0x200000, "user3", ROMREGION_ERASEFF ) + + ROM_REGION(0x800, "user6", ROMREGION_ERASEFF) + + ROM_REGION( 0x200000, "user7", 0 ) + ROM_LOAD( "gundam wing endless duel.c23", 0x000000, 0x80000, CRC(e49acd29) SHA1(ac137261fe7a7691738ac812bea9591256eb9038) ) + ROM_LOAD( "gundam wing endless duel.c20", 0x080000, 0x80000, CRC(cf22a554) SHA1(86a31c83a1d28038c334949e82182c07010ccb3c) ) + ROM_LOAD( "gundam wing endless duel.c22", 0x100000, 0x80000, CRC(30d06d7a) SHA1(17c617d94abb10c3bdf9d51013b116f4ef4debe8) ) + ROM_LOAD( "gundam wing endless duel.c21", 0x180000, 0x80000, CRC(0cc430c0) SHA1(fb36359e7e3919244c47a6da43f31dc2a79fcba6) ) +ROM_END + ROM_START( rushbets ) ROM_REGION( 0x200000, "user3", ROMREGION_ERASEFF ) @@ -1667,7 +1679,8 @@ GAME( 1996, iron, 0, kinstb, iron, snesb_state, init_i GAME( 1996, denseib, 0, kinstb, denseib, snesb_state, init_denseib, ROT0, "bootleg", "Ghost Chaser Densei (SNES bootleg, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1996, denseib2, denseib, kinstb, denseib, snesb_state, init_denseib2, ROT0, "bootleg", "Ghost Chaser Densei (SNES bootleg, set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, sblast2b, 0, kinstb, sblast2b, snesb_state, init_sblast2b, ROT0, "bootleg", "Sonic Blast Man 2 Special Turbo (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS) -GAME( 1996, endless, 0, kinstb, endless, snesb_state, init_endless, ROT0, "bootleg", "Gundam Wing: Endless Duel (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1996, endless, 0, kinstb, endless, snesb_state, init_endless, ROT0, "bootleg", "Gundam Wing: Endless Duel (SNES bootleg, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +GAME( 1996, endlessa, endless, kinstb, endless, snesb_state, init_endless, ROT0, "bootleg", "Gundam Wing: Endless Duel (SNES bootleg, set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1996, legendsb, 0, kinstb, kinstb, snesb_state, init_legendsb, ROT0, "bootleg", "Legend (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, rushbets, 0, kinstb, rushbets, snesb_state, init_rushbets, ROT0, "bootleg", "Rushing Beat Shura (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1997, venom, 0, kinstb, venom, snesb_state, init_venom, ROT0, "bootleg", "Venom & Spider-Man - Separation Anxiety (SNES bootleg)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/snk68.cpp b/src/mame/drivers/snk68.cpp index 35cf4a41e2d..be30229ed25 100644 --- a/src/mame/drivers/snk68.cpp +++ b/src/mame/drivers/snk68.cpp @@ -48,6 +48,7 @@ Notes: #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "sound/3812intf.h" +#include "sound/msm5205.h" #include "emupal.h" #include "speaker.h" @@ -157,6 +158,13 @@ void snk68_state::sound_io_map(address_map &map) map(0x80, 0x80).lw8(NAME([this] (u8 data) { m_upd7759->reset_w(BIT(data, 7)); } )); } +void snk68_state::powb_sound_io_map(address_map &map) +{ + map.global_mask(0xff); + map(0x00, 0x00).rw("ymsnd", FUNC(ym3812_device::status_port_r), FUNC(ym3812_device::control_port_w)); + map(0x20, 0x20).w("ymsnd", FUNC(ym3812_device::write_port_w)); +} + /******************************************************************************/ static INPUT_PORTS_START( pow ) @@ -619,6 +627,17 @@ void snk68_state::pow(machine_config &config) m_upd7759->add_route(ALL_OUTPUTS, "mono", 0.50); } +void snk68_state::powb(machine_config &config) +{ + pow(config); + + m_soundcpu->set_addrmap(AS_IO, &snk68_state::powb_sound_io_map); + + config.device_remove("upd"); + + MSM5205(config, "msm", 0).add_route(ALL_OUTPUTS, "mono", 0.50); // TODO: hook this up +} + void snk68_state::streetsm(machine_config &config) { pow(config); @@ -709,6 +728,58 @@ ROM_START( powj ) ROM_LOAD( "pal20l10.a6", 0x0000, 0x00cc, CRC(c3d9e729) SHA1(f05f03eecf12b4d0793124ecd3195307be04046b) ) ROM_END +ROM_START( powb ) // main PCB + sprite ROM board + ROM_REGION( 0x40000, "maincpu", 0 ) // identical to pow, but smaller ROMs + ROM_LOAD16_BYTE( "pow36b.bin", 0x000000, 0x10000, CRC(a4de338d) SHA1(18ac22e5e99018cc794350faed4b75006737d2bc) ) + ROM_LOAD16_BYTE( "pow35b.bin", 0x000001, 0x10000, CRC(ba405691) SHA1(a21eab60efbe8c56524518c389ab7d545c41af55) ) + ROM_LOAD16_BYTE( "pow36a.bin", 0x020000, 0x10000, CRC(fa53460c) SHA1(f4a31e27c45ac2727cbf3e855ccc787392e17866) ) + ROM_LOAD16_BYTE( "pow35a.bin", 0x020001, 0x10000, CRC(a67c6495) SHA1(14066d314bbe42ab12d7287724e4071869f61157) ) + + ROM_REGION( 0x10000, "soundcpu", 0 ) // very similar to pow, updated to support MSM5205 instead of UPD7759 + ROM_LOAD( "pow37.bin", 0x000000, 0x10000, CRC(0d22d25f) SHA1(0dca3e1bebe91da84b8537c0ff184241797ac8da) ) + + ROM_REGION( 0x010000, "gfx1", 0 ) // characters, identical to pow + ROM_LOAD( "pow34.bin", 0x000000, 0x08000, CRC(df864a08) SHA1(dd996070077efbbf9d784299b6563cab258e4a8e) ) + ROM_LOAD( "pow33.bin", 0x008000, 0x08000, CRC(9e470d53) SHA1(f7dc6ac39ade573480e87170a2781f0f72930580) ) + + ROM_REGION( 0x200000, "gfx2", 0 ) // sprites, different format + ROM_LOAD16_BYTE( "pow30.bin", 0x000000, 0x10000, CRC(40b43c09) SHA1(8b12b02284032e01ff8b9410948e1da8f88f124b) ) + ROM_LOAD16_BYTE( "pow24.bin", 0x000001, 0x10000, CRC(efbfdf59) SHA1(c02d18fb582bd4bdbf2b3ea6f2bd925e7d70a3af) ) + ROM_LOAD16_BYTE( "pow29.bin", 0x020000, 0x10000, CRC(61909aa4) SHA1(6981bf33f7261a0d5dc412e4f4bb72b523f4af37) ) + ROM_LOAD16_BYTE( "pow23.bin", 0x020001, 0x10000, CRC(ea9aca79) SHA1(693916685b23b10b966e6fb9e0f2846994b672c9) ) + ROM_LOAD16_BYTE( "pow28.bin", 0x040000, 0x10000, CRC(81da0f09) SHA1(0c788abce58b581790051741aafee72ddcdabd02) ) + ROM_LOAD16_BYTE( "pow22.bin", 0x040001, 0x10000, CRC(361f178b) SHA1(6a680e2b37e1ae825d548e90720999bd0188b151) ) + ROM_LOAD16_BYTE( "pow27.bin", 0x060000, 0x10000, CRC(f7db186c) SHA1(cbd17ee46563dcb7ad1e2f8b2c7481102ecb91f7) ) + ROM_LOAD16_BYTE( "pow21.bin", 0x060001, 0x10000, CRC(606fab0a) SHA1(7b60df4ee8096da6ad14d0aa197b20b7293f04a9) ) + ROM_LOAD16_BYTE( "pow26.bin", 0x080000, 0x10000, CRC(a028dfda) SHA1(7a84a44fc062aa946f1fddbefbde0dae0d0212a3) ) + ROM_LOAD16_BYTE( "pow20.bin", 0x080001, 0x10000, CRC(06be682c) SHA1(24abf7f3b525124a2b38aae6e1c313d1dc0ad1ff) ) + ROM_LOAD16_BYTE( "pow31.bin", 0x0a0000, 0x10000, CRC(f25ea217) SHA1(bde91824539ea037acdd3ccdbb3387f0364888ec) ) + ROM_LOAD16_BYTE( "pow19.bin", 0x0a0001, 0x10000, CRC(4e7b2b47) SHA1(344af976c4c82495a820437cbbdacb1027fa14c0) ) + ROM_LOAD16_BYTE( "pow25.bin", 0x0c0000, 0x10000, CRC(a4cf97d5) SHA1(8ff0a7fe61f3ee3167601e68a54960b3e712c4b5) ) + ROM_LOAD16_BYTE( "pow18.bin", 0x0c0001, 0x10000, CRC(b70c603d) SHA1(6434eeddf7009887889914edc63a348053a05bc0) ) + ROM_LOAD16_BYTE( "pow32.bin", 0x0e0000, 0x10000, CRC(9ffd27ea) SHA1(d693baa289811c8b612fb45b1186a361d73d223b) ) + ROM_LOAD16_BYTE( "pow17.bin", 0x0e0001, 0x10000, CRC(c91291ce) SHA1(1276caa972ba625f3aacbd11e5b37d66406fbe97) ) + ROM_LOAD16_BYTE( "pow15.bin", 0x100000, 0x10000, CRC(ffe660b2) SHA1(06b93e0f0b7dd83046c428459a47239454e9d7f2) ) + ROM_LOAD16_BYTE( "pow1.bin", 0x100001, 0x10000, CRC(4fc31abe) SHA1(2bdc3de7301ab512dbf3c3a9e4e249d258ea287f) ) + ROM_LOAD16_BYTE( "pow14.bin", 0x120000, 0x10000, CRC(07a08711) SHA1(d43707a6e8eb6925e1f46a495590c31a1683d073) ) + ROM_LOAD16_BYTE( "pow2.bin", 0x120001, 0x10000, CRC(0be02c0c) SHA1(7dcbc8c47982d78c887de4e8112cb17678f07213) ) + ROM_LOAD16_BYTE( "pow13.bin", 0x140000, 0x10000, CRC(37147ef2) SHA1(2970bfbdac856a02316ebef98c4da8fe451efc7b) ) + ROM_LOAD16_BYTE( "pow3.bin", 0x140001, 0x10000, CRC(fe4e3f95) SHA1(efe2665405dbd866de96a09bced43ff945d09ede) ) + ROM_LOAD16_BYTE( "pow12.bin", 0x160000, 0x10000, CRC(57085ebc) SHA1(ee1c4140bd24aa8721fcdba5545001ffbfb5df44) ) + ROM_LOAD16_BYTE( "pow4.bin", 0x160001, 0x10000, CRC(325ba653) SHA1(55e6c9d8bd61a02ef8334e9637e4be02e22750bd) ) + ROM_LOAD16_BYTE( "pow11.bin", 0x180000, 0x10000, CRC(2c90e2c2) SHA1(cc1d555076e780cacfeb8aa0e784da08cce7e23a) ) + ROM_LOAD16_BYTE( "pow5.bin", 0x180001, 0x10000, CRC(36d691e2) SHA1(b4c7fd340649380bb9736e325c31775eb515a642) ) + ROM_LOAD16_BYTE( "pow10.bin", 0x1a0000, 0x10000, CRC(6ac5e036) SHA1(05ec7e82080b8ea4426b18ccf1e79fc2f2f81e8b) ) + ROM_LOAD16_BYTE( "pow6.bin", 0x1a0001, 0x10000, CRC(e6d8123a) SHA1(23f21d0b857de6c099de5c4d139bc32475cb8b88) ) + ROM_LOAD16_BYTE( "pow9.bin", 0x1c0000, 0x10000, CRC(5b1a1c99) SHA1(d4748cc02021bd189e635a8578ce28201000ee4f) ) + ROM_LOAD16_BYTE( "pow7.bin", 0x1c0001, 0x10000, CRC(093fe9c6) SHA1(36090da050f66fea1d9edaf5673a156a3f43de77) ) + ROM_LOAD16_BYTE( "pow16.bin", 0x1e0000, 0x10000, CRC(bbc4d174) SHA1(73bbee1ae76a76a5c057f8ade05399c411640aaf) ) + ROM_LOAD16_BYTE( "pow8.bin", 0x1e0001, 0x10000, CRC(7f7c703e) SHA1(86d98d2028fef28ef629a417a1e06b7353766545) ) + + ROM_REGION( 0x10000, "msm", 0 ) // unique + ROM_LOAD( "pow38.bin", 0x000000, 0x10000, CRC(72f35d38) SHA1(072d2af2a3ffa4b46be471659fc4d9bf6e02b683) ) +ROM_END + ROM_START( streetsm ) ROM_REGION( 0x40000, "maincpu", 0 ) ROM_LOAD16_BYTE( "s2-1ver2.14h", 0x00000, 0x20000, CRC(655f4773) SHA1(5374a6cf0b895c5ff839b0f52402df4cc53241cf) ) @@ -1092,19 +1163,33 @@ ROM_START( searcharj ) ROM_LOAD( "bh.v1", 0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) ) ROM_END + +void snk68_state::init_powb() +{ + uint8_t *gfx2 = memregion("gfx2")->base(); + + // rearrange sprites to what the driver expects + for (int i = 0; i < 0x200000; i++) + { + gfx2[i] = bitswap(gfx2[i], 7, 3, 6, 2, 5, 1, 4, 0); + } +} + + /******************************************************************************/ -GAME( 1988, pow, 0, pow, pow, snk68_state, empty_init, ROT0, "SNK", "P.O.W. - Prisoners of War (US version 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, powj, pow, pow, powj, snk68_state, empty_init, ROT0, "SNK", "Datsugoku - Prisoners of War (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, streetsm, 0, streetsm, streetsm, snk68_state, empty_init, ROT0, "SNK", "Street Smart (US version 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, streetsm1, streetsm, searchar, streetsm, searchar_state, empty_init, ROT0, "SNK", "Street Smart (US version 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, streetsmw, streetsm, searchar, streetsj, searchar_state, empty_init, ROT0, "SNK", "Street Smart (World version 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, streetsmj, streetsm, searchar, streetsj, searchar_state, empty_init, ROT0, "SNK", "Street Smart (Japan version 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, ikari3, 0, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari III - The Rescue (World version 1, 8-Way Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, ikari3w, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari III - The Rescue (World, Rotary Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, ikari3u, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari III - The Rescue (US, Rotary Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, ikari3j, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari Three (Japan, Rotary Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, ikari3k, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari Three (Korea, 8-Way Joystick)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, searchar, 0, searchar, searchar, searchar_state, empty_init, ROT90, "SNK", "SAR - Search And Rescue (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, searcharu, searchar, searchar, searchar, searchar_state, empty_init, ROT90, "SNK", "SAR - Search And Rescue (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, searcharj, searchar, searchar, searchar, searchar_state, empty_init, ROT90, "SNK", "SAR - Search And Rescue (Japan version 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, pow, 0, pow, pow, snk68_state, empty_init, ROT0, "SNK", "P.O.W. - Prisoners of War (US version 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, powj, pow, pow, powj, snk68_state, empty_init, ROT0, "SNK", "Datsugoku - Prisoners of War (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, powb, pow, powb, pow, snk68_state, init_powb, ROT0, "bootleg", "P.O.W. - Prisoners of War (bootleg of US version 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // MSM5205 not hooked up +GAME( 1989, streetsm, 0, streetsm, streetsm, snk68_state, empty_init, ROT0, "SNK", "Street Smart (US version 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, streetsm1, streetsm, searchar, streetsm, searchar_state, empty_init, ROT0, "SNK", "Street Smart (US version 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, streetsmw, streetsm, searchar, streetsj, searchar_state, empty_init, ROT0, "SNK", "Street Smart (World version 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, streetsmj, streetsm, searchar, streetsj, searchar_state, empty_init, ROT0, "SNK", "Street Smart (Japan version 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, ikari3, 0, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari III - The Rescue (World version 1, 8-Way Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, ikari3w, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari III - The Rescue (World, Rotary Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, ikari3u, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari III - The Rescue (US, Rotary Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, ikari3j, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari Three (Japan, Rotary Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, ikari3k, ikari3, searchar, ikari3, searchar_state, empty_init, ROT0, "SNK", "Ikari Three (Korea, 8-Way Joystick)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, searchar, 0, searchar, searchar, searchar_state, empty_init, ROT90, "SNK", "SAR - Search And Rescue (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, searcharu, searchar, searchar, searchar, searchar_state, empty_init, ROT90, "SNK", "SAR - Search And Rescue (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, searcharj, searchar, searchar, searchar, searchar_state, empty_init, ROT90, "SNK", "SAR - Search And Rescue (Japan version 3)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/socrates.cpp b/src/mame/drivers/socrates.cpp index 768feeac3a2..4c2da8d187e 100644 --- a/src/mame/drivers/socrates.cpp +++ b/src/mame/drivers/socrates.cpp @@ -809,36 +809,33 @@ void socrates_state::video_start() uint32_t socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - static const uint8_t fixedcolors[8] = - { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 - }; - uint8_t *videoram = m_vram_reg->base(); - int x, y, colidx, color; + static const uint8_t fixedcolors[8] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 }; + uint8_t const *const videoram = m_vram_reg->base(); int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000 - for (y = 0; y < 228; y++) + for (int y = 0; y < 228; y++) { if ((((y+m_scroll_offset)*128)&0xffff) >= 0xf000) lineoffset = 0x1000; // see comment above - for (x = 0; x < 264; x++) + for (int x = 0; x < 264; x++) { + int color; if (x < 256) { - colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; + int colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; if (x&1) colidx >>=4; colidx &= 0xF; if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; } else { - colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; + int colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; colidx >>=4; colidx &= 0xF; if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; } + bitmap.pix(y, x) = color; } } return 0; @@ -898,7 +895,7 @@ uint32_t iqunlimz_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for(int b=0; b<2; b++) { - bitmap.pix16(y, x*2 + b) = get_color(data & 0x0f, y); + bitmap.pix(y, x*2 + b) = get_color(data & 0x0f, y); data >>= 4; } } @@ -932,7 +929,7 @@ uint32_t iqunlimz_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int cx=0; cx<6; cx++) { int px = 8 + x*6 + cx; - bitmap.pix16(py, px) = BIT(data, 7) ? col1 : col0; + bitmap.pix(py, px) = BIT(data, 7) ? col1 : col0; data <<= 1; } } diff --git a/src/mame/drivers/sorcerer.cpp b/src/mame/drivers/sorcerer.cpp index 63b2002ad13..8e507a39ca7 100644 --- a/src/mame/drivers/sorcerer.cpp +++ b/src/mame/drivers/sorcerer.cpp @@ -391,22 +391,20 @@ GFXDECODE_END uint32_t sorcerer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space& program = m_maincpu->space(AS_PROGRAM); - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0xf080,x; - uint16_t *p; + uint16_t sy=0,ma=0xf080; - for (y = 0; y < 30; y++) + for (uint8_t y = 0; y < 30; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+64; x++) + for (uint16_t x = ma; x < ma+64; x++) { - chr = program.read_byte(x); + uint8_t const chr = program.read_byte(x); /* get pattern of pixels for that character scanline */ - gfx = program.read_byte(0xf800 | (chr<<3) | ra); + uint8_t const gfx = program.read_byte(0xf800 | (chr<<3) | ra); /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/spaceg.cpp b/src/mame/drivers/spaceg.cpp index 176219979db..5c8e169c2d0 100644 --- a/src/mame/drivers/spaceg.cpp +++ b/src/mame/drivers/spaceg.cpp @@ -341,18 +341,15 @@ uint8_t spaceg_state::colorram_r(offs_t offset) uint32_t spaceg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; uint8_t data = m_videoram[offs]; int y = offs & 0xff; int x = (offs >> 8) << 3; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix16(y, x) = (data & 0x80) ? m_colorram[offs] : 0; + bitmap.pix(y, x) = (data & 0x80) ? m_colorram[offs] : 0; x++; data <<= 1; diff --git a/src/mame/drivers/spc1000.cpp b/src/mame/drivers/spc1000.cpp index 4740f4fca85..fb1df6a2d27 100644 --- a/src/mame/drivers/spc1000.cpp +++ b/src/mame/drivers/spc1000.cpp @@ -3,6 +3,8 @@ /*************************************************************************** Samsung SPC-1000 driver by Miodrag Milanovic +This was the first computer from Samsung. It featured a cassette player +embedded in the righthand side of the keyboard. 2009-05-10 Preliminary driver. 2014-02-16 Added cassette, many games are playable @@ -321,8 +323,8 @@ static INPUT_PORTS_START( spc1000 ) PORT_START("LINE.4") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1c) // shows symbols PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) @@ -331,7 +333,7 @@ static INPUT_PORTS_START( spc1000 ) PORT_START("LINE.5") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) @@ -351,7 +353,7 @@ static INPUT_PORTS_START( spc1000 ) PORT_START("LINE.7") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) @@ -361,7 +363,7 @@ static INPUT_PORTS_START( spc1000 ) PORT_START("LINE.8") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) diff --git a/src/mame/drivers/spc1500.cpp b/src/mame/drivers/spc1500.cpp index c6732deed1f..8fc2d1eefac 100644 --- a/src/mame/drivers/spc1500.cpp +++ b/src/mame/drivers/spc1500.cpp @@ -523,36 +523,29 @@ MC6845_RECONFIGURE(spc1500_state::crtc_reconfig) MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) { - uint8_t han2; - uint8_t *pf; + uint8_t const *pf; uint16_t hfnt; - int i; - int j; - int h1, h2, h3; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); unsigned char cho[] ={1,1,1,1,1,1,1,1,0,0,1,1,1,3,5,5,0,0,5,3,3,5,5,5,0,0,3,3,5,1}; unsigned char jong[]={0,0,0,1,1,1,1,1,0,0,1,1,1,2,2,2,0,0,2,2,2,2,2,2,0,0,2,2,1,1}; - bool inv = false; char hs = (m_crtc_vreg[0x9] < 15 ? 3 : 4); int n = y & (m_crtc_vreg[0x9]); bool ln400 = (hs == 4 && m_crtc_vreg[0x4] > 20); - uint8_t *vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13]; - for (i = 0; i < x_count; i++) + uint8_t const *const vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13]; + for (int i = 0; i < x_count; i++) { - uint8_t *pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)]; - uint8_t *pv = &vram[(y>>hs)*x_count + i]; + uint8_t const *const pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)]; + uint8_t const *const pv = &vram[(y>>hs)*x_count + i]; uint8_t ascii = *(pv+0x1000); uint8_t attr = *pv; - inv = (attr & 0x8 ? true : false); + bool inv = (attr & 0x8 ? true : false); uint8_t color = attr & 0x7; uint8_t pixelb = *(pp+0); uint8_t pixelr = *(pp+0x4000); uint8_t pixelg = *(pp+0x8000); bool nopalet = ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400); uint8_t pen = (nopalet ? color : m_paltbl[color]); - uint8_t pixelpen = 0; - uint8_t pixel = 0; if (hs == 4 && (ascii & 0x80)) { uint16_t wpixelb = (pixelb << 8) + (*(pp+1)); @@ -560,10 +553,10 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) uint16_t wpixelg = (pixelg << 8) + (*(pp+0x8001)); if (ascii != 0xfa) { - han2 = *(pv+0x1001); - h1 = (ascii>>2)&0x1f; - h2 = ((ascii<<3)|(han2>>5))&0x1f; - h3 = (han2)&0x1f; + uint8_t han2 = *(pv+0x1001); + int h1 = (ascii>>2)&0x1f; + int h2 = ((ascii<<3)|(han2>>5))&0x1f; + int h3 = (han2)&0x1f; pf = &m_font[0x2000+(h1 * 32) + (cho[h2] + (h3 != 0) -1) * 16 * 2 * 32 + n]; hfnt = (*pf << 8) | (*(pf+16)); pf = &m_font[0x4000+(h2 * 32) + (h3 == 0 ? 0 : 1) * 16 * 2 * 32 + n]; @@ -578,26 +571,26 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) hfnt = (*pf << 8) | (*(pf+16)); } hfnt = (inv ? 0xffff - hfnt : hfnt); - for (j = 0x8000; j > 0; j>>=1) + for (int j = 0x8000; j > 0; j>>=1) { - pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0)); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0)); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); *p++ = m_palette->pen(((hfnt & j) || (m_priority & (1<<pixel))) ? pixelpen : pen); } i++; } else if (attr & 0x20) { - uint8_t *pa = &m_pcgram[(ascii*(m_crtc_vreg[0x9]+1))+n]; + uint8_t const *pa = &m_pcgram[(ascii*(m_crtc_vreg[0x9]+1))+n]; uint8_t b = *pa; uint8_t r = *(pa+0x800); uint8_t g = *(pa+0x1000); - for (j = 0x80; j > 0; j>>=1) + for (int j = 0x80; j > 0; j>>=1) { - pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0); + uint8_t pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0); pen = (pixel == 7 ? color : pixel); pixel = (pixelg&j ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); *p++ = m_palette->pen((m_priority & (1<<pixel)) ? pixelpen : pen); } } @@ -609,10 +602,10 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) fnt = 0xff; } fnt = (inv ? 0xff - fnt : fnt); - for (j = 0x80; j > 0; j>>=1) + for (int j = 0x80; j > 0; j>>=1) { - pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); if (ascii == 0 && attr == 0 && !inv) *p++ = m_palette->pen(pixelpen); else diff --git a/src/mame/drivers/special.cpp b/src/mame/drivers/special.cpp index e01bb3f4b5e..f5cb7d7ef24 100644 --- a/src/mame/drivers/special.cpp +++ b/src/mame/drivers/special.cpp @@ -14,6 +14,7 @@ Notes: - Special, specialp, lik, erik: At the first prompt, press Enter for the Monitor. All other keys just beep. - Specimx: Press Enter to go into a ramdisk File Manager. Press F3 to load a tape (which errors). + If you had loaded a disk, press F6 to boot it. - Specimx -bios 1 and 2 don't set a colour, so a default has been chosen instead of a black screen. - Specimx -bios 1 lists a number of programs on the ramdisk, but most of them don't work. @@ -564,6 +565,7 @@ void special_state::specimx(machine_config &config) m_pit->out_handler<1>().set("custom", FUNC(specimx_sound_device::set_input_ch1)); m_pit->set_clk<2>(2000000); m_pit->out_handler<2>().set("custom", FUNC(specimx_sound_device::set_input_ch2)); + TIMER(config, m_pit_timer).configure_generic(FUNC(special_state::pit_timer)); m_ppi->in_pb_callback().set(FUNC(special_state::specimx_portb_r)); m_ppi->out_pc_callback().set(FUNC(special_state::specimx_portc_w)); diff --git a/src/mame/drivers/special_gambl.cpp b/src/mame/drivers/special_gambl.cpp index b04b71edb2f..f81628ffdd1 100644 --- a/src/mame/drivers/special_gambl.cpp +++ b/src/mame/drivers/special_gambl.cpp @@ -201,9 +201,9 @@ u32 dinaris_state::screen_update_dice(screen_device &screen, bitmap_ind16 &bitma u8 const color1 = m_vram[0x4000 + (y & 0xfe) + x * 256]; u8 const color2 = m_vram[0x4000 + (y | 0x01) + x * 256]; for (int b = 7; b >= 4; b--) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(code, b) ? (color1 & 0xf) : (color1 >> 4); + bitmap.pix(y, x * 8 + (7 - b)) = BIT(code, b) ? (color1 & 0xf) : (color1 >> 4); for (int b = 3; b >= 0; b--) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(code, b) ? (color2 & 0xf) : (color2 >> 4); + bitmap.pix(y, x * 8 + (7 - b)) = BIT(code, b) ? (color2 & 0xf) : (color2 >> 4); } } return 0; diff --git a/src/mame/drivers/speglsht.cpp b/src/mame/drivers/speglsht.cpp index 5ec410fe31a..03e67016e09 100644 --- a/src/mame/drivers/speglsht.cpp +++ b/src/mame/drivers/speglsht.cpp @@ -374,18 +374,16 @@ VIDEO_START_MEMBER(speglsht_state,speglsht) #define PLOT_PIXEL_RGB(x,y,r,g,b) if(y>=0 && x>=0 && x<512 && y<512) \ { \ - bitmap.pix32(y, x) = (b) | ((g)<<8) | ((r)<<16); \ + bitmap.pix(y, x) = (b) | ((g)<<8) | ((r)<<16); \ } uint32_t speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,dy; + int dy=(m_videoreg&0x20)?(256*512):0; //visible frame - dy=(m_videoreg&0x20)?(256*512):0; //visible frame - - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<512;x++) + for(int x=0;x<512;x++) { int tmp=dy+y*512+x; PLOT_PIXEL_RGB(x-67,y-5,(m_framebuffer[tmp]>>0)&0xff,(m_framebuffer[tmp]>>8)&0xff,(m_framebuffer[tmp]>>16)&0xff); @@ -397,10 +395,10 @@ uint32_t speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rg m_maincpu->draw_screen(screen, *m_bitmap, cliprect); //copy temporary bitmap to rgb 32 bit bitmap - for(y=cliprect.min_y; y<cliprect.max_y;y++) + for(int y=cliprect.min_y; y<cliprect.max_y;y++) { - uint16_t *srcline = &m_bitmap->pix16(y); - for(x=cliprect.min_x; x<cliprect.max_x;x++) + uint16_t const *const srcline = &m_bitmap->pix(y); + for(int x=cliprect.min_x; x<cliprect.max_x;x++) { if(srcline[x]) { diff --git a/src/mame/drivers/spg29x.cpp b/src/mame/drivers/spg29x.cpp index dc25021cc42..79144684df1 100644 --- a/src/mame/drivers/spg29x.cpp +++ b/src/mame/drivers/spg29x.cpp @@ -245,8 +245,8 @@ uint32_t spg29x_game_state::spg290_screen_update(screen_device &screen, bitmap_r for (int y=0; y <= cliprect.max_y; y++) for (int x=0; x <= cliprect.max_x; x++) { - auto pix = rgb_t(bitmap.pix32(y, x)); - bitmap.pix32(y, x) = rgb_t(pix.r() * fade_offset / 255, pix.g() * fade_offset / 255, pix.b() * fade_offset / 255); + rgb_t pix(bitmap.pix(y, x)); + bitmap.pix(y, x) = rgb_t(pix.r() * fade_offset / 255, pix.g() * fade_offset / 255, pix.b() * fade_offset / 255); } } diff --git a/src/mame/drivers/spg2xx.cpp b/src/mame/drivers/spg2xx.cpp index 81cd5c7bb21..4dea858b588 100644 --- a/src/mame/drivers/spg2xx.cpp +++ b/src/mame/drivers/spg2xx.cpp @@ -1039,13 +1039,13 @@ static INPUT_PORTS_START( hotwheels ) PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("P2") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CONFNAME( 0x0080, 0x0000, "Player 1 Controller Type" ) PORT_CONFSETTING( 0x0000, "Bling" ) PORT_CONFSETTING( 0x0080, "Rally" ) @@ -1059,7 +1059,7 @@ static INPUT_PORTS_START( hotwheels ) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("P3") // never read? @@ -1862,6 +1862,11 @@ ROM_START( vtechtvsgr ) ROM_LOAD16_WORD_SWAP( "vtechtvstation_gr.bin", 0x000000, 0x800000, CRC(879f1b12) SHA1(c14d52bead2c190130ce88cbdd4f5e93145f13f9) ) ROM_END +ROM_START( jouet ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_WORD_SWAP( "jouet.bin", 0x000000, 0x400000, CRC(da46097e) SHA1(f760f4d126a8291b7dacdea7a70691b25ad8b989) ) +ROM_END + ROM_START( senspeed ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) ROM_LOAD16_WORD_SWAP( "speedracer.bin", 0x000000, 0x800000, CRC(4efbcd39) SHA1(2edffbaa9ea309ad308fa60f32d8b7a98ee313c7) ) @@ -1989,6 +1994,9 @@ CONS( 2009, senwfit, 0, 0, gssytts, senwfit, spg2xx_game_senwfit_s CONS( 2006, vtechtvssp, 0, 0, spg2xx, spg2xx, spg2xx_game_state, empty_init, "VTech", "TV Station (VTech, Spain)", MACHINE_NOT_WORKING ) CONS( 2006, vtechtvsgr, 0, 0, spg2xx, spg2xx, spg2xx_game_state, empty_init, "VTech", "TV Learning Station (VTech, Germany)", MACHINE_NOT_WORKING ) +// ROM checksum fails, but is expecting 0 as a result? shows 'CopyRight' when booting normally? protection? +CONS( 200?, jouet, 0, 0, spg2xx, spg2xx, spg2xx_game_state, empty_init, "<unknown>", "10 Jeux Interactifs / Jeux Pour Filles (France)", MACHINE_NOT_WORKING ) + CONS( 2008, senspeed, 0, 0, senspeed, senspeed, spg2xx_game_senspeed_state, empty_init, "Senario", "Speed Racer (Senario)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) CONS( 200?, jjstrip, 0, 0, tvsprt10, jjstrip, spg2xx_game_state, empty_init, "Shiggles Inc.", "Club Jenna Presents: Jenna Jameson's Strip Poker", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/spg2xx_lexibook.cpp b/src/mame/drivers/spg2xx_lexibook.cpp index 0eb1c727daf..ce3db54d8fb 100644 --- a/src/mame/drivers/spg2xx_lexibook.cpp +++ b/src/mame/drivers/spg2xx_lexibook.cpp @@ -404,6 +404,13 @@ ROM_START( vgcaplet ) ROM_LOAD16_WORD_SWAP( "capletl.bin", 0x1000000, 0x0800000, CRC(1ae2fa49) SHA1(62f41d45da011c1dfb35c1111a478798c2b33aaf) ) ROM_END +ROM_START( vgcap35 ) + ROM_REGION( 0x2000000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_WORD_SWAP( "vgpocket.bin", 0x0000000, 0x1000000, CRC(b4dd781b) SHA1(b060c83c2f96a2b78f075d1c8143f654016ff0ec) ) + ROM_RELOAD(0x1000000,0x1000000) +ROM_END + + // these all have the same ROM scrambling CONS( 200?, lexizeus, 0, 0, lexizeus, lexizeus, spg2xx_lexizeus_game_state, init_zeus, "Lexibook", "Zeus IG900 20-in-1 (US?)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // bad sound and some corrupt bg tilemap entries in Tiger Rescue, verify ROM data (same game runs in Zone 60 without issue) @@ -412,10 +419,11 @@ CONS( 200?, vsplus, 0, 0, vsplus, vsplus, spg2xx_vsplus_game CONS( 200?, lexiseal, 0, 0, lexiseal, lexiseal, spg2xx_lexiseal_game_state, init_zeus, "Lexibook / Sit Up Limited", "Seal 50-in-1", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // also has bad sound in Tiger Rescue, but no corrupt tilemap -// there are versions of the Seal that actually show Lexibook on the boot screen rather than just the unit +// There are versions of the Seal 50-in-1 that actually show Lexibook on the boot screen rather than it just being on the unit. The Seal name was also used for some VT systems CONS( 200?, discpal, 0, 0, lexizeus, lexiseal, spg2xx_lexizeus_game_state, init_zeus, "Performance Designed Products / Disney / Jungle Soft", "Disney Game It! Classic Pals", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -// there was also a Game It! Princess Pals +// There was also a Game It! Princess Pals + +CONS( 2006, vgcaplet, 0, 0, lexiseal, lexiseal, spg2xx_lexiseal_game_state, init_zeus, "Performance Designed Products (licensed by Taito / Data East)", "VG Pocket Caplet Fast Acting 50-in-1", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -CONS( 200?, vgcaplet, 0, 0, lexiseal, lexiseal, spg2xx_lexiseal_game_state, init_zeus, "Performance Designed Products (licensed by Taito / Data East)", "VG Pocket Caplet Fast Acting 50-in-1", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -// there was also a 35 game version of the Caplet +CONS( 2006, vgcap35, 0, 0, lexiseal, lexiseal, spg2xx_lexiseal_game_state, init_zeus, "Performance Designed Products (licensed by Taito / Data East)", "VG Pocket Caplet Fast Acting 35-in-1", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/spg2xx_wiwi.cpp b/src/mame/drivers/spg2xx_wiwi.cpp index 9e1b900f377..0940fc0190c 100644 --- a/src/mame/drivers/spg2xx_wiwi.cpp +++ b/src/mame/drivers/spg2xx_wiwi.cpp @@ -6,10 +6,10 @@ The WiWi could also run NES games; SunPlus hardware was in the cartridge, it was a 'fake' system. - --- + --- - some of these are just checking a external timer on a port, I think this is one of the SPG features - so might need making more generic. + some of these are just checking a external timer on a port, I think this is one of the SPG features + so might need making more generic. */ @@ -90,9 +90,9 @@ public: protected: -// virtual uint16_t portb_r(); +// virtual uint16_t portb_r(); virtual void porta_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override; -// virtual void portb_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override; +// virtual void portb_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override; }; @@ -212,10 +212,10 @@ void spg2xx_game_ddmsup_state::ddmsup(machine_config &config) { spg2xx(config); -// m_maincpu->portb_in().set(FUNC(spg2xx_game_ddmsup_state::portb_r)); +// m_maincpu->portb_in().set(FUNC(spg2xx_game_ddmsup_state::portb_r)); m_maincpu->porta_in().set(FUNC(spg2xx_game_ddmsup_state::porta_r)); m_maincpu->porta_out().set(FUNC(spg2xx_game_ddmsup_state::porta_w)); -// m_maincpu->portb_out().set(FUNC(spg2xx_game_ddmsup_state::portb_w)); +// m_maincpu->portb_out().set(FUNC(spg2xx_game_ddmsup_state::portb_w)); } diff --git a/src/mame/drivers/spg2xx_zone_32bit.cpp b/src/mame/drivers/spg2xx_zone_32bit.cpp index 9d21deab6dc..e0c9feb17d4 100644 --- a/src/mame/drivers/spg2xx_zone_32bit.cpp +++ b/src/mame/drivers/spg2xx_zone_32bit.cpp @@ -651,10 +651,10 @@ INPUT_PORTS_END static INPUT_PORTS_START( mywicogt ) PORT_START("P1") - PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("P2") - PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("P3") PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Green / Left") @@ -666,7 +666,7 @@ static INPUT_PORTS_START( mywicogt ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start / Pause / Menu") PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Back") - PORT_BIT( 0xfe00, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0xfe00, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END diff --git a/src/mame/drivers/spiders.cpp b/src/mame/drivers/spiders.cpp index 2f77fc485fe..b1dd2729510 100644 --- a/src/mame/drivers/spiders.cpp +++ b/src/mame/drivers/spiders.cpp @@ -285,8 +285,6 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) for (uint8_t cx = 0; cx < x_count; cx++) { - uint8_t data1, data2, data3; - /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 3) & 0x3f00) | ((ra << 5) & 0x00e0) | @@ -295,9 +293,9 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) if (m_flipscreen) offs = offs ^ 0x3fff; - data1 = m_ram[0x0000 | offs]; - data2 = m_ram[0x4000 | offs]; - data3 = m_ram[0x8000 | offs]; + uint8_t data1 = m_ram[0x0000 | offs]; + uint8_t data2 = m_ram[0x4000 | offs]; + uint8_t data3 = m_ram[0x8000 | offs]; for (int i = 0; i < 8; i++) { @@ -309,9 +307,9 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) ((data2 & 0x80) >> 6) | ((data1 & 0x80) >> 7); - data1 = data1 << 1; - data2 = data2 << 1; - data3 = data3 << 1; + data1 <<= 1; + data2 <<= 1; + data3 <<= 1; } else { @@ -319,17 +317,17 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) ((data2 & 0x01) << 1) | ((data1 & 0x01) << 0); - data1 = data1 >> 1; - data2 = data2 >> 1; - data3 = data3 >> 1; + data1 >>= 1; + data2 >>= 1; + data3 >>= 1; } - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } - ma = ma + 1; + ma++; } } diff --git a/src/mame/drivers/spinb.cpp b/src/mame/drivers/spinb.cpp index f7235c7ecfb..bebb8c64b7c 100644 --- a/src/mame/drivers/spinb.cpp +++ b/src/mame/drivers/spinb.cpp @@ -599,7 +599,7 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 16; x++) { uint8_t const gfx = m_dmdram[ma+0x200]; @@ -622,7 +622,7 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 16; x++) { uint8_t const gfx = m_dmdram[ma++]; diff --git a/src/mame/drivers/splash_ms.cpp b/src/mame/drivers/splash_ms.cpp index ac4c1e33ba4..f16b9504ccb 100644 --- a/src/mame/drivers/splash_ms.cpp +++ b/src/mame/drivers/splash_ms.cpp @@ -184,11 +184,11 @@ uint32_t splashms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = 0; y < 256; y++) { - uint16_t* dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); for (int x = 0; x < 512; x++) { - uint8_t pix = m_bitmapram[(y * 512) + x]; + uint8_t const pix = m_bitmapram[(y * 512) + x]; //if (pix) dst[x] = pix + 0x100; } diff --git a/src/mame/drivers/srmp5.cpp b/src/mame/drivers/srmp5.cpp index 9ef4d397dfa..414d65e9829 100644 --- a/src/mame/drivers/srmp5.cpp +++ b/src/mame/drivers/srmp5.cpp @@ -137,7 +137,7 @@ private: uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,address,xs,xs2,ys,ys2,height,width,xw,yw,xb,yb,sizex,sizey; + int address,height,width,sizex,sizey; uint16_t *sprite_list=m_sprram.get(); uint16_t *sprite_list_end=&m_sprram[0x4000]; //guess uint8_t *pixels=(uint8_t *)m_tileram.get(); @@ -152,22 +152,22 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b { // 16x16 tile uint16_t *map = &sprram[0x2000]; - for(yw = 0; yw < tile_height; yw++) + for(int yw = 0; yw < tile_height; yw++) { - for(xw = 0; xw < tile_width; xw++) + for(int xw = 0; xw < tile_width; xw++) { uint16_t tile = map[yw * 128 + xw * 2]; if(tile >= 0x2000) continue; address = tile * SPRITE_DATA_GRANULARITY; - for(y = 0; y < 16; y++) + for(int y = 0; y < 16; y++) { - for(x = 0; x < 16; x++) + for(int x = 0; x < 16; x++) { uint8_t pen = pixels[BYTE_XOR_LE(address)]; if(pen) { - bitmap.pix32(yw * 16 + y, xw * 16 + x) = pens[pen]; + bitmap.pix(yw * 16 + y, xw * 16 + x) = pens[pen]; } address++; } @@ -191,8 +191,8 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b global_y=(int16_t)sprite_list[SPRITE_GLOBAL_Y]; while(sublist_length) { - x=(int16_t)sprite_sublist[SPRITE_LOCAL_X]+global_x; - y=(int16_t)sprite_sublist[SPRITE_LOCAL_Y]+global_y; + int x=(int16_t)sprite_sublist[SPRITE_LOCAL_X]+global_x; + int y=(int16_t)sprite_sublist[SPRITE_LOCAL_Y]+global_y; width =(sprite_sublist[SPRITE_SIZE]>> 4)&0xf; height=(sprite_sublist[SPRITE_SIZE]>>12)&0xf; @@ -201,24 +201,24 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b address=(sprite_sublist[SPRITE_TILE] & ~(sprite_sublist[SPRITE_SIZE] >> 11 & 7))*SPRITE_DATA_GRANULARITY; y -= (height + 1) * (sizey + 1)-1; - for(xw=0;xw<=width;xw++) + for(int xw=0;xw<=width;xw++) { - xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; - for(yw=0;yw<=height;yw++) + int xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; + for(int yw=0;yw<=height;yw++) { - yb = yw*(sizey+1)+y; - for(ys=0;ys<=sizey;ys++) + int yb = yw*(sizey+1)+y; + for(int ys=0;ys<=sizey;ys++) { - ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); - for(xs=0;xs<=sizex;xs++) + int ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); + for(int xs=0;xs<=sizex;xs++) { uint8_t pen=pixels[BYTE_XOR_LE(address)&(0x100000-1)]; - xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; + int xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; if(pen) { if(cliprect.contains(xb+xs2, yb+ys2)) { - bitmap.pix32(yb+ys2, xb+xs2) = pens[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; + bitmap.pix(yb+ys2, xb+xs2) = pens[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; } } ++address; @@ -235,8 +235,7 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b #ifdef DEBUG_CHAR { - int i; - for(i = 0; i < 0x2000; i++) + for(int i = 0; i < 0x2000; i++) { if (m_tileduty[i] == 1) { diff --git a/src/mame/drivers/ssem.cpp b/src/mame/drivers/ssem.cpp index 62b543c48cf..bb232317522 100644 --- a/src/mame/drivers/ssem.cpp +++ b/src/mame/drivers/ssem.cpp @@ -437,9 +437,8 @@ void ssem_state::glyph_print(bitmap_rgb32 &bitmap, int32_t x, int32_t y, Format int32_t line = 0; for(line = 0; line < 8; line++) { - uint32_t *d = &bitmap.pix32(y + line); - int32_t bit = 0; - for(bit = 0; bit < 8; bit++) + uint32_t *const d = &bitmap.pix(y + line); + for(uint32_t bit = 0; bit < 8; bit++) { if(char_glyphs[cur][line] & (1 << (7 - bit))) { diff --git a/src/mame/drivers/ssingles.cpp b/src/mame/drivers/ssingles.cpp index 8b1fd2918f9..8ad3cc7f007 100644 --- a/src/mame/drivers/ssingles.cpp +++ b/src/mame/drivers/ssingles.cpp @@ -218,20 +218,18 @@ static constexpr rgb_t ssingles_colors[NUM_PENS] = MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) { - uint32_t tile_address; - uint16_t cell, palette; - uint8_t b0, b1; - const uint8_t *gfx = memregion("gfx1")->base(); + uint8_t const *const gfx = memregion("gfx1")->base(); for (int cx = 0; cx < x_count; ++cx) { int address = ((ma >> 1) + (cx >> 1)) & 0xff; - cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); - tile_address = ((cell & 0x3ff) << 4) + ra; - palette = (cell >> 10) & 0x1c; + uint32_t tile_address = ((cell & 0x3ff) << 4) + ra; + uint16_t palette = (cell >> 10) & 0x1c; + uint8_t b0, b1; if (cx & 1) { b0 = gfx[tile_address + 0x0000]; /* 9.bin */ @@ -245,7 +243,7 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) for (int x = 7; x >= 0; --x) { - bitmap.pix32(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; + bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; b0 >>= 1; b1 >>= 1; } @@ -254,20 +252,18 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) { - uint32_t tile_address; - uint16_t cell, palette; - uint8_t b0, b1; const uint8_t *gfx = memregion("gfx1")->base(); for (int cx = 0; cx < x_count; ++cx) { int address = ((ma >> 1) + (cx >> 1)) & 0xff; - cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); - tile_address = ((cell & 0x1ff) << 4) + ra; - palette = (cell >> 10) & 0x1c; + uint32_t tile_address = ((cell & 0x1ff) << 4) + ra; + uint16_t palette = (cell >> 10) & 0x1c; + uint8_t b0, b1; if (cx & 1) { b0 = gfx[tile_address + 0x0000]; /* 9.bin */ @@ -281,7 +277,7 @@ MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) for (int x = 7; x >= 0; --x) { - bitmap.pix32(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; + bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; b0 >>= 1; b1 >>= 1; } diff --git a/src/mame/drivers/sstrangr.cpp b/src/mame/drivers/sstrangr.cpp index c83a1ed145c..ac633ef2d8b 100644 --- a/src/mame/drivers/sstrangr.cpp +++ b/src/mame/drivers/sstrangr.cpp @@ -403,17 +403,17 @@ uint32_t sstrangr_state::screen_update_sstrangr(screen_device &screen, bitmap_rg if (m_flip_screen) { pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - data = data << 1; + data <<= 1; } else { pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - data = data >> 1; + data >>= 1; } - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; + x++; } } @@ -441,17 +441,17 @@ uint32_t sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rg if (m_flip_screen) { color = (data & 0x80) ? fore_color : 0; - data = data << 1; + data <<= 1; } else { color = (data & 0x01) ? fore_color : 0; - data = data >> 1; + data >>= 1; } - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } } diff --git a/src/mame/drivers/startouch.cpp b/src/mame/drivers/startouch.cpp index cd6abb78981..5e8b0182518 100644 --- a/src/mame/drivers/startouch.cpp +++ b/src/mame/drivers/startouch.cpp @@ -2,16 +2,16 @@ // copyright-holders: /******************************************************************************* - Skeleton driver for "EuroByte Electronics & Multimedia IASA" PC-based touch - games, sold in Spain by Sleic / Petaco. - - -----+----------------------------+------+---------------------------------- - Dump | Game | Year | Notes - -----+----------------------------+------+---------------------------------- - NO | Superchip | 1999 | - NO | Star Touch | 2000 | - YES | Star Touch / EuroPlay 2001 | 2001 | Original Game: http://www.eurobyte.com.gr/gb_europlay.htm - + Skeleton driver for "EuroByte Electronics & Multimedia IASA" PC-based touch + games, sold in Spain by Sleic / Petaco. + + -----+----------------------------+------+---------------------------------- + Dump | Game | Year | Notes + -----+----------------------------+------+---------------------------------- + NO | Superchip | 1999 | + NO | Star Touch | 2000 | + YES | Star Touch / EuroPlay 2001 | 2001 | Original Game: http://www.eurobyte.com.gr/gb_europlay.htm + Hardware overview: MB Soyo M5EH or similar (e.g. Biostar M5ATD) 16384 KB RAM diff --git a/src/mame/drivers/studio2.cpp b/src/mame/drivers/studio2.cpp index 3365c1005a2..44278fe4780 100644 --- a/src/mame/drivers/studio2.cpp +++ b/src/mame/drivers/studio2.cpp @@ -518,7 +518,7 @@ void visicom_state::dma_w(offs_t offset, uint8_t data) for (int x = 0; x < 8; x++) { int color = (BIT(color1, 7) << 1) | BIT(color0, 7); - m_vdc->m_bitmap.pix32(y, sx + x) = VISICOM_PALETTE[color]; + m_vdc->m_bitmap.pix(y, sx + x) = VISICOM_PALETTE[color]; color0 <<= 1; color1 <<= 1; } diff --git a/src/mame/drivers/sun2.cpp b/src/mame/drivers/sun2.cpp index 8f43b4249dd..f6b895fd502 100644 --- a/src/mame/drivers/sun2.cpp +++ b/src/mame/drivers/sun2.cpp @@ -624,29 +624,26 @@ void sun2_state::mbustype3space_map(address_map &map) uint32_t sun2_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); if (!(m_bw2_ctrl & 0x8000)) return 0; - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/sun3.cpp b/src/mame/drivers/sun3.cpp index 01418f6ca10..5650ba652ed 100644 --- a/src/mame/drivers/sun3.cpp +++ b/src/mame/drivers/sun3.cpp @@ -283,8 +283,8 @@ private: uint8_t rtc7170_r(offs_t offset); void rtc7170_w(offs_t offset, uint8_t data); + template <unsigned W, unsigned H> uint32_t bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(sun3_timer); @@ -898,57 +898,27 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3_state::sun3_timer) } } +template <unsigned W, unsigned H> uint32_t sun3_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); - for (y = 0; y < 900; y++) + for (int y = 0; y < H; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < W/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; - } - } - return 0; -} - -uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - uint32_t *scanline; - int x, y; - uint8_t pixels; - static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); - - for (y = 0; y < 1100; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1600/8; x++) - { - pixels = m_vram[(y * (1600/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (W/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } return 0; @@ -956,27 +926,24 @@ uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t sun3_state::bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)]; + uint8_t const *const m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)]; - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } return 0; @@ -1013,7 +980,7 @@ void sun3_state::sun3(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(SCREEN(config, "bwtwo", SCREEN_TYPE_RASTER)); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1152, 900>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1152-1, 0, 900-1); bwtwo.set_refresh_hz(72); @@ -1079,7 +1046,7 @@ void sun3_state::sun3_60(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(*subdevice<screen_device>("bwtwo")); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1600-1, 0, 1100-1); bwtwo.set_refresh_hz(72); @@ -1102,7 +1069,7 @@ void sun3_state::sun3200(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(*subdevice<screen_device>("bwtwo")); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1600-1, 0, 1100-1); bwtwo.set_refresh_hz(72); diff --git a/src/mame/drivers/sun3x.cpp b/src/mame/drivers/sun3x.cpp index c79ca22c57f..08f9c6e9ef2 100644 --- a/src/mame/drivers/sun3x.cpp +++ b/src/mame/drivers/sun3x.cpp @@ -531,27 +531,24 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3x_state::sun380_timer) uint32_t sun3x_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/supertnk.cpp b/src/mame/drivers/supertnk.cpp index 32c3b059d65..8d7dbad2182 100644 --- a/src/mame/drivers/supertnk.cpp +++ b/src/mame/drivers/supertnk.cpp @@ -281,12 +281,8 @@ WRITE_LINE_MEMBER(supertnk_state::bitplane_select_1_w) uint32_t supertnk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; @@ -294,16 +290,16 @@ uint32_t supertnk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm uint8_t data1 = m_videoram[1][offs]; uint8_t data2 = m_videoram[2][offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { uint8_t color = ((data0 & 0x80) >> 5) | ((data1 & 0x80) >> 6) | ((data2 & 0x80) >> 7); - bitmap.pix32(y, x) = m_pens[color]; + bitmap.pix(y, x) = m_pens[color]; - data0 = data0 << 1; - data1 = data1 << 1; - data2 = data2 << 1; + data0 <<= 1; + data1 <<= 1; + data2 <<= 1; - x = x + 1; + x++; } } diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp index 3a75624bb61..d37796980ae 100644 --- a/src/mame/drivers/supracan.cpp +++ b/src/mame/drivers/supracan.cpp @@ -553,8 +553,8 @@ void supracan_state::draw_sprite_tile(bitmap_ind16 &dst, bitmap_ind8 &priomap, c for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint8_t *priop = &priomap.pix8(y, dstx); - uint16_t *dstp = &dst.pix16(y, dstx); + uint8_t *priop = &priomap.pix(y, dstx); + uint16_t *dstp = &dst.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { const uint32_t srcdata = *srcp; @@ -627,7 +627,7 @@ void supracan_state::draw_sprite_tile_mask(bitmap_ind8 &dst, const rectangle &cl for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint8_t *dstp = &dst.pix8(y, dstx); + uint8_t *dstp = &dst.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { if (*srcp) @@ -697,9 +697,9 @@ void supracan_state::draw_sprite_tile_masked(bitmap_ind16 &dst, bitmap_ind8 &mas for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint16_t *dstp = &dst.pix16(y, dstx); - uint8_t *priop = &priomap.pix8(y, dstx); - uint8_t *maskp = &mask.pix8(y, dstx); + uint16_t *dstp = &dst.pix(y, dstx); + uint8_t *priop = &priomap.pix(y, dstx); + uint8_t *maskp = &mask.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { const uint32_t srcdata = *srcp; @@ -838,8 +838,8 @@ void supracan_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &maskmap, bi uint32_t delta = (1 << 17) / xscale; for (int sy = 0; sy < ysize * 8; sy++) { - uint16_t *src = &sprite_bitmap->pix16(sy); - uint16_t *dst = &bitmap.pix16(y + sy); + uint16_t *src = &sprite_bitmap->pix(sy); + uint16_t *dst = &bitmap.pix(y + sy); uint32_t dx = x << 16; for (int sx = 0; sx < xsize * 8; sx++) { @@ -897,7 +897,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr uint32_t cy = starty; /* get dest and priority pointers */ - uint16_t *dest = &bitmap.pix16(sy, sx); + uint16_t *dest = &bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) @@ -909,7 +909,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr { int scroll = 0; // scrollram[(cx>>16)&0x3ff]); - uint16_t data = &srcbitmap.pix16(((cy >> 16) - scroll) & ymask, (cx >> 16) & xmask)[0]; + uint16_t data = &srcbitmap.pix(((cy >> 16) - scroll) & ymask, (cx >> 16) & xmask)[0]; if ((data & transmask) != 0) dest[0] = data; @@ -918,7 +918,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr #endif { int scroll = 0;//scrollram[(cy>>16)&0x3ff]); - uint16_t data = srcbitmap.pix16((cy >> 16) & ymask, ((cx >> 16) - scroll) & xmask); + uint16_t data = srcbitmap.pix((cy >> 16) & ymask, ((cx >> 16) - scroll) & xmask); if ((data & transmask) != 0) *dest = data; @@ -1059,8 +1059,8 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - // these will have to change to pix32 etc. once alpha blending is supported - uint16_t* screen = &bitmap.pix16(y); + // these will have to change to uint32_t* etc. once alpha blending is supported + uint16_t* screen = &bitmap.pix(y); int actualy = y & mosaic_mask; int realy = actualy + scrolly; @@ -1069,8 +1069,8 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (scrolly + y < 0 || scrolly + y > ((ysize * 8) - 1)) continue; - uint16_t* src = &src_bitmap.pix16(realy & ((ysize * 8) - 1)); - uint8_t* priop = &m_prio_bitmap.pix8(y); + uint16_t* src = &src_bitmap.pix(realy & ((ysize * 8) - 1)); + uint8_t* priop = &m_prio_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { @@ -1163,9 +1163,9 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t* dstp = &bitmap.pix16(y); - uint8_t* priop = &m_prio_bitmap.pix8(y); - uint16_t* spritep = &m_sprite_final_bitmap.pix16(y); + uint16_t* dstp = &bitmap.pix(y); + uint8_t* priop = &m_prio_bitmap.pix(y); + uint16_t* spritep = &m_sprite_final_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/suprgolf.cpp b/src/mame/drivers/suprgolf.cpp index 41cabcb5380..3b39c581fd9 100644 --- a/src/mame/drivers/suprgolf.cpp +++ b/src/mame/drivers/suprgolf.cpp @@ -135,40 +135,36 @@ void suprgolf_state::video_start() uint32_t suprgolf_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,count,color; + int count; bitmap.fill(m_palette->black_pen(), cliprect); - { - count = 0; + count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) + { + for(int x=0;x<512;x++) { - for(x=0;x<512;x++) - { - color = m_bg_fb[count]; + int const color = m_bg_fb[count]; - if(x <= cliprect.max_x && y <= cliprect.max_y) - bitmap.pix16(y, x) = m_palette->pen((color & 0x7ff)); + if(x <= cliprect.max_x && y <= cliprect.max_y) + bitmap.pix(y, x) = m_palette->pen((color & 0x7ff)); - count++; - } + count++; } } - { - count = 0; + count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) + { + for(int x=0;x<512;x++) { - for(x=0;x<512;x++) - { - color = m_fg_fb[count]; + int const color = m_fg_fb[count]; - if(((m_fg_fb[count] & 0x0f) != 0x0f) && (x <= cliprect.max_x && y <= cliprect.max_y)) - bitmap.pix16(y, x) = m_palette->pen((color & 0x7ff)); + if(((m_fg_fb[count] & 0x0f) != 0x0f) && (x <= cliprect.max_x && y <= cliprect.max_y)) + bitmap.pix(y, x) = m_palette->pen((color & 0x7ff)); - count++; - } + count++; } } diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp index 6f852db02ab..41aebc4abee 100644 --- a/src/mame/drivers/svision.cpp +++ b/src/mame/drivers/svision.cpp @@ -362,7 +362,7 @@ uint32_t svision_state::screen_update_svision(screen_device &screen, bitmap_ind1 { const int start_x = 3 - (m_reg[XPOS] & 3); const int end_x = std::min(163, m_reg[XSIZE] | 3); - uint16_t *line = &bitmap.pix16(y, start_x); + uint16_t *line = &bitmap.pix(y, start_x); for (int x = start_x, i = 0; x < end_x; x+=4, i++) { uint8_t b = m_videoram[j+i]; @@ -394,7 +394,7 @@ uint32_t svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 { const int start_x = 3 - (m_reg[XPOS] & 3); const int end_x = std::min(163, m_reg[XSIZE] | 3); - uint32_t *line = &bitmap.pix32(y, start_x); + uint32_t *line = &bitmap.pix(y, start_x); for (int x = start_x, i = 0; x < end_x; x += 4, i++) { uint8_t b = m_videoram[j + i]; diff --git a/src/mame/drivers/swyft.cpp b/src/mame/drivers/swyft.cpp index 5030904123d..a4d20d070d4 100644 --- a/src/mame/drivers/swyft.cpp +++ b/src/mame/drivers/swyft.cpp @@ -599,19 +599,16 @@ void swyft_state::video_start() uint32_t swyft_state::screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t code; - int y, x, b; - int addr = 0; - for (y = 0; y < 242; y++) + for (int y = 0; y < 242; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - code = m_p_swyft_videoram[addr++]; - for (b = 7; b >= 0; b--) + uint16_t code = m_p_swyft_videoram[addr++]; + for (int b = 7; b >= 0; b--) { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + bitmap.pix(y, horpos++) = (code >> b) & 0x01; } } } diff --git a/src/mame/drivers/sys9002.cpp b/src/mame/drivers/sys9002.cpp index 37bf2d7abfa..3e113c90f59 100644 --- a/src/mame/drivers/sys9002.cpp +++ b/src/mame/drivers/sys9002.cpp @@ -91,18 +91,16 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( sys9002_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem] & 0x7f; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_vram[mem] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7)]; diff --git a/src/mame/drivers/systel1.cpp b/src/mame/drivers/systel1.cpp index 98bd3af70bc..b02d503ea1c 100644 --- a/src/mame/drivers/systel1.cpp +++ b/src/mame/drivers/systel1.cpp @@ -108,7 +108,7 @@ I8275_DRAW_CHARACTER_MEMBER(systel1_state::draw_character) for (int i = 0; i < 7; i++) { - bitmap.pix32(y, x + i) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x + i) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/taitotz.cpp b/src/mame/drivers/taitotz.cpp index 84840c89d54..431db2869a2 100644 --- a/src/mame/drivers/taitotz.cpp +++ b/src/mame/drivers/taitotz.cpp @@ -845,12 +845,12 @@ static inline uint32_t generate_texel_address(int iu, int iv) void taitotz_renderer::draw_scanline_noz(int32_t scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); float u = extent.param[POLY_U].start; float v = extent.param[POLY_V].start; - float du = extent.param[POLY_U].dpdx; - float dv = extent.param[POLY_V].dpdx; + float const du = extent.param[POLY_U].dpdx; + float const dv = extent.param[POLY_V].dpdx; uint32_t *texram = &m_texture[extradata.texture * 0x1000]; @@ -879,24 +879,24 @@ void taitotz_renderer::draw_scanline_noz(int32_t scanline, const extent_t &exten void taitotz_renderer::draw_scanline(int32_t scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); float ooz = extent.param[POLY_Z].start; float uoz = extent.param[POLY_U].start; float voz = extent.param[POLY_V].start; - float dooz = extent.param[POLY_Z].dpdx; - float duoz = extent.param[POLY_U].dpdx; - float dvoz = extent.param[POLY_V].dpdx; + const float dooz = extent.param[POLY_Z].dpdx; + const float duoz = extent.param[POLY_U].dpdx; + const float dvoz = extent.param[POLY_V].dpdx; float nx= extent.param[POLY_NX].start; float dnx = extent.param[POLY_NX].dpdx; float ny = extent.param[POLY_NY].start; - float dny = extent.param[POLY_NY].dpdx; + const float dny = extent.param[POLY_NY].dpdx; float nz = extent.param[POLY_NZ].start; - float dnz = extent.param[POLY_NZ].dpdx; + const float dnz = extent.param[POLY_NZ].dpdx; - uint32_t *texram = &m_texture[extradata.texture * 0x1000]; + uint32_t *const texram = &m_texture[extradata.texture * 0x1000]; uint32_t alpha = extradata.alpha & 0x1f; uint32_t alpha_enable = extradata.alpha & 0x80; @@ -1435,11 +1435,11 @@ uint32_t taitotz_state::screen_update_taitotz(screen_device &screen, bitmap_rgb3 { m_renderer->draw(bitmap, cliprect); - uint16_t *screen_src = (uint16_t*)&m_screen_ram[m_scr_base]; + uint16_t const *screen_src = (uint16_t*)&m_screen_ram[m_scr_base]; for (int j=0; j < 384; j++) { - uint32_t *fb = &bitmap.pix32(j); + uint32_t *const fb = &bitmap.pix(j); for (int i=0; i < 512; i++) { uint16_t p = *screen_src++; diff --git a/src/mame/drivers/taitowlf.cpp b/src/mame/drivers/taitowlf.cpp index dc57211b3d3..74d86eefeb7 100644 --- a/src/mame/drivers/taitowlf.cpp +++ b/src/mame/drivers/taitowlf.cpp @@ -113,22 +113,18 @@ private: #if !TAITOWLF_ENABLE_VGA uint32_t taitowlf_state::screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - bitmap.fill(m_palette->black_pen(), cliprect); - count = (0); + int count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<512;x++) + for(int x=0;x<512;x++) { - uint32_t color; - - color = (m_bootscreen_rom[count] & 0xff); + uint32_t color = m_bootscreen_rom[count] & 0xff; if(cliprect.contains(x+0, y)) - bitmap.pix32(y, x+0) = m_palette->pen(color); + bitmap.pix(y, x+0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/tamag1.cpp b/src/mame/drivers/tamag1.cpp index 649a6ca54cc..a0f77f5df63 100644 --- a/src/mame/drivers/tamag1.cpp +++ b/src/mame/drivers/tamag1.cpp @@ -69,7 +69,7 @@ E0C6S46_PIXEL_UPDATE(tamag1_state::pixel_update) int y = com, x = seg2x[seg]; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = state; + bitmap.pix(y, x) = state; // 2 rows of indicators: // above screen: 0:meal, 1:lamp, 2:play, 3:medicine diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp index 69b7ba9e13a..6785eb42d67 100644 --- a/src/mame/drivers/tandy2k.cpp +++ b/src/mame/drivers/tandy2k.cpp @@ -157,10 +157,7 @@ void tandy2k_state::enable_w(uint8_t data) m_pit->write_gate2(BIT(data, 4)); // FDC reset - if (!BIT(data, 5)) - { - m_fdc->soft_reset(); - } + m_fdc->reset_w(!BIT(data, 5)); // timer 0 enable m_maincpu->tmrin0_w(BIT(data, 6)); @@ -502,7 +499,7 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 0; x < 8; x++) { int color = BIT(a, x) | (BIT(b, x) << 1) | (BIT(c, x) << 2); - bitmap.pix32(y, (sx * 8) + (7 - x)) = cpen[color]; + bitmap.pix(y, (sx * 8) + (7 - x)) = cpen[color]; } } else @@ -517,7 +514,7 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 0; x < 8; x++) { int color = 4 | (BIT(attr, 6) << 1) | BIT(data, 7); - bitmap.pix32(y, (sx * 8) + x) = cpen[color]; + bitmap.pix(y, (sx * 8) + x) = cpen[color]; data <<= 1; } } @@ -624,7 +621,7 @@ CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character ) { int color = BIT(video, 7 - i); - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } } diff --git a/src/mame/drivers/tapatune.cpp b/src/mame/drivers/tapatune.cpp index e98f02f8b83..7ce930e02eb 100644 --- a/src/mame/drivers/tapatune.cpp +++ b/src/mame/drivers/tapatune.cpp @@ -180,10 +180,10 @@ MC6845_BEGIN_UPDATE( tapatune_state::crtc_begin_update ) MC6845_UPDATE_ROW( tapatune_state::crtc_update_row ) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); offs_t offs = (ma*2 + ra*0x40)*4; - uint8_t *videoram = reinterpret_cast<uint8_t *>(m_videoram.target()); + uint8_t const *const videoram = reinterpret_cast<uint8_t *>(m_videoram.target()); for (uint32_t x = 0; x < x_count*4; x++) { diff --git a/src/mame/drivers/tasc.cpp b/src/mame/drivers/tasc.cpp index 7a6d2efa96f..097be9d0600 100644 --- a/src/mame/drivers/tasc.cpp +++ b/src/mame/drivers/tasc.cpp @@ -239,7 +239,7 @@ void tasc_state::tasc(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - static const int16_t speaker_levels[4] = { 0, 32767, -32768, 0 }; + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 }; SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.75); m_speaker->set_levels(4, speaker_levels); } diff --git a/src/mame/drivers/tattack.cpp b/src/mame/drivers/tattack.cpp index 5d1b56b7910..8f419a20d2c 100644 --- a/src/mame/drivers/tattack.cpp +++ b/src/mame/drivers/tattack.cpp @@ -144,13 +144,11 @@ void tattack_state::draw_edge_bitmap(bitmap_ind16 &bitmap, const rectangle &clip void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t ram_offs; const uint16_t ram_base = 0x40+(m_ram[0x33] & 0x10); const int x_base = -8; - int xi,yi; // draw brick pattern - for(ram_offs=ram_base;ram_offs<ram_base+0xe;ram_offs++) + for(uint16_t ram_offs=ram_base;ram_offs<ram_base+0xe;ram_offs++) { uint8_t cur_column = m_ram[ram_offs]; @@ -174,15 +172,15 @@ void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle & if(draw_block == true) { - for(xi=0;xi<3;xi++) + for(int xi=0;xi<3;xi++) { - for(yi=0;yi<15;yi++) + for(int yi=0;yi<15;yi++) { int resx = bit*4+xi+160+x_base; int resy = (ram_offs & 0xf)*16+yi+16; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_bricks_color_bank == true ? red_pen : (bit & 4 ? yellow_pen : green_pen); + bitmap.pix(resy, resx) = m_bricks_color_bank == true ? red_pen : (bit & 4 ? yellow_pen : green_pen); } } } @@ -192,25 +190,25 @@ void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle & // draw paddle if(m_bottom_edge_enable == false) { - for(xi=0;xi<4;xi++) - for(yi=0;yi<m_paddle_ysize;yi++) + for(int xi=0;xi<4;xi++) + for(int yi=0;yi<m_paddle_ysize;yi++) { int resx =(paddle_xpos+xi); int resy = m_paddle_reg+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = white_pen; + bitmap.pix(resy, resx) = white_pen; } } // draw ball - for(xi=0;xi<3;xi++) - for(yi=0;yi<3;yi++) + for(int xi=0;xi<3;xi++) + for(int yi=0;yi<3;yi++) { int resx = m_ball_regs[0]+xi-2+x_base; int resy = m_ball_regs[1]+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = (white_pen); + bitmap.pix(resy, resx) = (white_pen); } } diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp index 0293cc0ad34..21748861b5c 100644 --- a/src/mame/drivers/tavernie.cpp +++ b/src/mame/drivers/tavernie.cpp @@ -255,19 +255,17 @@ void ivg09_state::ds_w(u8 data) // Attributes when high: 0 = alpha rom; 1 = flash; 2 = reverse video; 3 = highlight off MC6845_UPDATE_ROW( ivg09_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 gfx,attr; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); m_flashcnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0xfff; - attr = m_vram[mem] >> 8; - u8 inv = ((x == cursor_x) ^ (BIT(attr, 2)) ^ (BIT(attr, 1) && BIT(m_flashcnt, 6))) ? 0xff : 0; - gfx = m_p_chargen[((m_vram[mem] & 0x1ff)<<4) | ra] ^ inv; // takes care of attr bit 0 too - u8 pen = BIT(attr, 3) ? 1 : 2; + u16 const mem = (ma + x) & 0xfff; + u8 const attr = m_vram[mem] >> 8; + u8 const inv = ((x == cursor_x) ^ (BIT(attr, 2)) ^ (BIT(attr, 1) && BIT(m_flashcnt, 6))) ? 0xff : 0; + u8 const gfx = m_p_chargen[((m_vram[mem] & 0x1ff)<<4) | ra] ^ inv; // takes care of attr bit 0 too + u8 const pen = BIT(attr, 3) ? 1 : 2; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7) ? pen : 0]; diff --git a/src/mame/drivers/tek440x.cpp b/src/mame/drivers/tek440x.cpp index 1dac2008b89..e04123889ee 100644 --- a/src/mame/drivers/tek440x.cpp +++ b/src/mame/drivers/tek440x.cpp @@ -131,22 +131,17 @@ void tek440x_state::machine_reset() u32 tek440x_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const u16 *video_ram; - u16 word; - u16 *line; - int y, x, b; - - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - line = &bitmap.pix16(y); - video_ram = &m_vram[y * 64]; + u16 *const line = &bitmap.pix(y); + u16 const *video_ram = &m_vram[y * 64]; - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + u16 const word = *(video_ram++); + for (int b = 0; b < 16; b++) { - line[x + b] = (word >> (15 - b)) & 0x0001; + line[x + b] = BIT(word, 15 - b); } } } diff --git a/src/mame/drivers/teleray10.cpp b/src/mame/drivers/teleray10.cpp index e603a734327..2aa362e4dec 100644 --- a/src/mame/drivers/teleray10.cpp +++ b/src/mame/drivers/teleray10.cpp @@ -158,7 +158,7 @@ u32 teleray10_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (unsigned scan = 0; scan < 12; scan++) { - u32 *px = &bitmap.pix32(y * 12 + scan); + u32 *px = &bitmap.pix(y * 12 + scan); for (unsigned x = 0; x < 80; x++) { u8 ch = m_displayram[offset + x]; diff --git a/src/mame/drivers/terak.cpp b/src/mame/drivers/terak.cpp index d2b7d53141c..42d55a04860 100644 --- a/src/mame/drivers/terak.cpp +++ b/src/mame/drivers/terak.cpp @@ -12,6 +12,7 @@ Floppies were 8 inch IBM format. ****************************************************************************/ #include "emu.h" +//#include "bus/qbus/qbus.h" #include "cpu/t11/t11.h" #include "emupal.h" #include "screen.h" @@ -105,7 +106,7 @@ uint32_t terak_state::screen_update_terak(screen_device &screen, bitmap_ind16 &b void terak_state::terak(machine_config &config) { /* basic machine hardware */ - T11(config, m_maincpu, XTAL(4'000'000)); + T11(config, m_maincpu, 4'000'000); // FIXME: actually LSI-11 m_maincpu->set_initial_mode(6 << 13); m_maincpu->set_addrmap(AS_PROGRAM, &terak_state::mem_map); diff --git a/src/mame/drivers/tgtpanic.cpp b/src/mame/drivers/tgtpanic.cpp index 1077dbb4251..8e7598b7796 100644 --- a/src/mame/drivers/tgtpanic.cpp +++ b/src/mame/drivers/tgtpanic.cpp @@ -59,33 +59,31 @@ void tgtpanic_state::machine_start() uint32_t tgtpanic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { uint32_t colors[4]; - uint32_t offs; - uint32_t x, y; colors[0] = 0; colors[1] = 0xffffffff; colors[2] = rgb_t(pal1bit(m_color >> 2), pal1bit(m_color >> 1), pal1bit(m_color >> 0)); colors[3] = rgb_t(pal1bit(m_color >> 6), pal1bit(m_color >> 5), pal1bit(m_color >> 4)); - for (offs = 0; offs < 0x2000; ++offs) + for (uint32_t offs = 0; offs < 0x2000; ++offs) { uint8_t val = m_ram[offs]; - y = (offs & 0x7f) << 1; - x = (offs >> 7) << 2; + uint32_t const y = (offs & 0x7f) << 1; + uint32_t const x = (offs >> 7) << 2; /* I'm guessing the hardware doubles lines */ - bitmap.pix32(y + 0, x + 0) = colors[val & 3]; - bitmap.pix32(y + 1, x + 0) = colors[val & 3]; + bitmap.pix(y + 0, x + 0) = colors[val & 3]; + bitmap.pix(y + 1, x + 0) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 1) = colors[val & 3]; - bitmap.pix32(y + 1, x + 1) = colors[val & 3]; + bitmap.pix(y + 0, x + 1) = colors[val & 3]; + bitmap.pix(y + 1, x + 1) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 2) = colors[val & 3]; - bitmap.pix32(y + 1, x + 2) = colors[val & 3]; + bitmap.pix(y + 0, x + 2) = colors[val & 3]; + bitmap.pix(y + 1, x + 2) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 3) = colors[val & 3]; - bitmap.pix32(y + 1, x + 3) = colors[val & 3]; + bitmap.pix(y + 0, x + 3) = colors[val & 3]; + bitmap.pix(y + 1, x + 3) = colors[val & 3]; } return 0; diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index ed51e4dffce..d473b040492 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -201,7 +201,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti74_pixel_update) { // internal: 2*16, external: 1*31 if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; } } @@ -220,7 +220,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) { // 1st line is simply 16 chars if (y == 7) y++; // the cursor is slightly below the char - bitmap.pix16(10 + y, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(10 + y, 1 + pos*6 + x) = state ? 1 : 2; } else if (line == 1 && pos < 15 && y < 7) { @@ -228,7 +228,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) // note: the chars are smaller than on the 1st line (this is handled in .lay file) const int gap = 9; int group = pos / 3; - bitmap.pix16(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/ti85.cpp b/src/mame/drivers/ti85.cpp index 8311d630149..871cbc42877 100644 --- a/src/mame/drivers/ti85.cpp +++ b/src/mame/drivers/ti85.cpp @@ -2,7 +2,7 @@ // copyright-holders:Krzysztof Strzecha,Jon Sturm /*************************************************************************** TI-85 and TI-86 drivers by Krzysztof Strzecha -TI-83 Plus, TI-84 Plus, and Siliver Edition support by Jon Sturm +TI-83 Plus, TI-84 Plus, and Silver Edition support by Jon Sturm Notes: 1. After start TI-85 waits for ON key interrupt, so press ON key to start diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp index 700e3b978f1..b7815de0f74 100644 --- a/src/mame/drivers/ti89.cpp +++ b/src/mame/drivers/ti89.cpp @@ -498,19 +498,18 @@ void ti68k_state::machine_reset() uint32_t ti68k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* preliminary implementation, doesn't use the contrast value */ - uint8_t width = screen.width(); - uint8_t height = screen.height(); - uint8_t x, y, b; + uint8_t const width = screen.width(); + uint8_t const height = screen.height(); if (!m_lcd_on || !m_lcd_base) bitmap.fill(0); else - for (y = 0; y < height; y++) - for (x = 0; x < width / 8; x++) + for (uint8_t y = 0; y < height; y++) + for (uint8_t x = 0; x < width / 8; x++) { uint8_t s_byte= m_maincpu->space(AS_PROGRAM).read_byte(m_lcd_base + y * (width/8) + x); - for (b = 0; b<8; b++) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(s_byte, b); + for (uint8_t b = 0; b<8; b++) + bitmap.pix(y, x * 8 + (7 - b)) = BIT(s_byte, b); } return 0; diff --git a/src/mame/drivers/ti931.cpp b/src/mame/drivers/ti931.cpp index 3531bf7ea13..aabcfe9839e 100644 --- a/src/mame/drivers/ti931.cpp +++ b/src/mame/drivers/ti931.cpp @@ -52,10 +52,10 @@ SCN2672_DRAW_CHARACTER_MEMBER(ti931_state::draw_character) { if (!half_shift) dots <<= 1; - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); if (half_shift) dots <<= 1; - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); } } diff --git a/src/mame/drivers/ti99_4x.cpp b/src/mame/drivers/ti99_4x.cpp index 1a432d6542c..a6585142307 100644 --- a/src/mame/drivers/ti99_4x.cpp +++ b/src/mame/drivers/ti99_4x.cpp @@ -283,7 +283,7 @@ static INPUT_PORTS_START(ti99_4) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O +") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('+') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K /") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('/') - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", .") PORT_CODE(KEYCODE_STOP) PORT_CHAR(',') PORT_CHAR('.') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", .") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(',') PORT_START("COL2") // col 2 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp index 2484f6d622c..1e0ed7c1c9c 100644 --- a/src/mame/drivers/ti99_8.cpp +++ b/src/mame/drivers/ti99_8.cpp @@ -5,7 +5,7 @@ The MESS TI-99/8 emulation driver The TI-99/8 was the envisaged successor to the TI-99/4A but never passed - its prototype state. Only a few dozens of consoles were built. The ROMs + its prototype state. Only a few dozen consoles were built. The ROMs were not even finalized, so the few available consoles have different operating system versions and capabilities. @@ -15,7 +15,7 @@ Name: "Texas Instruments Computer TI-99/8" (no "Home") - Inofficial nickname: "Armadillo" + Unofficial nickname: "Armadillo" CPU: Single-CPU system using a TMS9995, but as a variant named MP9537. This variant does not offer on-chip RAM or decrementer. @@ -81,7 +81,7 @@ Modes: - Compatibility mode (TI-99/4A mode): Memory-mapped devices are placed at the same location as found in the TI-99/4A, thereby - providing a good downward compatibility. + providing good downward compatibility. The console starts up in compatibility mode. - Native mode (Armadillo mode): Devices are located at positions above 0xF000 that allow for a contiguous usage of memory. @@ -94,7 +94,7 @@ From the 32 bits, 24 bits define the physical address, so this allows for a maximum of 16 MiB of mapped-addressable memory. - See more about the mapper in the file mapper8.c. + See more about the mapper in the file 998board.cpp Availability of ROMs and documentation diff --git a/src/mame/drivers/tickee.cpp b/src/mame/drivers/tickee.cpp index 076043c17f6..a0ca3cf7f1e 100644 --- a/src/mame/drivers/tickee.cpp +++ b/src/mame/drivers/tickee.cpp @@ -220,21 +220,20 @@ VIDEO_START_MEMBER(tickee_state,tickee) TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::scanline_update) { - uint16_t *src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; /* blank palette: fill with pen 255 */ if (m_control[2]) { - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = pens[0xff]; } else /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = src[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; @@ -245,16 +244,15 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::scanline_update) TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::rapidfir_scanline_update) { - uint16_t *src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); const pen_t *pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; if (m_palette_bank) { /* blank palette: fill with pen 255 */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { dest[x + 0] = pens[0xff]; dest[x + 1] = pens[0xff]; @@ -263,7 +261,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::rapidfir_scanline_update) else { /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = src[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/tiki100.cpp b/src/mame/drivers/tiki100.cpp index c9dce4cdd35..3c1b19f2f1a 100644 --- a/src/mame/drivers/tiki100.cpp +++ b/src/mame/drivers/tiki100.cpp @@ -493,13 +493,13 @@ uint32_t tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // // - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (int vaddr = cliprect.min_y; vaddr <= cliprect.max_y; vaddr++) { // This is at the start of a line int haddr = (cliprect.min_x>>4); - int haddr_end = (cliprect.max_x>>4); + int const haddr_end = (cliprect.max_x>>4); for (; haddr <= haddr_end; haddr++) { // This is at the start of a 16-dot cluster. Changes in m_scroll and m_video_ram come into effect here. @@ -521,7 +521,7 @@ uint32_t tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // m_current_pixel = data&0x0F; } - bitmap.pix32(vaddr, (haddr<<4) + dot) = palette[m_current_pixel&0x0F]; + bitmap.pix(vaddr, (haddr<<4) + dot) = palette[m_current_pixel&0x0F]; // This will run the dot-shifter and add the TEST-pattern to the upper bits (usually hidden by palette). data = (data>>1)|((haddr&0x02)<<14); diff --git a/src/mame/drivers/tim100.cpp b/src/mame/drivers/tim100.cpp index 2c8a8f7997c..447708f15a9 100644 --- a/src/mame/drivers/tim100.cpp +++ b/src/mame/drivers/tim100.cpp @@ -118,11 +118,10 @@ GFXDECODE_END I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t pixels; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (uint8_t i = 0; i < 2; i++) { - pixels = m_charmap[(i * 0x1000) | (linecount & 15) | (charcode << 4)]; + uint8_t pixels = m_charmap[(i * 0x1000) | (linecount & 15) | (charcode << 4)]; if (vsp) pixels = 0; @@ -132,12 +131,12 @@ I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - bitmap.pix32(y, x++) = palette[BIT(pixels, 7) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 6) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 5) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 4) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 3) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 2) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 7) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 6) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 5) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 4) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 3) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 2) ? (hlgt ? 2 : 1) : 0]; } } diff --git a/src/mame/drivers/tk635.cpp b/src/mame/drivers/tk635.cpp index e57e27e870d..3b27c8907c5 100644 --- a/src/mame/drivers/tk635.cpp +++ b/src/mame/drivers/tk635.cpp @@ -122,10 +122,10 @@ uint32_t tk635_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // 8 pixels of the character for (int p = 0; p < 8; p++) - bitmap.pix32(y * 16 + i, x * 9 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 16 + i, x * 9 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); // 9th pixel empty - bitmap.pix32(y * 16 + i, x * 9 + 8) = rgb_t::black(); + bitmap.pix(y * 16 + i, x * 9 + 8) = rgb_t::black(); } } } diff --git a/src/mame/drivers/tmaster.cpp b/src/mame/drivers/tmaster.cpp index 7e4445a9e98..a44aed2b974 100644 --- a/src/mame/drivers/tmaster.cpp +++ b/src/mame/drivers/tmaster.cpp @@ -558,8 +558,8 @@ ROM_END ROM_START( tm2kspeval ) /* NOT FOR RELEASE / FOR EVALUATION - still requires credits - Defaults to Spanish but English can be selected */ ROM_REGION( 0x200000, "maincpu", 0 ) // 68000 Code - ROM_LOAD16_BYTE( "touch_master_2000_spain_451_4.xx3.u51", 0x000000, 0x080000, CRC(ba51f4dd) SHA1(bcdf6acbe6546a562e74178d4f9cdb0e167baee2) ) /* Ver: 4.XX3 Spanish 6-26-97 - Evaluation Only (yes, it's actually 451 and not U51) */ - ROM_LOAD16_BYTE( "touch_master_2000_spain_452_4.xx3.u52", 0x000001, 0x080000, CRC(6ca86264) SHA1(2fb04b8d4bd0a51653ca80e1af7fedab5aebb9dd) ) /* Ver: 4.XX3 Spanish 6-26-97 - Evaluation Only (yes, it's actually 452 and not U52) */ + ROM_LOAD16_BYTE( "touch_master_2000_span_451_4.xx3.u51", 0x000000, 0x080000, CRC(ba51f4dd) SHA1(bcdf6acbe6546a562e74178d4f9cdb0e167baee2) ) /* Ver: 4.XX3 Spanish 6-26-97 - Evaluation Only (yes, it's actually 451 and not U51) */ + ROM_LOAD16_BYTE( "touch_master_2000_span_452_4.xx3.u52", 0x000001, 0x080000, CRC(6ca86264) SHA1(2fb04b8d4bd0a51653ca80e1af7fedab5aebb9dd) ) /* Ver: 4.XX3 Spanish 6-26-97 - Evaluation Only (yes, it's actually 452 and not U52) */ ROM_REGION( 0x400000, "blitter", ROMREGION_ERASE ) // Blitter gfx ROM_LOAD16_BYTE( "touch_master_2000_u38_4.x.u38", 0x100000, 0x080000, CRC(22bb6cc5) SHA1(fc6cfd4e1e6e1455d648a7b63f2c8e37cdfe86d6) ) /* All 4 graphic roms marked as Rev 4.X */ diff --git a/src/mame/drivers/tmc600.cpp b/src/mame/drivers/tmc600.cpp index 26d727321e7..f42b5eea487 100644 --- a/src/mame/drivers/tmc600.cpp +++ b/src/mame/drivers/tmc600.cpp @@ -142,14 +142,14 @@ void tmc600_state::tmc600_io_map(address_map &map) static INPUT_PORTS_START( tmc600 ) PORT_START("Y0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') PORT_CHAR('_') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_CHAR('\"') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') PORT_CHAR('"') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') PORT_CHAR('#') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('/') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') PORT_CHAR('\'') PORT_START("Y1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') PORT_CHAR('(') @@ -162,7 +162,7 @@ static INPUT_PORTS_START( tmc600 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_START("Y2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_CHAR('\\') + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -198,13 +198,13 @@ static INPUT_PORTS_START( tmc600 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x85") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00C5) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x84") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xC3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') PORT_CHAR('~') - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END),3) PORT_START("Y6") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E2") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL1") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL2") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp index 4315b0c991c..50c527f21ff 100644 --- a/src/mame/drivers/tmmjprd.cpp +++ b/src/mame/drivers/tmmjprd.cpp @@ -235,30 +235,25 @@ void tmmjprd_state::draw_tile(bitmap_ind16 &bitmap, const rectangle &cliprect, i { for (int drawx=x;drawx<x+sizex;drawx++) { - uint16_t dat; - uint16_t* dst; - if (!depth) { if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; + uint16_t dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; if (dat!=15) { //dat += (colour<<8); - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } drawx++; if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0x0f); + uint16_t dat = (rom[(tileaddr*32)+count] & 0x0f); if (dat!=15) { //dat += (colour<<8); - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } @@ -268,12 +263,11 @@ void tmmjprd_state::draw_tile(bitmap_ind16 &bitmap, const rectangle &cliprect, i { if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0xff); + uint16_t dat = (rom[(tileaddr*32)+count] & 0xff); if (dat!=255) { dat += (colour<<8) & 0xf00; - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } count++; diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp index 0ebd9f3ecb5..b4a63ee497f 100644 --- a/src/mame/drivers/toaplan2.cpp +++ b/src/mame/drivers/toaplan2.cpp @@ -1311,6 +1311,29 @@ void toaplan2_state::bbakraid_68k_mem(address_map &map) map(0x5000c0, 0x5000cf).w(FUNC(toaplan2_state::batrider_objectbank_w)).umask16(0x00ff); } + +void toaplan2_state::nprobowl_68k_mem(address_map &map) // TODO: verify everything, implement oki banking +{ + map(0x000000, 0x0fffff).rom(); + map(0x200000, 0x207fff).ram().share("mainram"); + map(0x208000, 0x20ffff).ram(); + map(0x400000, 0x40000d).lrw16( + NAME([this](offs_t offset, u16 mem_mask) { return m_vdp[0]->read(offset ^ (0xc/2), mem_mask); }), + NAME([this](offs_t offset, u16 data, u16 mem_mask) { m_vdp[0]->write(offset ^ (0xc/2), data, mem_mask); })); + map(0x500000, 0x500001).portr("IN"); + map(0x500002, 0x500003).portr("UNK"); + map(0x500004, 0x500005).portr("DSW"); + //map(0x500010, 0x500011).w(); + //map(0x500012, 0x500013).w(); + map(0x500021, 0x500021).w(m_oki[0], FUNC(okim6295_device::write)); + //map(0x500040, 0x500041).w(); + //map(0x500042, 0x500043).w(); + map(0x500060, 0x500061).lr16(NAME([this] () -> u16 { return machine().rand(); })); // TODO: Hack, probably checks something in the mechanical part, verify + map(0x500080, 0x500081).w(FUNC(toaplan2_state::batrider_textdata_dma_w)); + map(0x500082, 0x500083).w(FUNC(toaplan2_state::batrider_pal_text_dma_w)); +} + + void toaplan2_state::pipibibs_sound_z80_mem(address_map &map) { map(0x0000, 0x7fff).rom(); @@ -3152,6 +3175,73 @@ static INPUT_PORTS_START( bbakraid ) INPUT_PORTS_END +static INPUT_PORTS_START( nprobowl ) + PORT_START("IN") // Player Inputs + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_SERVICE1 ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START2 ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Set (Relay)") + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // no effect in test mode + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gutter L") + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gutter R") + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // no effect in test mode + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Ballout") + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Ballpass") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Mot Home") + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // no effect in test mode + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // no effect in test mode + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // no effect in test mode + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // no effect in test mode + + PORT_START("DSW") // SW0323 and SW0324 + PORT_SERVICE_DIPLOC( 0x0001, IP_ACTIVE_HIGH, "SW0323:!1") + PORT_DIPUNKNOWN_DIPLOC(0x0002, 0x0000, "SW0323:!2") + PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW0323:!3") + PORT_DIPSETTING( 0x0004, DEF_STR( On ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPUNKNOWN_DIPLOC(0x0008, 0x0000, "SW0323:!4") + PORT_DIPNAME( 0x0070, 0x0000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW0323:!5,!6,!7") + PORT_DIPSETTING( 0x0070, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x0060, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x0050, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x0030, DEF_STR( 1C_4C ) ) + PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW0323:!8") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC(0x0100, 0x0000, "SW0324:!1") + PORT_DIPUNKNOWN_DIPLOC(0x0200, 0x0000, "SW0324:!2") + PORT_DIPUNKNOWN_DIPLOC(0x0400, 0x0000, "SW0324:!3") + PORT_DIPUNKNOWN_DIPLOC(0x0800, 0x0000, "SW0324:!4") + PORT_DIPUNKNOWN_DIPLOC(0x1000, 0x0000, "SW0324:!5") + PORT_DIPUNKNOWN_DIPLOC(0x2000, 0x0000, "SW0324:!6") + PORT_DIPUNKNOWN_DIPLOC(0x4000, 0x0000, "SW0324:!7") + PORT_DIPUNKNOWN_DIPLOC(0x8000, 0x0000, "SW0324:!8") + + PORT_START("UNK") // ?? + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) +INPUT_PORTS_END + + // Text layer graphics -- ROM based in some games, RAM based in others // See video/gp9001.cpp for the main graphics layouts @@ -4143,6 +4233,47 @@ void toaplan2_state::bbakraid(machine_config &config) } +void toaplan2_state::nprobowl(machine_config &config) +{ + // basic machine hardware + M68000(config, m_maincpu, 32_MHz_XTAL / 2); // 32MHz Oscillator, divisor not verified + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::nprobowl_68k_mem); + + ADDRESS_MAP_BANK(config, m_dma_space, 0); + m_dma_space->set_addrmap(0, &toaplan2_state::batrider_dma_mem); + m_dma_space->set_endianness(ENDIANNESS_BIG); + m_dma_space->set_data_width(16); + m_dma_space->set_addr_width(16); + m_dma_space->set_stride(0x8000); + + // video hardware + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank)); + m_screen->set_palette(m_palette); + + GFXDECODE(config, m_gfxdecode, m_palette, gfx_batrider); + PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH); + + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_2); + + MCFG_VIDEO_START_OVERRIDE(toaplan2_state, batrider) + + // sound hardware + SPEAKER(config, "mono").front_center(); + + OKIM6295(config, m_oki[0], 32_MHz_XTAL/8, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); // divisor not verified + // TODO: banking +} + + /*************************************************************************** Game driver(s) @@ -5684,6 +5815,24 @@ ROM_START( bbakraidja ) ROM_END +// dedicated PCB marked Pro Bowl +ROM_START( nprobowl ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD16_BYTE( "newprobowl-prg0-u021", 0x000000, 0x080000, CRC(3a57f122) SHA1(cc361c295f23bc0479ba49eb15de2ec6ca535a56) ) // 11xxxxxxxxxxxxxxxxx = 0xFF + ROM_LOAD16_BYTE( "newprobowl-prg1-u024", 0x000001, 0x080000, CRC(9e9bb58a) SHA1(3d2159bde418dee5d89e3df9a248b4b1989e6ee9) ) // 11xxxxxxxxxxxxxxxxx = 0xFF + + ROM_REGION( 0x200000, "gp9001_0", 0 ) + ROM_LOAD16_BYTE( "newprobowl-chr0-u0518", 0x000000, 0x80000, CRC(0736cccd) SHA1(5a4b691be1df697fef3847456c0f4bb3466c403f) ) + ROM_LOAD16_BYTE( "newprobowl-chr1-u0519", 0x000001, 0x80000, CRC(6700a9bf) SHA1(12a72aa0b91119fbbed994aec702a6869af6f287) ) + ROM_LOAD16_BYTE( "newprobowl-chr2-u0520", 0x100000, 0x80000, CRC(e5f6d0b6) SHA1(6e1a4792698be4b478118e8c82edb0cf3e2286f2) ) + ROM_LOAD16_BYTE( "newprobowl-chr3-u0521", 0x100001, 0x80000, CRC(00c21951) SHA1(922abde172fb82b504dce41b95227740f16208a7) ) + + ROM_REGION( 0x100000, "oki1", 0 ) + ROM_LOAD( "newprobowl-adpcm0-u0834", 0x00000, 0x80000, CRC(3b40b161) SHA1(ff8ba38dd7e0dadbf72810470e3d9afb1cd983d2) ) + ROM_LOAD( "newprobowl-adpcm1-u0835", 0x80000, 0x80000, CRC(8c191e60) SHA1(f81c2849ffc553d921fc680cd50c2997b834c44a) ) +ROM_END + + // The following is in order of Toaplan Board/game numbers // See list at top of file @@ -5787,3 +5936,6 @@ GAME( 1999, bbakraidc, bbakraid, bbakraid, bbakraid, toaplan2_state, init_ GAME( 1999, bbakraidj, bbakraid, bbakraid, bbakraid, toaplan2_state, init_bbakraid, ROT270, "Eighting", "Battle Bakraid - Unlimited Version (Japan) (Tue Jun 8 1999)", MACHINE_SUPPORTS_SAVE ) // older revision of the code GAME( 1999, bbakraidja, bbakraid, bbakraid, bbakraid, toaplan2_state, init_bbakraid, ROT270, "Eighting", "Battle Bakraid (Japan) (Wed Apr 7 1999)", MACHINE_SUPPORTS_SAVE ) + +// dedicated PCB +GAME( 1996, nprobowl, 0, nprobowl, nprobowl, toaplan2_state, empty_init, ROT0, "Zuck / Able Corp", "New Pro Bowl", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE ) // bad GFXs, no sound banking, controls, etc diff --git a/src/mame/drivers/toratora.cpp b/src/mame/drivers/toratora.cpp index 805860a038f..4e3e827f373 100644 --- a/src/mame/drivers/toratora.cpp +++ b/src/mame/drivers/toratora.cpp @@ -121,20 +121,16 @@ WRITE_LINE_MEMBER(toratora_state::cb2_u2_w) uint32_t toratora_state::screen_update_toratora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; data = data << 1; x = x + 1; diff --git a/src/mame/drivers/toypop.cpp b/src/mame/drivers/toypop.cpp index b257d003dd1..2883d32f8c5 100644 --- a/src/mame/drivers/toypop.cpp +++ b/src/mame/drivers/toypop.cpp @@ -180,14 +180,14 @@ void namcos16_state::toypop_palette(palette_device &palette) const void namcos16_state::legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip) { - const uint16_t pal_base = 0x300 + (m_pal_bank << 4); - const uint32_t src_base = 0x200/2; - const uint16_t src_pitch = 288 / 2; + uint16_t const pal_base = 0x300 + (m_pal_bank << 4); + uint32_t const src_base = 0x200/2; + uint16_t const src_pitch = 288 / 2; for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint16_t *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base]; - uint16_t *dst = &bitmap.pix16(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x); + uint16_t const *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base]; + uint16_t *dst = &bitmap.pix(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/drivers/trs80dt1.cpp b/src/mame/drivers/trs80dt1.cpp index 0aa9fc23e79..c4446f0048e 100644 --- a/src/mame/drivers/trs80dt1.cpp +++ b/src/mame/drivers/trs80dt1.cpp @@ -310,7 +310,7 @@ I8275_DRAW_CHARACTER_MEMBER( trs80dt1_state::crtc_update_row ) charcode &= 0x7f; linecount &= 15; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = 0; if (lten) // underline attr @@ -326,7 +326,7 @@ I8275_DRAW_CHARACTER_MEMBER( trs80dt1_state::crtc_update_row ) gfx ^= 0xff; for(u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } diff --git a/src/mame/drivers/trs80m2.cpp b/src/mame/drivers/trs80m2.cpp index 2a249824e59..6b971840d1f 100644 --- a/src/mame/drivers/trs80m2.cpp +++ b/src/mame/drivers/trs80m2.cpp @@ -391,7 +391,7 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); int x = 0; @@ -409,7 +409,7 @@ MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) int dout = BIT(data, 7); int color = (dcursor ^ drevid ^ dout) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/trs80m3.cpp b/src/mame/drivers/trs80m3.cpp index 1cd18228c0f..d40be698f0b 100644 --- a/src/mame/drivers/trs80m3.cpp +++ b/src/mame/drivers/trs80m3.cpp @@ -531,6 +531,6 @@ void trs80m3_state::init_trs80m4p() // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS COMP( 1980, trs80m3, 0, trs80l2, model3, trs80m3, trs80m3_state, init_trs80m3, "Tandy Radio Shack", "TRS-80 Model III", MACHINE_SUPPORTS_SAVE ) -COMP( 1980, trs80m4, trs80m3, 0, model4, trs80m3, trs80m3_state, init_trs80m4, "Tandy Radio Shack", "TRS-80 Model 4", MACHINE_SUPPORTS_SAVE ) +COMP( 1980, trs80m4, trs80m3, 0, model4, trs80m3, trs80m3_state, init_trs80m4, "Tandy Radio Shack", "TRS-80 Model 4", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) COMP( 1983, trs80m4p, trs80m3, 0, model4p, trs80m4p, trs80m3_state, init_trs80m4p, "Tandy Radio Shack", "TRS-80 Model 4P", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE) COMP( 1982, cp500, trs80m3, 0, cp500, trs80m3, trs80m3_state, init_trs80m3, "Prológica", "CP-500 (PVIII REV.3)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ts803.cpp b/src/mame/drivers/ts803.cpp index 3e088f09bbd..62a1a03033a 100644 --- a/src/mame/drivers/ts803.cpp +++ b/src/mame/drivers/ts803.cpp @@ -327,24 +327,23 @@ MC6845_ON_UPDATE_ADDR_CHANGED( ts803_state::crtc_update_addr ) MC6845_UPDATE_ROW( ts803_state::crtc_update_row ) { bool rv = BIT(m_io_dsw->read(), 8) ? 0 : 1; - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = (rv ^ (x == cursor_x)) ? 0xff : 0; + uint8_t inv = (rv ^ (x == cursor_x)) ? 0xff : 0; + uint8_t gfx; if (m_graphics_mode) { - mem = (ra*0x2000 + ma + x) & 0x7fff; + uint16_t mem = (ra*0x2000 + ma + x) & 0x7fff; gfx = m_videoram[mem] ^ inv; } else { - mem = 0x1800 + ((ma + x) & 0x7ff); - chr = m_videoram[mem]; + uint16_t mem = 0x1800 + ((ma + x) & 0x7ff); + uint8_t chr = m_videoram[mem]; gfx = (ra > 7) ? inv : m_p_chargen[(chr<<3) | ((ra+1)&7)] ^ inv; } diff --git a/src/mame/drivers/ttchamp.cpp b/src/mame/drivers/ttchamp.cpp index 41a8430f9ac..17523eb68fe 100644 --- a/src/mame/drivers/ttchamp.cpp +++ b/src/mame/drivers/ttchamp.cpp @@ -186,45 +186,43 @@ void ttchamp_state::video_start() uint32_t ttchamp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { logerror("update\n"); - int y,x,count; + int count; static const int xxx=320,yyy=204; bitmap.fill(m_palette->black_pen()); - uint8_t *videoramfg; - uint8_t* videorambg; + uint8_t const *const videoramfg = (uint8_t*)m_videoram2; + uint8_t const *const videorambg = (uint8_t*)m_videoram0; count=0; - videorambg = (uint8_t*)m_videoram0; - videoramfg = (uint8_t*)m_videoram2; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) + for(int x=0;x<xxx;x++) { - bitmap.pix16(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; + bitmap.pix(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; count++; } } - /* +#if 0 count=0; videoram = (uint8_t*)m_videoram1; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) - { - uint8_t pix = videoram[BYTE_XOR_LE(count)]; - if (pix) bitmap.pix16(y, x) = pix+0x200; - count++; - } + for (int x=0;x<xxx;x++) + { + uint8_t pix = videoram[BYTE_XOR_LE(count)]; + if (pix) bitmap.pix(y, x) = pix+0x200; + count++; + } } - */ +#endif count=0; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) + for(int x=0;x<xxx;x++) { uint8_t pix = videoramfg[BYTE_XOR_LE(count)]; if (pix) @@ -239,16 +237,16 @@ uint32_t ttchamp_state::screen_update(screen_device &screen, bitmap_ind16 &bitma if (pix == 0x01) // blend mode 1 { uint8_t pix = videorambg[BYTE_XOR_LE(count)]; - bitmap.pix16(y, x) = pix + 0x200; + bitmap.pix(y, x) = pix + 0x200; } else if (pix == 0x02) // blend mode 2 { uint8_t pix = videorambg[BYTE_XOR_LE(count)]; - bitmap.pix16(y, x) = pix + 0x100; + bitmap.pix(y, x) = pix + 0x100; } else { - bitmap.pix16(y, x) = pix + 0x000; + bitmap.pix(y, x) = pix + 0x000; } } count++; diff --git a/src/mame/drivers/tulip1.cpp b/src/mame/drivers/tulip1.cpp index b2af48f7fca..a52a7ae8864 100644 --- a/src/mame/drivers/tulip1.cpp +++ b/src/mame/drivers/tulip1.cpp @@ -118,7 +118,7 @@ GFXDECODE_END MC6845_UPDATE_ROW( tulip1_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -127,7 +127,7 @@ MC6845_UPDATE_ROW( tulip1_state::crtc_update_row ) // draw 8 pixels of the character for (int x = 0; x < 8; x++) - bitmap.pix32(y, x + i*8) = pen[BIT(data, 7 - x)]; + bitmap.pix(y, x + i*8) = pen[BIT(data, 7 - x)]; } } diff --git a/src/mame/drivers/tv910.cpp b/src/mame/drivers/tv910.cpp index c5b3803cdf8..3ef568eb70f 100644 --- a/src/mame/drivers/tv910.cpp +++ b/src/mame/drivers/tv910.cpp @@ -465,7 +465,7 @@ void tv910_state::vbl_ack_w(uint8_t data) MC6845_UPDATE_ROW( tv910_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = (ra & 7) | m_charset->read() << 10; uint8_t chr = m_vram[0x7ff]; uint8_t att = (chr & 0xf0) == 0x90 ? chr & 0x0f : 0; @@ -498,14 +498,14 @@ MC6845_UPDATE_ROW( tv910_state::crtc_update_row ) if (bow) data ^= 0xff; - *p = BIT(data, 7) ? bg : fg; p++; - *p = BIT(data, 6) ? bg : fg; p++; - *p = BIT(data, 5) ? bg : fg; p++; - *p = BIT(data, 4) ? bg : fg; p++; - *p = BIT(data, 3) ? bg : fg; p++; - *p = BIT(data, 2) ? bg : fg; p++; - *p = BIT(data, 1) ? bg : fg; p++; - *p = BIT(data, 0) ? bg : fg; p++; + *p++ = BIT(data, 7) ? bg : fg; + *p++ = BIT(data, 6) ? bg : fg; + *p++ = BIT(data, 5) ? bg : fg; + *p++ = BIT(data, 4) ? bg : fg; + *p++ = BIT(data, 3) ? bg : fg; + *p++ = BIT(data, 2) ? bg : fg; + *p++ = BIT(data, 1) ? bg : fg; + *p++ = BIT(data, 0) ? bg : fg; } } diff --git a/src/mame/drivers/tv950.cpp b/src/mame/drivers/tv950.cpp index 4b46e96315b..3db629e060c 100644 --- a/src/mame/drivers/tv950.cpp +++ b/src/mame/drivers/tv950.cpp @@ -259,7 +259,7 @@ MC6845_UPDATE_ROW( tv950_state::crtc_update_row ) else m_attr_screen = m_attr_row; - uint32_t *p = &bitmap.pix32(m_row); + uint32_t *p = &bitmap.pix(m_row); rgb_t fg(255,255,255,255); rgb_t bg(0,0,0,0); diff --git a/src/mame/drivers/tv955.cpp b/src/mame/drivers/tv955.cpp index dfc6f9f67c7..b0f4f055bab 100644 --- a/src/mame/drivers/tv955.cpp +++ b/src/mame/drivers/tv955.cpp @@ -77,7 +77,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(tv955_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/tv990.cpp b/src/mame/drivers/tv990.cpp index 38de5f3b54a..f28d5b01c42 100644 --- a/src/mame/drivers/tv990.cpp +++ b/src/mame/drivers/tv990.cpp @@ -194,51 +194,43 @@ void tv990_state::tvi1111_w(offs_t offset, uint16_t data, uint16_t mem_mask) uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, pixels2; - uint16_t *vram = (uint16_t *)m_vram.target(); - uint8_t *fontram = (uint8_t *)m_fontram.target(); - uint16_t *curchar; - uint8_t *fontptr; - int miny = cliprect.min_y / m_rowh; - int maxy = cliprect.max_y / m_rowh; + uint16_t const *const vram = (uint16_t *)m_vram.target(); + uint8_t const *const fontram = (uint8_t *)m_fontram.target(); + int const miny = cliprect.min_y / m_rowh; + int const maxy = cliprect.max_y / m_rowh; bitmap.fill(0, cliprect); - for (y = miny; y <= maxy; y++) + for (int y = miny; y <= maxy; y++) { - int i; - for(i = 7; i >= 0; i--) + for(int i = 7; i >= 0; i--) { if(!BIT(tvi1111_regs[0x1f], i)) continue; - int starty = tvi1111_regs[i + 0x40] >> 8; - int endy = tvi1111_regs[i + 0x40] & 0xff; + int const starty = tvi1111_regs[i + 0x40] >> 8; + int const endy = tvi1111_regs[i + 0x40] & 0xff; if((y < starty) || (y >= endy)) continue; - uint16_t row_offset = tvi1111_regs[i + 0x50]; - curchar = &vram[row_offset]; + uint16_t const row_offset = tvi1111_regs[i + 0x50]; + uint16_t const *curchar = &vram[row_offset]; int minx = tvi1111_regs[i + 0x30] >> 8; int maxx = tvi1111_regs[i + 0x30] & 0xff; if(maxx > m_width) maxx = m_width; - uint16_t cursor_x = tvi1111_regs[0x16] - row_offset; + uint16_t const cursor_x = tvi1111_regs[0x16] - row_offset; - for (x = minx; x < maxx; x++) + for (int x = minx; x < maxx; x++) { uint8_t chr = curchar[x - minx] >> 8; uint8_t attr = curchar[x - minx] & 0xff; if((attr & 2) && (m_screen->frame_number() & 32)) // blink rate? continue; - fontptr = (uint8_t *)&fontram[(chr + (attr & 0x40 ? 256 : 0)) * 64]; - - uint32_t palette[2]; + uint8_t const *fontptr = &fontram[(chr + (attr & 0x40 ? 256 : 0)) * 64]; if (BIT(tvi1111_regs[0x1b], 0) && x == cursor_x) { @@ -253,6 +245,7 @@ uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, attr ^= attrchg; } + uint32_t palette[2]; if (attr & 0x4) // inverse video? { palette[1] = m_palette->pen(0); @@ -266,32 +259,32 @@ uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int chary = 0; chary < m_rowh; chary++) { - scanline = &bitmap.pix32((y*m_rowh)+chary, (x*16)); + uint32_t *scanline = &bitmap.pix((y*m_rowh)+chary, (x*16)); - pixels = *fontptr++; - pixels2 = *fontptr++; + uint8_t pixels = *fontptr++; + uint8_t pixels2 = *fontptr++; if((attr & 0x8) && (chary == m_rowh - 1)) { pixels = 0xff; pixels2 = 0xff; } - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels2>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels2>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels2>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels2>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels2>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels2>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels2>>1)&1]; - *scanline++ = palette[(pixels&1)]; - *scanline++ = palette[(pixels2&1)]; + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels2, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels2, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels2, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels2, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels2, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels2, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels2, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; + *scanline++ = palette[BIT(pixels2, 0)]; } } } diff --git a/src/mame/drivers/tvc.cpp b/src/mame/drivers/tvc.cpp index 3fff0ca5fca..7dac19358ff 100644 --- a/src/mame/drivers/tvc.cpp +++ b/src/mame/drivers/tvc.cpp @@ -635,18 +635,17 @@ void tvc64p_state::machine_reset() MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vram = &m_vram_base[(m_vram_bank & 0x30)<<10]; - uint16_t offset = ((ma*4 + ra*0x40) & 0x3fff); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vram = &m_vram_base[(m_vram_bank & 0x30)<<10]; + uint16_t const offset = ((ma*4 + ra*0x40) & 0x3fff); switch(m_video_mode) { case 0 : // 2 colors mode - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; + uint8_t const data = vram[offset + i]; *p++ = palette[m_col[BIT(data,7)]]; *p++ = palette[m_col[BIT(data,6)]]; *p++ = palette[m_col[BIT(data,5)]]; @@ -660,9 +659,9 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) case 1 : // 4 colors mode // a0 b0 c0 d0 a1 b1 c1 d1 - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; + uint8_t const data = vram[offset + i]; *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; @@ -676,11 +675,11 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) default: // 16 colors mode // IIGG RRBB - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; - uint8_t col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); - uint8_t col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); + uint8_t const data = vram[offset + i]; + uint8_t const col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); + uint8_t const col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); *p++ = palette[col0]; *p++ = palette[col0]; *p++ = palette[col0]; diff --git a/src/mame/drivers/tvgame.cpp b/src/mame/drivers/tvgame.cpp index 9e8334e16bd..5f2ec5156c5 100644 --- a/src/mame/drivers/tvgame.cpp +++ b/src/mame/drivers/tvgame.cpp @@ -76,15 +76,14 @@ void tvgame_state::speaker_w(uint8_t data) uint32_t tvgame_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,gfx; - uint16_t sy=0,ma=241,x; + uint16_t sy=0,ma=241; - for (y = 0; y < 213; y++) + for (uint8_t y = 0; y < 213; y++) { - uint16_t *p = &bitmap.pix16(sy++); - for (x = ma; x < ma+27; x++) + uint16_t *p = &bitmap.pix(sy++); + for (uint16_t x = ma; x < ma+27; x++) { - gfx = m_p_videoram[x]; + uint8_t gfx = m_p_videoram[x]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 0); diff --git a/src/mame/drivers/twins.cpp b/src/mame/drivers/twins.cpp index 787cfc93da5..611402fdeea 100644 --- a/src/mame/drivers/twins.cpp +++ b/src/mame/drivers/twins.cpp @@ -238,7 +238,7 @@ void twins_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprec { int count = (y * 320) + cliprect.left(); for(int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix16(y, x) = videoram[BYTE_XOR_LE(count++)]; + bitmap.pix(y, x) = videoram[BYTE_XOR_LE(count++)]; } } @@ -260,7 +260,7 @@ void spider_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &clipre { u8 pixel = videoram[BYTE_XOR_LE(count++)]; if (pixel) - bitmap.pix16(y, x) = pixel; + bitmap.pix(y, x) = pixel; } } } diff --git a/src/mame/drivers/ultrsprt.cpp b/src/mame/drivers/ultrsprt.cpp index f79dd7229da..315951ef4fa 100644 --- a/src/mame/drivers/ultrsprt.cpp +++ b/src/mame/drivers/ultrsprt.cpp @@ -72,16 +72,16 @@ private: u32 ultrsprt_state::screen_update_ultrsprt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 *vram = m_vram.get() + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES; + u8 const *const vram = m_vram.get() + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES; for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { int fb_index = y * 1024; - u16 *dest = &bitmap.pix16(y, cliprect.min_x); + u16 *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - u8 p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)]; + u8 const p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)]; if (p1 == 0) *dest++ = vram[BYTE4_XOR_BE(fb_index + x)]; diff --git a/src/mame/drivers/unior.cpp b/src/mame/drivers/unior.cpp index 1e8fafe958f..054e52e24e3 100644 --- a/src/mame/drivers/unior.cpp +++ b/src/mame/drivers/unior.cpp @@ -281,7 +281,7 @@ void unior_state::scroll_w(u8 data) I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = m_p_chargen[(linecount & 7) | (charcode << 3)]; if (vsp) @@ -294,7 +294,7 @@ I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) gfx ^= 0xff; for(u8 i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t unior_pens[3] = diff --git a/src/mame/drivers/unistar.cpp b/src/mame/drivers/unistar.cpp index ea086d988f9..49b9b68a54e 100644 --- a/src/mame/drivers/unistar.cpp +++ b/src/mame/drivers/unistar.cpp @@ -136,7 +136,7 @@ void unistar_state::unistar_palette(palette_device &palette) const I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character) { // This code just a guess, so that we can see something - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = m_chargen[(linecount & 15) | (charcode << 4)]; if (vsp) @@ -149,7 +149,7 @@ I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character) gfx ^= 0xff; for(u8 i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/univac.cpp b/src/mame/drivers/univac.cpp index 403e2ad029f..b0d98788273 100644 --- a/src/mame/drivers/univac.cpp +++ b/src/mame/drivers/univac.cpp @@ -502,7 +502,7 @@ uint32_t univac_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap { for (u8 ra = 0; ra < 14; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); for (uint16_t x = ma; x < ma + 80; x++) { diff --git a/src/mame/drivers/unixpc.cpp b/src/mame/drivers/unixpc.cpp index fa042790363..c28fc92cc3d 100644 --- a/src/mame/drivers/unixpc.cpp +++ b/src/mame/drivers/unixpc.cpp @@ -309,7 +309,7 @@ uint32_t unixpc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 348; y++) for (int x = 0; x < 720/16; x++) for (int b = 0; b < 16; b++) - bitmap.pix16(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); + bitmap.pix(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); return 0; } diff --git a/src/mame/drivers/unkhorse.cpp b/src/mame/drivers/unkhorse.cpp index 432c2ccb57d..ddb9c514cb7 100644 --- a/src/mame/drivers/unkhorse.cpp +++ b/src/mame/drivers/unkhorse.cpp @@ -86,7 +86,7 @@ uint32_t horse_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, uint8_t color = m_colorram[(y << 1 & 0x1e0) | x] >> 4; for (int i = 0; i < 8; i++) - bitmap.pix16(y, x << 3 | i) = (data >> i & 1) ? color : 0; + bitmap.pix(y, x << 3 | i) = (data >> i & 1) ? color : 0; } } diff --git a/src/mame/drivers/unkpoker.cpp b/src/mame/drivers/unkpoker.cpp index 1445d167f1d..4f60318aaa0 100644 --- a/src/mame/drivers/unkpoker.cpp +++ b/src/mame/drivers/unkpoker.cpp @@ -70,7 +70,7 @@ uint32_t unkpoker_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { diff --git a/src/mame/drivers/ut88.cpp b/src/mame/drivers/ut88.cpp index 64f4e46fe4d..fd83840838f 100644 --- a/src/mame/drivers/ut88.cpp +++ b/src/mame/drivers/ut88.cpp @@ -13,12 +13,12 @@ Need instructions... When started you enter a one-key command, followed by whatever parameters are needed. -Pressing 1 will allow entry of bytes into RAM, however the system doesn't -allow you to view memory (afaik). +Pressing 1 will allow entry of bytes into RAM. Command 3 does a test of the display, however the rest are a mystery. -Paste facility was tested but doesn't work, so all code remnants removed. +Paste facility was tested but doesn't work, because keyboard response is +too slow. ****************************************************************************/ @@ -129,7 +129,7 @@ static INPUT_PORTS_START( ut88 ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) @@ -157,27 +157,27 @@ INPUT_PORTS_END static INPUT_PORTS_START( ut88mini ) PORT_START("LINE0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_START("LINE1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_START("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('V') INPUT_PORTS_END const gfx_layout charlayout = @@ -259,6 +259,7 @@ void ut88mini_state::ut88mini(machine_config &config) /* video hardware */ config.set_default_layout(layout_ut88mini); + TIMER(config, "display_timer").configure_periodic(FUNC(ut88mini_state::display_timer), attotime::from_hz(60)); /* Cassette */ SPEAKER(config, "speaker").front_center(); @@ -284,6 +285,7 @@ ROM_END ROM_START( ut88mini ) ROM_REGION( 0x0400, "maincpu", 0 ) ROM_LOAD( "ut88mini.rom", 0x0000, 0x0400, CRC(ce9213ee) SHA1(16b71b3051a800386d664dbcc5983b783475d0c6) ) // DD10,DD11 (0x200 each) + ROM_FILL(0x71,1,0x7e) // show content of ram address ROM_REGION( 0x0200, "proms", 0 ) ROM_LOAD( "ut88key1.dd15", 0x0000, 0x0100, CRC(ecfe42c7) SHA1(d7f10bbb05934150c1a258db1c8b4eb65771af59) ) diff --git a/src/mame/drivers/uzebox.cpp b/src/mame/drivers/uzebox.cpp index f7407df54c4..2d1399d0b1c 100644 --- a/src/mame/drivers/uzebox.cpp +++ b/src/mame/drivers/uzebox.cpp @@ -242,10 +242,10 @@ void uzebox_state::line_update() for (uint32_t x = m_line_pos_cycles; x < cycles; x++) { if (m_bitmap.cliprect().contains(x, m_vpos)) - m_bitmap.pix32(m_vpos, x) = color; + m_bitmap.pix(m_vpos, x) = color; if (!INTERLACED) if (m_bitmap.cliprect().contains(x, m_vpos + 1)) - m_bitmap.pix32(m_vpos + 1, x) = color; + m_bitmap.pix(m_vpos + 1, x) = color; } m_line_pos_cycles = cycles; diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index 60103982180..ab00be275cd 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -177,16 +177,14 @@ GFXDECODE_END MC6845_UPDATE_ROW( v6809_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/vboy.cpp b/src/mame/drivers/vboy.cpp index ef69def55cc..3dbaf47a3eb 100644 --- a/src/mame/drivers/vboy.cpp +++ b/src/mame/drivers/vboy.cpp @@ -227,7 +227,7 @@ void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, { uint8_t const col = (pal >> (dat * 2)) & 3; - bitmap.pix16((res_y), (res_x)) = m_palette->pen(col); + bitmap.pix((res_y), (res_x)) = m_palette->pen(col); } } } @@ -288,9 +288,8 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num) { // g_profiler.start(PROFILER_USER2); - int x,y; - for(y=0;y<=h;y++) + for(int y=0;y<=h;y++) { int32_t y1 = (y+gy); @@ -299,7 +298,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui int src_y = y+my; - for(x=0;x<=w;x++) + for(int x=0;x<=w;x++) { int32_t x1 = (x+gx); @@ -336,7 +335,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui } if(pix != -1) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + bitmap.pix(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -346,9 +345,8 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num) { // g_profiler.start(PROFILER_USER3); - int x,y; - for(y=0;y<=h;y++) + for(int y=0;y<=h;y++) { float h_skw = (int16_t)READ_BGMAP(param_base + (y*8+0)) / 8.0; float prlx = (int16_t)READ_BGMAP(param_base + (y*8+1)) / 8.0; @@ -358,7 +356,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect h_skw += right ? -prlx : prlx; - for(x=0;x<=w;x++) + for(int x=0;x<=w;x++) { int32_t src_x,src_y; int16_t y1 = (y+gy); @@ -381,7 +379,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect if(pix != -1) if (cliprect.contains(x1, y1)) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + bitmap.pix(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -421,7 +419,6 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle uint16_t param_base = READ_WORLD(num+9) & 0xfff0; uint16_t ovr_char = READ_BGMAP(READ_WORLD(num+10)); uint8_t bg_map_num = def & 0x0f; - int i; if(end) return 1; @@ -458,21 +455,19 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle } else if (mode==3) // OBJ Mode { - int start_offs, end_offs; - if(cur_spt == -1) { popmessage("Cur spt used with -1 pointer!"); return 0; } - start_offs = m_vip_regs.SPT[cur_spt]; + int start_offs = m_vip_regs.SPT[cur_spt]; - end_offs = 0x3ff; + int end_offs = 0x3ff; if(cur_spt != 0) end_offs = m_vip_regs.SPT[cur_spt-1]; - i = start_offs; + int i = start_offs; do { uint16_t start_ndx = i * 4; @@ -489,12 +484,12 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle if(right && jron) put_obj(bitmap, cliprect, (jx+jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); - i --; + i--; i &= 0x3ff; }while(i != end_offs); if((lon && !right) || (ron && right)) - cur_spt --; + cur_spt--; } return 0; @@ -514,21 +509,15 @@ uint32_t vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 if(0) { - int x,y; - - for(y=0;y<224;y++) + for(int y=0;y<224;y++) { - for(x=0;x<384;x++) + for(int x=0;x<384;x++) { - uint8_t pen; - uint8_t pix; - int yi; - - pen = m_l_frame_1[(x*0x40)+(y >> 2)]; - yi = ((y & 0x3)*2); - pix = (pen >> yi) & 3; + uint8_t pen = m_l_frame_1[(x*0x40)+(y >> 2)]; + int yi = ((y & 0x3)*2); + uint8_t pix = (pen >> yi) & 3; - bitmap.pix16(y, x) = m_palette->pen(pix & 3); + bitmap.pix(y, x) = m_palette->pen(pix & 3); } } } diff --git a/src/mame/drivers/vcombat.cpp b/src/mame/drivers/vcombat.cpp index ef93aec1594..3dd856f4fb8 100644 --- a/src/mame/drivers/vcombat.cpp +++ b/src/mame/drivers/vcombat.cpp @@ -173,20 +173,18 @@ uint32_t vcombat_state::update_screen(screen_device &screen, bitmap_rgb32 &bitma for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { - int x; int src_addr = 256/2 * y; const uint16_t *m68k_src = &m68k_buf[src_addr]; const uint16_t *i860_src = &i860_buf[src_addr]; - uint32_t *dst = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dst = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - int i; uint16_t m68k_pix = *m68k_src++; uint16_t i860_pix = *i860_src++; /* Draw two pixels */ - for (i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) { /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors. Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */ diff --git a/src/mame/drivers/vector06.cpp b/src/mame/drivers/vector06.cpp index b91a025789f..b3c81e63829 100644 --- a/src/mame/drivers/vector06.cpp +++ b/src/mame/drivers/vector06.cpp @@ -90,7 +90,7 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(164) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') @@ -134,9 +134,9 @@ static INPUT_PORTS_START( vector06 ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') PORT_CHAR('[') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('\\') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('}') PORT_CHAR(']') + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) PORT_START("LINE.8") diff --git a/src/mame/drivers/vegaeo.cpp b/src/mame/drivers/vegaeo.cpp index 796a3c03332..62fb7c9f077 100644 --- a/src/mame/drivers/vegaeo.cpp +++ b/src/mame/drivers/vegaeo.cpp @@ -167,7 +167,7 @@ uint32_t vegaeo_state::screen_update_vega(screen_device &screen, bitmap_ind16 &b { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[0x14000 * (m_vbuffer ^ 1) + (y * 320) + x] & 0xff; + bitmap.pix(y, x) = m_vram[0x14000 * (m_vbuffer ^ 1) + (y * 320) + x] & 0xff; } } return 0; diff --git a/src/mame/drivers/vg5k.cpp b/src/mame/drivers/vg5k.cpp index 9aa760e8c35..18afb0dccd0 100644 --- a/src/mame/drivers/vg5k.cpp +++ b/src/mame/drivers/vg5k.cpp @@ -82,7 +82,7 @@ public: void init_vg5k(); - DECLARE_INPUT_CHANGED_MEMBER(delta_button); + DECLARE_INPUT_CHANGED_MEMBER(delta_button); private: required_device<z80_device> m_maincpu; @@ -114,12 +114,12 @@ private: void vg5k_state::z80_m1_w(uint8_t data) { - // Leverage the refresh callback of the Z80 emulator to pretend - // the second T state of the M1 cycle didn't happen. - // This simulates the WAIT line asserted at that moment, as - // the current implementation of the Z80 doesn't handle the WAIT - // line at that moment. - m_maincpu->adjust_icount(-1); + // Leverage the refresh callback of the Z80 emulator to pretend + // the second T state of the M1 cycle didn't happen. + // This simulates the WAIT line asserted at that moment, as + // the current implementation of the Z80 doesn't handle the WAIT + // line at that moment. + m_maincpu->adjust_icount(-1); } uint8_t vg5k_state::printer_r() @@ -163,17 +163,17 @@ uint8_t vg5k_state::cassette_r() void vg5k_state::cassette_w(uint8_t data) { m_dac->write(BIT(data, 3)); - m_cassette->change_state(BIT(data, 1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED , CASSETTE_MASK_MOTOR); - - if (BIT(data, 1)) { - if (BIT(data, 0)) { - m_cassette->output(+1); - } else { - m_cassette->output(-1); - } - } else { - m_cassette->output(0); - } + m_cassette->change_state(BIT(data, 1) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED , CASSETTE_MASK_MOTOR); + + if (BIT(data, 1)) { + if (BIT(data, 0)) { + m_cassette->output(+1); + } else { + m_cassette->output(-1); + } + } else { + m_cassette->output(0); + } } @@ -308,8 +308,8 @@ static INPUT_PORTS_START( vg5k ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("direct") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("DELTA") PORT_CHANGED_MEMBER(DEVICE_SELF, vg5k_state, delta_button, 0) + PORT_START("direct") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_NAME("DELTA") PORT_CHANGED_MEMBER(DEVICE_SELF, vg5k_state, delta_button, 0) INPUT_PORTS_END @@ -333,10 +333,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::vg5k_scanline) INPUT_CHANGED_MEMBER(vg5k_state::delta_button) { - // The yellow Delta key on the keyboard is wired so that it asserts directly the NMI line of the Z80. - if (!newval) { - m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); - } + // The yellow Delta key on the keyboard is wired so that it asserts directly the NMI line of the Z80. + if (!newval) { + m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); + } } @@ -398,7 +398,7 @@ void vg5k_state::vg5k(machine_config &config) Z80(config, m_maincpu, XTAL(4'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &vg5k_state::vg5k_mem); m_maincpu->set_addrmap(AS_IO, &vg5k_state::vg5k_io); - m_maincpu->refresh_cb().set(FUNC(vg5k_state::z80_m1_w)); + m_maincpu->refresh_cb().set(FUNC(vg5k_state::z80_m1_w)); TIMER(config, "vg5k_scanline").configure_scanline(FUNC(vg5k_state::vg5k_scanline), "screen", 0, 10); diff --git a/src/mame/drivers/vicdual.cpp b/src/mame/drivers/vicdual.cpp index 67d786dc0b6..c6711fde550 100644 --- a/src/mame/drivers/vicdual.cpp +++ b/src/mame/drivers/vicdual.cpp @@ -477,7 +477,7 @@ uint8_t vicdual_state::frogs_io_r(offs_t offset) void vicdual_state::frogs_io_w(offs_t offset, uint8_t data) { if (offset & 0x01) assert_coin_status(); - if (offset & 0x02) frogs_audio_w(data); + if (offset & 0x02) m_vicdual_sound->write(data); } @@ -557,14 +557,12 @@ void vicdual_state::frogs(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &vicdual_state::frogs_map); m_maincpu->set_addrmap(AS_IO, &vicdual_state::frogs_io_map); - MCFG_MACHINE_START_OVERRIDE(vicdual_state,frogs_audio) - /* video hardware */ m_screen->set_screen_update(FUNC(vicdual_state::screen_update_bw)); /* audio hardware */ SPEAKER(config, "mono").front_center(); - frogs_audio(config); + FROGS_AUDIO(config, m_vicdual_sound, 0).add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -1142,7 +1140,7 @@ void vicdual_state::sspacaho_io_w(offs_t offset, uint8_t data) void vicdual_state::tranqgun_io_w(offs_t offset, uint8_t data) { - if (offset & 0x01) tranqgun_audio_w(data); + if (offset & 0x01) m_vicdual_sound->write(data); if (offset & 0x02) palette_bank_w(data); if (offset & 0x08) assert_coin_status(); } @@ -1168,12 +1166,8 @@ void carnival_state::carnival_io_w(offs_t offset, uint8_t data) void vicdual_state::brdrline_io_w(offs_t offset, uint8_t data) { - if (offset & 0x01) brdrline_audio_w(data); - if (offset & 0x02) - { - palette_bank_w(data); - brdrline_audio_aux_w(data); - } + if (offset & 0x01) m_vicdual_sound->write(data); + if (offset & 0x02) palette_bank_w(data); if (offset & 0x08) assert_coin_status(); } @@ -2266,7 +2260,7 @@ void vicdual_state::tranqgun(machine_config &config) /* audio hardware */ SPEAKER(config, "mono").front_center(); - tranqgun_audio(config); + BORDERLINE_AUDIO(config, m_vicdual_sound, 0).add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -2279,7 +2273,7 @@ void vicdual_state::brdrline(machine_config &config) /* audio hardware */ SPEAKER(config, "mono").front_center(); - brdrline_audio(config); + BORDERLINE_AUDIO(config, m_vicdual_sound, 0).add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -4023,7 +4017,7 @@ GAME( 1980, samurai, 0, samurai, samurai, vicdual_state, empty_in GAME( 1979, invinco, 0, invinco, invinco, vicdual_state, empty_init, ROT270, "Sega", "Invinco", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1979, invds, 0, invds, invds, vicdual_state, empty_init, ROT270, "Sega", "Invinco / Deep Scan", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1979, carhntds, 0, carhntds, carhntds, vicdual_state, empty_init, ROT270, "Sega", "Car Hunt / Deep Scan (France)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1980, tranqgun, 0, tranqgun, tranqgun, vicdual_state, empty_init, ROT270, "Sega", "Tranquillizer Gun", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, tranqgun, 0, tranqgun, tranqgun, vicdual_state, empty_init, ROT270, "Sega", "Tranquillizer Gun", MACHINE_SUPPORTS_SAVE ) GAME( 1980, spacetrk, 0, spacetrk, spacetrk, vicdual_state, empty_init, ROT270, "Sega", "Space Trek (upright)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1980, spacetrkc, spacetrk, spacetrk, spacetrkc, vicdual_state, empty_init, ROT270, "Sega", "Space Trek (cocktail)", MACHINE_IMPERFECT_GRAPHICS |MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1980, carnival, 0, carnival, carnival, carnival_state, empty_init, ROT270, "Sega", "Carnival (upright, AY8912 music)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) @@ -4032,11 +4026,11 @@ GAME( 1980, carnivalc, carnival, carnival, carnivalc, carnival_state, empty_in GAME( 1980, carnivalh, carnival, carnivalh, carnivalh, carnival_state, empty_init, ROT270, "Sega", "Carnival (Head On hardware, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1980, carnivalha, carnival, carnivalh, carnivalh, carnival_state, empty_init, ROT270, "Sega", "Carnival (Head On hardware, set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1980, verbena, carnival, carnival, carnival, carnival_state, empty_init, ROT270, "bootleg (Cocamatic)", "Verbena (bootleg of Carnival)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, brdrline, 0, brdrline, brdrline, vicdual_state, empty_init, ROT270, "Sega", "Borderline", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, starrkr, brdrline, brdrline, starrkr, vicdual_state, empty_init, ROT270, "Sega", "Star Raker", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, brdrlins, brdrline, brdrline, brdrline, vicdual_state, empty_init, ROT270, "bootleg (Sidam)", "Borderline (Sidam bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, brdrlinb, brdrline, brdrline, brdrline, vicdual_state, empty_init, ROT270, "bootleg (Karateco)", "Borderline (Karateco bootleg)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1981, brdrlinet, brdrline, tranqgun, tranqgun, vicdual_state, empty_init, ROT270, "Sega", "Borderline (Tranquillizer Gun conversion)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // official factory conversion +GAME( 1981, brdrline, 0, brdrline, brdrline, vicdual_state, empty_init, ROT270, "Sega", "Borderline", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, starrkr, brdrline, brdrline, starrkr, vicdual_state, empty_init, ROT270, "Sega", "Star Raker", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1981, brdrlins, brdrline, brdrline, brdrline, vicdual_state, empty_init, ROT270, "bootleg (Sidam)", "Borderline (Sidam bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, brdrlinb, brdrline, brdrline, brdrline, vicdual_state, empty_init, ROT270, "bootleg (Karateco)", "Borderline (Karateco bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, brdrlinet, brdrline, tranqgun, tranqgun, vicdual_state, empty_init, ROT270, "Sega", "Borderline (Tranquillizer Gun conversion)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // official factory conversion GAME( 198?, startrks, 0, headons, headons, vicdual_state, empty_init, ROT0, "bootleg (Sidam)", "Star Trek (Head On hardware)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1980, digger, 0, digger, digger, vicdual_state, empty_init, ROT270, "Sega", "Digger", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1981, pulsar, 0, pulsar, pulsar, vicdual_state, empty_init, ROT270, "Sega", "Pulsar", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/victor9k.cpp b/src/mame/drivers/victor9k.cpp index fae63959c6e..b42e75619b5 100644 --- a/src/mame/drivers/victor9k.cpp +++ b/src/mame/drivers/victor9k.cpp @@ -304,7 +304,7 @@ MC6845_UPDATE_ROW( victor9k_state::crtc_update_row ) color = palette[pen]; } - bitmap.pix32(vbp + y, x++) = color; + bitmap.pix(vbp + y, x++) = color; } aa += 2; diff --git a/src/mame/drivers/vidbrain.cpp b/src/mame/drivers/vidbrain.cpp index 1bc42153e12..7f52f8f3530 100644 --- a/src/mame/drivers/vidbrain.cpp +++ b/src/mame/drivers/vidbrain.cpp @@ -33,6 +33,21 @@ - expander 1 (F3870 CPU, cassette, RS-232) - expander 2 (modem) +Keyboard: + - When typing, (A .) key is often misinterpreted as (O #). + - Shift is a toggle. This prevents Natural Keyboard & Paste from being + able to shift as needed. The shift state shows as a block on the intro + screen. + +Using the system: + - At startup, the intro screen gives the choices TEXT, COLOR, CLOCK, ALARM. + - Press F1 for TEXT - this allows you to test the keyboard, but note that + the Space key simply advances the cursor - it doesn't erase. + - Press F2 for COLOR - this shows colour bars, presumably as a hardware test. + In emulation, the colours are offset to the right and wrap around a bit. + - Press F3 for CLOCK + - Press F4 for ALARM + */ #include "emu.h" @@ -246,25 +261,25 @@ static INPUT_PORTS_START( vidbrain ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('8') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('6') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('+') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPECIAL ALARM") PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPECIAL ALARM") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_START("IO06") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('7') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('5') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('3') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT CLOCK") PORT_CODE(KEYCODE_F3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT CLOCK") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_START("IO07") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('%') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('4') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('2') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PREVIOUS COLOR") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PREVIOUS COLOR") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_START("UV201-31") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('.') PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('1') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') PORT_CHAR('0') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK TEXT") PORT_CODE(KEYCODE_F1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BACK TEXT") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_START("RESET") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("MASTER CONTROL") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHANGED_MEMBER(DEVICE_SELF, vidbrain_state, trigger_reset, 0) diff --git a/src/mame/drivers/video21.cpp b/src/mame/drivers/video21.cpp index 66a1ed5521e..6af36ce0652 100644 --- a/src/mame/drivers/video21.cpp +++ b/src/mame/drivers/video21.cpp @@ -74,19 +74,18 @@ private: uint32_t video21_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 28; y++) + for (uint8_t y = 0; y < 28; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 32; x++) + for (uint16_t x = 0; x < 32; x++) { - chr = m_p_videoram[x+ma] & 0x7f; - gfx = m_p_chargen[(chr<<3) | ra ]; + uint8_t chr = m_p_videoram[x+ma] & 0x7f; + uint8_t gfx = m_p_chargen[(chr<<3) | ra ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/videopkr.cpp b/src/mame/drivers/videopkr.cpp index 0e127efe2bc..d0de4d55425 100644 --- a/src/mame/drivers/videopkr.cpp +++ b/src/mame/drivers/videopkr.cpp @@ -995,7 +995,7 @@ static INPUT_PORTS_START( videopkr ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Discard") PORT_CODE(KEYCODE_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_GAMBLE_DEAL ) PORT_NAME("Discard") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_POKER_CANCEL ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_POKER_HOLD1 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_POKER_HOLD2 ) @@ -1104,7 +1104,7 @@ static INPUT_PORTS_START( babypkr ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books") PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP ) PORT_NAME("Double / Discard") PORT_CODE(KEYCODE_3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_GAMBLE_DEAL ) PORT_NAME("Double / Discard") PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_POKER_CANCEL ) PORT_NAME("Cancel / Take") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_POKER_HOLD1 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_POKER_HOLD2 ) diff --git a/src/mame/drivers/vis.cpp b/src/mame/drivers/vis.cpp index 1ade543187c..816e0764017 100644 --- a/src/mame/drivers/vis.cpp +++ b/src/mame/drivers/vis.cpp @@ -316,11 +316,11 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect { const uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int pos, line, column, col, addr, curr_addr = 0; + int curr_addr = 0; const uint8_t decode_tbl[] = {0, 1, 2, 3, 4, 5, 6, 9, 12, 17, 22, 29, 38, 50, 66, 91, 128, 165, 190, 206, 218, 227, 234, 239, 244, 247, 250, 251, 252, 253, 254, 255}; - for (addr = vga.crtc.start_addr, line=0; line<(vga.crtc.vert_disp_end+1); line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = vga.crtc.start_addr, line=0; line<(vga.crtc.vert_disp_end+1); line+=height, addr+=offset(), curr_addr+=offset()) { for(int yi = 0;yi < height; yi++) { @@ -329,7 +329,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect curr_addr = addr; if((line + yi) == (vga.crtc.line_compare & 0x3ff)) curr_addr = 0; - for (pos=curr_addr, col=0, column=0; column<(vga.crtc.horz_disp_end+1); column++, col+=8, pos+=8) + for (int pos=curr_addr, col=0, column=0; column<(vga.crtc.horz_disp_end+1); column++, col+=8, pos+=8) { if(pos + 0x08 > 0x80000) return; @@ -340,8 +340,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect continue; uint8_t a = vga.memory[pos + xi], b = vga.memory[pos + xi + 1]; uint8_t c = vga.memory[pos + xi + 2], d = vga.memory[pos + xi + 3]; - uint8_t y[4], ub, vb, trans; - uint16_t u, v; + uint8_t y[4], ub, vb; if(col || xi) { y[0] = decode_tbl[a & 0x1f] + ydelta; @@ -357,9 +356,9 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect y[1] = decode_tbl[b & 0x1f] + y[0]; y[2] = decode_tbl[c & 0x1f] + y[1]; y[3] = decode_tbl[d & 0x1f] + y[2]; - trans = (a >> 7) | ((c >> 6) & 2); - u = ua; - v = va; + uint8_t trans = (a >> 7) | ((c >> 6) & 2); + uint16_t u = ua; + uint16_t v = va; for(int i = 0; i < 4; i++) { if(i == trans) @@ -372,7 +371,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect u = ub; v = vb; } - bitmap.pix32(line + yi, col + xi + i) = IV | (uint32_t)yuv_to_rgb(y[i], u, v); + bitmap.pix(line + yi, col + xi + i) = IV | (uint32_t)yuv_to_rgb(y[i], u, v); } ua = ub; va = vb; diff --git a/src/mame/drivers/vixen.cpp b/src/mame/drivers/vixen.cpp index b30a882147b..4c926f7c6ea 100644 --- a/src/mame/drivers/vixen.cpp +++ b/src/mame/drivers/vixen.cpp @@ -298,53 +298,53 @@ INPUT_PORTS_START( vixen ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') PORT_START("KEY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') PORT_CHAR(0x11) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') PORT_CHAR(0x17) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') PORT_CHAR(0x05) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') PORT_CHAR(0x12) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') PORT_CHAR(0x14) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_CHAR(0x19) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') PORT_CHAR(0x15) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') PORT_CHAR(0x09) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) PORT_START("KEY.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') PORT_CHAR(0x01) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') PORT_CHAR(0x13) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') PORT_CHAR(0x04) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') PORT_CHAR(0x06) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') PORT_CHAR(0x07) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') PORT_CHAR(0x08) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR(0x0a) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') PORT_CHAR(0x0b) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) PORT_START("KEY.4") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') PORT_CHAR(0x1a) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_CHAR(0x18) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') PORT_CHAR(0x03) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') PORT_CHAR(0x16) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') PORT_CHAR(0x02) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') PORT_CHAR(0x0e) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') PORT_CHAR(0x0d) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0d) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_START("KEY.5") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8, UCHAR_MAMEKEY(LEFT)) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') PORT_CHAR(0x10) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') PORT_CHAR(0x0f) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') PORT_START("KEY.6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR(0x1F) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR(0x7E) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') PORT_CHAR(0x1C) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR(0x60) PORT_START("KEY.7") @@ -417,7 +417,7 @@ uint32_t vixen_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { int color = BIT(gfx, 7 - b); - bitmap.pix32((y * 10) + ra, (x * 8) + b) = pen[color]; + bitmap.pix((y * 10) + ra, (x * 8) + b) = pen[color]; } } } diff --git a/src/mame/drivers/vk100.cpp b/src/mame/drivers/vk100.cpp index b56b800fdbb..cb3e4ee42db 100644 --- a/src/mame/drivers/vk100.cpp +++ b/src/mame/drivers/vk100.cpp @@ -1025,7 +1025,7 @@ MC6845_UPDATE_ROW( vk100_state::crtc_update_row ) // display a 12-bit wide chunk for (int j = 0; j < 12; j++) { - bitmap.pix32(y, (12*i)+j) = (((block&(0x0001<<j))?1:0)^(m_vgSOPS&1))?fgColor:bgColor; + bitmap.pix(y, (12*i)+j) = (((block&(0x0001<<j))?1:0)^(m_vgSOPS&1))?fgColor:bgColor; } } } diff --git a/src/mame/drivers/votrhv.cpp b/src/mame/drivers/votrhv.cpp index 2b3fea5b6e7..398de89d918 100644 --- a/src/mame/drivers/votrhv.cpp +++ b/src/mame/drivers/votrhv.cpp @@ -7,46 +7,46 @@ * ******************************************************************************/ /* - The HC-110 and HC-120 both consist of 3 boards: - 1. An 'embedded system' 6800 board with two output latches, one input - latch, and two 'resume/reset' latches which pull the 6800 is out of - reset on a rising edge, as a form of power saving. (pcb 1816?) - 2. A keyboard handler pcb; this is different on the HC-110 (where it is - made by a 3rd party company for the 128-key input) and the HC-120 - (where it was made by votrax/phonic mirror, pcb 1817?) - 3. The voice synthesizer pcb 1818c, encased in epoxy. It is a discrete - synthesizer roughly equivalent to an SC-01 or VSK, it has external - pins to allow control of speech pitch and rate in addition to the - typical 2 inflection pins. - - Notes: Electronic Arrays, Inc. who made the EA8316 CMOS mask ROMs was - bought out by NEC in 1978. - - TODO: 1818c discrete speech synth device - - The 1818C SYNTHESIZER BOARD is mentioned as one of two speech - synthesizers described in US Patent 4,130,730 in figures 3, 4a and 4b - (the Votrax VSK/VSL is the other device, described in figures 1, 2a, - and 2b) - The 1818C uses three Motorola MCM14524 256x4 CMOS MASK ROMs to hold - the phoneme parameters. - (This is mentioned in 4,130,730 column 11 line 31.) - - Motorola MCM14524: - +---..---+ - /CLK -> | 1 16 | -- VDD (up to 18v) - CE -> | 2 15 | <- A0 - B0 <- | 3 14 | <- A1 - B1 <- | 4 13 | <- A7 - B2 <- | 5 12 | <- A6 - B3 <- | 6 11 | <- A5 - A2 -> | 7 10 | <- A4 - (0v)VSS -- | 8 9 | <- A3 - +--------+ - see http://bitsavers.org/components/motorola/_dataBooks/1978_Motorola_CMOS_Data_Book.pdf - page 488 - - TODO: make the two latcha/b flops combine together using input_merger + The HC-110 and HC-120 both consist of 3 boards: + 1. An 'embedded system' 6800 board with two output latches, one input + latch, and two 'resume/reset' latches which pull the 6800 is out of + reset on a rising edge, as a form of power saving. (pcb 1816?) + 2. A keyboard handler pcb; this is different on the HC-110 (where it is + made by a 3rd party company for the 128-key input) and the HC-120 + (where it was made by votrax/phonic mirror, pcb 1817?) + 3. The voice synthesizer pcb 1818c, encased in epoxy. It is a discrete + synthesizer roughly equivalent to an SC-01 or VSK, it has external + pins to allow control of speech pitch and rate in addition to the + typical 2 inflection pins. + + Notes: Electronic Arrays, Inc. who made the EA8316 CMOS mask ROMs was + bought out by NEC in 1978. + + TODO: 1818c discrete speech synth device + + The 1818C SYNTHESIZER BOARD is mentioned as one of two speech + synthesizers described in US Patent 4,130,730 in figures 3, 4a and 4b + (the Votrax VSK/VSL is the other device, described in figures 1, 2a, + and 2b) + The 1818C uses three Motorola MCM14524 256x4 CMOS MASK ROMs to hold + the phoneme parameters. + (This is mentioned in 4,130,730 column 11 line 31.) + + Motorola MCM14524: + +---..---+ + /CLK -> | 1 16 | -- VDD (up to 18v) + CE -> | 2 15 | <- A0 + B0 <- | 3 14 | <- A1 + B1 <- | 4 13 | <- A7 + B2 <- | 5 12 | <- A6 + B3 <- | 6 11 | <- A5 + A2 -> | 7 10 | <- A4 + (0v)VSS -- | 8 9 | <- A3 + +--------+ + see http://bitsavers.org/components/motorola/_dataBooks/1978_Motorola_CMOS_Data_Book.pdf + page 488 + + TODO: make the two latcha/b flops combine together using input_merger */ /* Core includes */ diff --git a/src/mame/drivers/vp101.cpp b/src/mame/drivers/vp101.cpp index dc094bf91b7..aea28ee884f 100644 --- a/src/mame/drivers/vp101.cpp +++ b/src/mame/drivers/vp101.cpp @@ -275,7 +275,7 @@ uint32_t vp10x_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (int y = 0; y < 240; y++) { - uint32_t *line = &bitmap.pix32(y); + uint32_t *line = &bitmap.pix(y); const uint32_t *video_ram = (const uint32_t *) &m_mainram[(m_fb_base/4) + (y * (0x1000/4)) + 4]; for (int x = 0; x < 320; x++) @@ -306,7 +306,7 @@ uint32_t vp10x_state::vp50_screen_update(screen_device &screen, bitmap_rgb32 &bi for (int y = 0; y < 240; y++) { - uint32_t *line = &bitmap.pix32(y); + uint32_t *line = &bitmap.pix(y); const uint8_t *video_ram = (const uint8_t *) &m_mainram[(0x10000/4)+(y * 100)]; for (int x = 0; x < 400; x++) diff --git a/src/mame/drivers/vt1682.cpp b/src/mame/drivers/vt1682.cpp index cc0fdb1401e..3c815bbe116 100644 --- a/src/mame/drivers/vt1682.cpp +++ b/src/mame/drivers/vt1682.cpp @@ -4295,11 +4295,11 @@ void vt_vt1682_state::draw_tile_pixline(int segment, int tile, int tileline, int else currentaddress = startaddress + ((tilesize_high - 1) - tileline) * linebytes; - uint8_t* pri2ptr = &m_pal2_priority_bitmap.pix8(y); - uint8_t* pri1ptr = &m_pal1_priority_bitmap.pix8(y); + uint8_t *const pri2ptr = &m_pal2_priority_bitmap.pix(y); + uint8_t *const pri1ptr = &m_pal1_priority_bitmap.pix(y); - uint8_t* pix2ptr = &m_pal2_pix_bitmap.pix8(y); - uint8_t* pix1ptr = &m_pal1_pix_bitmap.pix8(y); + uint8_t *const pix2ptr = &m_pal2_pix_bitmap.pix(y); + uint8_t *const pix1ptr = &m_pal1_pix_bitmap.pix(y); int shift_amount, mask, bytes_in; @@ -5042,12 +5042,12 @@ uint32_t vt_vt1682_state::screen_update(screen_device& screen, bitmap_rgb32& bit for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const pen_t* paldata = m_palette->pens(); - uint8_t* pri2ptr = &m_pal2_priority_bitmap.pix8(y); - uint8_t* pri1ptr = &m_pal1_priority_bitmap.pix8(y); - uint8_t* pix2ptr = &m_pal2_pix_bitmap.pix8(y); - uint8_t* pix1ptr = &m_pal1_pix_bitmap.pix8(y); - uint32_t* dstptr = &bitmap.pix32(y); + pen_t const *const paldata = m_palette->pens(); + uint8_t const *const pri2ptr = &m_pal2_priority_bitmap.pix(y); + uint8_t const *const pri1ptr = &m_pal1_priority_bitmap.pix(y); + uint8_t const *const pix2ptr = &m_pal2_pix_bitmap.pix(y); + uint8_t const *const pix1ptr = &m_pal1_pix_bitmap.pix(y); + uint32_t *const dstptr = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { @@ -6236,12 +6236,12 @@ CONS( 200?, dance555, 0, 0, vt1682_exsportp, dance555, vt1682_exsport_state // manual explicitly states it has NTSC output only (unit can be connected to a TV) and both Ranning Horse + Explosion (Bomberman) are the NTSC versions // has 21.477 Mhz XTAL -CONS( 200?, njp60in1, 0, 0, vt1682_lxts3, njp60in1, vt1682_lxts3_state, njp60in1_init, "<unknown>", "NJ Pocket 60-in-1 handheld 'X zero' (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) // needs high colour line mode for main menu +CONS( 200?, njp60in1, 0, 0, vt1682_lxts3, njp60in1, vt1682_lxts3_state, njp60in1_init, "<unknown>", "NJ Pocket 60-in-1 handheld 'X zero' (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) // RNG + linescroll issues // this appears to be related to the NJ Pocket, claims 101-in-1 but has some duplicates. // Like the 'Wow Wireless gaming' it incorrectly mixes the PAL version of 'Ranning Horse' with the NTSC version of 'Bomberman', it has no TV output. // has 26.6017 Mhz (6xPAL) XTAL -CONS( 200?, unk1682, 0, 0, vt1682_unk1682, lxts3, vt1682_lxts3_state, unk1682_init, "<unknown>", "unknown VT1682-based 101-in-1 handheld (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) // needs high colour line mode for main menu +CONS( 200?, unk1682, 0, 0, vt1682_unk1682, lxts3, vt1682_lxts3_state, unk1682_init, "<unknown>", "unknown VT1682-based 101-in-1 handheld (PAL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) // RNG + linescroll issues -CONS( 2010, lxts3, 0, 0, vt1682_lxts3, lxts3, vt1682_lxts3_state, regular_init, "Lexibook", "Toy Story 3 (Lexibook)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // random number generation issues on 2 games, linescroll on racing games +CONS( 2010, lxts3, 0, 0, vt1682_lxts3, lxts3, vt1682_lxts3_state, regular_init, "Lexibook", "Toy Story 3 (Lexibook)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // RNG + linescroll issues diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp index b8a29a08829..c40cc146cf2 100644 --- a/src/mame/drivers/vt240.cpp +++ b/src/mame/drivers/vt240.cpp @@ -201,10 +201,7 @@ READ_LINE_MEMBER(vt240_state::i8085_sid_r) UPD7220_DISPLAY_PIXELS_MEMBER( vt240_state::hgdc_draw ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - int xi, gfx1, gfx2; - uint8_t vom; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(!BIT(m_reg0, 7)) { @@ -212,14 +209,14 @@ UPD7220_DISPLAY_PIXELS_MEMBER( vt240_state::hgdc_draw ) vram_w((0x20000 + address) >> 1, 0); } - gfx1 = m_video_ram[(address & 0x7fff) >> 1]; - gfx2 = m_video_ram[((address & 0x7fff) + 0x8000) >> 1]; + int const gfx1 = m_video_ram[(address & 0x7fff) >> 1]; + int const gfx2 = m_video_ram[((address & 0x7fff) + 0x8000) >> 1]; - bool color = m_monitor->read() ? true : false; - for(xi=0;xi<16;xi++) + bool const color = m_monitor->read() ? true : false; + for(int xi=0;xi<16;xi++) { - vom = BIT(gfx1, xi) | (BIT(gfx2, xi) << 1) | ((m_reg0 & 3) << 2); - bitmap.pix32(y, x + xi) = palette[color ? (vom + 16) : vom]; + uint8_t const vom = BIT(gfx1, xi) | (BIT(gfx2, xi) << 1) | ((m_reg0 & 3) << 2); + bitmap.pix(y, x + xi) = palette[color ? (vom + 16) : vom]; } } diff --git a/src/mame/drivers/vta2000.cpp b/src/mame/drivers/vta2000.cpp index 974bd16f0d0..db6f3cea898 100644 --- a/src/mame/drivers/vta2000.cpp +++ b/src/mame/drivers/vta2000.cpp @@ -100,29 +100,28 @@ void vta2000_state::machine_reset() uint32_t vta2000_state::screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) /* Cursor is missing. */ { - static uint8_t framecnt=0; - uint8_t y,ra,gfx,attr,fg,bg; - uint16_t sy=0,ma=0,x,xx=0,chr; + static uint8_t framecnt=0; // FIXME: static variable + uint16_t sy=0,ma=0; framecnt++; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - xx = ma << 1; - for (x = ma; x < ma + 80; x++) + uint16_t xx = ma << 1; + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[xx++]; - attr = m_p_videoram[xx++]; + uint16_t chr = m_p_videoram[xx++]; + uint8_t const attr = m_p_videoram[xx++]; if ((chr & 0x60)==0x60) chr+=256; - gfx = m_p_chargen[(chr<<4) | ra ]; - bg = 0; + uint8_t gfx = m_p_chargen[(chr<<4) | ra ]; + uint8_t fg, bg = 0; /* Process attributes */ if (BIT(attr, 4)) diff --git a/src/mame/drivers/vtech1.cpp b/src/mame/drivers/vtech1.cpp index bb69f550b54..934c86000ce 100644 --- a/src/mame/drivers/vtech1.cpp +++ b/src/mame/drivers/vtech1.cpp @@ -395,7 +395,7 @@ INPUT_PORTS_END MACHINE DRIVERS ***************************************************************************/ -static const int16_t speaker_levels[] = {-32768, 0, 32767, 0}; +static const double speaker_levels[] = {-1.0, 0.0, 1.0, 0.0}; void vtech1_state::laser110(machine_config &config) { diff --git a/src/mame/drivers/warpsped.cpp b/src/mame/drivers/warpsped.cpp index 53c6360c58d..fe66335c014 100644 --- a/src/mame/drivers/warpsped.cpp +++ b/src/mame/drivers/warpsped.cpp @@ -171,7 +171,7 @@ static void draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l, int colo { if (y >= 0 && y <= bitmap.height() - 1) { - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int h1 = x - l; int h2 = x + l; diff --git a/src/mame/drivers/warriorb.cpp b/src/mame/drivers/warriorb.cpp index d03e5dcb4fa..e6e013fcf1b 100644 --- a/src/mame/drivers/warriorb.cpp +++ b/src/mame/drivers/warriorb.cpp @@ -182,6 +182,7 @@ void warriorb_state::pancontrol_w(offs_t offset, u8 data) { filter_volume_device *flt = nullptr; offset &= 3; + offset ^= 1; switch (offset) { diff --git a/src/mame/drivers/wheelfir.cpp b/src/mame/drivers/wheelfir.cpp index 0a462c9f937..2443bdf0bf9 100644 --- a/src/mame/drivers/wheelfir.cpp +++ b/src/mame/drivers/wheelfir.cpp @@ -276,9 +276,6 @@ void wheelfir_state::wheelfir_blit_w(offs_t offset, uint16_t data, uint16_t mem_ if(!ACCESSING_BITS_8_15 && offset==0x6) //LSB only! { - int x,y; - - int direct_width=m_direct_write_x1-m_direct_write_x0+1; int direct_height=m_direct_write_y1-m_direct_write_y0+1; @@ -286,203 +283,197 @@ void wheelfir_state::wheelfir_blit_w(offs_t offset, uint16_t data, uint16_t mem_ if(direct_width>0 && direct_height>0) { - x= m_direct_write_idx % direct_width; - y = (m_direct_write_idx / direct_width) %direct_height; + int x = m_direct_write_idx % direct_width; + int y = (m_direct_write_idx / direct_width) % direct_height; x+=m_direct_write_x0; y+=m_direct_write_y0; if(x<512 && y <512) { - m_tmp_bitmap[LAYER_BG]->pix16(y, x) = sixdat; + m_tmp_bitmap[LAYER_BG]->pix(y, x) = sixdat; } } ++m_direct_write_idx; return; - } if(offset==0xf && data==0xffff) { m_maincpu->set_input_line(1, HOLD_LINE); - { - uint8_t *rom = memregion("gfx1")->base(); + uint8_t const *const rom = memregion("gfx1")->base(); - int width = m_screen->width(); - int height = m_screen->height(); + int width = m_screen->width(); + int height = m_screen->height(); - int src_x0=(m_blitter_data[0]>>8)+((m_blitter_data[6]&0x100)?256:0); - int src_y0=(m_blitter_data[2]>>8)+((m_blitter_data[6]&0x200)?256:0); + int src_x0=(m_blitter_data[0]>>8)+((m_blitter_data[6]&0x100)?256:0); + int src_y0=(m_blitter_data[2]>>8)+((m_blitter_data[6]&0x200)?256:0); - int dst_x0=(m_blitter_data[0]&0xff)+((m_blitter_data[7]&0x40)?256:0); - int dst_y0=(m_blitter_data[2]&0xff)+((m_blitter_data[7]&0x80)?256:0); + int dst_x0=(m_blitter_data[0]&0xff)+((m_blitter_data[7]&0x40)?256:0); + int dst_y0=(m_blitter_data[2]&0xff)+((m_blitter_data[7]&0x80)?256:0); - int dst_x1=(m_blitter_data[1]&0xff)+((m_blitter_data[9]&4)?256:0); - int dst_y1=(m_blitter_data[3]&0xff)+((m_blitter_data[9]&8)?256:0); + int dst_x1=(m_blitter_data[1]&0xff)+((m_blitter_data[9]&4)?256:0); + int dst_y1=(m_blitter_data[3]&0xff)+((m_blitter_data[9]&8)?256:0); - int x_dst_step=(m_blitter_data[7]&0x1)?1:-1; - int y_dst_step=(m_blitter_data[7]&0x2)?1:-1; + int x_dst_step=(m_blitter_data[7]&0x1)?1:-1; + int y_dst_step=(m_blitter_data[7]&0x2)?1:-1; - int x_src_step=(m_blitter_data[8]&0x4000)?1:-1; - int y_src_step=(m_blitter_data[8]&0x8000)?1:-1; + int x_src_step=(m_blitter_data[8]&0x4000)?1:-1; + int y_src_step=(m_blitter_data[8]&0x8000)?1:-1; - int page=((m_blitter_data[6])>>10)*0x40000; + int page=((m_blitter_data[6])>>10)*0x40000; - if(page>=0x400000) /* src set to unav. page before direct write to the framebuffer */ - { - m_direct_write_x0=dst_x0; - m_direct_write_x1=dst_x1; - m_direct_write_y0=dst_y0; - m_direct_write_y1=dst_y1; - m_direct_write_idx=0; + if(page>=0x400000) /* src set to unav. page before direct write to the framebuffer */ + { + m_direct_write_x0=dst_x0; + m_direct_write_x1=dst_x1; + m_direct_write_y0=dst_y0; + m_direct_write_y1=dst_y1; + m_direct_write_idx=0; + } + if(x_dst_step<0) + { + if(dst_x0<=dst_x1) + { + return; } - if(x_dst_step<0) + } + else + { + if(dst_x0>=dst_x1) { - if(dst_x0<=dst_x1) - { - return; - } - + return; } - else - { - if(dst_x0>=dst_x1) - { - return; - } - } + } - if(y_dst_step<0) + if(y_dst_step<0) + { + if(dst_y0<=dst_y1) { - if(dst_y0<=dst_y1) - { - return; - } + return; } - else + } + else + { + if(dst_y0>=dst_y1) { - if(dst_y0>=dst_y1) - { - return; - } - + return; } + } - //additional checks - - int d1, d2, hflag, dflag, index; - d1=((m_blitter_data[0x0a]&0x1f00)>>8); + //additional checks - d2=((m_blitter_data[0x0b]&0x1f00)>>8); + int d1, d2, hflag, dflag, index; + d1=((m_blitter_data[0x0a]&0x1f00)>>8); - d1|=((m_blitter_data[0x8]&0x100)>>3); - d2|=((m_blitter_data[0x8]&0x400)>>5); - hflag=(m_blitter_data[0x9]&0x1)?1:0; - dflag=(m_blitter_data[0x8]&0x1000)?1:0; - index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + d2=((m_blitter_data[0x0b]&0x1f00)>>8); - float scale_x=get_scale(index); + d1|=((m_blitter_data[0x8]&0x100)>>3); + d2|=((m_blitter_data[0x8]&0x400)>>5); + hflag=(m_blitter_data[0x9]&0x1)?1:0; + dflag=(m_blitter_data[0x8]&0x1000)?1:0; + index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); - d1=((m_blitter_data[0x0b]&0xc000)>>14) | - ((m_blitter_data[0x0c]&0xc000)>>12) | - ((m_blitter_data[0x0a]&0x4000)>>10); + const float scale_x=get_scale(index); - d2=((m_blitter_data[0x0c]&0x1f00)>>8); + d1=((m_blitter_data[0x0b]&0xc000)>>14) | + ((m_blitter_data[0x0c]&0xc000)>>12) | + ((m_blitter_data[0x0a]&0x4000)>>10); - d1|=((m_blitter_data[0x8]&0x200)>>4); - d2|=((m_blitter_data[0x8]&0x800)>>6); + d2=((m_blitter_data[0x0c]&0x1f00)>>8); - hflag=(m_blitter_data[0x9]&0x2)?1:0; - dflag=(m_blitter_data[0x8]&0x2000)?1:0; - index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + d1|=((m_blitter_data[0x8]&0x200)>>4); + d2|=((m_blitter_data[0x8]&0x800)>>6); - float scale_y=get_scale(index); + hflag=(m_blitter_data[0x9]&0x2)?1:0; + dflag=(m_blitter_data[0x8]&0x2000)?1:0; + index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + const float scale_y=get_scale(index); - if(scale_x==0 || scale_y==0) return; + if(scale_x==0 || scale_y==0) return; - float scale_x_step=100.f/scale_x; - float scale_y_step=100.f/scale_y; + const float scale_x_step=100.f/scale_x; + const float scale_y_step=100.f/scale_y; - int x,y; - float idx_x,idx_y; - int vpage=LAYER_FG; - if(m_blitter_data[0x7]&0x10) - { - vpage=LAYER_BG; + int vpage=LAYER_FG; + if(m_blitter_data[0x7]&0x10) + { + vpage=LAYER_BG; /* - printf("%s bg -> %d %d %d %d %d %d @ %x\n",machine().describe_context().c_str(), dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0); + printf("%s bg -> %d %d %d %d %d %d @ %x\n",machine().describe_context().c_str(), dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0); - for(int i=0;i<16;++i) - { - printf("%x = %.4x\n",i,m_blitter_data[i]); - } + for(int i=0;i<16;++i) + { + printf("%x = %.4x\n",i,m_blitter_data[i]); + } - printf("\n"); + printf("\n"); */ - } + } - bool endx=false; - bool endy=false; + bool endx=false; + bool endy=false; - if(m_blitter_data[0x7]&0x0c) - { - //??? - } + if(m_blitter_data[0x7]&0x0c) + { + //??? + } - for( x=dst_x0, idx_x=0 ; !endx;x+=x_dst_step, idx_x+=scale_x_step ) + float idx_x = 0; + for(int x=dst_x0; !endx; x+=x_dst_step, idx_x+=scale_x_step) + { + endy=false; + float idx_y = 0; + for(int y=dst_y0; !endy; y+=y_dst_step, idx_y+=scale_y_step) { - endy=false; - for( y=dst_y0, idx_y=0 ; !endy;y+=y_dst_step, idx_y+=scale_y_step) - { - endx=(x==dst_x1); - endy=(y==dst_y1); + endx=(x==dst_x1); + endy=(y==dst_y1); - int xx=src_x0+x_src_step*idx_x; - int yy=src_y0+y_src_step*idx_y; + int xx=src_x0+x_src_step*idx_x; + int yy=src_y0+y_src_step*idx_y; - int address=page+yy*512+xx; + int address=page+yy*512+xx; - int pix = rom[address&(0x1000000-1)]; + int pix = rom[address&(0x1000000-1)]; - int screen_x=x; - int screen_y=y; + int screen_x=x; + int screen_y=y; - if(page>=0x400000) + if(page>=0x400000) + { + //hack for clear + if(screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) { - //hack for clear - if(screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) - { - // m_tmp_bitmap[vpage]->pix16(screen_y , screen_x ) =0; - } + // m_tmp_bitmap[vpage]->pix(screen_y , screen_x ) =0; } - else - { - if (vpage == LAYER_FG) screen_y&=0xff; + } + else + { + if (vpage == LAYER_FG) screen_y&=0xff; - if(pix && screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) - { - m_tmp_bitmap[vpage]->pix16(screen_y , screen_x ) = pix; - } + if(pix && screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) + { + m_tmp_bitmap[vpage]->pix(screen_y, screen_x) = pix; } } } @@ -502,22 +493,19 @@ uint32_t wheelfir_state::screen_update_wheelfir(screen_device &screen, bitmap_in for(int y=cliprect.min_y; y < cliprect.max_y; y++) { - uint16_t *source = &m_tmp_bitmap[LAYER_BG]->pix16(( (m_scanlines[y].y)&511)); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const source = &m_tmp_bitmap[LAYER_BG]->pix(( (m_scanlines[y].y)&511)); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x < cliprect.max_x; x++) { - dest[x] = source[ (x+(m_scanlines[y].x)) &511]; + dest[x] = source[(x + m_scanlines[y].x) & 511]; } } copybitmap_trans(bitmap, *m_tmp_bitmap[LAYER_FG], 0, 0, 0, 0, cliprect, 0); /* - { - m_tmp_bitmap[LAYER_BG]->fill(0, screen.visible_area()); - - } + m_tmp_bitmap[LAYER_BG]->fill(0, screen.visible_area()); */ return 0; diff --git a/src/mame/drivers/wicat.cpp b/src/mame/drivers/wicat.cpp index 7c273fc5b04..32283d00bfc 100644 --- a/src/mame/drivers/wicat.cpp +++ b/src/mame/drivers/wicat.cpp @@ -623,13 +623,13 @@ WRITE_LINE_MEMBER(wicat_state::crtc_irq_clear_w) I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels) { uint8_t romdata = vsp ? 0 : m_chargen->base()[(charcode << 4) | linecount]; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < 10; i++) { int color = ((romdata & 0xc0) != 0) ^ rvv; - bitmap.pix32(y, x + i) = pen[color]; + bitmap.pix(y, x + i) = pen[color]; romdata <<= 1; } } diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp index 7bd361178da..a47f2195678 100644 --- a/src/mame/drivers/williams.cpp +++ b/src/mame/drivers/williams.cpp @@ -1904,7 +1904,8 @@ void joust2_state::joust2(machine_config &config) // basic machine hardware m_maincpu->set_addrmap(AS_PROGRAM, &joust2_state::d000_map); - WILLIAMS_CVSD_SOUND(config, m_cvsd_sound).add_route(ALL_OUTPUTS, "speaker", 1.0); + S11_OBG(config, m_bg).add_route(ALL_OUTPUTS, "speaker", 2.0); // D-11298-3035 'pinbot style' older BG sound board + // Jumpers for the board: W1=? W2=open W3=present W4=open W5=open W6=open W7=present // pia m_pia[0]->readpa_handler().set_ioport("IN0").mask(0xf0); @@ -1912,12 +1913,16 @@ void joust2_state::joust2(machine_config &config) m_pia[0]->ca2_handler().set("mux", FUNC(ls157_device::select_w)); m_pia[1]->readpa_handler().set_ioport("IN2"); - m_pia[1]->writepb_handler().set(FUNC(joust2_state::snd_cmd_w)); - m_pia[1]->ca2_handler().set(FUNC(joust2_state::pia_3_cb1_w)); + m_pia[1]->writepb_handler().set(FUNC(joust2_state::snd_cmd_w)); // this goes both to the sound cpu AND to the s11 bg cpu + m_pia[1]->ca2_handler().set(FUNC(joust2_state::pia_s11_bg_strobe_w)); m_pia[1]->cb2_handler().set(m_pia[2], FUNC(pia6821_device::ca1_w)); m_pia[1]->irqa_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<0>)); m_pia[1]->irqb_handler().set("mainirq", FUNC(input_merger_any_high_device::in_w<1>)); + // these (and ca2 above) are educated guesses, as we have no schematics for joust 2's pcb which has the 20 pin system 11 bg sound connector on it; inferno, which we have schematics to, lacks this connector. All of pia[1] ca2, pia[2] cb1, and pia[2] cb2 are unconnected/grounded on inferno. + m_bg->cb2_cb().set(m_pia[2], FUNC(pia6821_device::cb1_w)); + m_pia[2]->cb2_handler().set(m_bg, FUNC(s11_obg_device::resetq_w)); // inverted? + LS157(config, m_mux, 0); m_mux->a_in_callback().set_ioport("INP1"); m_mux->b_in_callback().set_ioport("INP2"); @@ -2345,7 +2350,7 @@ Stargate ROM labels are in this format: +--------------------+ Solid Yellow (Black print) 3002-1 through 3002-12 - ROM type A, 2532 -Solid Yellow (Green print) 3002-13 through 3002-24 - ROM type B, 2732 +Solid Yellow (Green print) 3002-13 through 3002-24 - ROM type B, 2732 | Black print | Green print Part Number | ROM# Number | ROM# Number @@ -3518,19 +3523,19 @@ ROM_START( joust2 ) ROM_LOAD( "cpu_2764_ic8_rom1_rev1.0f", 0x0E000, 0x2000, CRC(84517c3c) SHA1(de0b6473953783c091ddcc7aaa89fc1ec3b9d378) ) // sound board - ROM_REGION( 0x90000, "cvsd:cpu", 0 ) - ROM_LOAD( "snd_27256_rom23_rev1.u4", 0x10000, 0x8000, CRC(3af6b47d) SHA1(aff19d65a4d9c249dec6a9e04a4066fada0f8fa1) ) + ROM_REGION( 0x80000, "bg:cpu", 0 ) + ROM_LOAD( "snd_27256_rom23_rev1.u4", 0x00000, 0x8000, CRC(3af6b47d) SHA1(aff19d65a4d9c249dec6a9e04a4066fada0f8fa1) ) + ROM_RELOAD( 0x08000, 0x8000 ) + ROM_RELOAD( 0x10000, 0x8000 ) ROM_RELOAD( 0x18000, 0x8000 ) - ROM_RELOAD( 0x20000, 0x8000 ) + ROM_LOAD( "snd_27256_rom24_rev1.u19", 0x20000, 0x8000, CRC(e7f9ed2e) SHA1(6b9ef5189650f0b6b2866da7f532cdf851f02ead) ) ROM_RELOAD( 0x28000, 0x8000 ) - ROM_LOAD( "snd_27256_rom24_rev1.u19", 0x30000, 0x8000, CRC(e7f9ed2e) SHA1(6b9ef5189650f0b6b2866da7f532cdf851f02ead) ) + ROM_RELOAD( 0x30000, 0x8000 ) ROM_RELOAD( 0x38000, 0x8000 ) - ROM_RELOAD( 0x40000, 0x8000 ) + ROM_LOAD( "snd_27256_rom25_rev1.u20", 0x40000, 0x8000, CRC(c85b29f7) SHA1(b37e1890bd0dfa0c7db19fc878450718b60c1ca0) ) ROM_RELOAD( 0x48000, 0x8000 ) - ROM_LOAD( "snd_27256_rom25_rev1.u20", 0x50000, 0x8000, CRC(c85b29f7) SHA1(b37e1890bd0dfa0c7db19fc878450718b60c1ca0) ) + ROM_RELOAD( 0x50000, 0x8000 ) ROM_RELOAD( 0x58000, 0x8000 ) - ROM_RELOAD( 0x60000, 0x8000 ) - ROM_RELOAD( 0x68000, 0x8000 ) ROM_REGION( 0xc000, "gfx1", 0 ) ROM_LOAD( "vid_27128_ic57_rom20_rev1.8f", 0x00000, 0x4000, CRC(572c6b01) SHA1(651df3223c1dc42543f57a7204ae492eb15a4999) ) @@ -3574,19 +3579,19 @@ ROM_START( joust2r1 ) ROM_LOAD( "cpu_2764_ic8_rom1_rev1.0f", 0x0E000, 0x2000, CRC(84517c3c) SHA1(de0b6473953783c091ddcc7aaa89fc1ec3b9d378) ) // sound board - ROM_REGION( 0x90000, "cvsd:cpu", 0 ) - ROM_LOAD( "snd_27256_rom23_rev1.u4", 0x10000, 0x8000, CRC(3af6b47d) SHA1(aff19d65a4d9c249dec6a9e04a4066fada0f8fa1) ) + ROM_REGION( 0x80000, "bg:cpu", 0 ) + ROM_LOAD( "snd_27256_rom23_rev1.u4", 0x00000, 0x8000, CRC(3af6b47d) SHA1(aff19d65a4d9c249dec6a9e04a4066fada0f8fa1) ) + ROM_RELOAD( 0x08000, 0x8000 ) + ROM_RELOAD( 0x10000, 0x8000 ) ROM_RELOAD( 0x18000, 0x8000 ) - ROM_RELOAD( 0x20000, 0x8000 ) + ROM_LOAD( "snd_27256_rom24_rev1.u19", 0x20000, 0x8000, CRC(e7f9ed2e) SHA1(6b9ef5189650f0b6b2866da7f532cdf851f02ead) ) ROM_RELOAD( 0x28000, 0x8000 ) - ROM_LOAD( "snd_27256_rom24_rev1.u19", 0x30000, 0x8000, CRC(e7f9ed2e) SHA1(6b9ef5189650f0b6b2866da7f532cdf851f02ead) ) + ROM_RELOAD( 0x30000, 0x8000 ) ROM_RELOAD( 0x38000, 0x8000 ) - ROM_RELOAD( 0x40000, 0x8000 ) + ROM_LOAD( "snd_27256_rom25_rev1.u20", 0x40000, 0x8000, CRC(c85b29f7) SHA1(b37e1890bd0dfa0c7db19fc878450718b60c1ca0) ) ROM_RELOAD( 0x48000, 0x8000 ) - ROM_LOAD( "snd_27256_rom25_rev1.u20", 0x50000, 0x8000, CRC(c85b29f7) SHA1(b37e1890bd0dfa0c7db19fc878450718b60c1ca0) ) + ROM_RELOAD( 0x50000, 0x8000 ) ROM_RELOAD( 0x58000, 0x8000 ) - ROM_RELOAD( 0x60000, 0x8000 ) - ROM_RELOAD( 0x68000, 0x8000 ) ROM_REGION( 0xc000, "gfx1", 0 ) ROM_LOAD( "vid_27128_ic57_rom20_rev1.8f", 0x00000, 0x4000, CRC(572c6b01) SHA1(651df3223c1dc42543f57a7204ae492eb15a4999) ) diff --git a/src/mame/drivers/wpc_dot.cpp b/src/mame/drivers/wpc_dot.cpp index 8dc47fb4784..0b677efd3a6 100644 --- a/src/mame/drivers/wpc_dot.cpp +++ b/src/mame/drivers/wpc_dot.cpp @@ -249,22 +249,21 @@ WRITE_LINE_MEMBER(wpc_dot_state::wpc_firq_w) uint32_t wpc_dot_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y,bit; uint32_t offset = (m_wpc->get_visible_page() * 0x200); - uint32_t col; - for(y=0;y<32;y++) // scanline + for(uint8_t y=0;y<32;y++) // scanline { - for(x=0;x<128;x+=8) // column + for(uint8_t x=0;x<128;x+=8) // column { - for(bit=0;bit<8;bit++) // bits + for(uint8_t bit=0;bit<8;bit++) // bits { assert(offset >= 0 && offset < ARRAY_LENGTH(m_dmdram)); + uint32_t col; if(m_dmdram[offset] & (1<<bit)) col = rgb_t(0xff,0xaa,0x00); else col = rgb_t(0x00,0x00,0x00); - bitmap.pix32(y,x+bit) = col; + bitmap.pix(y,x+bit) = col; } offset++; } diff --git a/src/mame/drivers/wrally.cpp b/src/mame/drivers/wrally.cpp index 810c7dc07ba..f8d3f7aa43f 100644 --- a/src/mame/drivers/wrally.cpp +++ b/src/mame/drivers/wrally.cpp @@ -146,20 +146,21 @@ void wrally_state::mcu_hostmem_map(address_map &map) void wrally_state::wrally_map(address_map &map) { - map(0x000000, 0x0fffff).rom(); /* ROM */ - map(0x100000, 0x103fff).ram().w(FUNC(wrally_state::vram_w)).share("videoram"); /* encrypted Video RAM */ - map(0x108000, 0x108007).ram().share("vregs"); /* Video Registers */ - map(0x10800c, 0x10800d).nopw(); /* CLR INT Video */ - map(0x200000, 0x203fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); /* Palette */ - map(0x440000, 0x440fff).ram().share("spriteram"); /* Sprite RAM */ + map(0x000000, 0x0fffff).rom(); // ROM + map(0x100000, 0x103fff).ram().w(FUNC(wrally_state::vram_w)).share("videoram"); // Encrypted Video RAM + map(0x108000, 0x108007).ram().share("vregs"); // Video Registers + map(0x10800c, 0x10800d).nopw(); // CLR INT Video + map(0x200000, 0x203fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette + + map(0x440000, 0x440fff).ram().share("spriteram"); // Sprite RAM map(0x700000, 0x700001).portr("DSW"); map(0x700002, 0x700003).portr("P1_P2"); map(0x700004, 0x700005).portr("WHEEL"); map(0x700008, 0x700009).portr("SYSTEM"); map(0x70000b, 0x70000b).select(0x000070).lw8(NAME([this] (offs_t offset, u8 data) { m_outlatch->write_d0(offset >> 4, data); })); - map(0x70000d, 0x70000d).w(FUNC(wrally_state::okim6295_bankswitch_w)); /* OKI6295 bankswitch */ - map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status/data register */ - map(0xfec000, 0xfeffff).ram().share("shareram"); /* Work RAM (shared with DS5002FP) */ + map(0x70000d, 0x70000d).w(FUNC(wrally_state::okim6295_bankswitch_w)); // OKI6295 bankswitch + map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // OKI6295 status/data register + map(0xfec000, 0xfeffff).ram().share("shareram"); // Work RAM (shared with DS5002FP) } @@ -241,15 +242,15 @@ static INPUT_PORTS_START( wrally ) PORT_START("SYSTEM") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE2 ) /* Go to test mode NOW */ + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE2 ) // Go to test mode NOW PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END static const gfx_layout wrally_tilelayout16 = { - 16,16, /* 16x16 tiles */ - RGN_FRAC(1,2), /* number of tiles */ - 4, /* 4 bpp */ + 16,16, // 16x16 tiles + RGN_FRAC(1,2), // number of tiles + 4, // 4 bpp { RGN_FRAC(1,2)+8, RGN_FRAC(1,2)+0, 8, 0 }, { STEP8(0,1), STEP8(16*16,1) }, { STEP16(0,16) }, @@ -263,19 +264,19 @@ GFXDECODE_END void wrally_state::wrally(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(24'000'000)/2); /* verified on pcb */ + // Basic machine hardware + M68000(config, m_maincpu, XTAL(24'000'000)/2); // Verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &wrally_state::wrally_map); m_maincpu->set_vblank_int("screen", FUNC(wrally_state::irq6_line_hold)); - gaelco_ds5002fp_device &ds5002(GAELCO_DS5002FP(config, "gaelco_ds5002fp", XTAL(24'000'000) / 2)); /* verified on pcb */ + gaelco_ds5002fp_device &ds5002(GAELCO_DS5002FP(config, "gaelco_ds5002fp", XTAL(24'000'000) / 2)); // verified on PCB ds5002.set_addrmap(0, &wrally_state::mcu_hostmem_map); config.set_perfect_quantum("gaelco_ds5002fp:mcu"); - /* video hardware */ + // Video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // Not accurate screen.set_size(64*16, 32*16); screen.set_visarea(8, 24*16-8-1, 16, 16*16-8-1); screen.set_screen_update(FUNC(wrally_state::screen_update)); @@ -293,30 +294,30 @@ void wrally_state::wrally(machine_config &config) m_outlatch->q_out_cb<1>().set(FUNC(wrally_state::coin2_lockout_w)); m_outlatch->q_out_cb<2>().set(FUNC(wrally_state::coin1_counter_w)); m_outlatch->q_out_cb<3>().set(FUNC(wrally_state::coin2_counter_w)); - m_outlatch->q_out_cb<4>().set_nop(); /* Sound muting */ - m_outlatch->q_out_cb<5>().set(FUNC(wrally_state::flipscreen_w)); /* Flip screen */ - m_outlatch->q_out_cb<6>().set_nop(); /* ??? */ - m_outlatch->q_out_cb<7>().set_nop(); /* ??? */ + m_outlatch->q_out_cb<4>().set_nop(); // Sound muting + m_outlatch->q_out_cb<5>().set(FUNC(wrally_state::flipscreen_w)); // Flip screen + m_outlatch->q_out_cb<6>().set_nop(); // ??? + m_outlatch->q_out_cb<7>().set_nop(); // ??? - /* sound hardware */ + // Sound hardware SPEAKER(config, "mono").front_center(); - okim6295_device &oki(OKIM6295(config, "oki", XTAL(1'000'000), okim6295_device::PIN7_HIGH)); /* verified on pcb */ + okim6295_device &oki(OKIM6295(config, "oki", XTAL(1'000'000), okim6295_device::PIN7_HIGH)); // verified on PCB oki.set_addrmap(0, &wrally_state::oki_map); oki.add_route(ALL_OUTPUTS, "mono", 1.0); } ROM_START( wrally ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "worldr17.c23", 0x000000, 0x080000, CRC(050f5629) SHA1(74fc2cd5114f3bc4b2429f1d8d7eeb1658f9f179) ) /* Only difference compared to set 2 is how the Dallas DS5002FP */ - ROM_LOAD16_BYTE( "worldr16.c22", 0x000001, 0x080000, CRC(9e0d126c) SHA1(369360b7ec2c3497af3bf62b4eba24c3d9f94675) ) /* power failure shows on screen, IE: "Tension baja " */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "worldr17.c23", 0x000000, 0x080000, CRC(050f5629) SHA1(74fc2cd5114f3bc4b2429f1d8d7eeb1658f9f179) ) // Only difference compared to set 2 is how the Dallas DS5002FP + ROM_LOAD16_BYTE( "worldr16.c22", 0x000001, 0x080000, CRC(9e0d126c) SHA1(369360b7ec2c3497af3bf62b4eba24c3d9f94675) ) // Power failure shows on screen, IE: "Tension baja" - ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) // DS5002FP code ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) - /* these are the default states stored in NVRAM */ + // These are the default states stored in NVRAM DS5002FP_SET_MON( 0x88 ) DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) @@ -327,29 +328,29 @@ ROM_START( wrally ) ROM_LOAD16_BYTE( "worldr19.i09", 0x100000, 0x080000, CRC(018b35bb) SHA1(ca789e23d18cc7d7e48b6858e6b61e03bf88b475) ) ROM_LOAD16_BYTE( "worldr18.i07", 0x100001, 0x080000, CRC(b37c807e) SHA1(9e6155a2b5206c0d4dca669d24d9fe9830027651) ) - ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_REGION( 0x100000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 ROM_LOAD( "worldr14.c01", 0x000000, 0x080000, CRC(e931c2ee) SHA1(ea1cf8ad52713e5136a370e289567eea9e6403d6) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + // 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs ROM_LOAD( "worldr15.c03", 0x080000, 0x080000, CRC(11f0fe2c) SHA1(96c2a04874fa036576b7cfc5559bb0e33582ffd2) ) - ROM_REGION( 0x0514, "plds", 0 ) /* PAL's and GAL's */ - ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x0104, NO_DUMP ) + ROM_REGION( 0x0514, "plds", 0 ) // PALs and GALs + ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x02e5, BAD_DUMP CRC(a1c780ed) SHA1(91dc230d94c992c4c4516554c0faeced41e1e34e) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "gal16v8-25lnc.h21", 0x0000, 0x0104, NO_DUMP ) - ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x02e5, BAD_DUMP CRC(a39efdc6) SHA1(bf86f764665531639076dfcc72583457f1cbf806) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "pal16r4-e2.bin", 0x0000, 0x0104, CRC(15fee75c) SHA1(b9ee5121dd41f2535d9abd78ff5fcfeaa1ac6b62) ) ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) ROM_END ROM_START( wrallya ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "c23.bin", 0x000000, 0x080000, CRC(8b7d93c3) SHA1(ce4163eebc5d4a0c1266d650523b1ffc702d1b87) ) /* Only difference compared to set 1 is how the Dallas DS5002FP */ - ROM_LOAD16_BYTE( "c22.bin", 0x000001, 0x080000, CRC(56da43b6) SHA1(02db8f969ed5e7f5e5356c45c0312faf5f000335) ) /* power failure shows on screen, IE: "Power Failure" */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "c23.bin", 0x000000, 0x080000, CRC(8b7d93c3) SHA1(ce4163eebc5d4a0c1266d650523b1ffc702d1b87) ) // Only difference compared to set 1 is how the Dallas DS5002FP + ROM_LOAD16_BYTE( "c22.bin", 0x000001, 0x080000, CRC(56da43b6) SHA1(02db8f969ed5e7f5e5356c45c0312faf5f000335) ) // power failure shows on screen, IE: "Power Failure" - ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) // DS5002FP code ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) - /* these are the default states stored in NVRAM */ + // These are the default states stored in NVRAM DS5002FP_SET_MON( 0x88 ) DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) @@ -360,79 +361,79 @@ ROM_START( wrallya ) ROM_LOAD16_BYTE( "worldr19.i09", 0x100000, 0x080000, CRC(018b35bb) SHA1(ca789e23d18cc7d7e48b6858e6b61e03bf88b475) ) ROM_LOAD16_BYTE( "worldr18.i07", 0x100001, 0x080000, CRC(b37c807e) SHA1(9e6155a2b5206c0d4dca669d24d9fe9830027651) ) - ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ + ROM_REGION( 0x100000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 ROM_LOAD( "worldr14.c01", 0x000000, 0x080000, CRC(e931c2ee) SHA1(ea1cf8ad52713e5136a370e289567eea9e6403d6) ) - /* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */ + // 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs ROM_LOAD( "worldr15.c03", 0x080000, 0x080000, CRC(11f0fe2c) SHA1(96c2a04874fa036576b7cfc5559bb0e33582ffd2) ) - ROM_REGION( 0x0514, "plds", 0 ) /* PAL's and GAL's */ - ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x0104, NO_DUMP ) + ROM_REGION( 0x0514, "plds", 0 ) // PALs and GALs + ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x02e5, BAD_DUMP CRC(a1c780ed) SHA1(91dc230d94c992c4c4516554c0faeced41e1e34e) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "gal16v8-25lnc.h21", 0x0000, 0x0104, NO_DUMP ) - ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x02e5, BAD_DUMP CRC(a39efdc6) SHA1(bf86f764665531639076dfcc72583457f1cbf806) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "pal16r4-e2.bin", 0x0000, 0x0104, CRC(15fee75c) SHA1(b9ee5121dd41f2535d9abd78ff5fcfeaa1ac6b62) ) ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) ROM_END ROM_START( wrallyb ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "rally_c23.c23", 0x000000, 0x080000, CRC(ddd6f833) SHA1(f12f82c412fa93f46020d50c2620974ae2fb502b) ) ROM_LOAD16_BYTE( "rally_c22.c22", 0x000001, 0x080000, CRC(59a0d35c) SHA1(7c6f376a53c1e6d793cbfb16861ee3298ee013a1) ) - ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) // DS5002FP code ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) - /* these are the default states stored in NVRAM */ + // These are the default states stored in NVRAM DS5002FP_SET_MON( 0x88 ) DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) ROM_REGION( 0x200000, "gfx1", 0 ) - ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) /* Same data, different layout */ + ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) // Same data, different layout ROM_LOAD( "rally h-8.h8", 0x100000, 0x100000, CRC(58dcd024) SHA1(384ff296d3c7c8e0c4469231d1940de3cea89fc2) ) - ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ - ROM_LOAD( "sound c-1.c1", 0x000000, 0x100000, CRC(2d69c9b8) SHA1(328cb3c928dc6921c0c3f0277f59bca6c747c504) ) /* Same data in a single rom */ + ROM_REGION( 0x100000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 + ROM_LOAD( "sound c-1.c1", 0x000000, 0x100000, CRC(2d69c9b8) SHA1(328cb3c928dc6921c0c3f0277f59bca6c747c504) ) // Same data in a single ROM - ROM_REGION( 0x0514, "plds", 0 ) /* PAL's and GAL's */ - ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x0104, NO_DUMP ) + ROM_REGION( 0x0514, "plds", 0 ) // PALs and GALs + ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x02e5, BAD_DUMP CRC(a1c780ed) SHA1(91dc230d94c992c4c4516554c0faeced41e1e34e) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "gal16v8-25lnc.h21", 0x0000, 0x0104, NO_DUMP ) - ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x02e5, BAD_DUMP CRC(a39efdc6) SHA1(bf86f764665531639076dfcc72583457f1cbf806) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "pal16r4-e2.bin", 0x0000, 0x0104, CRC(15fee75c) SHA1(b9ee5121dd41f2535d9abd78ff5fcfeaa1ac6b62) ) ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) ROM_END -ROM_START( wrallyat ) /* Board Marked 930217, Atari License */ - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code */ - ROM_LOAD16_BYTE( "rally.c23", 0x000000, 0x080000, CRC(366595ad) SHA1(e16341ed9eacf9b729c28184268150ea9b62f185) ) /* North & South America only... */ +ROM_START( wrallyat ) // Board Marked 930217, Atari License + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "rally.c23", 0x000000, 0x080000, CRC(366595ad) SHA1(e16341ed9eacf9b729c28184268150ea9b62f185) ) // North & South America only... ROM_LOAD16_BYTE( "rally.c22", 0x000001, 0x080000, CRC(0ad4ec6f) SHA1(991557cf25fe960b1c586e990e6019befe5a11d0) ) - ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) /* DS5002FP code */ + ROM_REGION( 0x8000, "gaelco_ds5002fp:sram", 0 ) // DS5002FP code ROM_LOAD( "wrdallas.bin", 0x00000, 0x8000, CRC(547d1768) SHA1(c58d1edd072d796be0663fb265f4739ec006b688) ) ROM_REGION( 0x100, "gaelco_ds5002fp:mcu:internal", ROMREGION_ERASE00 ) - /* these are the default states stored in NVRAM */ + // These are the default states stored in NVRAM DS5002FP_SET_MON( 0x88 ) DS5002FP_SET_RPCTL( 0x00 ) DS5002FP_SET_CRCR( 0x80 ) ROM_REGION( 0x200000, "gfx1", 0 ) - ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) /* Same data, different layout */ + ROM_LOAD( "rally h-12.h12", 0x000000, 0x100000, CRC(3353dc00) SHA1(db3b1686751dcaa231d66c08b5be81fcfe299ad9) ) // Same data, different layout ROM_LOAD( "rally h-8.h8", 0x100000, 0x100000, CRC(58dcd024) SHA1(384ff296d3c7c8e0c4469231d1940de3cea89fc2) ) - ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */ - ROM_LOAD( "sound c-1.c1", 0x000000, 0x100000, CRC(2d69c9b8) SHA1(328cb3c928dc6921c0c3f0277f59bca6c747c504) ) /* Same data in a single rom */ + ROM_REGION( 0x100000, "oki", 0 ) // ADPCM samples - sound chip is OKIM6295 + ROM_LOAD( "sound c-1.c1", 0x000000, 0x100000, CRC(2d69c9b8) SHA1(328cb3c928dc6921c0c3f0277f59bca6c747c504) ) // Same data in a single ROM - ROM_REGION( 0x0514, "plds", 0 ) /* PAL's and GAL's */ - ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x0104, NO_DUMP ) + ROM_REGION( 0x0514, "plds", 0 ) // PALs and GALs + ROM_LOAD( "tibpal20l8-25cnt.b23", 0x0000, 0x02e5, BAD_DUMP CRC(a1c780ed) SHA1(91dc230d94c992c4c4516554c0faeced41e1e34e) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "gal16v8-25lnc.h21", 0x0000, 0x0104, NO_DUMP ) - ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "tibpal20l8-25cnt.h15", 0x0000, 0x02e5, BAD_DUMP CRC(a39efdc6) SHA1(bf86f764665531639076dfcc72583457f1cbf806) ) // Bruteforced but verified (as GAL22V10) ROM_LOAD( "pal16r4-e2.bin", 0x0000, 0x0104, CRC(15fee75c) SHA1(b9ee5121dd41f2535d9abd78ff5fcfeaa1ac6b62) ) ROM_LOAD( "pal16r8-b15.bin", 0x0000, 0x0104, CRC(b50337a6) SHA1(1f922753cb9982cad9a3c9246894ecd38273236e) ) ROM_END -GAME( 1993, wrally, 0, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 0E56)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Tension baja " */ -GAME( 1993, wrallya, wrally, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 3873)", MACHINE_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Power Failure" */ -GAME( 1993, wrallyb, wrally, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 8AA2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, wrallyat, wrally, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, wrally, 0, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 0E56)", MACHINE_SUPPORTS_SAVE ) // Dallas DS5002FP power failure shows as: "Tension baja" +GAME( 1993, wrallya, wrally, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 3873)", MACHINE_SUPPORTS_SAVE ) // Dallas DS5002FP power failure shows as: "Power Failure" +GAME( 1993, wrallyb, wrally, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco", "World Rally (Version 1.0, Checksum 8AA2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, wrallyat, wrally, wrally, wrally, wrally_state, empty_init, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/wswan.cpp b/src/mame/drivers/wswan.cpp index af411c7fb78..dc1cc0d09a5 100644 --- a/src/mame/drivers/wswan.cpp +++ b/src/mame/drivers/wswan.cpp @@ -2,7 +2,7 @@ // copyright-holders:Anthony Kruize,Wilbert Pol /*************************************************************************** - wswan.c + wswan.cpp Driver file to handle emulation of the Bandai WonderSwan By: @@ -12,85 +12,221 @@ Based on the WStech documentation by Judge and Dox. + Usage: + Keep START button pressed during startup (or reset) to enter the internal + configuration menu. + Known issues/TODOs: - - Get the V30MZ core into MAME, still need to remove some nec specific - instructions and fix the flags handling of the div/mul instructions. - - Add support for noise sound - - Add support for voice sound - - Add support for enveloped sound + - Add support for noise sound. + - Add support for voice sound. + - Add support for enveloped sound. - Perform video DMA at proper timing. - - Add sound DMA. - - Setup some reasonable values in the internal EEPROM area? - Add (real/proper) RTC support. - - Look into timing issues like in Puzzle Bobble. VBlank interrupt lasts very long - which causes sprites to be disabled until about 10%-40% of drawing the screen. - The real unit seems to display things fine, need a real unit + real cart to - verify. - - Is background color setting really ok? - - Get a dump of the internal BIOSes. - Swan Crystal can handle up to 512Mbit ROMs?????? - + - SRAM sizes should be in kbit instead of kbytes(?). This raises a few + interesting issues: + - mirror of smaller <64KBYTE/512kbit SRAM sizes + - banking when using 1M or 2M sram sizes + - The units likely came with the name "WONDERSWAN" configured in the + internal EEPOM ***************************************************************************/ #include "emu.h" -#include "includes/wswan.h" - +#include "cpu/v30mz/v30mz.h" +#include "machine/nvram.h" +#include "audio/wswan.h" +#include "video/wswan.h" +#include "bus/wswan/slot.h" +#include "bus/wswan/rom.h" +#include "emupal.h" +#include "render.h" #include "screen.h" #include "softlist.h" #include "speaker.h" #include "wswan.lh" -void wswan_state::wswan_mem(address_map &map) +#include <algorithm> + + +namespace { + +class wswan_state : public driver_device +{ +public: + wswan_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_vdp(*this, "vdp"), + m_sound(*this, "custom"), + m_cart(*this, "cartslot"), + m_region_maincpu(*this, "maincpu"), + m_cursx(*this, "CURSX"), + m_cursy(*this, "CURSY"), + m_buttons(*this, "BUTTONS") + { } + + void wswan(machine_config &config); + +protected: + // Interrupt flags + static const u8 WSWAN_IFLAG_STX = 0x01; + static const u8 WSWAN_IFLAG_KEY = 0x02; + static const u8 WSWAN_IFLAG_RTC = 0x04; + static const u8 WSWAN_IFLAG_SRX = 0x08; + static const u8 WSWAN_IFLAG_LCMP = 0x10; + static const u8 WSWAN_IFLAG_VBLTMR = 0x20; + static const u8 WSWAN_IFLAG_VBL = 0x40; + static const u8 WSWAN_IFLAG_HBLTMR = 0x80; + + // Interrupts + static const u8 WSWAN_INT_STX = 0; + static const u8 WSWAN_INT_KEY = 1; + static const u8 WSWAN_INT_RTC = 2; + static const u8 WSWAN_INT_SRX = 3; + static const u8 WSWAN_INT_LCMP = 4; + static const u8 WSWAN_INT_VBLTMR = 5; + static const u8 WSWAN_INT_VBL = 6; + static const u8 WSWAN_INT_HBLTMR = 7; + + static const u32 INTERNAL_EEPROM_SIZE = 1024; // 16kbit on WSC + static const u32 INTERNAL_EEPROM_SIZE_WS = 64; // 1kbit on WS + + enum enum_system { TYPE_WSWAN=0, TYPE_WSC }; + + struct sound_dma_t + { + sound_dma_t() { } + + u32 source = 0; // Source address + u16 size = 0; // Size + u8 enable = 0; // Enabled + }; + + required_device<cpu_device> m_maincpu; + required_device<wswan_video_device> m_vdp; + required_device<wswan_sound_device> m_sound; + required_device<ws_cart_slot_device> m_cart; + + u8 m_ws_portram[256]; + u8 m_internal_eeprom[INTERNAL_EEPROM_SIZE * 2]; + u8 m_system_type; + sound_dma_t m_sound_dma; + u8 m_bios_disabled; + u8 m_rotate; + + required_memory_region m_region_maincpu; + required_ioport m_cursx; + required_ioport m_cursy; + required_ioport m_buttons; + + u8 bios_r(offs_t offset); + u8 port_r(offs_t offset); + void port_w(offs_t offset, u8 data); + + void set_irq_line(int irq); + void dma_sound_cb(); + void common_start(); + virtual void machine_start() override; + virtual void machine_reset() override; + void palette(palette_device &palette) const; + + void io_map(address_map &map); + void mem_map(address_map &map); + void snd_map(address_map &map); + + void register_save(); + void handle_irqs(); + void clear_irq_line(int irq); + virtual u16 get_internal_eeprom_address(); +}; + +class wscolor_state : public wswan_state +{ +public: + using wswan_state::wswan_state; + void wscolor(machine_config &config); + +protected: + virtual void machine_start() override; + void mem_map(address_map &map); + void palette(palette_device &palette) const; + virtual u16 get_internal_eeprom_address() override; +}; + +static const uint8_t ws_portram_init[256] = +{ + 0x00, 0x00, 0x00/*?*/, 0xbb, 0x00, 0x00, 0x00, 0x26, 0xfe, 0xde, 0xf9, 0xfb, 0xdb, 0xd7, 0x7f, 0xf5, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9e, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x99, 0xfd, 0xb7, 0xdf, + 0x30, 0x57, 0x75, 0x76, 0x15, 0x73, 0x70/*77?*/, 0x77, 0x20, 0x75, 0x50, 0x36, 0x70, 0x67, 0x50, 0x77, + 0x57, 0x54, 0x75, 0x77, 0x75, 0x17, 0x37, 0x73, 0x50, 0x57, 0x60, 0x77, 0x70, 0x77, 0x10, 0x73, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x87, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xdb, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x83, 0x00, + 0x2f, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, + 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 +}; + +void wswan_state::mem_map(address_map &map) { map(0x00000, 0x03fff).rw(m_vdp, FUNC(wswan_video_device::vram_r), FUNC(wswan_video_device::vram_w)); // 16kb RAM / 4 colour tiles map(0x04000, 0x0ffff).noprw(); // nothing - //map(0x10000, 0xeffff) // cart range, setup at machine_start map(0xf0000, 0xfffff).r(FUNC(wswan_state::bios_r)); } -void wscolor_state::wscolor_mem(address_map &map) + +void wscolor_state::mem_map(address_map &map) { - map(0x00000, 0x0ffff).rw("vdp", FUNC(wswan_video_device::vram_r), FUNC(wswan_video_device::vram_w)); // 16kb RAM / 4 colour tiles, 16 colour tiles + palettes - //map(0x10000, 0xeffff) // cart range, setup at machine_start + map(0x00000, 0x0ffff).rw(m_vdp, FUNC(wswan_video_device::vram_r), FUNC(wswan_video_device::vram_w)); // 16kb RAM / 4 colour tiles, 16 colour tiles + palettes map(0xf0000, 0xfffff).r(FUNC(wscolor_state::bios_r)); } -void wswan_state::wswan_io(address_map &map) + +void wswan_state::io_map(address_map &map) { map(0x00, 0xff).rw(FUNC(wswan_state::port_r), FUNC(wswan_state::port_w)); // I/O ports } -void wswan_state::wswan_snd(address_map &map) + +void wswan_state::snd_map(address_map &map) { map(0x00000, 0x03fff).r(m_vdp, FUNC(wswan_video_device::vram_r)); } + static INPUT_PORTS_START( wswan ) PORT_START("CURSX") - PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("X1 - Up") - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("X3 - Down") PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("X4 - Left") + PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("X3 - Down") PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("X2 - Right") + PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("X1 - Up") PORT_START("BUTTONS") - PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start") - PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button A") PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Button B") + PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Button A") + PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start") PORT_START("CURSY") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y1 - Up") PORT_CODE(KEYCODE_W) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y3 - Down") PORT_CODE(KEYCODE_S) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y4 - Left") PORT_CODE(KEYCODE_A) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y3 - Down") PORT_CODE(KEYCODE_S) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y2 - Right") PORT_CODE(KEYCODE_D) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y1 - Up") PORT_CODE(KEYCODE_W) INPUT_PORTS_END static GFXDECODE_START( gfx_wswan ) GFXDECODE_END + /* WonderSwan can display 16 shades of grey */ -void wswan_state::wswan_palette(palette_device &palette) const +void wswan_state::palette(palette_device &palette) const { for (int i = 0; i < 16; i++) { @@ -99,7 +235,8 @@ void wswan_state::wswan_palette(palette_device &palette) const } } -void wscolor_state::wscolor_palette(palette_device &palette) const + +void wscolor_state::palette(palette_device &palette) const { for (int i = 0; i < 4096; i++) { @@ -110,6 +247,7 @@ void wscolor_state::wscolor_palette(palette_device &palette) const } } + static void wswan_cart(device_slot_interface &device) { device.option_add_internal("ws_rom", WS_ROM_STD); @@ -117,16 +255,17 @@ static void wswan_cart(device_slot_interface &device) device.option_add_internal("ws_eeprom", WS_ROM_EEPROM); } + void wswan_state::wswan(machine_config &config) { - /* Basic machine hardware */ + // Basic machine hardware V30MZ(config, m_maincpu, 3.072_MHz_XTAL); - m_maincpu->set_addrmap(AS_PROGRAM, &wswan_state::wswan_mem); - m_maincpu->set_addrmap(AS_IO, &wswan_state::wswan_io); + m_maincpu->set_addrmap(AS_PROGRAM, &wswan_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &wswan_state::io_map); WSWAN_VIDEO(config, m_vdp, 0); m_vdp->set_screen("screen"); - m_vdp->set_vdp_type(VDP_TYPE_WSWAN); + m_vdp->set_vdp_type(wswan_video_device::VDP_TYPE_WSWAN); m_vdp->set_irq_callback(FUNC(wswan_state::set_irq_line)); m_vdp->set_dmasnd_callback(FUNC(wswan_state::dma_sound_cb)); @@ -136,70 +275,627 @@ void wswan_state::wswan(machine_config &config) screen.set_screen_update("vdp", FUNC(wswan_video_device::screen_update)); // screen.set_size(WSWAN_X_PIXELS, WSWAN_Y_PIXELS); // screen.set_visarea(0*8, WSWAN_X_PIXELS - 1, 0, WSWAN_Y_PIXELS - 1); - screen.set_raw(3.072_MHz_XTAL, 256, 0, WSWAN_X_PIXELS, 159, 0, WSWAN_Y_PIXELS); + screen.set_raw(3.072_MHz_XTAL, 256, 0, wswan_video_device::WSWAN_X_PIXELS, 159, 0, wswan_video_device::WSWAN_Y_PIXELS); screen.set_palette("palette"); config.set_default_layout(layout_wswan); config.set_maximum_quantum(attotime::from_hz(60)); - NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); GFXDECODE(config, "gfxdecode", "palette", gfx_wswan); - PALETTE(config, "palette", FUNC(wswan_state::wswan_palette), 16); + PALETTE(config, "palette", FUNC(wswan_state::palette), 16); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); WSWAN_SND(config, m_sound, 3.072_MHz_XTAL); - m_sound->set_addrmap(0, &wswan_state::wswan_snd); + m_sound->set_addrmap(0, &wswan_state::snd_map); m_sound->add_route(0, "lspeaker", 0.50); m_sound->add_route(1, "rspeaker", 0.50); - /* cartridge */ + // cartridge WS_CART_SLOT(config, m_cart, 3.072_MHz_XTAL / 8, wswan_cart, nullptr); - /* software lists */ + // software lists SOFTWARE_LIST(config, "cart_list").set_original("wswan"); SOFTWARE_LIST(config, "wsc_list").set_compatible("wscolor"); SOFTWARE_LIST(config, "pc2_list").set_compatible("pockchalv2"); } + void wscolor_state::wscolor(machine_config &config) { wswan(config); - m_maincpu->set_addrmap(AS_PROGRAM, &wscolor_state::wscolor_mem); + m_maincpu->set_addrmap(AS_PROGRAM, &wscolor_state::mem_map); - m_vdp->set_vdp_type(VDP_TYPE_WSC); + m_vdp->set_vdp_type(wswan_video_device::VDP_TYPE_WSC); auto &palette(*subdevice<palette_device>("palette")); palette.set_entries(4096); - palette.set_init(FUNC(wscolor_state::wscolor_palette)); + palette.set_init(FUNC(wscolor_state::palette)); - /* software lists */ + // software lists config.device_remove("wsc_list"); SOFTWARE_LIST(config.replace(), "cart_list").set_original("wscolor"); SOFTWARE_LIST(config, "ws_list").set_compatible("wswan"); } + +void wswan_state::handle_irqs() +{ + if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_HBLTMR); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBL) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBL); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBLTMR) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBLTMR); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_LCMP) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_LCMP); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_SRX) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_SRX); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_RTC) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_RTC); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_KEY) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_KEY); // V30MZ + } + else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_STX) + { + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_STX); // V30MZ + } + else + { + m_maincpu->set_input_line(0, CLEAR_LINE); + } +} + + +void wswan_state::set_irq_line(int irq) +{ + if (m_ws_portram[0xb2] & irq) + { + m_ws_portram[0xb6] |= irq; + handle_irqs(); + } +} + + +void wswan_state::dma_sound_cb() +{ + if ((m_sound_dma.enable & 0x88) == 0x80) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + /* TODO: Output sound DMA byte */ + port_w(0x89, space.read_byte(m_sound_dma.source)); + m_sound_dma.size--; + m_sound_dma.source = (m_sound_dma.source + 1) & 0x0fffff; + if (m_sound_dma.size == 0) + { + m_sound_dma.enable &= 0x7f; + } + } +} + + +void wswan_state::clear_irq_line(int irq) +{ + m_ws_portram[0xb6] &= ~irq; + handle_irqs(); +} + + +void wswan_state::register_save() +{ + save_item(NAME(m_ws_portram)); + save_item(NAME(m_internal_eeprom)); + save_item(NAME(m_bios_disabled)); + save_item(NAME(m_rotate)); + + save_item(NAME(m_sound_dma.source)); + save_item(NAME(m_sound_dma.size)); + save_item(NAME(m_sound_dma.enable)); + + if (m_cart->exists()) + m_cart->save_nvram(); +} + + +void wswan_state::common_start() +{ + register_save(); + + if (m_cart->exists()) + { + // ROM + m_maincpu->space(AS_PROGRAM).install_read_handler(0x20000, 0x2ffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_rom20))); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x30000, 0x3ffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_rom30))); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x40000, 0xeffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_rom40))); + + // SRAM + if (m_cart->get_type() == WS_SRAM) + { + m_maincpu->space(AS_PROGRAM).install_read_handler(0x10000, 0x1ffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_ram))); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x10000, 0x1ffff, write8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::write_ram))); + } + } +} + + +void wswan_state::machine_start() +{ + common_start(); + subdevice<nvram_device>("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE_WS * 2); + m_system_type = TYPE_WSWAN; +} + + +void wscolor_state::machine_start() +{ + common_start(); + subdevice<nvram_device>("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE * 2); + m_system_type = TYPE_WSC; +} + + +void wswan_state::machine_reset() +{ + m_bios_disabled = 0; + + if (m_cart->exists()) + m_rotate = m_cart->get_is_rotated(); + else + m_rotate = 0; + + /* Intialize ports */ + std::copy(std::begin(ws_portram_init), std::end(ws_portram_init), std::begin(m_ws_portram)); + + render_target *target = machine().render().first_target(); + target->set_view(m_rotate); + + /* Initialize sound DMA */ + m_sound_dma = sound_dma_t(); +} + + +u8 wswan_state::bios_r(offs_t offset) +{ + if (!m_bios_disabled) + return m_region_maincpu->base()[offset & (m_region_maincpu->bytes() - 1)]; + else + return m_cart->read_rom40(offset + 0xb0000); +} + + +u8 wswan_state::port_r(offs_t offset) +{ + u8 value = m_ws_portram[offset]; + + if (offset != 2) + logerror("PC=%X: port read %02X\n", m_maincpu->pc(), offset); + + if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) + return m_vdp->reg_r(offset); + + switch (offset) + { + case 0x4a: // Sound DMA source address (low) + value = m_sound_dma.source & 0xff; + break; + case 0x4b: // Sound DMA source address (high) + value = (m_sound_dma.source >> 8) & 0xff; + break; + case 0x4c: // Sound DMA source memory segment + value = (m_sound_dma.source >> 16) & 0xff; + break; + case 0x4e: // Sound DMA transfer size (low) + value = m_sound_dma.size & 0xff; + break; + case 0x4f: // Sound DMA transfer size (high) + value = (m_sound_dma.size >> 8) & 0xff; + break; + case 0x52: // Sound DMA start/stop + value = m_sound_dma.enable; + break; + case 0x60: + value = m_vdp->reg_r(offset); + break; + case 0xa0: // Hardware type + // Bit 0 - Disable/enable Bios + // Bit 1 - Determine mono/color + // Bit 2 - Unknown, used to determine color/crystal + // Bit 3 - Unknown + // Bit 7 - Checked during start up, expects bit 7 set + value = value & ~ 0x02; + if (m_system_type == TYPE_WSC) + value |= 2; + value |= 0x80; + break; + case 0xb5: // Read controls + // Bit 0-3 - Current state of input lines (read-only) + // Bit 4-6 - Select line of inputs to read + // 001 - Read Y cursors + // 010 - Read X cursors + // 100 - Read START,A,B buttons + // Bit 7 - Unknown + value = value & 0xf0; + switch (value) + { + case 0x10: // Read Y cursors: Y1 - Y2 - Y3 - Y4 + { + u8 input = m_cursy->read(); + if (m_rotate) // reorient controls if the console is rotated + { + if (input & 0x01) value |= 0x02; + if (input & 0x02) value |= 0x04; + if (input & 0x04) value |= 0x08; + if (input & 0x08) value |= 0x01; + } + else + value = value | input; + } + break; + case 0x20: // Read X cursors: X1 - X2 - X3 - X4 + { + u8 input = m_cursx->read(); + if (m_rotate) // reorient controls if the console is rotated + { + if (input & 0x01) value |= 0x02; + if (input & 0x02) value |= 0x04; + if (input & 0x04) value |= 0x08; + if (input & 0x08) value |= 0x01; + } + else + value = value | input; + } + break; + case 0x40: // Read buttons: START - A - B + value = value | m_buttons->read(); + break; + } + break; + case 0xc0: + case 0xc1: + case 0xc2: + case 0xc3: + case 0xc4: // Cartridge EEPROM data + case 0xc5: // Cartridge EEPROM data + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: // RTC data + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + value = m_cart->read_io(offset & 0x0f); + break; + } + + return value; +} + + +void wswan_state::port_w(offs_t offset, u8 data) +{ + address_space &mem = m_maincpu->space(AS_PROGRAM); + logerror("PC=%X: port write %02X <- %02X\n", m_maincpu->pc(), offset, data); + + if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) + { + m_vdp->reg_w(offset, data); + return; + } + + switch (offset) + { + case 0x40: // DMA source address (low) + case 0x41: // DMA source address (high) + case 0x42: // DMA source bank + case 0x43: // DMA destination bank + case 0x44: // DMA destination address (low) + case 0x45: // DMA destination address (high) + case 0x46: // Size of copied data (low) + case 0x47: // Size of copied data (high) + break; + case 0x48: // DMA control + // Bit 0-6 - Unknown + // Bit 7 - DMA stop/start + if (data & 0x80) + { + u32 src, dst; + u16 length; + + src = m_ws_portram[0x40] + (m_ws_portram[0x41] << 8) + (m_ws_portram[0x42] << 16); + dst = m_ws_portram[0x44] + (m_ws_portram[0x45] << 8) + (m_ws_portram[0x43] << 16); + length = m_ws_portram[0x46] + (m_ws_portram[0x47] << 8); + for ( ; length > 0; length--) + { + mem.write_byte(dst, mem.read_byte(src)); + src++; + dst++; + } +#ifdef MAME_DEBUG + logerror("DMA src:%X dst:%X length:%d\n", src, dst, length); +#endif + m_ws_portram[0x40] = src & 0xff; + m_ws_portram[0x41] = (src >> 8) & 0xff; + m_ws_portram[0x44] = dst & 0xff; + m_ws_portram[0x45] = (dst >> 8) & 0xff; + m_ws_portram[0x46] = length & 0xff; + m_ws_portram[0x47] = (length >> 8) & 0xff; + data &= 0x7f; + } + break; + case 0x4a: // Sound DMA source address (low) + m_sound_dma.source = (m_sound_dma.source & 0x0fff00) | data; + break; + case 0x4b: // Sound DMA source address (high) + m_sound_dma.source = (m_sound_dma.source & 0x0f00ff) | (data << 8); + break; + case 0x4c: // Sound DMA source memory segment + // Bit 0-3 - Sound DMA source address segment + // Bit 4-7 - Unknown + m_sound_dma.source = (m_sound_dma.source & 0xffff) | ((data & 0x0f) << 16); + break; + case 0x4d: // Unknown + break; + case 0x4e: // Sound DMA transfer size (low) + m_sound_dma.size = (m_sound_dma.size & 0xff00) | data; + break; + case 0x4f: // Sound DMA transfer size (high) + m_sound_dma.size = (m_sound_dma.size & 0xff) | (data << 8); + break; + case 0x50: // Unknown + case 0x51: // Unknown + break; + case 0x52: // Sound DMA start/stop + // Bit 0-6 - Unknown + // Bit 7 - Sound DMA stop/start + m_sound_dma.enable = data; + break; + case 0x60: + m_vdp->reg_w(offset, data); + break; + case 0x80: // Audio 1 freq (lo) + case 0x81: // Audio 1 freq (hi) + case 0x82: // Audio 2 freq (lo) + case 0x83: // Audio 2 freq (hi) + case 0x84: // Audio 3 freq (lo) + case 0x85: // Audio 3 freq (hi) + case 0x86: // Audio 4 freq (lo) + case 0x87: // Audio 4 freq (hi) + case 0x88: // Audio 1 volume + // Bit 0-3 - Right volume audio channel 1 + // Bit 4-7 - Left volume audio channel 1 + case 0x89: // Audio 2 volume + // Bit 0-3 - Right volume audio channel 2 + // Bit 4-7 - Left volume audio channel 2 + case 0x8a: // Audio 3 volume + // Bit 0-3 - Right volume audio channel 3 + // Bit 4-7 - Left volume audio channel 3 + case 0x8b: // Audio 4 volume + // Bit 0-3 - Right volume audio channel 4 + // Bit 4-7 - Left volume audio channel 4 + case 0x8c: // Sweep step + case 0x8d: // Sweep time + case 0x8e: // Noise control + // Bit 0-2 - Noise generator type + // Bit 3 - Reset + // Bit 4 - Enable + // Bit 5-7 - Unknown + case 0x8f: // Sample location + // Bit 0-7 - Sample address location 0 00xxxxxx xx000000 + case 0x90: // Audio control + // Bit 0 - Audio 1 enable + // Bit 1 - Audio 2 enable + // Bit 2 - Audio 3 enable + // Bit 3 - Audio 4 enable + // Bit 4 - Unknown + // Bit 5 - Audio 2 voice mode enable + // Bit 6 - Audio 3 sweep mode enable + // Bit 7 - Audio 4 noise mode enable + case 0x91: // Audio output + // Bit 0 - Mono select + // Bit 1-2 - Output volume + // Bit 3 - External stereo + // Bit 4-6 - Unknown + // Bit 7 - External speaker (Read-only, set by hardware) + case 0x92: // Noise counter shift register (lo) + case 0x93: // Noise counter shift register (hi) + // Bit 0-6 - Noise counter shift register bit 8-14 + // bit 7 - Unknown + case 0x94: // Master volume + // Bit 0-3 - Master volume + // Bit 4-7 - Unknown + m_sound->port_w(offset, data); + break; + case 0x9E: // WSC volume setting (0, 1, 2, 3) + break; + case 0xa0: // Hardware type/system control + // Bit 0 - Enable cartridge slot and/or disable bios + // Bit 1 - Hardware type: 0 = WS, 1 = WSC + // Bit 2 - Unknown, written during boot + // Bit 3 - Unknown, written during boot + // Bit 4-6 - Unknown + // Bit 7 - Unknown, read during boot + if ((data & 0x01) && !m_bios_disabled) + m_bios_disabled = 1; + break; + + case 0xb0: // Interrupt base vector + break; + case 0xb1: // Communication byte + break; + case 0xb2: // Interrupt enable + // Bit 0 - Serial transmit interrupt enable + // Bit 1 - Key press interrupt enable + // Bit 2 - RTC alarm interrupt enable + // Bit 3 - Serial receive interrupt enable + // Bit 4 - Drawing line detection interrupt enable + // Bit 5 - VBlank timer interrupt enable + // Bit 6 - VBlank interrupt enable + // Bit 7 - HBlank timer interrupt enable + break; + case 0xb3: // serial communication control + // Bit 0 - Receive complete + // Bit 1 - Error + // Bit 2 - Send complete + // Bit 3-4 - Unknown + // Bit 5 - Send data interrupt generation + // Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps + // Bit 7 - Receive data interrupt generation + m_ws_portram[0xb1] = 0xff; + if (data & 0x80) + { + // m_ws_portram[0xb1] = 0x00; + data |= 0x04; + } + if (data & 0x20) + { + // data |= 0x01; + } + break; + case 0xb5: // Read controls + // Bit 0-3 - Current state of input lines (read-only) + // Bit 4-6 - Select line of inputs to read + // 001 - Read Y cursors + // 010 - Read X cursors + // 100 - Read START,A,B buttons + // Bit 7 - Unknown + break; + case 0xb6: // Interrupt acknowledge + // Bit 0 - Serial transmit interrupt acknowledge + // Bit 1 - Key press interrupt acknowledge + // Bit 2 - RTC alarm interrupt acknowledge + // Bit 3 - Serial receive interrupt acknowledge + // Bit 4 - Drawing line detection interrupt acknowledge + // Bit 5 - VBlank timer interrupt acknowledge + // Bit 6 - VBlank interrupt acknowledge + // Bit 7 - HBlank timer interrupt acknowledge + clear_irq_line(data); + data = m_ws_portram[0xb6]; + break; + case 0xba: // Internal EEPROM data (low) + case 0xbb: // Internal EEPROM data (high) + break; + case 0xbc: // Internal EEPROM address (low) + // (WS) Bit 0-5 = Internal EEPROM address + // (WSC) Bit 0-7 - Internal EEPROM address bit 1-8 + case 0xbd: // Internal EEPROM address (high) + // (WSC) Bit 0 - Internal EEPROM address bit 9(?) + // Bit 1-7 - Unknown + break; + case 0xbe: // Internal EEPROM command/status + // Bit 0 - Read complete (read only) + // Bit 1 - Write complete (read only) + // Bit 2-3 - Unknown + // Bit 4 - Read + // Bit 5 - Write + // Bit 6 - Protect + // Bit 7 - Initialize + if (data & 0x20) + { + u16 addr = get_internal_eeprom_address(); + m_internal_eeprom[addr] = m_ws_portram[0xba]; + m_internal_eeprom[addr + 1] = m_ws_portram[0xbb]; + data |= 0x02; + } + else if ( data & 0x10 ) + { + u16 addr = get_internal_eeprom_address(); + m_ws_portram[0xba] = m_internal_eeprom[addr]; + m_ws_portram[0xbb] = m_internal_eeprom[addr + 1]; + data |= 0x01; + } + else + { + logerror( "Unsupported internal EEPROM command: %X\n", data ); + } + break; + case 0xc0: // ROM bank $40000-$fffff + case 0xc1: // SRAM bank + case 0xc2: // ROM bank $20000-$2ffff + case 0xc3: // ROM bank $30000-$3ffff + case 0xc4: + case 0xc5: + case 0xc6: // EEPROM address / command + case 0xc7: // EEPROM address / command + case 0xc8: // EEPROM command + case 0xc9: + case 0xca: // RTC command + case 0xcb: // RTC data + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + m_cart->write_io(offset & 0x0f, data); + break; + default: + logerror( "Write to unsupported port: %X - %X\n", offset, data ); + break; + } + + // Update the port value + m_ws_portram[offset] = data; +} + + +u16 wswan_state::get_internal_eeprom_address() { + return (m_ws_portram[0xbc] & 0x3f) << 1; +} + + +u16 wscolor_state::get_internal_eeprom_address() { + return (((m_ws_portram[0xbd] << 8) | m_ws_portram[0xbc]) & 0x1FF) << 1; +} + /*************************************************************************** Game driver(s) ***************************************************************************/ -ROM_START( wswan ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD( "ws_bios.bin", 0x0000, 0x0001, NO_DUMP ) +ROM_START(wswan) + ROM_REGION(0x1000, "maincpu", 0) + ROM_LOAD("boot.rom", 0x0000, 0x1000, CRC(7f35f890) SHA1(4015bcacea76bb0b5bbdb13c5358f7e1abb986a1)) + + ROM_REGION(0x80, "nvram", 0) + // Need a dump from an original new unit + // Empty file containing just the name 'WONDERSAN' + ROM_LOAD("internal_eeprom.ws", 0x00, 0x80, BAD_DUMP CRC(b1dff316) SHA1(7b76c3d59c9add9501f95e8bfc34427773fcbd28)) ROM_END -ROM_START( wscolor ) - ROM_REGION( 0x100000, "maincpu", ROMREGION_ERASEFF ) -// ROM_LOAD( "wsc_bios.bin", 0x0000, 0x0001, NO_DUMP ) +ROM_START(wscolor) + ROM_REGION(0x2000, "maincpu", 0) + ROM_LOAD("boot.rom", 0x0000, 0x2000, CRC(cb06d9c3) SHA1(c5ad0b8af45d762662a69f50b64161b9c8919efb)) + + ROM_REGION(0x800, "nvram", 0) + // Need a dump from an original new unit + // Empty file containing just the name 'WONDERSAN' + ROM_LOAD("internal_eeprom.wsc", 0x000, 0x800, BAD_DUMP CRC(9e29725c) SHA1(a903c2cb5f4bb94b67326ff87a2d91605dceffff)) ROM_END +} // anonymous namespace + + // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME CONS( 1999, wswan, 0, 0, wswan, wswan, wswan_state, empty_init, "Bandai", "WonderSwan", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) CONS( 2000, wscolor, wswan, 0, wscolor, wswan, wscolor_state, empty_init, "Bandai", "WonderSwan Color", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/wy100.cpp b/src/mame/drivers/wy100.cpp index 693c37039fc..46522a98922 100644 --- a/src/mame/drivers/wy100.cpp +++ b/src/mame/drivers/wy100.cpp @@ -111,7 +111,7 @@ I8275_DRAW_CHARACTER_MEMBER(wy100_state::draw_character) const rgb_t fg = rgb_t::white(); const rgb_t bg = rgb_t::black(); for (int i = 0; i < 10; i++) - bitmap.pix32(y, x + i) = BIT(dots, i < 1 || i > 8 ? 7 : 8 - i) ? fg : bg; + bitmap.pix(y, x + i) = BIT(dots, i < 1 || i > 8 ? 7 : 8 - i) ? fg : bg; } WRITE_LINE_MEMBER(wy100_state::txd_w) diff --git a/src/mame/drivers/wy50.cpp b/src/mame/drivers/wy50.cpp index a8d01829a15..434b0b041ad 100644 --- a/src/mame/drivers/wy50.cpp +++ b/src/mame/drivers/wy50.cpp @@ -158,11 +158,11 @@ SCN2672_DRAW_CHARACTER_MEMBER(wy50_state::draw_character) const rgb_t fg = BIT(m_cur_attr, 0) || (prot && !m_rev_prot) ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); dots <<= 1; } if (!m_is_132) - bitmap.pix32(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); } WRITE_LINE_MEMBER(wy50_state::mbc_attr_clock_w) diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index 9a0948aa6db..87fa7b56c7e 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -1094,9 +1094,9 @@ uint32_t x07_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c for(int y = 0; y < 8; y++) for (int x=0; x<6; x++) if(m_cursor.on && m_blink && m_cursor.x == px && m_cursor.y == py) - bitmap.pix16(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; + bitmap.pix(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; else - bitmap.pix16(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; + bitmap.pix(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; } diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp index 7b822545fe4..e91e0262742 100644 --- a/src/mame/drivers/x1.cpp +++ b/src/mame/drivers/x1.cpp @@ -228,11 +228,9 @@ constexpr XTAL VDP_CLOCK = 42.954'545_MHz_XTAL; uint16_t x1_state::check_keyboard_press() { static const char *const portnames[3] = { "key1","key2","key3" }; - int i,port_i,scancode; uint8_t keymod = ioport("key_modifiers")->read() & 0x1f; uint32_t pad = ioport("tenkey")->read(); uint32_t f_key = ioport("f_keys")->read(); - scancode = 0; static const uint8_t kanatable[52][3] = { // normal, kana, kana + shift @@ -290,75 +288,67 @@ uint16_t x1_state::check_keyboard_press() {0x5f,0xdb,0x00} // _ / ro }; - for(port_i=0;port_i<3;port_i++) + for(u8 port_i=0; port_i<3; port_i++) { - for(i=0;i<32;i++) + for(u8 i=0; i<32; i++) { - if((ioport(portnames[port_i])->read()>>i) & 1) + u8 scancode = port_i * 32 + i; + if(BIT(ioport(portnames[port_i])->read(), i)) { - //key_flag = 1; - if(keymod & 0x02) // shift not pressed + switch (keymod & 6) { - if ((keymod & 0x04) == 0) // kana on - { + case 0: // kana on, shift on if (scancode >= 0x2c && scancode <= 0x5f) - scancode = kanatable[scancode - 0x2c][1]; - } + if (kanatable[scancode - 0x2c][2]) + scancode = kanatable[scancode - 0x2c][2]; + break; - if (scancode >= 0x41 && scancode < 0x5a) - scancode += 0x20; // lowercase - } - else - { - if ((keymod & 0x04) == 0) // kana on - { + case 2: // kana on, shift off if (scancode >= 0x2c && scancode <= 0x5f) - { - if (kanatable[scancode - 0x2c][2] != 0) - scancode = kanatable[scancode - 0x2c][2]; - } - } - - if(scancode >= 0x31 && scancode < 0x3a) - scancode -= 0x10; - if(scancode == 0x30) - { - scancode = 0x3d; - } + if (kanatable[scancode - 0x2c][1]) + scancode = kanatable[scancode - 0x2c][1]; + break; + + case 4: // kana off, shift on + if (scancode == 0x40 || (scancode >= 0x5b && scancode <= 0x5f)) + scancode += 0x20; + else // numbers, special chars + if ((scancode >= 0x2c && scancode <= 0x3b)) + scancode ^= 0x10; + break; + + default: // kana off, shift off + // Control key + if (scancode >= 0x41 && scancode <= 0x5f) + if (!BIT(keymod, 0)) + scancode -= 0x40; + // If nothing pressed, default to lower case + if (scancode >= 0x41 && scancode <= 0x5a) + scancode += 0x20; + break; } + if(!BIT(keymod, 3)) // capslock + if ((scancode >= 0x41 && scancode <= 0x5a) || (scancode >= 0x61 && scancode <= 0x7a)) + scancode ^= 0x20; - - if((keymod & 0x10) == 0) // graph on + if(!BIT(keymod, 4)) // graph on scancode |= 0x80; return scancode; } - scancode++; } } // check numpad - scancode = 0x30; - for(i=0;i<10;i++) - { - if((pad >> i) & 0x01) - { - return scancode | 0x100; - } - scancode++; - } + for(u8 i=0; i<10; i++) + if(BIT(pad, i)) + return i + 0x120; // check function keys - scancode = 0x71; - for(i=0;i<5;i++) - { - if((f_key >> i) & 0x01) - { - return (scancode + ((keymod & 0x02) ? 0 : 5)) | 0x100; - } - scancode++; - } + for(u8 i=0; i<5; i++) + if(BIT(f_key, i)) + return i + 0x171 + (BIT(keymod, 1) ? 0 : 5); return 0; } @@ -1751,37 +1741,37 @@ INPUT_PORTS_START( x1 ) PORT_START("key1") //0x00-0x1f PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") /*PORT_CODE(KEYCODE_6) PORT_CHAR('6')*/ - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-8") /*PORT_CODE(KEYCODE_7) PORT_CHAR('7')*/ - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") /*PORT_CODE(KEYCODE_3) PORT_CHAR('3')*/ - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") /*PORT_CODE(KEYCODE_4) PORT_CHAR('4')*/ - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") /*PORT_CODE(KEYCODE_5) PORT_CHAR('5')*/ - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") /*PORT_CODE(KEYCODE_1) PORT_CHAR('1')*/ - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") /*PORT_CODE(KEYCODE_2) PORT_CHAR('2')*/ + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-2") PORT_CHAR(1) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-3") PORT_CHAR(2) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_END) PORT_CHAR(3) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-5") PORT_CHAR(4) + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-6") PORT_CHAR(5) + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-7") PORT_CHAR(6) + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0-8") PORT_CHAR(7) + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL INS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HTab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-3") PORT_CHAR(10) + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-4") PORT_CHAR(11) + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-5") PORT_CHAR(12) + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-7") PORT_CHAR(14) + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1-8") PORT_CHAR(15) + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-1") PORT_CHAR(16) + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-2") PORT_CHAR(17) + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-3") PORT_CHAR(18) + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-4") PORT_CHAR(19) + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-5") PORT_CHAR(20) + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-6") PORT_CHAR(21) + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-7") PORT_CHAR(22) + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2-8") PORT_CHAR(23) + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-1") PORT_CHAR(24) + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-2") PORT_CHAR(25) + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3-3") PORT_CHAR(26) PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) + PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_START("key2") //0x20-0x3f PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') @@ -1796,68 +1786,68 @@ INPUT_PORTS_START( x1 ) PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2b + - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? PORT_START("key3") //0x40-0x5f - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') - PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc2\xa5") // yen - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xc2\xa5") PORT_CHAR(165) PORT_CHAR('|')// yen + PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") + PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") PORT_CHAR('_') PORT_START("f_keys") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) + PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6)) + PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7)) + PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8)) + PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9)) + PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_START("tenkey") PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) @@ -1873,62 +1863,19 @@ INPUT_PORTS_START( x1 ) PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - // TODO: add other numpad keys + // TODO: add other numpad keys (comma, period, equals, enter, HOME/CLR) PORT_START("key_modifiers") PORT_BIT(0x00000001,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x00000002,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x00000002,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x00000004,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) - -#if 0 - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') - PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') - PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) - PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") - PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("\xEF\xBF\xA5") - - PORT_START("key3") - PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 6") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey ,") - PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 3") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey Enter") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey .") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_INSERT) - PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("EL") PORT_CODE(KEYCODE_PGUP) - PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_PGDN) - PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) - PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("DUP") PORT_CODE(KEYCODE_END) - PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) - PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) - PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) - PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) - PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) - PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) - PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) - PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) - -#endif INPUT_PORTS_END INPUT_PORTS_START( x1turbo ) PORT_INCLUDE( x1 ) + // X1TURBO TODO: add other keys (ROLL UP, ROLL DOWN, HELP, COPY, XFER) PORT_START("X1TURBO_DSW") PORT_DIPNAME( 0x01, 0x01, "Interlace mode" ) diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp index 64bd8293172..ff80cb9b300 100644 --- a/src/mame/drivers/xerox820.cpp +++ b/src/mame/drivers/xerox820.cpp @@ -229,7 +229,7 @@ static INPUT_PORTS_START( xerox820 ) // inputs defined in machine/keyboard.c INPUT_PORTS_END -TIMER_CALLBACK_MEMBER( bigboard_state::bigboard_beepoff ) +TIMER_DEVICE_CALLBACK_MEMBER(bigboard_state::beep_timer) { m_beeper->set_state(0); } @@ -322,7 +322,7 @@ void bigboard_state::kbpio_pa_w(uint8_t data) /* beeper on bigboard */ if (BIT(data, 5) & (!m_bit5)) { - machine().scheduler().timer_set(attotime::from_msec(40), timer_expired_delegate(FUNC(bigboard_state::bigboard_beepoff),this)); + m_beep_timer->adjust(attotime::from_msec(40)); m_beeper->set_state(1); } m_bit5 = BIT(data, 5); @@ -480,25 +480,25 @@ WRITE_LINE_MEMBER( xerox820_state::fdc_drq_w ) uint32_t xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=(m_scroll + 1) * 0x80,x; - const pen_t *pen=m_palette->pens(); + uint16_t sy=0,ma=(m_scroll + 1) * 0x80; + pen_t const *const pen=m_palette->pens(); m_framecnt++; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { if (ma > 0xb80) ma = 0; - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { + uint8_t gfx; if (ra < 8) { - chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; + uint8_t chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; /* Take care of flashing characters */ if ((chr < 0x80) && (m_framecnt & 0x08)) @@ -510,14 +510,14 @@ uint32_t xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else gfx = 0xff; - /* Display a scanline of a character (7 pixels) */ - *p++ = pen[0]; - *p++ = pen[BIT(gfx, 4) ^ 1]; - *p++ = pen[BIT(gfx, 3) ^ 1]; - *p++ = pen[BIT(gfx, 2) ^ 1]; - *p++ = pen[BIT(gfx, 1) ^ 1]; - *p++ = pen[BIT(gfx, 0) ^ 1]; - *p++ = pen[0]; + /* Display a scanline of a character (7 pixels) */ + *p++ = pen[0]; + *p++ = pen[BIT(gfx, 4) ^ 1]; + *p++ = pen[BIT(gfx, 3) ^ 1]; + *p++ = pen[BIT(gfx, 2) ^ 1]; + *p++ = pen[BIT(gfx, 1) ^ 1]; + *p++ = pen[BIT(gfx, 0) ^ 1]; + *p++ = pen[0]; } } ma+=128; @@ -696,6 +696,7 @@ void bigboard_state::bigboard(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); BEEP(config, m_beeper, 950).add_route(ALL_OUTPUTS, "mono", 1.00); /* bigboard only */ + TIMER(config, m_beep_timer).configure_generic(FUNC(bigboard_state::beep_timer)); } void xerox820ii_state::xerox820ii(machine_config &config) diff --git a/src/mame/drivers/xtheball.cpp b/src/mame/drivers/xtheball.cpp index a1971a6f27f..eae17c07c2a 100644 --- a/src/mame/drivers/xtheball.cpp +++ b/src/mame/drivers/xtheball.cpp @@ -77,19 +77,18 @@ void xtheball_state::machine_start() TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update) { - uint16_t *srcbg = &m_vram_bg[(params->rowaddr << 8) & 0xff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const srcbg = &m_vram_bg[(params->rowaddr << 8) & 0xff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr; - int x; /* bit stored at 3040130 controls which foreground mode to use */ if (!m_foreground_mode) { /* mode 0: foreground is the same as background */ - uint16_t *srcfg = &m_vram_fg[(params->rowaddr << 8) & 0xff00]; + uint16_t const *const srcfg = &m_vram_fg[(params->rowaddr << 8) & 0xff00]; - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t fgpix = srcfg[coladdr & 0xff]; uint16_t bgpix = srcbg[coladdr & 0xff]; @@ -102,9 +101,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update) { /* mode 1: foreground is half background resolution in */ /* X and supports two pages */ - uint16_t *srcfg = &m_vram_fg[(params->rowaddr << 7) & 0xff00]; + uint16_t const *const srcfg = &m_vram_fg[(params->rowaddr << 7) & 0xff00]; - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t fgpix = srcfg[(coladdr >> 1) & 0xff] >> (8 * (coladdr & 1)); uint16_t bgpix = srcbg[coladdr & 0xff]; diff --git a/src/mame/drivers/xyonix.cpp b/src/mame/drivers/xyonix.cpp index 80126638f8d..4308d390c03 100644 --- a/src/mame/drivers/xyonix.cpp +++ b/src/mame/drivers/xyonix.cpp @@ -197,10 +197,10 @@ MC6845_UPDATE_ROW( xyonix_state::crtc_update_row ) uint16_t data = m_gfx->base()[0x8000 | tile] << 8 | m_gfx->base()[tile]; // draw 4 pixels - bitmap.pix32(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; - bitmap.pix32(y, i * 4 + 1) = pen[(attr & 0xf0) | bitswap<4>(data, 5, 1, 13, 9)]; - bitmap.pix32(y, i * 4 + 2) = pen[(attr & 0xf0) | bitswap<4>(data, 6, 2, 14, 10)]; - bitmap.pix32(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; + bitmap.pix(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; + bitmap.pix(y, i * 4 + 1) = pen[(attr & 0xf0) | bitswap<4>(data, 5, 1, 13, 9)]; + bitmap.pix(y, i * 4 + 2) = pen[(attr & 0xf0) | bitswap<4>(data, 6, 2, 14, 10)]; + bitmap.pix(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; } } #endif diff --git a/src/mame/drivers/ymdx11.cpp b/src/mame/drivers/ymdx11.cpp index 0de96879f69..6b131a0dd8e 100644 --- a/src/mame/drivers/ymdx11.cpp +++ b/src/mame/drivers/ymdx11.cpp @@ -57,7 +57,7 @@ void yamaha_dx11_state::machine_start() HD44780_PIXEL_UPDATE(yamaha_dx11_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void yamaha_dx11_state::palette_init(palette_device &palette) diff --git a/src/mame/drivers/ymtx81z.cpp b/src/mame/drivers/ymtx81z.cpp index 21892a615b6..8680a59f698 100644 --- a/src/mame/drivers/ymtx81z.cpp +++ b/src/mame/drivers/ymtx81z.cpp @@ -43,7 +43,7 @@ private: HD44780_PIXEL_UPDATE(ymtx81z_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void ymtx81z_state::palette_init(palette_device &palette) diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp index fab1cab1f5a..881119f48bc 100644 --- a/src/mame/drivers/z100.cpp +++ b/src/mame/drivers/z100.cpp @@ -309,7 +309,7 @@ void z100_state::memory_ctrl_w(uint8_t data) MC6845_UPDATE_ROW(z100_state::update_row) { - uint32_t *const pix = &bitmap.pix32(y); + uint32_t *const pix = &bitmap.pix(y); const uint16_t amask = m_vram_config->read() ? 0xfff : 0x7ff; for (int x = 0; x < x_count; x++) diff --git a/src/mame/drivers/z1013.cpp b/src/mame/drivers/z1013.cpp index fba061a158f..363738abfc9 100644 --- a/src/mame/drivers/z1013.cpp +++ b/src/mame/drivers/z1013.cpp @@ -240,21 +240,20 @@ INPUT_PORTS_END uint32_t z1013_state::screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+32; x++) + for (uint16_t x = ma; x < ma+32; x++) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/z22.cpp b/src/mame/drivers/z22.cpp index 7421bf9ad16..b2ab00d41bf 100644 --- a/src/mame/drivers/z22.cpp +++ b/src/mame/drivers/z22.cpp @@ -77,7 +77,7 @@ void z22_state::machine_reset() MC6845_UPDATE_ROW(z22_state::update_row) { - u32 *pix = &bitmap.pix32(y); + u32 *pix = &bitmap.pix(y); for (unsigned x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/z80ne.cpp b/src/mame/drivers/z80ne.cpp index 00da29c4226..ca8a1cecd0d 100644 --- a/src/mame/drivers/z80ne.cpp +++ b/src/mame/drivers/z80ne.cpp @@ -115,6 +115,14 @@ Quick Instructions: - EP1390: requires a floppy to boot from. Disks marked as NE-DOS 1.5 should work. - EP2390: uses ports 8x, not emulated, not working. For NE-DOS G.1 +Natural Keyboard and Paste: + - The hexpad keys conflict with the keyboard keys, therefore Natural Keyboard is not + supported. Paste is meant for Z80NE only. + + - Test Paste: + N1000=11=22=33=44=55=66=77=88=99=N1000= + Press Ctrl+0 to review the data. + *********************************************************************************************************/ @@ -247,7 +255,7 @@ static INPUT_PORTS_START( z80ne ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("RST") /* RESET key */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, z80ne_state, z80ne_reset, 0) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LX.384 Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, z80ne_state, z80ne_reset, 0) PORT_CHAR('N') /* Settings - need to reboot after altering these */ PORT_START("LX.385") diff --git a/src/mame/drivers/z9001.cpp b/src/mame/drivers/z9001.cpp index 3755fcfdd85..3e24d356356 100644 --- a/src/mame/drivers/z9001.cpp +++ b/src/mame/drivers/z9001.cpp @@ -175,23 +175,22 @@ void z9001_state::machine_start() uint32_t z9001_state::screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,col,fg,bg; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; m_framecnt++; - for(y = 0; y < 24; y++ ) + for (uint8_t y = 0; y < 24; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen - col = m_p_colorram[x]; - fg = col>>4; - bg = col&15; + uint8_t chr = m_p_videoram[x]; // get char in videoram + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen + uint8_t col = m_p_colorram[x]; + uint8_t fg = col>>4; + uint8_t bg = col&15; /* Check for flashing - swap bg & fg */ if ((BIT(col, 7)) && (m_framecnt & 0x10)) diff --git a/src/mame/drivers/zeebo_qualcomm_adreno130.cpp b/src/mame/drivers/zeebo_qualcomm_adreno130.cpp index 0676971370d..c26ef04de57 100644 --- a/src/mame/drivers/zeebo_qualcomm_adreno130.cpp +++ b/src/mame/drivers/zeebo_qualcomm_adreno130.cpp @@ -120,7 +120,7 @@ uint32_t zeebo_game_state::screen_update(screen_device &screen, bitmap_rgb32 &bi void zeebo_game_state::zeebo(machine_config &config) { - ARM11(config, m_maincpu, 528000000); // 528 MHz ARM11 based SoC + ARM11(config, m_maincpu, 528000000); // 528 MHz ARM11 based SoC m_maincpu->set_addrmap(AS_PROGRAM, &zeebo_game_state::zeebo_arm11_map); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); diff --git a/src/mame/drivers/zorba.cpp b/src/mame/drivers/zorba.cpp index 52d667554a5..c0c6f9924cb 100644 --- a/src/mame/drivers/zorba.cpp +++ b/src/mame/drivers/zorba.cpp @@ -490,8 +490,7 @@ void zorba_state::pia1_portb_w(uint8_t data) I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t gfx = m_p_chargen[(linecount & 15) + (charcode << 4) + ((gpa & 1) << 11)]; @@ -505,8 +504,8 @@ I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) if (lten) gfx = 0xff; - for(i=0;i<8;i++) - bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; + for (int i = 0; i < 8; i++) + bitmap.pix(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; } diff --git a/src/mame/drivers/zrt80.cpp b/src/mame/drivers/zrt80.cpp index 2d571912ab6..9927a085788 100644 --- a/src/mame/drivers/zrt80.cpp +++ b/src/mame/drivers/zrt80.cpp @@ -22,6 +22,7 @@ #include "machine/ins8250.h" #include "machine/keyboard.h" #include "sound/beep.h" +#include "machine/timer.h" #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -38,17 +39,12 @@ public: , m_beep(*this, "beeper") , m_palette(*this, "palette") , m_p_chargen(*this, "chargen") - { - } + , m_beep_timer(*this, "beep_timer") + { } void zrt80(machine_config &config); private: - enum - { - TIMER_BEEP_OFF - }; - uint8_t zrt80_10_r(); void zrt80_30_w(uint8_t data); void zrt80_38_w(uint8_t data); @@ -58,7 +54,7 @@ private: void io_map(address_map &map); void mem_map(address_map &map); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + TIMER_DEVICE_CALLBACK_MEMBER(beep_timer); uint8_t m_term_data; void machine_reset() override; void machine_start() override; @@ -69,6 +65,7 @@ private: required_device<beep_device> m_beep; required_device<palette_device> m_palette; required_region_ptr<u8> m_p_chargen; + required_device<timer_device> m_beep_timer; }; @@ -79,28 +76,21 @@ uint8_t zrt80_state::zrt80_10_r() return ret; } -void zrt80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(zrt80_state::beep_timer) { - switch (id) - { - case TIMER_BEEP_OFF: - m_beep->set_state(0); - break; - default: - throw emu_fatalerror("Unknown id in zrt80_state::device_timer"); - } + m_beep->set_state(0); } void zrt80_state::zrt80_30_w(uint8_t data) { - timer_set(attotime::from_msec(100), TIMER_BEEP_OFF); + m_beep_timer->adjust(attotime::from_msec(100)); m_beep->set_state(1); } void zrt80_state::zrt80_38_w(uint8_t data) { - timer_set(attotime::from_msec(400), TIMER_BEEP_OFF); + m_beep_timer->adjust(attotime::from_msec(400)); m_beep->set_state(1); } @@ -224,18 +214,16 @@ void zrt80_state::machine_reset() MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); - uint8_t polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = polarity; + uint8_t inv = polarity; if (x == cursor_x) inv ^= 0xff; - mem = (ma + x) & 0x1fff; - chr = m_p_videoram[mem]; + uint16_t const mem = (ma + x) & 0x1fff; + uint8_t chr = m_p_videoram[mem]; if (BIT(chr, 7)) { @@ -243,7 +231,7 @@ MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) chr &= 0x7f; } - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t const gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; @@ -304,6 +292,7 @@ void zrt80_state::zrt80(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); BEEP(config, m_beep, 800).add_route(ALL_OUTPUTS, "mono", 0.50); + TIMER(config, m_beep_timer).configure_generic(FUNC(zrt80_state::beep_timer)); /* Devices */ MC6845(config, m_crtc, XTAL(20'000'000) / 8); diff --git a/src/mame/includes/apollo.h b/src/mame/includes/apollo.h index a645dc31a72..367a926baa5 100644 --- a/src/mame/includes/apollo.h +++ b/src/mame/includes/apollo.h @@ -438,7 +438,7 @@ public: protected: required_device<screen_device> m_screen; - apollo_graphics_15i(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type); + apollo_graphics_15i(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides virtual void device_start() override; @@ -544,8 +544,8 @@ protected: uint32_t m_color_lookup_table[16]; - lut_fifo *m_lut_fifo; - bt458 *m_bt458; + std::unique_ptr<lut_fifo> m_lut_fifo; + std::unique_ptr<bt458> m_bt458; }; diff --git a/src/mame/includes/apple3.h b/src/mame/includes/apple3.h index 58b86f1ee3b..2eb967b4dde 100644 --- a/src/mame/includes/apple3.h +++ b/src/mame/includes/apple3.h @@ -127,6 +127,7 @@ public: DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); DECLARE_WRITE_LINE_MEMBER(vbl_w); + DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); // these need to be public for now uint32_t m_flags; @@ -165,6 +166,8 @@ private: int m_pdl_charge; int m_va, m_vb, m_vc; int m_smoothscr; + + int m_inh_state; }; #endif // MAME_INCLUDES_APPLE3_H diff --git a/src/mame/includes/astrof.h b/src/mame/includes/astrof.h index e4bf8971d1f..a7310bc85e9 100644 --- a/src/mame/includes/astrof.h +++ b/src/mame/includes/astrof.h @@ -25,6 +25,30 @@ public: m_sn(*this, "snsnd"), m_screen(*this, "screen") { } + void init_afire(); + void init_abattle(); + void init_sstarbtl(); + void init_acombat3(); + void init_asterion(); + + void astrof(machine_config &config); + void abattle(machine_config &config); + void spfghmk2(machine_config &config); + void tomahawk(machine_config &config); + void astrof_audio(machine_config &config); + void spfghmk2_audio(machine_config &config); + void tomahawk_audio(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(astrof_p1_controls_r); + DECLARE_CUSTOM_INPUT_MEMBER(astrof_p2_controls_r); + DECLARE_CUSTOM_INPUT_MEMBER(tomahawk_controls_r); + DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); + DECLARE_INPUT_CHANGED_MEMBER(service_coin_inserted); + +protected: + virtual void video_start() override; + +private: /* video-related */ required_shared_ptr<uint8_t> m_videoram; @@ -62,20 +86,10 @@ public: uint8_t abattle_coin_prot_r(); uint8_t afire_coin_prot_r(); uint8_t tomahawk_protection_r(); - DECLARE_CUSTOM_INPUT_MEMBER(astrof_p1_controls_r); - DECLARE_CUSTOM_INPUT_MEMBER(astrof_p2_controls_r); - DECLARE_CUSTOM_INPUT_MEMBER(tomahawk_controls_r); void astrof_audio_1_w(uint8_t data); void astrof_audio_2_w(uint8_t data); void spfghmk2_audio_w(uint8_t data); void tomahawk_audio_w(uint8_t data); - DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); - DECLARE_INPUT_CHANGED_MEMBER(service_coin_inserted); - void init_afire(); - void init_abattle(); - void init_sstarbtl(); - void init_acombat3(); - virtual void video_start() override; DECLARE_MACHINE_START(astrof); DECLARE_MACHINE_START(abattle); DECLARE_MACHINE_RESET(abattle); @@ -92,13 +106,6 @@ public: void tomahawk_set_video_control_2( uint8_t data ); void video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens, int num_pens ); void base(machine_config &config); - void astrof(machine_config &config); - void abattle(machine_config &config); - void spfghmk2(machine_config &config); - void tomahawk(machine_config &config); - void astrof_audio(machine_config &config); - void spfghmk2_audio(machine_config &config); - void tomahawk_audio(machine_config &config); void astrof_map(address_map &map); void spfghmk2_map(address_map &map); void tomahawk_map(address_map &map); diff --git a/src/mame/includes/bagman.h b/src/mame/includes/bagman.h index 8d1cba713d8..db5d786a530 100644 --- a/src/mame/includes/bagman.h +++ b/src/mame/includes/bagman.h @@ -32,6 +32,8 @@ public: void pickin(machine_config &config); void sbagmani(machine_config &config); + void init_bagmans3(); + protected: // common DECLARE_WRITE_LINE_MEMBER(coin_counter_w); diff --git a/src/mame/includes/bbc.h b/src/mame/includes/bbc.h index 1e0e383798e..98068a32abc 100644 --- a/src/mame/includes/bbc.h +++ b/src/mame/includes/bbc.h @@ -404,6 +404,7 @@ public: void abc110(machine_config &config); void acw443(machine_config &config); void abc310(machine_config &config); + void cfa3000bp(machine_config &config); void econx25(machine_config &config); void reutapm(machine_config &config); diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h index e74310a53a4..c1d31c76ede 100644 --- a/src/mame/includes/cave.h +++ b/src/mame/includes/cave.h @@ -80,6 +80,7 @@ public: void sailormn(machine_config &config); void paceight(machine_config &config); void pacslot(machine_config &config); + void paccarn(machine_config &config); void hotdogst(machine_config &config); void crusherm(machine_config &config); void donpachi(machine_config &config); @@ -340,6 +341,7 @@ private: void metmqstr_sound_portmap(address_map &map); void oki2_map(address_map &map); void oki_map(address_map &map); + void paccarn_map(address_map &map); void paceight_map(address_map &map); void pacslot_map(address_map &map); void ppsatan_map(address_map &map); diff --git a/src/mame/includes/champbas.h b/src/mame/includes/champbas.h index 917c80d9ab7..70d82340623 100644 --- a/src/mame/includes/champbas.h +++ b/src/mame/includes/champbas.h @@ -112,6 +112,7 @@ public: void exctsccr(machine_config &config); void exctsccrb(machine_config &config); + void exctscc2(machine_config &config); protected: TIMER_DEVICE_CALLBACK_MEMBER(exctsccr_sound_irq); @@ -129,6 +130,7 @@ protected: void exctsccrb_map(address_map &map); void exctsccr_sound_map(address_map &map); void exctsccr_sound_io_map(address_map &map); + void exctscc2_sound_io_map(address_map &map); private: required_device<cpu_device> m_audiocpu; diff --git a/src/mame/includes/dai.h b/src/mame/includes/dai.h index 56b8612cf60..00dfdf79bf3 100644 --- a/src/mame/includes/dai.h +++ b/src/mame/includes/dai.h @@ -15,6 +15,7 @@ #include "machine/pit8253.h" #include "machine/tms5501.h" #include "imagedev/cassette.h" +#include "machine/timer.h" #include "emupal.h" @@ -32,16 +33,12 @@ public: , m_ram(*this, "mainram") , m_palette(*this, "palette") , m_io_keyboard(*this, "IN%u", 0U) + , m_tms_timer(*this, "tms_timer") { } void dai(machine_config &config); private: - enum - { - TIMER_TMS5501 - }; - u8 m_paddle_select; u8 m_paddle_enable; u8 m_cassette_motor[2]; @@ -59,6 +56,7 @@ private: void dai_palette(palette_device &palette) const; u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); IRQ_CALLBACK_MEMBER(int_ack); + TIMER_DEVICE_CALLBACK_MEMBER(tms_timer); void mem_map(address_map &map); @@ -66,7 +64,6 @@ private: virtual void machine_start() override; virtual void machine_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; memory_passthrough_handler *m_rom_shadow_tap; required_device<cpu_device> m_maincpu; @@ -78,6 +75,7 @@ private: required_shared_ptr<u8> m_ram; required_device<palette_device> m_palette; required_ioport_array<9> m_io_keyboard; + required_device<timer_device> m_tms_timer; }; diff --git a/src/mame/includes/deco_mlc.h b/src/mame/includes/deco_mlc.h index 4eca0a33e09..c7d45063872 100644 --- a/src/mame/includes/deco_mlc.h +++ b/src/mame/includes/deco_mlc.h @@ -30,12 +30,15 @@ public: { } void init_mlc(); + void init_acchi(); void init_avengrgs(); - void mlc(machine_config &config); - void mlc_6bpp(machine_config &config); + void acchi(machine_config &config); void avengrgs(machine_config &config); + void mlc(machine_config &config); void mlc_5bpp(machine_config &config); + void mlc_6bpp(machine_config &config); + void stadhr96(machine_config &config); protected: virtual void machine_reset() override; @@ -59,11 +62,7 @@ private: required_region_ptr<u8> m_gfx2; int m_irqLevel; - u32 m_mlc_raster_table_1[4*256]; - u32 m_mlc_raster_table_2[4*256]; - u32 m_mlc_raster_table_3[4*256]; u32 m_vbl_i; - int m_lastScanline[9]; u32 m_colour_mask; u32 m_shadow_mask; u32 m_shadow_shift; @@ -101,5 +100,6 @@ private: void descramble_sound(); void avengrgs_map(address_map &map); - void decomlc_map(address_map &map); + void decomlc_146_map(address_map &map); + void decomlc_no146_map(address_map &map); }; diff --git a/src/mame/includes/fmtowns.h b/src/mame/includes/fmtowns.h index 7197a102ea9..525e4ce429f 100644 --- a/src/mame/includes/fmtowns.h +++ b/src/mame/includes/fmtowns.h @@ -26,6 +26,8 @@ #include "bus/generic/carts.h" #include "bus/generic/slot.h" #include "bus/rs232/rs232.h" +#include "bus/fmt_scsi/fmt_scsi.h" +#include "bus/fmt_scsi/fmt121.h" #include "formats/fmtowns_dsk.h" @@ -111,6 +113,7 @@ class towns_state : public driver_device , m_dma_1(*this, "dma_1") , m_cdrom(*this, "cdrom") , m_cdda(*this, "cdda") + , m_scsi_slot(*this, "scsislot") , m_bank_cb000_r(*this, "bank_cb000_r") , m_bank_cb000_w(*this, "bank_cb000_w") , m_bank_f8000_r(*this, "bank_f8000_r") @@ -150,6 +153,7 @@ protected: void pcm_mem(address_map &map); void towns16_io(address_map &map); void towns_io(address_map &map); + void towns_1g_io(address_map &map); void towns2_io(address_map &map); void townsux_io(address_map &map); void towns_mem(address_map &map); @@ -167,8 +171,6 @@ protected: DECLARE_WRITE_LINE_MEMBER(towns_scsi_irq); DECLARE_WRITE_LINE_MEMBER(towns_scsi_drq); - uint16_t towns_scsi_dma_r(); - void towns_scsi_dma_w(uint16_t data); private: /* devices */ @@ -187,6 +189,7 @@ private: required_device<upd71071_device> m_dma_1; required_device<cdrom_image_device> m_cdrom; required_device<cdda_device> m_cdda; + optional_device<fmt_scsi_slot_device> m_scsi_slot; required_memory_bank m_bank_cb000_r; required_memory_bank m_bank_cb000_w; diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h index 59314a1e903..5fbf6db267f 100644 --- a/src/mame/includes/gridlee.h +++ b/src/mame/includes/gridlee.h @@ -101,7 +101,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: void gridlee_sound_w(offs_t offset, uint8_t data); diff --git a/src/mame/includes/karnov.h b/src/mame/includes/karnov.h index f2d14ba5f63..25c24beaee9 100644 --- a/src/mame/includes/karnov.h +++ b/src/mame/includes/karnov.h @@ -58,32 +58,24 @@ public: uint16_t m_i8751_needs_ack; uint16_t m_i8751_coin_pending; uint16_t m_i8751_command_queue; - int m_microcontroller_id; - int m_coin_mask; int m_latch; - u16 mcusim_r(); - void mcusim_w(u16 data); - void mcusim_ack_w(u16 data); - void mcusim_reset_w(u16 data); + u16 wndrplnt_mcu_r(); + void wndrplnt_mcu_w(u16 data); + void wndrplnt_mcu_ack_w(u16 data); + void wndrplnt_mcu_reset_w(u16 data); + void vint_ack_w(u16 data); void videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); void playfield_w(offs_t offset, u16 data, u16 mem_mask = ~0); - void init_wndrplnt(); - void init_karnov(); - void init_karnovj(); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fix_tile_info); DECLARE_VIDEO_START(karnov); DECLARE_VIDEO_START(wndrplnt); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(mcusim_vbint_w); + DECLARE_WRITE_LINE_MEMBER(wndrplnt_mcusim_vbint_w); void vbint_w(int state); - void karnov_i8751_w( int data ); - void wndrplnt_i8751_w( int data ); - - void chelnov(machine_config &config); void chelnovjbl(machine_config &config); void karnov(machine_config &config); void wndrplnt(machine_config &config); @@ -93,7 +85,8 @@ public: void chelnovjbl_mcu_map(address_map &map); void chelnovjbl_mcu_io_map(address_map &map); void karnov_map(address_map &map); - void chelnov_map(address_map &map); + void karnovjbl_map(address_map &map); + void wndrplnt_map(address_map &map); void karnov_sound_map(address_map &map); void karnovjbl_sound_map(address_map &map); @@ -123,9 +116,3 @@ private: uint16_t m_maincpu_to_mcu; bool m_coin_state; }; - -enum { - KARNOV = 0, - KARNOVJ, - WNDRPLNT -}; diff --git a/src/mame/includes/kaypro.h b/src/mame/includes/kaypro.h index e119ce1b5c7..97de596cfe4 100644 --- a/src/mame/includes/kaypro.h +++ b/src/mame/includes/kaypro.h @@ -14,17 +14,13 @@ #include "sound/beep.h" #include "video/mc6845.h" #include "machine/wd_fdc.h" +#include "machine/timer.h" #include "emupal.h" #include "screen.h" class kaypro_state : public driver_device { public: - enum - { - TIMER_FLOPPY - }; - kaypro_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_palette(*this, "palette") @@ -42,6 +38,7 @@ public: , m_bankr(*this, "bankr") , m_bankw(*this, "bankw") , m_bank3(*this, "bank3") + , m_floppy_timer(*this, "floppy_timer") {} void omni2(machine_config &config); @@ -51,6 +48,8 @@ public: void kaypro484(machine_config &config); void kaypro10(machine_config &config); void kaypro284(machine_config &config); + void kaypro4x(machine_config &config); + void kaypro1(machine_config &config); void init_kaypro(); @@ -60,6 +59,7 @@ private: void kayproii_io(address_map &map); DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + TIMER_DEVICE_CALLBACK_MEMBER(floppy_timer); u8 kaypro484_87_r(); u8 kaypro484_system_port_r(); u8 kaypro484_status_r(); @@ -85,7 +85,6 @@ private: DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); void mc6845_screen_configure(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; u8 m_mc6845_reg[32]; u8 m_mc6845_ind; @@ -115,6 +114,7 @@ private: required_memory_bank m_bankr; required_memory_bank m_bankw; required_memory_bank m_bank3; + required_device<timer_device> m_floppy_timer; }; #endif // MAME_INCLUDES_KAYPRO_H diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h index 5164532102a..0eeed203cff 100644 --- a/src/mame/includes/mac.h +++ b/src/mame/includes/mac.h @@ -292,10 +292,6 @@ private: uint8_t m_sonora_vctl[8]; emu_timer *m_vbl_timer, *m_cursor_timer; uint16_t m_cursor_line; - uint16_t m_dafb_int_status; - int m_dafb_scsi1_drq, m_dafb_scsi2_drq; - uint8_t m_dafb_mode; - uint32_t m_dafb_base, m_dafb_stride; // this is shared among all video setups with vram optional_shared_ptr<uint32_t> m_vram; @@ -368,11 +364,6 @@ private: uint8_t mac_5396_r(offs_t offset); void mac_5396_w(offs_t offset, uint8_t data); - uint32_t dafb_r(offs_t offset, uint32_t mem_mask = ~0); - void dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); - uint32_t dafb_dac_r(offs_t offset, uint32_t mem_mask = ~0); - void dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); - uint32_t macwd_r(offs_t offset, uint32_t mem_mask = ~0); void macwd_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); @@ -438,8 +429,6 @@ private: DECLARE_VIDEO_START(macprtb); DECLARE_VIDEO_START(macsonora); DECLARE_VIDEO_RESET(macrbv); - DECLARE_VIDEO_START(macdafb); - DECLARE_VIDEO_RESET(macdafb); DECLARE_VIDEO_START(macv8); DECLARE_VIDEO_RESET(macsonora); DECLARE_VIDEO_RESET(maceagle); @@ -450,7 +439,6 @@ private: uint32_t screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -459,8 +447,6 @@ private: TIMER_CALLBACK_MEMBER(mac_6015_tick); TIMER_CALLBACK_MEMBER(mac_adbrefresh_tick); TIMER_CALLBACK_MEMBER(mac_scanline_tick); - TIMER_CALLBACK_MEMBER(dafb_vbl_tick); - TIMER_CALLBACK_MEMBER(dafb_cursor_tick); DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2); uint8_t mac_via_in_a(); uint8_t mac_via_in_b(); @@ -487,7 +473,6 @@ private: void mac_state_load(); DECLARE_WRITE_LINE_MEMBER(mac_via_irq); DECLARE_WRITE_LINE_MEMBER(mac_via2_irq); - void dafb_recalc_ints(); void set_scc_waitrequest(int waitrequest); void mac_driver_init(model_t model); void mac_install_memory(offs_t memory_begin, offs_t memory_end, offs_t memory_size, void *memory_data, int is_rom, const char *bank); diff --git a/src/mame/includes/mbee.h b/src/mame/includes/mbee.h index 667df44b806..d3de5626b73 100644 --- a/src/mame/includes/mbee.h +++ b/src/mame/includes/mbee.h @@ -29,6 +29,7 @@ #include "video/mc6845.h" +#include "machine/timer.h" #include "emupal.h" #include "screen.h" @@ -83,11 +84,6 @@ public: void init_mbee256() { m_features = 0x2d; }; private: - enum - { - TIMER_MBEE_NEWKB - }; - void port04_w(uint8_t data); void port06_w(uint8_t data); uint8_t port07_r(); @@ -118,7 +114,7 @@ private: void standard_palette(palette_device &palette) const; void premium_palette(palette_device &palette) const; uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(timer_newkb); + TIMER_DEVICE_CALLBACK_MEMBER(newkb_timer); DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bee); DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bin); WRITE_LINE_MEMBER(rtc_irq_w); @@ -173,7 +169,6 @@ private: void setup_banks(uint8_t data, bool first_time, uint8_t b_mask); void oldkb_scan(uint16_t param); void oldkb_matrix_r(uint16_t offs); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; required_device<z80_device> m_maincpu; required_device<z80pio_device> m_pio; required_device<cassette_image_device> m_cassette; diff --git a/src/mame/includes/model1.h b/src/mame/includes/model1.h index 4ffe3f26498..559e5ed7a6d 100644 --- a/src/mame/includes/model1.h +++ b/src/mame/includes/model1.h @@ -64,13 +64,13 @@ public: struct spoint_t { - int32_t x, y; + int32_t x = 0, y = 0; }; struct point_t { - float x, y, z; - float xx, yy; + float x = 0, y = 0, z = 0; + float xx = 0, yy = 0; spoint_t s; }; diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h index e8aec216d39..54a34e01327 100644 --- a/src/mame/includes/model2.h +++ b/src/mame/includes/model2.h @@ -26,14 +26,21 @@ #include "emupal.h" #include "screen.h" +#include <algorithm> + + class model2_renderer; -struct raster_state; -struct geo_state; -struct triangle; class model2_state : public driver_device { public: + struct plane; + struct texture_parameter; + struct triangle; + struct quad_m2; + struct raster_state; + struct geo_state; + model2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_textureram0(*this, "textureram0"), @@ -626,6 +633,8 @@ public: typedef void (model2_renderer::*scanline_render_func)(int32_t scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid); public: + using triangle = model2_state::triangle; + model2_renderer(model2_state& state) : poly_manager<float, m2_poly_extra_data, 4, 0x10000>(state.machine()) , m_state(state) @@ -722,37 +731,54 @@ typedef model2_renderer::vertex_t poly_vertex; * *******************************************/ -struct plane +struct model2_state::plane { - poly_vertex normal; - float distance; + plane() : normal(0, 0) + { + std::fill(std::begin(normal.p), std::end(normal.p), 0); + } + + poly_vertex normal; + float distance = 0; }; -struct texture_parameter +struct model2_state::texture_parameter { - float diffuse; - float ambient; - u32 specular_control; - float specular_scale; + float diffuse = 0; + float ambient = 0; + u32 specular_control = 0; + float specular_scale = 0; }; -struct triangle +struct model2_state::triangle { - void * next; - poly_vertex v[3]; - u16 z; - u16 texheader[4]; - u8 luma; - int16_t viewport[4]; - int16_t center[2]; + triangle() : v{ { 0, 0 }, { 0, 0 }, { 0, 0 } } + { + for (poly_vertex &vertex : v) + std::fill(std::begin(vertex.p), std::end(vertex.p), 0); + } + + void * next = nullptr; + poly_vertex v[3]; + u16 z = 0; + u16 texheader[4] = { 0, 0, 0, 0 }; + u8 luma = 0; + int16_t viewport[4] = { 0, 0, 0, 0 }; + int16_t center[2] = { 0, 0 }; }; -struct quad_m2 +struct model2_state::quad_m2 { - poly_vertex v[4]; - u16 z; - u16 texheader[4]; - u8 luma; + quad_m2() : v{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } } + { + for (poly_vertex &vertex : v) + std::fill(std::begin(vertex.p), std::end(vertex.p), 0); + } + + poly_vertex v[4]; + u16 z = 0; + u16 texheader[4] = { 0, 0, 0, 0 }; + u8 luma = 0; }; /******************************************* @@ -763,28 +789,36 @@ struct quad_m2 #define MAX_TRIANGLES 32768 -struct raster_state +struct model2_state::raster_state { -// u32 mode; /* bit 0 = Test Mode, bit 2 = Switch 60Hz(1)/30Hz(0) operation */ - u16 *texture_rom; /* Texture ROM pointer */ - u32 texture_rom_mask; /* Texture ROM mask */ - int16_t viewport[4]; /* View port (startx,starty,endx,endy) */ - int16_t center[4][2]; /* Centers (eye 0[x,y],1[x,y],2[x,y],3[x,y]) */ - u16 center_sel; /* Selected center */ - u32 reverse; /* Left/Right Reverse */ - float z_adjust; /* ZSort Mode */ - float triangle_z; /* Current Triangle z value */ - u8 master_z_clip; /* Master Z-Clip value */ - u32 cur_command; /* Current command */ - u32 command_buffer[32]; /* Command buffer */ - u32 command_index; /* Command buffer index */ - triangle tri_list[MAX_TRIANGLES]; /* Triangle list */ - u32 tri_list_index; /* Triangle list index */ - triangle *tri_sorted_list[0x10000]; /* Sorted Triangle list */ - u16 min_z; /* Minimum sortable Z value */ - u16 max_z; /* Maximum sortable Z value */ - u16 texture_ram[0x10000]; /* Texture RAM pointer */ - u8 log_ram[0x40000]; /* Log RAM pointer */ + raster_state() + { + std::fill(std::begin(command_buffer), std::end(command_buffer), 0); + std::fill(std::begin(tri_sorted_list), std::end(tri_sorted_list), nullptr); + std::fill(std::begin(texture_ram), std::end(texture_ram), 0); + std::fill(std::begin(log_ram), std::end(log_ram), 0); + } + +// u32 mode = 0; // bit 0 = Test Mode, bit 2 = Switch 60Hz(1)/30Hz(0) operation + u16 * texture_rom = nullptr; // Texture ROM pointer + u32 texture_rom_mask = 0; // Texture ROM mask + int16_t viewport[4] = { 0, 0, 0, 0 }; // View port (startx,starty,endx,endy) + int16_t center[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; // Centers (eye 0[x,y],1[x,y],2[x,y],3[x,y]) + u16 center_sel = 0; // Selected center + u32 reverse = 0; // Left/Right Reverse + float z_adjust = 0; // ZSort Mode + float triangle_z = 0; // Current Triangle z value + u8 master_z_clip = 0; // Master Z-Clip value + u32 cur_command = 0; // Current command + u32 command_buffer[32]; // Command buffer + u32 command_index = 0; // Command buffer index + triangle tri_list[MAX_TRIANGLES]; // Triangle list + u32 tri_list_index = 0; // Triangle list index + triangle * tri_sorted_list[0x10000]; // Sorted Triangle list + u16 min_z = 0; // Minimum sortable Z value + u16 max_z = 0; // Maximum sortable Z value + u16 texture_ram[0x10000]; // Texture RAM pointer + u8 log_ram[0x40000]; // Log RAM pointer }; /******************************************* @@ -793,21 +827,31 @@ struct raster_state * *******************************************/ -struct geo_state +struct model2_state::geo_state { - raster_state * raster; - u32 mode; /* bit 0 = Enable Specular, bit 1 = Calculate Normals */ - u32 * polygon_rom; /* Polygon ROM pointer */ - u32 polygon_rom_mask; /* Polygon ROM mask */ - float matrix[12]; /* Current Transformation Matrix */ - poly_vertex focus; /* Focus (x,y) */ - poly_vertex light; /* Light Vector */ - float lod; /* LOD */ - float coef_table[32]; /* Distane Coefficient table */ - texture_parameter texture_parameters[32]; /* Texture parameters */ - u32 polygon_ram0[0x8000]; /* Fast Polygon RAM pointer */ - u32 polygon_ram1[0x8000]; /* Slow Polygon RAM pointer */ - model2_state *state; + geo_state() : focus(0, 0), light(0, 0) + { + std::fill(std::begin(matrix), std::end(matrix), 0); + std::fill(std::begin(focus.p), std::end(focus.p), 0); + std::fill(std::begin(light.p), std::end(light.p), 0); + std::fill(std::begin(coef_table), std::end(coef_table), 0); + std::fill(std::begin(polygon_ram0), std::end(polygon_ram0), 0); + std::fill(std::begin(polygon_ram1), std::end(polygon_ram1), 0); + } + + raster_state * raster = nullptr; + u32 mode = 0; // bit 0 = Enable Specular, bit 1 = Calculate Normals + u32 * polygon_rom = nullptr; // Polygon ROM pointer + u32 polygon_rom_mask = 0; // Polygon ROM mask + float matrix[12]; // Current Transformation Matrix + poly_vertex focus; // Focus (x,y) + poly_vertex light; // Light Vector + float lod = 0; // LOD + float coef_table[32]; // Distane Coefficient table + texture_parameter texture_parameters[32]; // Texture parameters + u32 polygon_ram0[0x8000]; // Fast Polygon RAM pointer + u32 polygon_ram1[0x8000]; // Slow Polygon RAM pointer + model2_state * state = nullptr; }; #endif // MAME_INCLUDES_MODEL2_H diff --git a/src/mame/includes/nforcepc.h b/src/mame/includes/nforcepc.h index 000f5ebb1da..acc61f21c74 100644 --- a/src/mame/includes/nforcepc.h +++ b/src/mame/includes/nforcepc.h @@ -24,7 +24,7 @@ public: crush11_host_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, const char *bios_device_tag) : crush11_host_device(mconfig, tag, owner, clock) { - set_ids_host(0x10de01a4, 0x01, 0x10430c11); + set_ids_host(0x10de01a4, 0xb2, 0); set_cpu_tag(std::forward<T>(cpu_tag)); biosrom.set_tag(bios_device_tag); } @@ -36,6 +36,7 @@ public: address_space *get_cpu_space(int spacenum) { return &cpu->space(spacenum); } void bios_map(address_map &map); + void aperture_map(address_map &map) {} protected: virtual void device_start() override; @@ -66,7 +67,7 @@ DECLARE_DEVICE_TYPE(CRUSH11, crush11_host_device) class crush11_memory_device : public pci_device { public: - crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, int ram_size); + crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id, int ram_size); crush11_memory_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void set_ram_size(int ram_size); diff --git a/src/mame/includes/nmk16.h b/src/mame/includes/nmk16.h index 4f5f93a5a8b..3b00d63eb9d 100644 --- a/src/mame/includes/nmk16.h +++ b/src/mame/includes/nmk16.h @@ -223,6 +223,7 @@ protected: void strahljbl_map(address_map &map); void tdragon2_map(address_map &map); void tdragon3h_map(address_map &map); + void tdragon3h_sound_io_map(address_map &map); void tdragon_map(address_map &map); void tdragonb_map(address_map &map); void tharrier_map(address_map &map); diff --git a/src/mame/includes/osi.h b/src/mame/includes/osi.h index 379eb16001b..3d459cdc7f9 100644 --- a/src/mame/includes/osi.h +++ b/src/mame/includes/osi.h @@ -101,25 +101,21 @@ public: c1p_state(const machine_config &mconfig, device_type type, const char *tag) : sb2m600_state(mconfig, type, tag) , m_beeper(*this, "beeper") + , m_beep_timer(*this, "beep_timer") { } void init_c1p(); void c1p(machine_config &config); protected: - enum - { - TIMER_SETUP_BEEP - }; - virtual void machine_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - void osi630_ctrl_w(uint8_t data); void osi630_sound_w(uint8_t data); void c1p_mem(address_map &map); + TIMER_DEVICE_CALLBACK_MEMBER(beep_timer); required_device<beep_device> m_beeper; + required_device<timer_device> m_beep_timer; }; class c1pmf_state : public c1p_state diff --git a/src/mame/includes/p2000t.h b/src/mame/includes/p2000t.h index d0f2654f6f2..e03976a24d2 100644 --- a/src/mame/includes/p2000t.h +++ b/src/mame/includes/p2000t.h @@ -15,6 +15,7 @@ #include "sound/spkrdev.h" #include "video/saa5050.h" #include "machine/p2000t_mdcr.h" +#include "machine/ram.h" #include "emupal.h" @@ -27,6 +28,8 @@ public: , m_maincpu(*this, "maincpu") , m_speaker(*this, "speaker") , m_mdcr(*this, "mdcr") + , m_ram(*this, RAM_TAG) + , m_bank(*this, "bank") , m_keyboard(*this, "KEY.%u", 0) { } @@ -44,6 +47,7 @@ protected: void p2000t_port_8c90_w(uint8_t data); void p2000t_port_9494_w(uint8_t data); uint8_t videoram_r(offs_t offset); + virtual void machine_start() override; INTERRUPT_GEN_MEMBER(p2000_interrupt); @@ -54,8 +58,9 @@ protected: required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; - // Only the P2000t has this device. - optional_device<mdcr_device> m_mdcr; + required_device<mdcr_device> m_mdcr; + required_device<ram_device> m_ram; + required_memory_bank m_bank; private: required_ioport_array<10> m_keyboard; diff --git a/src/mame/includes/pacman.h b/src/mame/includes/pacman.h index fcfe679c2ff..93990e0f8dc 100644 --- a/src/mame/includes/pacman.h +++ b/src/mame/includes/pacman.h @@ -6,6 +6,7 @@ #pragma once #include "machine/74259.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/namco.h" #include "emupal.h" @@ -175,7 +176,6 @@ public: void init_mschamp(); void init_mbrush(); void init_pengomc1(); - void init_clubpacma(); protected: TILEMAP_MAPPER_MEMBER(pacman_scan_rows); @@ -264,4 +264,26 @@ protected: void epos_portmap(address_map &map); }; +class clubpacm_state : public pacman_state +{ +public: + clubpacm_state(const machine_config &mconfig, device_type type, const char *tag) + : pacman_state(mconfig, type, tag) + , m_sublatch(*this, "sublatch") + , m_players(*this, "P%u", 1) + { } + + void clubpacm(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(clubpacm_input_r); + + void init_clubpacma(); + +protected: + void clubpacm_map(address_map &map); + + required_device<generic_latch_8_device> m_sublatch; + required_ioport_array<2> m_players; +}; + #endif // MAME_INCLUDES_PACMAN_H diff --git a/src/mame/includes/pc1512.h b/src/mame/includes/pc1512.h index 036f64c8f7c..61522356432 100644 --- a/src/mame/includes/pc1512.h +++ b/src/mame/includes/pc1512.h @@ -75,7 +75,6 @@ public: m_nden(1), m_dint(0), m_ddrq(0), - m_dreset(1), m_fdc_dsr(0), m_neop(0), m_ack_int_enable(1), @@ -178,7 +177,6 @@ public: int m_nden; int m_dint; int m_ddrq; - int m_dreset; uint8_t m_fdc_dsr; int m_neop; diff --git a/src/mame/includes/prof80.h b/src/mame/includes/prof80.h index 272e3070746..08d89ec8f30 100644 --- a/src/mame/includes/prof80.h +++ b/src/mame/includes/prof80.h @@ -86,7 +86,6 @@ private: DECLARE_WRITE_LINE_MEMBER(inuse_w); DECLARE_WRITE_LINE_MEMBER(motor_w); DECLARE_WRITE_LINE_MEMBER(select_w); - DECLARE_WRITE_LINE_MEMBER(resf_w); DECLARE_WRITE_LINE_MEMBER(mini_w); DECLARE_WRITE_LINE_MEMBER(mstop_w); diff --git a/src/mame/includes/s11.h b/src/mame/includes/s11.h index 4c63ff9df64..af42237c704 100644 --- a/src/mame/includes/s11.h +++ b/src/mame/includes/s11.h @@ -10,12 +10,14 @@ #define MAME_INCLUDES_S11_H #include "cpu/m6800/m6800.h" -#include "audio/s11c_bg.h" #include "audio/pinsnd88.h" +#include "audio/s11c_bg.h" #include "machine/6821pia.h" #include "machine/genpin.h" #include "machine/input_merger.h" +#include "machine/rescap.h" #include "sound/dac.h" +#include "sound/flt_biquad.h" #include "sound/hc55516.h" #include "sound/ym2151.h" @@ -45,6 +47,8 @@ public: , m_audiocpu(*this, "audiocpu") , m_audioirq(*this, "audioirq") , m_hc55516(*this, "hc55516") + , m_cvsd_filter(*this, "cvsd_filter") + , m_cvsd_filter2(*this, "cvsd_filter2") , m_dac(*this, "dac") , m_pias(*this, "pias") , m_pia21(*this, "pia21") @@ -60,6 +64,7 @@ public: { } void s11(machine_config &config); + void s11_only(machine_config &config); void s11_bgs(machine_config &config); void s11_bgm(machine_config &config); @@ -113,6 +118,8 @@ protected: optional_device<m6802_cpu_device> m_audiocpu; optional_device<input_merger_device> m_audioirq; optional_device<hc55516_device> m_hc55516; + optional_device<filter_biquad_device> m_cvsd_filter; + optional_device<filter_biquad_device> m_cvsd_filter2; optional_device<mc1408_device> m_dac; optional_device<pia6821_device> m_pias; required_device<pia6821_device> m_pia21; diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h index 14bb5af7651..fe04be66d4d 100644 --- a/src/mame/includes/segag80r.h +++ b/src/mame/includes/segag80r.h @@ -211,7 +211,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index f12948d0557..f4b9ee8ba17 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -145,7 +145,7 @@ protected: uint8_t update_tilemaps(screen_device &screen, const rectangle &cliprect); void sprite_erase_buffer(); void sprite_swap_buffers(); - int draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); + int draw_one_sprite(uint16_t const *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); void sprite_render_list(); inline uint8_t compute_color_offsets(int which, int layerbit, int layerflag); inline uint16_t compute_sprite_blend(uint8_t encoding); diff --git a/src/mame/includes/seibuspi.h b/src/mame/includes/seibuspi.h index 19c64116ba8..1ee4287d3ae 100644 --- a/src/mame/includes/seibuspi.h +++ b/src/mame/includes/seibuspi.h @@ -8,6 +8,7 @@ #include "machine/eepromser.h" #include "machine/7200fifo.h" +#include "machine/intelfsh.h" #include "sound/okim6295.h" #include "emupal.h" #include "tilemap.h" @@ -29,6 +30,9 @@ public: , m_key(*this, "KEY.%u", 0) , m_special(*this, "SPECIAL") , m_z80_bank(*this, "z80_bank") + , m_soundflash1(*this, "soundflash1") + , m_soundflash2(*this, "soundflash2") + , m_soundflash1_region(*this, "soundflash1") { } void sys386f(machine_config &config); @@ -75,6 +79,10 @@ protected: optional_memory_bank m_z80_bank; + optional_device<intel_e28f008sa_device> m_soundflash1, m_soundflash2; + + optional_region_ptr<u8> m_soundflash1_region; + int m_z80_prg_transfer_pos; int m_z80_lastbank; u8 m_sb_coin_latch; diff --git a/src/mame/includes/sidepckt.h b/src/mame/includes/sidepckt.h index cedc1360a04..4906bf6f8bd 100644 --- a/src/mame/includes/sidepckt.h +++ b/src/mame/includes/sidepckt.h @@ -10,6 +10,7 @@ #pragma once +#include "cpu/mcs51/mcs51.h" #include "machine/gen_latch.h" #include "emupal.h" #include "tilemap.h" @@ -20,6 +21,7 @@ public: sidepckt_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_mcu(*this, "mcu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -33,10 +35,14 @@ public: void sidepckt(machine_config &config); void init_sidepckt(); - void init_sidepcktj(); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; private: required_device<cpu_device> m_maincpu; + optional_device<i8751_device> m_mcu; required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; @@ -47,16 +53,20 @@ private: required_shared_ptr<uint8_t> m_spriteram; tilemap_t *m_bg_tilemap; - const uint8_t* m_prot_table[3]; - uint8_t m_i8751_return; - uint8_t m_current_ptr; - uint8_t m_current_table; - uint8_t m_in_math; - uint8_t m_math_param; + + uint8_t m_mcu_p1; + uint8_t m_mcu_p2; + uint8_t m_mcu_p3; + uint8_t m_scroll_y; - uint8_t i8751_r(); - void i8751_w(uint8_t data); + uint8_t mcu_r(); + void mcu_w(uint8_t data); + + void mcu_p1_w(uint8_t data); + uint8_t mcu_p2_r(); + void mcu_p3_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); void colorram_w(offs_t offset, uint8_t data); uint8_t scroll_y_r(); @@ -64,8 +74,6 @@ private: TILE_GET_INFO_MEMBER(get_tile_info); - virtual void machine_reset() override; - virtual void video_start() override; void sidepckt_palette(palette_device &palette) const; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); diff --git a/src/mame/includes/snk68.h b/src/mame/includes/snk68.h index 197524a8262..f6c8df6a682 100644 --- a/src/mame/includes/snk68.h +++ b/src/mame/includes/snk68.h @@ -31,11 +31,14 @@ public: void streetsm(machine_config &config); void pow(machine_config &config); + void powb(machine_config &config); + + void init_powb(); protected: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_soundcpu; - required_device<upd7759_device> m_upd7759; + optional_device<upd7759_device> m_upd7759; required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<snk68_spr_device> m_sprites; @@ -79,6 +82,7 @@ private: void tile_callback_pow(int &tile, int& fx, int& fy, int& region); void pow_map(address_map &map); + void powb_sound_io_map(address_map &map); }; class searchar_state : public snk68_state diff --git a/src/mame/includes/special.h b/src/mame/includes/special.h index 8349b36d95d..4a3ee5c5ba1 100644 --- a/src/mame/includes/special.h +++ b/src/mame/includes/special.h @@ -22,6 +22,7 @@ #include "formats/smx_dsk.h" #include "formats/rk_cas.h" #include "machine/wd_fdc.h" +#include "machine/timer.h" #include "machine/ram.h" #include "emupal.h" @@ -50,6 +51,7 @@ public: , m_bank6(*this, "bank6") , m_io_keyboard(*this, "LINE%u", 0U) , m_palette(*this, "palette") + , m_pit_timer(*this, "pit_timer") { } void special(machine_config &config); @@ -61,15 +63,7 @@ public: void init_erik(); void init_special(); -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - private: - enum - { - TIMER_PIT8253_GATES - }; - // specimx void specimx_select_bank(offs_t offset, uint8_t data); void video_memory_w(offs_t offset, uint8_t data); @@ -96,6 +90,7 @@ private: void porta_w(uint8_t data); void portb_w(uint8_t data); void portc_w(uint8_t data); + TIMER_DEVICE_CALLBACK_MEMBER(pit_timer); void erik_palette(palette_device &palette) const; void specimx_palette(palette_device &palette) const; @@ -144,6 +139,7 @@ private: optional_memory_bank m_bank6; required_ioport_array<13> m_io_keyboard; required_device<palette_device> m_palette; + optional_device<timer_device> m_pit_timer; // specimx only }; #endif // MAME_INCLUDES_SPECIAL_H diff --git a/src/mame/includes/taito_f2.h b/src/mame/includes/taito_f2.h index d46fe276ee8..44f8fabdb26 100644 --- a/src/mame/includes/taito_f2.h +++ b/src/mame/includes/taito_f2.h @@ -105,11 +105,11 @@ protected: struct f2_tempsprite { - u32 code, color; - bool flipx, flipy; - int x, y; - int zoomx, zoomy; - u64 primask; + u32 code = 0, color = 0; + bool flipx = false, flipy = false; + int x = 0, y = 0; + int zoomx = 0, zoomy = 0; + u64 primask = 0; }; /* memory pointers */ optional_shared_ptr<u16> m_sprite_extension; @@ -118,7 +118,7 @@ protected: std::unique_ptr<u16[]> m_spriteram_delayed; /* video-related */ - std::unique_ptr<struct f2_tempsprite[]> m_spritelist; + std::unique_ptr<f2_tempsprite[]> m_spritelist; int m_sprite_type; u16 m_spritebank[8]; diff --git a/src/mame/includes/toaplan2.h b/src/mame/includes/toaplan2.h index 3deeaebdc0a..00e4ef4f1fe 100644 --- a/src/mame/includes/toaplan2.h +++ b/src/mame/includes/toaplan2.h @@ -75,6 +75,7 @@ public: void truxton2(machine_config &config); void vfive(machine_config &config); void kbash2(machine_config &config); + void nprobowl(machine_config &config); void init_bbakraid(); void init_pipibibsbl(); @@ -229,6 +230,7 @@ private: void kbash_68k_mem(address_map &map); void kbash_v25_mem(address_map &map); void mahoudai_68k_mem(address_map &map); + void nprobowl_68k_mem(address_map &map); void othldrby_68k_mem(address_map &map); void pipibibi_bootleg_68k_mem(address_map &map); void pipibibs_68k_mem(address_map &map); diff --git a/src/mame/includes/turrett.h b/src/mame/includes/turrett.h index cce1f821f56..6192a5f56ff 100644 --- a/src/mame/includes/turrett.h +++ b/src/mame/includes/turrett.h @@ -121,7 +121,7 @@ protected: virtual void device_reset() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface overrides virtual space_config_vector memory_space_config() const override; diff --git a/src/mame/includes/ut88.h b/src/mame/includes/ut88.h index 8b7c2a85824..2e3edd16491 100644 --- a/src/mame/includes/ut88.h +++ b/src/mame/includes/ut88.h @@ -14,6 +14,7 @@ #include "sound/dac.h" #include "machine/i8255.h" #include "imagedev/cassette.h" +#include "machine/timer.h" #include "emupal.h" class ut88_common : public driver_device @@ -108,16 +109,11 @@ public: private: void machine_start() override; void machine_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + TIMER_DEVICE_CALLBACK_MEMBER(display_timer); void io_map(address_map &map); void mem_map(address_map &map); - enum - { - TIMER_UPDATE_DISPLAY - }; - uint8_t keyboard_r(); void led_w(offs_t offset, uint8_t data); diff --git a/src/mame/includes/vicdual.h b/src/mame/includes/vicdual.h index cb887834a8d..d26932a55e9 100644 --- a/src/mame/includes/vicdual.h +++ b/src/mame/includes/vicdual.h @@ -15,6 +15,7 @@ #include "sound/samples.h" #include "sound/volt_reg.h" #include "screen.h" +#include "audio/vicdual.h" #include "audio/vicdual-97271p.h" #include "video/vicdual-97269pb.h" @@ -29,6 +30,7 @@ public: m_coinstate_timer(*this, "coinstate"), m_nsub_coinage_timer(*this, "nsub_coin"), m_screen(*this, "screen"), + m_vicdual_sound(*this, "vicdual_sound"), m_proms(*this, "proms"), m_videoram(*this, "videoram"), m_characterram(*this, "characterram"), @@ -49,7 +51,6 @@ public: void headonn(machine_config &config); void invho2(machine_config &config); void frogs(machine_config &config); - void frogs_audio(machine_config &config); void headons(machine_config &config); void invinco(machine_config &config); void invinco_audio(machine_config &config); @@ -61,7 +62,6 @@ public: void headon2bw(machine_config &config); void safari(machine_config &config); void brdrline(machine_config &config); - void brdrline_audio(machine_config &config); void samurai(machine_config &config); void sspaceat(machine_config &config); void digger(machine_config &config); @@ -70,7 +70,6 @@ public: void carhntds(machine_config &config); void alphaho(machine_config &config); void tranqgun(machine_config &config); - void tranqgun_audio(machine_config &config); DECLARE_READ_LINE_MEMBER(coin_status_r); DECLARE_READ_LINE_MEMBER(get_64v); @@ -88,6 +87,7 @@ protected: required_device<timer_device> m_coinstate_timer; optional_device<timer_device> m_nsub_coinage_timer; required_device<screen_device> m_screen; + optional_device<vicdual_audio_device_base> m_vicdual_sound; optional_memory_region m_proms; required_shared_ptr<uint8_t> m_videoram; @@ -146,12 +146,8 @@ protected: void invinco_io_w(offs_t offset, uint8_t data); /*----------- defined in audio/vicdual.cpp -----------*/ - void frogs_audio_w(uint8_t data); void headon_audio_w(uint8_t data); void invho2_audio_w(uint8_t data); - void brdrline_audio_w(uint8_t data); - void brdrline_audio_aux_w(uint8_t data); - TIMER_CALLBACK_MEMBER( frogs_croak_callback ); /*----------- defined in audio/depthch.cpp -----------*/ void depthch_audio_w(uint8_t data); @@ -163,13 +159,9 @@ protected: void pulsar_audio_1_w(uint8_t data); void pulsar_audio_2_w(uint8_t data); - /*----------- defined in audio/tranqgun.cpp -----------*/ - void tranqgun_audio_w(uint8_t data); - TIMER_DEVICE_CALLBACK_MEMBER(clear_coin_status); DECLARE_MACHINE_START(samurai); - DECLARE_MACHINE_START(frogs_audio); virtual void machine_start() override; diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h index bc910e8be0e..2054be06828 100644 --- a/src/mame/includes/williams.h +++ b/src/mame/includes/williams.h @@ -11,6 +11,7 @@ #pragma once #include "audio/williams.h" +#include "audio/s11c_bg.h" #include "cpu/m6800/m6800.h" #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" @@ -479,7 +480,7 @@ public: joust2_state(const machine_config &mconfig, device_type type, const char *tag) : williams_d000_rom_state(mconfig, type, tag), m_mux(*this, "mux"), - m_cvsd_sound(*this, "cvsd") + m_bg(*this, "bg") { } void joust2(machine_config &config); @@ -489,7 +490,7 @@ private: virtual void driver_init() override; required_device<ls157_device> m_mux; - required_device<williams_cvsd_sound_device> m_cvsd_sound; + required_device<s11_obg_device> m_bg; uint16_t m_current_sound_data; virtual TILE_GET_INFO_MEMBER(get_tile_info) override; @@ -497,7 +498,7 @@ private: TIMER_CALLBACK_MEMBER(deferred_snd_cmd_w); void snd_cmd_w(u8 data); - DECLARE_WRITE_LINE_MEMBER(pia_3_cb1_w); + DECLARE_WRITE_LINE_MEMBER(pia_s11_bg_strobe_w); }; /*----------- defined in video/williams.cpp -----------*/ diff --git a/src/mame/includes/wswan.h b/src/mame/includes/wswan.h deleted file mode 100644 index 2657e33e3c3..00000000000 --- a/src/mame/includes/wswan.h +++ /dev/null @@ -1,120 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/***************************************************************************** - * - * includes/wswan.h - * - ****************************************************************************/ -#ifndef MAME_INCLUDES_WSWAN_H -#define MAME_INCLUDES_WSWAN_H - -#pragma once - -#define WSWAN_TYPE_MONO 0 -#define WSWAN_TYPE_COLOR 1 - -#define INTERNAL_EEPROM_SIZE 1024 - -#include "cpu/v30mz/v30mz.h" -#include "machine/nvram.h" -#include "audio/wswan.h" -#include "video/wswan.h" -#include "bus/wswan/slot.h" -#include "bus/wswan/rom.h" -#include "emupal.h" - - -class wswan_state : public driver_device -{ -public: - wswan_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_vdp(*this, "vdp"), - m_sound(*this, "custom"), - m_cart(*this, "cartslot"), - m_cursx(*this, "CURSX"), - m_cursy(*this, "CURSY"), - m_buttons(*this, "BUTTONS") - { } - - void wswan(machine_config &config); - -protected: - /* Interrupt flags */ - static const uint8_t WSWAN_IFLAG_STX = 0x01; - static const uint8_t WSWAN_IFLAG_KEY = 0x02; - static const uint8_t WSWAN_IFLAG_RTC = 0x04; - static const uint8_t WSWAN_IFLAG_SRX = 0x08; - static const uint8_t WSWAN_IFLAG_LCMP = 0x10; - static const uint8_t WSWAN_IFLAG_VBLTMR = 0x20; - static const uint8_t WSWAN_IFLAG_VBL = 0x40; - static const uint8_t WSWAN_IFLAG_HBLTMR = 0x80; - - /* Interrupts */ - static const uint8_t WSWAN_INT_STX = 0; - static const uint8_t WSWAN_INT_KEY = 1; - static const uint8_t WSWAN_INT_RTC = 2; - static const uint8_t WSWAN_INT_SRX = 3; - static const uint8_t WSWAN_INT_LCMP = 4; - static const uint8_t WSWAN_INT_VBLTMR = 5; - static const uint8_t WSWAN_INT_VBL = 6; - static const uint8_t WSWAN_INT_HBLTMR = 7; - - struct SoundDMA - { - uint32_t source; /* Source address */ - uint16_t size; /* Size */ - uint8_t enable; /* Enabled */ - }; - - required_device<cpu_device> m_maincpu; - required_device<wswan_video_device> m_vdp; - required_device<wswan_sound_device> m_sound; - required_device<ws_cart_slot_device> m_cart; - - uint8_t m_ws_portram[256]; - uint8_t m_internal_eeprom[INTERNAL_EEPROM_SIZE]; - uint8_t m_system_type; - SoundDMA m_sound_dma; - std::unique_ptr<uint8_t[]> m_ws_bios_bank; - uint8_t m_bios_disabled; - uint8_t m_rotate; - - required_ioport m_cursx; - required_ioport m_cursy; - required_ioport m_buttons; - - uint8_t bios_r(offs_t offset); - uint8_t port_r(offs_t offset); - void port_w(offs_t offset, uint8_t data); - - void set_irq_line(int irq); - void dma_sound_cb(); - void common_start(); - virtual void machine_start() override; - virtual void machine_reset() override; - void wswan_palette(palette_device &palette) const; - - void wswan_io(address_map &map); - void wswan_mem(address_map &map); - void wswan_snd(address_map &map); - - void register_save(); - void handle_irqs(); - void clear_irq_line(int irq); -}; - -class wscolor_state : public wswan_state -{ -public: - using wswan_state::wswan_state; - void wscolor(machine_config &config); - -protected: - virtual void machine_start() override; - void wscolor_mem(address_map &map); - void wscolor_palette(palette_device &palette) const; -}; - -#endif // MAME_INCLUDES_WSWAN_H diff --git a/src/mame/includes/xavix.h b/src/mame/includes/xavix.h index 22d4b584d3a..7f24498bbf3 100644 --- a/src/mame/includes/xavix.h +++ b/src/mame/includes/xavix.h @@ -48,7 +48,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/mame/includes/xbox_pci.h b/src/mame/includes/xbox_pci.h index 05829c6028e..b0fc2aae613 100644 --- a/src/mame/includes/xbox_pci.h +++ b/src/mame/includes/xbox_pci.h @@ -169,6 +169,7 @@ public: class mcpx_smbus_device : public pci_device { public: + mcpx_smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id); mcpx_smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto interrupt_handler() { return m_interrupt_handler.bind(); } @@ -182,6 +183,8 @@ protected: virtual void device_start() override; virtual void device_reset() override; + virtual void config_map(address_map &map) override; + private: devcb_write_line m_interrupt_handler; struct smbus_state { @@ -199,6 +202,8 @@ private: void smbus_io2(address_map &map); uint32_t smbus_read(int bus, offs_t offset, uint32_t mem_mask); void smbus_write(int bus, offs_t offset, uint32_t data, uint32_t mem_mask); + uint8_t minimum_grant_r() { return 3; } + uint8_t maximum_latency_r() { return 1; } }; DECLARE_DEVICE_TYPE(MCPX_SMBUS, mcpx_smbus_device) @@ -209,6 +214,7 @@ DECLARE_DEVICE_TYPE(MCPX_SMBUS, mcpx_smbus_device) class usb_function_device; class mcpx_ohci_device : public pci_device { public: + mcpx_ohci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id); mcpx_ohci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void set_hack_callback(std::function<void(void)> hack) { hack_callback = hack; } void plug_usb_device(int port, device_usb_ohci_function_interface *function); @@ -224,6 +230,8 @@ protected: virtual void device_config_complete() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void config_map(address_map &map) override; + private: ohci_usb_controller *ohci_usb; devcb_write_line m_interrupt_handler; @@ -236,6 +244,8 @@ private: int port; } connecteds[4]; int connecteds_count; + uint8_t minimum_grant_r() { return 3; } + uint8_t maximum_latency_r() { return 1; } }; DECLARE_DEVICE_TYPE(MCPX_OHCI, mcpx_ohci_device) @@ -271,9 +281,10 @@ DECLARE_DEVICE_TYPE(MCPX_ETH, mcpx_eth_device) class mcpx_apu_device : public pci_device { public: template <typename T> - mcpx_apu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag) + mcpx_apu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id, T &&cpu_tag) : mcpx_apu_device(mconfig, tag, owner, clock) { + set_ids(0x10de01b0, 0xc2, 0x040100, subsystem_id); set_cpu_tag(std::forward<T>(cpu_tag)); } mcpx_apu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -287,6 +298,8 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void config_map(address_map &map) override; + private: required_device<device_memory_interface> cpu; // APU contains 3 dsps: voice processor (VP) global processor (GP) encode processor (EP) @@ -312,6 +325,8 @@ private: address_space *space; } apust; void apu_mmio(address_map &map); + uint8_t minimum_grant_r() { return 1; } + uint8_t maximum_latency_r() { return 0xc; } }; DECLARE_DEVICE_TYPE(MCPX_APU, mcpx_apu_device) @@ -322,6 +337,7 @@ DECLARE_DEVICE_TYPE(MCPX_APU, mcpx_apu_device) class mcpx_ac97_audio_device : public pci_device { public: + mcpx_ac97_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id); mcpx_ac97_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); uint32_t ac97_audio_r(offs_t offset, uint32_t mem_mask = ~0); @@ -335,6 +351,8 @@ protected: virtual void device_start() override; virtual void device_reset() override; + virtual void config_map(address_map &map) override; + private: struct ac97_state { uint32_t mixer_regs[0x84 / 4]; @@ -343,6 +361,8 @@ private: void ac97_mmio(address_map &map); void ac97_io0(address_map &map); void ac97_io1(address_map &map); + uint8_t minimum_grant_r() { return 2; } + uint8_t maximum_latency_r() { return 5; } }; DECLARE_DEVICE_TYPE(MCPX_AC97_AUDIO, mcpx_ac97_audio_device) @@ -364,13 +384,12 @@ DECLARE_DEVICE_TYPE(MCPX_AC97_MODEM, mcpx_ac97_modem_device) class mcpx_ide_device : public pci_device { public: + mcpx_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id); mcpx_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto pri_interrupt_handler() { return m_pri_interrupt_handler.bind(); } auto sec_interrupt_handler() { return m_sec_interrupt_handler.bind(); } - virtual void config_map(address_map &map) override; - void class_rev_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); uint8_t pri_read_cs1_r(); void pri_write_cs1_w(uint8_t data); @@ -384,6 +403,8 @@ protected: virtual void map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) override; + virtual void config_map(address_map &map) override; + private: required_device<bus_master_ide_controller_device> m_pri; required_device<bus_master_ide_controller_device> m_sec; @@ -396,6 +417,8 @@ private: void ide_io(address_map &map); DECLARE_WRITE_LINE_MEMBER(ide_pri_interrupt); DECLARE_WRITE_LINE_MEMBER(ide_sec_interrupt); + uint8_t minimum_grant_r() { return 3; } + uint8_t maximum_latency_r() { return 1; } }; DECLARE_DEVICE_TYPE(MCPX_IDE, mcpx_ide_device) diff --git a/src/mame/includes/xerox820.h b/src/mame/includes/xerox820.h index 86f436f6432..e5e9c9c3f81 100644 --- a/src/mame/includes/xerox820.h +++ b/src/mame/includes/xerox820.h @@ -22,6 +22,7 @@ #include "machine/z80sio.h" #include "sound/spkrdev.h" #include "sound/beep.h" +#include "machine/timer.h" #include "imagedev/floppy.h" #include "imagedev/snapquik.h" #include "emupal.h" @@ -136,6 +137,7 @@ public: bigboard_state(const machine_config &mconfig, device_type type, const char *tag) : xerox820_state(mconfig, type, tag) , m_beeper(*this, "beeper") + , m_beep_timer(*this, "beep_timer") { } void kbpio_pa_w(uint8_t data); @@ -144,9 +146,10 @@ public: protected: virtual void machine_reset() override; - TIMER_CALLBACK_MEMBER(bigboard_beepoff); + TIMER_DEVICE_CALLBACK_MEMBER(beep_timer); required_device<beep_device> m_beeper; + required_device<timer_device> m_beep_timer; bool m_bit5; }; diff --git a/src/mame/layout/allied.lay b/src/mame/layout/allied.lay index dcf52fad9b2..96d502fc506 100644 --- a/src/mame/layout/allied.lay +++ b/src/mame/layout/allied.lay @@ -12,7 +12,7 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk> </element> <element name="P0"><text string="Ball"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -22,6 +22,16 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="-1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> @@ -29,85 +39,28 @@ copyright-holders:Robbbert <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit5" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit0" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="5" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit15" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="15" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit25" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit24" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="25" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit35" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit34" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="35" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit41" ref="digit"> diff --git a/src/mame/layout/amerihok.lay b/src/mame/layout/amerihok.lay index 7e99d507559..7d49457fae8 100644 --- a/src/mame/layout/amerihok.lay +++ b/src/mame/layout/amerihok.lay @@ -14,7 +14,7 @@ license:CC0 <color red="0.0" green="0.0" blue="0.0" /> </rect> </element> - <element name="disk" defstate="0"><disk><color red="0.8" green="0.8" blue="0" /></disk></element> + <element name="disk" defstate="0"><disk state="0"><color red="0.8" green="0.8" blue="0" /></disk></element> <element name="label_left"><text string="Home"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="label_right"><text string="Visitor"><color red="1.0" green="1.0" blue="1.0" /></text></element> diff --git a/src/mame/layout/babypkr.lay b/src/mame/layout/babypkr.lay index 46fc90f2fe0..c0bde122cc9 100644 --- a/src/mame/layout/babypkr.lay +++ b/src/mame/layout/babypkr.lay @@ -3,91 +3,118 @@ license:CC0 --> <mamelayout version="2"> - <element name="L0" defstate="1"> - <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <element name="L0"> + <rect state="0"> + <color red="0.25" green="0.25" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="1.00" blue="0.0" /> </rect> - <text string="DRAW/TAKE" state="1"> + <text string="DRAW/TAKE"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L1" defstate="1"> - <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <element name="L1"> + <rect state="0"> + <color red="0.25" green="0.25" blue="0.0" /> </rect> - <text string="CANCEL/DOUBLE" state="1"> + <rect state="1"> + <color red="1.00" green="1.00" blue="0.0" /> + </rect> + <text string="CANCEL/DOUBLE"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L2" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue=".0" /> + <element name="L2"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 1 " state="1"> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> + </rect> + <text string=" HOLD 1 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L3" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L3"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 2 " state="1"> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> + </rect> + <text string=" HOLD 2 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L4" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L4"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 3 " state="1"> + <text string=" HOLD 3 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L5" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L5"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 4 " state="1"> + <text string=" HOLD 4 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L6" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L6"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 5 " state="1"> + <text string=" HOLD 5 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L7" defstate="1"> - <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <element name="L7"> + <rect state="0"> + <color red="0.25" green="0.25" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="1.00" blue="0.0" /> </rect> - <text string=" DEAL " state="1"> + <text string=" DEAL "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L8" defstate="1"> - <disk> - <color red="0.70" green="0.0" blue="0.0" /> - </disk> - <text string="BET" state="1"> + <element name="L8"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> + </rect> + <text string="BET"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> @@ -111,13 +138,13 @@ license:CC0 </rect> </element> - <element name="LX" defstate="1"> + <element name="LX"> <rect> <color red="0.00" green="0.0" blue="0.0" /> </rect> </element> - <element name="Dig1" defstate="1"> + <element name="Dig1"> <led7seg> <color red="1" green="1" blue="1" /> </led7seg> @@ -128,34 +155,34 @@ license:CC0 <bounds left="0" top="0" right="4" bottom="3" /> </screen> - <element name="" ref="LX"> + <element ref="LX"> <bounds x="0.0" y="3.00" width="0.01" height="0.50" /> </element> - <element name="lamp3" ref="L8"> + <element name="lamp3" ref="L8" inputtag="IN1" inputmask="0x08"> <bounds x="0.022" y="3.16" width="0.315" height="0.315" /> </element> - <element name="lamp2" ref="L0"> + <element name="lamp2" ref="L0" inputtag="IN0" inputmask="0x10" > <bounds x="0.382" y="3.16" width="0.449" height="0.315" /> </element> - <element name="lamp0" ref="L1"> + <element name="lamp0" ref="L1" inputtag="IN0" inputmask="0x20"> <bounds x="0.876" y="3.16" width="0.449" height="0.315" /> </element> - <element name="lamp1" ref="L2"> + <element name="lamp1" ref="L2" inputtag="IN0" inputmask="0x40"> <bounds x="1.371" y="3.16" width="0.315" height="0.315" /> </element> - <element name="lamp1" ref="L3"> + <element name="lamp1" ref="L3" inputtag="IN0" inputmask="0x80"> <bounds x="1.730" y="3.16" width="0.315" height="0.315" /> </element> - <element name="lamp1" ref="L4"> + <element name="lamp1" ref="L4" inputtag="IN1" inputmask="0x01"> <bounds x="2.090" y="3.16" width="0.315" height="0.315" /> </element> - <element name="lamp1" ref="L5"> + <element name="lamp1" ref="L5" inputtag="IN1" inputmask="0x02"> <bounds x="2.449" y="3.16" width="0.315" height="0.315" /> </element> - <element name="lamp1" ref="L6"> + <element name="lamp1" ref="L6" inputtag="IN1" inputmask="0x04"> <bounds x="2.809" y="3.16" width="0.315" height="0.315" /> </element> - <element name="lamp3" ref="L7"> + <element name="lamp3" ref="L7" inputtag="IN0" inputmask="0x08"> <bounds x="3.169" y="3.16" width="0.449" height="0.315" /> </element> @@ -180,6 +207,5 @@ license:CC0 </element> </repeat> </repeat> - </view> </mamelayout> diff --git a/src/mame/layout/brkball.lay b/src/mame/layout/brkball.lay index 809b5901cf2..f88c6185534 100644 --- a/src/mame/layout/brkball.lay +++ b/src/mame/layout/brkball.lay @@ -7,10 +7,16 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> + <group name="dmd"> <repeat count="21"> <param name="s" start="0" increment="65" /> @@ -20,6 +26,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/cgang.lay b/src/mame/layout/cgang.lay index a8a46b91c66..76cd60d2c77 100644 --- a/src/mame/layout/cgang.lay +++ b/src/mame/layout/cgang.lay @@ -7,7 +7,6 @@ license:CC0 <!-- define elements --> <element name="black"><rect><color red="0" green="0" blue="0" /></rect></element> - <element name="blackd"><disk><color red="0" green="0" blue="0" /></disk></element> <element name="white"><rect><color red="0.9" green="0.9" blue="0.92" /></rect></element> <element name="gray2"><rect><color red="0.12" green="0.12" blue="0.12" /></rect></element> <element name="yellow"><rect><color red="0.9" green="0.9" blue="0.15" /></rect></element> @@ -74,7 +73,7 @@ license:CC0 </element> <element name="nothing" defstate="0"> - <text string=" "/> + <rect><color alpha="0" /></rect> </element> <element name="hlb" defstate="0"> @@ -113,8 +112,12 @@ license:CC0 </element> <element name="ledg" defstate="0"> - <disk state="0"><color red="0.2" green="0.4" blue="0.17" /></disk> - <disk state="1"><color red="0.5" green="1.0" blue="0.4" /></disk> + <disk> + <bounds left="-0.5" top="-0.5" right="2.5" bottom="2.5" /> + <color red="0" green="0" blue="0" /> + </disk> + <disk state="0"><bounds width="2" height="2" /><color red="0.2" green="0.4" blue="0.17" /></disk> + <disk state="1"><bounds width="2" height="2" /><color red="0.5" green="1.0" blue="0.4" /></disk> </element> <element name="ledr" defstate="0"> @@ -253,213 +256,12 @@ license:CC0 </disk> </element> - <element name="ani_white" defstate="0"> - <text string=" "><bounds x="0" y="0" width="1" height="100" /></text> - <rect state="1"><bounds x="0" y="0" width="1" height="1" /><color red="1" green="1" blue="1" /></rect> - <rect state="2"><bounds x="0" y="0" width="1" height="2" /><color red="1" green="1" blue="1" /></rect> - <rect state="3"><bounds x="0" y="0" width="1" height="3" /><color red="1" green="1" blue="1" /></rect> - <rect state="4"><bounds x="0" y="0" width="1" height="4" /><color red="1" green="1" blue="1" /></rect> - <rect state="5"><bounds x="0" y="0" width="1" height="5" /><color red="1" green="1" blue="1" /></rect> - <rect state="6"><bounds x="0" y="0" width="1" height="6" /><color red="1" green="1" blue="1" /></rect> - <rect state="7"><bounds x="0" y="0" width="1" height="7" /><color red="1" green="1" blue="1" /></rect> - <rect state="8"><bounds x="0" y="0" width="1" height="8" /><color red="1" green="1" blue="1" /></rect> - <rect state="9"><bounds x="0" y="0" width="1" height="9" /><color red="1" green="1" blue="1" /></rect> - <rect state="10"><bounds x="0" y="0" width="1" height="10" /><color red="1" green="1" blue="1" /></rect> - <rect state="11"><bounds x="0" y="0" width="1" height="11" /><color red="1" green="1" blue="1" /></rect> - <rect state="12"><bounds x="0" y="0" width="1" height="12" /><color red="1" green="1" blue="1" /></rect> - <rect state="13"><bounds x="0" y="0" width="1" height="13" /><color red="1" green="1" blue="1" /></rect> - <rect state="14"><bounds x="0" y="0" width="1" height="14" /><color red="1" green="1" blue="1" /></rect> - <rect state="15"><bounds x="0" y="0" width="1" height="15" /><color red="1" green="1" blue="1" /></rect> - <rect state="16"><bounds x="0" y="0" width="1" height="16" /><color red="1" green="1" blue="1" /></rect> - <rect state="17"><bounds x="0" y="0" width="1" height="17" /><color red="1" green="1" blue="1" /></rect> - <rect state="18"><bounds x="0" y="0" width="1" height="18" /><color red="1" green="1" blue="1" /></rect> - <rect state="19"><bounds x="0" y="0" width="1" height="19" /><color red="1" green="1" blue="1" /></rect> - <rect state="20"><bounds x="0" y="0" width="1" height="20" /><color red="1" green="1" blue="1" /></rect> - <rect state="21"><bounds x="0" y="0" width="1" height="21" /><color red="1" green="1" blue="1" /></rect> - <rect state="22"><bounds x="0" y="0" width="1" height="22" /><color red="1" green="1" blue="1" /></rect> - <rect state="23"><bounds x="0" y="0" width="1" height="23" /><color red="1" green="1" blue="1" /></rect> - <rect state="24"><bounds x="0" y="0" width="1" height="24" /><color red="1" green="1" blue="1" /></rect> - <rect state="25"><bounds x="0" y="0" width="1" height="25" /><color red="1" green="1" blue="1" /></rect> - <rect state="26"><bounds x="0" y="0" width="1" height="26" /><color red="1" green="1" blue="1" /></rect> - <rect state="27"><bounds x="0" y="0" width="1" height="27" /><color red="1" green="1" blue="1" /></rect> - <rect state="28"><bounds x="0" y="0" width="1" height="28" /><color red="1" green="1" blue="1" /></rect> - <rect state="29"><bounds x="0" y="0" width="1" height="29" /><color red="1" green="1" blue="1" /></rect> - <rect state="30"><bounds x="0" y="0" width="1" height="30" /><color red="1" green="1" blue="1" /></rect> - <rect state="31"><bounds x="0" y="0" width="1" height="31" /><color red="1" green="1" blue="1" /></rect> - <rect state="32"><bounds x="0" y="0" width="1" height="32" /><color red="1" green="1" blue="1" /></rect> - <rect state="33"><bounds x="0" y="0" width="1" height="33" /><color red="1" green="1" blue="1" /></rect> - <rect state="34"><bounds x="0" y="0" width="1" height="34" /><color red="1" green="1" blue="1" /></rect> - <rect state="35"><bounds x="0" y="0" width="1" height="35" /><color red="1" green="1" blue="1" /></rect> - <rect state="36"><bounds x="0" y="0" width="1" height="36" /><color red="1" green="1" blue="1" /></rect> - <rect state="37"><bounds x="0" y="0" width="1" height="37" /><color red="1" green="1" blue="1" /></rect> - <rect state="38"><bounds x="0" y="0" width="1" height="38" /><color red="1" green="1" blue="1" /></rect> - <rect state="39"><bounds x="0" y="0" width="1" height="39" /><color red="1" green="1" blue="1" /></rect> - <rect state="40"><bounds x="0" y="0" width="1" height="40" /><color red="1" green="1" blue="1" /></rect> - <rect state="41"><bounds x="0" y="0" width="1" height="41" /><color red="1" green="1" blue="1" /></rect> - <rect state="42"><bounds x="0" y="0" width="1" height="42" /><color red="1" green="1" blue="1" /></rect> - <rect state="43"><bounds x="0" y="0" width="1" height="43" /><color red="1" green="1" blue="1" /></rect> - <rect state="44"><bounds x="0" y="0" width="1" height="44" /><color red="1" green="1" blue="1" /></rect> - <rect state="45"><bounds x="0" y="0" width="1" height="45" /><color red="1" green="1" blue="1" /></rect> - <rect state="46"><bounds x="0" y="0" width="1" height="46" /><color red="1" green="1" blue="1" /></rect> - <rect state="47"><bounds x="0" y="0" width="1" height="47" /><color red="1" green="1" blue="1" /></rect> - <rect state="48"><bounds x="0" y="0" width="1" height="48" /><color red="1" green="1" blue="1" /></rect> - <rect state="49"><bounds x="0" y="0" width="1" height="49" /><color red="1" green="1" blue="1" /></rect> - <rect state="50"><bounds x="0" y="0" width="1" height="50" /><color red="1" green="1" blue="1" /></rect> - <rect state="51"><bounds x="0" y="0" width="1" height="51" /><color red="1" green="1" blue="1" /></rect> - <rect state="52"><bounds x="0" y="0" width="1" height="52" /><color red="1" green="1" blue="1" /></rect> - <rect state="53"><bounds x="0" y="0" width="1" height="53" /><color red="1" green="1" blue="1" /></rect> - <rect state="54"><bounds x="0" y="0" width="1" height="54" /><color red="1" green="1" blue="1" /></rect> - <rect state="55"><bounds x="0" y="0" width="1" height="55" /><color red="1" green="1" blue="1" /></rect> - <rect state="56"><bounds x="0" y="0" width="1" height="56" /><color red="1" green="1" blue="1" /></rect> - <rect state="57"><bounds x="0" y="0" width="1" height="57" /><color red="1" green="1" blue="1" /></rect> - <rect state="58"><bounds x="0" y="0" width="1" height="58" /><color red="1" green="1" blue="1" /></rect> - <rect state="59"><bounds x="0" y="0" width="1" height="59" /><color red="1" green="1" blue="1" /></rect> - <rect state="60"><bounds x="0" y="0" width="1" height="60" /><color red="1" green="1" blue="1" /></rect> - <rect state="61"><bounds x="0" y="0" width="1" height="61" /><color red="1" green="1" blue="1" /></rect> - <rect state="62"><bounds x="0" y="0" width="1" height="62" /><color red="1" green="1" blue="1" /></rect> - <rect state="63"><bounds x="0" y="0" width="1" height="63" /><color red="1" green="1" blue="1" /></rect> - <rect state="64"><bounds x="0" y="0" width="1" height="64" /><color red="1" green="1" blue="1" /></rect> - <rect state="65"><bounds x="0" y="0" width="1" height="65" /><color red="1" green="1" blue="1" /></rect> - <rect state="66"><bounds x="0" y="0" width="1" height="66" /><color red="1" green="1" blue="1" /></rect> - <rect state="67"><bounds x="0" y="0" width="1" height="67" /><color red="1" green="1" blue="1" /></rect> - <rect state="68"><bounds x="0" y="0" width="1" height="68" /><color red="1" green="1" blue="1" /></rect> - <rect state="69"><bounds x="0" y="0" width="1" height="69" /><color red="1" green="1" blue="1" /></rect> - <rect state="70"><bounds x="0" y="0" width="1" height="70" /><color red="1" green="1" blue="1" /></rect> - <rect state="71"><bounds x="0" y="0" width="1" height="71" /><color red="1" green="1" blue="1" /></rect> - <rect state="72"><bounds x="0" y="0" width="1" height="72" /><color red="1" green="1" blue="1" /></rect> - <rect state="73"><bounds x="0" y="0" width="1" height="73" /><color red="1" green="1" blue="1" /></rect> - <rect state="74"><bounds x="0" y="0" width="1" height="74" /><color red="1" green="1" blue="1" /></rect> - <rect state="75"><bounds x="0" y="0" width="1" height="75" /><color red="1" green="1" blue="1" /></rect> - <rect state="76"><bounds x="0" y="0" width="1" height="76" /><color red="1" green="1" blue="1" /></rect> - <rect state="77"><bounds x="0" y="0" width="1" height="77" /><color red="1" green="1" blue="1" /></rect> - <rect state="78"><bounds x="0" y="0" width="1" height="78" /><color red="1" green="1" blue="1" /></rect> - <rect state="79"><bounds x="0" y="0" width="1" height="79" /><color red="1" green="1" blue="1" /></rect> - <rect state="80"><bounds x="0" y="0" width="1" height="80" /><color red="1" green="1" blue="1" /></rect> - <rect state="81"><bounds x="0" y="0" width="1" height="81" /><color red="1" green="1" blue="1" /></rect> - <rect state="82"><bounds x="0" y="0" width="1" height="82" /><color red="1" green="1" blue="1" /></rect> - <rect state="83"><bounds x="0" y="0" width="1" height="83" /><color red="1" green="1" blue="1" /></rect> - <rect state="84"><bounds x="0" y="0" width="1" height="84" /><color red="1" green="1" blue="1" /></rect> - <rect state="85"><bounds x="0" y="0" width="1" height="85" /><color red="1" green="1" blue="1" /></rect> - <rect state="86"><bounds x="0" y="0" width="1" height="86" /><color red="1" green="1" blue="1" /></rect> - <rect state="87"><bounds x="0" y="0" width="1" height="87" /><color red="1" green="1" blue="1" /></rect> - <rect state="88"><bounds x="0" y="0" width="1" height="88" /><color red="1" green="1" blue="1" /></rect> - <rect state="89"><bounds x="0" y="0" width="1" height="89" /><color red="1" green="1" blue="1" /></rect> - <rect state="90"><bounds x="0" y="0" width="1" height="90" /><color red="1" green="1" blue="1" /></rect> - <rect state="91"><bounds x="0" y="0" width="1" height="91" /><color red="1" green="1" blue="1" /></rect> - <rect state="92"><bounds x="0" y="0" width="1" height="92" /><color red="1" green="1" blue="1" /></rect> - <rect state="93"><bounds x="0" y="0" width="1" height="93" /><color red="1" green="1" blue="1" /></rect> - <rect state="94"><bounds x="0" y="0" width="1" height="94" /><color red="1" green="1" blue="1" /></rect> - <rect state="95"><bounds x="0" y="0" width="1" height="95" /><color red="1" green="1" blue="1" /></rect> - <rect state="96"><bounds x="0" y="0" width="1" height="96" /><color red="1" green="1" blue="1" /></rect> - <rect state="97"><bounds x="0" y="0" width="1" height="97" /><color red="1" green="1" blue="1" /></rect> - <rect state="98"><bounds x="0" y="0" width="1" height="98" /><color red="1" green="1" blue="1" /></rect> - <rect state="99"><bounds x="0" y="0" width="1" height="99" /><color red="1" green="1" blue="1" /></rect> - <rect state="100"><bounds x="0" y="0" width="1" height="100" /><color red="1" green="1" blue="1" /></rect> + <element name="crate" defstate="0"> + <rect><color red="0.75" green="0.1" blue="0.15" /></rect> </element> - <element name="ani_crate" defstate="0"> - <text string=" "><bounds x="0" y="0" width="1" height="110" /></text> - <rect state="0"><bounds x="0" y="0" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="1"><bounds x="0" y="1" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="2"><bounds x="0" y="2" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="3"><bounds x="0" y="3" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="4"><bounds x="0" y="4" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="5"><bounds x="0" y="5" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="6"><bounds x="0" y="6" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="7"><bounds x="0" y="7" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="8"><bounds x="0" y="8" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="9"><bounds x="0" y="9" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="10"><bounds x="0" y="10" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="11"><bounds x="0" y="11" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="12"><bounds x="0" y="12" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="13"><bounds x="0" y="13" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="14"><bounds x="0" y="14" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="15"><bounds x="0" y="15" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="16"><bounds x="0" y="16" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="17"><bounds x="0" y="17" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="18"><bounds x="0" y="18" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="19"><bounds x="0" y="19" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="20"><bounds x="0" y="20" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="21"><bounds x="0" y="21" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="22"><bounds x="0" y="22" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="23"><bounds x="0" y="23" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="24"><bounds x="0" y="24" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="25"><bounds x="0" y="25" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="26"><bounds x="0" y="26" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="27"><bounds x="0" y="27" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="28"><bounds x="0" y="28" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="29"><bounds x="0" y="29" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="30"><bounds x="0" y="30" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="31"><bounds x="0" y="31" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="32"><bounds x="0" y="32" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="33"><bounds x="0" y="33" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="34"><bounds x="0" y="34" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="35"><bounds x="0" y="35" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="36"><bounds x="0" y="36" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="37"><bounds x="0" y="37" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="38"><bounds x="0" y="38" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="39"><bounds x="0" y="39" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="40"><bounds x="0" y="40" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="41"><bounds x="0" y="41" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="42"><bounds x="0" y="42" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="43"><bounds x="0" y="43" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="44"><bounds x="0" y="44" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="45"><bounds x="0" y="45" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="46"><bounds x="0" y="46" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="47"><bounds x="0" y="47" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="48"><bounds x="0" y="48" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="49"><bounds x="0" y="49" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="50"><bounds x="0" y="50" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="51"><bounds x="0" y="51" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="52"><bounds x="0" y="52" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="53"><bounds x="0" y="53" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="54"><bounds x="0" y="54" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="55"><bounds x="0" y="55" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="56"><bounds x="0" y="56" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="57"><bounds x="0" y="57" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="58"><bounds x="0" y="58" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="59"><bounds x="0" y="59" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="60"><bounds x="0" y="60" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="61"><bounds x="0" y="61" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="62"><bounds x="0" y="62" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="63"><bounds x="0" y="63" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="64"><bounds x="0" y="64" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="65"><bounds x="0" y="65" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="66"><bounds x="0" y="66" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="67"><bounds x="0" y="67" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="68"><bounds x="0" y="68" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="69"><bounds x="0" y="69" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="70"><bounds x="0" y="70" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="71"><bounds x="0" y="71" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="72"><bounds x="0" y="72" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="73"><bounds x="0" y="73" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="74"><bounds x="0" y="74" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="75"><bounds x="0" y="75" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="76"><bounds x="0" y="76" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="77"><bounds x="0" y="77" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="78"><bounds x="0" y="78" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="79"><bounds x="0" y="79" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="80"><bounds x="0" y="80" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="81"><bounds x="0" y="81" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="82"><bounds x="0" y="82" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="83"><bounds x="0" y="83" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="84"><bounds x="0" y="84" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="85"><bounds x="0" y="85" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="86"><bounds x="0" y="86" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="87"><bounds x="0" y="87" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="88"><bounds x="0" y="88" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="89"><bounds x="0" y="89" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="90"><bounds x="0" y="90" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="91"><bounds x="0" y="91" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="92"><bounds x="0" y="92" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="93"><bounds x="0" y="93" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="94"><bounds x="0" y="94" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="95"><bounds x="0" y="95" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="96"><bounds x="0" y="96" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="97"><bounds x="0" y="97" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="98"><bounds x="0" y="98" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="99"><bounds x="0" y="99" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> - <rect state="100"><bounds x="0" y="100" width="1" height="10" /><color red="0.75" green="0.1" blue="0.15" /></rect> + <element name="door" defstate="0"> + <rect><color red="0.75" green="0.75" blue="0.75" /></rect> </element> @@ -525,37 +327,48 @@ license:CC0 <element ref="blue"><bounds x="7" y="5" width="48" height="3" /></element> <element ref="black"><bounds x="7" y="5" width="48" height="1.5" /></element> - <!-- unable to move the cosmogangs with artwork, have to do it like this with 'fishing lines' --> <repeat count="5"> <param name="x" start="12.6" increment="9" /> <param name="i" start="0" increment="1" /> - <element ref="gray2"><bounds x="~x~" y="17" width="0.8" height="38.5" /></element> - <element name="cg_count~i~" ref="ani_white"><bounds x="~x~" y="17" width="0.8" height="35" /><color alpha="0.5" /></element> - </repeat> - - <repeat count="5"> - <param name="x" start="11.2" increment="9" /> - <param name="i" start="0" increment="1" /> - - <element name="en_count~i~" ref="ani_crate"><bounds x="~x~" y="17" width="3.6" height="38.5" /></element> + <element ref="gray2"><bounds x="~x~" y="15.5" width="0.8" height="40" /></element> </repeat> <repeat count="5"> <param name="x" start="10" increment="9" /> <param name="i" start="0" increment="1" /> + <param name="mask" start="0x01" lshift="1" /> - <element name="cg_sol~i~" ref="cosmo"><bounds x="~x~" y="10" width="6" height="7" /></element> + <element name="cg_sol~i~" ref="cosmo"> + <animate name="cg_count~i~" /> + <bounds state="0" x="~x~" y="10" width="6" height="7" /> + <bounds state="255" x="~x~" y="48.5" width="6" height="7" /> + </element> + + <element ref="nothing" inputtag="FAKE1" inputmask="~mask~"> + <animate name="cg_count~i~" /> + <bounds state="0" x="~x~" y="10" width="6" height="7" /> + <bounds state="255" x="~x~" y="48.5" width="6" height="7" /> + </element> </repeat> <repeat count="5"> - <param name="x" start="10" increment="9" /> - <param name="mask" start="0x01" lshift="1" /> + <param name="x" start="11.2" increment="9" /> + <param name="i" start="0" increment="1" /> - <element ref="nothing" blend="add" inputtag="FAKE1" inputmask="~mask~"><bounds x="~x~" y="10" width="6" height="45.5" /></element> + <element ref="crate"> + <animate name="en_count~i~" /> + <bounds state="0" x="~x~" y="13.5" width="3.6" height="3.5" /> + <bounds state="255" x="~x~" y="52" width="3.6" height="3.5" /> + </element> </repeat> - <element name="door_count" ref="ani_white"><bounds x="8.5" y="8" width="45" height="9" /><color alpha="0.3" /></element> + <element ref="door"> + <animate name="door_count" /> + <bounds state="0" x="8.5" y="8" width="45" height="0" /> + <bounds state="255" x="8.5" y="8" width="45" height="9" /> + <color alpha="0.6" /> + </element> </group> @@ -613,13 +426,11 @@ license:CC0 <element name="misc_lamp10" ref="led2p"><bounds x="4.5" y="0.5" width="2" height="2" /></element> <element ref="text_start1"><bounds x="9" y="0.55" width="5" height="1.9" /></element> - <element ref="blackd"><bounds x="14.5" y="0" width="3" height="3" /></element> - <element name="misc_lamp0" ref="ledg"><bounds x="15" y="0.5" width="2" height="2" /></element> + <element name="misc_lamp0" ref="ledg"><bounds x="14.5" y="0" width="3" height="3" /></element> <element ref="hlb" inputtag="IN1" inputmask="0x10"><bounds x="14.5" y="0" width="3" height="3" /><color alpha="0.2" /></element> <element ref="text_start2"><bounds x="18.5" y="0.55" width="5" height="1.9" /></element> - <element ref="blackd"><bounds x="24.0" y="0" width="3" height="3" /></element> - <element name="misc_lamp1" ref="ledg"><bounds x="24.5" y="0.5" width="2" height="2" /></element> + <element name="misc_lamp1" ref="ledg"><bounds x="24" y="0" width="3" height="3" /></element> <element ref="hlb" inputtag="IN1" inputmask="0x08"><bounds x="24.0" y="0" width="3" height="3" /><color alpha="0.2" /></element> </group> diff --git a/src/mame/layout/eacc.lay b/src/mame/layout/eacc.lay index 83b241f9dcf..20d058add21 100644 --- a/src/mame/layout/eacc.lay +++ b/src/mame/layout/eacc.lay @@ -11,7 +11,7 @@ Electronics Australia Car Computer <led7seg><color red="0.75" green="0.0" blue="0.0" /></led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk> </element> <element name="red_button" state="0"> <rect state="0"><color red="0.75" green="0.25" blue="0.25" /></rect> diff --git a/src/mame/layout/emma2.lay b/src/mame/layout/emma2.lay index e0586813dff..094dcadb219 100644 --- a/src/mame/layout/emma2.lay +++ b/src/mame/layout/emma2.lay @@ -12,7 +12,7 @@ license:CC0 </element> <element name="red_led" defstate="1"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> diff --git a/src/mame/layout/epc.lay b/src/mame/layout/epc.lay index 833016329f5..30b31050770 100644 --- a/src/mame/layout/epc.lay +++ b/src/mame/layout/epc.lay @@ -9,7 +9,7 @@ LEDs for the Ericsson PC keyboard <element name="text_caps"><text string="Caps Lock"><color red="0.7" green="0.7" blue="0.7" /></text></element> <element name="text_num"><text string="Num Lock"><color red="0.7" green="0.7" blue="0.7" /></text></element> <element name="text_scroll"><text string="Scroll Lock"><color red="0.7" green="0.7" blue="0.7" /></text></element> - <element name="led" defstate="0"><disk><color red="0.85" green="0.18" blue="0.16" /></disk></element> + <element name="led" defstate="0"><disk state="0"><color red="0.85" green="0.18" blue="0.16" /></disk></element> <group name="caps"> <element ref="led" name="kbled0"><bounds x="0" y="0" width="100" height="100" /></element> diff --git a/src/mame/layout/esq2by16.lay b/src/mame/layout/esq2by16.lay index aa05f652938..400a4ee17a4 100644 --- a/src/mame/layout/esq2by16.lay +++ b/src/mame/layout/esq2by16.lay @@ -32,30 +32,64 @@ license:CC0 </rect> </element> - - <element name="Page1"> - <dotmatrix5dot> - <color red="0.0" green="1.0" blue="1.0" /> - </dotmatrix5dot> - </element> - - <element name="Page2"> - <dotmatrix5dot> - <color red="0.0" green="1.0" blue="0.0" /> - </dotmatrix5dot> - </element> - - <element name="Page3"> - <dotmatrix5dot> - <color red="1.0" green="1.0" blue="0.0" /> - </dotmatrix5dot> + <element name="dotrow"> + <rect> + <bounds x="-0.05" width="5.55" y="-0.05" height="1.1" /> + <color red="0.0" green="0.0" blue="0.0" /> + </rect> + <disk state="0" statemask="0x01"> + <bounds x="0.0" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x02"> + <bounds x="1.1" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x04"> + <bounds x="2.2" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x08"> + <bounds x="3.3" /> + <color red="0.125" green="0.125" blue="0.125" /></disk> + <disk state="0" statemask="0x10"> + <bounds x="4.4" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk statemask="0x01"> + <bounds x="0.0" /> + </disk> + <disk statemask="0x02"> + <bounds x="1.1" /> + </disk> + <disk statemask="0x04"> + <bounds x="2.2" /> + </disk> + <disk statemask="0x08"> + <bounds x="3.3" /> + </disk> + <disk statemask="0x10"> + <bounds x="4.4" /> + </disk> </element> - <element name="Page4"> - <dotmatrix5dot> - <color red="0.0" green="0.0" blue="1.0" /> - </dotmatrix5dot> - </element> + <group name="page"> + <repeat count="2"> + <param name="origin" start="~start~" increment="112" /> + <param name="row" start="0" increment="10" /> + <repeat count="16"> + <param name="char" start="~origin~" increment="7" /> + <param name="x" start="0" increment="6" /> + <repeat count="7"> + <param name="n" start="~char~" increment="1" /> + <param name="y" start="~row~" increment="1" /> + <element name="pg_~n~" ref="dotrow" state="0"> + <bounds x="~x~" y="~y~" width="5" height="1" /> + </element> + </repeat> + </repeat> + </repeat> + </group> <view name="Default Layout"> <!-- Background --> @@ -81,41 +115,29 @@ license:CC0 <element name="rLed_14" ref="rLeds"> <bounds x="280" y="20" width="5" height="3" /> </element> <element name="rLed_15" ref="rLeds"> <bounds x="290" y="20" width="5" height="3" /> </element> - <repeat count="3"> - <param name="page" start="3" increment="-1" /> - <param name="start" start="3000" increment="-1000" /> - <param name="baseline" start="0" increment="20" /> - <repeat count="2"> - <param name="origin" start="~start~" increment="112" /> - <param name="row" start="~baseline~" increment="10" /> - <repeat count="16"> - <param name="char" start="~origin~" increment="7" /> - <param name="x" start="0" increment="6" /> - <repeat count="7"> - <param name="n" start="~char~" increment="1" /> - <param name="y" start="~row~" increment="1" /> - <element name="pg_~n~" ref="Page~page~" state="0"> - <bounds x="~x~" y="~y~" width="5" height="1" /> - </element> - </repeat> - </repeat> - </repeat> - </repeat> - <repeat count="2"> - <param name="origin" start="4000" increment="112" /> - <param name="row" start="80" increment="10" /> - <repeat count="16"> - <param name="char" start="~origin~" increment="7" /> - <param name="x" start="0" increment="6" /> - <repeat count="7"> - <param name="n" start="~char~" increment="1" /> - <param name="y" start="~row~" increment="1" /> - <element name="pg_~n~" ref="Page4" state="0"> - <bounds x="~x~" y="~y~" width="5" height="1" /> - </element> - </repeat> - </repeat> - </repeat> + <param name="start" value="3000" /> + <group ref="page"> + <bounds x="0" y="0" width="95" height="17" /> + <color red="1.0" green="1.0" blue="0.0" /> + </group> + + <param name="start" value="2000" /> + <group ref="page"> + <bounds x="0" y="20" width="95" height="17" /> + <color red="0.0" green="1.0" blue="0.0" /> + </group> + + <param name="start" value="1000" /> + <group ref="page"> + <bounds x="0" y="40" width="95" height="17" /> + <color red="0.0" green="1.0" blue="1.0" /> + </group> + + <param name="start" value="4000" /> + <group ref="page"> + <bounds x="0" y="80" width="95" height="17" /> + <color red="0.0" green="0.0" blue="1.0" /> + </group> </view> </mamelayout> diff --git a/src/mame/layout/fireball.lay b/src/mame/layout/fireball.lay index 605696ff1e4..3c065d226cd 100644 --- a/src/mame/layout/fireball.lay +++ b/src/mame/layout/fireball.lay @@ -14,7 +14,7 @@ license:CC0 </element> <element name="red_led"> - <rect> + <rect state="0"> <color red="1.0" green="0.0" blue="0.0" /> </rect> </element> diff --git a/src/mame/layout/gp_1.lay b/src/mame/layout/gp_1.lay index 307a2f3866e..7fb78c8d787 100644 --- a/src/mame/layout/gp_1.lay +++ b/src/mame/layout/gp_1.lay @@ -11,7 +11,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> diff --git a/src/mame/layout/gp_2.lay b/src/mame/layout/gp_2.lay index 6ea287e5e4e..eeb0089535d 100644 --- a/src/mame/layout/gp_2.lay +++ b/src/mame/layout/gp_2.lay @@ -11,7 +11,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> diff --git a/src/mame/layout/hankin.lay b/src/mame/layout/hankin.lay index 8200df9aa70..8689fc5a5ba 100644 --- a/src/mame/layout/hankin.lay +++ b/src/mame/layout/hankin.lay @@ -12,7 +12,7 @@ copyright-holders:Robbbert </led14seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -21,91 +21,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="5" increment="-1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~s~~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit05" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit04" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit03" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit02" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit01" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit00" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit15" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit25" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit24" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="2" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit35" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit34" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="3" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit41" ref="digit"> diff --git a/src/mame/layout/hp9825.lay b/src/mame/layout/hp9825.lay index 98341bd0bff..713f23f45bd 100644 --- a/src/mame/layout/hp9825.lay +++ b/src/mame/layout/hp9825.lay @@ -6,9 +6,44 @@ Hewlett-Packard 9825 Layout --> <mamelayout version="2"> <element name="dotmatrix5dot"> - <dotmatrix5dot> - <color red="1.0" green="0" blue="0" /> - </dotmatrix5dot> + <rect> + <bounds x="-0.05" width="5.55" y="-0.05" height="1.1" /> + <color red="0.0" green="0.0" blue="0.0" /> + </rect> + <disk state="0" statemask="0x01"> + <bounds x="0.0" /> + <color red="0.25" green="0.25" blue="0.25" /> + </disk> + <disk state="0" statemask="0x02"> + <bounds x="1.1" /> + <color red="0.25" green="0.25" blue="0.25" /> + </disk> + <disk state="0" statemask="0x04"> + <bounds x="2.2" /> + <color red="0.25" green="0.25" blue="0.25" /> + </disk> + <disk state="0" statemask="0x08"> + <bounds x="3.3" /> + <color red="0.25" green="0.25" blue="0.25" /></disk> + <disk state="0" statemask="0x10"> + <bounds x="4.4" /> + <color red="0.25" green="0.25" blue="0.25" /> + </disk> + <disk statemask="0x01"> + <bounds x="0.0" /> + </disk> + <disk statemask="0x02"> + <bounds x="1.1" /> + </disk> + <disk statemask="0x04"> + <bounds x="2.2" /> + </disk> + <disk statemask="0x08"> + <bounds x="3.3" /> + </disk> + <disk statemask="0x10"> + <bounds x="4.4" /> + </disk> </element> <element name="run_light" defstate="0"> @@ -34,6 +69,7 @@ Hewlett-Packard 9825 Layout <param name="rowidx" start="0" increment="1" /> <element name="char_~digitidx~_~rowidx~" ref="dotmatrix5dot" state="0"> <bounds x="~digit_x~" y="~rowidx~" width="5" height="1" /> + <color red="1.0" green="0.0" blue="0.0" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/instruct.lay b/src/mame/layout/instruct.lay index 308287bf402..f0c2fb9b011 100644 --- a/src/mame/layout/instruct.lay +++ b/src/mame/layout/instruct.lay @@ -6,15 +6,13 @@ copyright-holders:Robbbert <mamelayout version="2"> - <element name="digit" defstate="0"> + <element name="digit"> <led7seg> <color red="1.0" green="0.0" blue="0.0" /> </led7seg> </element> - <element name="red_led"> - <disk> - <color red="1.0" green="0.0" blue="0.0" /> - </disk> + <element name="red_led" defstate="1"> + <disk state="0"><color red="1.0" green="0.0" blue="0.0" /></disk> </element> <view name="Default Layout"> @@ -29,7 +27,7 @@ copyright-holders:Robbbert </element> </repeat> <repeat count="8"> - <param name="n" start="0" increment="1" /> + <param name="n" start="7" increment="-1" /> <param name="x" start="20" increment="44" /> <element name="led~n~" ref="red_led"> <bounds x="~x~" width="15" y="80" height="15" /> diff --git a/src/mame/layout/mmd1.lay b/src/mame/layout/mmd1.lay index 94b43dd4053..33be315819c 100644 --- a/src/mame/layout/mmd1.lay +++ b/src/mame/layout/mmd1.lay @@ -8,7 +8,7 @@ Basic display of LEDs for the MMD-1 <mamelayout version="2"> <element name="red_led"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> diff --git a/src/mame/layout/mmd2.lay b/src/mame/layout/mmd2.lay index e64430e1393..2d65e05db0b 100644 --- a/src/mame/layout/mmd2.lay +++ b/src/mame/layout/mmd2.lay @@ -8,19 +8,19 @@ Basic display of LEDs for the MMD-2 <mamelayout version="2"> <element name="r_led"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> <element name="g_led"> - <disk> + <disk state="0"> <color red="0.0" green="1.0" blue="0.0" /> </disk> </element> <element name="o_led"> - <disk> + <disk state="0"> <color red="1.0" green="0.50" blue="0.0" /> </disk> </element> diff --git a/src/mame/layout/model1io2.lay b/src/mame/layout/model1io2.lay index 785b3b4540e..493a8de92fb 100644 --- a/src/mame/layout/model1io2.lay +++ b/src/mame/layout/model1io2.lay @@ -21,29 +21,22 @@ license:CC0 </element> <view name="Default"> - <!-- workaround for MAME selecting a 2-screen view by default --> - <screen tag="ioboard:screen"><bounds left="0" top="0" right="1" bottom="1" /></screen> - - <screen tag="screen"> - <bounds left="0" top="0" right="4" bottom="3" /> - </screen> - </view> - - <view name="Diagnostic"> - <element ref="background"> - <bounds x="0" y="0" width="496" height="419" /> - </element> + <collection name="Diagnostics" visible="no"> + <element ref="background"> + <bounds x="0" y="0" width="512" height="419" /> + </element> + <screen tag="ioboard:screen"> + <bounds left="8" top="392" right="129" bottom="411" /> + </screen> + <element name="led_comm_err" ref="led_red"> + <bounds x="141" y="399" width="5" height="5" /> + </element> + <element ref="text_comm_err"> + <bounds x="145" y="398" width="40" height="7" /> + </element> + </collection> <screen tag="screen"> - <bounds left="0" top="0" right="496" bottom="384" /> - </screen> - <screen tag="ioboard:screen"> - <bounds left="8" top="392" right="129" bottom="411" /> + <bounds left="0" top="0" right="512" bottom="384" /> </screen> - <element name="led_comm_err" ref="led_red"> - <bounds x="141" y="399" width="5" height="5" /> - </element> - <element ref="text_comm_err"> - <bounds x="145" y="398" width="40" height="7" /> - </element> </view> </mamelayout> diff --git a/src/mame/layout/outrun.lay b/src/mame/layout/outrun.lay index 328141206bb..a44fafdb3cb 100644 --- a/src/mame/layout/outrun.lay +++ b/src/mame/layout/outrun.lay @@ -73,7 +73,7 @@ license:CC0 <screen index="0"> <bounds x="0" y="0" width="640" height="480" /> </screen> - <element ref="shifter" inputtag="IN0" inputmask="0x02"> + <element ref="shifter" inputtag="SERVICE" inputmask="0x10"> <bounds x="648" y="414" width="32" height="64" /> </element> </view> @@ -81,7 +81,7 @@ license:CC0 <screen index="0"> <bounds x="0" y="0" width="640" height="480" /> </screen> - <element ref="shifter" inputtag="IN0" inputmask="0x02"> + <element ref="shifter" inputtag="SERVICE" inputmask="0x10"> <bounds x="-40" y="414" width="32" height="64" /> </element> </view> diff --git a/src/mame/layout/play_1.lay b/src/mame/layout/play_1.lay index 4b3ffafb19f..f1e635f7935 100644 --- a/src/mame/layout/play_1.lay +++ b/src/mame/layout/play_1.lay @@ -12,7 +12,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="1.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="1.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -23,91 +25,44 @@ copyright-holders:Robbbert <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P7"><text string="1 2 3 4 5"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit10" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="10" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit20" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit24" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="20" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit30" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit34" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit35" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="30" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit40" ref="digit"> diff --git a/src/mame/layout/play_2.lay b/src/mame/layout/play_2.lay index 2807df9e281..e33313c9540 100644 --- a/src/mame/layout/play_2.lay +++ b/src/mame/layout/play_2.lay @@ -20,91 +20,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="10" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit40" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit50" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit1" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit41" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit51" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit2" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit42" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit52" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="2" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit3" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit43" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit53" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="3" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit4" ref="digit"> diff --git a/src/mame/layout/play_3.lay b/src/mame/layout/play_3.lay index 1679e85cc4c..44217420019 100644 --- a/src/mame/layout/play_3.lay +++ b/src/mame/layout/play_3.lay @@ -20,103 +20,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="7"> + <param name="n" start="~s~" increment="10" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="318" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit40" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit50" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> - <element name="digit60" ref="digit"> - <bounds left="274" top="45" right="308" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="308" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit1" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit41" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit51" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> - <element name="digit61" ref="digit"> - <bounds left="274" top="105" right="308" bottom="144" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="105" right="308" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit2" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit42" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit52" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> - <element name="digit62" ref="digit"> - <bounds left="274" top="165" right="308" bottom="204" /> - </element> + <param name="s" value="2" /> + <group ref="score"> + <bounds left="10" top="165" right="308" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit3" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit43" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit53" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> - <element name="digit63" ref="digit"> - <bounds left="274" top="225" right="308" bottom="264" /> - </element> + <param name="s" value="3" /> + <group ref="score"> + <bounds left="10" top="225" right="308" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit4" ref="digit"> diff --git a/src/mame/layout/s11.lay b/src/mame/layout/s11.lay index b22a6e04108..9f6012cebd7 100644 --- a/src/mame/layout/s11.lay +++ b/src/mame/layout/s11.lay @@ -28,103 +28,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="7"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="24" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="20" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="25" right="364" bottom="249" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit1" ref="digit"> - <bounds left="10" top="45" right="30" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="34" top="45" right="54" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="58" top="45" right="78" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="82" top="45" right="102" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="106" top="45" right="126" bottom="84" /> - </element> - <element name="digit6" ref="digit"> - <bounds left="130" top="45" right="150" bottom="84" /> - </element> - <element name="digit7" ref="digit"> - <bounds left="154" top="45" right="174" bottom="84" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="45" right="174" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit9" ref="digit"> - <bounds left="190" top="45" right="210" bottom="84" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="214" top="45" right="234" bottom="84" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="238" top="45" right="258" bottom="84" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="262" top="45" right="282" bottom="84" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="286" top="45" right="306" bottom="84" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="310" top="45" right="330" bottom="84" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="334" top="45" right="354" bottom="84" /> - </element> + <param name="s" value="9" /> + <group ref="score"> + <bounds left="190" top="45" right="354" bottom="84" /> + </group> <!-- Player 3 Score --> - <element name="digit17" ref="digit"> - <bounds left="10" top="100" right="30" bottom="139" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="34" top="100" right="54" bottom="139" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="58" top="100" right="78" bottom="139" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="82" top="100" right="102" bottom="139" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="106" top="100" right="126" bottom="139" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="130" top="100" right="150" bottom="139" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="154" top="100" right="174" bottom="139" /> - </element> + <param name="s" value="17" /> + <group ref="score"> + <bounds left="10" top="100" right="174" bottom="139" /> + </group> <!-- Player 4 Score --> - <element name="digit25" ref="digit"> - <bounds left="190" top="100" right="210" bottom="139" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="214" top="100" right="234" bottom="139" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="238" top="100" right="258" bottom="139" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="262" top="100" right="282" bottom="139" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="286" top="100" right="306" bottom="139" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="310" top="100" right="330" bottom="139" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="334" top="100" right="354" bottom="139" /> - </element> + <param name="s" value="25" /> + <group ref="score"> + <bounds left="190" top="100" right="354" bottom="139" /> + </group> <!-- Credits and Balls --> <element name="digit16" ref="digit"> diff --git a/src/mame/layout/s11a.lay b/src/mame/layout/s11a.lay index 739fae1b1c6..cb38652e5bf 100644 --- a/src/mame/layout/s11a.lay +++ b/src/mame/layout/s11a.lay @@ -17,7 +17,7 @@ copyright-holders:Robbbert, Barry Rodewald </led7seg> </element> <element name="diagled" defstate="0"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> @@ -28,103 +28,44 @@ copyright-holders:Robbbert, Barry Rodewald <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="7"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="24" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="20" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="25" right="364" bottom="249" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit1" ref="digit"> - <bounds left="10" top="45" right="30" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="34" top="45" right="54" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="58" top="45" right="78" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="82" top="45" right="102" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="106" top="45" right="126" bottom="84" /> - </element> - <element name="digit6" ref="digit"> - <bounds left="130" top="45" right="150" bottom="84" /> - </element> - <element name="digit7" ref="digit"> - <bounds left="154" top="45" right="174" bottom="84" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="45" right="174" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit9" ref="digit"> - <bounds left="190" top="45" right="210" bottom="84" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="214" top="45" right="234" bottom="84" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="238" top="45" right="258" bottom="84" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="262" top="45" right="282" bottom="84" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="286" top="45" right="306" bottom="84" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="310" top="45" right="330" bottom="84" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="334" top="45" right="354" bottom="84" /> - </element> + <param name="s" value="9" /> + <group ref="score"> + <bounds left="190" top="45" right="354" bottom="84" /> + </group> <!-- Player 3 Score --> - <element name="digit17" ref="digit"> - <bounds left="10" top="100" right="30" bottom="139" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="34" top="100" right="54" bottom="139" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="58" top="100" right="78" bottom="139" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="82" top="100" right="102" bottom="139" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="106" top="100" right="126" bottom="139" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="130" top="100" right="150" bottom="139" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="154" top="100" right="174" bottom="139" /> - </element> + <param name="s" value="17" /> + <group ref="score"> + <bounds left="10" top="100" right="174" bottom="139" /> + </group> <!-- Player 4 Score --> - <element name="digit25" ref="digit"> - <bounds left="190" top="100" right="210" bottom="139" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="214" top="100" right="234" bottom="139" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="238" top="100" right="258" bottom="139" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="262" top="100" right="282" bottom="139" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="286" top="100" right="306" bottom="139" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="310" top="100" right="330" bottom="139" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="334" top="100" right="354" bottom="139" /> - </element> + <param name="s" value="25" /> + <group ref="score"> + <bounds left="190" top="100" right="354" bottom="139" /> + </group> <!-- Credits and Balls --> <element name="digit16" ref="digit"> diff --git a/src/mame/layout/s11b.lay b/src/mame/layout/s11b.lay index d80df1e644f..7913a262642 100644 --- a/src/mame/layout/s11b.lay +++ b/src/mame/layout/s11b.lay @@ -16,7 +16,7 @@ license:CC0 </led7seg> </element> <element name="diagled" defstate="0"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> @@ -25,114 +25,44 @@ license:CC0 <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="8"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="24" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="20" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="25" right="400" bottom="244" /> <!-- LEDs --> <!-- Player 1 Score --> - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="30" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="34" top="45" right="54" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="58" top="45" right="78" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="82" top="45" right="102" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="106" top="45" right="126" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="130" top="45" right="150" bottom="84" /> - </element> - <element name="digit6" ref="digit"> - <bounds left="154" top="45" right="174" bottom="84" /> - </element> - <element name="digit7" ref="digit"> - <bounds left="178" top="45" right="198" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="198" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit8" ref="digit"> - <bounds left="202" top="45" right="222" bottom="84" /> - </element> - <element name="digit9" ref="digit"> - <bounds left="226" top="45" right="246" bottom="84" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="250" top="45" right="270" bottom="84" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="274" top="45" right="294" bottom="84" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="298" top="45" right="318" bottom="84" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="322" top="45" right="342" bottom="84" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="346" top="45" right="366" bottom="84" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="370" top="45" right="390" bottom="84" /> - </element> + <param name="s" value="8" /> + <group ref="score"> + <bounds left="202" top="45" right="390" bottom="84" /> + </group> <!-- Player 3 Score --> - <element name="digit16" ref="digit"> - <bounds left="10" top="100" right="30" bottom="139" /> - </element> - <element name="digit17" ref="digit"> - <bounds left="34" top="100" right="54" bottom="139" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="58" top="100" right="78" bottom="139" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="82" top="100" right="102" bottom="139" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="106" top="100" right="126" bottom="139" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="130" top="100" right="150" bottom="139" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="154" top="100" right="174" bottom="139" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="178" top="100" right="198" bottom="139" /> - </element> + <param name="s" value="16" /> + <group ref="score"> + <bounds left="10" top="100" right="198" bottom="139" /> + </group> <!-- Player 4 Score --> - <element name="digit24" ref="digit"> - <bounds left="202" top="100" right="222" bottom="139" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="226" top="100" right="246" bottom="139" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="250" top="100" right="270" bottom="139" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="274" top="100" right="294" bottom="139" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="298" top="100" right="318" bottom="139" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="322" top="100" right="342" bottom="139" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="346" top="100" right="366" bottom="139" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="370" top="100" right="390" bottom="139" /> - </element> + <param name="s" value="24" /> + <group ref="score"> + <bounds left="202" top="100" right="390" bottom="139" /> + </group> <!-- Credits and Balls --> <element name="digit60" ref="diagled"> diff --git a/src/mame/layout/s11c.lay b/src/mame/layout/s11c.lay index d80df1e644f..7913a262642 100644 --- a/src/mame/layout/s11c.lay +++ b/src/mame/layout/s11c.lay @@ -16,7 +16,7 @@ license:CC0 </led7seg> </element> <element name="diagled" defstate="0"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> @@ -25,114 +25,44 @@ license:CC0 <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="8"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="24" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="20" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="25" right="400" bottom="244" /> <!-- LEDs --> <!-- Player 1 Score --> - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="30" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="34" top="45" right="54" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="58" top="45" right="78" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="82" top="45" right="102" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="106" top="45" right="126" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="130" top="45" right="150" bottom="84" /> - </element> - <element name="digit6" ref="digit"> - <bounds left="154" top="45" right="174" bottom="84" /> - </element> - <element name="digit7" ref="digit"> - <bounds left="178" top="45" right="198" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="198" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit8" ref="digit"> - <bounds left="202" top="45" right="222" bottom="84" /> - </element> - <element name="digit9" ref="digit"> - <bounds left="226" top="45" right="246" bottom="84" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="250" top="45" right="270" bottom="84" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="274" top="45" right="294" bottom="84" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="298" top="45" right="318" bottom="84" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="322" top="45" right="342" bottom="84" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="346" top="45" right="366" bottom="84" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="370" top="45" right="390" bottom="84" /> - </element> + <param name="s" value="8" /> + <group ref="score"> + <bounds left="202" top="45" right="390" bottom="84" /> + </group> <!-- Player 3 Score --> - <element name="digit16" ref="digit"> - <bounds left="10" top="100" right="30" bottom="139" /> - </element> - <element name="digit17" ref="digit"> - <bounds left="34" top="100" right="54" bottom="139" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="58" top="100" right="78" bottom="139" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="82" top="100" right="102" bottom="139" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="106" top="100" right="126" bottom="139" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="130" top="100" right="150" bottom="139" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="154" top="100" right="174" bottom="139" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="178" top="100" right="198" bottom="139" /> - </element> + <param name="s" value="16" /> + <group ref="score"> + <bounds left="10" top="100" right="198" bottom="139" /> + </group> <!-- Player 4 Score --> - <element name="digit24" ref="digit"> - <bounds left="202" top="100" right="222" bottom="139" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="226" top="100" right="246" bottom="139" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="250" top="100" right="270" bottom="139" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="274" top="100" right="294" bottom="139" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="298" top="100" right="318" bottom="139" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="322" top="100" right="342" bottom="139" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="346" top="100" right="366" bottom="139" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="370" top="100" right="390" bottom="139" /> - </element> + <param name="s" value="24" /> + <group ref="score"> + <bounds left="202" top="100" right="390" bottom="139" /> + </group> <!-- Credits and Balls --> <element name="digit60" ref="diagled"> diff --git a/src/mame/layout/s3.lay b/src/mame/layout/s3.lay index a8b7c7627aa..edda250d126 100644 --- a/src/mame/layout/s3.lay +++ b/src/mame/layout/s3.lay @@ -12,7 +12,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -21,91 +23,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit8" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit9" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="8" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit16" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit17" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="16" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit24" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="24" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit14" ref="digit"> diff --git a/src/mame/layout/s4.lay b/src/mame/layout/s4.lay index a8b7c7627aa..edda250d126 100644 --- a/src/mame/layout/s4.lay +++ b/src/mame/layout/s4.lay @@ -12,7 +12,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -21,91 +23,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit8" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit9" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="8" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit16" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit17" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="16" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit24" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="24" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit14" ref="digit"> diff --git a/src/mame/layout/s6.lay b/src/mame/layout/s6.lay index 0951612d38a..961524a27da 100644 --- a/src/mame/layout/s6.lay +++ b/src/mame/layout/s6.lay @@ -12,7 +12,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -21,91 +23,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit0" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="0" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit8" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit9" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="8" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit20" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit24" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="20" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit28" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="28" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit14" ref="digit"> diff --git a/src/mame/layout/s6a.lay b/src/mame/layout/s6a.lay index 92a279b3184..bc08684e881 100644 --- a/src/mame/layout/s6a.lay +++ b/src/mame/layout/s6a.lay @@ -23,103 +23,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="7"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="318" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit1" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit6" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> - <element name="digit7" ref="digit"> - <bounds left="274" top="45" right="308" bottom="84" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="45" right="308" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit9" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="274" top="105" right="308" bottom="144" /> - </element> + <param name="s" value="9" /> + <group ref="score"> + <bounds left="10" top="105" right="308" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit17" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="274" top="165" right="308" bottom="204" /> - </element> + <param name="s" value="17" /> + <group ref="score"> + <bounds left="10" top="165" right="308" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit25" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="274" top="225" right="308" bottom="264" /> - </element> + <param name="s" value="25" /> + <group ref="score"> + <bounds left="10" top="225" right="308" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit16" ref="digit"> diff --git a/src/mame/layout/s9.lay b/src/mame/layout/s9.lay index 92a279b3184..bc08684e881 100644 --- a/src/mame/layout/s9.lay +++ b/src/mame/layout/s9.lay @@ -23,103 +23,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="7"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="318" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit1" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit6" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> - <element name="digit7" ref="digit"> - <bounds left="274" top="45" right="308" bottom="84" /> - </element> + <param name="s" value="1" /> + <group ref="score"> + <bounds left="10" top="45" right="308" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit9" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="274" top="105" right="308" bottom="144" /> - </element> + <param name="s" value="9" /> + <group ref="score"> + <bounds left="10" top="105" right="308" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit17" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit18" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit19" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="274" top="165" right="308" bottom="204" /> - </element> + <param name="s" value="17" /> + <group ref="score"> + <bounds left="10" top="165" right="308" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit25" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit26" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit27" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit28" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit29" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="274" top="225" right="308" bottom="264" /> - </element> + <param name="s" value="25" /> + <group ref="score"> + <bounds left="10" top="225" right="308" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit16" ref="digit"> diff --git a/src/mame/layout/saitek_ssystem3.lay b/src/mame/layout/saitek_ssystem3.lay index 0ee2fa6e6c7..a65a1acb6cb 100644 --- a/src/mame/layout/saitek_ssystem3.lay +++ b/src/mame/layout/saitek_ssystem3.lay @@ -214,7 +214,11 @@ license:CC0 <!-- lcd screen 2 --> <element name="whitew"><rect><color red="1" green="1" blue="1" /></rect></element> - <element name="lcd2m"><rect><color red="0.69" green="0.69" blue="0.69" /></rect></element> + + <element name="lcd2m" defstate="1"> + <rect state="1"><color red="1" green="1" blue="1" /></rect> + <rect state="0"><color red="0.69" green="0.69" blue="0.69" /></rect> + </element> <element name="lcd_cb"> <rect><bounds x="-2.5" y="-2.5" width="45" height="45" /><color red="0.05" green="0.55" blue="0.4" /></rect> diff --git a/src/mame/layout/sc1_vfd.lay b/src/mame/layout/sc1_vfd.lay index 98c827faed8..f81bc27f1c0 100644 --- a/src/mame/layout/sc1_vfd.lay +++ b/src/mame/layout/sc1_vfd.lay @@ -18,18 +18,28 @@ license:CC0 </rect> </element> <element name="vfd0"> - <led14segsc> - <color red="0" green="0.6" blue="1.0" /> - </led14segsc> + <led14segsc> + <color red="0" green="0.6" blue="1.0" /> + </led14segsc> </element> <element name="Steppers" defstate="0"> <simplecounter maxstate="999" digits="3"> - <color red="1.0" green="1.0" blue="1.0" /> - <bounds x="0" y="0" width="1" height="1" /> + <color red="1.0" green="1.0" blue="1.0" /> + <bounds x="0" y="0" width="1" height="1" /> </simplecounter> </element> + <group name="vfd"> + <repeat count="16"> + <param name="n" start="0" increment="1" /> + <param name="x" start="0" increment="9" /> + <element name="vfd~n~" ref="vfd0" state="0"> + <bounds x="~x~" y="0" width="9" height="17" /> + </element> + </repeat> + </group> + <view name="VFD, Reels and Lamp Matrix"> <element name="reel1" ref="Steppers" state="0"> <bounds x="10" y="320" width="50" height="50"/> @@ -50,871 +60,23 @@ license:CC0 <bounds x="280" y="320" width="50" height="50"/> </element> - <element name="lamp0" ref="matrixlamp" state="0"> - <bounds x="0" y="0" width="7" height="7"/> - </element> - <element name="lamp1" ref="matrixlamp" state="0"> - <bounds x="8" y="0" width="7" height="7"/> - </element> - <element name="lamp2" ref="matrixlamp" state="0"> - <bounds x="16" y="0" width="7" height="7"/> - </element> - <element name="lamp3" ref="matrixlamp" state="0"> - <bounds x="24" y="0" width="7" height="7"/> - </element> - <element name="lamp4" ref="matrixlamp" state="0"> - <bounds x="32" y="0" width="7" height="7"/> - </element> - <element name="lamp5" ref="matrixlamp" state="0"> - <bounds x="40" y="0" width="7" height="7"/> - </element> - <element name="lamp6" ref="matrixlamp" state="0"> - <bounds x="48" y="0" width="7" height="7"/> - </element> - <element name="lamp7" ref="matrixlamp" state="0"> - <bounds x="56" y="0" width="7" height="7"/> - </element> - <element name="lamp8" ref="matrixlamp" state="0"> - <bounds x="64" y="0" width="7" height="7"/> - </element> - <element name="lamp9" ref="matrixlamp" state="0"> - <bounds x="72" y="0" width="7" height="7"/> - </element> - <element name="lamp10" ref="matrixlamp" state="0"> - <bounds x="80" y="0" width="7" height="7"/> - </element> - <element name="lamp11" ref="matrixlamp" state="0"> - <bounds x="88" y="0" width="7" height="7"/> - </element> - <element name="lamp12" ref="matrixlamp" state="0"> - <bounds x="96" y="0" width="7" height="7"/> - </element> - <element name="lamp13" ref="matrixlamp" state="0"> - <bounds x="104" y="0" width="7" height="7"/> - </element> - <element name="lamp14" ref="matrixlamp" state="0"> - <bounds x="112" y="0" width="7" height="7"/> - </element> - <element name="lamp15" ref="matrixlamp" state="0"> - <bounds x="120" y="0" width="7" height="7"/> - </element> - <element name="lamp16" ref="matrixlamp" state="0"> - <bounds x="0" y="8" width="7" height="7"/> - </element> - <element name="lamp17" ref="matrixlamp" state="0"> - <bounds x="8" y="8" width="7" height="7"/> - </element> - <element name="lamp18" ref="matrixlamp" state="0"> - <bounds x="16" y="8" width="7" height="7"/> - </element> - <element name="lamp19" ref="matrixlamp" state="0"> - <bounds x="24" y="8" width="7" height="7"/> - </element> - <element name="lamp20" ref="matrixlamp" state="0"> - <bounds x="32" y="8" width="7" height="7"/> - </element> - <element name="lamp21" ref="matrixlamp" state="0"> - <bounds x="40" y="8" width="7" height="7"/> - </element> - <element name="lamp22" ref="matrixlamp" state="0"> - <bounds x="48" y="8" width="7" height="7"/> - </element> - <element name="lamp23" ref="matrixlamp" state="0"> - <bounds x="56" y="8" width="7" height="7"/> - </element> - <element name="lamp24" ref="matrixlamp" state="0"> - <bounds x="64" y="8" width="7" height="7"/> - </element> - <element name="lamp25" ref="matrixlamp" state="0"> - <bounds x="72" y="8" width="7" height="7"/> - </element> - <element name="lamp26" ref="matrixlamp" state="0"> - <bounds x="80" y="8" width="7" height="7"/> - </element> - <element name="lamp27" ref="matrixlamp" state="0"> - <bounds x="88" y="8" width="7" height="7"/> - </element> - <element name="lamp28" ref="matrixlamp" state="0"> - <bounds x="96" y="8" width="7" height="7"/> - </element> - <element name="lamp29" ref="matrixlamp" state="0"> - <bounds x="104" y="8" width="7" height="7"/> - </element> - <element name="lamp30" ref="matrixlamp" state="0"> - <bounds x="112" y="8" width="7" height="7"/> - </element> - <element name="lamp31" ref="matrixlamp" state="0"> - <bounds x="120" y="8" width="7" height="7"/> - </element> - <element name="lamp32" ref="matrixlamp" state="0"> - <bounds x="0" y="16" width="7" height="7"/> - </element> - <element name="lamp33" ref="matrixlamp" state="0"> - <bounds x="8" y="16" width="7" height="7"/> - </element> - <element name="lamp34" ref="matrixlamp" state="0"> - <bounds x="16" y="16" width="7" height="7"/> - </element> - <element name="lamp35" ref="matrixlamp" state="0"> - <bounds x="24" y="16" width="7" height="7"/> - </element> - <element name="lamp36" ref="matrixlamp" state="0"> - <bounds x="32" y="16" width="7" height="7"/> - </element> - <element name="lamp37" ref="matrixlamp" state="0"> - <bounds x="40" y="16" width="7" height="7"/> - </element> - <element name="lamp38" ref="matrixlamp" state="0"> - <bounds x="48" y="16" width="7" height="7"/> - </element> - <element name="lamp39" ref="matrixlamp" state="0"> - <bounds x="56" y="16" width="7" height="7"/> - </element> - <element name="lamp40" ref="matrixlamp" state="0"> - <bounds x="64" y="16" width="7" height="7"/> - </element> - <element name="lamp41" ref="matrixlamp" state="0"> - <bounds x="72" y="16" width="7" height="7"/> - </element> - <element name="lamp42" ref="matrixlamp" state="0"> - <bounds x="80" y="16" width="7" height="7"/> - </element> - <element name="lamp43" ref="matrixlamp" state="0"> - <bounds x="88" y="16" width="7" height="7"/> - </element> - <element name="lamp44" ref="matrixlamp" state="0"> - <bounds x="96" y="16" width="7" height="7"/> - </element> - <element name="lamp45" ref="matrixlamp" state="0"> - <bounds x="104" y="16" width="7" height="7"/> - </element> - <element name="lamp46" ref="matrixlamp" state="0"> - <bounds x="112" y="16" width="7" height="7"/> - </element> - <element name="lamp47" ref="matrixlamp" state="0"> - <bounds x="120" y="16" width="7" height="7"/> - </element> - <element name="lamp48" ref="matrixlamp" state="0"> - <bounds x="0" y="24" width="7" height="7"/> - </element> - <element name="lamp49" ref="matrixlamp" state="0"> - <bounds x="8" y="24" width="7" height="7"/> - </element> - <element name="lamp50" ref="matrixlamp" state="0"> - <bounds x="16" y="24" width="7" height="7"/> - </element> - <element name="lamp51" ref="matrixlamp" state="0"> - <bounds x="24" y="24" width="7" height="7"/> - </element> - <element name="lamp52" ref="matrixlamp" state="0"> - <bounds x="32" y="24" width="7" height="7"/> - </element> - <element name="lamp53" ref="matrixlamp" state="0"> - <bounds x="40" y="24" width="7" height="7"/> - </element> - <element name="lamp54" ref="matrixlamp" state="0"> - <bounds x="48" y="24" width="7" height="7"/> - </element> - <element name="lamp55" ref="matrixlamp" state="0"> - <bounds x="56" y="24" width="7" height="7"/> - </element> - <element name="lamp56" ref="matrixlamp" state="0"> - <bounds x="64" y="24" width="7" height="7"/> - </element> - <element name="lamp57" ref="matrixlamp" state="0"> - <bounds x="72" y="24" width="7" height="7"/> - </element> - <element name="lamp58" ref="matrixlamp" state="0"> - <bounds x="80" y="24" width="7" height="7"/> - </element> - <element name="lamp59" ref="matrixlamp" state="0"> - <bounds x="88" y="24" width="7" height="7"/> - </element> - <element name="lamp60" ref="matrixlamp" state="0"> - <bounds x="96" y="24" width="7" height="7"/> - </element> - <element name="lamp61" ref="matrixlamp" state="0"> - <bounds x="104" y="24" width="7" height="7"/> - </element> - <element name="lamp62" ref="matrixlamp" state="0"> - <bounds x="112" y="24" width="7" height="7"/> - </element> - <element name="lamp63" ref="matrixlamp" state="0"> - <bounds x="120" y="24" width="7" height="7"/> - </element> - <element name="lamp64" ref="matrixlamp" state="0"> - <bounds x="0" y="32" width="7" height="7"/> - </element> - <element name="lamp65" ref="matrixlamp" state="0"> - <bounds x="8" y="32" width="7" height="7"/> - </element> - <element name="lamp66" ref="matrixlamp" state="0"> - <bounds x="16" y="32" width="7" height="7"/> - </element> - <element name="lamp67" ref="matrixlamp" state="0"> - <bounds x="24" y="32" width="7" height="7"/> - </element> - <element name="lamp68" ref="matrixlamp" state="0"> - <bounds x="32" y="32" width="7" height="7"/> - </element> - <element name="lamp69" ref="matrixlamp" state="0"> - <bounds x="40" y="32" width="7" height="7"/> - </element> - <element name="lamp70" ref="matrixlamp" state="0"> - <bounds x="48" y="32" width="7" height="7"/> - </element> - <element name="lamp71" ref="matrixlamp" state="0"> - <bounds x="56" y="32" width="7" height="7"/> - </element> - <element name="lamp72" ref="matrixlamp" state="0"> - <bounds x="64" y="32" width="7" height="7"/> - </element> - <element name="lamp73" ref="matrixlamp" state="0"> - <bounds x="72" y="32" width="7" height="7"/> - </element> - <element name="lamp74" ref="matrixlamp" state="0"> - <bounds x="80" y="32" width="7" height="7"/> - </element> - <element name="lamp75" ref="matrixlamp" state="0"> - <bounds x="88" y="32" width="7" height="7"/> - </element> - <element name="lamp76" ref="matrixlamp" state="0"> - <bounds x="96" y="32" width="7" height="7"/> - </element> - <element name="lamp77" ref="matrixlamp" state="0"> - <bounds x="104" y="32" width="7" height="7"/> - </element> - <element name="lamp78" ref="matrixlamp" state="0"> - <bounds x="112" y="32" width="7" height="7"/> - </element> - <element name="lamp79" ref="matrixlamp" state="0"> - <bounds x="120" y="32" width="7" height="7"/> - </element> - <element name="lamp80" ref="matrixlamp" state="0"> - <bounds x="0" y="40" width="7" height="7"/> - </element> - <element name="lamp81" ref="matrixlamp" state="0"> - <bounds x="8" y="40" width="7" height="7"/> - </element> - <element name="lamp82" ref="matrixlamp" state="0"> - <bounds x="16" y="40" width="7" height="7"/> - </element> - <element name="lamp83" ref="matrixlamp" state="0"> - <bounds x="24" y="40" width="7" height="7"/> - </element> - <element name="lamp84" ref="matrixlamp" state="0"> - <bounds x="32" y="40" width="7" height="7"/> - </element> - <element name="lamp85" ref="matrixlamp" state="0"> - <bounds x="40" y="40" width="7" height="7"/> - </element> - <element name="lamp86" ref="matrixlamp" state="0"> - <bounds x="48" y="40" width="7" height="7"/> - </element> - <element name="lamp87" ref="matrixlamp" state="0"> - <bounds x="56" y="40" width="7" height="7"/> - </element> - <element name="lamp88" ref="matrixlamp" state="0"> - <bounds x="64" y="40" width="7" height="7"/> - </element> - <element name="lamp89" ref="matrixlamp" state="0"> - <bounds x="72" y="40" width="7" height="7"/> - </element> - <element name="lamp90" ref="matrixlamp" state="0"> - <bounds x="80" y="40" width="7" height="7"/> - </element> - <element name="lamp91" ref="matrixlamp" state="0"> - <bounds x="88" y="40" width="7" height="7"/> - </element> - <element name="lamp92" ref="matrixlamp" state="0"> - <bounds x="96" y="40" width="7" height="7"/> - </element> - <element name="lamp93" ref="matrixlamp" state="0"> - <bounds x="104" y="40" width="7" height="7"/> - </element> - <element name="lamp94" ref="matrixlamp" state="0"> - <bounds x="112" y="40" width="7" height="7"/> - </element> - <element name="lamp95" ref="matrixlamp" state="0"> - <bounds x="120" y="40" width="7" height="7"/> - </element> - <element name="lamp96" ref="matrixlamp" state="0"> - <bounds x="0" y="48" width="7" height="7"/> - </element> - <element name="lamp97" ref="matrixlamp" state="0"> - <bounds x="8" y="48" width="7" height="7"/> - </element> - <element name="lamp98" ref="matrixlamp" state="0"> - <bounds x="16" y="48" width="7" height="7"/> - </element> - <element name="lamp99" ref="matrixlamp" state="0"> - <bounds x="24" y="48" width="7" height="7"/> - </element> - <element name="lamp100" ref="matrixlamp" state="0"> - <bounds x="32" y="48" width="7" height="7"/> - </element> - <element name="lamp101" ref="matrixlamp" state="0"> - <bounds x="40" y="48" width="7" height="7"/> - </element> - <element name="lamp102" ref="matrixlamp" state="0"> - <bounds x="48" y="48" width="7" height="7"/> - </element> - <element name="lamp103" ref="matrixlamp" state="0"> - <bounds x="56" y="48" width="7" height="7"/> - </element> - <element name="lamp104" ref="matrixlamp" state="0"> - <bounds x="64" y="48" width="7" height="7"/> - </element> - <element name="lamp105" ref="matrixlamp" state="0"> - <bounds x="72" y="48" width="7" height="7"/> - </element> - <element name="lamp106" ref="matrixlamp" state="0"> - <bounds x="80" y="48" width="7" height="7"/> - </element> - <element name="lamp107" ref="matrixlamp" state="0"> - <bounds x="88" y="48" width="7" height="7"/> - </element> - <element name="lamp108" ref="matrixlamp" state="0"> - <bounds x="96" y="48" width="7" height="7"/> - </element> - <element name="lamp109" ref="matrixlamp" state="0"> - <bounds x="104" y="48" width="7" height="7"/> - </element> - <element name="lamp110" ref="matrixlamp" state="0"> - <bounds x="112" y="48" width="7" height="7"/> - </element> - <element name="lamp111" ref="matrixlamp" state="0"> - <bounds x="120" y="48" width="7" height="7"/> - </element> - <element name="lamp112" ref="matrixlamp" state="0"> - <bounds x="0" y="56" width="7" height="7"/> - </element> - <element name="lamp113" ref="matrixlamp" state="0"> - <bounds x="8" y="56" width="7" height="7"/> - </element> - <element name="lamp114" ref="matrixlamp" state="0"> - <bounds x="16" y="56" width="7" height="7"/> - </element> - <element name="lamp115" ref="matrixlamp" state="0"> - <bounds x="24" y="56" width="7" height="7"/> - </element> - <element name="lamp116" ref="matrixlamp" state="0"> - <bounds x="32" y="56" width="7" height="7"/> - </element> - <element name="lamp117" ref="matrixlamp" state="0"> - <bounds x="40" y="56" width="7" height="7"/> - </element> - <element name="lamp118" ref="matrixlamp" state="0"> - <bounds x="48" y="56" width="7" height="7"/> - </element> - <element name="lamp119" ref="matrixlamp" state="0"> - <bounds x="56" y="56" width="7" height="7"/> - </element> - <element name="lamp120" ref="matrixlamp" state="0"> - <bounds x="64" y="56" width="7" height="7"/> - </element> - <element name="lamp121" ref="matrixlamp" state="0"> - <bounds x="72" y="56" width="7" height="7"/> - </element> - <element name="lamp122" ref="matrixlamp" state="0"> - <bounds x="80" y="56" width="7" height="7"/> - </element> - <element name="lamp123" ref="matrixlamp" state="0"> - <bounds x="88" y="56" width="7" height="7"/> - </element> - <element name="lamp124" ref="matrixlamp" state="0"> - <bounds x="96" y="56" width="7" height="7"/> - </element> - <element name="lamp125" ref="matrixlamp" state="0"> - <bounds x="104" y="56" width="7" height="7"/> - </element> - <element name="lamp126" ref="matrixlamp" state="0"> - <bounds x="112" y="56" width="7" height="7"/> - </element> - <element name="lamp127" ref="matrixlamp" state="0"> - <bounds x="120" y="56" width="7" height="7"/> - </element> - <element name="lamp128" ref="matrixlamp" state="0"> - <bounds x="0" y="64" width="7" height="7"/> - </element> - <element name="lamp129" ref="matrixlamp" state="0"> - <bounds x="8" y="64" width="7" height="7"/> - </element> - <element name="lamp130" ref="matrixlamp" state="0"> - <bounds x="16" y="64" width="7" height="7"/> - </element> - <element name="lamp131" ref="matrixlamp" state="0"> - <bounds x="24" y="64" width="7" height="7"/> - </element> - <element name="lamp132" ref="matrixlamp" state="0"> - <bounds x="32" y="64" width="7" height="7"/> - </element> - <element name="lamp133" ref="matrixlamp" state="0"> - <bounds x="40" y="64" width="7" height="7"/> - </element> - <element name="lamp134" ref="matrixlamp" state="0"> - <bounds x="48" y="64" width="7" height="7"/> - </element> - <element name="lamp135" ref="matrixlamp" state="0"> - <bounds x="56" y="64" width="7" height="7"/> - </element> - <element name="lamp136" ref="matrixlamp" state="0"> - <bounds x="64" y="64" width="7" height="7"/> - </element> - <element name="lamp137" ref="matrixlamp" state="0"> - <bounds x="72" y="64" width="7" height="7"/> - </element> - <element name="lamp138" ref="matrixlamp" state="0"> - <bounds x="80" y="64" width="7" height="7"/> - </element> - <element name="lamp139" ref="matrixlamp" state="0"> - <bounds x="88" y="64" width="7" height="7"/> - </element> - <element name="lamp140" ref="matrixlamp" state="0"> - <bounds x="96" y="64" width="7" height="7"/> - </element> - <element name="lamp141" ref="matrixlamp" state="0"> - <bounds x="104" y="64" width="7" height="7"/> - </element> - <element name="lamp142" ref="matrixlamp" state="0"> - <bounds x="112" y="64" width="7" height="7"/> - </element> - <element name="lamp143" ref="matrixlamp" state="0"> - <bounds x="120" y="64" width="7" height="7"/> - </element> - <element name="lamp144" ref="matrixlamp" state="0"> - <bounds x="0" y="72" width="7" height="7"/> - </element> - <element name="lamp145" ref="matrixlamp" state="0"> - <bounds x="8" y="72" width="7" height="7"/> - </element> - <element name="lamp146" ref="matrixlamp" state="0"> - <bounds x="16" y="72" width="7" height="7"/> - </element> - <element name="lamp147" ref="matrixlamp" state="0"> - <bounds x="24" y="72" width="7" height="7"/> - </element> - <element name="lamp148" ref="matrixlamp" state="0"> - <bounds x="32" y="72" width="7" height="7"/> - </element> - <element name="lamp149" ref="matrixlamp" state="0"> - <bounds x="40" y="72" width="7" height="7"/> - </element> - <element name="lamp150" ref="matrixlamp" state="0"> - <bounds x="48" y="72" width="7" height="7"/> - </element> - <element name="lamp151" ref="matrixlamp" state="0"> - <bounds x="56" y="72" width="7" height="7"/> - </element> - <element name="lamp152" ref="matrixlamp" state="0"> - <bounds x="64" y="72" width="7" height="7"/> - </element> - <element name="lamp153" ref="matrixlamp" state="0"> - <bounds x="72" y="72" width="7" height="7"/> - </element> - <element name="lamp154" ref="matrixlamp" state="0"> - <bounds x="80" y="72" width="7" height="7"/> - </element> - <element name="lamp155" ref="matrixlamp" state="0"> - <bounds x="88" y="72" width="7" height="7"/> - </element> - <element name="lamp156" ref="matrixlamp" state="0"> - <bounds x="96" y="72" width="7" height="7"/> - </element> - <element name="lamp157" ref="matrixlamp" state="0"> - <bounds x="104" y="72" width="7" height="7"/> - </element> - <element name="lamp158" ref="matrixlamp" state="0"> - <bounds x="112" y="72" width="7" height="7"/> - </element> - <element name="lamp159" ref="matrixlamp" state="0"> - <bounds x="120" y="72" width="7" height="7"/> - </element> - <element name="lamp160" ref="matrixlamp" state="0"> - <bounds x="0" y="80" width="7" height="7"/> - </element> - <element name="lamp161" ref="matrixlamp" state="0"> - <bounds x="8" y="80" width="7" height="7"/> - </element> - <element name="lamp162" ref="matrixlamp" state="0"> - <bounds x="16" y="80" width="7" height="7"/> - </element> - <element name="lamp163" ref="matrixlamp" state="0"> - <bounds x="24" y="80" width="7" height="7"/> - </element> - <element name="lamp164" ref="matrixlamp" state="0"> - <bounds x="32" y="80" width="7" height="7"/> - </element> - <element name="lamp165" ref="matrixlamp" state="0"> - <bounds x="40" y="80" width="7" height="7"/> - </element> - <element name="lamp166" ref="matrixlamp" state="0"> - <bounds x="48" y="80" width="7" height="7"/> - </element> - <element name="lamp167" ref="matrixlamp" state="0"> - <bounds x="56" y="80" width="7" height="7"/> - </element> - <element name="lamp168" ref="matrixlamp" state="0"> - <bounds x="64" y="80" width="7" height="7"/> - </element> - <element name="lamp169" ref="matrixlamp" state="0"> - <bounds x="72" y="80" width="7" height="7"/> - </element> - <element name="lamp170" ref="matrixlamp" state="0"> - <bounds x="80" y="80" width="7" height="7"/> - </element> - <element name="lamp171" ref="matrixlamp" state="0"> - <bounds x="88" y="80" width="7" height="7"/> - </element> - <element name="lamp172" ref="matrixlamp" state="0"> - <bounds x="96" y="80" width="7" height="7"/> - </element> - <element name="lamp173" ref="matrixlamp" state="0"> - <bounds x="104" y="80" width="7" height="7"/> - </element> - <element name="lamp174" ref="matrixlamp" state="0"> - <bounds x="112" y="80" width="7" height="7"/> - </element> - <element name="lamp175" ref="matrixlamp" state="0"> - <bounds x="120" y="80" width="7" height="7"/> - </element> - <element name="lamp176" ref="matrixlamp" state="0"> - <bounds x="0" y="88" width="7" height="7"/> - </element> - <element name="lamp177" ref="matrixlamp" state="0"> - <bounds x="8" y="88" width="7" height="7"/> - </element> - <element name="lamp178" ref="matrixlamp" state="0"> - <bounds x="16" y="88" width="7" height="7"/> - </element> - <element name="lamp179" ref="matrixlamp" state="0"> - <bounds x="24" y="88" width="7" height="7"/> - </element> - <element name="lamp180" ref="matrixlamp" state="0"> - <bounds x="32" y="88" width="7" height="7"/> - </element> - <element name="lamp181" ref="matrixlamp" state="0"> - <bounds x="40" y="88" width="7" height="7"/> - </element> - <element name="lamp182" ref="matrixlamp" state="0"> - <bounds x="48" y="88" width="7" height="7"/> - </element> - <element name="lamp183" ref="matrixlamp" state="0"> - <bounds x="56" y="88" width="7" height="7"/> - </element> - <element name="lamp184" ref="matrixlamp" state="0"> - <bounds x="64" y="88" width="7" height="7"/> - </element> - <element name="lamp185" ref="matrixlamp" state="0"> - <bounds x="72" y="88" width="7" height="7"/> - </element> - <element name="lamp186" ref="matrixlamp" state="0"> - <bounds x="80" y="88" width="7" height="7"/> - </element> - <element name="lamp187" ref="matrixlamp" state="0"> - <bounds x="88" y="88" width="7" height="7"/> - </element> - <element name="lamp188" ref="matrixlamp" state="0"> - <bounds x="96" y="88" width="7" height="7"/> - </element> - <element name="lamp189" ref="matrixlamp" state="0"> - <bounds x="104" y="88" width="7" height="7"/> - </element> - <element name="lamp190" ref="matrixlamp" state="0"> - <bounds x="112" y="88" width="7" height="7"/> - </element> - <element name="lamp191" ref="matrixlamp" state="0"> - <bounds x="120" y="88" width="7" height="7"/> - </element> - <element name="lamp192" ref="matrixlamp" state="0"> - <bounds x="0" y="96" width="7" height="7"/> - </element> - <element name="lamp193" ref="matrixlamp" state="0"> - <bounds x="8" y="96" width="7" height="7"/> - </element> - <element name="lamp194" ref="matrixlamp" state="0"> - <bounds x="16" y="96" width="7" height="7"/> - </element> - <element name="lamp195" ref="matrixlamp" state="0"> - <bounds x="24" y="96" width="7" height="7"/> - </element> - <element name="lamp196" ref="matrixlamp" state="0"> - <bounds x="32" y="96" width="7" height="7"/> - </element> - <element name="lamp197" ref="matrixlamp" state="0"> - <bounds x="40" y="96" width="7" height="7"/> - </element> - <element name="lamp198" ref="matrixlamp" state="0"> - <bounds x="48" y="96" width="7" height="7"/> - </element> - <element name="lamp199" ref="matrixlamp" state="0"> - <bounds x="56" y="96" width="7" height="7"/> - </element> - <element name="lamp200" ref="matrixlamp" state="0"> - <bounds x="64" y="96" width="7" height="7"/> - </element> - <element name="lamp201" ref="matrixlamp" state="0"> - <bounds x="72" y="96" width="7" height="7"/> - </element> - <element name="lamp202" ref="matrixlamp" state="0"> - <bounds x="80" y="96" width="7" height="7"/> - </element> - <element name="lamp203" ref="matrixlamp" state="0"> - <bounds x="88" y="96" width="7" height="7"/> - </element> - <element name="lamp204" ref="matrixlamp" state="0"> - <bounds x="96" y="96" width="7" height="7"/> - </element> - <element name="lamp205" ref="matrixlamp" state="0"> - <bounds x="104" y="96" width="7" height="7"/> - </element> - <element name="lamp206" ref="matrixlamp" state="0"> - <bounds x="112" y="96" width="7" height="7"/> - </element> - <element name="lamp207" ref="matrixlamp" state="0"> - <bounds x="120" y="96" width="7" height="7"/> - </element> - <element name="lamp208" ref="matrixlamp" state="0"> - <bounds x="0" y="104" width="7" height="7"/> - </element> - <element name="lamp209" ref="matrixlamp" state="0"> - <bounds x="8" y="104" width="7" height="7"/> - </element> - <element name="lamp210" ref="matrixlamp" state="0"> - <bounds x="16" y="104" width="7" height="7"/> - </element> - <element name="lamp211" ref="matrixlamp" state="0"> - <bounds x="24" y="104" width="7" height="7"/> - </element> - <element name="lamp212" ref="matrixlamp" state="0"> - <bounds x="32" y="104" width="7" height="7"/> - </element> - <element name="lamp213" ref="matrixlamp" state="0"> - <bounds x="40" y="104" width="7" height="7"/> - </element> - <element name="lamp214" ref="matrixlamp" state="0"> - <bounds x="48" y="104" width="7" height="7"/> - </element> - <element name="lamp215" ref="matrixlamp" state="0"> - <bounds x="56" y="104" width="7" height="7"/> - </element> - <element name="lamp216" ref="matrixlamp" state="0"> - <bounds x="64" y="104" width="7" height="7"/> - </element> - <element name="lamp217" ref="matrixlamp" state="0"> - <bounds x="72" y="104" width="7" height="7"/> - </element> - <element name="lamp218" ref="matrixlamp" state="0"> - <bounds x="80" y="104" width="7" height="7"/> - </element> - <element name="lamp219" ref="matrixlamp" state="0"> - <bounds x="88" y="104" width="7" height="7"/> - </element> - <element name="lamp220" ref="matrixlamp" state="0"> - <bounds x="96" y="104" width="7" height="7"/> - </element> - <element name="lamp221" ref="matrixlamp" state="0"> - <bounds x="104" y="104" width="7" height="7"/> - </element> - <element name="lamp222" ref="matrixlamp" state="0"> - <bounds x="112" y="104" width="7" height="7"/> - </element> - <element name="lamp223" ref="matrixlamp" state="0"> - <bounds x="120" y="104" width="7" height="7"/> - </element> - <element name="lamp224" ref="matrixlamp" state="0"> - <bounds x="0" y="112" width="7" height="7"/> - </element> - <element name="lamp225" ref="matrixlamp" state="0"> - <bounds x="8" y="112" width="7" height="7"/> - </element> - <element name="lamp226" ref="matrixlamp" state="0"> - <bounds x="16" y="112" width="7" height="7"/> - </element> - <element name="lamp227" ref="matrixlamp" state="0"> - <bounds x="24" y="112" width="7" height="7"/> - </element> - <element name="lamp228" ref="matrixlamp" state="0"> - <bounds x="32" y="112" width="7" height="7"/> - </element> - <element name="lamp229" ref="matrixlamp" state="0"> - <bounds x="40" y="112" width="7" height="7"/> - </element> - <element name="lamp230" ref="matrixlamp" state="0"> - <bounds x="48" y="112" width="7" height="7"/> - </element> - <element name="lamp231" ref="matrixlamp" state="0"> - <bounds x="56" y="112" width="7" height="7"/> - </element> - <element name="lamp232" ref="matrixlamp" state="0"> - <bounds x="64" y="112" width="7" height="7"/> - </element> - <element name="lamp233" ref="matrixlamp" state="0"> - <bounds x="72" y="112" width="7" height="7"/> - </element> - <element name="lamp234" ref="matrixlamp" state="0"> - <bounds x="80" y="112" width="7" height="7"/> - </element> - <element name="lamp235" ref="matrixlamp" state="0"> - <bounds x="88" y="112" width="7" height="7"/> - </element> - <element name="lamp236" ref="matrixlamp" state="0"> - <bounds x="96" y="112" width="7" height="7"/> - </element> - <element name="lamp237" ref="matrixlamp" state="0"> - <bounds x="104" y="112" width="7" height="7"/> - </element> - <element name="lamp238" ref="matrixlamp" state="0"> - <bounds x="112" y="112" width="7" height="7"/> - </element> - <element name="lamp239" ref="matrixlamp" state="0"> - <bounds x="120" y="112" width="7" height="7"/> - </element> - <element name="lamp240" ref="matrixlamp" state="0"> - <bounds x="0" y="120" width="7" height="7"/> - </element> - <element name="lamp241" ref="matrixlamp" state="0"> - <bounds x="8" y="120" width="7" height="7"/> - </element> - <element name="lamp242" ref="matrixlamp" state="0"> - <bounds x="16" y="120" width="7" height="7"/> - </element> - <element name="lamp243" ref="matrixlamp" state="0"> - <bounds x="24" y="120" width="7" height="7"/> - </element> - <element name="lamp244" ref="matrixlamp" state="0"> - <bounds x="32" y="120" width="7" height="7"/> - </element> - <element name="lamp245" ref="matrixlamp" state="0"> - <bounds x="40" y="120" width="7" height="7"/> - </element> - <element name="lamp246" ref="matrixlamp" state="0"> - <bounds x="48" y="120" width="7" height="7"/> - </element> - <element name="lamp247" ref="matrixlamp" state="0"> - <bounds x="56" y="120" width="7" height="7"/> - </element> - <element name="lamp248" ref="matrixlamp" state="0"> - <bounds x="64" y="120" width="7" height="7"/> - </element> - <element name="lamp249" ref="matrixlamp" state="0"> - <bounds x="72" y="120" width="7" height="7"/> - </element> - <element name="lamp250" ref="matrixlamp" state="0"> - <bounds x="80" y="120" width="7" height="7"/> - </element> - <element name="lamp251" ref="matrixlamp" state="0"> - <bounds x="88" y="120" width="7" height="7"/> - </element> - <element name="lamp252" ref="matrixlamp" state="0"> - <bounds x="96" y="120" width="7" height="7"/> - </element> - <element name="lamp253" ref="matrixlamp" state="0"> - <bounds x="104" y="120" width="7" height="7"/> - </element> - <element name="lamp254" ref="matrixlamp" state="0"> - <bounds x="112" y="120" width="7" height="7"/> - </element> - <element name="lamp255" ref="matrixlamp" state="0"> - <bounds x="120" y="120" width="7" height="7"/> - </element> - <element name="vfd0" ref="vfd0" state="0"> - <bounds x="0" y="280" width="9" height="14"/> - </element> - <element name="vfd1" ref="vfd0" state="0"> - <bounds x="9" y="280" width="9" height="14"/> - </element> - <element name="vfd2" ref="vfd0" state="0"> - <bounds x="18" y="280" width="9" height="14"/> - </element> - <element name="vfd3" ref="vfd0" state="0"> - <bounds x="27" y="280" width="9" height="14"/> - </element> - <element name="vfd4" ref="vfd0" state="0"> - <bounds x="36" y="280" width="9" height="14"/> - </element> - <element name="vfd5" ref="vfd0" state="0"> - <bounds x="45" y="280" width="9" height="14"/> - </element> - <element name="vfd6" ref="vfd0" state="0"> - <bounds x="54" y="280" width="9" height="14"/> - </element> - <element name="vfd7" ref="vfd0" state="0"> - <bounds x="63" y="280" width="9" height="14"/> - </element> - <element name="vfd8" ref="vfd0" state="0"> - <bounds x="72" y="280" width="9" height="14"/> - </element> - <element name="vfd9" ref="vfd0" state="0"> - <bounds x="81" y="280" width="9" height="14"/> - </element> - <element name="vfd10" ref="vfd0" state="0"> - <bounds x="90" y="280" width="9" height="14"/> - </element> - <element name="vfd11" ref="vfd0" state="0"> - <bounds x="99" y="280" width="9" height="14"/> - </element> - <element name="vfd12" ref="vfd0" state="0"> - <bounds x="108" y="280" width="9" height="14"/> - </element> - <element name="vfd13" ref="vfd0" state="0"> - <bounds x="117" y="280" width="9" height="14"/> - </element> - <element name="vfd14" ref="vfd0" state="0"> - <bounds x="126" y="280" width="9" height="14"/> - </element> - <element name="vfd15" ref="vfd0" state="0"> - <bounds x="135" y="280" width="9" height="14"/> - </element> + <repeat count="16"> + <param name="s" start="0" increment="16" /> + <param name="y" start="0" increment="8" /> + <repeat count="16"> + <param name="n" start="~s~" increment="1" /> + <param name="x" start="0" increment="8" /> + <element name="lamp~n~" ref="matrixlamp" state="0" blend="add"> + <bounds x="~x~" y="~y~" width="7" height="7" /> + </element> + </repeat> + </repeat> + <group ref="vfd"> + <bounds x="0" y="280" width="144" height="17" /> + </group> </view> + <view name="VFD Only (144:17)"> - <element name="vfd0" ref="vfd0" state="0"> - <bounds x="0" y="0" width="9" height="14"/> - </element> - <element name="vfd1" ref="vfd0" state="0"> - <bounds x="9" y="0" width="9" height="14"/> - </element> - <element name="vfd2" ref="vfd0" state="0"> - <bounds x="18" y="0" width="9" height="14"/> - </element> - <element name="vfd3" ref="vfd0" state="0"> - <bounds x="27" y="0" width="9" height="14"/> - </element> - <element name="vfd4" ref="vfd0" state="0"> - <bounds x="36" y="0" width="9" height="14"/> - </element> - <element name="vfd5" ref="vfd0" state="0"> - <bounds x="45" y="0" width="9" height="14"/> - </element> - <element name="vfd6" ref="vfd0" state="0"> - <bounds x="54" y="0" width="9" height="14"/> - </element> - <element name="vfd7" ref="vfd0" state="0"> - <bounds x="63" y="0" width="9" height="14"/> - </element> - <element name="vfd8" ref="vfd0" state="0"> - <bounds x="72" y="0" width="9" height="14"/> - </element> - <element name="vfd9" ref="vfd0" state="0"> - <bounds x="81" y="0" width="9" height="14"/> - </element> - <element name="vfd10" ref="vfd0" state="0"> - <bounds x="90" y="0" width="9" height="14"/> - </element> - <element name="vfd11" ref="vfd0" state="0"> - <bounds x="99" y="0" width="9" height="14"/> - </element> - <element name="vfd12" ref="vfd0" state="0"> - <bounds x="108" y="0" width="9" height="14"/> - </element> - <element name="vfd13" ref="vfd0" state="0"> - <bounds x="117" y="0" width="9" height="14"/> - </element> - <element name="vfd14" ref="vfd0" state="0"> - <bounds x="126" y="0" width="9" height="14"/> - </element> - <element name="vfd15" ref="vfd0" state="0"> - <bounds x="135" y="0" width="9" height="14"/> - </element> + <group ref="vfd" /> </view> </mamelayout> diff --git a/src/mame/layout/sc1_vid.lay b/src/mame/layout/sc1_vid.lay index c77112a5f3e..5ea3f54d33f 100644 --- a/src/mame/layout/sc1_vid.lay +++ b/src/mame/layout/sc1_vid.lay @@ -43,10 +43,10 @@ license:CC0 <group name="lamps"> <repeat count="16"> <param name="s" start="0" increment="16" /> - <param name="x" start="0" increment="8" /> + <param name="y" start="0" increment="8" /> <repeat count="16"> <param name="n" start="~s~" increment="1" /> - <param name="y" start="0" increment="8" /> + <param name="x" start="0" increment="8" /> <element name="lamp~n~" ref="matrixlamp" state="0" blend="add"> <bounds x="~x~" y="~y~" width="7" height="7" /> </element> diff --git a/src/mame/layout/sc2_dmd.lay b/src/mame/layout/sc2_dmd.lay index 0d3b9b1f41e..1681c04659c 100644 --- a/src/mame/layout/sc2_dmd.lay +++ b/src/mame/layout/sc2_dmd.lay @@ -18,9 +18,14 @@ license:CC0 </rect> </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <element name="Steppers" defstate="0"> <simplecounter maxstate="999" digits="3"> @@ -38,6 +43,7 @@ license:CC0 <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc2copcl7.lay b/src/mame/layout/sc2copcl7.lay index d8588a2a311..2694b6d9dae 100644 --- a/src/mame/layout/sc2copcl7.lay +++ b/src/mame/layout/sc2copcl7.lay @@ -2099,9 +2099,14 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <group name="dmd"> <repeat count="21"> @@ -2112,6 +2117,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc2cpe.lay b/src/mame/layout/sc2cpe.lay index d52439a3590..4c6b9be519d 100644 --- a/src/mame/layout/sc2cpe.lay +++ b/src/mame/layout/sc2cpe.lay @@ -2125,9 +2125,14 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <group name="dmd"> <repeat count="21"> @@ -2138,6 +2143,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc2prem2.lay b/src/mame/layout/sc2prem2.lay index 71b79ae888a..403b9f01279 100644 --- a/src/mame/layout/sc2prem2.lay +++ b/src/mame/layout/sc2prem2.lay @@ -2185,9 +2185,14 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <group name="dmd"> <repeat count="21"> @@ -2198,6 +2203,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc2prom.lay b/src/mame/layout/sc2prom.lay index 63c9b8d1679..212b629aab5 100644 --- a/src/mame/layout/sc2prom.lay +++ b/src/mame/layout/sc2prom.lay @@ -1609,9 +1609,14 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <group name="dmd"> <repeat count="21"> @@ -1622,6 +1627,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc2ptytm1.lay b/src/mame/layout/sc2ptytm1.lay index 1cde0618a3b..74b9892b150 100644 --- a/src/mame/layout/sc2ptytm1.lay +++ b/src/mame/layout/sc2ptytm1.lay @@ -1153,9 +1153,14 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <group name="dmd"> <repeat count="21"> @@ -1166,6 +1171,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc2town2.lay b/src/mame/layout/sc2town2.lay index d0595ea60ea..201466679a5 100644 --- a/src/mame/layout/sc2town2.lay +++ b/src/mame/layout/sc2town2.lay @@ -1887,9 +1887,14 @@ </element> <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0.12" blue="0.12" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="1.0" blue="1.0" /> + <color state="0" red="0.125" green="0.125" blue="0.125" /> + </disk> </element> <group name="dmd"> <repeat count="21"> @@ -1900,6 +1905,7 @@ <param name="x" start="0" increment="1" /> <element name="dotmatrix~n~" ref="dotmatrixdot" state="0"> <bounds x="~x~" y="~y~" width="1" height="1" /> + <color red="1.0" green="0.12" blue="0.12" /> </element> </repeat> </repeat> diff --git a/src/mame/layout/sc4_dmd.lay b/src/mame/layout/sc4_dmd.lay index b42cda68acd..bdb8e56c481 100644 --- a/src/mame/layout/sc4_dmd.lay +++ b/src/mame/layout/sc4_dmd.lay @@ -87,9 +87,14 @@ license:CC0 <element name="dotmatrixdot"> - <dotmatrixdot> - <color red="1.0" green="0" blue="0" /> - </dotmatrixdot> + <rect> + <color red="0" green="0" blue="0" /> + <bounds left="-0.05" top="-0.05" right="1.05" bottom="1.05" /> + </rect> + <disk> + <color state="1" red="1.0" green="0.0" blue="0.0" /> + <color state="0" red="0.125" green="0.0" blue="0.0" /> + </disk> </element> <element name="digit" defstate="10"> <led7seg> diff --git a/src/mame/layout/sdk86.lay b/src/mame/layout/sdk86.lay index ed3a73006db..9ee46f9e113 100644 --- a/src/mame/layout/sdk86.lay +++ b/src/mame/layout/sdk86.lay @@ -30,16 +30,4 @@ copyright-holders:Robbbert </group> </view> - <view name="LED Displays with Terminal"> - <bounds left="0" top="0" right="362" bottom="340.5" /> - - <screen index="0"> - <bounds left="0" top="69" right="362" bottom="340.5" /> - </screen> - - <group ref="leds"> - <bounds left="10" top="10" right="352" bottom="59" /> - </group> - </view> - </mamelayout> diff --git a/src/mame/layout/sentx6p.lay b/src/mame/layout/sentx6p.lay index a148fe39a67..b9fed5379b4 100644 --- a/src/mame/layout/sentx6p.lay +++ b/src/mame/layout/sentx6p.lay @@ -19,8 +19,8 @@ license:CC0 <bounds left="0.10" top="0.3" right="0.90" bottom="0.7" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -40,8 +40,8 @@ license:CC0 <bounds left="0.15" top="0.3" right="0.85" bottom="0.7" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -116,8 +116,8 @@ license:CC0 <bounds left="0.47" top="0.645" right="0.53" bottom="0.675" /> </disk> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -133,8 +133,8 @@ license:CC0 <bounds left="0.10" top="0.425" right="0.45" bottom="0.485" /> </rect> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -150,8 +150,8 @@ license:CC0 <bounds left="0.55" top="0.425" right="0.90" bottom="0.485" /> </rect> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -167,8 +167,8 @@ license:CC0 <bounds left="0.10" top="0.495" right="0.45" bottom="0.555" /> </rect> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -183,8 +183,8 @@ license:CC0 <color red="0.6" green="0.6" blue="0.6" /> <bounds left="0.55" top="0.495" right="0.90" bottom="0.555" /> </rect> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -200,8 +200,8 @@ license:CC0 <bounds left="0.10" top="0.565" right="0.45" bottom="0.625" /> </rect> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -217,8 +217,8 @@ license:CC0 <bounds left="0.55" top="0.565" right="0.90" bottom="0.625" /> </rect> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -229,8 +229,8 @@ license:CC0 <bounds left="0.10" top="0.425" right="0.45" bottom="0.485" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -241,8 +241,8 @@ license:CC0 <bounds left="0.55" top="0.425" right="0.90" bottom="0.485" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -253,8 +253,8 @@ license:CC0 <bounds left="0.10" top="0.495" right="0.45" bottom="0.555" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -265,8 +265,8 @@ license:CC0 <bounds left="0.55" top="0.495" right="0.90" bottom="0.555" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -277,8 +277,8 @@ license:CC0 <bounds left="0.10" top="0.565" right="0.45" bottom="0.625" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -289,8 +289,8 @@ license:CC0 <bounds left="0.55" top="0.565" right="0.90" bottom="0.625" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -354,8 +354,8 @@ license:CC0 <bounds left="0.09" top="0.045" right="0.46" bottom="0.25" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -383,8 +383,8 @@ license:CC0 <bounds left="0.255" top="0.295" right="0.44" bottom="0.40" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -448,8 +448,8 @@ license:CC0 <bounds left="0.54" top="0.045" right="0.91" bottom="0.25" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> @@ -477,8 +477,8 @@ license:CC0 <bounds left="0.695" top="0.295" right="0.91" bottom="0.40" /> </text> - <rect state="1000"> - <color alpha="0.5" red="1.0" green="0.1" blue="0.1" /> + <rect> + <color alpha="0" /> <bounds x="0" y="0" width="1" height="1" /> </rect> </element> diff --git a/src/mame/layout/st_mp100.lay b/src/mame/layout/st_mp100.lay index def3591b2a9..bd6d4413834 100644 --- a/src/mame/layout/st_mp100.lay +++ b/src/mame/layout/st_mp100.lay @@ -12,7 +12,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -22,91 +24,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="6"> + <param name="n" start="~s~" increment="-1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="274" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit5" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit0" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> + <param name="s" value="5" /> + <group ref="score"> + <bounds left="10" top="45" right="264" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit15" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> + <param name="s" value="15" /> + <group ref="score"> + <bounds left="10" top="105" right="264" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit25" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit24" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> + <param name="s" value="25" /> + <group ref="score"> + <bounds left="10" top="165" right="264" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit35" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit34" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> + <param name="s" value="35" /> + <group ref="score"> + <bounds left="10" top="225" right="264" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit44" ref="digit"> diff --git a/src/mame/layout/st_mp200.lay b/src/mame/layout/st_mp200.lay index 9a822882e58..beb31822671 100644 --- a/src/mame/layout/st_mp200.lay +++ b/src/mame/layout/st_mp200.lay @@ -12,7 +12,9 @@ copyright-holders:Robbbert </led7seg> </element> <element name="red_led"> - <disk><color red="1.0" green="0.0" blue="0.0" /></disk> + <disk state="0"> + <color red="1.0" green="0.0" blue="0.0" /> + </disk> </element> <element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element> @@ -22,103 +24,44 @@ copyright-holders:Robbbert <element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element> <element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element> + <group name="score"> + <repeat count="7"> + <param name="n" start="~s~" increment="-1" /> + <param name="x" start="0" increment="44" /> + <element name="digit~n~" ref="digit"> + <bounds x="~x~" y="0" width="34" height="39" /> + </element> + </repeat> + </group> + <view name="Default Layout"> <bounds left="0" top="20" right="318" bottom="394" /> <!-- LEDs --> <!-- Player 1 Score --> - - <element name="digit6" ref="digit"> - <bounds left="10" top="45" right="44" bottom="84" /> - </element> - <element name="digit5" ref="digit"> - <bounds left="54" top="45" right="88" bottom="84" /> - </element> - <element name="digit4" ref="digit"> - <bounds left="98" top="45" right="132" bottom="84" /> - </element> - <element name="digit3" ref="digit"> - <bounds left="142" top="45" right="176" bottom="84" /> - </element> - <element name="digit2" ref="digit"> - <bounds left="186" top="45" right="220" bottom="84" /> - </element> - <element name="digit1" ref="digit"> - <bounds left="230" top="45" right="264" bottom="84" /> - </element> - <element name="digit0" ref="digit"> - <bounds left="274" top="45" right="308" bottom="84" /> - </element> + <param name="s" value="6" /> + <group ref="score"> + <bounds left="10" top="45" right="308" bottom="84" /> + </group> <!-- Player 2 Score --> - <element name="digit16" ref="digit"> - <bounds left="10" top="105" right="44" bottom="144" /> - </element> - <element name="digit15" ref="digit"> - <bounds left="54" top="105" right="88" bottom="144" /> - </element> - <element name="digit14" ref="digit"> - <bounds left="98" top="105" right="132" bottom="144" /> - </element> - <element name="digit13" ref="digit"> - <bounds left="142" top="105" right="176" bottom="144" /> - </element> - <element name="digit12" ref="digit"> - <bounds left="186" top="105" right="220" bottom="144" /> - </element> - <element name="digit11" ref="digit"> - <bounds left="230" top="105" right="264" bottom="144" /> - </element> - <element name="digit10" ref="digit"> - <bounds left="274" top="105" right="308" bottom="144" /> - </element> + <param name="s" value="16" /> + <group ref="score"> + <bounds left="10" top="105" right="308" bottom="144" /> + </group> <!-- Player 3 Score --> - <element name="digit26" ref="digit"> - <bounds left="10" top="165" right="44" bottom="204" /> - </element> - <element name="digit25" ref="digit"> - <bounds left="54" top="165" right="88" bottom="204" /> - </element> - <element name="digit24" ref="digit"> - <bounds left="98" top="165" right="132" bottom="204" /> - </element> - <element name="digit23" ref="digit"> - <bounds left="142" top="165" right="176" bottom="204" /> - </element> - <element name="digit22" ref="digit"> - <bounds left="186" top="165" right="220" bottom="204" /> - </element> - <element name="digit21" ref="digit"> - <bounds left="230" top="165" right="264" bottom="204" /> - </element> - <element name="digit20" ref="digit"> - <bounds left="274" top="165" right="308" bottom="204" /> - </element> + <param name="s" value="26" /> + <group ref="score"> + <bounds left="10" top="165" right="308" bottom="204" /> + </group> <!-- Player 4 Score --> - <element name="digit36" ref="digit"> - <bounds left="10" top="225" right="44" bottom="264" /> - </element> - <element name="digit35" ref="digit"> - <bounds left="54" top="225" right="88" bottom="264" /> - </element> - <element name="digit34" ref="digit"> - <bounds left="98" top="225" right="132" bottom="264" /> - </element> - <element name="digit33" ref="digit"> - <bounds left="142" top="225" right="176" bottom="264" /> - </element> - <element name="digit32" ref="digit"> - <bounds left="186" top="225" right="220" bottom="264" /> - </element> - <element name="digit31" ref="digit"> - <bounds left="230" top="225" right="264" bottom="264" /> - </element> - <element name="digit30" ref="digit"> - <bounds left="274" top="225" right="308" bottom="264" /> - </element> + <param name="s" value="36" /> + <group ref="score"> + <bounds left="10" top="225" right="308" bottom="264" /> + </group> <!-- Credits and Balls --> <element name="digit44" ref="digit"> diff --git a/src/mame/layout/tecnbras.lay b/src/mame/layout/tecnbras.lay index c65cea29235..b0cd0368d3f 100644 --- a/src/mame/layout/tecnbras.lay +++ b/src/mame/layout/tecnbras.lay @@ -4,9 +4,45 @@ license:CC0 --> <mamelayout version="2"> <element name="dotmatrix5dot"> - <dotmatrix5dot> - <color red="1.0" green="0" blue="0" /> - </dotmatrix5dot> + <rect> + <bounds x="-0.05" width="5.55" y="-0.05" height="1.1" /> + <color red="0.0" green="0.0" blue="0.0" /> + </rect> + <disk state="0" statemask="0x01"> + <bounds x="0.0" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x02"> + <bounds x="1.1" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x04"> + <bounds x="2.2" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x08"> + <bounds x="3.3" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk state="0" statemask="0x10"> + <bounds x="4.4" /> + <color red="0.125" green="0.125" blue="0.125" /> + </disk> + <disk statemask="0x01"> + <bounds x="0.0" /> + </disk> + <disk statemask="0x02"> + <bounds x="1.1" /> + </disk> + <disk statemask="0x04"> + <bounds x="2.2" /> + </disk> + <disk statemask="0x08"> + <bounds x="3.3" /> + </disk> + <disk statemask="0x10"> + <bounds x="4.4" /> + </disk> </element> <element name="background"> <rect> @@ -18,299 +54,17 @@ license:CC0 <element ref="background"> <bounds left="00" top="00" right="70" bottom="7" /> </element> - <element name="dmd_0" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="0" width="5" height="1" /> - </element> - <element name="dmd_1" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="1" width="5" height="1" /> - </element> - <element name="dmd_2" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="2" width="5" height="1" /> - </element> - <element name="dmd_3" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="3" width="5" height="1" /> - </element> - <element name="dmd_4" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="4" width="5" height="1" /> - </element> - <element name="dmd_5" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="5" width="5" height="1" /> - </element> - <element name="dmd_6" ref="dotmatrix5dot" state="0"> - <bounds x="0" y="6" width="5" height="1" /> - </element> - <element name="dmd_7" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="0" width="5" height="1" /> - </element> - <element name="dmd_8" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="1" width="5" height="1" /> - </element> - <element name="dmd_9" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="2" width="5" height="1" /> - </element> - <element name="dmd_10" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="3" width="5" height="1" /> - </element> - <element name="dmd_11" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="4" width="5" height="1" /> - </element> - <element name="dmd_12" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="5" width="5" height="1" /> - </element> - <element name="dmd_13" ref="dotmatrix5dot" state="0"> - <bounds x="5" y="6" width="5" height="1" /> - </element> - <element name="dmd_14" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="0" width="5" height="1" /> - </element> - <element name="dmd_15" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="1" width="5" height="1" /> - </element> - <element name="dmd_16" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="2" width="5" height="1" /> - </element> - <element name="dmd_17" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="3" width="5" height="1" /> - </element> - <element name="dmd_18" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="4" width="5" height="1" /> - </element> - <element name="dmd_19" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="5" width="5" height="1" /> - </element> - <element name="dmd_20" ref="dotmatrix5dot" state="0"> - <bounds x="10" y="6" width="5" height="1" /> - </element> - <element name="dmd_21" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="0" width="5" height="1" /> - </element> - <element name="dmd_22" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="1" width="5" height="1" /> - </element> - <element name="dmd_23" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="2" width="5" height="1" /> - </element> - <element name="dmd_24" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="3" width="5" height="1" /> - </element> - <element name="dmd_25" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="4" width="5" height="1" /> - </element> - <element name="dmd_26" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="5" width="5" height="1" /> - </element> - <element name="dmd_27" ref="dotmatrix5dot" state="0"> - <bounds x="15" y="6" width="5" height="1" /> - </element> - <element name="dmd_28" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="0" width="5" height="1" /> - </element> - <element name="dmd_29" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="1" width="5" height="1" /> - </element> - <element name="dmd_30" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="2" width="5" height="1" /> - </element> - <element name="dmd_31" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="3" width="5" height="1" /> - </element> - <element name="dmd_32" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="4" width="5" height="1" /> - </element> - <element name="dmd_33" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="5" width="5" height="1" /> - </element> - <element name="dmd_34" ref="dotmatrix5dot" state="0"> - <bounds x="20" y="6" width="5" height="1" /> - </element> - <element name="dmd_35" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="0" width="5" height="1" /> - </element> - <element name="dmd_36" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="1" width="5" height="1" /> - </element> - <element name="dmd_37" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="2" width="5" height="1" /> - </element> - <element name="dmd_38" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="3" width="5" height="1" /> - </element> - <element name="dmd_39" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="4" width="5" height="1" /> - </element> - <element name="dmd_40" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="5" width="5" height="1" /> - </element> - <element name="dmd_41" ref="dotmatrix5dot" state="0"> - <bounds x="25" y="6" width="5" height="1" /> - </element> - <element name="dmd_42" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="0" width="5" height="1" /> - </element> - <element name="dmd_43" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="1" width="5" height="1" /> - </element> - <element name="dmd_44" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="2" width="5" height="1" /> - </element> - <element name="dmd_45" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="3" width="5" height="1" /> - </element> - <element name="dmd_46" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="4" width="5" height="1" /> - </element> - <element name="dmd_47" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="5" width="5" height="1" /> - </element> - <element name="dmd_48" ref="dotmatrix5dot" state="0"> - <bounds x="30" y="6" width="5" height="1" /> - </element> - <element name="dmd_49" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="0" width="5" height="1" /> - </element> - <element name="dmd_50" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="1" width="5" height="1" /> - </element> - <element name="dmd_51" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="2" width="5" height="1" /> - </element> - <element name="dmd_52" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="3" width="5" height="1" /> - </element> - <element name="dmd_53" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="4" width="5" height="1" /> - </element> - <element name="dmd_54" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="5" width="5" height="1" /> - </element> - <element name="dmd_55" ref="dotmatrix5dot" state="0"> - <bounds x="35" y="6" width="5" height="1" /> - </element> - <element name="dmd_56" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="0" width="5" height="1" /> - </element> - <element name="dmd_57" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="1" width="5" height="1" /> - </element> - <element name="dmd_58" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="2" width="5" height="1" /> - </element> - <element name="dmd_59" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="3" width="5" height="1" /> - </element> - <element name="dmd_60" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="4" width="5" height="1" /> - </element> - <element name="dmd_61" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="5" width="5" height="1" /> - </element> - <element name="dmd_62" ref="dotmatrix5dot" state="0"> - <bounds x="40" y="6" width="5" height="1" /> - </element> - <element name="dmd_63" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="0" width="5" height="1" /> - </element> - <element name="dmd_64" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="1" width="5" height="1" /> - </element> - <element name="dmd_65" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="2" width="5" height="1" /> - </element> - <element name="dmd_66" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="3" width="5" height="1" /> - </element> - <element name="dmd_67" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="4" width="5" height="1" /> - </element> - <element name="dmd_68" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="5" width="5" height="1" /> - </element> - <element name="dmd_69" ref="dotmatrix5dot" state="0"> - <bounds x="45" y="6" width="5" height="1" /> - </element> - <element name="dmd_70" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="0" width="5" height="1" /> - </element> - <element name="dmd_71" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="1" width="5" height="1" /> - </element> - <element name="dmd_72" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="2" width="5" height="1" /> - </element> - <element name="dmd_73" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="3" width="5" height="1" /> - </element> - <element name="dmd_74" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="4" width="5" height="1" /> - </element> - <element name="dmd_75" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="5" width="5" height="1" /> - </element> - <element name="dmd_76" ref="dotmatrix5dot" state="0"> - <bounds x="50" y="6" width="5" height="1" /> - </element> - <element name="dmd_77" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="0" width="5" height="1" /> - </element> - <element name="dmd_78" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="1" width="5" height="1" /> - </element> - <element name="dmd_79" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="2" width="5" height="1" /> - </element> - <element name="dmd_80" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="3" width="5" height="1" /> - </element> - <element name="dmd_81" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="4" width="5" height="1" /> - </element> - <element name="dmd_82" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="5" width="5" height="1" /> - </element> - <element name="dmd_83" ref="dotmatrix5dot" state="0"> - <bounds x="55" y="6" width="5" height="1" /> - </element> - <element name="dmd_84" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="0" width="5" height="1" /> - </element> - <element name="dmd_85" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="1" width="5" height="1" /> - </element> - <element name="dmd_86" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="2" width="5" height="1" /> - </element> - <element name="dmd_87" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="3" width="5" height="1" /> - </element> - <element name="dmd_88" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="4" width="5" height="1" /> - </element> - <element name="dmd_89" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="5" width="5" height="1" /> - </element> - <element name="dmd_90" ref="dotmatrix5dot" state="0"> - <bounds x="60" y="6" width="5" height="1" /> - </element> - <element name="dmd_91" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="0" width="5" height="1" /> - </element> - <element name="dmd_92" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="1" width="5" height="1" /> - </element> - <element name="dmd_93" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="2" width="5" height="1" /> - </element> - <element name="dmd_94" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="3" width="5" height="1" /> - </element> - <element name="dmd_95" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="4" width="5" height="1" /> - </element> - <element name="dmd_96" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="5" width="5" height="1" /> - </element> - <element name="dmd_97" ref="dotmatrix5dot" state="0"> - <bounds x="65" y="6" width="5" height="1" /> - </element> + <repeat count="14"> + <param name="char" start="0" increment="7" /> + <param name="x" start="0" increment="5" /> + <repeat count="7"> + <param name="n" start="~char~" increment="1" /> + <param name="y" start="0" increment="1" /> + <element name="dmd_~n~" ref="dotmatrix5dot" state="0"> + <bounds x="~x~" y="~y~" width="5" height="1" /> + <color red="1.0" green="0.0" blue="0.0" /> + </element> + </repeat> + </repeat> </view> </mamelayout> diff --git a/src/mame/layout/tm990189.lay b/src/mame/layout/tm990189.lay index dc6330b7c1b..5c221eb6918 100644 --- a/src/mame/layout/tm990189.lay +++ b/src/mame/layout/tm990189.lay @@ -9,7 +9,7 @@ license:CC0 </led7seg> </element> <element name="red_led" defstate="1"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> diff --git a/src/mame/layout/tm990189v.lay b/src/mame/layout/tm990189v.lay index d1514d55303..f2797f8849c 100644 --- a/src/mame/layout/tm990189v.lay +++ b/src/mame/layout/tm990189v.lay @@ -9,7 +9,7 @@ license:CC0 </led7seg> </element> <element name="red_led" defstate="1"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> diff --git a/src/mame/layout/tmtennis.lay b/src/mame/layout/tmtennis.lay index db4e50b1aee..9d434d4a914 100644 --- a/src/mame/layout/tmtennis.lay +++ b/src/mame/layout/tmtennis.lay @@ -6,54 +6,35 @@ license:CC0 <!-- define elements --> - <element name="green"><rect><color red="0" green="0.5" blue="0" /></rect></element> - <element name="greena"><rect><color red="0" green="1" blue="0" /></rect></element> - <element name="greend"><rect><color red="0" green="1" blue="0" /></rect></element> - + <element name="court"> + <image><data><![CDATA[ + <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="700" height="249" viewBox="0 0 700 249" version="1.1" id="svg1"> + <g fill="none" stroke="#00ff00" stroke-width="3" stroke-linecap="butt" stroke-linejoin="round" stroke-opacity="1"> + <path d="m 1.5,247.5 h 697 l -95,-208 h -507 z" /> + <path d="M 88,58.5 H 612" /> + <path d="M 12,224.5 H 688" /> + <path d="m 138.5,224.5 47,-166" /> + <path d="m 561.5,224.5 -47,-166" /> + <path d="M 163,136.5 H 537" /> + <path d="M 350,247.5 V 38.5" + </g> + <g fill="#00ff00"> + <rect width="12" height="39" x="344" y="0" /> + <rect width="12" height="42" x="344" y="206" /> + </g> + </svg> + ]]></data></image> + </element> <!-- build screen --> <view name="Internal Layout"> - <screen index="0"><bounds x="10" y="10" width="64" height="13.9" /></screen> - - <!-- draw the tennis court --> - - <repeat count="201"> - <param name="x" start="6.9" increment="0.0475" /> - <param name="y" start="27" increment="-0.105" /> - <element ref="greend"><bounds x="~x~" y="~y~" width="0.35" height="0.35" /><color alpha="0.18" /></element> - </repeat> - - <repeat count="201"> - <param name="x" start="76.8" increment="-0.0475" /> - <param name="y" start="27" increment="-0.105" /> - <element ref="greend"><bounds x="~x~" y="~y~" width="0.35" height="0.35" /><color alpha="0.18" /></element> - </repeat> - <repeat count="159"> - <param name="x" start="20.7" increment="0.029" /> - <param name="y" start="24.7" increment="-0.105" /> - <element ref="greend"><bounds x="~x~" y="~y~" width="0.35" height="0.35" /><color alpha="0.18" /></element> - </repeat> + <screen index="0" blend="add"><bounds x="3" y="7.6" width="64" height="13.9" /></screen> - <repeat count="159"> - <param name="x" start="63" increment="-0.029" /> - <param name="y" start="24.7" increment="-0.105" /> - <element ref="greend"><bounds x="~x~" y="~y~" width="0.35" height="0.35" /><color alpha="0.18" /></element> - </repeat> - - <element ref="greena"><bounds x="41.85" y="6" width="0.3" height="20" /><color alpha="0.5" /></element> - - <element ref="green"><bounds x="16.5" y="6.1" width="51" height="0.3" /></element> - <element ref="green"><bounds x="15.7" y="8" width="52.6" height="0.3" /></element> - - <element ref="green"><bounds x="23.35" y="15.9" width="37.3" height="0.3" /></element> - - <element ref="green"><bounds x="8.1" y="24.8" width="67.8" height="0.3" /></element> - <element ref="green"><bounds x="7" y="27" width="70" height="0.3" /></element> + <!-- draw the tennis court --> - <element ref="green"><bounds x="41.4" y="2.3" width="1.2" height="3.9" /></element> - <element ref="green"><bounds x="41.4" y="23" width="1.2" height="4.2" /></element> + <element ref="court"><bounds width="70" height="24.9" /><color alpha="0.5" /></element> </view> </mamelayout> diff --git a/src/mame/layout/touchme.lay b/src/mame/layout/touchme.lay index 25df5f557fa..e794cf36ceb 100644 --- a/src/mame/layout/touchme.lay +++ b/src/mame/layout/touchme.lay @@ -86,7 +86,7 @@ license:CC0 <element name="digit0" ref="digit"><bounds x="5.15" y="5.6" width="1" height="1.5" /></element> <element name="digit1" ref="digit"><bounds x="6.15" y="5.6" width="1" height="1.5" /></element> - <!-- element (also allow clicking it) --> + <!-- bezel (also allow clicking it) --> <element ref="static_gray"><bounds x="1.4" y="7.7" width="9.5" height="12.4" /></element> <element ref="static_black"><bounds x="1.7" y="9.7" width="8.9" height="8.9" /></element> diff --git a/src/mame/layout/unkeinv.lay b/src/mame/layout/unkeinv.lay index 81e7aabe0e8..b5fde8e2ac8 100644 --- a/src/mame/layout/unkeinv.lay +++ b/src/mame/layout/unkeinv.lay @@ -20,179 +20,79 @@ license:CC0 </element> + <!-- build screen --> <view name="Internal Layout"> <bounds left="-0.5" right="18" top="-0.5" bottom="26.5" /> + <!-- wand --> + + <repeat count="4"> + <param name="y" start="1" increment="3" /> + <param name="n" start="0" increment="1" /> + <element ref="ledr" name="~n~.7"> + <animate inputtag="IN.1" mask="0x0f" /> + <bounds state="0" x="0" y="~y~" width="1" height="1" /> + <bounds state="11" x="16.5" y="~y~" width="1" height="1" /> + </element> + </repeat> + <repeat count="5"> + <param name="y" start="13" increment="3" /> + <param name="n" start="0" increment="1" /> + <element ref="ledr" name="~n~.6"> + <animate inputtag="IN.1" mask="0x0f" /> + <bounds state="0" x="0" y="~y~" width="1" height="1" /> + <bounds state="11" x="16.5" y="~y~" width="1" height="1" /> + </element> + </repeat> + <!-- invaders --> <element name="0.0" ref="ledy"><bounds x="0" y="0" width="1" height="1" /></element> - <element name="0.1" ref="ledy"><bounds x="0" y="3" width="1" height="1" /></element> - <element name="0.2" ref="ledy"><bounds x="0" y="6" width="1" height="1" /></element> - <element name="0.3" ref="ledy"><bounds x="0" y="9" width="1" height="1" /></element> - <element name="0.4" ref="ledy"><bounds x="0" y="12" width="1" height="1" /></element> + <element name="1.0" ref="ledy"><bounds x="0" y="3" width="1" height="1" /></element> + <element name="2.0" ref="ledy"><bounds x="0" y="6" width="1" height="1" /></element> + <element name="3.0" ref="ledy"><bounds x="0" y="9" width="1" height="1" /></element> + <element name="4.0" ref="ledy"><bounds x="0" y="12" width="1" height="1" /></element> - <element name="1.0" ref="ledy"><bounds x="3" y="0" width="1" height="1" /></element> + <element name="0.1" ref="ledy"><bounds x="3" y="0" width="1" height="1" /></element> <element name="1.1" ref="ledy"><bounds x="3" y="3" width="1" height="1" /></element> - <element name="1.2" ref="ledy"><bounds x="3" y="6" width="1" height="1" /></element> - <element name="1.3" ref="ledy"><bounds x="3" y="9" width="1" height="1" /></element> - <element name="1.4" ref="ledy"><bounds x="3" y="12" width="1" height="1" /></element> + <element name="2.1" ref="ledy"><bounds x="3" y="6" width="1" height="1" /></element> + <element name="3.1" ref="ledy"><bounds x="3" y="9" width="1" height="1" /></element> + <element name="4.1" ref="ledy"><bounds x="3" y="12" width="1" height="1" /></element> - <element name="2.0" ref="ledy"><bounds x="6" y="0" width="1" height="1" /></element> - <element name="2.1" ref="ledy"><bounds x="6" y="3" width="1" height="1" /></element> + <element name="0.2" ref="ledy"><bounds x="6" y="0" width="1" height="1" /></element> + <element name="1.2" ref="ledy"><bounds x="6" y="3" width="1" height="1" /></element> <element name="2.2" ref="ledy"><bounds x="6" y="6" width="1" height="1" /></element> - <element name="2.3" ref="ledy"><bounds x="6" y="9" width="1" height="1" /></element> - <element name="2.4" ref="ledy"><bounds x="6" y="12" width="1" height="1" /></element> + <element name="3.2" ref="ledy"><bounds x="6" y="9" width="1" height="1" /></element> + <element name="4.2" ref="ledy"><bounds x="6" y="12" width="1" height="1" /></element> - <element name="3.0" ref="ledy"><bounds x="9" y="0" width="1" height="1" /></element> - <element name="3.1" ref="ledy"><bounds x="9" y="3" width="1" height="1" /></element> - <element name="3.2" ref="ledy"><bounds x="9" y="6" width="1" height="1" /></element> + <element name="0.3" ref="ledy"><bounds x="9" y="0" width="1" height="1" /></element> + <element name="1.3" ref="ledy"><bounds x="9" y="3" width="1" height="1" /></element> + <element name="2.3" ref="ledy"><bounds x="9" y="6" width="1" height="1" /></element> <element name="3.3" ref="ledy"><bounds x="9" y="9" width="1" height="1" /></element> - <element name="3.4" ref="ledy"><bounds x="9" y="12" width="1" height="1" /></element> + <element name="4.3" ref="ledy"><bounds x="9" y="12" width="1" height="1" /></element> - <element name="4.0" ref="ledy"><bounds x="12" y="0" width="1" height="1" /></element> - <element name="4.1" ref="ledy"><bounds x="12" y="3" width="1" height="1" /></element> - <element name="4.2" ref="ledy"><bounds x="12" y="6" width="1" height="1" /></element> - <element name="4.3" ref="ledy"><bounds x="12" y="9" width="1" height="1" /></element> + <element name="0.4" ref="ledy"><bounds x="12" y="0" width="1" height="1" /></element> + <element name="1.4" ref="ledy"><bounds x="12" y="3" width="1" height="1" /></element> + <element name="2.4" ref="ledy"><bounds x="12" y="6" width="1" height="1" /></element> + <element name="3.4" ref="ledy"><bounds x="12" y="9" width="1" height="1" /></element> <element name="4.4" ref="ledy"><bounds x="12" y="12" width="1" height="1" /></element> - <element name="5.0" ref="ledy"><bounds x="15" y="0" width="1" height="1" /></element> - <element name="5.1" ref="ledy"><bounds x="15" y="3" width="1" height="1" /></element> - <element name="5.2" ref="ledy"><bounds x="15" y="6" width="1" height="1" /></element> - <element name="5.3" ref="ledy"><bounds x="15" y="9" width="1" height="1" /></element> - <element name="5.4" ref="ledy"><bounds x="15" y="12" width="1" height="1" /></element> + <element name="0.5" ref="ledy"><bounds x="15" y="0" width="1" height="1" /></element> + <element name="1.5" ref="ledy"><bounds x="15" y="3" width="1" height="1" /></element> + <element name="2.5" ref="ledy"><bounds x="15" y="6" width="1" height="1" /></element> + <element name="3.5" ref="ledy"><bounds x="15" y="9" width="1" height="1" /></element> + <element name="4.5" ref="ledy"><bounds x="15" y="12" width="1" height="1" /></element> <!-- barriers --> - <element name="0.5" ref="ledg"><bounds x="1.5" y="18" width="1" height="1" /></element> - <element name="1.5" ref="ledg"><bounds x="4.5" y="18" width="1" height="1" /></element> - <element name="2.5" ref="ledg"><bounds x="7.5" y="18" width="1" height="1" /></element> - <element name="3.5" ref="ledg"><bounds x="10.5" y="18" width="1" height="1" /></element> - <element name="4.5" ref="ledg"><bounds x="13.5" y="18" width="1" height="1" /></element> + <element name="5.0" ref="ledg"><bounds x="1.5" y="18" width="1" height="1" /></element> + <element name="5.1" ref="ledg"><bounds x="4.5" y="18" width="1" height="1" /></element> + <element name="5.2" ref="ledg"><bounds x="7.5" y="18" width="1" height="1" /></element> + <element name="5.3" ref="ledg"><bounds x="10.5" y="18" width="1" height="1" /></element> + <element name="5.4" ref="ledg"><bounds x="13.5" y="18" width="1" height="1" /></element> <element name="5.5" ref="ledg"><bounds x="16.5" y="18" width="1" height="1" /></element> - <!-- wand --> - - <element name="8.8" ref="ledr"><bounds x="0" y="1" width="1" height="1" /></element> - <element name="8.9" ref="ledr"><bounds x="0" y="4" width="1" height="1" /></element> - <element name="8.10" ref="ledr"><bounds x="0" y="7" width="1" height="1" /></element> - <element name="8.11" ref="ledr"><bounds x="0" y="10" width="1" height="1" /></element> - <element name="8.0" ref="ledr"><bounds x="0" y="13" width="1" height="1" /></element> - <element name="8.1" ref="ledr"><bounds x="0" y="16" width="1" height="1" /></element> - <element name="8.2" ref="ledr"><bounds x="0" y="19" width="1" height="1" /></element> - <element name="8.3" ref="ledr"><bounds x="0" y="22" width="1" height="1" /></element> - <element name="8.4" ref="ledr"><bounds x="0" y="25" width="1" height="1" /></element> - - <element name="9.8" ref="ledr"><bounds x="1.5" y="1" width="1" height="1" /></element> - <element name="9.9" ref="ledr"><bounds x="1.5" y="4" width="1" height="1" /></element> - <element name="9.10" ref="ledr"><bounds x="1.5" y="7" width="1" height="1" /></element> - <element name="9.11" ref="ledr"><bounds x="1.5" y="10" width="1" height="1" /></element> - <element name="9.0" ref="ledr"><bounds x="1.5" y="13" width="1" height="1" /></element> - <element name="9.1" ref="ledr"><bounds x="1.5" y="16" width="1" height="1" /></element> - <element name="9.2" ref="ledr"><bounds x="1.5" y="19" width="1" height="1" /></element> - <element name="9.3" ref="ledr"><bounds x="1.5" y="22" width="1" height="1" /></element> - <element name="9.4" ref="ledr"><bounds x="1.5" y="25" width="1" height="1" /></element> - - <element name="10.8" ref="ledr"><bounds x="3" y="1" width="1" height="1" /></element> - <element name="10.9" ref="ledr"><bounds x="3" y="4" width="1" height="1" /></element> - <element name="10.10" ref="ledr"><bounds x="3" y="7" width="1" height="1" /></element> - <element name="10.11" ref="ledr"><bounds x="3" y="10" width="1" height="1" /></element> - <element name="10.0" ref="ledr"><bounds x="3" y="13" width="1" height="1" /></element> - <element name="10.1" ref="ledr"><bounds x="3" y="16" width="1" height="1" /></element> - <element name="10.2" ref="ledr"><bounds x="3" y="19" width="1" height="1" /></element> - <element name="10.3" ref="ledr"><bounds x="3" y="22" width="1" height="1" /></element> - <element name="10.4" ref="ledr"><bounds x="3" y="25" width="1" height="1" /></element> - - <element name="11.8" ref="ledr"><bounds x="4.5" y="1" width="1" height="1" /></element> - <element name="11.9" ref="ledr"><bounds x="4.5" y="4" width="1" height="1" /></element> - <element name="11.10" ref="ledr"><bounds x="4.5" y="7" width="1" height="1" /></element> - <element name="11.11" ref="ledr"><bounds x="4.5" y="10" width="1" height="1" /></element> - <element name="11.0" ref="ledr"><bounds x="4.5" y="13" width="1" height="1" /></element> - <element name="11.1" ref="ledr"><bounds x="4.5" y="16" width="1" height="1" /></element> - <element name="11.2" ref="ledr"><bounds x="4.5" y="19" width="1" height="1" /></element> - <element name="11.3" ref="ledr"><bounds x="4.5" y="22" width="1" height="1" /></element> - <element name="11.4" ref="ledr"><bounds x="4.5" y="25" width="1" height="1" /></element> - - <element name="12.8" ref="ledr"><bounds x="6" y="1" width="1" height="1" /></element> - <element name="12.9" ref="ledr"><bounds x="6" y="4" width="1" height="1" /></element> - <element name="12.10" ref="ledr"><bounds x="6" y="7" width="1" height="1" /></element> - <element name="12.11" ref="ledr"><bounds x="6" y="10" width="1" height="1" /></element> - <element name="12.0" ref="ledr"><bounds x="6" y="13" width="1" height="1" /></element> - <element name="12.1" ref="ledr"><bounds x="6" y="16" width="1" height="1" /></element> - <element name="12.2" ref="ledr"><bounds x="6" y="19" width="1" height="1" /></element> - <element name="12.3" ref="ledr"><bounds x="6" y="22" width="1" height="1" /></element> - <element name="12.4" ref="ledr"><bounds x="6" y="25" width="1" height="1" /></element> - - <element name="13.8" ref="ledr"><bounds x="7.5" y="1" width="1" height="1" /></element> - <element name="13.9" ref="ledr"><bounds x="7.5" y="4" width="1" height="1" /></element> - <element name="13.10" ref="ledr"><bounds x="7.5" y="7" width="1" height="1" /></element> - <element name="13.11" ref="ledr"><bounds x="7.5" y="10" width="1" height="1" /></element> - <element name="13.0" ref="ledr"><bounds x="7.5" y="13" width="1" height="1" /></element> - <element name="13.1" ref="ledr"><bounds x="7.5" y="16" width="1" height="1" /></element> - <element name="13.2" ref="ledr"><bounds x="7.5" y="19" width="1" height="1" /></element> - <element name="13.3" ref="ledr"><bounds x="7.5" y="22" width="1" height="1" /></element> - <element name="13.4" ref="ledr"><bounds x="7.5" y="25" width="1" height="1" /></element> - - <element name="14.8" ref="ledr"><bounds x="9" y="1" width="1" height="1" /></element> - <element name="14.9" ref="ledr"><bounds x="9" y="4" width="1" height="1" /></element> - <element name="14.10" ref="ledr"><bounds x="9" y="7" width="1" height="1" /></element> - <element name="14.11" ref="ledr"><bounds x="9" y="10" width="1" height="1" /></element> - <element name="14.0" ref="ledr"><bounds x="9" y="13" width="1" height="1" /></element> - <element name="14.1" ref="ledr"><bounds x="9" y="16" width="1" height="1" /></element> - <element name="14.2" ref="ledr"><bounds x="9" y="19" width="1" height="1" /></element> - <element name="14.3" ref="ledr"><bounds x="9" y="22" width="1" height="1" /></element> - <element name="14.4" ref="ledr"><bounds x="9" y="25" width="1" height="1" /></element> - - <element name="15.8" ref="ledr"><bounds x="10.5" y="1" width="1" height="1" /></element> - <element name="15.9" ref="ledr"><bounds x="10.5" y="4" width="1" height="1" /></element> - <element name="15.10" ref="ledr"><bounds x="10.5" y="7" width="1" height="1" /></element> - <element name="15.11" ref="ledr"><bounds x="10.5" y="10" width="1" height="1" /></element> - <element name="15.0" ref="ledr"><bounds x="10.5" y="13" width="1" height="1" /></element> - <element name="15.1" ref="ledr"><bounds x="10.5" y="16" width="1" height="1" /></element> - <element name="15.2" ref="ledr"><bounds x="10.5" y="19" width="1" height="1" /></element> - <element name="15.3" ref="ledr"><bounds x="10.5" y="22" width="1" height="1" /></element> - <element name="15.4" ref="ledr"><bounds x="10.5" y="25" width="1" height="1" /></element> - - <element name="16.8" ref="ledr"><bounds x="12" y="1" width="1" height="1" /></element> - <element name="16.9" ref="ledr"><bounds x="12" y="4" width="1" height="1" /></element> - <element name="16.10" ref="ledr"><bounds x="12" y="7" width="1" height="1" /></element> - <element name="16.11" ref="ledr"><bounds x="12" y="10" width="1" height="1" /></element> - <element name="16.0" ref="ledr"><bounds x="12" y="13" width="1" height="1" /></element> - <element name="16.1" ref="ledr"><bounds x="12" y="16" width="1" height="1" /></element> - <element name="16.2" ref="ledr"><bounds x="12" y="19" width="1" height="1" /></element> - <element name="16.3" ref="ledr"><bounds x="12" y="22" width="1" height="1" /></element> - <element name="16.4" ref="ledr"><bounds x="12" y="25" width="1" height="1" /></element> - - <element name="17.8" ref="ledr"><bounds x="13.5" y="1" width="1" height="1" /></element> - <element name="17.9" ref="ledr"><bounds x="13.5" y="4" width="1" height="1" /></element> - <element name="17.10" ref="ledr"><bounds x="13.5" y="7" width="1" height="1" /></element> - <element name="17.11" ref="ledr"><bounds x="13.5" y="10" width="1" height="1" /></element> - <element name="17.0" ref="ledr"><bounds x="13.5" y="13" width="1" height="1" /></element> - <element name="17.1" ref="ledr"><bounds x="13.5" y="16" width="1" height="1" /></element> - <element name="17.2" ref="ledr"><bounds x="13.5" y="19" width="1" height="1" /></element> - <element name="17.3" ref="ledr"><bounds x="13.5" y="22" width="1" height="1" /></element> - <element name="17.4" ref="ledr"><bounds x="13.5" y="25" width="1" height="1" /></element> - - <element name="18.8" ref="ledr"><bounds x="15" y="1" width="1" height="1" /></element> - <element name="18.9" ref="ledr"><bounds x="15" y="4" width="1" height="1" /></element> - <element name="18.10" ref="ledr"><bounds x="15" y="7" width="1" height="1" /></element> - <element name="18.11" ref="ledr"><bounds x="15" y="10" width="1" height="1" /></element> - <element name="18.0" ref="ledr"><bounds x="15" y="13" width="1" height="1" /></element> - <element name="18.1" ref="ledr"><bounds x="15" y="16" width="1" height="1" /></element> - <element name="18.2" ref="ledr"><bounds x="15" y="19" width="1" height="1" /></element> - <element name="18.3" ref="ledr"><bounds x="15" y="22" width="1" height="1" /></element> - <element name="18.4" ref="ledr"><bounds x="15" y="25" width="1" height="1" /></element> - - <element name="19.8" ref="ledr"><bounds x="16.5" y="1" width="1" height="1" /></element> - <element name="19.9" ref="ledr"><bounds x="16.5" y="4" width="1" height="1" /></element> - <element name="19.10" ref="ledr"><bounds x="16.5" y="7" width="1" height="1" /></element> - <element name="19.11" ref="ledr"><bounds x="16.5" y="10" width="1" height="1" /></element> - <element name="19.0" ref="ledr"><bounds x="16.5" y="13" width="1" height="1" /></element> - <element name="19.1" ref="ledr"><bounds x="16.5" y="16" width="1" height="1" /></element> - <element name="19.2" ref="ledr"><bounds x="16.5" y="19" width="1" height="1" /></element> - <element name="19.3" ref="ledr"><bounds x="16.5" y="22" width="1" height="1" /></element> - <element name="19.4" ref="ledr"><bounds x="16.5" y="25" width="1" height="1" /></element> - </view> </mamelayout> diff --git a/src/mame/layout/v4dbltak.lay b/src/mame/layout/v4dbltak.lay index 7e71796f13e..7ed917688b7 100644 --- a/src/mame/layout/v4dbltak.lay +++ b/src/mame/layout/v4dbltak.lay @@ -7,7 +7,7 @@ license:CC0 <!-- this adds support for combining outputs to make an aggregated output--><script> local layout = {} - local ledlamps = { { 88, 89, 90, 91, 92, 93, 94, -1 }, + local ledlamps = { { 88, 89, 90, 91, 92, 93, 94, -1 }, { 80, 81, 82, 83, 84, 85, 86, 87 }, { 72, 73, 74, 75, 76, 77, 78, -1 }, { 64, 65, 66, 67, 68, 69, 70, -1 } } @@ -125,7 +125,7 @@ return layout, "v4dbltak" <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> - + <element name="SELECT"> <rect state="1"> <color red="1.0" green="0.5" blue="0.0" /> @@ -138,7 +138,7 @@ return layout, "v4dbltak" <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> - + <element name="DEAL"> <rect state="1"> <color red="1.0" green="0.5" blue="0.0" /> @@ -158,7 +158,7 @@ return layout, "v4dbltak" <bounds x="0" y="0.1" width="1" height="0.8" /> </text> </element> - + <view name="Monitor and Lamps"> <screen index="0"> <bounds x="0" y="0" width="504" height="296" /> diff --git a/src/mame/layout/videocba.lay b/src/mame/layout/videocba.lay index cb0b7f605b9..2d7b4f952b0 100644 --- a/src/mame/layout/videocba.lay +++ b/src/mame/layout/videocba.lay @@ -3,33 +3,36 @@ license:CC0 --> <mamelayout version="2"> - <element name="L7" defstate="1"> + <element name="L7"> <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <color red="0.25" green="0.25" blue="0.0" /> </rect> - <text string="START" state="1"> + <rect> + <color red="1.00" green="1.00" blue="0.0" /> + </rect> + <text string="START"> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="BX" defstate="1"> + <element name="BX"> <rect> <color red="0.00" green="0.00" blue="0.0" /> </rect> </element> - <element name="Dig1" defstate="1"> + <element name="Dig1"> <led7seg> - <color red=".75" green="0.0" blue="0.0" /> + <color red="0.75" green="0.0" blue="0.0" /> </led7seg> </element> <view name="Button Lamps"> <screen index="0"> <bounds left="0" top="0" right="4" bottom="3" /> </screen> - <element name="lamp3" ref="L7"> + <element name="lamp3" ref="L7" inputtag="IN0" inputmask="0x08" > <bounds x="3.093" y="3.12" width="0.5" height="0.30" /> </element> - <element name="" ref="BX"> + <element ref="BX"> <bounds x="3.99" y="3.00" width="0.01" height="0.45" /> </element> <repeat count="3"> diff --git a/src/mame/layout/videopkr.lay b/src/mame/layout/videopkr.lay index a242edba8e3..aeb9e3f9317 100644 --- a/src/mame/layout/videopkr.lay +++ b/src/mame/layout/videopkr.lay @@ -3,120 +3,144 @@ license:CC0 --> <mamelayout version="2"> - <element name="L0" defstate="1"> - <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <element name="L0"> + <rect state="0"> + <color red="0.25" green="0.25" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="1.00" blue="0.0" /> </rect> - <text string=" DRAW " state="1"> + <text string=" DRAW "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L1" defstate="1"> - <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <element name="L1"> + <rect state="0"> + <color red="0.25" green="0.25" blue="0.0" /> </rect> - <text string=" CANCEL " state="1"> + <rect state="1"> + <color red="1.00" green="1.00" blue="0.0" /> + </rect> + <text string=" CANCEL "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L2" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue=".0" /> + <element name="L2"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 1 " state="1"> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> + </rect> + <text string=" HOLD 1 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L3" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L3"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 2 " state="1"> + <text string=" HOLD 2 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L4" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L4"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 3 " state="1"> + <text string=" HOLD 3 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L5" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L5"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> + </rect> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 4 " state="1"> + <text string=" HOLD 4 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L6" defstate="1"> - <rect> - <color red="0.70" green="0.0" blue="0.0" /> + <element name="L6"> + <rect state="0"> + <color red="0.25" green="0.0" blue="0.0" /> </rect> - <text string=" HOLD 5 " state="1"> + <rect state="1"> + <color red="1.00" green="0.0" blue="0.0" /> + </rect> + <text string=" HOLD 5 "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> - <element name="L7" defstate="1"> - <rect> - <color red="0.70" green="0.70" blue="0.0" /> + <element name="L7"> + <rect state="0"> + <color red="0.25" green="0.25" blue="0.0" /> </rect> - <text string=" DEAL " state="1"> + <rect state="1"> + <color red="1.00" green="1.00" blue="0.0" /> + </rect> + <text string=" DEAL "> <color red="0.0" green="0.0" blue="0.0" /> <bounds x="0" y="0.25" width="1" height="0.5" /> </text> </element> <element name="DSKR" defstate="1"> - <rect> + <rect state="0"> <color red="0.70" green="0.00" blue="0.0" /> </rect> </element> <element name="DSKV" defstate="1"> - <rect> + <rect state="0"> <color red="0.00" green="0.70" blue="0.0" /> </rect> </element> <element name="DSKA" defstate="1"> - <rect> + <rect state="0"> <color red="0.7" green="0.70" blue="0.0" /> </rect> </element> - <element name="BX" defstate="1"> + <element name="BX"> <rect> <color red="0.00" green="0.00" blue="0.0" /> </rect> </element> - <element name="BZ" defstate="1"> + <element name="BZ"> <rect> <color red="0.5" green="0.5" blue="0.5" /> </rect> </element> - <element name="Dig1" defstate="1"> + <element name="Dig1"> <led7seg> - <color red=".75" green="0.0" blue="0.0" /> + <color red="0.75" green="0.0" blue="0.0" /> </led7seg> </element> @@ -125,35 +149,35 @@ license:CC0 <bounds left="0" top="0" right="4" bottom="3" /> </screen> - <element name="lamp0" ref="L0"> + <element name="lamp0" ref="L0" inputtag="IN0" inputmask="0x10"> <bounds x="0.02313" y="3.12" width="0.5" height="0.30" /> </element> - <element name="lamp0" ref="L1"> + <element name="lamp0" ref="L1" inputtag="IN0" inputmask="0x20"> <bounds x="0.5694" y="3.12" width="0.5" height="0.30" /> </element> - <element name="lamp1" ref="L2"> + <element name="lamp1" ref="L2" inputtag="IN0" inputmask="0x40"> <bounds x="1.112" y="3.12" width="0.35" height="0.30" /> </element> - <element name="lamp1" ref="L3"> + <element name="lamp1" ref="L3" inputtag="IN0" inputmask="0x80"> <bounds x="1.508" y="3.12" width="0.35" height="0.30" /> </element> - <element name="lamp2" ref="L4"> + <element name="lamp2" ref="L4" inputtag="IN1" inputmask="0x01"> <bounds x="1.904" y="3.12" width="0.35" height="0.30" /> </element> - <element name="lamp2" ref="L5"> + <element name="lamp2" ref="L5" inputtag="IN1" inputmask="0x02"> <bounds x="2.3" y="3.12" width="0.35" height="0.30" /> </element> - <element name="lamp2" ref="L6"> + <element name="lamp2" ref="L6" inputtag="IN1" inputmask="0x04"> <bounds x="2.697" y="3.12" width="0.35" height="0.30" /> </element> - <element name="lamp3" ref="L7"> + <element name="lamp3" ref="L7" inputtag="IN0" inputmask="0x08"> <bounds x="3.093" y="3.12" width="0.5" height="0.30" /> </element> - <element name="" ref="BX"> + <element ref="BX"> <bounds x="3.99" y="3.00" width="0.01" height="0.45" /> </element> - <element name="" ref="BZ"> + <element ref="BZ"> <bounds x="0.01" y="3.01" width="0.42" height="0.10" /> </element> diff --git a/src/mame/layout/wpc_an.lay b/src/mame/layout/wpc_an.lay index e8a09f861f0..5a5dd55267f 100644 --- a/src/mame/layout/wpc_an.lay +++ b/src/mame/layout/wpc_an.lay @@ -16,7 +16,7 @@ license:CC0 </led7seg> </element> <element name="diagled" defstate="0"> - <disk> + <disk state="0"> <color red="1.0" green="0.0" blue="0.0" /> </disk> </element> diff --git a/src/mame/machine/3do.cpp b/src/mame/machine/3do.cpp index 245f018fe8b..cf5af65cfe8 100644 --- a/src/mame/machine/3do.cpp +++ b/src/mame/machine/3do.cpp @@ -1046,8 +1046,8 @@ uint32_t _3do_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for ( int y = 0; y < 120; y++ ) { - uint32_t *dest_p0 = &bitmap.pix32(22 + y * 2, 254 ); - uint32_t *dest_p1 = &bitmap.pix32(22 + y * 2 + 1, 254 ); + uint32_t *dest_p0 = &bitmap.pix(22 + y * 2, 254 ); + uint32_t *dest_p1 = &bitmap.pix(22 + y * 2 + 1, 254 ); for ( int x = 0; x < 320; x++ ) { diff --git a/src/mame/machine/3dom2.cpp b/src/mame/machine/3dom2.cpp index dee32da9369..7da659deefa 100644 --- a/src/mame/machine/3dom2.cpp +++ b/src/mame/machine/3dom2.cpp @@ -1336,9 +1336,9 @@ uint32_t m2_vdu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (uint32_t ys = vdouble ? 2 : 1; ys > 0; --ys) { if (hdouble) - draw_scanline_double(&bitmap.pix32(v, 0), srclower, srcupper); + draw_scanline_double(&bitmap.pix(v, 0), srclower, srcupper); else - draw_scanline(&bitmap.pix32(v, 0), srclower, srcupper); + draw_scanline(&bitmap.pix(v, 0), srclower, srcupper); ++v; } @@ -1352,7 +1352,7 @@ uint32_t m2_vdu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma // Blank this block of lines if DMA is disabled while (lines--) { - uint32_t *dst = &bitmap.pix32(v, cliprect.min_x); + uint32_t *dst = &bitmap.pix(v, cliprect.min_x); for (uint32_t x = cliprect.min_x; x <= cliprect.max_x; ++x) *dst++ = rgb_t::black(); diff --git a/src/mame/machine/abc1600mac.cpp b/src/mame/machine/abc1600mac.cpp index 1e46a1bcda0..156ca960213 100644 --- a/src/mame/machine/abc1600mac.cpp +++ b/src/mame/machine/abc1600mac.cpp @@ -440,7 +440,7 @@ void abc1600_mac_device::task_w(offs_t offset, uint8_t data) m_task = data ^ 0xff; - if (LOG) logerror("%s TASK %05x:%02x (TASK %u BOOTE %u MAGIC %u)\n", machine().describe_context(), offset, data, + if (LOG) logerror("%s TASK %05x:%02x (TASK %u BOOTE %u MAGIC %u)\n", machine().describe_context(), offset, data, get_current_task(offset), BOOTE, MAGIC); } @@ -498,7 +498,7 @@ void abc1600_mac_device::segment_w(offs_t offset, uint8_t data) m_segment_ram[sega] = data & 0x7f; - if (LOG) logerror("%s %05x:%02x TASK %u SEGMENT %u MEM %05x-%05x\n", machine().describe_context(), offset, data, + if (LOG) logerror("%s %05x:%02x TASK %u SEGMENT %u MEM %05x-%05x\n", machine().describe_context(), offset, data, get_current_task(offset), sega & 0x1f, (sega & 0x1f) * 0x8000, ((sega & 0x1f) * 0x8000) + 0x7fff); } @@ -604,8 +604,8 @@ void abc1600_mac_device::page_w(offs_t offset, uint8_t data) m_page_ram[pga] = ((data & 0xc3) << 8) | (m_page_ram[pga] & 0xff); } - if (LOG) logerror("%s %05x:%02x TASK %u SEGMENT %u PAGE %u MEM %05x-%05x %06x\n", machine().describe_context(), offset, data, - get_current_task(offset), sega & 0x1f, ((offset >> 11) & 0x0f), ((sega & 0x1f) * 0x8000) + ((offset >> 11) & 0x0f) * 0x800, + if (LOG) logerror("%s %05x:%02x TASK %u SEGMENT %u PAGE %u MEM %05x-%05x %06x\n", machine().describe_context(), offset, data, + get_current_task(offset), sega & 0x1f, ((offset >> 11) & 0x0f), ((sega & 0x1f) * 0x8000) + ((offset >> 11) & 0x0f) * 0x800, ((sega & 0x1f) * 0x8000) + (((offset >> 11) & 0x0f) * 0x800) + 0x7ff, (m_page_ram[pga] & 0x3ff) << 11); } diff --git a/src/mame/machine/aim65.cpp b/src/mame/machine/aim65.cpp index 5c7ce8c221d..cf7b14ba9e1 100644 --- a/src/mame/machine/aim65.cpp +++ b/src/mame/machine/aim65.cpp @@ -315,8 +315,6 @@ void aim65_state::z32_pa_w( u8 data ) // Display printer output uint32_t aim65_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t data; - for (u8 y = 0; y<cliprect.max_y; y++) { u16 sy = m_printer_y*10 - cliprect.max_y + 10 + y; @@ -324,13 +322,14 @@ uint32_t aim65_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, sy += 0x280; for(u8 x = 0; x < 10; x++) { + uint16_t data; if (!BIT(sy, 0)) data = m_printerRAM[sy * 10 + x]; else data = m_printerRAM[sy * 10 + (9 - x)]; for (u8 b = 0; b < 10; b++) - bitmap.pix16(y, 120 - (b * 12) - ((x > 4) ? x+1 : x)) = BIT(data, b); + bitmap.pix(y, 120 - (b * 12) - ((x > 4) ? x+1 : x)) = BIT(data, b); } } diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp index 0fecabe04f1..13109d4da1f 100644 --- a/src/mame/machine/amstrad.cpp +++ b/src/mame/machine/amstrad.cpp @@ -799,7 +799,7 @@ void amstrad_state::amstrad_plus_update_video_sprites() else horiz = m_asic.h_start; - p = &m_gate_array.bitmap->pix16(m_gate_array.y, horiz ); + p = &m_gate_array.bitmap->pix(m_gate_array.y, horiz ); for ( i = 15 * 8; i >= 0; i -= 8 ) { uint8_t xmag = ( m_asic.ram[ 0x2000 + i + 4 ] >> 2 ) & 0x03; @@ -852,7 +852,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_hsync_changed) m_gate_array.line_ticks = 0; if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + m_gate_array.draw_p = &m_gate_array.bitmap->pix(m_gate_array.y); } else { @@ -895,7 +895,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_hsync_changed) m_gate_array.line_ticks = 0; if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + m_gate_array.draw_p = &m_gate_array.bitmap->pix(m_gate_array.y); } else { diff --git a/src/mame/machine/apple3.cpp b/src/mame/machine/apple3.cpp index 1a4bf520389..a875d6dfc9e 100644 --- a/src/mame/machine/apple3.cpp +++ b/src/mame/machine/apple3.cpp @@ -189,6 +189,16 @@ uint8_t apple3_state::apple3_c0xx_r(offs_t offset) result = (m_joybuttons->read() & 8) ? 0x80 : 0x00; break; + case 0x64: // slot 2 IRQ status (negative logic) + case 0x6c: + result = (m_a2bus->get_a2bus_irq_mask() & (1<<2)) ? 0 : 0x80; + break; + + case 0x65: // slot 1 IRQ status (negative logic) + case 0x6d: + result = (m_a2bus->get_a2bus_irq_mask() & (1<<1)) ? 0 : 0x80; + break; + case 0x66: // paddle A/D conversion done (bit 7 = 1 while counting, 0 when done) case 0x6e: result = m_ramp_active ? 0x80 : 0x00; @@ -646,6 +656,7 @@ void apple3_state::machine_reset() m_analog_sel = 0; m_ramp_active = false; m_charwrt = false; + m_inh_state = false; m_fdc->set_floppies_4(floppy0, floppy1, floppy2, floppy3); @@ -653,7 +664,10 @@ void apple3_state::machine_reset() m_scanend->adjust(attotime::never); } - +WRITE_LINE_MEMBER(apple3_state::a2bus_inh_w) +{ + m_inh_state = state; +} uint8_t *apple3_state::apple3_get_indexed_addr(offs_t offset) { @@ -666,7 +680,7 @@ uint8_t *apple3_state::apple3_get_indexed_addr(offs_t offset) if ((offset >= 0xFFD0) && (offset <= 0xFFEF)) result = apple3_bankaddr(~0, offset & 0x7FFF); else if (offset < 0x2000) - result = apple3_bankaddr(~0, offset - 0x2000); + result = apple3_bankaddr(~0, offset); else if (offset > 0x9FFF) result = apple3_bankaddr(~0, offset - 0x8000); else @@ -691,6 +705,7 @@ void apple3_state::init_apple3() m_vb = 0; m_vc = 0; m_smoothscr = 0; + m_inh_state = false; // kludge round +12v pull up resistors, which after conversion will bring this low when nothing is plugged in. issue also affects dcd/dsr but those don't affect booting. m_acia->write_cts(0); @@ -743,6 +758,7 @@ void apple3_state::init_apple3() save_item(NAME(m_vc)); save_item(NAME(m_smoothscr)); save_item(NAME(m_charwrt)); + save_item(NAME(m_inh_state)); } void apple3_state::device_post_load() @@ -754,6 +770,24 @@ uint8_t apple3_state::apple3_memory_r(offs_t offset) { uint8_t rv = 0xff; + if (m_inh_state) + { + for (int slot = 1; slot < 4; slot++) + { + device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card(slot); + if (slotdevice != nullptr) + { + if ((slotdevice->inh_type() & INH_READ) == INH_READ) + { + if ((offset >= slotdevice->inh_start()) && (offset <= slotdevice->inh_end())) + { + return slotdevice->read_inh_rom(offset); + } + } + } + } + } + // (zp), y or (zp,x) read if (!machine().side_effects_disabled()) { @@ -891,6 +925,25 @@ uint8_t apple3_state::apple3_memory_r(offs_t offset) void apple3_state::apple3_memory_w(offs_t offset, uint8_t data) { + if (m_inh_state) + { + for (int slot = 1; slot < 4; slot++) + { + device_a2bus_card_interface *slotdevice = m_a2bus->get_a2bus_card(slot); + if (slotdevice != nullptr) + { + if ((slotdevice->inh_type() & INH_WRITE) == INH_WRITE) + { + if ((offset >= slotdevice->inh_start()) && (offset <= slotdevice->inh_end())) + { + slotdevice->write_inh_rom(offset, data); + return; + } + } + } + } + } + if ((m_indir_bank & 0x80) && (offset >= 0x100)) { uint8_t *test; @@ -1314,25 +1367,24 @@ WRITE_LINE_MEMBER(apple3_state::a2bus_irq_w) { uint8_t irq_mask = m_a2bus->get_a2bus_irq_mask(); - m_via[1]->write_ca1(state); - m_via[1]->write_pa7(state); + m_via[0]->write_ca1(!state); if (irq_mask & (1<<4)) { - m_via[1]->write_pa4(ASSERT_LINE); + m_via[1]->write_pa4(CLEAR_LINE); } else { - m_via[1]->write_pa4(CLEAR_LINE); + m_via[1]->write_pa4(ASSERT_LINE); } if (irq_mask & (1<<3)) { - m_via[1]->write_pa5(ASSERT_LINE); + m_via[1]->write_pa5(CLEAR_LINE); } else { - m_via[1]->write_pa5(CLEAR_LINE); + m_via[1]->write_pa5(ASSERT_LINE); } } diff --git a/src/mame/machine/b2m.cpp b/src/mame/machine/b2m.cpp index 10c892e25db..fae7b699f9c 100644 --- a/src/mame/machine/b2m.cpp +++ b/src/mame/machine/b2m.cpp @@ -280,17 +280,14 @@ void b2m_state::machine_reset() uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1; - uint8_t code2; - uint8_t col; - int y, x, b; - uint8_t *ram = m_ram->pointer(); + u8 const *const ram = m_ram->pointer(); - for (x = 0; x < 48; x++) + for (int x = 0; x < 48; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - u16 t = x*256 + ((y + m_video_scroll) & 0xff); + u16 const t = x*256 + ((y + m_video_scroll) & 0xff); + u8 code1, code2; if (m_video_page==0) { code1 = ram[0x11000 + t]; @@ -301,10 +298,10 @@ uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c code1 = ram[0x19000 + t]; code2 = ram[0x1d000 + t]; } - for (b = 7; b >= 0; b--) + for (int b = 7; b >= 0; b--) { - col = (BIT(code2, b)<<1) + BIT(code1, b); - bitmap.pix16(y, x*8+b) = col; + u8 const col = (BIT(code2, b)<<1) + BIT(code1, b); + bitmap.pix(y, x*8+b) = col; } } } diff --git a/src/mame/machine/bacta_datalogger.cpp b/src/mame/machine/bacta_datalogger.cpp index de229723505..beae2f8883e 100644 --- a/src/mame/machine/bacta_datalogger.cpp +++ b/src/mame/machine/bacta_datalogger.cpp @@ -53,7 +53,7 @@ void bacta_datalogger_device::device_reset() int startbits = 1; int databits = 8; parity_t parity = device_serial_interface::PARITY_ODD; - stop_bits_t stopbits = device_serial_interface::STOP_BITS_1; + stop_bits_t stopbits = device_serial_interface::STOP_BITS_1; set_data_frame(startbits, databits, parity, stopbits); diff --git a/src/mame/machine/bk.cpp b/src/mame/machine/bk.cpp index cd83484112f..d9c5a7c6907 100644 --- a/src/mame/machine/bk.cpp +++ b/src/mame/machine/bk.cpp @@ -151,15 +151,15 @@ void bk_state::floppy_data_w(uint16_t data) u32 bk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u16 nOfs = (m_scroll - 728) % 256; + u16 const nOfs = (m_scroll - 728) % 256; for (u16 y = 0; y < 256; y++) { for (u16 x = 0; x < 32; x++) { - u16 code = m_vram[((y+nOfs) %256)*32 + x]; + u16 const code = m_vram[((y+nOfs) %256)*32 + x]; for (u8 b = 0; b < 16; b++) - bitmap.pix16(y, x*16 + b) = BIT(code, b); + bitmap.pix(y, x*16 + b) = BIT(code, b); } } return 0; diff --git a/src/mame/machine/cedar_magnet_plane.cpp b/src/mame/machine/cedar_magnet_plane.cpp index 094d25ddeab..9ecb7a7eea3 100644 --- a/src/mame/machine/cedar_magnet_plane.cpp +++ b/src/mame/machine/cedar_magnet_plane.cpp @@ -140,7 +140,7 @@ u32 cedar_magnet_plane_device::draw(screen_device &screen, bitmap_ind16 &bitmap, for (int y = 0; y < 256;y++) { - u16 *dst = &bitmap.pix16((y - m_scrolly) & 0xff); + u16 *const dst = &bitmap.pix((y - m_scrolly) & 0xff); for (int x = 0; x < 256;x++) { diff --git a/src/mame/machine/cedar_magnet_sprite.cpp b/src/mame/machine/cedar_magnet_sprite.cpp index 3be7bd8466f..0109d59efe0 100644 --- a/src/mame/machine/cedar_magnet_sprite.cpp +++ b/src/mame/machine/cedar_magnet_sprite.cpp @@ -309,7 +309,7 @@ u32 cedar_magnet_sprite_device::draw(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 256; y++) { - uint16_t *dst = &bitmap.pix16((y) & 0xff); + uint16_t *const dst = &bitmap.pix((y) & 0xff); for (int x = 0; x < 256; x++) { diff --git a/src/mame/machine/concept.cpp b/src/mame/machine/concept.cpp index 83de6b7e48b..ff70dfd656d 100644 --- a/src/mame/machine/concept.cpp +++ b/src/mame/machine/concept.cpp @@ -66,7 +66,7 @@ uint32_t concept_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* resolution is 720*560 */ for (int y = 0; y < 560; y++) { - uint16_t *line = &bitmap.pix16(560-1-y); + uint16_t *const line = &bitmap.pix(560-1-y); for (int x = 0; x < 720; x++) line[720-1-x] = (m_videoram[(x+48+y*768)>>4] & (0x8000 >> ((x+48+y*768) & 0xf))) ? 1 : 0; } diff --git a/src/mame/machine/dai.cpp b/src/mame/machine/dai.cpp index c569f898399..aba8ac42d19 100644 --- a/src/mame/machine/dai.cpp +++ b/src/mame/machine/dai.cpp @@ -19,17 +19,10 @@ #define LOG_DAI_PORT_R(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port read : %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0) #define LOG_DAI_PORT_W(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0) -void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(dai_state::tms_timer) { - switch (id) - { - case TIMER_TMS5501: - m_tms5501->xi7_w(BIT(m_io_keyboard[8]->read(), 2)); - timer_set(attotime::from_hz(100), TIMER_TMS5501); - break; - default: - throw emu_fatalerror("Unknown id in dai_state::device_timer"); - } + m_tms5501->xi7_w(BIT(m_io_keyboard[8]->read(), 2)); + m_tms_timer->adjust(attotime::from_hz(100)); } @@ -68,7 +61,7 @@ IRQ_CALLBACK_MEMBER(dai_state::int_ack) void dai_state::machine_start() { membank("bank2")->configure_entries(0, 4, m_rom + 0x2000, 0x1000); - timer_set(attotime::from_hz(100), TIMER_TMS5501); + m_tms_timer->adjust(attotime::from_hz(100)); save_item(NAME(m_paddle_select)); save_item(NAME(m_paddle_enable)); save_item(NAME(m_cassette_motor)); diff --git a/src/mame/machine/dragon.cpp b/src/mame/machine/dragon.cpp index 35f32ef1c31..3499c6553bd 100644 --- a/src/mame/machine/dragon.cpp +++ b/src/mame/machine/dragon.cpp @@ -222,7 +222,7 @@ MC6845_UPDATE_ROW(d64plus_state::crtc_update_row) for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; - bitmap.pix32(y, x) = m_palette->pen(BIT(data, 7) && de); + bitmap.pix(y, x) = m_palette->pen(BIT(data, 7) && de); data <<= 1; } } diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp index dacd0a3ec4e..961a37e3b3a 100644 --- a/src/mame/machine/egret.cpp +++ b/src/mame/machine/egret.cpp @@ -113,14 +113,14 @@ void egret_device::send_port(uint8_t offset, uint8_t data) { m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); /* - if (data & 0x80) - { - printf("EG ADB: 1->0 time %d\n", m_adb_dtime); - } - else - { - printf("EG ADB: 0->1 time %d\n", m_adb_dtime); - } + if (data & 0x80) + { + printf("EG ADB: 1->0 time %d\n", m_adb_dtime); + } + else + { + printf("EG ADB: 0->1 time %d\n", m_adb_dtime); + } */ // allow the linechange handler to override us adb_in = (data & 0x80) ? true : false; diff --git a/src/mame/machine/fp6000_kbd.cpp b/src/mame/machine/fp6000_kbd.cpp index 3cd8f5d7b36..31825ad01d5 100644 --- a/src/mame/machine/fp6000_kbd.cpp +++ b/src/mame/machine/fp6000_kbd.cpp @@ -38,7 +38,7 @@ static INPUT_PORTS_START( keyboard ) PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0b */ PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0c */ PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("Ins") PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0d */ PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("Del") - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0e */ PORT_CODE(KEYCODE_HOME) PORT_CHAR(0) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("Cls / Home") + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0e */ PORT_CODE(KEYCODE_HOME) PORT_CHAR(12) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("Cls / Home") PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0f */ PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK)) PORT_NAME("SLock / Break") PORT_START("row_1") @@ -56,7 +56,7 @@ static INPUT_PORTS_START( keyboard ) PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1b */ PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1c */ PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("\xe2\x86\x91 PgUp") PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1d */ PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("\xe2\x86\x92 PgRt") - PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1e */ PORT_CODE(KEYCODE_END) PORT_CHAR(0) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("Clr / End") + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1e */ PORT_CODE(KEYCODE_END) PORT_CHAR(0xff) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_NAME("Clr / End") PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1f */ PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_START("row_2") @@ -123,7 +123,7 @@ static INPUT_PORTS_START( keyboard ) PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 56 */ PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 57 */ PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 58 */ PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 59 */ PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0) PORT_CHAR('_') PORT_NAME(" _") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 59 */ PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(0xff) PORT_CHAR('_') PORT_NAME(" _") PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5a */ PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Kana") PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5b */ PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5c */ PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) diff --git a/src/mame/machine/gamepock.cpp b/src/mame/machine/gamepock.cpp index 66de6c28dcb..6b188d2a312 100644 --- a/src/mame/machine/gamepock.cpp +++ b/src/mame/machine/gamepock.cpp @@ -154,14 +154,14 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 50; j++ ) { - bitmap.pix16(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } @@ -172,14 +172,14 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 50; j++ ) { - bitmap.pix16(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } @@ -190,25 +190,25 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 25; j++ ) { - bitmap.pix16(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; } for ( int j = 25; j < 50; j++ ) { - bitmap.pix16(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } diff --git a/src/mame/machine/ibm6580_fdc.cpp b/src/mame/machine/ibm6580_fdc.cpp index 68392bbe302..9feceae1a1f 100644 --- a/src/mame/machine/ibm6580_fdc.cpp +++ b/src/mame/machine/ibm6580_fdc.cpp @@ -18,7 +18,7 @@ DEFINE_DEVICE_TYPE(DW_FDC, dw_fdc_device, "dw_fdc", "IBM Displaywriter Floppy") ROM_START( dw_fdc ) ROM_REGION(0x800, "mcu", 0) - ROM_LOAD("4430030_FLP_8041.BIN", 0x0000, 0x400, CRC(2bb96799) SHA1(e30b0f2d790197f290858eab74ad5e151ded78c3)) + ROM_LOAD("4430030_flp_8041.bin", 0x0000, 0x400, CRC(2bb96799) SHA1(e30b0f2d790197f290858eab74ad5e151ded78c3)) ROM_END diff --git a/src/mame/machine/imds2ioc.cpp b/src/mame/machine/imds2ioc.cpp index fc9c7a25dd9..1f8008b48b2 100644 --- a/src/mame/machine/imds2ioc.cpp +++ b/src/mame/machine/imds2ioc.cpp @@ -347,9 +347,8 @@ WRITE_LINE_MEMBER(imds2ioc_device::pio_lpt_select_w) I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) { - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; uint16_t pixels; if (lten) { @@ -392,8 +391,8 @@ I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) pixels = ~pixels; } - for (i = 0; i < 14; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; + for (unsigned i = 0; i < 14; i++) { + bitmap.pix(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; } } diff --git a/src/mame/machine/inder_vid.cpp b/src/mame/machine/inder_vid.cpp index e5005ea52b3..ea501338fe2 100644 --- a/src/mame/machine/inder_vid.cpp +++ b/src/mame/machine/inder_vid.cpp @@ -36,17 +36,16 @@ void inder_vid_device::megaphx_tms_map(address_map &map) TMS340X0_SCANLINE_RGB32_CB_MEMBER(inder_vid_device::scanline) { - uint16_t *vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); const pen_t *paldata = m_palette->pens(); int coladdr = params->coladdr; - int x; if (m_bpp_mode == 8) { - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = paldata[pixels & 0xff]; @@ -55,7 +54,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(inder_vid_device::scanline) } else if (m_bpp_mode == 4) { - for (x = params->heblnk; x < params->hsblnk; x += 4) + for (int x = params->heblnk; x < params->hsblnk; x += 4) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 3] = paldata[((pixels & 0xf000) >> 12)]; diff --git a/src/mame/machine/informer_207_376_kbd.cpp b/src/mame/machine/informer_207_376_kbd.cpp index 5c36eb4c2b4..4dacd14577f 100644 --- a/src/mame/machine/informer_207_376_kbd.cpp +++ b/src/mame/machine/informer_207_376_kbd.cpp @@ -121,7 +121,7 @@ static INPUT_PORTS_START( keyboard ) PORT_START("row_5") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 50 */ PORT_CODE(KEYCODE_F2) PORT_NAME("Cursor Sel Clear") PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 51 */ PORT_CODE(KEYCODE_F1) // X + human? ATTN? - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNKNOWN) /* 52 */ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_UNKNOWN) /* 52 */ PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) /* 53 */ PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 54 */ PORT_CODE(KEYCODE_F3) PORT_NAME("Cursor Blink Alt Cursor") PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 55 */ PORT_CODE(KEYCODE_END) PORT_NAME("Erase EOF") diff --git a/src/mame/machine/informer_207_376_kbd.h b/src/mame/machine/informer_207_376_kbd.h index ff802e0487b..a855b8f9d44 100644 --- a/src/mame/machine/informer_207_376_kbd.h +++ b/src/mame/machine/informer_207_376_kbd.h @@ -22,8 +22,8 @@ // ======================> informer_207_376_kbd_hle_device class informer_207_376_kbd_hle_device : public device_t, - public device_buffered_serial_interface<16>, - protected device_matrix_keyboard_interface<8> + public device_buffered_serial_interface<16>, + protected device_matrix_keyboard_interface<8> { public: // construction/destruction diff --git a/src/mame/machine/informer_213_kbd.cpp b/src/mame/machine/informer_213_kbd.cpp new file mode 100644 index 00000000000..30373f5152f --- /dev/null +++ b/src/mame/machine/informer_213_kbd.cpp @@ -0,0 +1,304 @@ +// license: BSD-3-Clause +// copyright-holders: Dirk Best +/*************************************************************************** + + Informer 213 Keyboard (HLE) + +***************************************************************************/ + +#include "emu.h" +#include "informer_213_kbd.h" +#include "machine/keyboard.ipp" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(INFORMER_213_KBD_HLE, informer_213_kbd_hle_device, "in213kbd_hle", "Informer 213 Keyboard (HLE)") + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( keyboard ) + PORT_START("row_0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 00 */ PORT_NAME("0x00") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 01 */ PORT_NAME("0x01") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 02 */ PORT_NAME("0x02") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 03 */ PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 04 */ PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 05 */ PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 06 */ PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 07 */ PORT_CODE(KEYCODE_END) PORT_NAME("ERASE EOF ERASE INPUT") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 08 */ PORT_CODE(KEYCODE_F5) PORT_NAME("PF5 PF17") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 09 */ PORT_NAME("0x09") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0a */ PORT_NAME("0x0a") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0b */ PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0c */ PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0d */ PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0e */ PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 0f */ PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~') + + PORT_START("row_1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 10 */ PORT_CODE(KEYCODE_F6) PORT_NAME("PF6 PF18") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 11 */ PORT_NAME("0x11") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 12 */ PORT_NAME("0x12") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 13 */ PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 14 */ PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 15 */ PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 16 */ PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 17 */ PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 18 */ PORT_CODE(KEYCODE_F7) PORT_NAME("PF7 PF19") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 19 */ PORT_NAME("0x19") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1a */ PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("ENTER SET UP") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1b */ PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1c */ PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1d */ PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1e */ PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 1f */ PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') + + PORT_START("row_2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 20 */ PORT_CODE(KEYCODE_F8) PORT_NAME("PF8 PF20") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 21 */ PORT_NAME("0x21") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 22 */ PORT_CODE(KEYCODE_ENTER) PORT_NAME("\xe2\x86\xb2") // ↲ (LF) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 23 */ PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 24 */ PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 25 */ PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 26 */ PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 27 */ PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') // (actually ¦) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 28 */ PORT_CODE(KEYCODE_F9) PORT_NAME("PF9 PF21") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 29 */ PORT_NAME("0x29") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 2a */ PORT_CODE(KEYCODE_RIGHT) PORT_NAME("\xe2\x86\x92") // → + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 2b */ PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 2c */ PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 2d */ PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 2e */ PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 2f */ PORT_CODE(KEYCODE_INSERT) PORT_NAME("â DUP PA1") + + PORT_START("row_3") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 30 */ PORT_CODE(KEYCODE_F10) PORT_NAME("PF10 PF22") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 31 */ PORT_NAME("0x31") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 32 */ PORT_CODE(KEYCODE_DOWN) PORT_NAME("\xe2\x86\x93") // ↓ + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 33 */ PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 34 */ PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 35 */ PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 36 */ PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 37 */ PORT_CODE(KEYCODE_DEL) PORT_NAME("DEL FIELD MARK PA2") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 38 */ PORT_CODE(KEYCODE_F11) PORT_NAME("PF11 PF23") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 39 */ PORT_NAME("0x39") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 3a */ PORT_CODE(KEYCODE_HOME) PORT_NAME("KEYCLICK TEST") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 3b */ PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 3c */ PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 3d */ PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("\xe2\x87\xa4 HOME") // ⇤ + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 3e */ PORT_CODE(KEYCODE_LEFT) PORT_NAME("\xe2\x86\x90") // ← + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 3f */ PORT_CODE(KEYCODE_UP) PORT_NAME("\xe2\x86\x91") // ↑ + + PORT_START("row_4") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 40 */ PORT_CODE(KEYCODE_F12) PORT_NAME("PF12 PF24") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 41 */ PORT_CODE(KEYCODE_TAB) PORT_NAME("\xe2\x87\xa5") // ⇥ + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 42 */ PORT_NAME("0x42") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 43 */ PORT_CODE(KEYCODE_ESC) PORT_NAME("RESET DEV CNCL") + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 44 */ PORT_NAME("0x44") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 45 */ PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 46 */ PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 47 */ PORT_CODE(KEYCODE_PAUSE) PORT_NAME("ATTN PA3 SYS REQ") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 48 */ PORT_CODE(KEYCODE_F1) PORT_NAME("PF1 PF13") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 49 */ PORT_NAME("0x49") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 4a */ PORT_NAME("0x4a") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 4b */ PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 4c */ PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 4d */ PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 4e */ PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 4f */ PORT_CODE(KEYCODE_PGUP) PORT_NAME("CURSOR SEL CLEAR") + + PORT_START("row_5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 50 */ PORT_CODE(KEYCODE_F2) PORT_NAME("PF2 PF14") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 51 */ PORT_NAME("0x51") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 52 */ PORT_NAME("0x52") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 53 */ PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 54 */ PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 55 */ PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 56 */ PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 57 */ PORT_CODE(KEYCODE_PGDN) PORT_NAME("CURSOR BLINK ALT CURSOR") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 58 */ PORT_CODE(KEYCODE_F3) PORT_NAME("PF3 PF15") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 59 */ PORT_NAME("0x59") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5a */ PORT_NAME("0x5a") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5b */ PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5c */ PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5d */ PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5e */ PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 5f */ PORT_CODE(KEYCODE_BACKSLASH2) PORT_NAME("PRINT IDENT") // but in setup Pound/Cent? + + PORT_START("row_6") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 60 */ PORT_CODE(KEYCODE_F4) PORT_NAME("PF4 PF16") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 61 */ PORT_NAME("0x61") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 62 */ PORT_NAME("0x62") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 63 */ PORT_NAME("0x63") + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 64 */ PORT_NAME("0x64") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 65 */ PORT_NAME("0x65") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 66 */ PORT_NAME("0x66") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 67 */ PORT_NAME("0x67") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 68 */ PORT_NAME("0x68") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 69 */ PORT_NAME("0x69") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 6a */ PORT_NAME("0x6a") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 6b */ PORT_NAME("0x6b") + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 6c */ PORT_NAME("0x6c") + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 6d */ PORT_NAME("0x6d") + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 6e */ PORT_NAME("0x6e") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 6f */ PORT_NAME("0x6f") + + PORT_START("row_7") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 70 */ PORT_NAME("0x70") + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 71 */ PORT_NAME("0x71") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 72 */ PORT_NAME("0x72") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 73 */ PORT_NAME("0x73") + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 74 */ PORT_NAME("0x74") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 75 */ PORT_NAME("0x75") + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 76 */ PORT_NAME("0x76") + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 77 */ PORT_NAME("0x77") + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 78 */ PORT_NAME("0x78") + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 79 */ PORT_NAME("0x79") + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 7a */ PORT_NAME("0x7a") + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 7b */ PORT_NAME("0x7b") + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 7c */ PORT_NAME("0x7c") + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 7d */ PORT_NAME("0x7d") + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 7e */ PORT_NAME("0x7e") + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 7f */ PORT_NAME("0x7f") + + PORT_START("row_8") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_CUSTOM) /* 80 */ + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 81 */ PORT_CODE(KEYCODE_LALT) PORT_NAME("ALT") + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 82 */ PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("SHIFT (LEFT?)") + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM) /* 83 */ + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 84 */ PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("LOCK") + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_CUSTOM) /* 85 */ + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM) /* 86 */ + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_CUSTOM) /* 87 */ + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) /* 88 */ PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("SHIFT (RIGHT?)") +INPUT_PORTS_END + +ioport_constructor informer_213_kbd_hle_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// informer_213_kbd_hle_device - constructor +//------------------------------------------------- + +informer_213_kbd_hle_device::informer_213_kbd_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, INFORMER_213_KBD_HLE, tag, owner, clock), + device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8"), + m_int_handler(*this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void informer_213_kbd_hle_device::device_start() +{ + // resolve callbacks + m_int_handler.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void informer_213_kbd_hle_device::device_reset() +{ + m_key = 0xff; + m_mod = 0; + + reset_key_state(); + start_processing(attotime::from_hz(2400)); + typematic_stop(); +} + +//------------------------------------------------- +// key_make - handle a key being pressed +//------------------------------------------------- + +void informer_213_kbd_hle_device::key_make(uint8_t row, uint8_t column) +{ + uint8_t code = row * 16 + column; + + // no typematic for modifier keys + if (code < 0x80) + typematic_start(row, column, attotime::from_msec(750), attotime::from_msec(50)); + + // modifier key (but not caps lock) + if (code > 0x80 && code != 0x84) + { + m_mod |= code; + code = m_mod; + } + + // send the code + m_key = code; + m_int_handler(1); + m_int_handler(0); +} + +//------------------------------------------------- +// key_break - handle a key being released +//------------------------------------------------- + +void informer_213_kbd_hle_device::key_break(uint8_t row, uint8_t column) +{ + uint8_t code = row * 16 + column; + + if (typematic_is(row, column)) + typematic_stop(); + + // send the break code (only for modifier keys: SHIFT and ALT) + if (code > 0x80 && code != 0x84) + { + m_mod = 0x80; + m_key = m_mod; + m_int_handler(1); + m_int_handler(0); + } +} + +//------------------------------------------------- +// key_repeat - handle a key being repeated +//------------------------------------------------- + +void informer_213_kbd_hle_device::key_repeat(u8 row, u8 column) +{ + uint8_t code = row * 16 + column; + m_key = code; + m_int_handler(1); + m_int_handler(0); +} + +//------------------------------------------------- +// read - read data from keyboard +//------------------------------------------------- + +uint8_t informer_213_kbd_hle_device::read() +{ + uint8_t tmp = m_key; + m_key = 0xff; + + return tmp; +} + +//------------------------------------------------- +// write - write data to keyboard +//------------------------------------------------- + +void informer_213_kbd_hle_device::write(uint8_t data) +{ + logerror("Keyboard received: %02x\n", data); +} diff --git a/src/mame/machine/informer_213_kbd.h b/src/mame/machine/informer_213_kbd.h new file mode 100644 index 00000000000..915e3a96c6c --- /dev/null +++ b/src/mame/machine/informer_213_kbd.h @@ -0,0 +1,58 @@ +// license: BSD-3-Clause +// copyright-holders: Dirk Best +/*************************************************************************** + + Informer 213 Keyboard (HLE) + +***************************************************************************/ + +#ifndef MAME_MACHINE_INFORMER_213_KBD_H +#define MAME_MACHINE_INFORMER_213_KBD_H + +#pragma once + +#include "machine/keyboard.h" +#include "diserial.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> informer_213_kbd_hle_device + +class informer_213_kbd_hle_device : public device_t, + protected device_matrix_keyboard_interface<9> +{ +public: + // construction/destruction + informer_213_kbd_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + // callbacks + auto int_handler() { return m_int_handler.bind(); } + + // from host + uint8_t read(); + void write(uint8_t data); + +protected: + // device_t overrides + virtual ioport_constructor device_input_ports() const override; + virtual void device_start() override; + virtual void device_reset() override; + + // device_matrix_keyboard_interface overrides + virtual void key_make(uint8_t row, uint8_t column) override; + virtual void key_break(uint8_t row, uint8_t column) override; + virtual void key_repeat(uint8_t row, uint8_t column) override; + +private: + devcb_write_line m_int_handler; + uint8_t m_key; + uint8_t m_mod; +}; + +// device type definition +DECLARE_DEVICE_TYPE(INFORMER_213_KBD_HLE, informer_213_kbd_hle_device) + +#endif // MAME_MACHINE_INFORMER_213_KBD_H diff --git a/src/mame/machine/kaypro.cpp b/src/mame/machine/kaypro.cpp index f3700fa0c9c..dd6327e2341 100644 --- a/src/mame/machine/kaypro.cpp +++ b/src/mame/machine/kaypro.cpp @@ -78,7 +78,8 @@ void kaypro_state::kayproiv_pio_system_w(u8 data) kayproii_pio_system_w(data); /* side select */ - m_floppy->ss_w(BIT(data, 2)); + if (m_floppy) + m_floppy->ss_w(BIT(data, 2)); } /*********************************************************** @@ -176,37 +177,31 @@ void kaypro_state::kaypro484_system_port_w(u8 data) *************************************************************************************/ -void kaypro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(kaypro_state::floppy_timer) { bool halt; - switch (id) + halt = (bool)m_maincpu->state_int(Z80_HALT); + if (m_is_motor_off) + { + m_floppy_timer->adjust(attotime::from_hz(10)); + return; + } + + if ((halt) && (m_fdc_rq & 3) && (m_fdc_rq < 0x80)) { - case TIMER_FLOPPY: - halt = (bool)m_maincpu->state_int(Z80_HALT); - if (m_is_motor_off) - { - timer_set(attotime::from_hz(10), TIMER_FLOPPY); - break; - } - if ((halt) && (m_fdc_rq & 3) && (m_fdc_rq < 0x80)) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - m_fdc_rq |= 0x80; - } - else - if ((m_fdc_rq == 0x80) || ((!halt) && BIT(m_fdc_rq, 7))) - { - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_fdc_rq &= 0x7f; - } - timer_set(attotime::from_hz(1e5), TIMER_FLOPPY); - - break; - default: - throw emu_fatalerror("Unknown id in kaypro_state::device_timer"); + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_fdc_rq |= 0x80; } + else + if ((m_fdc_rq == 0x80) || ((!halt) && BIT(m_fdc_rq, 7))) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_fdc_rq &= 0x7f; + } + m_floppy_timer->adjust(attotime::from_hz(1e5)); } + WRITE_LINE_MEMBER( kaypro_state::fdc_intrq_w ) { m_fdc_rq = (m_fdc_rq & 0x82) | state; @@ -249,7 +244,7 @@ void kaypro_state::machine_reset() m_system_port = 0x80; m_fdc_rq = 0; m_maincpu->reset(); - timer_set(attotime::from_hz(1), TIMER_FLOPPY); /* kick-start the nmi timer */ + m_floppy_timer->adjust(attotime::from_hz(1)); /* kick-start the nmi timer */ } diff --git a/src/mame/machine/lynx.cpp b/src/mame/machine/lynx.cpp index 0ea49c13a12..7da6ae8f077 100644 --- a/src/mame/machine/lynx.cpp +++ b/src/mame/machine/lynx.cpp @@ -1310,7 +1310,7 @@ void lynx_state::lynx_draw_line() if (m_mikey.data[0x92] & 0x02) { j -= 160 * 102 / 2 - 1; - uint32_t *const line = &m_bitmap_temp.pix32(102 - 1 - y); + uint32_t *const line = &m_bitmap_temp.pix(102 - 1 - y); for (int x = 160 - 2; x >= 0; j++, x -= 2) { uint8_t const byte = lynx_read_ram(j); @@ -1320,7 +1320,7 @@ void lynx_state::lynx_draw_line() } else { - uint32_t *const line = &m_bitmap_temp.pix32(y); + uint32_t *const line = &m_bitmap_temp.pix(y); for (int x = 0; x < 160; j++, x += 2) { uint8_t const byte = lynx_read_ram(j); diff --git a/src/mame/machine/m6502_swap_op_d5_d6.cpp b/src/mame/machine/m6502_swap_op_d5_d6.cpp index d3c661f8c2b..df832634684 100644 --- a/src/mame/machine/m6502_swap_op_d5_d6.cpp +++ b/src/mame/machine/m6502_swap_op_d5_d6.cpp @@ -4,10 +4,13 @@ m6502_swap_op_d5_d6.cpp - 6502 with instruction scrambling + 6502 / N2A03 with instruction scrambling Seen on die marked VH2009, used on polmega, silv35 - but also elsewhere + these are N2A03 derived CPUs used on VTxx systems + + VT1682 systems with this scrambling currently derive from M6502 type + but this might be incorrect ***************************************************************************/ @@ -15,6 +18,7 @@ #include "m6502_swap_op_d5_d6.h" DEFINE_DEVICE_TYPE(M6502_SWAP_OP_D5_D6, m6502_swap_op_d5_d6, "m6502_swap_op_d5_d6", "M6502 swapped D5/D6") +DEFINE_DEVICE_TYPE(N2A03_CORE_SWAP_OP_D5_D6, n2a03_core_swap_op_d5_d6, "n2a03_core_swap_op_d5_d6", "N2A03 core with swapped D5/D6") m6502_swap_op_d5_d6::m6502_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6502_device(mconfig, M6502_SWAP_OP_D5_D6, tag, owner, clock) @@ -64,3 +68,57 @@ u8 m6502_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) { return opcode ? mintf->descramble(value) : value; } + + + + + +n2a03_core_swap_op_d5_d6::n2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + n2a03_core_device(mconfig, N2A03_CORE_SWAP_OP_D5_D6, tag, owner, clock) +{ +} + +void n2a03_core_swap_op_d5_d6::device_start() +{ + mintf = std::make_unique<mi_decrypt>(); + init(); +} + +void n2a03_core_swap_op_d5_d6::device_reset() +{ + n2a03_core_device::device_reset(); +} + +uint8_t n2a03_core_swap_op_d5_d6::mi_decrypt::descramble(uint8_t op) +{ + return bitswap<8>(op, 7, 5, 6, 4, 3, 2, 1, 0); +} + +uint8_t n2a03_core_swap_op_d5_d6::mi_decrypt::read_sync(uint16_t adr) +{ + uint8_t res = cprogram.read_byte(adr); + + res = descramble(res); + + return res; +} + +std::unique_ptr<util::disasm_interface> n2a03_core_swap_op_d5_d6::create_disassembler() +{ + return std::make_unique<disassembler>(downcast<mi_decrypt *>(mintf.get())); +} + +n2a03_core_swap_op_d5_d6::disassembler::disassembler(mi_decrypt *mi) : mintf(mi) +{ +} + +u32 n2a03_core_swap_op_d5_d6::disassembler::interface_flags() const +{ + return SPLIT_DECRYPTION; +} + +u8 n2a03_core_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const +{ + return opcode ? mintf->descramble(value) : value; +} + diff --git a/src/mame/machine/m6502_swap_op_d5_d6.h b/src/mame/machine/m6502_swap_op_d5_d6.h index efcd4a69c17..aec61cf077f 100644 --- a/src/mame/machine/m6502_swap_op_d5_d6.h +++ b/src/mame/machine/m6502_swap_op_d5_d6.h @@ -4,7 +4,7 @@ m6502_swap_op_d5_d6.h - 6502 with instruction scrambling + 6502 / N2A03 with instruction scrambling ***************************************************************************/ @@ -13,8 +13,8 @@ #pragma once -#include "cpu/m6502/m6502.h" -#include "cpu/m6502/m6502d.h" +#include "cpu/m6502/n2a03.h" +#include "cpu/m6502/n2a03d.h" class m6502_swap_op_d5_d6 : public m6502_device { public: @@ -24,9 +24,6 @@ protected: class mi_decrypt : public mi_default { public: - bool m_scramble_en = false; - bool m_next_scramble = false; - virtual ~mi_decrypt() {} virtual uint8_t read_sync(uint16_t adr) override; @@ -48,6 +45,37 @@ protected: virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; }; +class n2a03_core_swap_op_d5_d6 : public n2a03_core_device { +public: + n2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + class mi_decrypt : public mi_default { + public: + + virtual ~mi_decrypt() {} + virtual uint8_t read_sync(uint16_t adr) override; + + uint8_t descramble(uint8_t op); + }; + + class disassembler : public n2a03_disassembler { + public: + mi_decrypt *mintf; + + disassembler(mi_decrypt *m); + virtual ~disassembler() = default; + virtual u32 interface_flags() const override; + virtual u8 decrypt8(u8 value, offs_t pc, bool opcode) const override; + }; + + virtual void device_reset() override; + virtual void device_start() override; + virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; +}; + + DECLARE_DEVICE_TYPE(M6502_SWAP_OP_D5_D6, m6502_swap_op_d5_d6) +DECLARE_DEVICE_TYPE(N2A03_CORE_SWAP_OP_D5_D6, n2a03_core_swap_op_d5_d6) #endif // MAME_M6502_SWAP_OP_D5_D6_H diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp index e5b8727e1e0..30eaec3893c 100644 --- a/src/mame/machine/mac.cpp +++ b/src/mame/machine/mac.cpp @@ -635,20 +635,6 @@ WRITE_LINE_MEMBER(mac_state::mac_scsi_irq) }*/ } -WRITE_LINE_MEMBER(mac_state::irq_539x_1_w) -{ - if (state) // make sure a CB1 transition occurs - { - m_via2->write_cb2(0); - m_via2->write_cb2(1); - } -} - -WRITE_LINE_MEMBER(mac_state::drq_539x_1_w) -{ - m_dafb_scsi1_drq = state; -} - /* ************************************************************************* * SCC * @@ -1494,12 +1480,6 @@ void mac_state::nubus_slot_interrupt(uint8_t slot, uint32_t state) static const uint8_t masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 }; uint8_t mask = 0x3f; - // quadra 700/900/950 use the top 2 bits of the interrupt register for ethernet and video - if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950)) - { - mask = 0xff; - } - slot -= 9; if (state) diff --git a/src/mame/machine/macadb.cpp b/src/mame/machine/macadb.cpp index 4d0ffb2ae27..6fdf0bbdb2e 100644 --- a/src/mame/machine/macadb.cpp +++ b/src/mame/machine/macadb.cpp @@ -195,7 +195,7 @@ static INPUT_PORTS_START( macadb ) INPUT_PORTS_END macadb_device::macadb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, MACADB, tag, owner, clock), + : device_t(mconfig, MACADB, tag, owner, clock), m_mouse0(*this, "MOUSE0"), m_mouse1(*this, "MOUSE1"), m_mouse2(*this, "MOUSE2"), @@ -212,7 +212,7 @@ macadb_device::macadb_device(const machine_config &mconfig, const char *tag, dev ioport_constructor macadb_device::device_input_ports() const { - return INPUT_PORTS_NAME(macadb); + return INPUT_PORTS_NAME(macadb); } void macadb_device::device_start() @@ -796,12 +796,12 @@ TIMER_CALLBACK_MEMBER(macadb_device::mac_adb_tick) set_adb_line(CLEAR_LINE); if (m_adb_buffer[m_adb_stream_ptr] & 0x80) { - //printf("1 "); + //printf("1 "); m_adb_timer->adjust(attotime::from_ticks(adb_short, adb_timebase)); } else { - //printf("0 "); + //printf("0 "); m_adb_timer->adjust(attotime::from_ticks(adb_long, adb_timebase)); } m_adb_linestate++; @@ -1499,14 +1499,14 @@ WRITE_LINE_MEMBER(macadb_device::adb_linechange_w) int dtime = (int)(machine().time().as_ticks(adb_timebase) - m_last_adb_time); m_last_adb_time = machine().time().as_ticks(adb_timebase); - /*if (m_adb_linestate <= 12) - { - printf("linechange: %d -> %d, time %d (state %d = %s)\n", state^1, state, dtime, m_adb_linestate, states[m_adb_linestate]); - } - else - { - printf("linechange: %d -> %d, time %d (state %d)\n", state^1, state, dtime, m_adb_linestate); - }*/ + /*if (m_adb_linestate <= 12) + { + printf("linechange: %d -> %d, time %d (state %d = %s)\n", state^1, state, dtime, m_adb_linestate, states[m_adb_linestate]); + } + else + { + printf("linechange: %d -> %d, time %d (state %d)\n", state^1, state, dtime, m_adb_linestate); + }*/ if ((m_adb_direction) && (m_adb_linestate == LST_TSTOP)) { diff --git a/src/mame/machine/macadb.h b/src/mame/machine/macadb.h index 6b2fff18880..e98a9852a84 100644 --- a/src/mame/machine/macadb.h +++ b/src/mame/machine/macadb.h @@ -47,7 +47,7 @@ public: protected: // device-level overrides - virtual ioport_constructor device_input_ports() const override; + virtual ioport_constructor device_input_ports() const override; virtual void device_start() override; virtual void device_reset() override; diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp index 73f86a8f740..4cb48449136 100644 --- a/src/mame/machine/mbee.cpp +++ b/src/mame/machine/mbee.cpp @@ -16,19 +16,6 @@ #include "machine/z80bin.h" -void mbee_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_MBEE_NEWKB: - timer_newkb(ptr, param); - break; - default: - throw emu_fatalerror("Unknown id in mbee_state::device_timer"); - } -} - - /*********************************************************** PIO @@ -144,7 +131,7 @@ void mbee_state::fdc_motor_w(uint8_t data) ************************************************************/ -TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb ) +TIMER_DEVICE_CALLBACK_MEMBER( mbee_state::newkb_timer ) { /* Keyboard scanner is a Mostek M3870 chip. Its speed of operation is determined by a 15k resistor on pin 2 (XTL2) and is therefore 2MHz. If a key change is detected (up or down), the /strobe @@ -157,6 +144,9 @@ TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb ) It includes up to 4 KB of mask-programmable ROM, 64 bytes of scratchpad RAM and up to 64 bytes of executable RAM. The MCU also integrates 32-bit I/O and a programmable timer. */ + if (!BIT(m_features, 2)) + return; + uint8_t i, j, pressed; // find what has changed @@ -186,8 +176,6 @@ TIMER_CALLBACK_MEMBER( mbee_state::timer_newkb ) if (m_b2) m_pio->port_b_write(pio_port_b_r()); - - timer_set(attotime::from_hz(50), TIMER_MBEE_NEWKB); } uint8_t mbee_state::port18_r() @@ -489,10 +477,6 @@ void mbee_state::machine_start() else m_size = 0x8000; - // new keyboard - if (BIT(m_features, 2)) - timer_set(attotime::from_hz(1), TIMER_MBEE_NEWKB); /* kick-start timer for kbd */ - // premium if (BIT(m_features, 3)) { diff --git a/src/mame/machine/mega32x.cpp b/src/mame/machine/mega32x.cpp index b8607d8506a..40af33a6965 100644 --- a/src/mame/machine/mega32x.cpp +++ b/src/mame/machine/mega32x.cpp @@ -935,13 +935,10 @@ void sega_32x_device::m68k_pwm_w(offs_t offset, uint16_t data) pwm_w(offset,data); } -void sega_32x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void sega_32x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int s = 0; s < samples; s++) - { - outputs[0][s] = inputs[0][s]; - outputs[1][s] = inputs[1][s]; - } + outputs[0] = inputs[0]; + outputs[1] = inputs[1]; } /**********************************************************************************************/ @@ -1742,7 +1739,7 @@ void sega_32x_device::device_start() set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b)); } - m_stream = stream_alloc_legacy(2, 2, 48000 * 4); + m_stream = stream_alloc(2, 2, 48000 * 4); m_32x_pwm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega_32x_device::handle_pwm_callback), this)); m_32x_dram0 = std::make_unique<uint16_t[]>(0x40000/2); diff --git a/src/mame/machine/mega32x.h b/src/mame/machine/mega32x.h index e56db24fdb3..51cdf07ad47 100644 --- a/src/mame/machine/mega32x.h +++ b/src/mame/machine/mega32x.h @@ -110,7 +110,7 @@ protected: virtual uint32_t palette_entries() const override { return 32*32*32/**2*/; } // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF diff --git a/src/mame/machine/megacd.cpp b/src/mame/machine/megacd.cpp index d0b53d9b595..0fefc92c4b6 100644 --- a/src/mame/machine/megacd.cpp +++ b/src/mame/machine/megacd.cpp @@ -1473,7 +1473,7 @@ inline uint8_t sega_segacd_device::read_pixel_from_stampmap(bitmap_ind16* srcbit if (x >= srcbitmap->width) return 0; if (y >= srcbitmap->height) return 0; - uint16_t* cacheptr = &srcbitmap->pix16(y, x); + uint16_t* cacheptr = &srcbitmap->pix(y, x); return cacheptr[0] & 0xf; */ diff --git a/src/mame/machine/megadriv.cpp b/src/mame/machine/megadriv.cpp index b9fb9ec504d..2a277d83789 100644 --- a/src/mame/machine/megadriv.cpp +++ b/src/mame/machine/megadriv.cpp @@ -764,11 +764,11 @@ uint32_t md_base_state::screen_update_megadriv(screen_device &screen, bitmap_rgb /* Copy our screen buffer here */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t* desty = &bitmap.pix32(y, 0); - uint32_t* srcy; + uint32_t *const desty = &bitmap.pix(y, 0); + uint32_t const *srcy; if (!m_vdp->m_use_alt_timing) - srcy = &m_vdp->m_render_bitmap->pix32(y, 0); + srcy = &m_vdp->m_render_bitmap->pix(y, 0); else srcy = m_vdp->m_render_line.get(); diff --git a/src/mame/machine/model1io2.cpp b/src/mame/machine/model1io2.cpp index f47a5b3bda2..9ff771dbcc2 100644 --- a/src/mame/machine/model1io2.cpp +++ b/src/mame/machine/model1io2.cpp @@ -282,7 +282,7 @@ HD44780_PIXEL_UPDATE( model1io2_device::lcd_pixel_update ) return; if (line < 2 && pos < 20) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/machine/namcos21_dsp_c67.cpp b/src/mame/machine/namcos21_dsp_c67.cpp index 424193383e9..91595973c02 100644 --- a/src/mame/machine/namcos21_dsp_c67.cpp +++ b/src/mame/machine/namcos21_dsp_c67.cpp @@ -39,7 +39,7 @@ void namcos21_dsp_c67_device::device_start() m_yield_hack_cb.resolve_safe(); m_pointram = std::make_unique<uint8_t[]>(PTRAM_SIZE); - m_mpDspState = make_unique_clear<dsp_state>(); + m_mpDspState = std::make_unique<dsp_state>(); save_item(NAME(m_dspram16)); } diff --git a/src/mame/machine/namcos21_dsp_c67.h b/src/mame/machine/namcos21_dsp_c67.h index 433c0a557e3..7fbb7988af2 100644 --- a/src/mame/machine/namcos21_dsp_c67.h +++ b/src/mame/machine/namcos21_dsp_c67.h @@ -8,13 +8,16 @@ #include "machine/namco_c67.h" #include "video/namcos21_3d.h" -#define PTRAM_SIZE 0x20000 +#include <algorithm> + #define ENABLE_LOGGING 0 class namcos21_dsp_c67_device : public device_t { public: + static constexpr unsigned PTRAM_SIZE = 0x20000; + enum { /* Namco System21 */ NAMCOS21_AIRCOMBAT = 0x4000, @@ -51,20 +54,27 @@ protected: virtual void device_add_mconfig(machine_config &config) override; private: - #define DSP_BUF_MAX (4096*12) + static constexpr unsigned DSP_BUF_MAX = 4096*12; struct dsp_state { - unsigned masterSourceAddr; + dsp_state() + { + std::fill(std::begin(slaveInputBuffer), std::end(slaveInputBuffer), 0); + std::fill(std::begin(slaveOutputBuffer), std::end(slaveOutputBuffer), 0); + std::fill(std::begin(masterDirectDrawBuffer), std::end(masterDirectDrawBuffer), 0); + } + + unsigned masterSourceAddr = 0; uint16_t slaveInputBuffer[DSP_BUF_MAX]; - unsigned slaveBytesAvailable; - unsigned slaveBytesAdvertised; - unsigned slaveInputStart; + unsigned slaveBytesAvailable = 0; + unsigned slaveBytesAdvertised = 0; + unsigned slaveInputStart = 0; uint16_t slaveOutputBuffer[DSP_BUF_MAX]; - unsigned slaveOutputSize; + unsigned slaveOutputSize = 0; uint16_t masterDirectDrawBuffer[256]; - unsigned masterDirectDrawSize; - int masterFinished; - int slaveActive; + unsigned masterDirectDrawSize = 0; + int masterFinished = 0; + int slaveActive = 0; }; required_device<namcos21_3d_device> m_renderer; diff --git a/src/mame/machine/nes_vt_soc.cpp b/src/mame/machine/nes_vt_soc.cpp index 1f0dd216a23..f3ee35252ff 100644 --- a/src/mame/machine/nes_vt_soc.cpp +++ b/src/mame/machine/nes_vt_soc.cpp @@ -121,6 +121,7 @@ nes_vt_soc_device::nes_vt_soc_device(const machine_config& mconfig, device_type m_default_palette_mode = PAL_MODE_VT0x; m_force_baddma = false; + m_use_raster_timing_hack = false; } nes_vt_soc_device::nes_vt_soc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) : @@ -299,8 +300,6 @@ uint32_t nes_vt_soc_device::get_banks(uint8_t bnk) // 8000 needs to bank in 60000 ( bank 0x30 ) void nes_vt_soc_device::update_banks() { - //uint32_t amod = m_ahigh >> 13; - uint8_t bank; // 8000-9fff @@ -314,11 +313,11 @@ void nes_vt_soc_device::update_banks() else bank = 0xfe; - m_bankaddr[0] = ((/*amod |*/ get_banks(bank)) ); + m_bankaddr[0] = get_banks(bank); // a000-bfff bank = m_410x[0x8]; - m_bankaddr[1] = ((/*amod |*/ get_banks(bank)) ); + m_bankaddr[1] = get_banks(bank); // c000-dfff if ((m_410x[0xb] & 0x40) != 0 || (m_410x[0x5] & 0x40) != 0) @@ -331,11 +330,11 @@ void nes_vt_soc_device::update_banks() else bank = 0xfe; - m_bankaddr[2] = ((/*amod |*/ get_banks(bank)) ); + m_bankaddr[2] = get_banks(bank); // e000 - ffff bank = m_initial_e000_bank; - m_bankaddr[3] = ((/*amod |*/ get_banks(bank)) ); + m_bankaddr[3] = get_banks(bank); } uint16_t nes_vt_soc_device::decode_nt_addr(uint16_t addr) @@ -380,6 +379,12 @@ void nes_vt_soc_device::scrambled_410x_w(uint16_t offset, uint8_t data) // load latched value and start counting m_410x[0x2] = data; // value doesn't matter? m_timer_val = m_410x[0x1]; + + // HACK for some one line errors in various games and completely broken rasters in msifrog, TOOD: find real source of issue (bad timing of interrupt or counter changes, or latching of data?) + if (m_use_raster_timing_hack) + if (m_ppu->in_vblanking()) + m_timer_val--; + m_timer_running = 1; break; @@ -468,7 +473,7 @@ uint8_t nes_vt_soc_device::spr_r(offs_t offset) uint8_t nes_vt_soc_device::chr_r(offs_t offset) { - if (m_4242 & 0x1 || m_411d & 0x04) + if (m_4242 & 0x1 || m_411d & 0x04) // newer VT platforms only (not VT03/09), split out { return m_chrram[offset]; } @@ -484,11 +489,18 @@ uint8_t nes_vt_soc_device::chr_r(offs_t offset) void nes_vt_soc_device::chr_w(offs_t offset, uint8_t data) { - if (m_4242 & 0x1 || m_411d & 0x04) + if (m_4242 & 0x1 || m_411d & 0x04) // newer VT platforms only (not VT03/09), split out { logerror("vram write %04x %02x\n", offset, data); m_chrram[offset] = data; } + else + { + int realaddr = calculate_real_video_address(offset, 1, 0); + + address_space& spc = this->space(AS_PROGRAM); + return spc.write_byte(realaddr, data); + } } @@ -755,7 +767,7 @@ int nes_vt_soc_device::calculate_real_video_address(int addr, int extended, int } } - return /*m_ahigh |*/ finaladdr; + return finaladdr; } /* @@ -763,17 +775,14 @@ int nes_vt_soc_device::calculate_real_video_address(int addr, int extended, int used for MMC3/other mapper compatibility some consoles have scrambled registers for crude copy protection - - is this always there with VT based games? it maps where mappers would be on a NES cartridge - but then seems to be able to alter internal state of extended PPU registers, which is awkward */ void nes_vt_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) { offset &= 0x7fff; - uint16_t addr = m_real_access_address; // we need the actual write address, not the translated one, to keep bittboy happy - if ((m_411d & 0x01) && (m_411d & 0x03)) + uint16_t addr = offset+0x8000; + if ((m_411d & 0x01) && (m_411d & 0x03)) // this condition is nonsense, maybe should be ((m_411d & 0x03) == 0x03) check it! (newer VT only, not VT03/09, split) { //CNROM compat logerror("%s: vtxx_cnrom_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); @@ -785,13 +794,13 @@ void nes_vt_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) m_ppu->set_201x_reg(0x5, data * 8 + 7); } - else if (m_411d & 0x01) + else if (m_411d & 0x01) // (newer VT only, not VT03/09, split) { //MMC1 compat, TODO logerror("%s: vtxx_mmc1_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); } - else if (m_411d & 0x02) + else if (m_411d & 0x02) // (newer VT only, not VT03/09, split) { //UNROM compat logerror("%s: vtxx_unrom_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); @@ -800,7 +809,7 @@ void nes_vt_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) m_410x[0x8] = ((data & 0x0F) << 1) + 1; update_banks(); } - else + else // standard mode (VT03/09) { //logerror("%s: vtxx_mmc3_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset+0x8000, data ); @@ -985,13 +994,6 @@ void nes_vt_soc_device::do_dma(uint8_t data, bool has_ntsc_bug) length -= 1; src_addr += 1; } - //TODO (always false) - //else if ((dma_mode == 1) && ((m_ppu->get_vram_dest() & 0xFF00) == 0x3F01) && !(m_ppu->get_201x_reg(0x1) & 0x80)) - //{ - // // Legacy mode for DGUN-2573 compat - // m_ppu->set_vram_dest(0x3F00); - // m_ppu->set_palette_mode(PAL_MODE_VT0x); - //} for (int i = 0; i < length; i++) { @@ -1116,17 +1118,22 @@ uint8_t nes_vt_soc_device::external_space_read(offs_t offset) address_space& spc = this->space(AS_PROGRAM); int bank = (offset & 0x6000) >> 13; int address = (m_bankaddr[bank] * 0x2000) + (offset & 0x1fff); - m_real_access_address = offset + 0x8000; return spc.read_byte(address); } void nes_vt_soc_device::external_space_write(offs_t offset, uint8_t data) { - address_space& spc = this->space(AS_PROGRAM); - int bank = (offset & 0x6000) >> 13; - int address = (m_bankaddr[bank] * 0x2000) + (offset&0x1fff); - m_real_access_address = offset + 0x8000; - spc.write_byte(address, data); + if ((m_410x[0xb] & 0x08)) + { + address_space& spc = this->space(AS_PROGRAM); + int bank = (offset & 0x6000) >> 13; + int address = (m_bankaddr[bank] * 0x2000) + (offset & 0x1fff); + spc.write_byte(address, data); + } + else + { + vt03_8000_mapper_w(offset, data); + } }; void nes_vt_soc_device::nes_vt_map(address_map &map) @@ -1214,7 +1221,7 @@ void nes_vt_soc_device::do_pal_timings_and_ppu_replacement(machine_config& confi void nes_vt_soc_device::device_add_mconfig(machine_config &config) { - M6502(config, m_maincpu, NTSC_APU_CLOCK); + N2A03_CORE(config, m_maincpu, NTSC_APU_CLOCK); // Butterfly Catch in vgpocket confirms N2A03 core type, not 6502 m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_device::nes_vt_map); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); @@ -1235,11 +1242,7 @@ void nes_vt_soc_device::device_add_mconfig(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - /* this should actually be a custom *almost* doubled up APU, however requires more thought - than just using 2 APUs as registers in the 2nd one affect the PCM channel mode but the - DMA control still comes from the 1st, but in the new mode, sound always outputs via the - 2nd. Probably need to split the APU into interface and sound gen logic. */ - NES_APU(config, m_apu, NTSC_APU_CLOCK); + NES_APU_VT(config, m_apu, NTSC_APU_CLOCK); m_apu->irq().set(FUNC(nes_vt_soc_device::apu_irq)); m_apu->mem_read().set(FUNC(nes_vt_soc_device::apu_read_mem)); m_apu->add_route(ALL_OUTPUTS, "mono", 0.50); @@ -1260,7 +1263,7 @@ void nes_vt_soc_scramble_device::device_add_mconfig(machine_config& config) { nes_vt_soc_device::device_add_mconfig(config); - M6502_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); + N2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); // Insect Chase in polmega confirms N2A03 core type, not 6502 m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_scramble_device::nes_vt_map); } @@ -1461,7 +1464,7 @@ void nes_vt_soc_4kram_fp_device::device_add_mconfig(machine_config& config) { nes_vt_soc_device::device_add_mconfig(config); - M6502_VTSCR(config.replace(), m_maincpu, NTSC_APU_CLOCK); + M6502_VTSCR(config.replace(), m_maincpu, NTSC_APU_CLOCK); // are these later chips N2A03 core, or 6502 core derived? m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_4kram_fp_device::nes_vt_fp_map); } diff --git a/src/mame/machine/nes_vt_soc.h b/src/mame/machine/nes_vt_soc.h index ebf3dd91142..18efbcb993f 100644 --- a/src/mame/machine/nes_vt_soc.h +++ b/src/mame/machine/nes_vt_soc.h @@ -7,6 +7,7 @@ #pragma once #include "cpu/m6502/n2a03.h" +#include "sound/nes_apu_vt.h" #include "machine/m6502_vtscr.h" #include "machine/m6502_swap_op_d5_d6.h" #include "video/ppu2c0x_vt.h" @@ -50,7 +51,8 @@ public: void set_8000_scramble(uint8_t reg0, uint8_t reg1, uint8_t reg2, uint8_t reg3, uint8_t reg4, uint8_t reg5, uint8_t reg6, uint8_t reg7); void set_410x_scramble(uint8_t reg0, uint8_t reg1); - void force_bad_dma() { m_force_baddma = true; }; + void force_bad_dma() { m_force_baddma = true; } + void force_raster_timing_hack() { m_use_raster_timing_hack = true; } void set_default_palette_mode(vtxx_pal_mode pmode) { m_default_palette_mode = pmode; } @@ -66,7 +68,7 @@ protected: required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; required_device<ppu_vt03_device> m_ppu; - required_device<nesapu_device> m_apu; + required_device<nes_apu_vt_device> m_apu; void nes_vt_map(address_map& map); @@ -91,7 +93,6 @@ protected: void psg1_4015_w(uint8_t data); void psg1_4017_w(uint8_t data); void vt_dma_w(uint8_t data); - void vt_fixed_dma_w(uint8_t data); void do_dma(uint8_t data, bool has_ntsc_bug); void vt03_4034_w(uint8_t data); @@ -142,7 +143,6 @@ private: address_space_config m_space_config; int m_bankaddr[4]; - uint16_t m_real_access_address; devcb_write8 m_write_0_callback; devcb_read8 m_read_0_callback; @@ -161,6 +161,7 @@ private: uint8_t m_2012_2017_descramble[0x6]; // passed to PPU in reset vtxx_pal_mode m_default_palette_mode; bool m_force_baddma; + bool m_use_raster_timing_hack; }; class nes_vt_soc_pal_device : public nes_vt_soc_device diff --git a/src/mame/machine/news_hid.cpp b/src/mame/machine/news_hid.cpp index f158fd54e15..0527299dde3 100644 --- a/src/mame/machine/news_hid.cpp +++ b/src/mame/machine/news_hid.cpp @@ -200,8 +200,8 @@ u8 news_hid_hle_device::status_68k_r() (!m_fifo[MOUSE].empty() ? 0x40 : 0) | (m_fifo[KEYBOARD].full() ? 0x20 : 0) | (m_fifo[MOUSE].full() ? 0x10 : 0) | - (m_irq_out_state[KEYBOARD] ? 0x08 : 0) | - (m_irq_out_state[MOUSE] ? 0x08 : 0) | + (m_irq_out_state[KEYBOARD] ? 0 : 0x08) | + (m_irq_out_state[MOUSE] ? 0 : 0x04) | (m_irq_enabled[KEYBOARD] ? 0x02 : 0) | (m_irq_enabled[MOUSE] ? 0x01 : 0); diff --git a/src/mame/machine/nl_tank.cpp b/src/mame/machine/nl_tank.cpp index 152d7fe01d3..3885aa7a0fd 100644 --- a/src/mame/machine/nl_tank.cpp +++ b/src/mame/machine/nl_tank.cpp @@ -230,14 +230,15 @@ NETLIST_START(tank) QBJT_EB(Q4, "2N3643") QBJT_EB(Q6, "2N3644") QBJT_EB(Q7, "2N3644") - QBJT_EB(Q27, "2N3643") - QBJT_EB(Q28, "2N3644") - QBJT_EB(Q29, "2N3643") - QBJT_EB(Q30, "2N3644") - QBJT_EB(Q31, "2N3643") - QBJT_EB(Q32, "2N3644") - QBJT_EB(Q33, "2N3643") - QBJT_EB(Q34, "2N3644") +// Currently not used +// QBJT_EB(Q27, "2N3643") +// QBJT_EB(Q28, "2N3644") +// QBJT_EB(Q29, "2N3643") +// QBJT_EB(Q30, "2N3644") +// QBJT_EB(Q31, "2N3643") +// QBJT_EB(Q32, "2N3644") +// QBJT_EB(Q33, "2N3643") +// QBJT_EB(Q34, "2N3644") TTL_7404_DIP(IC_H3) TTL_7400_DIP(IC_B6) diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp index 932cabea96b..0b18cfe1193 100644 --- a/src/mame/machine/osborne1.cpp +++ b/src/mame/machine/osborne1.cpp @@ -382,7 +382,7 @@ inline void osborne1_state::draw_rows(uint16_t col, bitmap_ind16 &bitmap, const // Draw a line of the display u8 const ra(y % 10); - uint16_t *p(&bitmap.pix16(y)); + uint16_t *p(&bitmap.pix(y)); uint16_t const row(((m_scroll_y + (y / 10)) << 7) & 0x0F80); for (uint16_t x = 0; Width > x; ++x) @@ -539,7 +539,7 @@ MC6845_UPDATE_ROW(osborne1nv_state::crtc_update_row) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint16_t const base = (ma >> 1) & 0xF80; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (u8 x = 0; x < x_count; ++x) { uint16_t const offset = base | ((ma + x) & 0x7F); diff --git a/src/mame/machine/p2000t.cpp b/src/mame/machine/p2000t.cpp index 06adeb063f4..e155e3afd33 100644 --- a/src/mame/machine/p2000t.cpp +++ b/src/mame/machine/p2000t.cpp @@ -44,19 +44,19 @@ */ uint8_t p2000t_state::p2000t_port_000f_r(offs_t offset) { - if (m_port_101f & P2000M_101F_KEYINT) - { - return (m_keyboard[0]->read() & m_keyboard[1]->read() & m_keyboard[2]->read() - & m_keyboard[3]->read() & m_keyboard[4]->read() & m_keyboard[5]->read() - & m_keyboard[6]->read() & m_keyboard[7]->read() & m_keyboard[8]->read() - & m_keyboard[9]->read()); - } - else if (offset < 10) - { - return m_keyboard[offset]->read(); - } - else - return 0xff; + if (m_port_101f & P2000M_101F_KEYINT) + { + return (m_keyboard[0]->read() & m_keyboard[1]->read() & m_keyboard[2]->read() + & m_keyboard[3]->read() & m_keyboard[4]->read() & m_keyboard[5]->read() + & m_keyboard[6]->read() & m_keyboard[7]->read() & m_keyboard[8]->read() + & m_keyboard[9]->read()); + } + else if (offset < 10) + { + return m_keyboard[offset]->read(); + } + else + return 0xff; } /* @@ -75,13 +75,13 @@ uint8_t p2000t_state::p2000t_port_000f_r(offs_t offset) */ uint8_t p2000t_state::p2000t_port_202f_r() { - uint8_t data = 0x00; - data |= !m_mdcr->wen() << 3; - data |= !m_mdcr->cip() << 4; - data |= !m_mdcr->bet() << 5; - data |= m_mdcr->rdc() << 6; - data |= !m_mdcr->rda() << 7; - return data; + uint8_t data = 0x00; + data |= !m_mdcr->wen() << 3; + data |= !m_mdcr->cip() << 4; + data |= !m_mdcr->bet() << 5; + data |= m_mdcr->rdc() << 6; + data |= !m_mdcr->rda() << 7; + return data; } @@ -99,11 +99,11 @@ uint8_t p2000t_state::p2000t_port_202f_r() */ void p2000t_state::p2000t_port_101f_w(uint8_t data) { - m_port_101f = data; - m_mdcr->wda(BIT(data, 0)); - m_mdcr->wdc(BIT(data, 1)); - m_mdcr->rev(BIT(data, 2)); - m_mdcr->fwd(BIT(data, 3)); + m_port_101f = data; + m_mdcr->wda(BIT(data, 0)); + m_mdcr->wdc(BIT(data, 1)); + m_mdcr->rev(BIT(data, 2)); + m_mdcr->fwd(BIT(data, 3)); } /* @@ -154,4 +154,32 @@ void p2000t_state::p2000t_port_707f_w(uint8_t data) { m_port_707f = data; } void p2000t_state::p2000t_port_888b_w(uint8_t data) {} void p2000t_state::p2000t_port_8c90_w(uint8_t data) {} -void p2000t_state::p2000t_port_9494_w(uint8_t data) {} + + +void p2000t_state::p2000t_port_9494_w(uint8_t data) { + // The memory region E000-FFFF (8k) is bank switched + int available_banks = (m_ram->size() - 0xe000) / 0x2000; + if (data < available_banks) + m_bank->set_entry(data); +} + +void p2000t_state::machine_start() +{ + auto program = &m_maincpu->space(AS_PROGRAM); + auto ramsize = m_ram->size(); + switch(ramsize) { + case 0x4000: // 16kb + program->unmap_readwrite(0xa000, 0xffff); + break; + case 0x8000: // 32kb + program->unmap_readwrite(0xe000, 0xffff); + break; + default: // more.. (48kb, 64kb, 102kb) + // In this case we have a set of 8kb memory banks. + uint8_t *ram = m_ram->pointer(); + auto available_banks = (ramsize - 0xe000) / 0x2000; + for(int i = 0; i < available_banks; i++) + m_bank->configure_entry(i, ram + (i * 0x2000)); + break; + } +} diff --git a/src/mame/machine/p2000t_mdcr.cpp b/src/mame/machine/p2000t_mdcr.cpp index 75d860e5bac..568364de3cf 100644 --- a/src/mame/machine/p2000t_mdcr.cpp +++ b/src/mame/machine/p2000t_mdcr.cpp @@ -34,12 +34,12 @@ READ_LINE_MEMBER(mdcr_device::bet) READ_LINE_MEMBER(mdcr_device::cip) { - return true; + return m_cassette->get_image() != nullptr; } READ_LINE_MEMBER(mdcr_device::wen) { - return true; + return m_cassette->get_image() != nullptr && m_cassette->is_writeable(); } WRITE_LINE_MEMBER(mdcr_device::rev) @@ -87,7 +87,7 @@ void mdcr_device::device_add_mconfig(machine_config &config) { CASSETTE(config, m_cassette); m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | - CASSETTE_SPEAKER_MUTED); + CASSETTE_SPEAKER_MUTED); m_cassette->set_interface("p2000_cass"); m_cassette->set_formats(p2000t_cassette_formats); } @@ -198,8 +198,14 @@ void mdcr_device::stop() bool mdcr_device::tape_start_or_end() { auto pos = m_cassette->get_position(); - return m_cassette->motor_on() && - (pos <= 0 || pos >= m_cassette->get_length()); + auto bet = m_cassette->motor_on() && + (pos <= 0 || pos >= m_cassette->get_length()); + + // Reset phase decoder at tape start/end. + if (bet) + m_phase_decoder.reset(); + + return bet; } void p2000_mdcr_devices(device_slot_interface &device) @@ -233,7 +239,7 @@ bool mdcr_device::phase_decoder::signal(bool state, double delay) if (state == m_last_signal) { if (m_needs_sync == 0 && m_current_clock > m_clock_period && - !within_tolerance(m_current_clock, m_clock_period)) + !within_tolerance(m_current_clock, m_clock_period)) { // We might be at the last bit in a sequence, meaning we // are only getting the reference signal for a while. diff --git a/src/mame/machine/partner.cpp b/src/mame/machine/partner.cpp index 69f9c201922..0bcc83d5f0a 100644 --- a/src/mame/machine/partner.cpp +++ b/src/mame/machine/partner.cpp @@ -343,9 +343,8 @@ void partner_state::mem_page_w(u8 data) I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const u8 *charmap = m_chargen + 0x400 * (gpa * 2 + hlgt); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u8 const *const charmap = m_chargen + 0x400 * (gpa * 2 + hlgt); u8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; @@ -356,8 +355,8 @@ I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) if (rvv) pixels ^= 0xff; - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1]; + for(int i=0;i<6;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1]; } void partner_state::machine_reset() diff --git a/src/mame/machine/pc1512kb.cpp b/src/mame/machine/pc1512kb.cpp index 13c8962ed8e..f026f37cfd1 100644 --- a/src/mame/machine/pc1512kb.cpp +++ b/src/mame/machine/pc1512kb.cpp @@ -87,11 +87,11 @@ INPUT_PORTS_START( pc1512_keyboard ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\'') PORT_CHAR('|') + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\\') PORT_CHAR('|') PORT_START("Y3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('?') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') @@ -144,7 +144,7 @@ INPUT_PORTS_START( pc1512_keyboard ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT" Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('#') PORT_CHAR('~') + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('#') PORT_CHAR('~') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("* PrtSc") PORT_CODE(KEYCODE_PRTSCR) diff --git a/src/mame/machine/pcd_kbd.cpp b/src/mame/machine/pcd_kbd.cpp index 32fc0bc72b0..83e8adb303e 100644 --- a/src/mame/machine/pcd_kbd.cpp +++ b/src/mame/machine/pcd_kbd.cpp @@ -78,7 +78,7 @@ INPUT_PORTS_START( pcd_keyboard ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(3) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7C") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(EQUALS_PAD)) @@ -206,9 +206,9 @@ INPUT_PORTS_START( pcd_keyboard ) PORT_START("ROW.16") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_PAUSE) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x3C") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Unknown 0x7E") PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) diff --git a/src/mame/machine/primo.cpp b/src/mame/machine/primo.cpp index 6c76a961e6d..ad4989257f8 100644 --- a/src/mame/machine/primo.cpp +++ b/src/mame/machine/primo.cpp @@ -340,7 +340,7 @@ u32 primo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons for (u8 y = 0; y < 192; y++) { - u16 *p = &bitmap.pix16(y); + u16 *p = &bitmap.pix(y); for (u16 x = 0; x < 32; x++) { u8 data = m_vram[ma+x]; diff --git a/src/mame/machine/psxcd.cpp b/src/mame/machine/psxcd.cpp index b7271d751b0..ddbcf2e267b 100644 --- a/src/mame/machine/psxcd.cpp +++ b/src/mame/machine/psxcd.cpp @@ -146,12 +146,12 @@ void psxcd_device::device_stop() for (int i = 0; i < MAX_PSXCD_TIMERS; i++) { if(m_timerinuse[i] && m_timers[i]->ptr()) - global_free((command_result *)m_timers[i]->ptr()); + delete (command_result *)m_timers[i]->ptr(); } while(res_queue) { command_result *res = res_queue->next; - global_free(res_queue); + delete res_queue; res_queue = res; } } @@ -164,7 +164,7 @@ void psxcd_device::device_reset() for (int i = 0; i < MAX_PSXCD_TIMERS; i++) { if(m_timerinuse[i] && m_timers[i]->ptr()) - global_free((command_result *)m_timers[i]->ptr()); + delete (command_result *)m_timers[i]->ptr(); m_timers[i]->adjust(attotime::never, 0, attotime::never); m_timerinuse[i] = false; } @@ -175,7 +175,7 @@ void psxcd_device::device_reset() while(res_queue) { command_result *res = res_queue->next; - global_free(res_queue); + delete res_queue; res_queue = res; } @@ -363,7 +363,7 @@ void psxcd_device::write(offs_t offset, uint8_t data) m_int1 = nullptr; res_queue = res->next; - global_free(res); + delete res; m_regs.sr &= ~0x20; rdp = 0; if(res_queue) @@ -867,7 +867,7 @@ void psxcd_device::cmd_complete(command_result *res) psxcd_device::command_result *psxcd_device::prepare_result(uint8_t res, uint8_t *data, int sz, uint8_t errcode) { - auto cr=global_alloc(command_result); + auto cr=new command_result; cr->res=res; if (sz) @@ -1072,7 +1072,7 @@ void psxcd_device::play_sector() if ((mode&mode_report) && !(sector & 15)) // slow the int rate { - auto res=global_alloc(command_result); + auto res=new command_result; uint8_t track = cdrom_get_track(m_cdrom_handle, sector) + 1; res->res=intr_dataready; diff --git a/src/mame/machine/radio86.cpp b/src/mame/machine/radio86.cpp index 14517a58409..577d141815e 100644 --- a/src/mame/machine/radio86.cpp +++ b/src/mame/machine/radio86.cpp @@ -217,7 +217,7 @@ I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels) pixels ^= 0xff; for (u8 i = 0; i < 6; i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t radio86_pens[3] = { diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp index 62baaccc2b6..402d9b8a78b 100644 --- a/src/mame/machine/sms.cpp +++ b/src/mame/machine/sms.cpp @@ -1433,7 +1433,7 @@ void gamegear_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rg if (sms_y2 >= vdp_bitmap.cliprect().min_y && sms_y2 <= vdp_bitmap.cliprect().max_y) { - uint32_t *vdp_buffer = &vdp_bitmap.pix32(sms_y2); + uint32_t *const vdp_buffer = &vdp_bitmap.pix(sms_y2); int sms_x = sms_min_x; int x_min_i = plot_min_x - plot_x_first_group; @@ -1496,7 +1496,7 @@ void gamegear_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rg line3 = m_line_buffer.get() + ((sms_y + y_i + 1) & 0x03) * 160; line4 = m_line_buffer.get() + ((sms_y + y_i + 2) & 0x03) * 160; - uint32_t *p_bitmap = &bitmap.pix32(visarea.min_y + plot_y_group + y_i, visarea.min_x); + uint32_t *const p_bitmap = &bitmap.pix(visarea.min_y + plot_y_group + y_i, visarea.min_x); for (int plot_x = plot_min_x; plot_x <= plot_max_x; plot_x++) { @@ -1555,9 +1555,9 @@ uint32_t gamegear_state::screen_update_gamegear(screen_device &screen, bitmap_rg // (it would be better to generalize this in the core, to be used for all LCD systems) for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *linedst = &bitmap.pix32(y); - uint32_t *line0 = &source_bitmap->pix32(y); - uint32_t *line1 = &m_prev_bitmap.pix32(y); + uint32_t *const linedst = &bitmap.pix(y); + uint32_t const *const line0 = &source_bitmap->pix(y); + uint32_t const *const line1 = &m_prev_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint32_t color0 = line0[x]; @@ -1568,9 +1568,9 @@ uint32_t gamegear_state::screen_update_gamegear(screen_device &screen, bitmap_rg uint16_t r1 = (color1 >> 16) & 0x000000ff; uint16_t g1 = (color1 >> 8) & 0x000000ff; uint16_t b1 = (color1 >> 0) & 0x000000ff; - uint8_t r = (uint8_t)((r0 + r1) >> 1); - uint8_t g = (uint8_t)((g0 + g1) >> 1); - uint8_t b = (uint8_t)((b0 + b1) >> 1); + uint8_t r = uint8_t((r0 + r1) >> 1); + uint8_t g = uint8_t((g0 + g1) >> 1); + uint8_t b = uint8_t((b0 + b1) >> 1); linedst[x] = (r << 16) | (g << 8) | b; } } diff --git a/src/mame/machine/special.cpp b/src/mame/machine/special.cpp index ed8e36e7033..58f3fdcb5f1 100644 --- a/src/mame/machine/special.cpp +++ b/src/mame/machine/special.cpp @@ -113,18 +113,11 @@ void special_state::specimx_portc_w(uint8_t data) m_dac->write(BIT(data, 5)); //beeper } -void special_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(special_state::pit_timer) { - switch (id) - { - case TIMER_PIT8253_GATES: - m_pit->write_gate0(0); - m_pit->write_gate1(0); - m_pit->write_gate2(0); - break; - default: - throw emu_fatalerror("Unknown id in special_state::device_timer"); - } + m_pit->write_gate0(0); + m_pit->write_gate1(0); + m_pit->write_gate2(0); } @@ -325,7 +318,7 @@ void special_state::machine_reset() { m_specimx_color = 0xF0; // default for -bios 1/2, since they don't have colour specimx_set_bank(2, 0); // Initial load ROM disk - timer_set(attotime::zero, TIMER_PIT8253_GATES); + m_pit_timer->adjust(attotime::zero); } } diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 30ea3f738e6..f4cafda3f71 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -511,7 +511,7 @@ void st0016_cpu_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip if (!flipy) { drawypos = ypos + yloop; } else { drawypos = (ypos + 8 - 1) - yloop; } - destline = &bitmap.pix16(drawypos); + destline = &bitmap.pix(drawypos); for (xloop = 0; xloop<8; xloop++) { @@ -654,7 +654,7 @@ void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap, const rectangle &clipre if (!flipy) { drawypos = ypos + yloop; } else { drawypos = (ypos + 8 - 1) - yloop; } - destline = &bitmap.pix16(drawypos); + destline = &bitmap.pix(drawypos); for (xloop = 0; xloop<8; xloop++) { diff --git a/src/mame/machine/teleprinter.cpp b/src/mame/machine/teleprinter.cpp index 8ef1576a2c2..75b1654a7ef 100644 --- a/src/mame/machine/teleprinter.cpp +++ b/src/mame/machine/teleprinter.cpp @@ -187,20 +187,17 @@ void teleprinter_device::term_write(uint8_t data) ***************************************************************************/ uint32_t teleprinter_device::tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t code; - int y, c, x, b; - - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { - for (c = 0; c < 8; c++) + for (int c = 0; c < 8; c++) { int horpos = 0; - for (x = 0; x < m_width; x++) + for (int x = 0; x < m_width; x++) { - code = teleprinter_font[(m_buffer[y*m_width + x] & 0x7f) *8 + c]; - for (b = 0; b < 8; b++) + uint8_t code = teleprinter_font[(m_buffer[y*m_width + x] & 0x7f) *8 + c]; + for (int b = 0; b < 8; b++) { - bitmap.pix32(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; + bitmap.pix(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; } } } diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index ee2fd34b6fe..cf8ca0fc56c 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -96,7 +96,7 @@ int thomson_state::to7_get_cassette() /* we simply count sign changes... */ int k, chg; int8_t data[40]; - cassette_get_samples( cass, 0, pos, TO7_BIT_LENGTH * 15. / 14., 40, 1, data, 0 ); + cass->get_samples( 0, pos, TO7_BIT_LENGTH * 15. / 14., 40, 1, data, 0 ); for ( k = 1, chg = 0; k < 40; k++ ) { @@ -177,7 +177,7 @@ int thomson_state::mo5_get_cassette() if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED ) return 1; - cassette_get_sample( cass, 0, pos, 0, &hbit ); + cass->get_sample( 0, pos, 0, &hbit ); hbit = hbit >= 0; VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", diff --git a/src/mame/machine/trs80.cpp b/src/mame/machine/trs80.cpp index 99deddaafb4..898ff364550 100644 --- a/src/mame/machine/trs80.cpp +++ b/src/mame/machine/trs80.cpp @@ -199,7 +199,7 @@ void trs80_state::port_ff_w(uint8_t data) if (!init) { init = 1; - static int16_t speaker_levels[4] = { 0, -32767, 0, 32767 }; + static double speaker_levels[4] = { 0.0, -1.0, 0.0, 1.0 }; m_speaker->set_levels(4, speaker_levels); } diff --git a/src/mame/machine/ut88.cpp b/src/mame/machine/ut88.cpp index 4c6fa1e2833..45116248dc6 100644 --- a/src/mame/machine/ut88.cpp +++ b/src/mame/machine/ut88.cpp @@ -25,14 +25,10 @@ static const uint8_t hex_to_7seg[16] = /* Driver initialization */ -void ut88mini_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_DEVICE_CALLBACK_MEMBER(ut88mini_state::display_timer) { - if (id == TIMER_UPDATE_DISPLAY) - { - for (int i = 0; i < 6; i++) - m_digits[i] = hex_to_7seg[m_lcd_digit[i]]; - timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); - } + for (u8 i = 0; i < 6; i++) + m_digits[i] = hex_to_7seg[m_lcd_digit[i]]; } uint8_t ut88_state::ppi_portb_r() @@ -123,7 +119,7 @@ uint8_t ut88mini_state::keyboard_r() { // This is real keyboard implementation uint8_t *keyrom1 = m_proms->base(); - uint8_t *keyrom2 = m_proms->base()+100; + uint8_t *keyrom2 = m_proms->base()+0x100; uint8_t key = keyrom2[m_io_line1->read()]; @@ -164,7 +160,6 @@ void ut88mini_state::led_w(offs_t offset, uint8_t data) void ut88mini_state::machine_start() { m_digits.resolve(); - timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); save_item(NAME(m_lcd_digit)); } diff --git a/src/mame/machine/victor9k_kb.cpp b/src/mame/machine/victor9k_kb.cpp index 7eae649ee07..5d533af2235 100644 --- a/src/mame/machine/victor9k_kb.cpp +++ b/src/mame/machine/victor9k_kb.cpp @@ -460,7 +460,7 @@ INPUT_PORTS_START( victor9k_keyboard ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("- _ ~") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR('~') // S24 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("= + \\") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_CHAR('\\') // S25 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xbd \xc2\xbc") PORT_CODE(KEYCODE_OPENBRACE) // unicode half fraction U+00BD / quarter fraction U+00BC // S45 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR(']') // S46 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("[ ]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('[') // S46 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') // S66 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("UNUSED S67") // unused // S67 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') // S87 diff --git a/src/mame/machine/wangpckb.cpp b/src/mame/machine/wangpckb.cpp index 0268732872c..b6bf1f62566 100644 --- a/src/mame/machine/wangpckb.cpp +++ b/src/mame/machine/wangpckb.cpp @@ -156,7 +156,7 @@ INPUT_PORTS_START( wangpc_keyboard ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') // 65 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') // 2f PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') // 56 - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') // 55 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(']') PORT_CHAR('[') // 55 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') // 46 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) // 22 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 23 @@ -200,7 +200,7 @@ INPUT_PORTS_START( wangpc_keyboard ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') // 4e PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') // 4d PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') // 3e - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') // 3d + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(3) // 3d PORT_START("Y7") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x87\xA4") PORT_CODE(KEYCODE_TILDE) // 1f @@ -257,7 +257,7 @@ INPUT_PORTS_START( wangpc_keyboard ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INDENT") PORT_CODE(KEYCODE_F1) // 7e PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REPLC") PORT_CODE(KEYCODE_F10) // 75 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("COPY") PORT_CODE(KEYCODE_F11) // 74 - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) // 24 + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL),UCHAR_SHIFT_2) // 24 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // 1d PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) diff --git a/src/mame/machine/williams.cpp b/src/mame/machine/williams.cpp index feff3b4b2bc..bd2815f4faa 100644 --- a/src/mame/machine/williams.cpp +++ b/src/mame/machine/williams.cpp @@ -508,16 +508,16 @@ TIMER_CALLBACK_MEMBER(joust2_state::deferred_snd_cmd_w) } -WRITE_LINE_MEMBER(joust2_state::pia_3_cb1_w) +WRITE_LINE_MEMBER(joust2_state::pia_s11_bg_strobe_w) { m_current_sound_data = (m_current_sound_data & ~0x100) | ((state << 8) & 0x100); - m_cvsd_sound->write(m_current_sound_data); + m_bg->ctrl_w(state); } void joust2_state::snd_cmd_w(u8 data) { m_current_sound_data = (m_current_sound_data & ~0xff) | (data & 0xff); - m_cvsd_sound->write(m_current_sound_data); + m_bg->data_w(data); machine().scheduler().synchronize(timer_expired_delegate(FUNC(joust2_state::deferred_snd_cmd_w),this), m_current_sound_data); } diff --git a/src/mame/machine/wswan.cpp b/src/mame/machine/wswan.cpp deleted file mode 100644 index c8a942e1a6e..00000000000 --- a/src/mame/machine/wswan.cpp +++ /dev/null @@ -1,664 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Anthony Kruize,Wilbert Pol -/*************************************************************************** - - wswan.c - - Machine file to handle emulation of the Bandai WonderSwan. - - Anthony Kruize - Wilbert Pol - -TODO: - SRAM sizes should be in kbit instead of kbytes(?). This raises a few - interesting issues: - - mirror of smaller <64KBYTE/512kbit sram sizes - - banking when using 1M or 2M sram sizes - -***************************************************************************/ - -#include "emu.h" -#include "includes/wswan.h" -#include "render.h" - -#define INTERNAL_EEPROM_SIZE 1024 - -enum enum_system { TYPE_WSWAN=0, TYPE_WSC }; - - -static const uint8_t ws_portram_init[256] = -{ - 0x00, 0x00, 0x00/*?*/, 0xbb, 0x00, 0x00, 0x00, 0x26, 0xfe, 0xde, 0xf9, 0xfb, 0xdb, 0xd7, 0x7f, 0xf5, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x9e, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x99, 0xfd, 0xb7, 0xdf, - 0x30, 0x57, 0x75, 0x76, 0x15, 0x73, 0x70/*77?*/, 0x77, 0x20, 0x75, 0x50, 0x36, 0x70, 0x67, 0x50, 0x77, - 0x57, 0x54, 0x75, 0x77, 0x75, 0x17, 0x37, 0x73, 0x50, 0x57, 0x60, 0x77, 0x70, 0x77, 0x10, 0x73, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x87, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xdb, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x83, 0x00, - 0x2f, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, - 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 -}; - -/* - Some fake bios code to initialize some registers and set up some things on the wonderswan. - The code from f:ffe0 which gets copied to 0:0400 is taken from a wonderswan crystal's initial - memory settings. Lacking real bios dumps we will use this.... - - The setting of SP to 2000h is what's needed to get Wonderswan Colloseum to boot. - - f000:ffc0 - FC cld - BC 00 20 mov sp,2000h - 68 00 00 push 0000h - 07 pop es - 68 00 F0 push F000h - 1F pop ds - BF 00 04 mov di,0400h - BE E0 FF mov si,FFE0h - B9 10 00 mov cx,0010h - F3 A4 rep movsb - B0 2F mov al,2Fh - E6 C0 out al,C0h - EA 00 04 00 00 jmp 0000:0400 - - f000:ffe0 - E4 A0 in al, A0h - 0C 01 or al,01h - E6 A0 out al,A0h - EA 00 00 FF FF jmp FFFFh:0000h - -*/ -static const uint8_t ws_fake_bios_code[] = { - 0xfc, 0xbc, 0x00, 0x20, 0x68, 0x00, 0x00, 0x07, 0x68, 0x00, 0xf0, 0x1f, 0xbf, 0x00, 0x04, 0xbe, - 0xe0, 0xff, 0xb9, 0x10, 0x00, 0xf3, 0xa4, 0xb0, 0x2f, 0xe6, 0xc0, 0xea, 0x00, 0x04, 0x00, 0x00, - 0xe4, 0xa0, 0x0c, 0x01, 0xe6, 0xa0, 0xea, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -void wswan_state::handle_irqs() -{ - if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_HBLTMR); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBL) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBL); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_VBLTMR) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_VBLTMR); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_LCMP) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_LCMP); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_SRX) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_SRX); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_RTC) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_RTC); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_KEY) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_KEY); // V30MZ - } - else if (m_ws_portram[0xb2] & m_ws_portram[0xb6] & WSWAN_IFLAG_STX) - { - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_ws_portram[0xb0] + WSWAN_INT_STX); // V30MZ - } - else - { - m_maincpu->set_input_line(0, CLEAR_LINE); - } -} - -void wswan_state::set_irq_line(int irq) -{ - if (m_ws_portram[0xb2] & irq) - { - m_ws_portram[0xb6] |= irq; - handle_irqs(); - } -} - -void wswan_state::dma_sound_cb() -{ - if ((m_sound_dma.enable & 0x88) == 0x80) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - /* TODO: Output sound DMA byte */ - port_w(0x89, space.read_byte(m_sound_dma.source)); - m_sound_dma.size--; - m_sound_dma.source = (m_sound_dma.source + 1) & 0x0fffff; - if (m_sound_dma.size == 0) - { - m_sound_dma.enable &= 0x7F; - } - } -} - -void wswan_state::clear_irq_line(int irq) -{ - m_ws_portram[0xb6] &= ~irq; - handle_irqs(); -} - -void wswan_state::register_save() -{ - save_item(NAME(m_ws_portram)); - save_item(NAME(m_internal_eeprom)); - save_item(NAME(m_bios_disabled)); - save_item(NAME(m_rotate)); - - save_item(NAME(m_sound_dma.source)); - save_item(NAME(m_sound_dma.size)); - save_item(NAME(m_sound_dma.enable)); - - if (m_cart->exists()) - m_cart->save_nvram(); -} - -void wswan_state::common_start() -{ - m_ws_bios_bank = std::make_unique<uint8_t[]>(0x10000); - memcpy(m_ws_bios_bank.get() + 0xffc0, ws_fake_bios_code, 0x40); - - register_save(); - - subdevice<nvram_device>("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE); - - if (m_cart->exists()) - { - // ROM - m_maincpu->space(AS_PROGRAM).install_read_handler(0x20000, 0x2ffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_rom20))); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x30000, 0x3ffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_rom30))); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x40000, 0xeffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_rom40))); - - // SRAM - if (m_cart->get_type() == WS_SRAM) - { - m_maincpu->space(AS_PROGRAM).install_read_handler(0x10000, 0x1ffff, read8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::read_ram))); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x10000, 0x1ffff, write8sm_delegate(*m_cart, FUNC(ws_cart_slot_device::write_ram))); - } - } -} - -void wswan_state::machine_start() -{ - common_start(); - m_system_type = TYPE_WSWAN; -} - -void wscolor_state::machine_start() -{ - common_start(); - m_system_type = TYPE_WSC; -} - -void wswan_state::machine_reset() -{ - m_bios_disabled = 0; - - if (m_cart->exists()) - m_rotate = m_cart->get_is_rotated(); - else - m_rotate = 0; - - /* Intialize ports */ - memcpy(m_ws_portram, ws_portram_init, 256); - - render_target *target = machine().render().first_target(); - target->set_view(m_rotate); - - /* Initialize sound DMA */ - memset(&m_sound_dma, 0, sizeof(m_sound_dma)); -} - -uint8_t wswan_state::bios_r(offs_t offset) -{ - if (!m_bios_disabled) - return m_ws_bios_bank[offset]; - else - return m_cart->read_rom40(offset + 0xb0000); -} - -uint8_t wswan_state::port_r(offs_t offset) -{ - uint8_t value = m_ws_portram[offset]; - - if (offset != 2) - logerror("PC=%X: port read %02X\n", m_maincpu->pc(), offset); - - if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) - return m_vdp->reg_r(offset); - - switch (offset) - { - case 0x4a: // Sound DMA source address (low) - value = m_sound_dma.source & 0xff; - break; - case 0x4b: // Sound DMA source address (high) - value = (m_sound_dma.source >> 8) & 0xff; - break; - case 0x4c: // Sound DMA source memory segment - value = (m_sound_dma.source >> 16) & 0xff; - break; - case 0x4e: // Sound DMA transfer size (low) - value = m_sound_dma.size & 0xff; - break; - case 0x4f: // Sound DMA transfer size (high) - value = (m_sound_dma.size >> 8) & 0xff; - break; - case 0x52: // Sound DMA start/stop - value = m_sound_dma.enable; - break; - case 0x60: - value = m_vdp->reg_r(offset); - break; - case 0xa0: // Hardware type - // Bit 0 - Disable/enable Bios - // Bit 1 - Determine mono/color - // Bit 2 - Determine color/crystal - value = value & ~ 0x02; - if (m_system_type == TYPE_WSC) - value |= 2; - break; - case 0xc0: - case 0xc1: - case 0xc2: - case 0xc3: - case 0xc4: // EEPROM data - case 0xc5: // EEPROM data - case 0xc6: - case 0xc7: - case 0xc8: - case 0xc9: - case 0xca: - case 0xcb: // RTC data - case 0xcc: - case 0xcd: - case 0xce: - case 0xcf: - value = m_cart->read_io(offset & 0x0f); - break; - } - - return value; -} - -void wswan_state::port_w(offs_t offset, uint8_t data) -{ - address_space &mem = m_maincpu->space(AS_PROGRAM); - uint8_t input; - logerror("PC=%X: port write %02X <- %02X\n", m_maincpu->pc(), offset, data); - - if (offset < 0x40 || (offset >= 0xa1 && offset < 0xb0)) - { - m_vdp->reg_w(offset, data); - return; - } - - switch (offset) - { - case 0x40: /* DMA source address (low) - Bit 0-7 - DMA source address bit 0-7 - */ - case 0x41: /* DMA source address (high) - Bit 0-7 - DMA source address bit 8-15 - */ - case 0x42: /* DMA source bank - Bit 0-7 - DMA source bank number - */ - case 0x43: /* DMA destination bank - Bit 0-7 - DMA destination bank number - */ - case 0x44: /* DMA destination address (low) - Bit 0-7 - DMA destination address bit 0-7 - */ - case 0x45: /* DMA destination address (high) - Bit 0-7 - DMA destination address bit 8-15 - */ - case 0x46: /* Size of copied data (low) - Bit 0-7 - DMA size bit 0-7 - */ - case 0x47: /* Size of copied data (high) - Bit 0-7 - DMA size bit 8-15 - */ - break; - case 0x48: /* DMA control - Bit 0-6 - Unknown - Bit 7 - DMA stop/start - */ - if (data & 0x80) - { - uint32_t src, dst; - uint16_t length; - - src = m_ws_portram[0x40] + (m_ws_portram[0x41] << 8) + (m_ws_portram[0x42] << 16); - dst = m_ws_portram[0x44] + (m_ws_portram[0x45] << 8) + (m_ws_portram[0x43] << 16); - length = m_ws_portram[0x46] + (m_ws_portram[0x47] << 8); - for ( ; length > 0; length--) - { - mem.write_byte(dst, mem.read_byte(src)); - src++; - dst++; - } -#ifdef MAME_DEBUG - logerror("DMA src:%X dst:%X length:%d\n", src, dst, length); -#endif - m_ws_portram[0x40] = src & 0xff; - m_ws_portram[0x41] = (src >> 8) & 0xff; - m_ws_portram[0x44] = dst & 0xff; - m_ws_portram[0x45] = (dst >> 8) & 0xff; - m_ws_portram[0x46] = length & 0xff; - m_ws_portram[0x47] = (length >> 8) & 0xff; - data &= 0x7f; - } - break; - case 0x4a: /* Sound DMA source address (low) - Bit 0-7 - Sound DMA source address bit 0-7 - */ - m_sound_dma.source = (m_sound_dma.source & 0x0fff00) | data; - break; - case 0x4b: /* Sound DMA source address (high) - Bit 0-7 - Sound DMA source address bit 8-15 - */ - m_sound_dma.source = (m_sound_dma.source & 0x0f00ff) | (data << 8); - break; - case 0x4c: /* Sound DMA source memory segment - Bit 0-3 - Sound DMA source address segment - Bit 4-7 - Unknown - */ - m_sound_dma.source = (m_sound_dma.source & 0xffff) | ((data & 0x0f) << 16); - break; - case 0x4d: /* Unknown */ - break; - case 0x4e: /* Sound DMA transfer size (low) - Bit 0-7 - Sound DMA transfer size bit 0-7 - */ - m_sound_dma.size = (m_sound_dma.size & 0xff00) | data; - break; - case 0x4f: /* Sound DMA transfer size (high) - Bit 0-7 - Sound DMA transfer size bit 8-15 - */ - m_sound_dma.size = (m_sound_dma.size & 0xff) | (data << 8); - break; - case 0x50: /* Unknown */ - case 0x51: /* Unknown */ - break; - case 0x52: /* Sound DMA start/stop - Bit 0-6 - Unknown - Bit 7 - Sound DMA stop/start - */ - m_sound_dma.enable = data; - break; - case 0x60: - m_vdp->reg_w(offset, data); - break; - case 0x80: /* Audio 1 freq (lo) - Bit 0-7 - Audio channel 1 frequency bit 0-7 - */ - case 0x81: /* Audio 1 freq (hi) - Bit 0-7 - Audio channel 1 frequency bit 8-15 - */ - case 0x82: /* Audio 2 freq (lo) - Bit 0-7 - Audio channel 2 frequency bit 0-7 - */ - case 0x83: /* Audio 2 freq (hi) - Bit 0-7 - Audio channel 2 frequency bit 8-15 - */ - case 0x84: /* Audio 3 freq (lo) - Bit 0-7 - Audio channel 3 frequency bit 0-7 - */ - case 0x85: /* Audio 3 freq (hi) - Bit 0-7 - Audio channel 3 frequency bit 8-15 - */ - case 0x86: /* Audio 4 freq (lo) - Bit 0-7 - Audio channel 4 frequency bit 0-7 - */ - case 0x87: /* Audio 4 freq (hi) - Bit 0-7 - Audio channel 4 frequency bit 8-15 - */ - case 0x88: /* Audio 1 volume - Bit 0-3 - Right volume audio channel 1 - Bit 4-7 - Left volume audio channel 1 - */ - case 0x89: /* Audio 2 volume - Bit 0-3 - Right volume audio channel 2 - Bit 4-7 - Left volume audio channel 2 - */ - case 0x8a: /* Audio 3 volume - Bit 0-3 - Right volume audio channel 3 - Bit 4-7 - Left volume audio channel 3 - */ - case 0x8b: /* Audio 4 volume - Bit 0-3 - Right volume audio channel 4 - Bit 4-7 - Left volume audio channel 4 - */ - case 0x8c: /* Sweep step - Bit 0-7 - Sweep step - */ - case 0x8d: /* Sweep time - Bit 0-7 - Sweep time - */ - case 0x8e: /* Noise control - Bit 0-2 - Noise generator type - Bit 3 - Reset - Bit 4 - Enable - Bit 5-7 - Unknown - */ - case 0x8f: /* Sample location - Bit 0-7 - Sample address location 0 00xxxxxx xx000000 - */ - case 0x90: /* Audio control - Bit 0 - Audio 1 enable - Bit 1 - Audio 2 enable - Bit 2 - Audio 3 enable - Bit 3 - Audio 4 enable - Bit 4 - Unknown - Bit 5 - Audio 2 voice mode enable - Bit 6 - Audio 3 sweep mode enable - Bit 7 - Audio 4 noise mode enable - */ - case 0x91: /* Audio output - Bit 0 - Mono select - Bit 1-2 - Output volume - Bit 3 - External stereo - Bit 4-6 - Unknown - Bit 7 - External speaker (Read-only, set by hardware) - */ - case 0x92: /* Noise counter shift register (lo) - Bit 0-7 - Noise counter shift register bit 0-7 - */ - case 0x93: /* Noise counter shift register (hi) - Bit 0-6 - Noise counter shift register bit 8-14 - bit 7 - Unknown - */ - case 0x94: /* Master volume - Bit 0-3 - Master volume - Bit 4-7 - Unknown - */ - m_sound->port_w(offset, data); - break; - case 0xa0: /* Hardware type - this is probably read only - Bit 0 - Enable cartridge slot and/or disable bios - Bit 1 - Hardware type: 0 = WS, 1 = WSC - Bit 2-7 - Unknown - */ - if ((data & 0x01) && !m_bios_disabled) - m_bios_disabled = 1; - break; - - case 0xb0: /* Interrupt base vector - Bit 0-7 - Interrupt base vector - */ - break; - case 0xb1: /* Communication byte - Bit 0-7 - Communication byte - */ - break; - case 0xb2: /* Interrupt enable - Bit 0 - Serial transmit interrupt enable - Bit 1 - Key press interrupt enable - Bit 2 - RTC alarm interrupt enable - Bit 3 - Serial receive interrupt enable - Bit 4 - Drawing line detection interrupt enable - Bit 5 - VBlank timer interrupt enable - Bit 6 - VBlank interrupt enable - Bit 7 - HBlank timer interrupt enable - */ - break; - case 0xb3: /* serial communication control - Bit 0 - Receive complete - Bit 1 - Error - Bit 2 - Send complete - Bit 3-4 - Unknown - Bit 5 - Send data interrupt generation - Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps - bit 7 - Receive data interrupt generation - */ - // data |= 0x02; - m_ws_portram[0xb1] = 0xff; - if (data & 0x80) - { - // m_ws_portram[0xb1] = 0x00; - data |= 0x04; - } - if (data & 0x20) - { - // data |= 0x01; - } - break; - case 0xb5: /* Read controls - Bit 0-3 - Current state of input lines (read-only) - Bit 4-6 - Select line of inputs to read - 001 - Read Y cursors - 010 - Read X cursors - 100 - Read START,A,B buttons - Bit 7 - Unknown - */ - data = data & 0xf0; - switch (data) - { - case 0x10: /* Read Y cursors: Y1 - Y2 - Y3 - Y4 */ - input = m_cursy->read(); - if (m_rotate) // reorient controls if the console is rotated - { - if (input & 0x01) data |= 0x02; - if (input & 0x02) data |= 0x04; - if (input & 0x04) data |= 0x08; - if (input & 0x08) data |= 0x01; - } - else - data = data | input; - break; - case 0x20: /* Read X cursors: X1 - X2 - X3 - X4 */ - input = m_cursx->read(); - if (m_rotate) // reorient controls if the console is rotated - { - if (input & 0x01) data |= 0x02; - if (input & 0x02) data |= 0x04; - if (input & 0x04) data |= 0x08; - if (input & 0x08) data |= 0x01; - } - else - data = data | input; - break; - case 0x40: /* Read buttons: START - A - B */ - data = data | m_buttons->read(); - break; - } - break; - case 0xb6: /* Interrupt acknowledge - Bit 0 - Serial transmit interrupt acknowledge - Bit 1 - Key press interrupt acknowledge - Bit 2 - RTC alarm interrupt acknowledge - Bit 3 - Serial receive interrupt acknowledge - Bit 4 - Drawing line detection interrupt acknowledge - Bit 5 - VBlank timer interrupt acknowledge - Bit 6 - VBlank interrupt acknowledge - Bit 7 - HBlank timer interrupt acknowledge - */ - clear_irq_line(data); - data = m_ws_portram[0xb6]; - break; - case 0xba: /* Internal EEPROM data (low) - Bit 0-7 - Internal EEPROM data transfer bit 0-7 - */ - case 0xbb: /* Internal EEPROM data (high) - Bit 0-7 - Internal EEPROM data transfer bit 8-15 - */ - break; - case 0xbc: /* Internal EEPROM address (low) - Bit 0-7 - Internal EEPROM address bit 1-8 - */ - case 0xbd: /* Internal EEPROM address (high) - Bit 0 - Internal EEPROM address bit 9(?) - Bit 1-7 - Unknown - Only 1KByte internal EEPROM?? - */ - break; - case 0xbe: /* Internal EEPROM command - Bit 0 - Read complete (read only) - Bit 1 - Write complete (read only) - Bit 2-3 - Unknown - Bit 4 - Read - Bit 5 - Write - Bit 6 - Protect - Bit 7 - Initialize - */ - if (data & 0x20) - { - uint16_t addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; - m_internal_eeprom[ addr ] = m_ws_portram[0xba]; - m_internal_eeprom[ addr + 1 ] = m_ws_portram[0xbb]; - data |= 0x02; - } - else if ( data & 0x10 ) - { - uint16_t addr = ( ( ( m_ws_portram[0xbd] << 8 ) | m_ws_portram[0xbc] ) << 1 ) & 0x1FF; - m_ws_portram[0xba] = m_internal_eeprom[ addr ]; - m_ws_portram[0xbb] = m_internal_eeprom[ addr + 1]; - data |= 0x01; - } - else - { - logerror( "Unsupported internal EEPROM command: %X\n", data ); - } - break; - case 0xc0: // ROM bank $40000-$fffff - case 0xc1: // SRAM bank - case 0xc2: // ROM bank $20000-$2ffff - case 0xc3: // ROM bank $30000-$3ffff - case 0xc4: - case 0xc5: - case 0xc6: // EEPROM address / command - case 0xc7: // EEPROM address / command - case 0xc8: // EEPROM command - case 0xc9: - case 0xca: // RTC command - case 0xcb: // RTC data - case 0xcc: - case 0xcd: - case 0xce: - case 0xcf: - m_cart->write_io(offset & 0x0f, data); - break; - default: - logerror( "Write to unsupported port: %X - %X\n", offset, data ); - break; - } - - /* Update the port value */ - m_ws_portram[offset] = data; -} diff --git a/src/mame/machine/x820kb.cpp b/src/mame/machine/x820kb.cpp index 420f6571316..1812a4e8d91 100644 --- a/src/mame/machine/x820kb.cpp +++ b/src/mame/machine/x820kb.cpp @@ -104,7 +104,7 @@ INPUT_PORTS_START( xerox_820_keyboard ) PORT_START("Y0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(3) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') @@ -138,7 +138,7 @@ INPUT_PORTS_START( xerox_820_keyboard ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR('\\') - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_CHAR('|') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("Y4") @@ -153,8 +153,8 @@ INPUT_PORTS_START( xerox_820_keyboard ) PORT_START("Y5") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) @@ -212,7 +212,7 @@ INPUT_PORTS_START( xerox_820_keyboard ) PORT_START("Y15") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL),UCHAR_SHIFT_2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index 99270ddf038..74af8e4eb71 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -964,18 +964,18 @@ void xbox_base_state::xbox_base(machine_config &config) NV2A_RAM(config, ":pci:00.3", 0, 128); // 128 megabytes MCPX_ISALPC(config, ":pci:01.0", 0, 0).interrupt_output().set(FUNC(xbox_base_state::maincpu_interrupt)); XBOX_SUPERIO(config, ":pci:01.0:0", 0); - MCPX_SMBUS(config, ":pci:01.1", 0).interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq11)); //.set(FUNC(xbox_base_state::smbus_interrupt_changed)); + MCPX_SMBUS(config, ":pci:01.1", 0, 0).interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq11)); //.set(FUNC(xbox_base_state::smbus_interrupt_changed)); XBOX_PIC16LC(config, ":pci:01.1:110", 0); // these 3 are on smbus number 1 XBOX_CX25871(config, ":pci:01.1:145", 0); XBOX_EEPROM(config, ":pci:01.1:154", 0); - MCPX_OHCI(config, ":pci:02.0", 0).interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq1)); //.set(FUNC(xbox_base_state::ohci_usb_interrupt_changed)); - MCPX_OHCI(config, ":pci:03.0", 0); + MCPX_OHCI(config, ":pci:02.0", 0, 0).interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq1)); //.set(FUNC(xbox_base_state::ohci_usb_interrupt_changed)); + MCPX_OHCI(config, ":pci:03.0", 0, 0); MCPX_ETH(config, ":pci:04.0", 0); - MCPX_APU(config, ":pci:05.0", 0, m_maincpu); - MCPX_AC97_AUDIO(config, ":pci:06.0", 0); + MCPX_APU(config, ":pci:05.0", 0, 0, m_maincpu); + MCPX_AC97_AUDIO(config, ":pci:06.0", 0, 0); MCPX_AC97_MODEM(config, ":pci:06.1", 0); PCI_BRIDGE(config, ":pci:08.0", 0, 0x10de01b8, 0); - MCPX_IDE(config, ":pci:09.0", 0).pri_interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq14)); //.set(FUNC(xbox_base_state::ide_interrupt_changed)); + MCPX_IDE(config, ":pci:09.0", 0, 0).pri_interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq14)); //.set(FUNC(xbox_base_state::ide_interrupt_changed)); NV2A_AGP(config, ":pci:1e.0", 0, 0x10de01b7, 0); NV2A_GPU(config, ":pci:1e.0:00.0", 0, m_maincpu).interrupt_handler().set(":pci:01.0", FUNC(mcpx_isalpc_device::irq3)); //.set(FUNC(xbox_base_state::nv2a_interrupt_changed)); diff --git a/src/mame/machine/xbox_pci.cpp b/src/mame/machine/xbox_pci.cpp index 3093bc72d2f..cebd51f9dd7 100644 --- a/src/mame/machine/xbox_pci.cpp +++ b/src/mame/machine/xbox_pci.cpp @@ -125,7 +125,9 @@ void mcpx_isalpc_device::map_extra(uint64_t memory_window_start, uint64_t memory mcpx_isalpc_device::mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id) : mcpx_isalpc_device(mconfig, tag, owner, clock) { - set_ids(0x10de01b2, 0xb4, 0, subsystem_id); // revision id must be at least 0xb4, otherwise usb will require a hub + // revision id must be at least 0xb4 in the xbox, otherwise usb will require a hub + // in the a7n266-c motherboard it has revision 0xc3 + set_ids(0x10de01b2, 0xb4, 0x060100, subsystem_id); } mcpx_isalpc_device::mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) @@ -162,7 +164,7 @@ void mcpx_isalpc_device::device_start() add_map(0x00000100, M_IO, FUNC(mcpx_isalpc_device::lpc_io)); bank_infos[0].adr = 0x8000; status = 0x00b0; - command = 0x0081; + command = 0x0001; command_mask = 0x01be; for (int a = 0; a < 16; a++) lpcdevices[a] = nullptr; @@ -491,6 +493,13 @@ void mcpx_isalpc_device::remap() DEFINE_DEVICE_TYPE(MCPX_SMBUS, mcpx_smbus_device, "mcpx_smbus", "MCPX SMBus Controller") +void mcpx_smbus_device::config_map(address_map &map) +{ + pci_device::config_map(map); + map(0x3e, 0x3e).r(FUNC(mcpx_smbus_device::minimum_grant_r)); + map(0x3f, 0x3f).r(FUNC(mcpx_smbus_device::maximum_latency_r)); +} + void mcpx_smbus_device::smbus_io0(address_map &map) { map(0x00000000, 0x0000000f).rw(FUNC(mcpx_smbus_device::smbus0_r), FUNC(mcpx_smbus_device::smbus0_w)); @@ -506,11 +515,16 @@ void mcpx_smbus_device::smbus_io2(address_map &map) map(0x00000000, 0x0000001f).noprw(); } +mcpx_smbus_device::mcpx_smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id) + : mcpx_smbus_device(mconfig, tag, owner, clock) +{ + set_ids(0x10de01b4, 0xc1, 0x0c0500, subsystem_id); +} + mcpx_smbus_device::mcpx_smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, MCPX_SMBUS, tag, owner, clock), m_interrupt_handler(*this) { - set_ids(0x10de01b4, 0, 0, 0); } void mcpx_smbus_device::device_start() @@ -525,6 +539,9 @@ void mcpx_smbus_device::device_start() add_map(0x00000020, M_IO, FUNC(mcpx_smbus_device::smbus_io2)); bank_infos[2].adr = 0xc200; status = 0x00b0; + command = 0x0001; + // Min Grant 3 + // Max Latency 1 intr_pin = 1; memset(&smbusst, 0, sizeof(smbusst)); for (int b = 0; b < 2; b++) @@ -654,11 +671,24 @@ void mcpx_smbus_device::smbus1_w(offs_t offset, uint32_t data, uint32_t mem_mask DEFINE_DEVICE_TYPE(MCPX_OHCI, mcpx_ohci_device, "mcpx_ohci", "MCPX OHCI USB Controller") +void mcpx_ohci_device::config_map(address_map &map) +{ + pci_device::config_map(map); + map(0x3e, 0x3e).r(FUNC(mcpx_ohci_device::minimum_grant_r)); + map(0x3f, 0x3f).r(FUNC(mcpx_ohci_device::maximum_latency_r)); +} + void mcpx_ohci_device::ohci_mmio(address_map &map) { map(0x00000000, 0x00000fff).rw(FUNC(mcpx_ohci_device::ohci_r), FUNC(mcpx_ohci_device::ohci_w)); } +mcpx_ohci_device::mcpx_ohci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id) + : mcpx_ohci_device(mconfig, tag, owner, clock) +{ + set_ids(0x10de01c2, 0xc3, 0x0c0310, subsystem_id); +} + mcpx_ohci_device::mcpx_ohci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, MCPX_OHCI, tag, owner, clock), ohci_usb(nullptr), @@ -667,7 +697,6 @@ mcpx_ohci_device::mcpx_ohci_device(const machine_config &mconfig, const char *ta maincpu(*this, ":maincpu"), connecteds_count(0) { - set_ids(0x10de01c2, 0, 0, 0); } void mcpx_ohci_device::plug_usb_device(int port, device_usb_ohci_function_interface *function) @@ -683,6 +712,7 @@ void mcpx_ohci_device::device_start() add_map(0x00001000, M_MEM, FUNC(mcpx_ohci_device::ohci_mmio)); bank_infos[0].adr = 0xfed00000; status = 0x00b0; + command = 0x0002; intr_pin = 1; ohci_usb = new ohci_usb_controller(); ohci_usb->set_cpu(maincpu.target()); @@ -810,6 +840,13 @@ void mcpx_eth_device::eth_io_w(uint32_t data) DEFINE_DEVICE_TYPE(MCPX_APU, mcpx_apu_device, "mcpx_apu", "MCP APU") +void mcpx_apu_device::config_map(address_map &map) +{ + pci_device::config_map(map); + map(0x3e, 0x3e).r(FUNC(mcpx_apu_device::minimum_grant_r)); + map(0x3f, 0x3f).r(FUNC(mcpx_apu_device::maximum_latency_r)); +} + void mcpx_apu_device::apu_mmio(address_map &map) { map(0x00000000, 0x00007ffff).rw(FUNC(mcpx_apu_device::apu_r), FUNC(mcpx_apu_device::apu_w)); @@ -827,6 +864,7 @@ void mcpx_apu_device::device_start() add_map(0x00080000, M_MEM, FUNC(mcpx_apu_device::apu_mmio)); bank_infos[0].adr = 0xfe800000; status = 0x00b0; + command = 0x0002; intr_pin = 1; memset(apust.memory, 0, sizeof(apust.memory)); memset(apust.voices_heap_blockaddr, 0, sizeof(apust.voices_heap_blockaddr)); @@ -999,6 +1037,13 @@ void mcpx_apu_device::apu_w(offs_t offset, uint32_t data, uint32_t mem_mask) DEFINE_DEVICE_TYPE(MCPX_AC97_AUDIO, mcpx_ac97_audio_device, "mcpx_ac97_audio", "MCPX AC'97 Audio Codec Interface") +void mcpx_ac97_audio_device::config_map(address_map &map) +{ + pci_device::config_map(map); + map(0x3e, 0x3e).r(FUNC(mcpx_ac97_audio_device::minimum_grant_r)); + map(0x3f, 0x3f).r(FUNC(mcpx_ac97_audio_device::maximum_latency_r)); +} + void mcpx_ac97_audio_device::ac97_mmio(address_map &map) { map(0x00000000, 0x000000fff).rw(FUNC(mcpx_ac97_audio_device::ac97_audio_r), FUNC(mcpx_ac97_audio_device::ac97_audio_w)); @@ -1014,10 +1059,15 @@ void mcpx_ac97_audio_device::ac97_io1(address_map &map) map(0x00000000, 0x00000007f).rw(FUNC(mcpx_ac97_audio_device::ac97_audio_io1_r), FUNC(mcpx_ac97_audio_device::ac97_audio_io1_w)); } +mcpx_ac97_audio_device::mcpx_ac97_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id) + : mcpx_ac97_audio_device(mconfig, tag, owner, clock) +{ + set_ids(0x10de01b1, 0xc2, 0x040100, subsystem_id); +} + mcpx_ac97_audio_device::mcpx_ac97_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, MCPX_AC97_AUDIO, tag, owner, clock) { - set_ids(0x10de01b1, 0, 0, 0); } void mcpx_ac97_audio_device::device_start() @@ -1031,6 +1081,7 @@ void mcpx_ac97_audio_device::device_start() add_map(0x00001000, M_MEM, FUNC(mcpx_ac97_audio_device::ac97_mmio)); bank_infos[2].adr = 0xfec00000; status = 0x00b0; + command = 0x0003; intr_pin = 1; memset(&ac97st, 0, sizeof(ac97st)); } @@ -1127,6 +1178,8 @@ void mcpx_ide_device::config_map(address_map &map) { pci_device::config_map(map); map(0x08, 0x0b).rw(FUNC(pci_device::class_rev_r), FUNC(mcpx_ide_device::class_rev_w)); + map(0x3e, 0x3e).r(FUNC(mcpx_ide_device::minimum_grant_r)); + map(0x3f, 0x3f).r(FUNC(mcpx_ide_device::maximum_latency_r)); } void mcpx_ide_device::ide_pri_command(address_map &map) @@ -1157,6 +1210,12 @@ void mcpx_ide_device::ide_io(address_map &map) map(0x0008, 0x000f).rw("ide2", FUNC(bus_master_ide_controller_device::bmdma_r), FUNC(bus_master_ide_controller_device::bmdma_w)); } +mcpx_ide_device::mcpx_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id) + : mcpx_ide_device(mconfig, tag, owner, clock) +{ + set_ids(0x10de01bc, 0xc3, 0x01018a, subsystem_id); +} + mcpx_ide_device::mcpx_ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, MCPX_IDE, tag, owner, clock), m_pri(*this, "ide1"), @@ -1164,7 +1223,6 @@ mcpx_ide_device::mcpx_ide_device(const machine_config &mconfig, const char *tag, m_pri_interrupt_handler(*this), m_sec_interrupt_handler(*this) { - set_ids(0x10de01bc, 0, 0x01018a, 0); } void mcpx_ide_device::device_start() @@ -1177,6 +1235,7 @@ void mcpx_ide_device::device_start() add_map(0x00000010, M_IO, FUNC(mcpx_ide_device::ide_io)); bank_infos[4].adr = 0xff60; status = 0x00b0; + command = 0x0001; m_pri_interrupt_handler.resolve_safe(); m_sec_interrupt_handler.resolve_safe(); } diff --git a/src/mame/machine/zx.cpp b/src/mame/machine/zx.cpp index a42a9244108..df7318a34c2 100644 --- a/src/mame/machine/zx.cpp +++ b/src/mame/machine/zx.cpp @@ -70,19 +70,19 @@ void zx_state::drop_sync() xe = 0; } if(ys == ye) { - uint16_t *dest = &m_bitmap_render->pix16(ys, xs); + uint16_t *dest = &m_bitmap_render->pix(ys, xs); for(int x = xs; x < xe; x++) *dest++ = 1; } else { - uint16_t *dest = &m_bitmap_render->pix16(ys, xs); + uint16_t *dest = &m_bitmap_render->pix(ys, xs); for(int x = xs; x < 384; x++) *dest++ = 1; for(int y = ys+1; y < ye; y++) { - dest = &m_bitmap_render->pix16(y, 0); + dest = &m_bitmap_render->pix(y, 0); for(int x = 0; x<384; x++) *dest++ = 1; } - dest = &m_bitmap_render->pix16(ye, 0); + dest = &m_bitmap_render->pix(ye, 0); for(int x = 0; x < xe; x++) *dest++ = 1; } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index bcc8b4b7ea0..3f09bf89e77 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -930,6 +930,9 @@ virusrck // (c) 2001 Access GmbH virusrckxl // (c) 2002 Access GmbH viruscl // (c) 2004 Access GmbH +@source:adacp150.cpp +adacp150p // + @source:adam.cpp adam // Coleco Adam @@ -2400,10 +2403,12 @@ acombat3 // bootleg acombat4 // bootleg acombato // bootleg afire // Rene Pierre +asterion // Olympia astrof // (c) [1980?] astrof2 // (c) [1980?] astrof3 // (c) [1980?] astroff // bootleg (Famaresa) +astroff2 // bootleg (Famaresa) spfghmk2 // (c) [1979] Data East Corporation spfghmk22 // (c) [1979] Data East Corporation sstarbtl // bootleg @@ -3137,7 +3142,8 @@ badlandsb2 // bootleg set 2 bagman // (c) 1982 bagmanj // (c) 1982 bagmans // (c) 1982 + Stern license -bagmans2 // (c) 1982 + Stern license +bagmans3 // (c) 1982 + Stern license +bagmans4 // (c) 1982 + Stern license bagnard // (c) 1982 bagnarda // (c) 1982 bagnardi // (c) 1983 + Itisa license @@ -3273,7 +3279,8 @@ bbcmc // 1986 BBC Master Compact bbcmc_ar // 1986 BBC Master Compact (Arabic) bbcmet // 1986 BBC Master ET bbcmt // 1986 BBC Master Turbo -cfa3000 // 1989 Henson CFA 3000 +cfa3000bp // 1989 Henson CFA 3000 (B+) +cfa3000 // 1989 Henson CFA 3000 (Master) daisy // 1987 Comus Daisy discmon // 1988 Arbiter Discmonitor discmate // 1988 Arbiter Discmate @@ -9301,6 +9308,7 @@ ilpag // (c) 199? unknown maxidbl // (c) 1992 Blitz Systems Inc. megadble // (c) 1990 Blitz Systems Inc. megadblj // (c) 1990 Blitz Systems Inc. +megastrp // (c) 1992 Blitz Systems Inc. poker52 // (c) 1993 Blitz Systems Inc. ? steaser // (c) 1993 unknown texasrls // (c) 1998 Cadillac Jack @@ -9930,6 +9938,7 @@ mazinger // (c) 1994 Banpresto (country is in EEPROM) mazingerj // (c) 1994 Banpresto (country is in EEPROM) metmqstr // (c) 1995 Banpresto / Pandorabox nmaster // (c) 1995 Banpresto / Pandorabox +paccarn // (c) 1996 Namco paceight // (c) 1996 Namco pacslot // (c) 1996 Namco plegends // (c) 1994 Atlus @@ -10129,6 +10138,9 @@ millpac // Valadon multiped // hack warlords // 037153-037159 (c) 1980 +@source:ceres.cpp +ceres1 // Eidgenössische Technische Hochschule Zürich Ceres-1 + @source:cesclass.cpp ccclass // hrclass // @@ -10663,6 +10675,10 @@ panich // 8015 (c) 1980 @source:cosmicos.cpp cosmicos // +@source:cowtipping.cpp +cowtipp // +cowtippa // + @source:cp1.cpp cp1 // @@ -11959,6 +11975,7 @@ cobraa // rblaster // (c) 1985 @source:deco_mlc.cpp +acchi // ??? (c) 1996 Data East Corporation (Japan) avengrgs // MCG (c) 1995 Data East Corporation (World) avengrgsj // MCG (c) 1995 Data East Corporation (Japan) ddream95 // MCE (c) 1996 Data East Corporation @@ -14202,8 +14219,9 @@ luctoday // 1980 Sigma mandinga // bootleg (Artemi) mandingaeg // bootleg (Electrogame) mandingarf // bootleg (Recreativos Franco S.A.) -olmandingo // bootleg mandingac // bootleg (Centromatic) +olmandingo // bootleg +olmandingc // bootleg (Calfesa) mltiwars // bootleg (Gayton Games) monsterz // (c) 1982 Nihon (Arcade TV Game List - P.102, Left, 20 from top) moonal2 // [1980] Nichibutsu @@ -14797,9 +14815,13 @@ suprpokrb // (c) 1986 Grayhound Electronics rp200 @source:generalplus_gpl_unknown.cpp +mapacman +taspinv + +@source:generalplus_gpl162xx_lcdtype.cpp pcp8718 pcp8728 -unkunsp +bkid218 @source:generalplus_gpl16250_mobigo.cpp mobigo @@ -14833,6 +14855,7 @@ gormiti tkmag220 // myac220 imgame +beijuehh @source:generalplus_gpl16250_romram.cpp paccon @@ -14855,6 +14878,7 @@ jak_tmnthp jak_dchp jak_ddhp jak_prhp +zippity @source:geneve.cpp geneve // 1987 Myarc Geneve 9640 @@ -15525,6 +15549,7 @@ hulk // jokrpokr // pinpool // roldisco // +sahalove // sinbad // sinbadn // solaride // @@ -16642,6 +16667,7 @@ tarzan // (c) 1999 tarzana // (c) 1999 tarzanc // (c) 1999 tjsb // (c) 1997 +unkigs // (c) 2001? @source:igspc.cpp eztouch // (c) 200? @@ -19010,6 +19036,7 @@ ymcapsul @source:quickpick5.cpp quickp5 +waijockey @source:kontest.cpp kontest // GX800 (c) 198? (Japan) @@ -19860,7 +19887,6 @@ uccopsu // (c) 1992 Irem America (US) mac2fdhd // 1988 Apple Macintosh II (FDHD) maccclas // 1993 Apple Macintosh Color Classic macclas2 // 1991 Apple Macintosh Classic II -macclasc // 1990 Apple Macintosh Classic macii // 1987 Apple Macintosh II maciici // 1989 Apple Macintosh IIci maciicx // 1989 Apple Macintosh IIcx @@ -19884,17 +19910,20 @@ macpb180 // 1992 Apple Macintosh PowerBook 180 macpb180c // 1992 Apple Macintosh PowerBook 180c macpd210 // 1992 Apple Macintosh PowerBook Duo 210 macprtb // 1989 Apple Macintosh Portable -macqd700 // 1991 Apple Macintosh Quadra 700 -macse // 1987 Apple Macintosh SE macse30 // 1989 Apple Macintosh SE/30 -macsefd // 1988 Apple Macintosh SE (FDHD) pmac6100 // 1993 Apple Power Macintosh 6100 +@source:macquadra700.cpp +macqd700 // 1991 Apple Macintosh Quadra 700 + @source:mac128.cpp mac128k // 1984 Apple Macintosh mac512k // 1985 Apple Macintosh 512k mac512ke // 1986 Apple Macintosh 512ke +macclasc // 1990 Apple Macintosh Classic macplus // 1986 Apple Macintosh Plus +macse // 1987 Apple Macintosh SE +macsefd // 1988 Apple Macintosh SE (FDHD) unitron // 1985 Unitron utrn1024 // 1986 Unitron 1024 @@ -22214,6 +22243,7 @@ rad_gen1 // (c)2004 Radica rad_gen2 // (c)2004 Radica rad_ssoc // (c)2004 Radica rad_sonic +rad_orun @source:megaphx.cpp megaphx // (c) 1991 Dinamic / Inder @@ -31429,6 +31459,7 @@ monkeyba // 2001.05 Monkey Ball mslug6 // 2006.02 Metal Slug 6 mushi2k4 // 2004.?? MushiKing The King Of Beetles 2004 Second (Japan) mushi2k5 // 2005.?? MushiKing The King Of Beetles 2005 First (Japan) +mushi2k62 // 2006.?? MushiKing The King Of Beetles 2006 Second (Japan) mushike // 2004.?? MushiKing The King Of Beetle (2K3 2ND Ver. 1.003-, World) mushikeo // 2004.?? MushiKing The King Of Beetle (2K3 2ND Ver. 1.002-, World) mushikep // 2004.?? MushiKing The King Of Beetle (Prototype) @@ -32152,6 +32183,8 @@ ablwikid maxx5in1 maxx6in1 max10in1 +vsmaxx25 +vsmaxx15 @source:nes_vt.cpp vdogdeme @@ -32185,12 +32218,20 @@ rtvgc300 rtvgc300fz red5mam cybar120 +sen101 mc_dg101 mc_aa2 mc_105te mc_sp69 +vsmaxx17 +vsmaxtx2 +vsmaxx77 +vsmaxxvd polmega silv35 +dturbogt +rcapnp +ventur25 lpgm240 mc_dcat8 mc_dcat8a @@ -32248,8 +32289,11 @@ zdog otrail denv150 techni4 -duetpp +sporzpp sporzbx +sporztn +wldsoctv +solargm ablmini senwld zonefusn @@ -35341,6 +35385,7 @@ sarpc_j233 // @source:rltennis.cpp rltennis // (c) 1993 TCH +rltennisa // (c) 1993 TCH @source:rm380z.cpp rm380z // @@ -36461,6 +36506,7 @@ endurord // bootleg hangon // (c) 1985 (Rev A) hangon1 // (c) 1985 hangon2 // (c) 1985 +hangonvf // bootleg shangonrb // (c) 1992 (but bootleg, hangon hw?) shangonrb2 // bootleg (Beta) shangonro // (c) 1987 (FD1094) @@ -37758,6 +37804,7 @@ snes4sln denseib // bootleg denseib2 // bootleg endless // bootleg +endlessa // bootleg ffight2b // bootleg iron // bootleg legendsb // bootleg @@ -37855,6 +37902,7 @@ ikari3k // A7007 'IK3'(c) 1989 ikari3u // A7007 'IK3'(c) 1989 ikari3w // A7007 'IK3'(c) 1989 pow // A7008 'DG' (c) 1988 +powb // bootleg powj // A7008 'DG' (c) 1988 searchar // A8007 'BH' (c) 1989 searcharj // A8007 'BH' (c) 1989 @@ -38123,6 +38171,7 @@ senspeed ordentv wfcentro tiktokmm +jouet @source:spg2xx_digimake.cpp rad_digi @@ -38176,6 +38225,7 @@ lexizeus // Lexibook lexiseal // discpal vgcaplet +vgcap35 vsplus @source:spg2xx_mysprtch.cpp @@ -40383,6 +40433,7 @@ kbash2 // bootleg kbashk // TP-023 (c) 1993 Toaplan kingdmgp // (c) 1994 Raizing/8ing mahoudai // (c) 1993 Raizing + Able license +nprobowl // (c) 1996 Zuck + Able license othldrby // (c) 1995 Sunwise pipibibs // TP-025 pipibibsa // TP-025 diff --git a/src/mame/mess.flt b/src/mame/mess.flt index 87309974e8b..c0552dbdd3a 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -24,6 +24,7 @@ acrnsys.cpp acrnsys1.cpp actions_atj2279b.cpp acvirus.cpp +adacp150.cpp adam.cpp adm11.cpp adm23.cpp @@ -154,6 +155,7 @@ cd100.cpp cd2650.cpp cdc721.cpp cdsys5.cpp +ceres.cpp cfx9850.cpp cgc7900.cpp cgenie.cpp @@ -331,6 +333,7 @@ gb.cpp gba.cpp gem_rp.cpp generalplus_gpl_unknown.cpp +generalplus_gpl162xx_lcdtype.cpp generalplus_gpl16250_mobigo.cpp generalplus_gpl16250_nand.cpp generalplus_gpl16250_rom.cpp @@ -521,6 +524,7 @@ m79152pc.cpp mac.cpp mac128.cpp macpci.cpp +macquadra700.cpp magiceyes_pollux_vr3520f.cpp magnum.cpp mattelchess.cpp diff --git a/src/mame/nl.lst b/src/mame/nl.lst index ce1ddf052ff..206b9a6d694 100644 --- a/src/mame/nl.lst +++ b/src/mame/nl.lst @@ -364,6 +364,15 @@ startrek // (c) 1982 tacscan // (c) 1982 zektor // (c) 1982 +@source:vicdual.cpp +brdrlinb // Karateco bootleg +brdrline // (c) 1980 Sega +brdrlinet // (c) 1981 Sega +brdrlins // Sidam bootleg +starrkr // (c) 1981 Sega +tranqgun // 413-428 (c) 1980 Sega +frogs // 112-119 [1978 Gremlin?] + @source:zaxxon.cpp congo // 605-5167 (c) 1983 (2 board stack) congoa // 605-5167 (c) 1983 (3 board stack) diff --git a/src/mame/video/1943.cpp b/src/mame/video/1943.cpp index 545cb91a6da..1a23037cd9b 100644 --- a/src/mame/video/1943.cpp +++ b/src/mame/video/1943.cpp @@ -257,15 +257,15 @@ void _1943_state::_1943_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { if (!(pri[x] & 0x80)) { - u8 c = source[x_index]; + u8 const c = source[x_index]; if (c != transparent_color) { // the priority is actually selected by bit 3 of BMPROM.07 diff --git a/src/mame/video/20pacgal.cpp b/src/mame/video/20pacgal.cpp index f087ed59822..56324388ea6 100644 --- a/src/mame/video/20pacgal.cpp +++ b/src/mame/video/20pacgal.cpp @@ -82,7 +82,7 @@ void _20pacgal_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &clipr for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for(int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = pen[bitmap.pix32(y, x)]; + bitmap.pix(y, x) = pen[bitmap.pix(y, x)]; } @@ -139,7 +139,7 @@ void _20pacgal_state::draw_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprec /* pen bits A0-A3 */ if (col) - bitmap.pix32(y, x) = (bitmap.pix32(y, x) & 0xff0) | col; + bitmap.pix(y, x) = (bitmap.pix(y, x) & 0xff0) | col; } /* next pixel */ @@ -278,7 +278,7 @@ void _20pacgal_state::draw_chars(bitmap_rgb32 &bitmap, const rectangle &cliprect /* pen bits A4-A11 */ if ( col != 0 ) - bitmap.pix32(y, x) = (color_base | col) << 4; + bitmap.pix(y, x) = (color_base | col) << 4; /* next pixel */ if (flip) @@ -398,7 +398,7 @@ void _20pacgal_state::draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect if (((lfsr & 0xffc0) == star_seta) || ((lfsr & 0xffc0) == star_setb)) { if (y >= cliprect.min_y && y <= cliprect.max_y) - bitmap.pix32(y, x) = NUM_PENS + (lfsr & 0x3f); + bitmap.pix(y, x) = NUM_PENS + (lfsr & 0x3f); cnt++; } } diff --git a/src/mame/video/40love.cpp b/src/mame/video/40love.cpp index 5a5560c599a..005f02090b7 100644 --- a/src/mame/video/40love.cpp +++ b/src/mame/video/40love.cpp @@ -155,29 +155,16 @@ uint8_t fortyl_state::fortyl_pixram_r(offs_t offset) void fortyl_state::fortyl_plot_pix( int offset ) { - int x, y, i, c, d1, d2; + const int x = (offset & 0x1f) * 8; + const int y = (offset >> 5) & 0xff; - x = (offset & 0x1f) * 8; - y = (offset >> 5) & 0xff; + const int d1 = (m_pixram_sel ? m_pixram2 : m_pixram1)[offset]; + const int d2 = (m_pixram_sel ? m_pixram2 : m_pixram1)[offset + 0x2000]; - if (m_pixram_sel) - { - d1 = m_pixram2[offset]; - d2 = m_pixram2[offset + 0x2000]; - } - else + for (int i = 0; i < 8; i++) { - d1 = m_pixram1[offset]; - d2 = m_pixram1[offset + 0x2000]; - } - - for (i = 0; i < 8; i++) - { - c = ((d2 >> i) & 1) + ((d1 >> i) & 1) * 2; - if (m_pixram_sel) - m_tmp_bitmap2->pix16(y, x + i) = m_pix_color[c] | ((m_color_bank == true) ? 0x200 : 0); - else - m_tmp_bitmap1->pix16(y, x + i) = m_pix_color[c] | ((m_color_bank == true) ? 0x200 : 0); + const int c = BIT(d2, i) | (BIT(d1, i) << 1); + (m_pixram_sel ? m_tmp_bitmap2 : m_tmp_bitmap1)->pix(y, x + i) = m_pix_color[c] | (m_color_bank ? 0x200 : 0); } } diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp index e97df1fd17f..c19d45b60c5 100644 --- a/src/mame/video/733_asr.cpp +++ b/src/mame/video/733_asr.cpp @@ -207,7 +207,7 @@ void asr733_device::linefeed() assert(asr_window_offset_y + asr_window_height <= m_bitmap->height()); for (int y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++) { - std::copy_n(&m_bitmap->pix16(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); + std::copy_n(&m_bitmap->pix(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); draw_scanline8(*m_bitmap, asr_window_offset_x, y, asr_window_width, buf, palette().pens()); } diff --git a/src/mame/video/8080bw.cpp b/src/mame/video/8080bw.cpp index f3df7201358..65c51ba6ebe 100644 --- a/src/mame/video/8080bw.cpp +++ b/src/mame/video/8080bw.cpp @@ -56,9 +56,9 @@ inline void _8080bw_state::set_pixel( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x if (y >= MW8080BW_VCOUNTER_START_NO_VBLANK) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = m_palette->pen_color(color); + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); } } @@ -80,18 +80,16 @@ inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, uint8_t y, uint8_ /* this is needed as this driver doesn't emulate the shift register like mw8080bw does */ void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, int color ) { - uint8_t x; - - for (x = 0; x < 4; x++) + for (uint8_t x = 0; x < 4; x++) { uint8_t y; for (y = MW8080BW_VCOUNTER_START_NO_VBLANK; y != 0; y++) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); } } } @@ -379,9 +377,9 @@ uint32_t _8080bw_state::screen_update_shuttlei(screen_device &screen, bitmap_rgb for (int i = 0; i < 8; i++) { if (m_flip_screen) - bitmap.pix32(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); + bitmap.pix(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); else - bitmap.pix32(y, x|i) = m_palette->pen_color(BIT(data, 7)); + bitmap.pix(y, x|i) = m_palette->pen_color(BIT(data, 7)); data <<= 1; } } @@ -402,7 +400,7 @@ uint32_t _8080bw_state::screen_update_spacecom(screen_device &screen, bitmap_rgb for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); + bitmap.pix(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); data >>= 1; } } diff --git a/src/mame/video/abc1600.cpp b/src/mame/video/abc1600.cpp index 5b9e8919f12..b8b87f295bd 100644 --- a/src/mame/video/abc1600.cpp +++ b/src/mame/video/abc1600.cpp @@ -180,7 +180,7 @@ MC6845_UPDATE_ROW(abc1600_mover_device::crtc_update_row) { int color = ((BIT(data, 15) ^ PIX_POL) && !BLANK) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; data <<= 1; } diff --git a/src/mame/video/abc80.cpp b/src/mame/video/abc80.cpp index 5aa828894cf..c5cf846b425 100644 --- a/src/mame/video/abc80.cpp +++ b/src/mame/video/abc80.cpp @@ -128,7 +128,7 @@ void abc80_state::draw_scanline(bitmap_rgb32 &bitmap, int y) color ^= (cursor & m_blink); color &= blank; - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); data <<= 1; } diff --git a/src/mame/video/abc800.cpp b/src/mame/video/abc800.cpp index 386ba12581c..bc6f3636a9d 100644 --- a/src/mame/video/abc800.cpp +++ b/src/mame/video/abc800.cpp @@ -73,16 +73,16 @@ void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) if (color) { - bool black = bitmap.pix32(y, x) == rgb_t::black(); + bool black = bitmap.pix(y, x) == rgb_t::black(); bool opaque = !BIT(fgctl, 3); if (black || opaque) { - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; + bitmap.pix(y, x) = pen[color]; + bitmap.pix(y, x + 1) = pen[color]; - bitmap.pix32(y + 1, x) = pen[color]; - bitmap.pix32(y + 1, x + 1) = pen[color]; + bitmap.pix(y + 1, x) = pen[color]; + bitmap.pix(y + 1, x + 1) = pen[color]; } } @@ -200,8 +200,8 @@ void abc800m_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) uint16_t fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); int color = (m_fgctl_prom->base()[fgctl_addr] & 0x07) ? 1 : 0; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 2; } @@ -241,7 +241,7 @@ MC6845_UPDATE_ROW( abc800m_state::abc800m_update_row ) if (BIT(data, 7) && de) { - bitmap.pix32(y, x) = fgpen; + bitmap.pix(y, x) = fgpen; } data <<= 1; diff --git a/src/mame/video/abc802.cpp b/src/mame/video/abc802.cpp index 5037c6a69fd..e42d84afc5f 100644 --- a/src/mame/video/abc802.cpp +++ b/src/mame/video/abc802.cpp @@ -127,7 +127,7 @@ MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + bit; int color = (BIT(data, 7) ^ ri) && de; - bitmap.pix32(y, x) = pen[color]; + bitmap.pix(y, x) = pen[color]; data <<= 1; } @@ -139,8 +139,8 @@ MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + (bit << 1); int color = (BIT(data, 7) ^ ri) && de; - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; + bitmap.pix(y, x) = pen[color]; + bitmap.pix(y, x + 1) = pen[color]; data <<= 1; } diff --git a/src/mame/video/abc806.cpp b/src/mame/video/abc806.cpp index f9a8b7209f8..558b217832c 100644 --- a/src/mame/video/abc806.cpp +++ b/src/mame/video/abc806.cpp @@ -310,11 +310,11 @@ MC6845_UPDATE_ROW( abc806_state::abc806_update_row ) int color = BIT(chargen_data, 7) ? fg_color : bg_color; if (!de) color = 0; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; if (e5 || e6) { - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } chargen_data <<= 1; @@ -407,9 +407,9 @@ void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int x = HORIZONTAL_PORCH_HACK + (ABC800_CHAR_WIDTH * 4) - 16 + (sx * 4) + pixel; - if (BIT(dot, 15) || (bitmap.pix32(y, x) == rgb_t::black())) + if (BIT(dot, 15) || (bitmap.pix(y, x) == rgb_t::black())) { - bitmap.pix32(y, x) = pen[(dot >> 12) & 0x07]; + bitmap.pix(y, x) = pen[(dot >> 12) & 0x07]; } dot <<= 4; diff --git a/src/mame/video/advision.cpp b/src/mame/video/advision.cpp index b0eec08439b..3dcbbc11433 100644 --- a/src/mame/video/advision.cpp +++ b/src/mame/video/advision.cpp @@ -96,9 +96,9 @@ uint32_t advision_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = 0; y < 128; y+=2) { if (*led > 0) - bitmap.pix16(30 + y, 85 + x) = --(*led); + bitmap.pix(30 + y, 85 + x) = --(*led); else - bitmap.pix16(30 + y, 85 + x) = 0; + bitmap.pix(30 + y, 85 + x) = 0; led += 256; } diff --git a/src/mame/video/aeroboto.cpp b/src/mame/video/aeroboto.cpp index 50fb751fe95..a7257ddec08 100644 --- a/src/mame/video/aeroboto.cpp +++ b/src/mame/video/aeroboto.cpp @@ -120,9 +120,7 @@ void aeroboto_state::aeroboto_tilecolor_w(offs_t offset, uint8_t data) void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { int x = m_spriteram[offs + 3]; int y = 240 - m_spriteram[offs]; @@ -144,10 +142,9 @@ void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const rectangle splitrect1(0, 255, 0, 39); - const rectangle splitrect2(0, 255, 40, 255); - uint8_t *src_base, *src_colptr, *src_rowptr; - int src_offsx, src_colmask, sky_color, star_color, x, y, i, j, pen; + rectangle const splitrect1(0, 255, 0, 39); + rectangle const splitrect2(0, 255, 40, 255); + int sky_color, star_color; sky_color = star_color = *m_bgcolor << 2; @@ -165,30 +162,30 @@ uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_in bitmap.fill(sky_color, cliprect); // actual scroll speed is unknown but it can be adjusted by changing the SCROLL_SPEED constant - m_sx += (char)(*m_starx - m_ox); + m_sx += char(*m_starx - m_ox); m_ox = *m_starx; - x = m_sx / SCROLL_SPEED; + int const x = m_sx / SCROLL_SPEED; if (*m_vscroll != 0xff) - m_sy += (char)(*m_stary - m_oy); + m_sy += char(*m_stary - m_oy); m_oy = *m_stary; - y = m_sy / SCROLL_SPEED; + int const y = m_sy / SCROLL_SPEED; - src_base = m_stars_rom; + uint8_t const *const src_base = m_stars_rom; - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { - src_offsx = (x + i) & 0xff; - src_colmask = 1 << (src_offsx & 7); + int src_offsx = (x + i) & 0xff; + int const src_colmask = 1 << (src_offsx & 7); src_offsx >>= 3; - src_colptr = src_base + src_offsx; - pen = star_color + ((i + 8) >> 4 & 1); + uint8_t const *const src_colptr = src_base + src_offsx; + int const pen = star_color + ((i + 8) >> 4 & 1); - for (j = 0; j < 256; j++) + for (int j = 0; j < 256; j++) { - src_rowptr = src_colptr + (((y + j) & 0xff) << 5 ); + uint8_t const *const src_rowptr = src_colptr + (((y + j) & 0xff) << 5 ); if (!((unsigned)*src_rowptr & src_colmask)) - bitmap.pix16(j, i) = pen; + bitmap.pix(j, i) = pen; } } } @@ -199,7 +196,7 @@ uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_in bitmap.fill(sky_color, cliprect); } - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) m_bg_tilemap->set_scrollx(y, m_hscroll[y]); // the playfield is part of a splitscreen and should not overlap with status display diff --git a/src/mame/video/aerofgt.cpp b/src/mame/video/aerofgt.cpp index 1fb4a2d8d5f..217de0c076a 100644 --- a/src/mame/video/aerofgt.cpp +++ b/src/mame/video/aerofgt.cpp @@ -640,17 +640,15 @@ void aerofgt_state::aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 & // BOOTLEG void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) { - int x, y, count; - - count = 16; // weird, the bitmap doesn't start at 0? - for (y = 0; y < 256; y++) - for (x = 0; x < 512; x++) + int count = 16; // weird, the bitmap doesn't start at 0? + for (int y = 0; y < 256; y++) + for (int x = 0; x < 512; x++) { int color = m_bitmapram[count] >> 1; /* data is GRB; convert to RGB */ rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f)); - bitmap.pix32(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; + bitmap.pix(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; count++; count &= 0x1ffff; @@ -660,11 +658,9 @@ void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) // BOOTLEG uint32_t aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, scrolly; - m_tilemap[0]->set_scroll_rows(256); - scrolly = m_scrolly[0]; - for (i = 0; i < 256; i++) + int scrolly = m_scrolly[0]; + for (int i = 0; i < 256; i++) m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i] + 22); m_tilemap[0]->set_scrolly(0, scrolly); diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp index 50bfd364300..891d89c25af 100644 --- a/src/mame/video/agat7.cpp +++ b/src/mame/video/agat7.cpp @@ -146,22 +146,18 @@ void agat7video_device::do_io(int offset) void agat7video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { - color = (chardata[y] & (1 << (7-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (7-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -226,26 +222,22 @@ void agat7video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 32; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 32; col++) { - address = m_start_address + col + (row * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + (row * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80); + uint8_t const v = (gfx & 0x80); gfx <<= 1; *(p++) = v ? fg : bg; *(p++) = v ? fg : bg; @@ -256,25 +248,20 @@ void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &b void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row/2) * 0x40); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row/2) * 0x40); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t const v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; @@ -287,25 +274,20 @@ void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 & void agat7video_device::graph_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x20; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x20; col++) { - address = m_start_address + col + ((row/4) * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row/4) * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t const v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; diff --git a/src/mame/video/agat9.cpp b/src/mame/video/agat9.cpp index 9e2f48ba42f..841f69bec26 100644 --- a/src/mame/video/agat9.cpp +++ b/src/mame/video/agat9.cpp @@ -294,33 +294,29 @@ void agat9video_device::do_io(int offset) void agat9video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { - color = (chardata[y] & (1 << (7 - x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (7 - x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -int color_1_p[4] = +static constexpr int color_1_p[4] = { 0, 4, 0, 5 }; -int color_2_p[4][2] = +static constexpr int color_2_p[4][2] = { { 0, 7 }, { 7, 0 }, @@ -392,26 +388,22 @@ void agat9video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b void agat9video_device::graph_update_mono_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 32; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 32; col++) { - address = m_start_address + col + (row * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + (row * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80) >> 7; + uint8_t v = (gfx & 0x80) >> 7; v = color_2_p[palette_index][v]; gfx <<= 1; *(p++) = v ? fg : bg; @@ -423,26 +415,22 @@ void agat9video_device::graph_update_mono_lores(screen_device &screen, bitmap_in void agat9video_device::graph_update_mono_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 64; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 64; col++) { - address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80) >> 7; + uint8_t v = (gfx & 0x80) >> 7; v = color_2_p[palette_index][v]; gfx <<= 1; *(p++) = v ? fg : bg; @@ -451,7 +439,7 @@ void agat9video_device::graph_update_mono_hires(screen_device &screen, bitmap_in } } -int color_4_p[4][4] = +static constexpr int color_4_p[4][4] = { { 0, 1, 2, 4 }, { 7, 1, 2, 4 }, @@ -461,25 +449,20 @@ int color_4_p[4][4] = void agat9video_device::graph_update_color_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { - v = (gfx & 0xc0) >> 6; + uint8_t v = (gfx & 0xc0) >> 6; v = color_4_p[palette_index][v]; gfx <<= 2; *(p++) = v; @@ -491,25 +474,20 @@ void agat9video_device::graph_update_color_hires(screen_device &screen, bitmap_i void agat9video_device::graph_update_color_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row / 2) * 0x40); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; @@ -525,34 +503,29 @@ void agat9video_device::graph_update_color_lores(screen_device &screen, bitmap_i void agat9video_device::plot_text_character_apple(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { code &= 0x3f; if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6 - x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6 - x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -560,25 +533,20 @@ void agat9video_device::plot_text_character_apple(bitmap_ind16 &bitmap, int xpos void agat9video_device::text_update_apple(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address; - uint32_t address; - int fg, bg; - - start_address = m_page2 ? 0x800 : 0x400; + uint32_t const start_address = m_page2 ? 0x800 : 0x400; - fg = color_2_p[palette_index][1]; - bg = color_2_p[palette_index][0]; + int const fg = color_2_p[palette_index][1]; + int const bg = color_2_p[palette_index][0]; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); plot_text_character_apple(bitmap, col * 7, row, 1, m_ram_dev->read(address), m_char_ptr, m_char_size, fg, bg); } @@ -587,13 +555,7 @@ void agat9video_device::text_update_apple(screen_device &screen, bitmap_ind16 &b void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b, va; - int offset; uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; int begincol = 0, endcol = 40; /* sanity checks */ @@ -614,20 +576,20 @@ void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, if (endcol < begincol) return; - va = m_page2 ? 0x4000 : 0x2000; + int const va = m_page2 ? 0x4000 : 0x2000; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = begincol; col < endcol; col++) + for (int col = begincol; col < endcol; col++) { - offset = ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1 + col] = m_ram_dev->read(va + offset); } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); /* * p. 50 of technical manual: @@ -638,17 +600,17 @@ void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, * 4. odd pixels can be 'black', 'green' (2) or 'red' (1) * 5. bit 7 affects color of pixels in this byte. zero = 'blue' or 'red', one = 'purple' or 'green'. */ - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t const w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7 - 1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7 - 1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; } } diff --git a/src/mame/video/airraid_dev.cpp b/src/mame/video/airraid_dev.cpp index 5b02b48a517..4a25c6e99c7 100644 --- a/src/mame/video/airraid_dev.cpp +++ b/src/mame/video/airraid_dev.cpp @@ -176,8 +176,8 @@ void airraid_video_device::mix_layer(screen_device &screen, bitmap_ind16 &bitmap { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_temp_bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &m_temp_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint8_t pix = src[x] & 0xff; diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp index 1194a8d422c..2ff7c7b6fdc 100644 --- a/src/mame/video/amiga.cpp +++ b/src/mame/video/amiga.cpp @@ -705,7 +705,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) if ((scanline & 1) ^ lof) { // lof matches? then render this scanline - dst = &bitmap.pix32(scanline); + dst = &bitmap.pix(scanline); } else { @@ -715,7 +715,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // otherwise just render the contents of the previous frame's scanline int shift = (m_previous_lof == lof) ? 1 : 0; - std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline)); + std::copy_n(&m_flickerfixer.pix(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix(scanline)); return; } } @@ -1026,7 +1026,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // save if (dst != nullptr) - std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline)); + std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix(save_scanline)); #if GUESS_COPPER_OFFSET if (m_screen->frame_number() % 64 == 0 && scanline == 0) diff --git a/src/mame/video/amigaaga.cpp b/src/mame/video/amigaaga.cpp index 46a5d092623..59e99a9bcbc 100644 --- a/src/mame/video/amigaaga.cpp +++ b/src/mame/video/amigaaga.cpp @@ -475,7 +475,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) if ((scanline & 1) ^ lof) { // lof matches? then render this scanline - dst = &bitmap.pix32(scanline); + dst = &bitmap.pix(scanline); } else { @@ -485,7 +485,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) // otherwise just render the contents of the previous frame's scanline int shift = (m_previous_lof == lof) ? 1 : 0; - std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline)); + std::copy_n(&m_flickerfixer.pix(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix(scanline)); return; } } @@ -829,7 +829,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) // save if (dst != nullptr) - std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline)); + std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix(save_scanline)); #if GUESS_COPPER_OFFSET if (m_screen->frame_number() % 64 == 0 && scanline == 0) diff --git a/src/mame/video/ams40041.cpp b/src/mame/video/ams40041.cpp index fc0143efa91..6dacc421a29 100644 --- a/src/mame/video/ams40041.cpp +++ b/src/mame/video/ams40041.cpp @@ -488,10 +488,10 @@ offs_t ams40041_device::get_char_rom_offset() MC6845_UPDATE_ROW( ams40041_device::draw_alpha ) { offs_t char_rom_offset = get_char_rom_offset(); - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); if (get_display_mode(m_vdu_mode) == ALPHA_40) - p = &bitmap.pix32(y + vbp, hbp); + p = &bitmap.pix(y + vbp, hbp); if (y > 199) return; @@ -558,7 +558,7 @@ MC6845_UPDATE_ROW( ams40041_device::draw_graphics_1 ) { if (y > 199) return; - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); for (int column = 0; column < x_count; column++) { @@ -578,7 +578,7 @@ MC6845_UPDATE_ROW( ams40041_device::draw_graphics_2 ) { if (y > 199) return; - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); for (int column = 0; column < x_count; column++) { diff --git a/src/mame/video/apexc.cpp b/src/mame/video/apexc.cpp index 095763b9c40..683e55e642b 100644 --- a/src/mame/video/apexc.cpp +++ b/src/mame/video/apexc.cpp @@ -72,7 +72,7 @@ void apexc_state::draw_led(bitmap_ind16 &bitmap, int x, int y, int state) { for (int yy = 1; yy < 7; yy++) for (int xx = 1; xx < 7; xx++) - bitmap.pix16(y + yy, x + xx) = state ? 2 : 3; + bitmap.pix(y + yy, x + xx) = state ? 2 : 3; } /* write a single char on screen */ @@ -134,7 +134,7 @@ void apexc_state::teletyper_linefeed() assert(teletyper_window_offset_y + teletyper_window_height <= m_bitmap->height()); for (int y = teletyper_window_offset_y; y < teletyper_window_offset_y + teletyper_window_height - teletyper_scroll_step; y++) { - std::copy_n(&m_bitmap->pix16(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); + std::copy_n(&m_bitmap->pix(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); draw_scanline8(*m_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/apollo.cpp b/src/mame/video/apollo.cpp index e4124bab8cd..a1b4c667fbf 100644 --- a/src/mame/video/apollo.cpp +++ b/src/mame/video/apollo.cpp @@ -1563,24 +1563,22 @@ uint32_t apollo_graphics_15i::screen_update(screen_device &screen, bitmap_rgb32 void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *source_ptr = m_image_memory.get(); - int x, y; - uint16_t data, mask; - uint16_t inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; + uint16_t const *source_ptr = m_image_memory.get(); + uint16_t const inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; MLOG1(("screen_update1: size=%0x rowpixels=%d", m_image_memory_size, bitmap.rowpixels())); if ((m_cr1 & CR1_DISP_EN) == 0) { // display is disabled - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { - bitmap.pix32(y, dest++) = 0; + bitmap.pix(y, dest++) = 0; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1588,23 +1586,24 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else if (m_n_planes == 4) { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { uint16_t data0 = source_ptr[0]; uint16_t data1 = source_ptr[m_image_plane_size]; uint16_t data2 = source_ptr[m_image_plane_size * 2]; uint16_t data3 = source_ptr[m_image_plane_size * 3]; source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { + uint16_t data; data = (data0 & mask) ? 1 : 0; data |= (data1 & mask) ? 2 : 0; data |= (data2 & mask) ? 4 : 0; data |= (data3 & mask) ? 8 : 0; - bitmap.pix32(y, dest++) = m_color_lookup_table[data]; + bitmap.pix(y, dest++) = m_color_lookup_table[data]; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1612,10 +1611,10 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else if (m_n_planes == 8) { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { uint16_t data0 = source_ptr[0]; uint16_t data1 = source_ptr[m_image_plane_size]; @@ -1626,8 +1625,9 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & uint16_t data6 = source_ptr[m_image_plane_size * 6]; uint16_t data7 = source_ptr[m_image_plane_size * 7]; source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { + uint16_t data; data = (data0 & mask) ? 1 : 0; data |= (data1 & mask) ? 2 : 0; data |= (data2 & mask) ? 4 : 0; @@ -1636,7 +1636,7 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & data |= (data5 & mask) ? 0x20 : 0; data |= (data6 & mask) ? 0x40 : 0; data |= (data7 & mask) ? 0x80 : 0; - bitmap.pix32(y, dest++) = m_bt458->get_rgb(data); + bitmap.pix(y, dest++) = m_bt458->get_rgb(data); } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1644,15 +1644,15 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else // m_n_planes == 1 { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { - data = *source_ptr++ ^ inverse; - for (mask = 0x8000; mask; mask >>= 1) + uint16_t const data = *source_ptr++ ^ inverse; + for (uint16_t mask = 0x8000; mask; mask >>= 1) { - bitmap.pix32(y, dest++) = data & mask ? 0 : 0x00ffffff; + bitmap.pix(y, dest++) = data & mask ? 0 : 0x00ffffff; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1725,25 +1725,18 @@ void apollo_graphics_15i::device_add_mconfig(machine_config &config) DEFINE_DEVICE_TYPE(APOLLO_GRAPHICS, apollo_graphics_15i, "apollo_graphics_15i", "Apollo Screen") apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, APOLLO_GRAPHICS, tag, owner, clock), - m_screen(*this, VIDEO_SCREEN_TAG), - m_lut_fifo(nullptr), - m_bt458(nullptr) + apollo_graphics_15i(mconfig, APOLLO_GRAPHICS, tag, owner, clock) { } -apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, uint32_t clock, device_type type) : +apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), - m_screen(*this, VIDEO_SCREEN_TAG), - m_lut_fifo(nullptr), - m_bt458(nullptr) + m_screen(*this, VIDEO_SCREEN_TAG) { } apollo_graphics_15i::~apollo_graphics_15i() { - if (m_lut_fifo) global_free(m_lut_fifo); - if (m_bt458) global_free(m_bt458); } //------------------------------------------------- @@ -1798,8 +1791,8 @@ void apollo_graphics_15i::device_start() memset(m_color_lookup_table, 0, sizeof(m_color_lookup_table)); - m_lut_fifo = nullptr; - m_bt458 = nullptr; + m_lut_fifo.reset(); + m_bt458.reset(); } //------------------------------------------------- @@ -1852,12 +1845,9 @@ void apollo_graphics_15i::device_reset() m_buffer_width = 1024; m_buffer_height = 1024; - if (m_lut_fifo) global_free(m_lut_fifo); - if (m_bt458) global_free(m_bt458); + m_lut_fifo = std::make_unique<lut_fifo>(); - m_lut_fifo = global_alloc(lut_fifo); - - m_bt458 = global_alloc(bt458(machine())); + m_bt458 = std::make_unique<bt458>(machine()); m_bt458->start(); m_bt458->reset(); } @@ -1899,7 +1889,7 @@ void apollo_graphics_19i::device_add_mconfig(machine_config &config) DEFINE_DEVICE_TYPE(APOLLO_MONO19I, apollo_graphics_19i, "apollo_graphics_19i", "Apollo 19\" Monochrome Screen") apollo_graphics_19i::apollo_graphics_19i(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - apollo_graphics_15i(mconfig, tag, owner, clock, APOLLO_MONO19I) + apollo_graphics_15i(mconfig, APOLLO_MONO19I, tag, owner, clock) { } diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp index 37e3819052c..5079b7fc449 100644 --- a/src/mame/video/apple2.cpp +++ b/src/mame/video/apple2.cpp @@ -138,6 +138,7 @@ void a2_video_device::device_reset() m_monohgr = false; m_newvideo = 0x01; m_rgbmode = 3; // default to color DHGR + m_monochrome = 0; // TODO: never set, but if left uninitialized could cause the emulation to start in monochrome by accident. Default to color for now } WRITE_LINE_MEMBER(a2_video_device::txt_w) @@ -192,13 +193,8 @@ WRITE_LINE_MEMBER(a2_video_device::an2_w) m_an2 = state; } -void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -207,9 +203,8 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -218,36 +213,30 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp if ((code >= 0x60) && (code <= 0x7f)) { code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; + using std::swap;// and flip the color + std::swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << x)) ? bg : fg; + uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -256,9 +245,8 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -267,91 +255,76 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i if ((code >= 0x60) && (code <= 0x7f)) { code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; + using std::swap;// and flip the color + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (x+1))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (x+1))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } else if (code < 0x40) // inverse: flip FG and BG { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { code &= 0x3f; if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } else if (code < 0x40) // inverse: flip FG and BG { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } if (m_an2) @@ -360,63 +333,52 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 1; x < 8; x++) + for (int x = 1; x < 8; x++) { - color = (chardata[y] & (1 << x)) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << x)) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + ((x-1) * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + ((x-1) * xscale) + i) = color; } } } } -void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -425,9 +387,8 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -437,17 +398,17 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << x)) ? bg : fg; + uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -455,10 +416,7 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, y, x; - uint8_t code; - uint32_t start_address = m_page2 ? 0x0800 : 0x0400; - uint32_t address; + uint32_t const start_address = m_page2 ? 0x0800 : 0x0400; int fg = 0; switch (m_sysconfig & 0x03) @@ -472,37 +430,43 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, /* perform adjustments */ beginrow = (std::max)(beginrow, cliprect.top()); endrow = (std::min)(endrow, cliprect.bottom()); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + const int startcol = (cliprect.left() / 14); + const int stopcol = ((cliprect.right() / 14) + 1); - if (!(m_sysconfig & 0x03)) + //printf("GR: row %d startcol %d stopcol %d left %d right %d\n", beginrow, startcol, stopcol, cliprect.left(), cliprect.right()); + + if (!(m_sysconfig & 0x03)) // color { - for (row = beginrow; row <= endrow; row += 8) + for (int row = startrow; row <= stoprow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = startcol; col < stopcol; col++) { /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; + uint8_t const code = m_ram_ptr[address]; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - if ((row + y) <= endrow) + if (((row + y) >= beginrow) && ((row + y) <= endrow)) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { - bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; + bitmap.pix(row + y, col * 14 + x) = (code >> 0) & 0x0F; } } } - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - if ((row + y) <= endrow) + if (((row + y) >= beginrow) && ((row + y) <= endrow)) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { - bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; + bitmap.pix(row + y, col * 14 + x) = (code >> 4) & 0x0F; } } } @@ -511,59 +475,56 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, } else { - for (row = beginrow; row <= endrow; row += 8) + for (int row = startrow; row <= stoprow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = startcol; col < stopcol; col++) { uint8_t bits; /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; + uint8_t const code = m_ram_ptr[address]; bits = (code >> 0) & 0x0F; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - if ((row + y) <= endrow) + if (((row + y) >= beginrow) && ((row + y) <= endrow)) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { if (col & 1) { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; } else { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; } } } } bits = (code >> 4) & 0x0F; - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - if ((row + y) <= endrow) + if (((row + y) >= beginrow) && ((row + y) <= endrow)) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { if (col & 1) { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; } else { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; } } } } - - if (row == 64) printf("\n"); - } } } @@ -571,10 +532,7 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, y; - uint8_t code, auxcode; - uint32_t start_address = m_page2 ? 0x0800 : 0x0400; - uint32_t address; + uint32_t const start_address = m_page2 ? 0x0800 : 0x0400; static const int aux_colors[16] = { 0, 2, 4, 6, 8, 0xa, 0xc, 0xe, 1, 3, 5, 7, 9, 0xb, 0xd, 0xf }; int fg = 0; @@ -590,160 +548,177 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + const int startcol = (cliprect.left() / 14); + const int stopcol = ((cliprect.right() / 14) + 1); + if (!(m_sysconfig & 0x03)) { - for (row = beginrow; row <= endrow; row += 8) + for (int row = startrow; row <= stoprow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = startcol; col < stopcol; col++) { /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; + uint8_t const code = m_ram_ptr[address]; + uint8_t const auxcode = m_aux_ptr[address]; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); - - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; - *vram++ = (code >> 0) & 0x0F; + if (((row + y) >= beginrow) && ((row + y) <= endrow)) + { + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); + + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + *vram++ = (code >> 0) & 0x0F; + } } - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); - - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; - *vram++ = (code >> 4) & 0x0F; + if (((row + y) >= beginrow) && ((row + y) <= endrow)) + { + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); + + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + *vram++ = (code >> 4) & 0x0F; + } } } } } else { - for (row = beginrow; row <= endrow; row += 8) + for (int row = startrow; row < stoprow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { uint8_t bits, abits; /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; + uint8_t const code = m_ram_ptr[address]; + uint8_t const auxcode = m_aux_ptr[address]; bits = (code >> 0) & 0x0F; abits = (auxcode >> 0) & 0x0F; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); - - if (col & 1) - { - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - } - else + if (((row + y) >= beginrow) && ((row + y) <= endrow)) { - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); + + if (col & 1) + { + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + } + else + { + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + } } } bits = (code >> 4) & 0x0F; abits = (auxcode >> 4) & 0x0F; - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); - - if (col & 1) + if (((row + y) >= beginrow) && ((row + y) <= endrow)) { - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - } - else - { - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = abits & (1 << 3) ? fg : 0; - *vram++ = abits & (1 << 0) ? fg : 0; - *vram++ = abits & (1 << 1) ? fg : 0; - *vram++ = abits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; - *vram++ = bits & (1 << 3) ? fg : 0; - *vram++ = bits & (1 << 0) ? fg : 0; - *vram++ = bits & (1 << 1) ? fg : 0; - *vram++ = bits & (1 << 2) ? fg : 0; + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); + + if (col & 1) + { + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + } + else + { + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = abits & (1 << 3) ? fg : 0; + *vram++ = abits & (1 << 0) ? fg : 0; + *vram++ = abits & (1 << 1) ? fg : 0; + *vram++ = abits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + *vram++ = bits & (1 << 3) ? fg : 0; + *vram++ = bits & (1 << 0) ? fg : 0; + *vram++ = bits & (1 << 1) ? fg : 0; + *vram++ = bits & (1 << 2) ? fg : 0; + } } } } @@ -753,30 +728,22 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address; - uint32_t address; - uint8_t *aux_page = m_ram_ptr; - int fg = 0; - int bg = 0; + uint8_t const *const aux_page = m_aux_ptr ? m_aux_ptr : m_ram_ptr; - if (m_aux_ptr) - { - aux_page = m_aux_ptr; - } - - if (m_80col) - { - start_address = 0x400; - } - else - { - start_address = m_page2 ? 0x800 : 0x400; - } + uint32_t const start_address = m_80col ? 0x400 : m_page2 ? 0x800 : 0x400; beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + const int startcol = (cliprect.left() / 14); + const int stopcol = ((cliprect.right() / 14) + 1); + + //printf("TXT: row %d startcol %d stopcol %d left %d right %d\n", beginrow, startcol, stopcol, cliprect.left(), cliprect.right()); + + int fg = 0; + int bg = 0; switch (m_sysconfig & 0x03) { case 0: case 4: fg = WHITE; break; @@ -785,27 +752,27 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (int row = startrow; row < stoprow; row += 8) { if (m_80col) { - for (col = 0; col < 40; col++) + for (int col = startcol; col < stopcol; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); plot_text_character(bitmap, col * 14, row, 1, aux_page[address], - m_char_ptr, m_char_size, fg, bg); + fg, bg); plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + fg, bg); } } else { - for (col = 0; col < 40; col++) + for (int col = startcol; col < stopcol; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); if (((m_sysconfig & 7) == 4) && (m_dhires)) { u8 tmp = aux_page[address]; @@ -813,8 +780,7 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c bg = tmp & 0xf; } - plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -831,6 +797,11 @@ void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitm beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + const int startcol = (cliprect.left() / 14); + const int stopcol = ((cliprect.right() / 14) + 1); + switch (m_sysconfig & 0x03) { case 0: case 4: fg = WHITE; break; @@ -839,14 +810,13 @@ void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitm case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (row = startrow; row <= stoprow; row += 8) { - for (col = 0; col < 40; col++) + for (col = startcol; col < stopcol; col++) { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -862,6 +832,9 @@ void a2_video_device::text_update_spectrum(screen_device &screen, bitmap_ind16 & beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + switch (m_sysconfig & 0x03) { case 0: fg = WHITE; break; @@ -870,14 +843,13 @@ void a2_video_device::text_update_spectrum(screen_device &screen, bitmap_ind16 & case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (row = startrow; row <= stoprow; row += 8) { for (col = 0; col < 40; col++) { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, bg, fg); + plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], bg, fg); } } } @@ -893,6 +865,9 @@ void a2_video_device::text_update_dodo(screen_device &screen, bitmap_ind16 &bitm beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + switch (m_sysconfig & 0x03) { case 0: fg = WHITE; break; @@ -901,14 +876,13 @@ void a2_video_device::text_update_dodo(screen_device &screen, bitmap_ind16 &bitm case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (row = startrow; row <= stoprow; row += 8) { for (col = 0; col < 40; col++) { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_dodo(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_dodo(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -924,6 +898,9 @@ void a2_video_device::text_update_jplus(screen_device &screen, bitmap_ind16 &bit beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + switch (m_sysconfig & 0x03) { case 0: fg = WHITE; break; @@ -932,14 +909,13 @@ void a2_video_device::text_update_jplus(screen_device &screen, bitmap_ind16 &bit case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (row = startrow; row <= stoprow; row += 8) { for (col = 0; col < 40; col++) { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_jplus(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_jplus(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -955,6 +931,9 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + const int startrow = (beginrow / 8) * 8; + const int stoprow = ((endrow / 8) + 1) * 8; + switch (m_sysconfig & 0x03) { case 0: fg = WHITE; break; @@ -963,30 +942,20 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (row = startrow; row <= stoprow; row += 8) { for (col = 0; col < 40; col++) { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_ultr(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_ultr(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; int mon_type = m_sysconfig & 0x03; - int begincol = 0, endcol = 40; /* sanity checks */ if (beginrow < cliprect.top()) @@ -996,40 +965,29 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co if (endrow < beginrow) return; - // we generate 2 pixels per "column" so adjust - if (begincol < (cliprect.left()/14)) - begincol = (cliprect.left()/14); - if (endcol > (cliprect.right()/14)) - endcol = (cliprect.right()/14); - if (cliprect.right() > 39*14) - endcol = 40; - if (endcol < begincol) - return; - - //printf("HGR draw: page %c, rows %d-%d cols %d-%d\n", m_page2 ? '2' : '1', beginrow, endrow, begincol, endcol); - - vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; - + uint8_t const *const vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = begincol; col < endcol; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); // verified on h/w: setting dhires w/o 80col emulates a rev. 0 Apple ][ with no orange/blue + uint16_t const *artifact_map_ptr; if (m_dhires) { artifact_map_ptr = m_hires_artifact_map.get(); @@ -1054,11 +1012,19 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co switch (mon_type) { case 0: - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; - *(p++) = v; - *(p++) = v; + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) + { + uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + *(p++) = v; + *(p++) = v; + } + else + { + p++; + p++; + } } break; @@ -1068,12 +1034,20 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; - *(p++) = v ? WHITE : BLACK; - *(p++) = v ? WHITE : BLACK; + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) + { + *(p++) = v ? WHITE : BLACK; + *(p++) = v ? WHITE : BLACK; + } + else + { + p++; + p++; + } } if (vram_row[col+1] & 0x80) { @@ -1087,12 +1061,20 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; - *(p++) = v ? GREEN : BLACK; - *(p++) = v ? GREEN : BLACK; + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) + { + *(p++) = v ? GREEN : BLACK; + *(p++) = v ? GREEN : BLACK; + } + else + { + p++; + p++; + } } if (vram_row[col+1] & 0x80) { @@ -1106,18 +1088,27 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; - *(p++) = v ? ORANGE : BLACK; - *(p++) = v ? ORANGE : BLACK; + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) + { + *(p++) = v ? ORANGE : BLACK; + *(p++) = v ? ORANGE : BLACK; + } + else + { + p++; + p++; + } } if (vram_row[col+1] & 0x80) { p--; } break; + } } } @@ -1126,15 +1117,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co // similar to regular A2 except page 2 is at $A000 void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - int mon_type = m_sysconfig & 0x03; + int const mon_type = m_sysconfig & 0x03; /* sanity checks */ if (beginrow < cliprect.top()) @@ -1144,34 +1127,36 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit if (endrow < beginrow) return; - vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + uint8_t const *const vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint16_t const *artifact_map_ptr; switch (mon_type) { case 0: artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -1183,9 +1168,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? WHITE : BLACK; *(p++) = v ? WHITE : BLACK; @@ -1202,9 +1187,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? GREEN : BLACK; *(p++) = v ? GREEN : BLACK; @@ -1221,9 +1206,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? ORANGE : BLACK; *(p++) = v ? ORANGE : BLACK; @@ -1240,17 +1225,11 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram, *vaux; - int row, col, b; - int offset; - uint8_t vram_row[82]; uint16_t v; - uint16_t *p; - uint32_t w; - int page = m_page2 ? 0x4000 : 0x2000; + int const page = m_page2 ? 0x4000 : 0x2000; int mon_type = m_sysconfig & 0x03; - bool bIsRGB = ((m_sysconfig & 7) == 4); - bool bIsRGBMixed = ((bIsRGB) && (m_rgbmode == 1)); + bool const bIsRGB = ((m_sysconfig & 7) == 4); + bool const bIsRGBMixed = ((bIsRGB) && (m_rgbmode == 1)); // IIgs force-monochrome-DHR setting if (m_newvideo & 0x20) @@ -1272,30 +1251,23 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (endrow < beginrow) return; - vram = &m_ram_ptr[page]; - if (m_aux_ptr) - { - vaux = m_aux_ptr; - } - else - { - vaux = vram; - } - vaux += page; + uint8_t const *const vram = &m_ram_ptr[page]; + uint8_t const *const vaux = (m_aux_ptr ? m_aux_ptr : vram) + page; + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+(col*2)+0] = vaux[offset]; vram_row[1+(col*2)+1] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); // RGB DHR 160-wide mode if ((bIsRGB) && (m_rgbmode == 2)) @@ -1303,11 +1275,11 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c mon_type = 4; } - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); /* DHGR pixel layout: @@ -1333,7 +1305,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!(vram_row[col-1] & 0x80)) { - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { v = (tw & 1); tw >>= 1; @@ -1342,7 +1314,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1351,7 +1323,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!(vram_row[col] & 0x80)) { - for (b = 4; b < 7; b++) + for (int b = 4; b < 7; b++) { v = (tw & 1); tw >>= 1; @@ -1360,7 +1332,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 4; b < 7; b++) + for (int b = 4; b < 7; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1372,7 +1344,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if ((bIsRGBMixed) && !(vram_row[col] & 0x80)) { uint32_t tw = (w >> 6); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (tw & 1); tw >>= 1; @@ -1381,7 +1353,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1392,7 +1364,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 1: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1402,7 +1374,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 2: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1412,7 +1384,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 3: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1426,7 +1398,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c { // Center the 480-wide image in the 560-wide display. // Aspect ratio won't be perfect, but it's in range. - for (b = 0; b < 40; b++) + for (int b = 0; b < 40; b++) { *(p++) = BLACK; } @@ -1445,7 +1417,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (mon_type == 4) { - for (b = 0; b < 40; b++) + for (int b = 0; b < 40; b++) { *(p++) = BLACK; } @@ -1490,15 +1462,7 @@ uint32_t a2_video_device::palette_entries() const uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const uint8_t *vram; - uint32_t *scanline; - uint8_t scb, b; - int col, palette; - uint32_t last_pixel = 0, pixel; - int beamy; - uint16_t *a2pixel; - - beamy = cliprect.top(); + int const beamy = cliprect.top(); if (m_newvideo & 0x80) { @@ -1511,24 +1475,24 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & return 0; } - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + uint32_t *const scanline = &bitmap.pix(beamy); + for (int col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; } } else // regular screen area { - int shrline = beamy - BORDER_TOP; + int const shrline = beamy - BORDER_TOP; - scb = m_aux_ptr[0x9D00 + shrline]; - palette = ((scb & 0x0f) << 4); + uint8_t const scb = m_aux_ptr[0x9D00 + shrline]; + int const palette = ((scb & 0x0f) << 4); - vram = &m_aux_ptr[0x2000 + (shrline * 160)]; - scanline = &bitmap.pix32(beamy); + uint8_t const *const vram = &m_aux_ptr[0x2000 + (shrline * 160)]; + uint32_t *const scanline = &bitmap.pix(beamy); // draw left and right borders - for (col = 0; col < BORDER_LEFT; col++) + for (int col = 0; col < BORDER_LEFT; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; scanline[col+BORDER_LEFT+640] = m_GSborder_colors[m_GSborder]; @@ -1536,9 +1500,9 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & if (scb & 0x80) // 640 mode { - for (col = 0; col < 160; col++) + for (int col = 0; col < 160; col++) { - b = vram[col]; + uint8_t const b = vram[col]; scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[palette + 0 + ((b >> 6) & 0x03)]; scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[palette + 4 + ((b >> 4) & 0x03)]; scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[palette + 8 + ((b >> 2) & 0x03)]; @@ -1555,9 +1519,12 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, }; - last_pixel = fillmode_init[scb & 0x1f]; - for (col = 0; col < 160; col++) + uint32_t last_pixel = fillmode_init[scb & 0x1f]; + for (int col = 0; col < 160; col++) { + uint8_t b; + uint32_t pixel; + b = vram[col]; pixel = (b >> 4) & 0x0f; @@ -1588,7 +1555,7 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & /* call legacy Apple II video rendering at scanline 0 to draw into the off-screen buffer */ if (beamy == 0) { - rectangle new_cliprect(0, 559, 0, 191); + rectangle const new_cliprect(0, 559, 0, 191); screen_update_GS_8bit(screen, *m_8bit_graphics, new_cliprect); } @@ -1599,24 +1566,24 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & return 0; } - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + uint32_t *const scanline = &bitmap.pix(beamy); + for (int col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; } } else { - scanline = &bitmap.pix32(beamy); + uint32_t *const scanline = &bitmap.pix(beamy); // draw left and right borders - for (col = 0; col < BORDER_LEFT + 40; col++) + for (int col = 0; col < BORDER_LEFT + 40; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; scanline[col+BORDER_LEFT+600] = m_GSborder_colors[m_GSborder]; } - a2pixel = &m_8bit_graphics->pix16(beamy-(BORDER_TOP+4)); + uint16_t *a2pixel = &m_8bit_graphics->pix(beamy-(BORDER_TOP+4)); for (int x = 0; x < 560; x++) { scanline[40 + BORDER_LEFT + x] = m_GSborder_colors[*a2pixel++]; @@ -1737,10 +1704,8 @@ void a2_video_device::text_updateGS(screen_device &screen, bitmap_ind16 &bitmap, /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_characterGS(bitmap, col * 14, row, 1, aux_page[address], - m_char_ptr, m_char_size, m_GSfg, m_GSbg); - plot_text_characterGS(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - m_char_ptr, m_char_size, m_GSfg, m_GSbg); + plot_text_characterGS(bitmap, col * 14, row, 1, aux_page[address], m_GSfg, m_GSbg); + plot_text_characterGS(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], m_GSfg, m_GSbg); } } else @@ -1749,8 +1714,7 @@ void a2_video_device::text_updateGS(screen_device &screen, bitmap_ind16 &bitmap, { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_characterGS(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, m_GSfg, m_GSbg); + plot_text_characterGS(bitmap, col * 14, row, 2, m_ram_ptr[address], m_GSfg, m_GSbg); } } } diff --git a/src/mame/video/apple2.h b/src/mame/video/apple2.h index a87c2aab6ce..f03fd6a596a 100644 --- a/src/mame/video/apple2.h +++ b/src/mame/video/apple2.h @@ -74,12 +74,12 @@ protected: void init_palette(); private: - void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); - void plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); - void plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); - void plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); - void plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); - void plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); + void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); + void plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); + void plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); + void plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); + void plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); + void plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); }; // device type definition diff --git a/src/mame/video/apple3.cpp b/src/mame/video/apple3.cpp index 5eba4a46a4b..940531d5a72 100644 --- a/src/mame/video/apple3.cpp +++ b/src/mame/video/apple3.cpp @@ -138,26 +138,21 @@ void apple3_state::video_start() void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, col, row, lc; - offs_t offset; - uint8_t ch; - const uint8_t *char_data; - pen_t fg, bg, temp; - uint16_t *dest; - uint8_t *ram = m_ram->pointer(); - uint32_t ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; - int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; - - for (y = beginrow; y <= endrow; y++) + uint8_t const *const ram = m_ram->pointer(); + uint32_t const ram_size = m_ram->size(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + int const beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int const endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; + + for (int y = beginrow; y <= endrow; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); - ch = ram[offset]; + offs_t offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); + uint8_t const ch = ram[offset]; // no color text in emulation mode + pen_t fg, bg; if ((m_flags & VAR_VM0) && (m_via_1_a & 0x40)) { /* color text */ @@ -175,17 +170,17 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) /* inverse? */ if (!(ch & 0x80)) { - temp = fg; - fg = bg; - bg = temp; + using std::swap; + swap(fg, bg); } - char_data = &m_char_mem[(ch & 0x7F) * 8]; + uint8_t const *const char_data = &m_char_mem[(ch & 0x7F) * 8]; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { + int lc; if (m_smoothscr) { // get the offset into the group of 8 lines @@ -196,7 +191,7 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) lc = col; } - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + lc * 2); dest[0] = (char_data[row] & (1 << col)) ? fg : bg; dest[1] = (char_data[row] & (1 << col)) ? fg : bg; } @@ -209,23 +204,20 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, col, row, lc; - offs_t offset; - uint8_t ch; - const uint8_t *char_data; - pen_t fg, bg; - uint16_t *dest; - uint8_t *ram = m_ram->pointer(); - uint32_t ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; - int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; - - for (y = beginrow; y <= endrow; y++) + uint8_t const *const ram = m_ram->pointer(); + uint32_t const ram_size = m_ram->size(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + int const beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int const endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; + + for (int y = beginrow; y <= endrow; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x; + offs_t const offset = ram_size - 0x8000 + text_map[y] + x; + uint8_t ch; + uint8_t const *char_data; + pen_t fg, bg; /* first character */ ch = ram[offset + 0x0000]; @@ -233,10 +225,11 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { + int lc; if (m_smoothscr) { // get the offset into the group of 8 lines @@ -247,7 +240,7 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) lc = col; } - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + lc + 0); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -258,11 +251,11 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { - dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 7); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + col + 7); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -275,37 +268,34 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* hi-res mode: 280x192x2 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info; - uint16_t *ptr; - uint8_t b; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info; if (m_flags & VAR_VM2) pix_info = &ram[m_hgr_map[ly]]; else pix_info = &ram[m_hgr_map[ly] - 0x2000]; - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - b = *(pix_info++); + uint8_t b = *(pix_info++); - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { ptr[0] = ptr[1] = (b & 0x01) ? WHITE : BLACK; ptr += 2; @@ -318,28 +308,24 @@ void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* color hi-res mode: 280x192x16 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info; - const uint8_t *col_info; - uint16_t *ptr; - uint8_t b; - uint16_t fgcolor, bgcolor; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info; + uint8_t const *col_info; if (m_flags & VAR_VM2) { pix_info = &ram[m_hgr_map[ly] + 0x2000]; @@ -350,16 +336,16 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect pix_info = &ram[m_hgr_map[ly] - 0x2000]; col_info = &ram[m_hgr_map[ly]]; } - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - bgcolor = ((*col_info >> 0) & 0x0F) + 16; - fgcolor = ((*col_info >> 4) & 0x0F) + 16; + uint16_t const bgcolor = ((*col_info >> 0) & 0x0F) + 16; + uint16_t const fgcolor = ((*col_info >> 4) & 0x0F) + 16; - b = *pix_info; + uint8_t b = *pix_info; - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { ptr[0] = ptr[1] = (b & 1) ? fgcolor : bgcolor; ptr += 2; @@ -376,27 +362,24 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* super hi-res mode: 560x192x2 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info1; - const uint8_t *pix_info2; - uint16_t *ptr; - uint8_t b1, b2; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info1; + uint8_t const *pix_info2; if (m_flags & VAR_VM2) { pix_info1 = &ram[m_hgr_map[ly] + 0x2000]; @@ -407,20 +390,20 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect pix_info1 = &ram[m_hgr_map[ly] - 0x2000]; pix_info2 = &ram[m_hgr_map[ly]]; } - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - b1 = *(pix_info1++); - b2 = *(pix_info2++); + uint8_t b1 = *(pix_info1++); + uint8_t b2 = *(pix_info2++); - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { *(ptr++) = (b1 & 0x01) ? WHITE : BLACK; b1 >>= 1; } - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { *(ptr++) = (b2 & 0x01) ? WHITE : BLACK; b2 >>= 1; @@ -433,28 +416,26 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect void apple3_state::graphics_chires(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *pen; - uint8_t p1, p2, p3, p4; - int y, i, ly, lyb; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } - pen = &bitmap.pix16(y); - for (i = 0; i < 20; i++) + uint16_t *pen = &bitmap.pix(y); + for (int i = 0; i < 20; i++) { + uint8_t p1, p2, p3, p4; if (m_flags & VAR_VM2) { p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0]; diff --git a/src/mame/video/arcadecl.cpp b/src/mame/video/arcadecl.cpp index 446ebb928a5..aa8ec654940 100644 --- a/src/mame/video/arcadecl.cpp +++ b/src/mame/video/arcadecl.cpp @@ -80,8 +80,8 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -107,12 +107,12 @@ uint32_t sparkz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { const uint16_t *const src = &m_bitmap[256 * y]; - uint16_t *const dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* regenerate the line */ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { - int bits = src[(x - 8) / 2]; + int const bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; dst[x + 1] = bits & 0xff; } diff --git a/src/mame/video/arcadia.cpp b/src/mame/video/arcadia.cpp index 491d30d9556..8940bdbc8ae 100644 --- a/src/mame/video/arcadia.cpp +++ b/src/mame/video/arcadia.cpp @@ -584,7 +584,7 @@ void arcadia_state::draw_sprites() for (j=0,m=0x80; j<8; j++, m>>=1) { if (b & m) - m_bitmap->pix16(y, x + j) = color; + m_bitmap->pix(y, x + j) = color; } } else @@ -594,8 +594,8 @@ void arcadia_state::draw_sprites() { if (b & m) { - m_bitmap->pix16(y, x + j) = color; - m_bitmap->pix16(y+1, x + j) = color; + m_bitmap->pix(y, x + j) = color; + m_bitmap->pix(y+1, x + j) = color; } } } diff --git a/src/mame/video/argus.cpp b/src/mame/video/argus.cpp index 023c5f2bf8b..443f6f5d0a2 100644 --- a/src/mame/video/argus.cpp +++ b/src/mame/video/argus.cpp @@ -719,36 +719,30 @@ void valtric_state::draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con else { m_bg_tilemap[1]->draw(screen, m_mosaicbitmap, cliprect, 0, 0); - { - int step=m_mosaic; - u32 *dest; - int x,y,xx,yy,c=0; - int width = screen.width(); - int height = screen.height(); + int step=m_mosaic; + int c=0; + int width = screen.width(); + int height = screen.height(); - if (m_mosaic<0)step*=-1; + if (m_mosaic<0)step*=-1; - for (y=0;y<width+step;y+=step) - for (x=0;x<height+step;x+=step) - { - if (y < height && x < width) - c=m_mosaicbitmap.pix32(y, x); - - if (m_mosaic<0) - if (y+step-1<height && x+step-1< width) - c = m_mosaicbitmap.pix32(y+step-1, x+step-1); - - for (yy=0;yy<step;yy++) - for (xx=0;xx<step;xx++) - { - if (xx+x < width && yy+y<height) - { - dest=&bitmap.pix32(y+yy, x+xx); - *dest=c; - } - } - } - } + for (int y=0;y<width+step;y+=step) + for (int x=0;x<height+step;x+=step) + { + if (y < height && x < width) + c=m_mosaicbitmap.pix(y, x); + + if (m_mosaic<0) + if (y+step-1<height && x+step-1< width) + c = m_mosaicbitmap.pix(y+step-1, x+step-1); + + for (int yy=0;yy<step;yy++) + for (int xx=0;xx<step;xx++) + { + if (xx+x < width && yy+y<height) + bitmap.pix(y+yy, x+xx) = c; + } + } } } #else @@ -761,33 +755,27 @@ void valtric_state::draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con else { m_bg_tilemap[1]->draw(screen, m_mosaicbitmap, cliprect, 0, 0); - { - u32 *dest; - int x,y,xx,yy,c=0; - int width = screen.width(); - int height = screen.height(); + int c=0; + int width = screen.width(); + int height = screen.height(); - for (y = 0; y < width+step; y += step) - for (x = 0; x < height+step; x += step) - { - if (y < height && x < width) - c = m_mosaicbitmap.pix32(y, x); - - if (m_valtric_mosaic & 0x80) - if (y+step-1 < height && x+step-1 < width) - c = m_mosaicbitmap.pix32(y+step-1, x+step-1); - - for (yy = 0; yy < step; yy++) - for (xx = 0; xx < step; xx++) - { - if (xx+x < width && yy+y < height) - { - dest = &bitmap.pix32(y+yy, x+xx); - *dest = c; - } - } - } - } + for (int y = 0; y < width+step; y += step) + for (int x = 0; x < height+step; x += step) + { + if (y < height && x < width) + c = m_mosaicbitmap.pix(y, x); + + if (m_valtric_mosaic & 0x80) + if (y+step-1 < height && x+step-1 < width) + c = m_mosaicbitmap.pix(y+step-1, x+step-1); + + for (int yy = 0; yy < step; yy++) + for (int xx = 0; xx < step; xx++) + { + if (xx+x < width && yy+y < height) + bitmap.pix(y+yy, x+xx) = c; + } + } } } #endif diff --git a/src/mame/video/armedf.cpp b/src/mame/video/armedf.cpp index 45a9b36f1f8..11995cb029e 100644 --- a/src/mame/video/armedf.cpp +++ b/src/mame/video/armedf.cpp @@ -281,28 +281,24 @@ void armedf_state::armedf_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,g if (ex > sx) { /* skip if inner loop doesn't draw anything */ - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + u8 const *const source = source_base + y_index*gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const destpri = &primap.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const u8 *source = source_base + y_index*gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *destpri = &primap.pix8(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); + if (c != transparent_color) { - int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); - if (c != transparent_color) - { - if (((1 << (destpri[x] & 0x1f)) & pmask) == 0) - dest[x] = pal[c]; - destpri[x] = 0x1f; - } - x_index += xinc; + if (((1 << (destpri[x] & 0x1f)) & pmask) == 0) + dest[x] = pal[c]; + destpri[x] = 0x1f; } - y_index += yinc; + x_index += xinc; } + y_index += yinc; } } } diff --git a/src/mame/video/artmagic.cpp b/src/mame/video/artmagic.cpp index 1060e828688..0fede06b4a5 100644 --- a/src/mame/video/artmagic.cpp +++ b/src/mame/video/artmagic.cpp @@ -334,13 +334,12 @@ void artmagic_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) TMS340X0_SCANLINE_RGB32_CB_MEMBER(artmagic_state::scanline) { offs_t offset = (params->rowaddr << 12) & 0x7ff000; - uint16_t *vram = address_to_vram(&offset); - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *vram = address_to_vram(&offset); + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; vram += offset; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = pens[vram[coladdr++ & 0x1ff] & 0xff]; } diff --git a/src/mame/video/astrocde.cpp b/src/mame/video/astrocde.cpp index 43bb3cb1a97..d89d431a2e6 100644 --- a/src/mame/video/astrocde.cpp +++ b/src/mame/video/astrocde.cpp @@ -256,11 +256,10 @@ void astrocde_state::init_savestate() uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; + uint8_t const *const videoram = m_videoram; uint32_t sparklebase = 0; const int colormask = (m_video_config & AC_MONITOR_BW) ? 0 : 0x1f0; int xystep = 2 - m_video_mode; - int y; /* compute the starting point of sparkle for the current frame */ int width = screen.width(); @@ -270,13 +269,12 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in sparklebase = (screen.frame_number() * (uint64_t)(width * height)) % RNG_PERIOD; /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); int effy = mame_vpos_to_astrocade_vpos(y); uint16_t offset = (effy / xystep) * (80 / xystep); uint32_t sparkleoffs = 0, staroffs = 0; - int x; /* compute the star and sparkle offset at the start of this line */ if (m_video_config & AC_STARS) @@ -288,23 +286,20 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in } /* iterate over groups of 4 pixels */ - for (x = 0; x < 456/4; x += xystep) + for (int x = 0; x < 456/4; x += xystep) { int effx = x - HORZ_OFFSET/4; const uint8_t *colorbase = &m_colors[(effx < m_colorsplit) ? 4 : 0]; - uint8_t data; - int xx; /* select either video data or background data */ - data = (effx >= 0 && effx < 80 && effy >= 0 && effy < m_vblank) ? videoram[offset++] : m_bgdata; + uint8_t data = (effx >= 0 && effx < 80 && effy >= 0 && effy < m_vblank) ? videoram[offset++] : m_bgdata; /* iterate over the 4 pixels */ - for (xx = 0; xx < 4; xx++) + for (int xx = 0; xx < 4; xx++) { uint8_t pixdata = (data >> 6) & 3; int colordata = colorbase[pixdata] << 1; int luma = colordata & 0x0f; - rgb_t color; /* handle stars/sparkle */ if (m_video_config & AC_STARS) @@ -324,7 +319,7 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in if (++sparkleoffs >= RNG_PERIOD) sparkleoffs = 0; } - color = (colordata & colormask) | luma; + rgb_t const color = (colordata & colormask) | luma; /* store the final color to the destination and shift */ *dest++ = color; @@ -341,20 +336,17 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in uint32_t astrocde_state::screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = mame_vpos_to_astrocade_vpos(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); uint16_t offset = m_profpac_vispage * 0x4000 + effy * 80; - int x; /* star with black */ /* iterate over groups of 4 pixels */ - for (x = 0; x < 456/4; x++) + for (int x = 0; x < 456/4; x++) { int effx = x - HORZ_OFFSET/4; diff --git a/src/mame/video/atarig42.cpp b/src/mame/video/atarig42.cpp index b3b8b197ba5..67a50a0478b 100644 --- a/src/mame/video/atarig42.cpp +++ b/src/mame/video/atarig42.cpp @@ -174,23 +174,22 @@ uint32_t atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.left(); - int top = cliprect.top(); - int right = cliprect.right() + 1; - int bottom = cliprect.bottom() + 1; - int x, y; + int const left = cliprect.left(); + int const top = cliprect.top(); + int const right = cliprect.right() + 1; + int const bottom = cliprect.bottom() + 1; /* now blend with the playfield */ - for (y = top; y < bottom; y++) + for (int y = top; y < bottom; y++) { - uint16_t *pf = &bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); - for (x = left; x < right; x++) + uint16_t *const pf = &bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); + for (int x = left; x < right; x++) if (mo[x]) { - int pfpri = pri[x]; - int mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; + int const pfpri = pri[x]; + int const mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; if (mopri >= pfpri) pf[x] = mo[x] & ATARIRLE_DATA_MASK; } diff --git a/src/mame/video/atarigt.cpp b/src/mame/video/atarigt.cpp index 711b792ec6d..490e5376ad2 100644 --- a/src/mame/video/atarigt.cpp +++ b/src/mame/video/atarigt.cpp @@ -486,9 +486,6 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 { bitmap_ind16 &mo_bitmap = m_rle->vram(0); bitmap_ind16 &tm_bitmap = m_rle->vram(1); - uint16_t *cram, *tram; - int color_latch; - int x, y; /* draw the playfield */ m_playfield_tilemap->draw(screen, m_pf_bitmap, cliprect, 0, 0); @@ -497,32 +494,31 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 m_alpha_tilemap->draw(screen, m_an_bitmap, cliprect, 0, 0); /* cache pointers */ - color_latch = m_colorram[0x30000>>1]; - cram = (uint16_t *)&m_colorram[0x00000>>1] + ((color_latch & 0x08) << 10); - tram = (uint16_t *)&m_colorram[0x20000>>1] + ((color_latch & 0x30) << 8); - const pen_t *mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; + int const color_latch = m_colorram[0x30000>>1]; + uint16_t const *const cram = (uint16_t *)&m_colorram[0x00000>>1] + ((color_latch & 0x08) << 10); + uint16_t const *const tram = (uint16_t *)&m_colorram[0x20000>>1] + ((color_latch & 0x30) << 8); + pen_t const *const mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; /* now do the nasty blend */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *an = &m_an_bitmap.pix16(y); - uint16_t *pf = &m_pf_bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint16_t *tm = &tm_bitmap.pix16(y); - uint32_t *dst = &bitmap.pix32(y); + uint16_t const *const an = &m_an_bitmap.pix(y); + uint16_t const *const pf = &m_pf_bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint16_t const *const tm = &tm_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y); /* Primal Rage: no TRAM, slightly different priorities */ if (m_is_primrage) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pfpri = (pf[x] >> 10) & 7; uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; uint8_t mgep = (mopri >= pfpri) && !(pfpri & 4); - uint16_t cra; - uint32_t rgb; /* compute CRA -- unlike T-Mek, MVID11 enforces MO priority and is ignored */ + uint16_t cra; if (an[x] & 0x8f) cra = an[x] & 0xff; else if ((mo[x] & 0x3f) && ((mo[x] & 0x800) || mgep || !(pf[x] & 0x3f))) @@ -532,6 +528,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 cra = cram[cra]; /* compute the result */ + uint32_t rgb; rgb = mram[((cra >> 10) & 0x01f)] & 0xff0000; rgb |= mram[((cra >> 5) & 0x01f)] & 0x00ff00; rgb |= mram[((cra >> 0) & 0x01f)] & 0x0000ff; @@ -548,16 +545,14 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 /* T-Mek: full TRAM and all effects */ else { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint8_t pfpri = (pf[x] >> 10) & 7; - uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; - uint8_t mgep = (mopri >= pfpri) && !(pfpri & 4); - int no_tra = 0, no_cra = 0; - uint16_t cra, tra, mra; - uint32_t rgb; + uint8_t const pfpri = (pf[x] >> 10) & 7; + uint8_t const mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; + uint8_t const mgep = (mopri >= pfpri) && !(pfpri & 4); /* compute CRA/TRA */ + uint16_t cra, tra; if (an[x] & 0x8f) { cra = an[x] & 0xff; @@ -577,9 +572,10 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 tra = tram[tra]; /* compute MRA */ - mra = (tm[x] & 0xe00) << 1; + uint16_t const mra = (tm[x] & 0xe00) << 1; /* turn off CRA/TRA as appropriate */ + int no_tra = 0, no_cra = 0; if (!(pf[x] & 0x1000) && (tra & 0x8000)) no_cra = 1; if (!(!(cra & 0x8000) && (!(pf[x] & 0x1000) || !(pf[x] & 0x3f)))) @@ -590,6 +586,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 tra = 0; /* compute the result */ + uint32_t rgb; rgb = mram[mra | ((cra >> 10) & 0x01f) | ((tra >> 5) & 0x3e0)] & 0xff0000; rgb |= mram[mra | ((cra >> 5) & 0x01f) | ((tra >> 0) & 0x3e0)] & 0x00ff00; rgb |= mram[mra | ((cra >> 0) & 0x01f) | ((tra << 5) & 0x3e0)] & 0x0000ff; diff --git a/src/mame/video/atarigx2.cpp b/src/mame/video/atarigx2.cpp index 870fbbe9b42..c376ac43112 100644 --- a/src/mame/video/atarigx2.cpp +++ b/src/mame/video/atarigx2.cpp @@ -182,19 +182,18 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.left(); - int top = cliprect.top(); - int right = cliprect.right() + 1; - int bottom = cliprect.bottom() + 1; - int x, y; + int const left = cliprect.left(); + int const top = cliprect.top(); + int const right = cliprect.right() + 1; + int const bottom = cliprect.bottom() + 1; /* now blend with the playfield */ - for (y = top; y < bottom; y++) + for (int y = top; y < bottom; y++) { - uint16_t *pf = &bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); - for (x = left; x < right; x++) + uint16_t *const pf = &bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); + for (int x = left; x < right; x++) if (mo[x] && (mo[x] >> ATARIRLE_PRIORITY_SHIFT) >= pri[x]) pf[x] = mo[x] & ATARIRLE_DATA_MASK; } diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp index 3db58a6d8d2..7ceb6e23699 100644 --- a/src/mame/video/atarimo.cpp +++ b/src/mame/video/atarimo.cpp @@ -234,7 +234,7 @@ void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cl // a stop or the end of line. //------------------------------------------------- -void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y) +void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t const *mo, int x, int y) { const uint16_t START_MARKER = ((4 << PRIORITY_SHIFT) | 2); const uint16_t END_MARKER = ((4 << PRIORITY_SHIFT) | 4); diff --git a/src/mame/video/atarimo.h b/src/mame/video/atarimo.h index 2de0270217f..8fc8e2db95d 100644 --- a/src/mame/video/atarimo.h +++ b/src/mame/video/atarimo.h @@ -101,7 +101,7 @@ public: // rendering virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; - void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y); + void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t const *mo, int x, int y); // memory access uint16_t &slipram(int offset) { return m_slipram[offset]; } diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp index 5112e2f8afc..5063ea02590 100644 --- a/src/mame/video/atarirle.cpp +++ b/src/mame/video/atarirle.cpp @@ -606,7 +606,7 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang int current_row = 0; for (int y = sy; y <= ey; y++, sourcey += dy) { - u16 *dest = &bitmap.pix16(y, sx); + u16 *dest = &bitmap.pix(y, sx); int sourcex = dx / 2, rle_end = 0; // loop until we hit the row we're on @@ -665,7 +665,7 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang // clipped case else { - const u16 *end = &bitmap.pix16(y, ex); + const u16 *end = &bitmap.pix(y, ex); int to_be_skipped = pixels_to_skip; // decode the pixels @@ -785,7 +785,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r int current_row = 0; for (int y = sy; y <= ey; y++, sourcey += dy) { - u16 *dest = &bitmap.pix16(y, ex); + u16 *dest = &bitmap.pix(y, ex); int sourcex = dx / 2, rle_end = 0; // loop until we hit the row we're on @@ -844,7 +844,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r // clipped case else { - const u16 *start = &bitmap.pix16(y, sx); + const u16 *start = &bitmap.pix(y, sx); int to_be_skipped = pixels_to_skip; // decode the pixels @@ -989,19 +989,19 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite) for (int ty = sy; ty <= ey; ty++) { - bitmap.pix16(ty, sx) = machine().rand() & 0xff; - bitmap.pix16(ty, ex) = machine().rand() & 0xff; + bitmap.pix(ty, sx) = machine().rand() & 0xff; + bitmap.pix(ty, ex) = machine().rand() & 0xff; } for (int tx = sx; tx <= ex; tx++) { - bitmap.pix16(sy, tx) = machine().rand() & 0xff; - bitmap.pix16(ey, tx) = machine().rand() & 0xff; + bitmap.pix(sy, tx) = machine().rand() & 0xff; + bitmap.pix(ey, tx) = machine().rand() & 0xff; } } while (0); - fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", - code, color, hflip, - x, -scaled_xoffs, (scale * info.width) >> 12, - y, -scaled_yoffs, (scale * info.height) >> 12, scale); + osd_printf_info(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", + code, color, hflip, + x, -scaled_xoffs, (scale * info.width) >> 12, + y, -scaled_yoffs, (scale * info.height) >> 12, scale); } } diff --git a/src/mame/video/atarist.cpp b/src/mame/video/atarist.cpp index 89f0d060ece..093c118f982 100644 --- a/src/mame/video/atarist.cpp +++ b/src/mame/video/atarist.cpp @@ -156,7 +156,7 @@ void st_state::shifter_tick() break; } - m_bitmap.pix32(y, x) = pen; + m_bitmap.pix(y, x) = pen; } @@ -192,7 +192,7 @@ inline void st_state::shifter_load() void st_state::draw_pixel(int x, int y, u32 pen) { if(x < m_bitmap.width() && y < m_bitmap.height()) - m_bitmap.pix32(y, x) = pen; + m_bitmap.pix(y, x) = pen; } void st_state::glue_tick() diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp index 44a7129aff6..8c77c936622 100644 --- a/src/mame/video/atarisy1.cpp +++ b/src/mame/video/atarisy1.cpp @@ -487,8 +487,8 @@ uint32_t atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp index 95c75cfee5b..a3acaa781e2 100644 --- a/src/mame/video/atarisy2.cpp +++ b/src/mame/video/atarisy2.cpp @@ -248,13 +248,13 @@ uint32_t atarisy2_state::screen_update_atarisy2(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; // high priority PF? if ((mopriority + pri[x]) & 2) diff --git a/src/mame/video/aussiebyte.cpp b/src/mame/video/aussiebyte.cpp index faf67b30126..65aceaa2cab 100644 --- a/src/mame/video/aussiebyte.cpp +++ b/src/mame/video/aussiebyte.cpp @@ -166,23 +166,22 @@ u8 aussiebyte_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, u16 ac_cnt, bool a MC6845_UPDATE_ROW( aussiebyte_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,attr; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); ra &= 15; m_cnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = ma + x; - attr = m_aram[mem & 0x7ff]; + u16 mem = ma + x; + u8 attr = m_aram[mem & 0x7ff]; + u8 chr; if (BIT(attr, 7)) chr = m_vram[mem & 0x3fff]; // alpha else chr = m_vram[(mem << 4) | ra]; // gfx - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + u8 gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/video/avigo.cpp b/src/mame/video/avigo.cpp index 5e84eb94e69..9bb5d450ed6 100644 --- a/src/mame/video/avigo.cpp +++ b/src/mame/video/avigo.cpp @@ -78,32 +78,26 @@ void avigo_state::video_start() uint32_t avigo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - int b; - int x; - /* draw avigo display */ - for (y=0; y<AVIGO_SCREEN_HEIGHT; y++) + for (int y=0; y<AVIGO_SCREEN_HEIGHT; y++) { - int by; uint8_t *line_ptr = &m_video_memory[y*(AVIGO_SCREEN_WIDTH>>3)]; - x = 0; - for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) + int x = 0; + for (int by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) { - int px; uint8_t byte = line_ptr[0]; - px = x; - for (b=7; b>=0; b--) + int px = x; + for (int b=7; b>=0; b--) { - bitmap.pix16(y, px) = ((byte>>7) & 0x01); + bitmap.pix(y, px) = ((byte>>7) & 0x01); px++; - byte = byte<<1; + byte <<= 1; } x = px; - line_ptr = line_ptr+1; + line_ptr++; } } return 0; diff --git a/src/mame/video/badlands.cpp b/src/mame/video/badlands.cpp index 9582a100e23..27fd00abf7e 100644 --- a/src/mame/video/badlands.cpp +++ b/src/mame/video/badlands.cpp @@ -114,13 +114,12 @@ uint32_t badlands_state::screen_update_badlands(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not yet verified - */ + // not yet verified if ((mo[x] & atari_motion_objects_device::PRIORITY_MASK) || !(pf[x] & 8)) pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; } diff --git a/src/mame/video/balsente.cpp b/src/mame/video/balsente.cpp index 3b7e65aec1a..ad5737a2db7 100644 --- a/src/mame/video/balsente.cpp +++ b/src/mame/video/balsente.cpp @@ -127,27 +127,25 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip int image = sprite[1] | ((flags & 7) << 8); int ypos = sprite[2] + 17 + BALSENTE_VBEND; int xpos = sprite[3]; - uint8_t *src; - int x, y; /* get a pointer to the source image */ - src = &m_sprite_data[(64 * image) & m_sprite_mask]; + uint8_t const *src = &m_sprite_data[(64 * image) & m_sprite_mask]; if (flags & 0x80) src += 4 * 15; /* loop over y */ - for (y = 0; y < 16; y++, ypos = (ypos + 1) & 255) + for (int y = 0; y < 16; y++, ypos = (ypos + 1) & 255) { if (ypos >= (16 + BALSENTE_VBEND) && ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - const pen_t *pens = &m_palette->pen(m_palettebank_vis * 256); - uint8_t *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; + pen_t const *const pens = &m_palette->pen(m_palettebank_vis * 256); + const uint8_t *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; int currx = xpos; /* standard case */ if (!(flags & 0x40)) { /* loop over x */ - for (x = 0; x < 4; x++, old += 2) + for (int x = 0; x < 4; x++, old += 2) { int ipixel = *src++; int left = ipixel & 0xf0; @@ -155,12 +153,12 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip /* left pixel, combine with the background */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[left | old[0]]; + bitmap.pix(ypos, currx) = pens[left | old[0]]; currx++; /* right pixel, combine with the background */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[right | old[1]]; + bitmap.pix(ypos, currx) = pens[right | old[1]]; currx++; } } @@ -171,7 +169,7 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip src += 4; /* loop over x */ - for (x = 0; x < 4; x++, old += 2) + for (int x = 0; x < 4; x++, old += 2) { int ipixel = *--src; int left = (ipixel << 4) & 0xf0; @@ -179,12 +177,12 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip /* left pixel, combine with the background */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[left | old[0]]; + bitmap.pix(ypos, currx) = pens[left | old[0]]; currx++; /* right pixel, combine with the background */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[right | old[1]]; + bitmap.pix(ypos, currx) = pens[right | old[1]]; currx++; } src += 4; diff --git a/src/mame/video/batman.cpp b/src/mame/video/batman.cpp index eb5b4c27f25..9d9746580ec 100644 --- a/src/mame/video/batman.cpp +++ b/src/mame/video/batman.cpp @@ -120,9 +120,9 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -143,7 +143,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 obscured by high fg playfield pens priority 3 only obscured by bg playfield priority 3 only */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -152,7 +152,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* foreground playfield case */ if (pri[x] & 0x80) { - int pfpriority = (pri[x] >> 2) & 3; + int const pfpriority = (pri[x] >> 2) & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -170,7 +170,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* background playfield case */ else { - int pfpriority = pri[x] & 3; + int const pfpriority = pri[x] & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -192,12 +192,12 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/battlane.cpp b/src/mame/video/battlane.cpp index 83de94e3da9..f9ba9320711 100644 --- a/src/mame/video/battlane.cpp +++ b/src/mame/video/battlane.cpp @@ -69,22 +69,19 @@ void battlane_state::battlane_spriteram_w(offs_t offset, uint8_t data) void battlane_state::battlane_bitmap_w(offs_t offset, uint8_t data) { - int i, orval; - - orval = (~m_video_ctrl >> 1) & 0x07; - + int orval = (~m_video_ctrl >> 1) & 0x07; if (!orval) orval = 7; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (data & 1 << i) { - m_screen_bitmap.pix8(offset % 0x100, (offset / 0x100) * 8 + i) |= orval; + m_screen_bitmap.pix(offset % 0x100, (offset / 0x100) * 8 + i) |= orval; } else { - m_screen_bitmap.pix8(offset % 0x100, (offset / 0x100) * 8 + i) &= ~orval; + m_screen_bitmap.pix(offset % 0x100, (offset / 0x100) * 8 + i) &= ~orval; } } } @@ -207,20 +204,18 @@ void battlane_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre void battlane_state::draw_fg_bitmap( bitmap_ind16 &bitmap ) { - int x, y, data; - - for (y = 0; y < 32 * 8; y++) + for (int y = 0; y < 32 * 8; y++) { - for (x = 0; x < 32 * 8; x++) + for (int x = 0; x < 32 * 8; x++) { - data = m_screen_bitmap.pix8(y, x); + int const data = m_screen_bitmap.pix(y, x); if (data) { if (flip_screen()) - bitmap.pix16(255 - y, 255 - x) = data; + bitmap.pix(255 - y, 255 - x) = data; else - bitmap.pix16(y, x) = data; + bitmap.pix(y, x) = data; } } } diff --git a/src/mame/video/bbc.cpp b/src/mame/video/bbc.cpp index d599169000a..5ba8ced6e97 100644 --- a/src/mame/video/bbc.cpp +++ b/src/mame/video/bbc.cpp @@ -308,7 +308,7 @@ MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) int col = m_trom->get_rgb() ^ ((x_pos == cursor_x) ? 7 : 0); - bitmap.pix32(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); + bitmap.pix(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); } } } @@ -324,7 +324,7 @@ MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) col ^= ((cursor_x != -1 && x_pos >= cursor_x && x_pos < (cursor_x + m_cursor_size)) ? 7 : 0); - bitmap.pix32(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); + bitmap.pix(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); data = (data << 1) | 1; } } diff --git a/src/mame/video/bbusters.cpp b/src/mame/video/bbusters.cpp index 9f9132cf9ff..ffb748fab9a 100644 --- a/src/mame/video/bbusters.cpp +++ b/src/mame/video/bbusters.cpp @@ -137,31 +137,30 @@ void bbusters_state_base::draw_block(screen_device &screen, bitmap_ind16 &dest,i gfx_element *gfx = m_gfxdecode->gfx(bank); pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors()); uint32_t xinc=(m_scale_line_count * 0x10000 ) / size; - uint8_t pixel; - int x_index; int dy=y; - int sx, ex = m_scale_line_count; + int ex = m_scale_line_count; while (m_scale_line_count) { if (dy>=16 && dy<240) { - uint16_t *destline = &dest.pix16(dy); - uint8_t *priorityline = &screen.priority().pix8(dy); + uint16_t *const destline = &dest.pix(dy); + uint8_t *const priorityline = &screen.priority().pix(dy); uint8_t srcline=*m_scale_table_ptr; const uint8_t *srcptr=nullptr; if (!flipy) srcline=size-srcline-1; + int x_index; if (flipx) x_index=(ex-1)*0x10000; else x_index=0; - for (sx=0; sx<size; sx++) { + for (int sx=0; sx<size; sx++) { if ((sx%16)==0) srcptr=get_source_ptr(gfx,sprite,sx,srcline,block); - pixel=*srcptr++; + uint8_t pixel=*srcptr++; if (pixel!=15 && priority > priorityline[(x+(x_index>>16)) & 0x1ff]) { priorityline[(x+(x_index>>16)) & 0x1ff] = priority; diff --git a/src/mame/video/bigevglf.cpp b/src/mame/video/bigevglf.cpp index f7cc450a09f..7b05c7443a2 100644 --- a/src/mame/video/bigevglf.cpp +++ b/src/mame/video/bigevglf.cpp @@ -35,12 +35,11 @@ void bigevglf_state::bigevglf_vidram_addr_w(uint8_t data) void bigevglf_state::bigevglf_vidram_w(offs_t offset, uint8_t data) { - uint32_t x, y, o; - o = m_vidram_bank + offset; + uint32_t o = m_vidram_bank + offset; m_vidram[o + 0x10000 * m_plane_selected] = data; - y = o >>8; - x = (o & 255); - m_tmp_bitmap[m_plane_selected].pix16(y, x) = data; + uint32_t y = o >>8; + uint32_t x = (o & 255); + m_tmp_bitmap[m_plane_selected].pix(y, x) = data; } uint8_t bigevglf_state::bigevglf_vidram_r(offs_t offset) diff --git a/src/mame/video/bking.cpp b/src/mame/video/bking.cpp index 868a648a01e..62cd0dd73d7 100644 --- a/src/mame/video/bking.cpp +++ b/src/mame/video/bking.cpp @@ -291,12 +291,12 @@ WRITE_LINE_MEMBER(bking_state::screen_vblank_bking) m_bg_tilemap->set_scrolly(0, 0); // check for collision - const uint8_t* colmask = memregion("user1")->base() + 8 * m_hit; + uint8_t const *const colmask = memregion("user1")->base() + 8 * m_hit; for (int y = rect.min_y; y <= rect.max_y; y++) { - const uint16_t* p0 = &m_colmap_bg.pix16(y); - const uint16_t* p1 = &m_colmap_ball.pix16(y); + uint16_t const *const p0 = &m_colmap_bg.pix(y); + uint16_t const *const p1 = &m_colmap_ball.pix(y); for (int x = rect.min_x; x <= rect.max_x; x++) { diff --git a/src/mame/video/blockout.cpp b/src/mame/video/blockout.cpp index 1206a755bf5..1e84ca939e8 100644 --- a/src/mame/video/blockout.cpp +++ b/src/mame/video/blockout.cpp @@ -79,7 +79,7 @@ void blockout_state::videoram_w(offs_t offset, u8 data) else color = back | 0x100; - m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix(y, x) = color; } } @@ -96,7 +96,7 @@ u32 blockout_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { const u16 d = m_frontvideoram[((y & 0xff) << 6) + ((x & 0x1ff) >> 3)]; if (d & (1 << (7 - (x & 7)))) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp index e903a2be935..d71c2db6ca0 100644 --- a/src/mame/video/blstroid.cpp +++ b/src/mame/video/blstroid.cpp @@ -152,8 +152,8 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -161,7 +161,7 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in priority address = HPPPMMMM */ - int priaddr = ((pf[x] & 8) << 4) | (pf[x] & 0x70) | ((mo[x] & 0xf0) >> 4); + int const priaddr = ((pf[x] & 8) << 4) | (pf[x] & 0x70) | ((mo[x] & 0xf0) >> 4); if (m_priorityram[priaddr] & 1) pf[x] = mo[x]; } diff --git a/src/mame/video/boogwing.cpp b/src/mame/video/boogwing.cpp index 6668fc3b6d2..5095b54e964 100644 --- a/src/mame/video/boogwing.cpp +++ b/src/mame/video/boogwing.cpp @@ -37,8 +37,7 @@ constexpr u32 sub_blend_r32(u32 d, u32 s, u8 level) */ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y, x; - const pen_t *paldata = &m_deco_ace->pen(0); + pen_t const *const paldata = &m_deco_ace->pen(0); bitmap_ind16 *sprite_bitmap1, *sprite_bitmap2, *alpha_tmap_bitmap; bitmap_ind8* priority_bitmap; @@ -49,21 +48,17 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c alpha_tmap_bitmap = &m_alpha_tmap_bitmap; priority_bitmap = &screen.priority(); - uint32_t* dstline; - uint16_t *srcline1, *srcline2, *srcline3, *tmapline; - uint8_t *srcpriline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top();y<=cliprect.bottom();y++) { - srcline1=&sprite_bitmap1->pix16(y,0); - srcline2=&sprite_bitmap2->pix16(y,0); - srcline3=&alpha_tmap_bitmap->pix16(y,0); - tmapline=&m_temp_bitmap.pix16(y,0); - srcpriline=&priority_bitmap->pix8(y,0); + uint16_t *srcline1=&sprite_bitmap1->pix(y,0); + uint16_t *srcline2=&sprite_bitmap2->pix(y,0); + uint16_t *srcline3=&alpha_tmap_bitmap->pix(y,0); + uint16_t *tmapline=&m_temp_bitmap.pix(y,0); + uint8_t *srcpriline=&priority_bitmap->pix(y,0); - dstline=&bitmap.pix32(y,0); + uint32_t *dstline=&bitmap.pix(y,0); - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix1 = srcline1[x]; uint16_t pix2 = srcline2[x]; diff --git a/src/mame/video/bosco.cpp b/src/mame/video/bosco.cpp index 62b366cebf9..8e7b869c3aa 100644 --- a/src/mame/video/bosco.cpp +++ b/src/mame/video/bosco.cpp @@ -266,16 +266,16 @@ uint32_t bosco_state::screen_update_bosco(screen_device &screen, bitmap_ind16 &b { for (int x = 63; x >= 0; x--) { - bitmap.pix16(y, x + 3) = bitmap.pix16(y, x); - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x + 3) = bitmap.pix(y, x); + bitmap.pix(y, x) = m_palette->black_pen(); } } else { for (int x = 224; x < 288; x++) { - bitmap.pix16(y, x - 3) = bitmap.pix16(y, x); - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x - 3) = bitmap.pix(y, x); + bitmap.pix(y, x) = m_palette->black_pen(); } } } diff --git a/src/mame/video/btoads.cpp b/src/mame/video/btoads.cpp index b891357d00e..a4203790a1d 100644 --- a/src/mame/video/btoads.cpp +++ b/src/mame/video/btoads.cpp @@ -307,10 +307,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) uint16_t *bg0_base = &m_vram_bg0[(fulladdr + (m_yscroll0 << 10)) & 0x3fc00]; uint16_t *bg1_base = &m_vram_bg1[(fulladdr + (m_yscroll1 << 10)) & 0x3fc00]; uint8_t *spr_base = &m_vram_fg_display[fulladdr & 0x3fc00]; - uint32_t *dst = &bitmap.pix32(scanline); + uint32_t *const dst = &bitmap.pix(scanline); const pen_t *pens = m_tlc34076->pens(); int coladdr = fulladdr & 0x3ff; - int x; /* for each scanline, switch off the render mode */ switch (m_screen_control & 3) @@ -324,7 +323,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG0 */ case 0: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -369,7 +368,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG1 */ case 1: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -411,7 +410,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 3. BG0 */ case 2: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -447,7 +446,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG0 */ case 3: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t bg0pix = bg0_base[(coladdr + m_xscroll0) & 0xff]; uint16_t bg1pix = bg1_base[(coladdr + m_xscroll1) & 0xff]; @@ -486,7 +485,6 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) { char name[10]; FILE *f; - int i; while (machine().input().code_pressed(KEYCODE_X)) ; @@ -494,7 +492,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) f = fopen(name, "w"); fprintf(f, "screen_control = %04X\n\n", m_screen_control << 8); - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { uint16_t *base = (i == 0) ? (uint16_t *)m_vram_fg_display : (i == 1) ? m_vram_bg0 : m_vram_bg1; int xscr = (i == 0) ? 0 : (i == 1) ? m_xscroll0 : m_xscroll1; diff --git a/src/mame/video/buggychl.cpp b/src/mame/video/buggychl.cpp index e3c98e953c9..7ac9ed42437 100644 --- a/src/mame/video/buggychl.cpp +++ b/src/mame/video/buggychl.cpp @@ -77,7 +77,7 @@ void buggychl_state::draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) { for (int y = 0; y < 256; y++) for (int x = 0; x < 256; x++) - bitmap.pix16(y, x) = 128 + x / 2; + bitmap.pix(y, x) = 128 + x / 2; } @@ -158,28 +158,21 @@ void buggychl_state::draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ) void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - const uint8_t *gfx; - g_profiler.start(PROFILER_USER1); - gfx = memregion("gfx2")->base(); - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + uint8_t const *const gfx = memregion("gfx2")->base(); + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int sx, sy, flipy, zoom, ch, x, px, y; - const uint8_t *lookup; - const uint8_t *zoomx_rom, *zoomy_rom; + int sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); + int sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); + int flipy = m_spriteram[offs + 1] & 0x40; + int zoom = m_spriteram[offs + 1] & 0x3f; + uint8_t const *const zoomy_rom = gfx + (zoom << 6); + uint8_t const *const zoomx_rom = gfx + 0x2000 + (zoom << 3); - sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); - sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); - flipy = m_spriteram[offs + 1] & 0x40; - zoom = m_spriteram[offs + 1] & 0x3f; - zoomy_rom = gfx + (zoom << 6); - zoomx_rom = gfx + 0x2000 + (zoom << 3); + uint8_t const *const lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { int dy = flip_screen_y() ? (255 - sy - y) : (sy + y); @@ -192,26 +185,23 @@ void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre if (flipy) base_pos ^= 0x38; - px = 0; - for (ch = 0; ch < 4; ch++) + int px = 0; + for (int ch = 0; ch < 4; ch++) { - int pos, code, realflipy; - const uint8_t *pendata; - - pos = base_pos + 2 * ch; - code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); - realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; + int pos = base_pos + 2 * ch; + int code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); + int realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; code += (realflipy ? (charline ^ 7) : charline); - pendata = m_gfxdecode->gfx(1)->get_data(code); + uint8_t const *const pendata = m_gfxdecode->gfx(1)->get_data(code); - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { int col = pendata[x]; if (col) { int dx = flip_screen_x() ? (255 - sx - px) : (sx + px); if ((dx & ~0xff) == 0) - bitmap.pix16(dy, dx) = m_sprite_color_base + col; + bitmap.pix(dy, dx) = m_sprite_color_base + col; } /* the following line is almost certainly wrong */ diff --git a/src/mame/video/busicom.cpp b/src/mame/video/busicom.cpp index 81c0c715f9a..711d1917915 100644 --- a/src/mame/video/busicom.cpp +++ b/src/mame/video/busicom.cpp @@ -1826,10 +1826,10 @@ uint32_t busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind1 for (u8 j = 0; j < 44; j++) { for (u8 b = 0; b < 34; b++) - bitmap.pix16((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; + bitmap.pix((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; for (u8 b = 34; b < 40; b++) - bitmap.pix16((y*44)+j, x*40+b) = 0; + bitmap.pix((y*44)+j, x*40+b) = 0; } } } diff --git a/src/mame/video/capbowl.cpp b/src/mame/video/capbowl.cpp index f39ea193571..0e4faece1ec 100644 --- a/src/mame/video/capbowl.cpp +++ b/src/mame/video/capbowl.cpp @@ -140,8 +140,8 @@ uint32_t capbowl_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* now regenerate the bitmap */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t const *src = &m_tms34061->vram(y); - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const src = &m_tms34061->vram(y); + uint32_t *dest = &bitmap.pix(y); for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/video/carpolo.cpp b/src/mame/video/carpolo.cpp index 7942b6a6eaf..69d6b50713f 100644 --- a/src/mame/video/carpolo.cpp +++ b/src/mame/video/carpolo.cpp @@ -321,8 +321,6 @@ int carpolo_state::check_sprite_sprite_collision(int x1, int y1, int code1, int /* check if the two sprites are even within collision range */ if ((abs(x1 - x2) < SPRITE_WIDTH) && (abs(y1 - y2) < SPRITE_HEIGHT)) { - int x,y; - normalize_coordinates(&x1, &y1, &x2, &y2); m_sprite_sprite_collision_bitmap1->fill(0); @@ -338,10 +336,10 @@ int carpolo_state::check_sprite_sprite_collision(int x1, int y1, int code1, int 0,flipy2, x2,y2); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if ((m_sprite_sprite_collision_bitmap1->pix16(y, x) == 1) && - (m_sprite_sprite_collision_bitmap2->pix16(y, x) == 1)) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if ((m_sprite_sprite_collision_bitmap1->pix(y, x) == 1) && + (m_sprite_sprite_collision_bitmap2->pix(y, x) == 1)) { *col_x = (x1 + x) & 0x0f; *col_y = (y1 + y) & 0x0f; @@ -369,12 +367,8 @@ int carpolo_state::check_sprite_left_goal_collision(int x1, int y1, int code1, i if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) && ((x1 + 16) > LEFT_GOAL_X) && (x1 < (LEFT_GOAL_X + GOAL_WIDTH))) { - int x,y; - int x2,y2; - - - x2 = LEFT_GOAL_X; - y2 = GOAL_Y; + int x2 = LEFT_GOAL_X; + int y2 = GOAL_Y; normalize_coordinates(&x1, &y1, &x2, &y2); @@ -392,11 +386,11 @@ int carpolo_state::check_sprite_left_goal_collision(int x1, int y1, int code1, i x2,y2, 0x20000,0x20000,0); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if (m_sprite_goal_collision_bitmap1->pix16(y, x) == 1) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if (m_sprite_goal_collision_bitmap1->pix(y, x) == 1) { - pen_t pix = m_sprite_goal_collision_bitmap2->pix16(y, x); + pen_t pix = m_sprite_goal_collision_bitmap2->pix(y, x); if (pix == LEFT_GOAL_PEN) { @@ -427,11 +421,8 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) && ((x1 + 16) > RIGHT_GOAL_X) && (x1 < (RIGHT_GOAL_X + GOAL_WIDTH))) { - int x,y; - int x2,y2; - - x2 = RIGHT_GOAL_X; - y2 = GOAL_Y; + int x2 = RIGHT_GOAL_X; + int y2 = GOAL_Y; normalize_coordinates(&x1, &y1, &x2, &y2); @@ -449,11 +440,11 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, x2,y2, 0x20000,0x20000,0); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if (m_sprite_goal_collision_bitmap1->pix16(y, x) == 1) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if (m_sprite_goal_collision_bitmap1->pix(y, x) == 1) { - pen_t pix = m_sprite_goal_collision_bitmap2->pix16(y, x); + pen_t pix = m_sprite_goal_collision_bitmap2->pix(y, x); if (pix == RIGHT_GOAL_PEN) { @@ -477,7 +468,6 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, 2 for collision with horizontal border */ int carpolo_state::check_sprite_border_collision(uint8_t x1, uint8_t y1, int code1, int flipy1) { - uint8_t x,y; int collided = 0; x1 = 240 - x1; @@ -488,9 +478,9 @@ int carpolo_state::check_sprite_border_collision(uint8_t x1, uint8_t y1, int cod 0,flipy1, 0,0); - for (x = 0; x < SPRITE_WIDTH; x++) - for (y = 0; y < SPRITE_HEIGHT; y++) - if (m_sprite_border_collision_bitmap->pix16(y, x) == 1) + for (uint8_t x = 0; x < SPRITE_WIDTH; x++) + for (uint8_t y = 0; y < SPRITE_HEIGHT; y++) + if (m_sprite_border_collision_bitmap->pix(y, x) == 1) { if (((uint8_t)(x1 + x) == LEFT_BORDER) || ((uint8_t)(x1 + x) == RIGHT_BORDER)) diff --git a/src/mame/video/ccastles.cpp b/src/mame/video/ccastles.cpp index 175f7f694d0..4784167e80b 100644 --- a/src/mame/video/ccastles.cpp +++ b/src/mame/video/ccastles.cpp @@ -254,49 +254,47 @@ void ccastles_state::ccastles_bitmode_addr_w(offs_t offset, uint8_t data) uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteaddr = &m_spriteram[m_outlatch[1]->q7_r() * 0x100]; /* BUF1/BUF2 */ - int flip = m_outlatch[1]->q4_r() ? 0xff : 0x00; /* PLAYER2 */ - pen_t black = m_palette->black_pen(); - int x, y, offs; + uint8_t const *const spriteaddr = &m_spriteram[m_outlatch[1]->q7_r() * 0x100]; /* BUF1/BUF2 */ + int const flip = m_outlatch[1]->q4_r() ? 0xff : 0x00; /* PLAYER2 */ + pen_t const black = m_palette->black_pen(); /* draw the sprites */ m_spritebitmap.fill(0x0f, cliprect); - for (offs = 0; offs < 320/2; offs += 4) + for (int offs = 0; offs < 320/2; offs += 4) { - int x = spriteaddr[offs + 3]; - int y = 256 - 16 - spriteaddr[offs + 1]; - int which = spriteaddr[offs]; - int color = spriteaddr[offs + 2] >> 7; + int const x = spriteaddr[offs + 3]; + int const y = 256 - 16 - spriteaddr[offs + 1]; + int const which = spriteaddr[offs]; + int const color = spriteaddr[offs + 2] >> 7; m_gfxdecode->gfx(0)->transpen(m_spritebitmap,cliprect, which, color, flip, flip, x, y, 7); } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* if we're in the VBLANK region, just fill with black */ if (m_syncprom[y] & 1) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } /* non-VBLANK region: merge the sprites and the bitmap */ else { - uint16_t *mosrc = &m_spritebitmap.pix16(y); - int effy = (((y - m_vblank_end) + (flip ? 0 : m_vscroll)) ^ flip) & 0xff; - uint8_t *src; + uint16_t const *const mosrc = &m_spritebitmap.pix(y); /* the "POTATO" chip does some magic here; this is just a guess */ + int effy = (((y - m_vblank_end) + (flip ? 0 : m_vscroll)) ^ flip) & 0xff; if (effy < 24) effy = 24; - src = &m_videoram[effy * 128]; + uint8_t const *const src = &m_videoram[effy * 128]; /* loop over X */ - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) @@ -305,12 +303,11 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in /* otherwise, process normally */ else { - int effx = (m_hscroll + (x ^ flip)) & 255; + int const effx = (m_hscroll + (x ^ flip)) & 255; /* low 4 bits = left pixel, high 4 bits = right pixel */ uint8_t pix = (src[effx / 2] >> ((effx & 1) * 4)) & 0x0f; - uint8_t mopix = mosrc[x]; - uint8_t prindex, prvalue; + uint8_t const mopix = mosrc[x]; /* Inputs to the priority PROM: @@ -323,11 +320,12 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in Bit 1 = MPI Bit 0 = BIT3 */ + uint8_t prindex; prindex = 0x40; prindex |= (mopix & 7) << 2; prindex |= (mopix & 8) >> 2; prindex |= (pix & 8) >> 3; - prvalue = m_priprom[prindex]; + uint8_t const prvalue = m_priprom[prindex]; /* Bit 1 of prvalue selects the low 4 bits of the final pixel */ if (prvalue & 2) diff --git a/src/mame/video/cclimber.cpp b/src/mame/video/cclimber.cpp index d476216a1a8..9da5443bf3f 100644 --- a/src/mame/video/cclimber.cpp +++ b/src/mame/video/cclimber.cpp @@ -691,16 +691,14 @@ uint32_t cclimber_state::screen_update_cclimber(screen_device &screen, bitmap_in uint32_t cclimber_state::screen_update_yamato(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - uint8_t *sky_rom = memregion("user1")->base() + 0x1200; + uint8_t const *const sky_rom = memregion("user1")->base() + 0x1200; - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) { - int j; pen_t pen = YAMATO_SKY_PEN_BASE + sky_rom[(m_flip_x ? 0x80 : 0) + (i >> 1)]; - for (j = 0; j < 0x100; j++) - bitmap.pix16(j, (i - 8) & 0xff) = pen; + for (int j = 0; j < 0x100; j++) + bitmap.pix(j, (i - 8) & 0xff) = pen; } draw_playfield(screen, bitmap, cliprect); diff --git a/src/mame/video/cgc7900.cpp b/src/mame/video/cgc7900.cpp index 4ce2acbd448..90ff7bd702e 100644 --- a/src/mame/video/cgc7900.cpp +++ b/src/mame/video/cgc7900.cpp @@ -159,18 +159,18 @@ void cgc7900_state::draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap) { if (!OVERLAY_CURSOR_BLINK || m_blink) { - bitmap.pix32(y, (sx * 8) + x) = pen[7]; + bitmap.pix(y, (sx * 8) + x) = pen[7]; } } else { if (!BIT(data, x) || (OVERLAY_BLK && OVERLAY_CHARACTER_BLINK && !m_blink)) { - if (OVERLAY_VB) bitmap.pix32(y, (sx * 8) + x) = pen[bg]; + if (OVERLAY_VB) bitmap.pix(y, (sx * 8) + x) = pen[bg]; } else { - if (OVERLAY_VF) bitmap.pix32(y, (sx * 8) + x) = pen[fg]; + if (OVERLAY_VF) bitmap.pix(y, (sx * 8) + x) = pen[fg]; } } } diff --git a/src/mame/video/chaknpop.cpp b/src/mame/video/chaknpop.cpp index 06905c73deb..675b0f3644b 100644 --- a/src/mame/video/chaknpop.cpp +++ b/src/mame/video/chaknpop.cpp @@ -208,9 +208,8 @@ void chaknpop_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { int dx = m_flip_x ? -1 : 1; - int offs, i; - for (offs = 0; offs < 0x2000; offs++) + for (int offs = 0; offs < 0x2000; offs++) { int x = ((offs & 0x1f) << 3) + 7; int y = offs >> 5; @@ -221,7 +220,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec if (!m_flip_y) y = 255 - y; - for (i = 0x80; i > 0; i >>= 1, x += dx) + for (int i = 0x80; i > 0; i >>= 1, x += dx) { pen_t color = 0; @@ -235,11 +234,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec color |= 0x040; // tx mask if (color) - { - pen_t pen = bitmap.pix16(y, x); - pen |= color; - bitmap.pix16(y, x) = pen; - } + bitmap.pix(y, x) |= color; } } } diff --git a/src/mame/video/changela.cpp b/src/mame/video/changela.cpp index 098359b15f4..5c2f57e3f1f 100644 --- a/src/mame/video/changela.cpp +++ b/src/mame/video/changela.cpp @@ -44,12 +44,10 @@ void changela_state::video_start() void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) { - int sx, i; + uint8_t const *const ROM = memregion("user1")->base(); + uint8_t const *const RAM = m_spriteram; - uint8_t* ROM = memregion("user1")->base(); - uint8_t* RAM = m_spriteram; - - for (sx = 0; sx < 256; sx++) + for (int sx = 0; sx < 256; sx++) { int vr = (RAM[sx * 4 + 0] & 0x80) >> 7; int hr = (RAM[sx * 4 + 0] & 0x40) >> 6; @@ -61,27 +59,26 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) if (sy - ypos <= vsize) { - for (i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { - uint32_t A7, A8, rom_addr; - uint8_t counter, data; uint8_t sum = sy - ypos; - counter = i; + uint8_t counter = i; if (hr) counter ^= 0x0f; - A8 = ((tile & 0x02) >> 1) ^ ((hr & hs) ^ hs); - A7 = ((((vr ^ ((sum & 0x10) >> 4)) & ((vsize & 0x10) >> 4)) ^ 0x01) & (tile & 0x01) ) ^ 0x01; - rom_addr = (counter >> 1) | ((sum & 0x0f) << 3) | (A7 << 7) | (A8 << 8) | ((tile >> 2) << 9); + uint32_t A8 = ((tile & 0x02) >> 1) ^ ((hr & hs) ^ hs); + uint32_t A7 = ((((vr ^ ((sum & 0x10) >> 4)) & ((vsize & 0x10) >> 4)) ^ 0x01) & (tile & 0x01) ) ^ 0x01; + uint32_t rom_addr = (counter >> 1) | ((sum & 0x0f) << 3) | (A7 << 7) | (A8 << 8) | ((tile >> 2) << 9); if (vr) rom_addr ^= (0x0f << 3); + uint8_t data; if (counter & 1) data = ROM[rom_addr] & 0x0f; else data = (ROM[rom_addr] & 0xf0) >> 4; if ((data != 0x0f) && (data != 0)) - bitmap.pix16(sy, xpos + i) = data | 0x10; + bitmap.pix(sy, xpos + i) = data | 0x10; if (hs) { @@ -91,7 +88,7 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) data = (ROM[rom_addr ^ 0x100] & 0xf0) >> 4; if ((data != 0x0f) && (data != 0)) - bitmap.pix16(sy, xpos + i + 16) = data | 0x10; + bitmap.pix(sy, xpos + i + 16) = data | 0x10; } } } @@ -106,22 +103,17 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) void changela_state::draw_obj1( bitmap_ind16 &bitmap ) { - int sx, sy; - - uint8_t* ROM = memregion("gfx2")->base(); - uint8_t* RAM = m_videoram; + uint8_t const *const ROM = memregion("gfx2")->base(); + uint8_t const *const RAM = m_videoram; uint8_t reg[4] = { 0 }; /* 4x4-bit registers (U58, U59) */ - uint8_t tile; uint8_t attrib = 0; - for (sy = 0; sy < 256; sy++) + for (int sy = 0; sy < 256; sy++) { - for (sx = 0; sx < 256; sx++) + for (int sx = 0; sx < 256; sx++) { - int c0, c1, col, sum; - /* 11 Bits: H1, H3, H4, H5, H6, H7, V3, V4, V5, V6, V7 */ int ram_addr = ((sx & 0xf8) >> 2) | ((sy & 0xf8) << 3); int tile_addr = RAM[ram_addr]; @@ -129,11 +121,12 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) if (!(RAM[ram_addr + 1] & 0x10) && (sx & 0x04)) /* D4=0 enables latch at U32 */ attrib = RAM[ram_addr + 1]; - tile = ROM[(tile_addr << 4) | ((sx & 0x04) >> 2) | ((sy & 0x07) << 1)]; + uint8_t tile = ROM[(tile_addr << 4) | ((sx & 0x04) >> 2) | ((sy & 0x07) << 1)]; reg[(sx & 0x0c) >> 2] = tile; - sum = (sx & 0x0f) + (attrib & 0x0f); /* 4-bit adder (U45) */ + int sum = (sx & 0x0f) + (attrib & 0x0f); /* 4-bit adder (U45) */ /* Multiplexors (U57) */ + int c0, c1; if ((sum & 0x03) == 0) { c0 = (reg[(sum & 0x0c) >> 2] & 0x08) >> 3; @@ -155,9 +148,9 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) c1 = (reg[(sum & 0x0c) >> 2] & 0x10) >> 4; } - col = c0 | (c1 << 1) | ((attrib & 0xc0) >> 4); + int col = c0 | (c1 << 1) | ((attrib & 0xc0) >> 4); if ((col & 0x07) != 0x07) - bitmap.pix16(sy, sx) = col | 0x20; + bitmap.pix(sy, sx) = col | 0x20; } } } @@ -170,20 +163,17 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) { - int sx, i, j; - - uint8_t* ROM = memregion("user2")->base(); - uint8_t* RAM = m_memory_devices.get() + 0x800; - uint8_t* TILE_ROM = memregion("gfx1")->base(); - uint8_t* TILE_RAM = m_memory_devices.get() + 0x1000; - uint8_t* PROM = memregion("proms")->base(); + uint8_t const *const ROM = memregion("user2")->base(); + uint8_t *const RAM = m_memory_devices.get() + 0x800; + uint8_t const *const TILE_ROM = memregion("gfx1")->base(); + uint8_t const *const TILE_RAM = m_memory_devices.get() + 0x1000; + uint8_t const *const PROM = memregion("proms")->base(); int preload = ((sy < 32) ? 1 : 0); uint8_t math_train[10] = { 0 }; uint8_t pre_train[3] = { 0 }; - uint8_t curr_state = 0; uint8_t prev_state = 0; uint8_t ram_count = 0; @@ -197,12 +187,9 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) m_v_count_river = (m_v_count_river + 1) & 0xff; /* ----- STATE MACHINE ----- */ - for (i = 0; i < 0x20; i++) + for (int i = 0; i < 0x20; i++) { - int rom_addr, ram_addr, ram_a5; - int mux45, mux61; - - curr_state = PROM[i]; + uint8_t curr_state = PROM[i]; /* Update Counters */ if (prev_state & 0x80) @@ -218,11 +205,11 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) if (prev_state & 0x10) hosc = (math_train[8] << 4) | math_train[9]; - rom_addr = m_slopeROM_bank | ((m_v_count_river & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); - ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; - ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); - mux45 = rom_count & 0x01; - mux61 = m_v_count_river & 0x01; + int rom_addr = m_slopeROM_bank | ((m_v_count_river & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); + int ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; + int ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); + int mux45 = rom_count & 0x01; + int mux61 = m_v_count_river & 0x01; switch (curr_state) { @@ -255,7 +242,7 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) /* Shift each item down the train */ if (curr_state & 0x02) { - for (j = 9; j > 0; j--) + for (int j = 9; j > 0; j--) { math_train[j] = math_train[j - 1]; } @@ -276,12 +263,9 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) int tile_h = (math_train[7] & 0x0f) | ((math_train[6] & 0x0f) << 4) | ((math_train[5] & 0x01) << 8); /* Burst of 16 10Mhz Clocks */ - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - int ram_addr, rom_addr; - int col; - - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (h_count > 0xff) { @@ -296,23 +280,21 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else col = (TILE_ROM[rom_addr] & 0xf0) >> 4; - bitmap.pix16(sy, sx) = col; + bitmap.pix(sy, sx) = col; } - for (sx = 16; sx < 256; sx++) + for (int sx = 16; sx < 256; sx++) { - int ram_addr, rom_addr; - int col; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (h_count > 0xff) { @@ -327,15 +309,16 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else col = (TILE_ROM[rom_addr] & 0xf0) >> 4; - bitmap.pix16(sy, sx) = col; + bitmap.pix(sy, sx) = col; } } } @@ -348,17 +331,15 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) { - int sx, i, j; - /* State machine */ - uint8_t* ROM = memregion("user2")->base(); - uint8_t* RAM = m_memory_devices.get() + 0x840 + 0x40 * tree_num; - uint8_t* PROM = memregion("proms")->base(); + uint8_t const *const ROM = memregion("user2")->base(); + uint8_t *const RAM = m_memory_devices.get() + 0x840 + 0x40 * tree_num; + uint8_t const *const PROM = memregion("proms")->base(); /* Tree Data */ - uint8_t* RAM2 = m_tree_ram.get() + 0x20 * tree_num; - uint8_t* TILE_ROM = (tree_num ? (memregion("user3")->base() + 0x1000) : (memregion("gfx1")->base() + 0x2000)); - uint8_t* TILE_RAM = (tree_num ? (memregion("user3")->base()) : (m_memory_devices.get() + 0x1800)); + uint8_t *const RAM2 = m_tree_ram.get() + 0x20 * tree_num; + uint8_t const *const TILE_ROM = (tree_num ? (memregion("user3")->base() + 0x1000) : (memregion("gfx1")->base() + 0x2000)); + uint8_t const *const TILE_RAM = (tree_num ? (memregion("user3")->base()) : (m_memory_devices.get() + 0x1800)); int preload = ((sy < 32) ? 1 : 0); @@ -366,7 +347,6 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) uint8_t pre_train[3] = { 0 }; uint8_t tree_train[3] = { 0 }; - uint8_t curr_state = 0; uint8_t prev_state = 0; uint8_t ram_count = 0; @@ -390,12 +370,9 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) m_v_count_tree = (m_v_count_tree + 1) & 0xff; /* ----- STATE MACHINE ----- */ - for (i = 0; i < 0x20; i++) + for (int i = 0; i < 0x20; i++) { - int rom_addr, ram_addr, ram_a5, ram2_addr; - int mux45, mux61; - - curr_state = PROM[i]; + uint8_t curr_state = PROM[i]; /* Update Counters */ if (prev_state & 0x80) @@ -414,12 +391,12 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) if (prev_state & 0x10) hosc = (math_train[8] << 4) | math_train[9]; - rom_addr = m_slopeROM_bank | ((m_v_count_tree & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); - ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; - ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); - ram2_addr = (ram_count << 1) | ((curr_state & 0x20) >> 5); - mux45 = rom_count & 0x01; - mux61 = m_v_count_tree & 0x01; + int rom_addr = m_slopeROM_bank | ((m_v_count_tree & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); + int ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; + int ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); + int ram2_addr = (ram_count << 1) | ((curr_state & 0x20) >> 5); + int mux45 = rom_count & 0x01; + int mux61 = m_v_count_tree & 0x01; switch(curr_state) { @@ -487,7 +464,7 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) /* Shift each item down the train */ if (curr_state & 0x02) { - for (j = 9; j > 0; j--) + for (int j = 9; j > 0; j--) math_train[j] = math_train[j-1]; } else @@ -507,11 +484,9 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 1; /* Burst of 16 10Mhz clocks */ - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - int ram_addr, rom_addr, col; - - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (h_count > 0xff) { @@ -526,14 +501,15 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); if (!(m_v_count_tree & 0x80) && (m_tree_en & (0x01 << tree_num)) && ((TILE_ROM[rom_addr] & 0xf0) == 0)) m_tree_on[tree_num] = 1; if (m_tree_on[tree_num]) { + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else @@ -543,15 +519,13 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 0; if (col != 0x0f && col != 0x00) - bitmap.pix16(sy, sx) = col | 0x30; + bitmap.pix(sy, sx) = col | 0x30; } } - for (sx = 16; sx < 256; sx++) + for (int sx = 16; sx < 256; sx++) { - int ram_addr, rom_addr, col; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (h_count > 0xff) { @@ -566,14 +540,15 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); if (!(m_v_count_tree & 0x80) && (m_tree_en & (0x01 << tree_num)) && ((TILE_ROM[rom_addr] & 0xf0) == 0)) m_tree_on[tree_num] = 1; if (m_tree_on[tree_num]) { + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else @@ -583,7 +558,7 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 0; if (col != 0x0f && col != 0x00) - bitmap.pix16(sy, sx) = col | 0x30; + bitmap.pix(sy, sx) = col | 0x30; } } @@ -644,7 +619,6 @@ e:|7 6 5 4 3 2 1 0 Hex|/RAMw /RAMr /ROM /AdderOutput AdderInput TrainInputs| TIMER_CALLBACK_MEMBER(changela_state::changela_scanline_callback) { int sy = param; - int sx; /* clear the current scanline first */ const rectangle rect(0, 255, sy, sy); @@ -659,32 +633,32 @@ TIMER_CALLBACK_MEMBER(changela_state::changela_scanline_callback) draw_tree(m_tree1_bitmap, sy, 1); /* Collision Detection */ - for (sx = 1; sx < 256; sx++) + for (int sx = 1; sx < 256; sx++) { - int riv_col, prev_col; - - if ((m_river_bitmap.pix16(sy, sx) == 0x08) - || (m_river_bitmap.pix16(sy, sx) == 0x09) - || (m_river_bitmap.pix16(sy, sx) == 0x0a)) + int riv_col; + if ((m_river_bitmap.pix(sy, sx) == 0x08) + || (m_river_bitmap.pix(sy, sx) == 0x09) + || (m_river_bitmap.pix(sy, sx) == 0x0a)) riv_col = 1; else riv_col = 0; - if ((m_river_bitmap.pix16(sy, sx-1) == 0x08) - || (m_river_bitmap.pix16(sy, sx-1) == 0x09) - || (m_river_bitmap.pix16(sy, sx-1) == 0x0a)) + int prev_col; + if ((m_river_bitmap.pix(sy, sx-1) == 0x08) + || (m_river_bitmap.pix(sy, sx-1) == 0x09) + || (m_river_bitmap.pix(sy, sx-1) == 0x0a)) prev_col = 1; else prev_col = 0; - if (m_obj0_bitmap.pix16(sy, sx) == 0x14) /* Car Outline Color */ + if (m_obj0_bitmap.pix(sy, sx) == 0x14) /* Car Outline Color */ { /* Tree 0 Collision */ - if (m_tree0_bitmap.pix16(sy, sx) != 0) + if (m_tree0_bitmap.pix(sy, sx) != 0) m_tree0_col = 1; /* Tree 1 Collision */ - if (m_tree1_bitmap.pix16(sy, sx) != 0) + if (m_tree1_bitmap.pix(sy, sx) != 0) m_tree1_col = 1; /* Hit Right Bank */ diff --git a/src/mame/video/channelf.cpp b/src/mame/video/channelf.cpp index c9d47bf65fd..9b8d254f79c 100644 --- a/src/mame/video/channelf.cpp +++ b/src/mame/video/channelf.cpp @@ -52,18 +52,16 @@ int channelf_state::recalc_palette_offset(int reg1, int reg2) uint32_t channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,col; - uint16_t ma=0,x; - int palette_offset; + uint16_t ma=0; - for(y = 0; y < 64; y++ ) + for (uint8_t y = 0; y < 64; y++ ) { - uint16_t *p = &bitmap.pix16(y); - palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); + uint16_t *p = &bitmap.pix(y); + int const palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); - for (x = ma; x < ma + 128; x++) + for (uint16_t x = ma; x < ma + 128; x++) { - col = palette_offset+(m_p_videoram[x|(y<<7)]&3); + uint8_t const col = palette_offset+(m_p_videoram[x|(y<<7)]&3); *p++ = colormap[col]; } ma+=128; diff --git a/src/mame/video/cheekyms.cpp b/src/mame/video/cheekyms.cpp index ffbb90db6aa..438084a922d 100644 --- a/src/mame/video/cheekyms.cpp +++ b/src/mame/video/cheekyms.cpp @@ -151,7 +151,6 @@ void cheekyms_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x; int scrolly = ((*m_port_80 >> 3) & 0x07); int flip = *m_port_80 & 0x80; @@ -168,9 +167,9 @@ uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm m_cm_tilemap->draw(screen, *m_bitmap_buffer, cliprect, 0, 0); /* draw the tilemap to the final bitmap applying the scroll to the man character */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int in_man_area; @@ -185,13 +184,13 @@ uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (in_man_area) { - if ((y + scrolly) < 27 * 8 && m_bitmap_buffer->pix16(y + scrolly, x) != 0) - bitmap.pix16(y, x) = m_bitmap_buffer->pix16(y + scrolly, x); + if ((y + scrolly) < 27 * 8 && m_bitmap_buffer->pix(y + scrolly, x) != 0) + bitmap.pix(y, x) = m_bitmap_buffer->pix(y + scrolly, x); } else { - if(m_bitmap_buffer->pix16(y, x) != 0) - bitmap.pix16(y, x) = m_bitmap_buffer->pix16(y, x); + if(m_bitmap_buffer->pix(y, x) != 0) + bitmap.pix(y, x) = m_bitmap_buffer->pix(y, x); } } } diff --git a/src/mame/video/circus.cpp b/src/mame/video/circus.cpp index e70aad8cb83..dfcfeb51ad5 100644 --- a/src/mame/video/circus.cpp +++ b/src/mame/video/circus.cpp @@ -54,35 +54,34 @@ void circus_state::draw_line( bitmap_ind16 &bitmap, const rectangle &cliprect, i if (x1 == x2) for (count = y2; count >= y1; count -= skip) - bitmap.pix16(count, x1) = 1; + bitmap.pix(count, x1) = 1; else for (count = x2; count >= x1; count -= skip) - bitmap.pix16(y1, count) = 1; + bitmap.pix(y1, count) = 1; } void circus_state::draw_sprite_collision( bitmap_ind16 &bitmap, const rectangle &cliprect ) { gfx_element *sprite_gfx = m_gfxdecode->gfx(1); const uint8_t *sprite_data = sprite_gfx->get_data(m_clown_z); - int sx, sy, dx, dy; - int pixel, collision = 0; + int collision = 0; // draw sprite and check collision on a pixel basis - for (sy = 0; sy < 16; sy++) + for (int sy = 0; sy < 16; sy++) { - dy = m_clown_x + sy-1; + int dy = m_clown_x + sy-1; if (dy>=0 && dy<bitmap.height()) { - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - dx = m_clown_y + sx; + int dx = m_clown_y + sx; if (dx>=0 && dx<bitmap.width()) { - pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; + int pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; if (pixel) { - collision |= bitmap.pix16(dy, dx); - bitmap.pix16(dy, dx) = m_palette->pen(pixel); + collision |= bitmap.pix(dy, dx); + bitmap.pix(dy, dx) = m_palette->pen(pixel); } } } diff --git a/src/mame/video/cloak.cpp b/src/mame/video/cloak.cpp index 92208ef7ac4..24dd7a086de 100644 --- a/src/mame/video/cloak.cpp +++ b/src/mame/video/cloak.cpp @@ -178,15 +178,13 @@ void cloak_state::video_start() void cloak_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - pen_t pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; + pen_t const pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; if (pen) - bitmap.pix16(y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen; + bitmap.pix(y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen; } } diff --git a/src/mame/video/cloud9.cpp b/src/mame/video/cloud9.cpp index c3debb52445..bb9cb18ae98 100644 --- a/src/mame/video/cloud9.cpp +++ b/src/mame/video/cloud9.cpp @@ -223,22 +223,21 @@ void cloud9_state::cloud9_bitmode_addr_w(offs_t offset, uint8_t data) uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteaddr = m_spriteram; - int flip = m_videolatch->q5_r() ? 0xff : 0x00; /* PLAYER2 */ - pen_t black = m_palette->black_pen(); - int x, y, offs; + uint8_t const *const spriteaddr = m_spriteram; + int const flip = m_videolatch->q5_r() ? 0xff : 0x00; /* PLAYER2 */ + pen_t const black = m_palette->black_pen(); /* draw the sprites */ m_spritebitmap.fill(0x00, cliprect); - for (offs = 0; offs < 0x20; offs++) + for (int offs = 0; offs < 0x20; offs++) if (spriteaddr[offs + 0x00] != 0) { - int x = spriteaddr[offs + 0x60]; - int y = 256 - 15 - spriteaddr[offs + 0x00]; - int xflip = spriteaddr[offs + 0x40] & 0x80; - int yflip = spriteaddr[offs + 0x40] & 0x40; - int which = spriteaddr[offs + 0x20]; - int color = 0; + int const x = spriteaddr[offs + 0x60]; + int const y = 256 - 15 - spriteaddr[offs + 0x00]; + int const xflip = spriteaddr[offs + 0x40] & 0x80; + int const yflip = spriteaddr[offs + 0x40] & 0x40; + int const which = spriteaddr[offs + 0x20]; + int const color = 0; m_gfxdecode->gfx(0)->transpen(m_spritebitmap,cliprect, which, color, xflip, yflip, x, y, 0); if (x >= 256 - 16) @@ -246,30 +245,28 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* if we're in the VBLANK region, just fill with black */ if (~m_syncprom[y] & 2) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } /* non-VBLANK region: merge the sprites and the bitmap */ else { - uint16_t *mosrc = &m_spritebitmap.pix16(y); - int effy = y ^ flip; - uint8_t *src[2]; + uint16_t const *const mosrc = &m_spritebitmap.pix(y); + int const effy = y ^ flip; /* two videoram arrays */ - src[0] = &m_videoram[0x4000 | (effy * 64)]; - src[1] = &m_videoram[0x0000 | (effy * 64)]; + uint8_t const *const src[2]{ &m_videoram[0x4000 | (effy * 64)], &m_videoram[0x0000 | (effy * 64)] }; /* loop over X */ - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) @@ -278,11 +275,11 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 /* otherwise, process normally */ else { - int effx = x ^ flip; + int const effx = x ^ flip; /* low 4 bits = left pixel, high 4 bits = right pixel */ uint8_t pix = (src[(effx >> 1) & 1][effx / 4] >> ((~effx & 1) * 4)) & 0x0f; - uint8_t mopix = mosrc[x]; + uint8_t const mopix = mosrc[x]; /* sprites have priority if sprite pixel != 0 or some other condition */ if (mopix != 0) diff --git a/src/mame/video/copsnrob.cpp b/src/mame/video/copsnrob.cpp index 109f13fcf9b..5ea31ff2c68 100644 --- a/src/mame/video/copsnrob.cpp +++ b/src/mame/video/copsnrob.cpp @@ -12,16 +12,12 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs, x, y; - /* redrawing the entire display is faster in this case */ - for (offs = m_videoram.bytes(); offs >= 0; offs--) + for (int offs = m_videoram.bytes(); offs >= 0; offs--) { - int sx,sy; - - sx = 31 - (offs % 32); - sy = offs / 32; + int const sx = 31 - (offs % 32); + int const sy = offs / 32; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[offs] & 0x3f,0, @@ -66,7 +62,7 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in care of the problem of displaying multiple beer trucks and of scrolling truck images smoothly off the top of the screen. */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { /* y is going up the screen, but the truck window RAM locations go down the screen. */ @@ -104,27 +100,25 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in They are flickered on/off every frame by the software, so don't play it with frameskip 1 or 3, as they could become invisible */ - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { - int bullet, mask1, mask2, val; - - val = m_bulletsram[x]; + int const val = m_bulletsram[x]; // Check for the most common case if (!(val & 0x0f)) continue; - mask1 = 0x01; - mask2 = 0x10; + int mask1 = 0x01; + int mask2 = 0x10; // Check each bullet - for (bullet = 0; bullet < 4; bullet++) + for (int bullet = 0; bullet < 4; bullet++) { if (val & mask1) { - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) if (m_bulletsram[y] & mask2) - bitmap.pix16(y, 256 - x) = 1; + bitmap.pix(y, 256 - x) = 1; } mask1 <<= 1; diff --git a/src/mame/video/cosmic.cpp b/src/mame/video/cosmic.cpp index f8fa7e1f4e5..12a9f6c6673 100644 --- a/src/mame/video/cosmic.cpp +++ b/src/mame/video/cosmic.cpp @@ -227,9 +227,9 @@ void cosmic_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect if (data & 0x80) { if (flip_screen()) - bitmap.pix16(255-y, 255-x) = pen; + bitmap.pix(255-y, 255-x) = pen; else - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } x++; @@ -308,7 +308,7 @@ void cosmic_state::cosmica_draw_starfield( screen_device &screen, bitmap_ind16 & /* RGB order is reversed -- bit 7=R, 6=G, 5=B */ int col = (map >> 7) | ((map >> 5) & 0x02) | ((map >> 3) & 0x04); - bitmap.pix16(y, x) = col; + bitmap.pix(y, x) = col; } x++; @@ -323,23 +323,20 @@ void cosmic_state::cosmica_draw_starfield( screen_device &screen, bitmap_ind16 & void cosmic_state::devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint8_t y; - uint8_t *horz_PROM = memregion("user2")->base(); - uint8_t *vert_PROM = memregion("user3")->base(); + uint8_t const *const horz_PROM = memregion("user2")->base(); + uint8_t const *const vert_PROM = memregion("user3")->base(); offs_t horz_addr = 0; uint8_t count = 0; uint8_t horz_data = 0; uint8_t vert_data; - for (y = 32; y < 224; y++) + for (int y = 32; y < 224; y++) { uint8_t x = 0; while (1) { - int x1; - /* for the vertical lines, each bit indicates if there should be a line at the x position */ vert_data = vert_PROM[x >> 3]; @@ -356,15 +353,15 @@ void cosmic_state::devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cli if (count == 0) horz_data = horz_PROM[horz_addr++]; - for (x1 = 0; x1 < 8; x1++) + for (int x1 = 0; x1 < 8; x1++) { if (!(vert_data & horz_data & 0x80)) /* NAND gate */ { /* blue */ if (flip_screen()) - bitmap.pix16(255-y, 255-x) = 4; + bitmap.pix(255-y, 255-x) = 4; else - bitmap.pix16(y, x) = 4; + bitmap.pix(y, x) = 4; } horz_data = (horz_data << 1) | 0x01; @@ -481,9 +478,9 @@ void cosmic_state::nomnlnd_draw_background( screen_device &screen, bitmap_ind16 if (color != 0) { if (flip_screen()) - bitmap.pix16(255-y, 255-x) = color; + bitmap.pix(255-y, 255-x) = color; else - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } x++; diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp index 16191c7f57e..1670851c092 100644 --- a/src/mame/video/cps1.cpp +++ b/src/mame/video/cps1.cpp @@ -3145,8 +3145,7 @@ void cps2_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitma void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - uint8_t *stars_rom = m_region_stars->base(); + uint8_t const *const stars_rom = m_region_stars->base(); if (!stars_rom && (m_stars_enabled[0] || m_stars_enabled[1])) { @@ -3158,7 +3157,7 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, if (m_stars_enabled[0]) { - for (offs = 0; offs < m_stars_rom_size / 2; offs++) + for (int offs = 0; offs < m_stars_rom_size / 2; offs++) { int col = stars_rom[8 * offs + 4]; if (col != 0x0f) @@ -3176,14 +3175,14 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0xa00 + col; + bitmap.pix(sy, sx) = 0xa00 + col; } } } if (m_stars_enabled[1]) { - for (offs = 0; offs < m_stars_rom_size / 2; offs++) + for (int offs = 0; offs < m_stars_rom_size / 2; offs++) { int col = stars_rom[8*offs]; if (col != 0x0f) @@ -3201,7 +3200,7 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0x800 + col; + bitmap.pix(sy, sx) = 0x800 + col; } } } diff --git a/src/mame/video/crbaloon.cpp b/src/mame/video/crbaloon.cpp index 2de79bf7b2f..d1da8d7cc97 100644 --- a/src/mame/video/crbaloon.cpp +++ b/src/mame/video/crbaloon.cpp @@ -118,12 +118,12 @@ void crbaloon_state::draw_sprite_and_check_collision(bitmap_ind16 &bitmap) /* draw the current pixel, but check collision first */ if (bit) { - if (bitmap.pix16(sy, sx) & 0x01) + if (bitmap.pix(sy, sx) & 0x01) /* compute the collision address -- the +1 is via observation of the game code, probably wrong for cocktail mode */ m_collision_address = ((((sy ^ 0xff) >> 3) << 5) | ((sx ^ 0xff) >> 3)) + 1; - bitmap.pix16(sy, sx) = (color << 1) | 1; + bitmap.pix(sy, sx) = (color << 1) | 1; } sx = sx + 1; diff --git a/src/mame/video/crgolf.cpp b/src/mame/video/crgolf.cpp index a12e514fc68..43d5bb8802f 100644 --- a/src/mame/video/crgolf.cpp +++ b/src/mame/video/crgolf.cpp @@ -68,13 +68,9 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 { int flip = m_screen_flip; - offs_t offs; - /* for each byte in the video RAM */ - for (offs = 0; offs < VIDEORAM_SIZE / 3; offs++) + for (offs_t offs = 0; offs < VIDEORAM_SIZE / 3; offs++) { - int i; - uint8_t y = (offs & 0x1fe0) >> 5; uint8_t x = (offs & 0x001f) << 3; @@ -92,7 +88,7 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 } /* for each pixel in the byte */ - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { offs_t color; uint8_t data_b = 0; @@ -114,7 +110,7 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 if (m_color_select) color = color | 0x10; - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; /* next pixel */ data_a0 = data_a0 << 1; diff --git a/src/mame/video/crt.cpp b/src/mame/video/crt.cpp index 68af26f59ba..d8ee79d1bde 100644 --- a/src/mame/video/crt.cpp +++ b/src/mame/video/crt.cpp @@ -134,19 +134,16 @@ void crt_device::eof() // void crt_device::update(bitmap_ind16 &bitmap) { - int i, p_i; - int y; - //if (m_decay_counter) { /* some time has elapsed: let's update the screen */ - for (y=0; y<m_window_height; y++) + for (int y=0; y<m_window_height; y++) { - uint16_t *line = &bitmap.pix16(y+m_window_offset_y); + uint16_t *const line = &bitmap.pix(y+m_window_offset_y); - p_i = -1; + int p_i = -1; - for (i=m_list_head[y]; (i != -1); i=m_list[i].next) + for (int i=m_list_head[y]; (i != -1); i=m_list[i].next) { crt_point *node = &m_list[i]; int x = (i % m_window_width) + m_window_offset_x; diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp index 243ebd384de..a8327bde897 100644 --- a/src/mame/video/cvs.cpp +++ b/src/mame/video/cvs.cpp @@ -135,13 +135,12 @@ VIDEO_START_MEMBER(cvs_state,cvs) uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 }; - offs_t offs; int scroll[8]; set_pens(); /* draw the background */ - for (offs = 0; offs < 0x0400; offs++) + for (offs_t offs = 0; offs < 0x0400; offs++) { int collision_color = 0x100; uint8_t code = m_video_ram[offs]; @@ -194,63 +193,56 @@ uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitma bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect); /* Bullet Hardware */ - for (offs = 8; offs < 256; offs++ ) + for (offs_t offs = 8; offs < 256; offs++ ) { if (m_bullet_ram[offs] != 0) { - int ct; - for (ct = 0; ct < 4; ct++) + for (int ct = 0; ct < 4; ct++) { int bx = 255 - 7 - m_bullet_ram[offs] - ct; /* Bullet/Object Collision */ - if ((s2636_0_bitmap.pix16(offs, bx) != 0) || - (s2636_1_bitmap.pix16(offs, bx) != 0) || - (s2636_2_bitmap.pix16(offs, bx) != 0)) + if ((s2636_0_bitmap.pix(offs, bx) != 0) || + (s2636_1_bitmap.pix(offs, bx) != 0) || + (s2636_2_bitmap.pix(offs, bx) != 0)) m_collision_register |= 0x08; /* Bullet/Background Collision */ - if (m_palette->pen_indirect(m_scrolled_collision_background.pix16(offs, bx))) + if (m_palette->pen_indirect(m_scrolled_collision_background.pix(offs, bx))) m_collision_register |= 0x80; - bitmap.pix16(offs, bx) = BULLET_STAR_PEN; + bitmap.pix(offs, bx) = BULLET_STAR_PEN; } } } /* mix and copy the S2636 images into the main bitmap, also check for collision */ + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - int y; - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - int x; + int pixel0 = s2636_0_bitmap.pix(y, x); + int pixel1 = s2636_1_bitmap.pix(y, x); + int pixel2 = s2636_2_bitmap.pix(y, x); + + int pixel = pixel0 | pixel1 | pixel2; - for (x = cliprect.left(); x <= cliprect.right(); x++) + if (S2636_IS_PIXEL_DRAWN(pixel)) { - int pixel0 = s2636_0_bitmap.pix16(y, x); - int pixel1 = s2636_1_bitmap.pix16(y, x); - int pixel2 = s2636_2_bitmap.pix16(y, x); + bitmap.pix(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel); - int pixel = pixel0 | pixel1 | pixel2; + /* S2636 vs. S2636 collision detection */ + if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01; + if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; + if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04; - if (S2636_IS_PIXEL_DRAWN(pixel)) + /* S2636 vs. background collision detection */ + if (m_palette->pen_indirect(m_scrolled_collision_background.pix(y, x))) { - bitmap.pix16(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel); - - /* S2636 vs. S2636 collision detection */ - if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01; - if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; - if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04; - - /* S2636 vs. background collision detection */ - if (m_palette->pen_indirect(m_scrolled_collision_background.pix16(y, x))) - { - if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; - if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20; - if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; - } + if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; + if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20; + if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; } } } @@ -275,21 +267,18 @@ void cvs_state::cvs_scroll_stars( ) void cvs_state::cvs_init_stars( ) { int generator = 0; - int x, y; /* precalculate the star background */ m_total_stars = 0; - for (y = 255; y >= 0; y--) + for (int y = 255; y >= 0; y--) { - for (x = 511; x >= 0; x--) + for (int x = 511; x >= 0; x--) { - int bit1, bit2; - generator <<= 1; - bit1 = (~generator >> 17) & 1; - bit2 = (generator >> 5) & 1; + int const bit1 = (~generator >> 17) & 1; + int const bit2 = (generator >> 5) & 1; if (bit1 ^ bit2) generator |= 1; @@ -328,8 +317,8 @@ void cvs_state::cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect y = ~y; if ((y >= cliprect.top()) && (y <= cliprect.bottom()) && - (update_always || (m_palette->pen_indirect(bitmap.pix16(y, x)) == 0))) - bitmap.pix16(y, x) = star_pen; + (update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0))) + bitmap.pix(y, x) = star_pen; } } } diff --git a/src/mame/video/cyberbal.cpp b/src/mame/video/cyberbal.cpp index 053cde7ae86..1f5cb34f233 100644 --- a/src/mame/video/cyberbal.cpp +++ b/src/mame/video/cyberbal.cpp @@ -233,13 +233,12 @@ uint32_t cyberbal_base_state::update_one_screen(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = curmob.first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not verified: logic is all controlled in a PAL - */ + // not verified: logic is all controlled in a PAL pf[x] = mo[x]; } } diff --git a/src/mame/video/cybstorm.cpp b/src/mame/video/cybstorm.cpp index 70c071be563..b27c73824c8 100644 --- a/src/mame/video/cybstorm.cpp +++ b/src/mame/video/cybstorm.cpp @@ -131,13 +131,13 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x]) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -149,7 +149,7 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* foreground playfield case */ if (pri[x] & 0x80) { - int pfpriority = (pri[x] >> 2) & 3; + int const pfpriority = (pri[x] >> 2) & 3; if (mopriority > pfpriority) pf[x] = (mo[x] & atari_motion_objects_device::DATA_MASK) | 0x1000; @@ -158,7 +158,7 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* background playfield case */ else { - int pfpriority = pri[x] & 3; + int const pfpriority = pri[x] & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -177,8 +177,8 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); int count = 0; for (int x = rect->left(); x <= rect->right() || (count && x < bitmap.width()); x++) { diff --git a/src/mame/video/dai.cpp b/src/mame/video/dai.cpp index 13891a8cda9..a5c7488b12a 100644 --- a/src/mame/video/dai.cpp +++ b/src/mame/video/dai.cpp @@ -50,12 +50,11 @@ void dai_state::dai_palette(palette_device &palette) const uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space &space = m_maincpu->space(AS_PROGRAM); - int i, j, k, l; - uint8_t* char_rom = memregion("chargen")->base(); + uint8_t const *const char_rom = memregion("chargen")->base(); - uint16_t dai_video_memory_start = 0xbfff; - uint16_t dai_scan_lines = 604; /* scan lines of PAL tv */ + uint16_t const dai_video_memory_start = 0xbfff; + uint16_t const dai_scan_lines = 604; /* scan lines of PAL tv */ uint16_t current_scan_line = 0; uint16_t current_video_memory_address = dai_video_memory_start; @@ -85,12 +84,8 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c 01 - four colour characters 10 - sixteen colour graphics 11 - sixteen colour characters */ - uint8_t unit_mode; - uint8_t current_data_1, current_data_2; - uint8_t current_colour; - while (current_scan_line < dai_scan_lines) { mode = space.read_byte(current_video_memory_address--); @@ -98,7 +93,7 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c line_repeat_count = mode & 0x0f; horizontal_resolution = (mode & 0x30) >> 4; display_mode = (mode & 0xc0) >> 6; - unit_mode = (colour & 0x40) >> 6; + uint8_t const unit_mode = (colour & 0x40) >> 6; if (colour & 0x80) m_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f; @@ -115,32 +110,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -154,32 +149,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -193,31 +188,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -231,31 +226,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -275,33 +270,33 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -316,33 +311,33 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -357,32 +352,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -396,32 +391,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -440,32 +435,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -479,32 +474,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -518,31 +513,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -556,31 +551,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -598,32 +593,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -637,32 +632,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -676,31 +671,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -713,31 +708,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } diff --git a/src/mame/video/darkmist.cpp b/src/mame/video/darkmist.cpp index 9cc0bbd7d45..4a213bf967d 100644 --- a/src/mame/video/darkmist.cpp +++ b/src/mame/video/darkmist.cpp @@ -103,12 +103,12 @@ void darkmist_state::mix_layer(screen_device &screen, bitmap_ind16 &bitmap, cons { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_temp_bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &m_temp_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t pix = (src[x] & 0xff); - uint16_t real = clut[pix]; + uint16_t const pix = (src[x] & 0xff); + uint16_t const real = clut[pix]; if (!(real & 0x40)) dest[x] = src[x]; diff --git a/src/mame/video/dassault.cpp b/src/mame/video/dassault.cpp index 5d8c4accad8..77e887cea3b 100644 --- a/src/mame/video/dassault.cpp +++ b/src/mame/video/dassault.cpp @@ -31,25 +31,21 @@ void dassault_state::video_start() void dassault_state::mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite_bitmap, const rectangle &cliprect, uint16_t pri, uint16_t primask, uint16_t penbase, uint8_t alpha) { - int y, x; - const pen_t *paldata = &m_palette->pen(0); + pen_t const *const paldata = &m_palette->pen(0); - uint16_t* srcline; - uint32_t* dstline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top(); y<=cliprect.bottom(); y++) { - srcline=&sprite_bitmap->pix16(y,0); - dstline=&bitmap.pix32(y,0); + uint16_t const *const srcline = &sprite_bitmap->pix(y, 0); + uint32_t *const dstline = &bitmap.pix(y, 0); - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left(); x<=cliprect.right(); x++) { uint16_t pix = srcline[x]; if ((pix & primask) != pri) continue; - if (pix&0xf) + if (pix & 0xf) { uint16_t pen = pix&0x1ff; if (pix & 0x800) pen += 0x200; diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp index 02f530d70d1..2f50d3877a3 100644 --- a/src/mame/video/dcheese.cpp +++ b/src/mame/video/dcheese.cpp @@ -6,10 +6,11 @@ **************************************************************************/ - #include "emu.h" #include "includes/dcheese.h" +#include <algorithm> + /************************************* * @@ -116,8 +117,8 @@ u32 dcheese_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co /* update the pixels */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); - u16 *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) & 0x1ff); + u16 *const dest = &bitmap.pix(y); + u16 const *const src = &m_dstbitmap->pix((y + m_blitter_vidparam[0x28/2]) & 0x1ff); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = src[x]; @@ -137,7 +138,7 @@ void dcheese_state::do_clear() { /* clear the requested scanlines */ for (int y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++) - memset(&m_dstbitmap->pix16(y & 0x1ff), 0, DSTBITMAP_WIDTH * 2); + std::fill_n(&m_dstbitmap->pix(y & 0x1ff), DSTBITMAP_WIDTH, 0); /* signal an IRQ when done (timing is just a guess) */ m_signal_irq_timer->adjust(m_screen->scan_period(), 1); @@ -168,7 +169,7 @@ void dcheese_state::do_blit() /* loop over target rows */ for (int y = ystart; y <= yend; y++) { - u16 *dst = &m_dstbitmap->pix16(y & 0x1ff); + u16 *const dst = &m_dstbitmap->pix(y & 0x1ff); /* loop over target columns */ for (int x = xstart; x <= xend; x++) diff --git a/src/mame/video/dday.cpp b/src/mame/video/dday.cpp index b18a56db2bd..71b6c51297d 100644 --- a/src/mame/video/dday.cpp +++ b/src/mame/video/dday.cpp @@ -302,19 +302,17 @@ uint32_t dday_state::screen_update_dday(screen_device &screen, bitmap_ind16 &bit if (m_sl_enable) { /* apply shadow */ - int x, y; - bitmap_ind16 &sl_bitmap = m_sl_tilemap->pixmap(); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t src_pixel = m_main_bitmap.pix16(y, x); + uint16_t src_pixel = m_main_bitmap.pix(y, x); - if (sl_bitmap.pix16(y, x) == 0xff) + if (sl_bitmap.pix(y, x) == 0xff) src_pixel += m_palette->entries(); - bitmap.pix16(y, x) = src_pixel; + bitmap.pix(y, x) = src_pixel; } } else diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp index ed80c87ec33..a4ed651c7b8 100644 --- a/src/mame/video/decbac06.cpp +++ b/src/mame/video/decbac06.cpp @@ -316,8 +316,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, src_y += cliprect.top(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *dstpix = &bitmap.pix16(y); - u8 *dstpri = &primap.pix8(y); + u16 *dstpix = &bitmap.pix(y); + u8 *dstpri = &primap.pix(y); if (row_scroll_enabled) src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3] & 0xf)) & (0x1ff >> (control1[3] & 0xf))]; else @@ -332,8 +332,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, if (col_scroll_enabled) column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2] & 0xf)) & (0x3f >> (control1[2] & 0xf))]; - const u16 p = src_bitmap.pix16((src_y + column_offset) & height_mask, src_x & width_mask); - const u8 colpri = flags_bitmap.pix8((src_y + column_offset) & height_mask, src_x & width_mask); + const u16 p = src_bitmap.pix((src_y + column_offset) & height_mask, src_x & width_mask); + const u8 colpri = flags_bitmap.pix((src_y + column_offset) & height_mask, src_x & width_mask); const bool is_drawn = ((flags & TILEMAP_DRAW_OPAQUE) || ((colpri & TILEMAP_PIXEL_LAYER0) && (flags & TILEMAP_DRAW_LAYER0)) || diff --git a/src/mame/video/decmxc06.cpp b/src/mame/video/decmxc06.cpp index 0905a096dd8..c83bf1f5a90 100644 --- a/src/mame/video/decmxc06.cpp +++ b/src/mame/video/decmxc06.cpp @@ -240,7 +240,7 @@ void deco_mxc06_device::device_start() { m_colpri_cb.resolve(); m_flip_screen = false; - m_spritelist = make_unique_clear<struct sprite_t[]>(0x400); + m_spritelist = std::make_unique<sprite_t[]>(0x400); save_item(NAME(m_flip_screen)); } diff --git a/src/mame/video/decmxc06.h b/src/mame/video/decmxc06.h index b774c7fec6e..52649fe902b 100644 --- a/src/mame/video/decmxc06.h +++ b/src/mame/video/decmxc06.h @@ -28,11 +28,11 @@ protected: private: struct sprite_t { - int height; - u32 code[8], colour; - int x[8], y[8]; - bool flipx, flipy; - u32 pri_mask; + int height = 0; + u32 code[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }, colour = 0; + int x[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }, y[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + bool flipx = false, flipy = false; + u32 pri_mask = 0; }; colpri_cb_delegate m_colpri_cb; bool m_flip_screen; diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index 497ccc1bb37..39564a86c9d 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -494,21 +494,21 @@ void deco16ic_device::custom_tilemap_draw( else column_offset = 0; - u16 p = src_bitmap0->pix16((src_y + column_offset) & height_mask, src_x); - u8 f = src_flagsmap0->pix8((src_y + column_offset) & height_mask, src_x); + u16 p = src_bitmap0->pix((src_y + column_offset) & height_mask, src_x); + u8 f = src_flagsmap0->pix((src_y + column_offset) & height_mask, src_x); if (src_bitmap1) { - f |= src_flagsmap1->pix8((src_y + column_offset) & height_mask, src_x) & ~TILEMAP_DRAW_CATEGORY_MASK; + f |= src_flagsmap1->pix((src_y + column_offset) & height_mask, src_x) & ~TILEMAP_DRAW_CATEGORY_MASK; if (!m_mix_cb.isnull()) { - const u16 p2 = src_bitmap1->pix16((src_y + column_offset) & height_mask, src_x); + const u16 p2 = src_bitmap1->pix((src_y + column_offset) & height_mask, src_x); p = m_mix_cb(p, p2); } else { // does boogie wings actually use this, or is the tattoo assassin code correct in this mode? - p |= (src_bitmap1->pix16((src_y + column_offset) & height_mask, src_x) & combine_mask) << combine_shift; + p |= (src_bitmap1->pix((src_y + column_offset) & height_mask, src_x) & combine_mask) << combine_shift; } } src_x = (src_x + 1) & width_mask; @@ -525,7 +525,7 @@ void deco16ic_device::custom_tilemap_draw( else dest[x] = m_gfxdecode->palette().pen(p); if (screen.priority().valid()) { - u8 *pri = &screen.priority().pix8(y); + u8 *const pri = &screen.priority().pix(y); pri[x] = (pri[x] & pmask) | priority; } } diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index afc17a93a69..6a225cc1c42 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -261,11 +261,11 @@ void nslasher_state::mix_nslasher(screen_device &screen, bitmap_rgb32 &bitmap, c /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); - const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); - const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); - const u8* tilemapPri = &screen.priority().pix8(y); - u32* destLine = &bitmap.pix32(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix(y); + const u8* tilemapPri = &screen.priority().pix(y); + u32* destLine = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -465,11 +465,11 @@ void nslasher_state::mix_tattass(screen_device &screen, bitmap_rgb32 &bitmap, co /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); - const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); - const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); - const u8* tilemapPri = &screen.priority().pix8(y); - u32* destLine = &bitmap.pix32(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix(y); + const u8* tilemapPri = &screen.priority().pix(y); + u32* destLine = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/deco_mlc.cpp b/src/mame/video/deco_mlc.cpp index 40631a9622a..9c92baf65ef 100644 --- a/src/mame/video/deco_mlc.cpp +++ b/src/mame/video/deco_mlc.cpp @@ -546,8 +546,8 @@ u32 deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c for (int i = cliprect.top(); i <= cliprect.bottom(); i++) { - u32 *dest = &bitmap.pix32(i); - u8 *pri = &screen.priority().pix8(i); + u32 *dest = &bitmap.pix(i); + u8 *pri = &screen.priority().pix(i); /* printf("%d -", i); diff --git a/src/mame/video/deco_zoomspr.cpp b/src/mame/video/deco_zoomspr.cpp index 3413231f01d..e7c0871d883 100644 --- a/src/mame/video/deco_zoomspr.cpp +++ b/src/mame/video/deco_zoomspr.cpp @@ -119,21 +119,20 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( if( ex>sx ) { /* skip if inner loop doesn't draw anything */ - int y; /* case 1: no alpha */ if (alpha == 0xff) { { - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &temp_bitmap.pix32(y); - uint8_t *pri = &pri_bitmap.pix8(y); + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &temp_bitmap.pix(y); + uint8_t *const pri = &pri_bitmap.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if (c != transparent_color) @@ -161,16 +160,16 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( else { { - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &temp_bitmap.pix32(y); - uint8_t *pri = &pri_bitmap.pix8(y); - uint32_t *tmapcolor = &dest_bmp.pix32(y); + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &temp_bitmap.pix(y); + uint8_t *const pri = &pri_bitmap.pix(y); + uint32_t *const tmapcolor = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if (c != transparent_color) @@ -399,12 +398,12 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *src = &temp_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y); + uint32_t const *const src = &temp_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint32_t srcpix = src[x]; + uint32_t const srcpix = src[x]; if ((srcpix & 0xff000000) == 0xff000000) { diff --git a/src/mame/video/decocass.cpp b/src/mame/video/decocass.cpp index 5cbc3d5e104..a9b0e6ea8ae 100644 --- a/src/mame/video/decocass.cpp +++ b/src/mame/video/decocass.cpp @@ -279,13 +279,13 @@ void decocass_state::draw_special_priority(bitmap_ind16 &bitmap, bitmap_ind8 &pr (dy >= 0 && dy < 64 && dx >= 0 && dx < 64 && objdata1[dy * 64 + dx] != 0)) { pri2 = true; - if (BIT(m_mode_set, 5) && priority.pix8(y, x) == 0) // least priority? - bitmap.pix16(y, x) = color; + if (BIT(m_mode_set, 5) && priority.pix(y, x) == 0) // least priority? + bitmap.pix(y, x) = color; } } if (!pri2) - bitmap.pix16(y, x) |= 0x10; + bitmap.pix(y, x) |= 0x10; } } } @@ -313,7 +313,7 @@ void decocass_state::draw_center(bitmap_ind16 &bitmap, const rectangle &cliprect if (((sy + y) & m_color_center_bot & 3) == (sy & m_color_center_bot & 3)) for (x = 0; x < 256; x++) if (0 != (x & 16) || 0 != (m_center_h_shift_space & 1)) - bitmap.pix16(sy + y, (sx + x) & 255) = color; + bitmap.pix(sy + y, (sx + x) & 255) = color; } } @@ -572,16 +572,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, int missile_y_adjust, int missile_y_adjust_flip_screen, uint8_t *missile_ram, int interleave) { - int i, offs, x; - /* Draw the missiles (16 of them) seemingly with alternating colors * from the E302 latch (color_missiles) */ - for (i = 0, offs = 0; i < 8; i++, offs += 4 * interleave) + for (int i = 0, offs = 0; i < 8; i++, offs += 4 * interleave) { - int sx, sy; - - sy = 255 - missile_ram[offs + 0 * interleave]; - sx = 255 - missile_ram[offs + 2 * interleave]; + int sy = 255 - missile_ram[offs + 0 * interleave]; + int sx = 255 - missile_ram[offs + 2 * interleave]; if (flip_screen()) { sx = 240 - sx; @@ -589,12 +585,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, } sy -= missile_y_adjust; if (sy >= cliprect.top() && sy <= cliprect.bottom()) - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { if (sx >= cliprect.left() && sx <= cliprect.right()) { - bitmap.pix16(sy, sx) = (m_color_missiles & 7) | 8; - priority.pix8(sy, sx) |= 1 << 2; + bitmap.pix(sy, sx) = (m_color_missiles & 7) | 8; + priority.pix(sy, sx) |= 1 << 2; } sx++; } @@ -608,12 +604,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, } sy -= missile_y_adjust; if (sy >= cliprect.top() && sy <= cliprect.bottom()) - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { if (sx >= cliprect.left() && sx <= cliprect.right()) { - bitmap.pix16(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; - priority.pix8(sy, sx) |= 1 << 3; + bitmap.pix(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; + priority.pix(sy, sx) |= 1 << 3; } sx++; } @@ -657,19 +653,17 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, srcbitmap = &m_bg_tilemap_r->pixmap(); } - int y,x; - // printf("m_mode_set %d\n", m_mode_set & 0x3); // technically our y drawing probably shouldn't wrap / mask, but simply draw the 128pixel high 'edge' at the requested position // see note above this funciton - for (y=clip.top(); y<=clip.bottom(); y++) + for (int y=clip.top(); y<=clip.bottom(); y++) { int srcline = (y + scrolly) & 0x1ff; - uint16_t* src = &srcbitmap->pix16(srcline); - uint16_t* dst = &bitmap.pix16(y); + uint16_t const *const src = &srcbitmap->pix(srcline); + uint16_t *const dst = &bitmap.pix(y); - for (x=clip.left(); x<=clip.right(); x++) + for (int x=clip.left(); x<=clip.right(); x++) { int srccol = 0; @@ -683,7 +677,7 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, case 0x03: srccol = (x + scrollx) & 0x1ff; break; // hwy, burnrub etc. } - uint16_t pix = src[srccol]; + uint16_t const pix = src[srccol]; if ((pix & 0x3) || opaque) dst[x] = pix; diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp index 4d6f61a3238..6450af9e97d 100644 --- a/src/mame/video/decodmd1.cpp +++ b/src/mame/video/decodmd1.cpp @@ -261,37 +261,35 @@ void decodmd_type1_device::device_reset() uint32_t decodmd_type1_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { uint8_t ptr = 0; - uint8_t x,y,dot; - uint32_t data1,data2,data3,data4; - uint32_t col; if(m_frameswap) ptr = 0x80; - for(y=0;y<16;y++) // scanline + for(uint8_t y=0;y<16;y++) // scanline { - for(x=0;x<128;x+=64) + for(uint8_t x=0;x<128;x+=64) { - data1 = m_pixels[ptr]; - data2 = m_pixels[ptr+1]; - data3 = m_pixels[ptr+2]; - data4 = m_pixels[ptr+3]; - for(dot=0;dot<64;dot+=2) + uint32_t data1 = m_pixels[ptr]; + uint32_t data2 = m_pixels[ptr+1]; + uint32_t data3 = m_pixels[ptr+2]; + uint32_t data4 = m_pixels[ptr+3]; + for(uint8_t dot=0;dot<64;dot+=2) { + uint32_t col; if((data1 & 0x01) != (data3 & 0x01)) col = rgb_t(0x7f,0x55,0x00); else if (data1 & 0x01) // both are the same, so either high intensity or none at all col = rgb_t(0xff,0xaa,0x00); else col = rgb_t::black(); - bitmap.pix32(y,x+dot) = col; + bitmap.pix(y,x+dot) = col; if((data2 & 0x01) != (data4 & 0x01)) col = rgb_t(0x7f,0x55,0x00); else if (data2 & 0x01) // both are the same, so either high intensity or none at all col = rgb_t(0xff,0xaa,0x00); else col = rgb_t::black(); - bitmap.pix32(y,x+dot+1) = col; + bitmap.pix(y,x+dot+1) = col; data1 >>= 1; data2 >>= 1; data3 >>= 1; diff --git a/src/mame/video/decodmd2.cpp b/src/mame/video/decodmd2.cpp index 2bb975e2f61..81b3cad15ec 100644 --- a/src/mame/video/decodmd2.cpp +++ b/src/mame/video/decodmd2.cpp @@ -102,16 +102,15 @@ TIMER_DEVICE_CALLBACK_MEMBER(decodmd_type2_device::dmd_firq) MC6845_UPDATE_ROW( decodmd_type2_device::crtc_update_row ) { - uint8_t *RAM = m_ram->pointer(); - uint8_t intensity; + uint8_t const *const RAM = m_ram->pointer(); uint16_t addr = (ma & 0xfc00) + ((ma & 0x100)<<2) + (ra << 4); for (int x = 0; x < 128; x += 8) { for (int dot = 0; dot < 8; dot++) { - intensity = ((RAM[addr] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x200] >> (7-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + uint8_t intensity = ((RAM[addr] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x200] >> (7-dot) & 0x01); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } addr++; } diff --git a/src/mame/video/decodmd3.cpp b/src/mame/video/decodmd3.cpp index 34d26f5bde4..6a7a2a94902 100644 --- a/src/mame/video/decodmd3.cpp +++ b/src/mame/video/decodmd3.cpp @@ -110,12 +110,12 @@ MC6845_UPDATE_ROW( decodmd_type3_device::crtc_update_row ) for (int dot = 0; dot < 8; dot++) { intensity = ((RAM[addr + 1] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x801] >> (7-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } for (int dot = 8; dot < 16; dot++) { intensity = ((RAM[addr] >> (15-dot) & 0x01) << 1) | (RAM[addr + 0x800] >> (15-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } addr += 2; } diff --git a/src/mame/video/decospr.cpp b/src/mame/video/decospr.cpp index a86c21976b8..1d085dd5869 100644 --- a/src/mame/video/decospr.cpp +++ b/src/mame/video/decospr.cpp @@ -563,26 +563,22 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const if (!m_sprite_bitmap.valid()) fatalerror("decospr_device::inefficient_copy_sprite_bitmap with no m_sprite_bitmap\n"); - int y, x; - const pen_t *paldata = m_gfxdecode->palette().pens(); + pen_t const *const paldata = m_gfxdecode->palette().pens(); - uint16_t* srcline; - uint32_t* dstline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top();y<=cliprect.bottom();y++) { - srcline= &m_sprite_bitmap.pix16(y); - dstline= &bitmap.pix32(y); + uint16_t const *const srcline= &m_sprite_bitmap.pix(y); + uint32_t *const dstline= &bitmap.pix(y); if (alpha==0xff) { - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { - uint16_t pix = srcline[x]; + uint16_t const pix = srcline[x]; if (pix&0xf) { - if ((pix & priority_mask) ==pri ) + if ((pix & priority_mask) == pri) { dstline[x] = paldata[(pix&palmask) + colbase]; } @@ -591,16 +587,16 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const } else { - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { - uint16_t pix = srcline[x]; + uint16_t const pix = srcline[x]; if (pix&m_pixmask) { - if ((pix & priority_mask) ==pri ) + if ((pix & priority_mask) == pri) { - uint32_t pal1 = paldata[(pix&palmask) + colbase]; - uint32_t pal2 = dstline[x]; + uint32_t const pal1 = paldata[(pix&palmask) + colbase]; + uint32_t const pal2 = dstline[x]; dstline[x] = alpha_blend_r32(pal2, pal1, alpha); } } diff --git a/src/mame/video/deniam.cpp b/src/mame/video/deniam.cpp index 439c15026ae..c5676be36e1 100644 --- a/src/mame/video/deniam.cpp +++ b/src/mame/video/deniam.cpp @@ -236,9 +236,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] & 0x0f); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -255,9 +255,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16+(rom[i] >> 4); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -278,9 +278,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] >> 4); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -297,9 +297,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] & 0x0f); + screen.priority().pix(y, sx + x) = 8; } } x++; diff --git a/src/mame/video/dgn_beta.cpp b/src/mame/video/dgn_beta.cpp index 8d1795f2e72..1850f89f815 100644 --- a/src/mame/video/dgn_beta.cpp +++ b/src/mame/video/dgn_beta.cpp @@ -100,9 +100,9 @@ the access to the video memory is unclear to me at the moment. MC6845_UPDATE_ROW( dgn_beta_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *videoram = m_videoram; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const videoram = m_videoram; + uint32_t *p = &bitmap.pix(y); int i; if(IsTextMode) { diff --git a/src/mame/video/dkong.cpp b/src/mame/video/dkong.cpp index bab2c20a215..91dbfba9031 100644 --- a/src/mame/video/dkong.cpp +++ b/src/mame/video/dkong.cpp @@ -796,25 +796,22 @@ void dkong_state::radarscp_step(int line_cnt) void dkong_state::radarscp_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { const uint8_t *htable = nullptr; - int x,y; - uint8_t draw_ok; - uint16_t *pixel; if (m_hardware_type == HARDWARE_TRS01) htable = m_gfx4; - y = cliprect.min_y; + int y = cliprect.min_y; while (y <= cliprect.max_y) { - x = cliprect.min_x; + int x = cliprect.min_x; while (x <= cliprect.max_x) { - pixel = &bitmap.pix16(y, x); - draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02); + uint16_t *const pixel = &bitmap.pix(y, x); + uint8_t draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02); if (m_hardware_type == HARDWARE_TRS01) /* Check again from schematics */ draw_ok = draw_ok && !((htable[ (!m_rflip_sig<<7) | (x>>2)] >>2) & 0x01); if (draw_ok) - *pixel = *(&m_bg_bits.pix16(y, x)); + *pixel = m_bg_bits.pix(y, x); x++; } y++; @@ -823,21 +820,19 @@ void dkong_state::radarscp_draw_background(bitmap_ind16 &bitmap, const rectangle void dkong_state::radarscp_scanline(int scanline) { - const uint8_t *table = m_gfx3; + uint8_t const *const table = m_gfx3; int table_len = m_gfx3_len; - int x,y,offset; - uint16_t *pixel; const rectangle &visarea = m_screen->visible_area(); - y = scanline; + int y = scanline; radarscp_step(y); if (y <= visarea.min_y || y > visarea.max_y) m_counter = 0; - offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400; - x = 0; + int offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400; + int x = 0; while (x < m_screen->width()) { - pixel = &m_bg_bits.pix16(y, x); + uint16_t *const pixel = &m_bg_bits.pix(y, x); if ((m_counter < table_len) && (x == 4 * (table[m_counter|offset] & 0x7f))) { if ( m_star_ff && (table[m_counter|offset] & 0x80) ) /* star */ @@ -852,7 +847,7 @@ void dkong_state::radarscp_scanline(int scanline) *pixel = RADARSCP_BCK_COL_OFFSET + m_blue_level; x++; } - while ((m_counter < table_len) && ( x < 4 * (table[m_counter|offset] & 0x7f))) + while ((m_counter < table_len) && (x < 4 * (table[m_counter|offset] & 0x7f))) m_counter++; } diff --git a/src/mame/video/dogfgt.cpp b/src/mame/video/dogfgt.cpp index 154e2d2380a..a8e3ee9fa8f 100644 --- a/src/mame/video/dogfgt.cpp +++ b/src/mame/video/dogfgt.cpp @@ -116,9 +116,9 @@ void dogfgt_state::internal_bitmapram_w(offs_t offset, uint8_t data) color |= ((m_bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i; if (flip_screen()) - m_pixbitmap.pix16(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + m_pixbitmap.pix(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; else - m_pixbitmap.pix16(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + m_pixbitmap.pix(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; } } diff --git a/src/mame/video/dpb_combiner.cpp b/src/mame/video/dpb_combiner.cpp index 29819661e35..48440eeec02 100644 --- a/src/mame/video/dpb_combiner.cpp +++ b/src/mame/video/dpb_combiner.cpp @@ -206,7 +206,7 @@ void dpb7000_combiner_card_device::fsck_tick() { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x && x < 256; x++) { *dest++ = 0xff000000 | (m_lum_out << 16) | (m_lum_out << 8) | m_lum_out; diff --git a/src/mame/video/dribling.cpp b/src/mame/video/dribling.cpp index a8e40930674..510dccb5c5e 100644 --- a/src/mame/video/dribling.cpp +++ b/src/mame/video/dribling.cpp @@ -62,7 +62,7 @@ uint32_t dribling_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // loop over rows for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); // loop over columns for (int x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp index 0fd9007937c..6cdbf33beca 100644 --- a/src/mame/video/dynax.cpp +++ b/src/mame/video/dynax.cpp @@ -647,7 +647,6 @@ VIDEO_START_MEMBER(dynax_state,neruton) void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &cliprect, int i ) { int color; - int scrollx, scrolly; switch (i) { @@ -660,8 +659,8 @@ void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &clipr color += (m_blit_palbank & 0x0f) * 16; - scrollx = m_blit_scroll_x; - scrolly = m_blit_scroll_y; + int scrollx = m_blit_scroll_x; + int scrolly = m_blit_scroll_y; if (i == 1 && (m_layer_layout == LAYOUT_HANAMAI || m_layer_layout == LAYOUT_HNORIDUR)) { @@ -670,16 +669,16 @@ void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &clipr } { - int dy, length, pen; - uint8_t *src1 = m_pixmap[i][1].get(); - uint8_t *src2 = m_pixmap[i][0].get(); + uint8_t const *src1 = m_pixmap[i][1].get(); + uint8_t const *src2 = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { + int length, pen; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16((dy - scrolly) & 0xff); + uint16_t *const dstbase = &bitmap.pix((dy - scrolly) & 0xff); length = scrollx; dst = dstbase + 2 * (256 - length); @@ -736,17 +735,17 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli } { - int dy, length, pen; - uint8_t *src1 = m_pixmap[i][1].get(); - uint8_t *src2 = m_pixmap[i][0].get(); + uint8_t const *src1 = m_pixmap[i][1].get(); + uint8_t const *src2 = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { - int sy = ((dy - scrolly) & 0xff) + y; + int length, pen; + int const sy = ((dy - scrolly) & 0xff) + y; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16(sy); + uint16_t *const dstbase = &bitmap.pix(sy); if ((sy < cliprect.top()) || (sy > cliprect.bottom())) { @@ -784,7 +783,6 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli void dynax_state::mjdialq2_copylayer( bitmap_ind16 &bitmap, const rectangle &cliprect, int i ) { int color; - int scrollx, scrolly; switch (i) { @@ -795,19 +793,19 @@ void dynax_state::mjdialq2_copylayer( bitmap_ind16 &bitmap, const rectangle &cli color += (m_blit_palbank & 1) * 16; - scrollx = m_blit_scroll_x; - scrolly = m_blit_scroll_y; + int const scrollx = m_blit_scroll_x; + int const scrolly = m_blit_scroll_y; { - int dy, length, pen; - uint8_t *src = m_pixmap[i][0].get(); + uint8_t const *src = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { + int length, pen; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16((dy - scrolly) & 0xff); + uint16_t *const dstbase = &bitmap.pix((dy - scrolly) & 0xff); length = scrollx; dst = dstbase + 256 - length; diff --git a/src/mame/video/dynduke.cpp b/src/mame/video/dynduke.cpp index 6d6295411a4..2f0fff57946 100644 --- a/src/mame/video/dynduke.cpp +++ b/src/mame/video/dynduke.cpp @@ -164,9 +164,6 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr { /* The transparency / palette handling on the background layer is very strange */ bitmap_ind16 &bm = m_bg_layer->pixmap(); - int scrolly, scrollx; - int x,y; - /* if we're disabled, don't draw */ if (!m_back_enable) { @@ -174,8 +171,8 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr return; } - scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7); - scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7); + int scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7); + int scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7); if (flip_screen()) { @@ -183,14 +180,14 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr scrollx = 256 - scrollx; } - for (y=0;y<256;y++) + for (int y=0;y<256;y++) { int realy = (y + scrolly) & 0x1ff; - uint16_t *src = &bm.pix16(realy); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &bm.pix(realy); + uint16_t *const dst = &bitmap.pix(y); - for (x=0;x<256;x++) + for (int x=0;x<256;x++) { int realx = (x + scrollx) & 0x1ff; uint16_t srcdat = src[realx]; diff --git a/src/mame/video/elan_eu3a05vid.cpp b/src/mame/video/elan_eu3a05vid.cpp index 46f39a1975e..5ea11e30bd9 100644 --- a/src/mame/video/elan_eu3a05vid.cpp +++ b/src/mame/video/elan_eu3a05vid.cpp @@ -245,11 +245,11 @@ void elan_eu3a05vid_device::draw_sprites(screen_device &screen, bitmap_ind16 &bi if (flags & 0x08) // guess flipy { - row = &bitmap.pix16((y + (sizey - 1 - yy)) & 0xff); + row = &bitmap.pix((y + (sizey - 1 - yy)) & 0xff); } else { - row = &bitmap.pix16((y + yy) & 0xff); + row = &bitmap.pix((y + yy) & 0xff); } for (int xx = 0; xx < sizex; xx++) @@ -457,7 +457,7 @@ void elan_eu3a05vid_device::draw_tilemaps(screen_device& screen, bitmap_ind16& b tile += ((m_tile_gfxbase_lo_data | m_tile_gfxbase_hi_data << 8) << 5); - uint16_t* row = &bitmap.pix16(drawline); + uint16_t *const row = &bitmap.pix(drawline); if (m_vidctrl & 0x20) // 4bpp { diff --git a/src/mame/video/elan_eu3a14vid.cpp b/src/mame/video/elan_eu3a14vid.cpp index bf7d92eb0ac..9f31ef164fc 100644 --- a/src/mame/video/elan_eu3a14vid.cpp +++ b/src/mame/video/elan_eu3a14vid.cpp @@ -252,8 +252,8 @@ void elan_eu3a14vid_device::draw_background_tile(bitmap_ind16& bitmap, const rec // RAM tile layer has no scrolling? (or we've never seen it used / enabled) } - uint16_t* dst = &bitmap.pix16(ypos + y); - uint8_t* pridst = &m_prioritybitmap.pix8(ypos + y); + uint16_t *const dst = &bitmap.pix(ypos + y); + uint8_t *const pridst = &m_prioritybitmap.pix(ypos + y); for (int x = 0; x < xstride; x++) { @@ -692,8 +692,8 @@ void elan_eu3a14vid_device::draw_sprite_line(screen_device &screen, bitmap_ind16 if (ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - uint16_t* dst = &bitmap.pix16(ypos); - uint8_t* pridst = &m_prioritybitmap.pix8(ypos); + uint16_t *const dst = &bitmap.pix(ypos); + uint8_t *const pridst = &m_prioritybitmap.pix(ypos); int count = 0; for (int x = 0; x < 8/bppdiv;x++) diff --git a/src/mame/video/electron.cpp b/src/mame/video/electron.cpp index e506a4e930c..352e4710769 100644 --- a/src/mame/video/electron.cpp +++ b/src/mame/video/electron.cpp @@ -80,7 +80,7 @@ inline uint8_t electron_state::read_vram( uint16_t addr ) inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/eolith.cpp b/src/mame/video/eolith.cpp index c31fea64fc2..fa18bbb3709 100644 --- a/src/mame/video/eolith.cpp +++ b/src/mame/video/eolith.cpp @@ -34,7 +34,7 @@ uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; + bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; } } diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp index 91a0b77299f..886582a9a3e 100644 --- a/src/mame/video/epos.cpp +++ b/src/mame/video/epos.cpp @@ -89,13 +89,13 @@ uint32_t epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, if (flip_screen()) { - bitmap.pix32(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix32(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + bitmap.pix(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); } else { - bitmap.pix32(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix32(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + bitmap.pix(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); } } diff --git a/src/mame/video/eprom.cpp b/src/mame/video/eprom.cpp index fad474f1502..2150f9c37ff 100644 --- a/src/mame/video/eprom.cpp +++ b/src/mame/video/eprom.cpp @@ -221,8 +221,8 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -266,15 +266,15 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b * * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected */ - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int pfpriority = (pf[x] >> 4) & 3; - int forcemc0 = 0, shade = 1, pfm = 1, m7 = 0; + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 4) & 3; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) continue; /* compute the FORCEMC signal */ + int forcemc0 = 0; if (!(pf[x] & 8)) { if (((pfpriority == 3) && !(mopriority & 1)) || @@ -284,12 +284,14 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b } /* compute the SHADE signal */ + int shade = 1; if (((mo[x] & 0x0f) != 1) || ((mo[x] & 0xf0) == 0) || forcemc0) shade = 0; /* compute the PF/M signal */ + int pfm = 1; if ((mopriority == 3) || (pf[x] & 8) || (!(pfpriority & 1) && (mopriority & 2)) || @@ -299,6 +301,7 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b pfm = 0; /* compute the M7 signal */ + int m7 = 0; if ((mo[x] & 0x0f) == 1) m7 = 1; @@ -327,12 +330,12 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) @@ -368,13 +371,13 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int pfpriority = (pf[x] >> 5) & 3; + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 5) & 3; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -393,12 +396,12 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/equites.cpp b/src/mame/video/equites.cpp index 26f64b55e9b..a0193cdebeb 100644 --- a/src/mame/video/equites.cpp +++ b/src/mame/video/equites.cpp @@ -350,7 +350,7 @@ void splndrbt_state::splndrbt_draw_sprites(bitmap_ind16 &bitmap, const rectangle int pen = srcgfx[offset]; if ((transmask & (1 << pen)) == 0) - bitmap.pix16(y, bx) = paldata[pen]; + bitmap.pix(y, bx) = paldata[pen]; } } } @@ -383,9 +383,9 @@ void splndrbt_state::splndrbt_copy_bg(bitmap_ind16 &dst_bitmap, const rectangle if (dst_y >= cliprect.top() && dst_y <= cliprect.bottom()) { const uint8_t * const romline = &xrom[(dst_y ^ dinvert) << 5]; - const uint16_t * const src_line = &src_bitmap.pix16((src_y + scroll_y) & 0x1ff); - const uint8_t * const flags_line = &flags_bitmap.pix8((src_y + scroll_y) & 0x1ff); - uint16_t * const dst_line = &dst_bitmap.pix16(dst_y); + const uint16_t * const src_line = &src_bitmap.pix((src_y + scroll_y) & 0x1ff); + const uint8_t * const flags_line = &flags_bitmap.pix((src_y + scroll_y) & 0x1ff); + uint16_t * const dst_line = &dst_bitmap.pix(dst_y); int dst_x = 0; int src_x; diff --git a/src/mame/video/esripsys.cpp b/src/mame/video/esripsys.cpp index 9db24deaa78..fd6e4b33aeb 100644 --- a/src/mame/video/esripsys.cpp +++ b/src/mame/video/esripsys.cpp @@ -151,18 +151,17 @@ void esripsys_state::video_start() uint32_t esripsys_state::screen_update_esripsys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - struct line_buffer_t *line_buffer = m_line_buffer; - int x, y; + struct line_buffer_t *const line_buffer = m_line_buffer; - uint8_t *colour_buf = line_buffer[m_12sel ? 0 : 1].colour_buf.get(); - uint8_t *intensity_buf = line_buffer[m_12sel ? 0 : 1].intensity_buf.get(); - uint8_t *priority_buf = line_buffer[m_12sel ? 0 : 1].priority_buf.get(); + uint8_t *const colour_buf = line_buffer[m_12sel ? 0 : 1].colour_buf.get(); + uint8_t *const intensity_buf = line_buffer[m_12sel ? 0 : 1].intensity_buf.get(); + uint8_t *const priority_buf = line_buffer[m_12sel ? 0 : 1].priority_buf.get(); - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); - for (x = 0; x < 512; ++x) + for (int x = 0; x < 512; ++x) { int idx = colour_buf[x]; int r = (m_pal_ram[idx] & 0xf); diff --git a/src/mame/video/exidy.cpp b/src/mame/video/exidy.cpp index 8c7146a847d..2df9ef5470d 100644 --- a/src/mame/video/exidy.cpp +++ b/src/mame/video/exidy.cpp @@ -134,12 +134,10 @@ void exidy_state::draw_background() for (offs = 0; offs < 0x400; offs++) { - uint8_t cy; - pen_t on_pen_1, on_pen_2; - uint8_t y = offs >> 5 << 3; - uint8_t code = m_videoram[offs]; + uint8_t const code = m_videoram[offs]; + pen_t on_pen_1, on_pen_2; if (m_is_2bpp) { on_pen_1 = 4 + ((code >> 6) & 0x02); @@ -151,9 +149,8 @@ void exidy_state::draw_background() on_pen_2 = off_pen; /* unused */ } - for (cy = 0; cy < 8; cy++) + for (uint8_t cy = 0; cy < 8; cy++) { - int i; uint8_t x = offs << 3; if (m_is_2bpp) @@ -161,16 +158,16 @@ void exidy_state::draw_background() uint8_t data1 = m_characterram[0x000 | (code << 3) | cy]; uint8_t data2 = m_characterram[0x800 | (code << 3) | cy]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (data1 & 0x80) - m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; + m_background_bitmap.pix(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; else - m_background_bitmap.pix16(y, x) = off_pen; + m_background_bitmap.pix(y, x) = off_pen; - x = x + 1; - data1 = data1 << 1; - data2 = data2 << 1; + x++; + data1 <<= 1; + data2 <<= 1; } } /* 1bpp */ @@ -178,16 +175,16 @@ void exidy_state::draw_background() { uint8_t data = m_characterram[(code << 3) | cy]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen; + m_background_bitmap.pix(y, x) = (data & 0x80) ? on_pen_1 : off_pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } } - y = y + 1; + y++; } } } @@ -282,7 +279,6 @@ void exidy_state::check_collision() const rectangle clip(0, 15, 0, 15); int org_1_x = 0, org_1_y = 0; int org_2_x = 0, org_2_y = 0; - int sx, sy; int count = 0; /* if there is nothing to detect, bail */ @@ -312,27 +308,27 @@ void exidy_state::check_collision() m_motion_object_2_clip.fill(0xff, clip); if (sprite_1_enabled()) { - sx = org_2_x - org_1_x; - sy = org_2_y - org_1_y; + int sx = org_2_x - org_1_x; + int sy = org_2_y - org_1_y; m_gfxdecode->gfx(0)->transpen(m_motion_object_2_clip,clip, ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, 0, 0, sx, sy, 0); } /* scan for collisions */ - for (sy = 0; sy < 16; sy++) - for (sx = 0; sx < 16; sx++) + for (int sy = 0; sy < 16; sy++) + for (int sx = 0; sx < 16; sx++) { - if (m_motion_object_1_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_1_vid.pix(sy, sx) != 0xff) { uint8_t current_collision_mask = 0; /* check for background collision (M1CHAR) */ - if (m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0) + if (m_background_bitmap.pix(org_1_y + sy, org_1_x + sx) != 0) current_collision_mask |= 0x04; /* check for motion object collision (M1M2) */ - if (m_motion_object_2_clip.pix16(sy, sx) != 0xff) + if (m_motion_object_2_clip.pix(sy, sx) != 0xff) current_collision_mask |= 0x10; /* if we got one, trigger an interrupt */ @@ -340,10 +336,10 @@ void exidy_state::check_collision() timer_set(m_screen->time_until_pos(org_1_x + sx, org_1_y + sy), TIMER_COLLISION_IRQ, current_collision_mask); } - if (m_motion_object_2_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_2_vid.pix(sy, sx) != 0xff) { /* check for background collision (M2CHAR) */ - if (m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0) + if (m_background_bitmap.pix(org_2_y + sy, org_2_x + sx) != 0) if ((m_collision_mask & 0x08) && (count++ < 128)) timer_set(m_screen->time_until_pos(org_2_x + sx, org_2_y + sy), TIMER_COLLISION_IRQ, 0x08); } diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index 11c83976dfa..2106e4ac16e 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -306,7 +306,6 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c int image = (~sprite[3] & 0x3f); int xoffs = (~((sprite[1] << 8) | sprite[2]) & 0x1ff); int yoffs = (~sprite[0] & 0xff) + 1; - int x, y, sy; uint8_t *src; /* skip if out of range */ @@ -321,8 +320,8 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c xoffs -= 0x1ff; /* loop over y */ - sy = yoffs + scroll_offset; - for (y = 0; y < 16; y++, yoffs--, sy--) + int sy = yoffs + scroll_offset; + for (int y = 0; y < 16; y++, yoffs--, sy--) { /* wrap at the top and bottom of the screen */ if (sy >= VBSTART) @@ -341,7 +340,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c int currx = xoffs; /* loop over x */ - for (x = 0; x < 8; x++, old += 2) + for (int x = 0; x < 8; x++, old += 2) { int ipixel = *src++; int left = ipixel & 0xf0; @@ -353,7 +352,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { /* combine with the background */ pen = left | old[0]; - bitmap.pix16(yoffs, currx) = pen; + bitmap.pix(yoffs, currx) = pen; /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) @@ -366,7 +365,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { /* combine with the background */ pen = right | old[1]; - bitmap.pix16(yoffs, currx) = pen; + bitmap.pix(yoffs, currx) = pen; /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) diff --git a/src/mame/video/exterm.cpp b/src/mame/video/exterm.cpp index 7a6373fdff4..4049ab85571 100644 --- a/src/mame/video/exterm.cpp +++ b/src/mame/video/exterm.cpp @@ -64,9 +64,8 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(exterm_state::from_shiftreg_slave) TMS340X0_SCANLINE_IND16_CB_MEMBER(exterm_state::scanline_update) { - uint16_t *bgsrc = &m_master_videoram[(params->rowaddr << 8) & 0xff00]; - uint16_t *fgsrc = nullptr; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const bgsrc = &m_master_videoram[(params->rowaddr << 8) & 0xff00]; + uint16_t *const dest = &bitmap.pix(scanline); tms340x0_device::display_params fgparams; int coladdr = params->coladdr; int fgcoladdr = 0; @@ -75,6 +74,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(exterm_state::scanline_update) m_slave->get_display_params(&fgparams); /* compute info about the slave vram */ + uint16_t *fgsrc = nullptr; if (fgparams.enabled && scanline >= fgparams.veblnk && scanline < fgparams.vsblnk && fgparams.heblnk < fgparams.hsblnk) { fgsrc = &m_slave_videoram[((fgparams.rowaddr << 8) + (fgparams.yoffset << 7)) & 0xff80]; diff --git a/src/mame/video/fgoal.cpp b/src/mame/video/fgoal.cpp index fb9de83dec5..8152f58a0ad 100644 --- a/src/mame/video/fgoal.cpp +++ b/src/mame/video/fgoal.cpp @@ -40,11 +40,7 @@ void fgoal_state::video_start() uint32_t fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint8_t* VRAM = m_video_ram; - - int x; - int y; - int n; + uint8_t const *VRAM = m_video_ram; /* draw color overlay foreground and background */ @@ -83,31 +79,31 @@ uint32_t fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, /* the ball has a fixed color */ - for (y = m_ypos; y < m_ypos + 8; y++) + for (int y = m_ypos; y < m_ypos + 8; y++) { - for (x = m_xpos; x < m_xpos + 8; x++) + for (int x = m_xpos; x < m_xpos + 8; x++) { if (y < 256 && x < 256) { - m_fgbitmap.pix16(y, x) = 128 + 16; + m_fgbitmap.pix(y, x) = 128 + 16; } } } /* draw bitmap layer */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* p = &bitmap.pix16(y); + uint16_t *const p = &bitmap.pix(y); - const uint16_t* FG = &m_fgbitmap.pix16(y); - const uint16_t* BG = &m_bgbitmap.pix16(y); + uint16_t const *const FG = &m_fgbitmap.pix(y); + uint16_t const *const BG = &m_bgbitmap.pix(y); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { uint8_t v = *VRAM++; - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { if (v & (1 << n)) { diff --git a/src/mame/video/firetrk.cpp b/src/mame/video/firetrk.cpp index 935cc97ed66..800cb5dd5e2 100644 --- a/src/mame/video/firetrk.cpp +++ b/src/mame/video/firetrk.cpp @@ -318,13 +318,11 @@ void firetrk_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, u void firetrk_state::check_collision(int which) { - int y, x; - - for (y = playfield_window.top(); y <= playfield_window.bottom(); y++) - for (x = playfield_window.left(); x <= playfield_window.right(); x++) + for (int y = playfield_window.top(); y <= playfield_window.bottom(); y++) + for (int x = playfield_window.left(); x <= playfield_window.right(); x++) { - pen_t a = m_helper1.pix16(y, x); - pen_t b = m_helper2.pix16(y, x); + pen_t const a = m_helper1.pix(y, x); + pen_t const b = m_helper2.pix(y, x); if (b != 0xff && (m_color1_mask >> a) & 1) m_crash[which] = 1; diff --git a/src/mame/video/fm7.cpp b/src/mame/video/fm7.cpp index 16eede8b9c9..e942d086b8b 100644 --- a/src/mame/video/fm7.cpp +++ b/src/mame/video/fm7.cpp @@ -1424,8 +1424,6 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma uint8_t code_r2 = 0,code_g2 = 0,code_b2 = 0; uint8_t code_r3 = 0,code_g3 = 0,code_b3 = 0; uint8_t code_r4 = 0,code_g4 = 0,code_b4 = 0; - uint16_t col; - int y, x, b; uint16_t page = 0x0000; if(m_video.display_video_page != 0) @@ -1436,9 +1434,9 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma if(m_video.modestatus & 0x40) // 320x200 mode { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { if(!(m_video.multi_page & 0x40)) { @@ -1461,21 +1459,22 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma code_b3 = m_video_ram[0xc000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; code_b4 = m_video_ram[0xe000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { + uint16_t col; col = (((code_b >> b) & 0x01) ? 8 : 0) | (((code_b2 >> b) & 0x01) ? 4 : 0) | (((code_b3 >> b) & 0x01) ? 2 : 0) | (((code_b4 >> b) & 0x01) ? 1 : 0); col |= (((code_g >> b) & 0x01) ? 128 : 0) | (((code_g2 >> b) & 0x01) ? 64 : 0) | (((code_g3 >> b) & 0x01) ? 32 : 0) | (((code_g4 >> b) & 0x01) ? 16 : 0); col |= (((code_r >> b) & 0x01) ? 2048 : 0) | (((code_r2 >> b) & 0x01) ? 1024 : 0) | (((code_r3 >> b) & 0x01) ? 512 : 0) | (((code_r4 >> b) & 0x01) ? 256 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_av_palette->pen_color(col); + bitmap.pix(y, x*8+(7-b)) = m_av_palette->pen_color(col); } } } } else { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - for (x = 0; x < 80; x++) + for (int x = 0; x < 80; x++) { if(!(m_video.multi_page & 0x40)) code_r = m_video_ram[page + 0x8000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; @@ -1483,10 +1482,10 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma code_g = m_video_ram[page + 0x4000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; if(!(m_video.multi_page & 0x10)) code_b = m_video_ram[page + 0x0000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_palette->pen_color(col); + uint16_t col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); + bitmap.pix(y, x*8+(7-b)) = m_palette->pen_color(col); } } } diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp index d60da80b198..ef6515700e9 100644 --- a/src/mame/video/fmtowns.cpp +++ b/src/mame/video/fmtowns.cpp @@ -975,13 +975,10 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo void towns_state::draw_sprites(const rectangle* rect) { uint16_t sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff; - int n; - uint16_t x,y,attr,colour; uint16_t xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff; uint16_t yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff; uint32_t poffset,coffset; int linesize = m_video.towns_crtc_reg[24] * 4; - bool xflip, yflip, xhalfsize, yhalfsize, rotation; if(!(m_video.towns_sprite_reg[1] & 0x80)) return; @@ -998,17 +995,17 @@ void towns_state::draw_sprites(const rectangle* rect) for(int i = linesize; i < 0x20000; i += linesize) memcpy(vram + i, vram, linesize); - for(n=sprite_limit;n<1024;n++) + for(int n=sprite_limit;n<1024;n++) { - x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); - y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); - attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); - colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); - xflip = (attr & 0x2000) >> 13; - yflip = (attr & 0x1000) >> 12; - rotation = (attr & 0x4000) >> 14; - xhalfsize = (attr & 0x400) >> 10; - yhalfsize = (attr & 0x800) >> 11; + uint16_t x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); + uint16_t y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); + uint16_t attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); + uint16_t colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); + bool xflip = (attr & 0x2000) >> 13; + bool yflip = (attr & 0x1000) >> 12; + bool rotation = (attr & 0x4000) >> 14; + bool xhalfsize = (attr & 0x400) >> 10; + bool yhalfsize = (attr & 0x800) >> 11; if(attr & 0x8000) { @@ -1053,12 +1050,10 @@ void towns_state::draw_sprites(const rectangle* rect) void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { uint32_t off = 0; - int x; uint16_t colour; int hzoom = 1; int linesize; uint32_t scroll; - int pixel; int page = 0; bool sphscroll = !(m_video.towns_crtc_reg[28] & (layer ? 0x20 : 0x10)); @@ -1111,7 +1106,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const off += line * linesize; off &= ~1; - for(x=rect->min_x;x<rect->max_x;x+=hzoom) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom) { int offpage; int curoff; @@ -1128,8 +1123,8 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const colour = (m_towns_gfxvram[curoff+(offpage*0x40000)+1] << 8) | m_towns_gfxvram[curoff+(offpage*0x40000)]; if(!(m_video.towns_video_reg[0] & 0x10) || (m_video.towns_video_reg[1] & 0x01) != layer || colour < 0x8000) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = ((colour & 0x001f) << 3) | ((colour & 0x7c00) << 1) | ((colour & 0x03e0) << 14); @@ -1143,12 +1138,10 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline) { int off = 0; - int x; uint8_t colour; int hzoom = 1; int linesize; uint32_t scroll; - int pixel; int page = 0; bool sphscroll = !(m_video.towns_crtc_reg[28] & 0x10); @@ -1174,12 +1167,12 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect off += (subpix >> 1) & ~3; subpix = subpix & 7; - for(x=rect->min_x;x<rect->max_x;x+=hzoom) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom) { off &= 0x3ffff; colour = m_towns_gfxvram[off+(subpix >= 4 ? (subpix & 3)+0x40000 : subpix)]; - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = m_palette->pen(colour); subpix++; if(subpix == 8) { @@ -1194,12 +1187,8 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { int off = 0; - int x; - uint8_t colour; int hzoom = 1; - int linesize; uint32_t scroll; - int pixel; int page = 0; palette_device* pal = m_palette16[layer]; bool sphscroll = !(m_video.towns_crtc_reg[28] & (layer ? 0x20 : 0x10)); @@ -1215,6 +1204,7 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta // if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) // off = 0x20000; + int linesize; if(layer == 0) linesize = m_video.towns_crtc_reg[20] * 4; else @@ -1249,23 +1239,24 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta off += line * linesize; - for(x=rect->min_x;x<rect->max_x;x+=hzoom*2) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom*2) { if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer + uint8_t colour; colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0 || bottom_layer) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+hzoom+pixel) = pal->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+hzoom+pixel) = pal->pen(colour); } colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0 || bottom_layer) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = pal->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = pal->pen(colour); } off++; if ((off - (page * 0x20000)) % linesize == 0 && sphscroll) @@ -1275,7 +1266,6 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer) { - int line; int scanline; int bottom; int top; @@ -1294,7 +1284,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re switch(m_video.towns_video_reg[0] & 0x03) { case 0x01: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1306,7 +1296,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x02: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1318,7 +1308,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x03: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1343,7 +1333,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re switch(m_video.towns_video_reg[0] & 0x0c) { case 0x04: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1355,7 +1345,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x0c: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1376,11 +1366,7 @@ void towns_state::render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t uint32_t vram_addr; uint16_t linesize = m_video.towns_crtc_reg[24] * 4; uint8_t code_h,code_l; - uint8_t colour; - uint8_t data; - uint8_t temp; uint8_t* font_rom = m_user->base(); - int a,b; // all characters are 16 pixels high vram_addr = (x * 4) + (y * (linesize * 16)); @@ -1415,29 +1401,27 @@ void towns_state::render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t | 0x38000; } } - colour = attr & 0x07; + uint8_t colour = attr & 0x07; if(attr & 0x20) colour |= 0x08; - for(a=0;a<16;a++) // for each scanline + for(int a=0;a<16;a++) // for each scanline { + uint8_t data; if((attr & 0xc0) == 0) data = font_rom[0x180000 + rom_addr + a]; + else if((attr & 0xc0) == 0x80) + data = font_rom[0x180000 + rom_addr + (a*2)]; else - { - if((attr & 0xc0) == 0x80) - data = font_rom[0x180000 + rom_addr + (a*2)]; - else - data = font_rom[0x180000 + rom_addr + (a*2) + 1]; - } + data = font_rom[0x180000 + rom_addr + (a*2) + 1]; if(attr & 0x08) data = ~data; // inverse // and finally, put the data in VRAM - for(b=0;b<8;b+=2) + for(int b=0;b<8;b+=2) { - temp = 0; + uint8_t temp = 0; if(data & (1<<b)) temp |= ((colour & 0x0f) << 4); if(data & (1<<(b+1))) @@ -1469,11 +1453,11 @@ void towns_state::draw_text_layer() * * The video hardware renders text to VRAM layer 1, there is no separate text layer */ - int x,y,c = 0; + int c = 0; - for(y=0;y<40;y++) + for(int y=0;y<40;y++) { - for(x=0;x<80;x++) + for(int x=0;x<80;x++) { render_text_char(x,y,m_towns_txtvram[c],((m_towns_txtvram[c+0x2000] << 8)|(m_towns_txtvram[c+0x2001])),m_towns_txtvram[c+1]); c+=2; diff --git a/src/mame/video/gaelco2.cpp b/src/mame/video/gaelco2.cpp index e9c0368e8f5..26d8902f2cb 100644 --- a/src/mame/video/gaelco2.cpp +++ b/src/mame/video/gaelco2.cpp @@ -393,7 +393,7 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { /* get a pointer to the current line in the screen bitmap */ const int ypos = ((sy + ey * 16 + py) & 0x1ff); - u16 *srcy = &bitmap.pix16(ypos); + u16 *const srcy = &bitmap.pix(ypos); const int gfx_py = yflip ? (gfx->height() - 1 - py) : py; @@ -403,7 +403,7 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { /* get current pixel */ const int xpos = (((sx + ex * 16 + px) & 0x3ff) + spr_x_adjust) & 0x3ff; - u16 *pixel = srcy + xpos; + u16 *const pixel = srcy + xpos; const u16 src_color = *pixel; const int gfx_px = xflip ? (gfx->width() - 1 - px) : px; diff --git a/src/mame/video/gaelco3d.cpp b/src/mame/video/gaelco3d.cpp index 2010e5d2738..6a10b3d4ec9 100644 --- a/src/mame/video/gaelco3d.cpp +++ b/src/mame/video/gaelco3d.cpp @@ -210,8 +210,8 @@ void gaelco3d_state::gaelco3d_renderer::render_noz_noperspective(int32_t scanlin offs_t endmask = m_texture_size - 1; const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float uoz = (object.uoz_base + scanline * object.uoz_dy + startx * object.uoz_dx) * zbase; float voz = (object.voz_base + scanline * object.voz_dy + startx * object.voz_dx) * zbase; @@ -249,8 +249,8 @@ void gaelco3d_state::gaelco3d_renderer::render_normal(int32_t scanline, const ex const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; float z0 = object.z0; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float ooz = object.ooz_base + scanline * object.ooz_dy + startx * ooz_dx; float uoz = object.uoz_base + scanline * object.uoz_dy + startx * uoz_dx; @@ -299,8 +299,8 @@ void gaelco3d_state::gaelco3d_renderer::render_alphablend(int32_t scanline, cons const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; float z0 = object.z0; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float ooz = object.ooz_base + object.ooz_dy * scanline + startx * ooz_dx; float uoz = object.uoz_base + object.uoz_dy * scanline + startx * uoz_dx; @@ -454,7 +454,7 @@ uint32_t gaelco3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { int offs = (yv + y - cliprect.min_y) * 4096 + xv + x - cliprect.min_x; diff --git a/src/mame/video/gaelco_wrally_sprites.cpp b/src/mame/video/gaelco_wrally_sprites.cpp index c865e658a66..b1ade9e73e1 100644 --- a/src/mame/video/gaelco_wrally_sprites.cpp +++ b/src/mame/video/gaelco_wrally_sprites.cpp @@ -99,7 +99,7 @@ void gaelco_wrally_sprites_device::draw_sprites(const rectangle &cliprect, uint1 { /* get a pointer to the current line in the screen bitmap */ int ypos = ((sy + py) & 0x1ff); - uint16_t *srcy = &m_temp_bitmap_sprites.pix16(ypos); + uint16_t *const srcy = &m_temp_bitmap_sprites.pix(ypos); int gfx_py = yflip ? (gfx->height() - 1 - py) : py; @@ -109,7 +109,7 @@ void gaelco_wrally_sprites_device::draw_sprites(const rectangle &cliprect, uint1 { /* get current pixel */ int xpos = (((sx + px) & 0x3ff) - 0x0f) & 0x3ff; - uint16_t *pixel = srcy + xpos; + uint16_t *const pixel = srcy + xpos; int gfx_px = xflip ? (gfx->width() - 1 - px) : px; /* get asociated pen for the current sprite pixel */ @@ -152,8 +152,8 @@ void gaelco_wrally_sprites_device::mix_sprites(bitmap_ind16 &bitmap, const recta { for (int y = cliprect.min_y; y < cliprect.max_y; y++) { - const uint16_t* spriteptr = &m_temp_bitmap_sprites.pix16(y); - uint16_t* dstptr = &bitmap.pix16(y); + uint16_t const *const spriteptr = &m_temp_bitmap_sprites.pix(y); + uint16_t *const dstptr = &bitmap.pix(y); for (int x = cliprect.min_x; x < cliprect.max_x; x++) { diff --git a/src/mame/video/galastrm.cpp b/src/mame/video/galastrm.cpp index 07e23705512..63a1461ed91 100644 --- a/src/mame/video/galastrm.cpp +++ b/src/mame/video/galastrm.cpp @@ -209,7 +209,7 @@ void galastrm_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c void galastrm_renderer::tc0610_draw_scanline(s32 scanline, const extent_t& extent, const gs_poly_data& object, int threadid) { - u16 *framebuffer = &m_screenbits.pix16(scanline); + u16 *const framebuffer = &m_screenbits.pix(scanline); const s32 dudx = extent.param[0].dpdx; const s32 dvdx = extent.param[1].dpdx; @@ -217,7 +217,7 @@ void galastrm_renderer::tc0610_draw_scanline(s32 scanline, const extent_t& exten s32 v = extent.param[1].start; for (int x = extent.startx; x < extent.stopx; x++) { - framebuffer[x] = object.texbase->pix16(v >> 16, u >> 16); + framebuffer[x] = object.texbase->pix(v >> 16, u >> 16); u += dudx; v += dvdx; } @@ -466,8 +466,8 @@ u32 galastrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x = 0; x < priority_bitmap.width; x++) { - u8 *pri = &priority_bitmap.pix8(y, x); - if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x)) + u8 *pri = &priority_bitmap.pix(y, x); + if (!(*pri & 0x02) && m_tmpbitmaps.pix(y, x)) *pri |= 0x04; } } @@ -510,8 +510,8 @@ u32 galastrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x=0; x < priority_bitmap.width(); x++) { - u8 *pri = &priority_bitmap.pix8(y, x); - if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x)) + u8 *pri = &priority_bitmap.pix(y, x); + if (!(*pri & 0x02) && m_tmpbitmaps.pix(y, x)) *pri |= 0x04; } } diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp index 5a6377f8062..2b4d8506769 100644 --- a/src/mame/video/galaxia.cpp +++ b/src/mame/video/galaxia.cpp @@ -110,8 +110,6 @@ VIDEO_START_MEMBER(galaxia_state,astrowar) uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect); bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect); bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect); @@ -120,12 +118,12 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 cvs_update_stars(bitmap, cliprect, STAR_PEN, 1); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - bool bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); - bool background = (bitmap.pix16(y, x) & 3) != 0; + bool const bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); + bool const background = (bitmap.pix(y, x) & 3) != 0; // draw bullets (guesswork) if (bullet) @@ -134,16 +132,16 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 if (background) m_collision_register |= 0x80; // bullet size/color/priority is guessed - bitmap.pix16(y, x) = BULLET_PEN; - if (x) bitmap.pix16(y, x-1) = BULLET_PEN; + bitmap.pix(y, x) = BULLET_PEN; + if (x) bitmap.pix(y, x-1) = BULLET_PEN; } // copy the S2636 images into the main bitmap and check collision - int pixel0 = s2636_0_bitmap.pix16(y, x); - int pixel1 = s2636_1_bitmap.pix16(y, x); - int pixel2 = s2636_2_bitmap.pix16(y, x); + int const pixel0 = s2636_0_bitmap.pix(y, x); + int const pixel1 = s2636_1_bitmap.pix(y, x); + int const pixel2 = s2636_2_bitmap.pix(y, x); - int pixel = pixel0 | pixel1 | pixel2; + int const pixel = pixel0 | pixel1 | pixel2; if (S2636_IS_PIXEL_DRAWN(pixel)) { @@ -164,7 +162,7 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; } - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } @@ -176,8 +174,6 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // astrowar has only one S2636 - int x, y; - bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect); bitmap.fill(0, cliprect); @@ -185,43 +181,43 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { // draw bullets (guesswork) if (m_bullet_ram[y]) { - uint8_t pos = m_bullet_ram[y] ^ 0xff; + uint8_t const pos = m_bullet_ram[y] ^ 0xff; // background vs. bullet collision detection - if (m_temp_bitmap.pix16(y, pos) & 1) + if (m_temp_bitmap.pix(y, pos) & 1) m_collision_register |= 0x02; // bullet size/color/priority is guessed - bitmap.pix16(y, pos) = BULLET_PEN; - if (pos) bitmap.pix16(y, pos-1) = BULLET_PEN; + bitmap.pix(y, pos) = BULLET_PEN; + if (pos) bitmap.pix(y, pos-1) = BULLET_PEN; } - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { // NOTE: similar to zac2650.c, the sprite chip runs at a different frequency than the background generator // the exact timing ratio is unknown, so we'll have to do with guesswork - float s_ratio = 256.0f / 196.0f; + float const s_ratio = 256.0f / 196.0f; - float sx = x * s_ratio; + float const sx = x * s_ratio; if (int(sx + 0.5f) > cliprect.right()) break; // copy the S2636 bitmap into the main bitmap and check collision - int pixel = s2636_0_bitmap.pix16(y, x); + int const pixel = s2636_0_bitmap.pix(y, x); if (S2636_IS_PIXEL_DRAWN(pixel)) { // S2636 vs. background collision detection - if ((m_temp_bitmap.pix16(y, int(sx)) | m_temp_bitmap.pix16(y, int(sx + 0.5f))) & 1) + if ((m_temp_bitmap.pix(y, int(sx)) | m_temp_bitmap.pix(y, int(sx + 0.5f))) & 1) m_collision_register |= 0x01; - bitmap.pix16(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; - bitmap.pix16(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } diff --git a/src/mame/video/galaxian.cpp b/src/mame/video/galaxian.cpp index 51395d7a521..7f6d24c192c 100644 --- a/src/mame/video/galaxian.cpp +++ b/src/mame/video/galaxian.cpp @@ -905,7 +905,7 @@ void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) - bitmap.pix32(y, m_x_scale*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ star = m_stars[star_offs++]; @@ -913,8 +913,8 @@ void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) { - bitmap.pix32(y, m_x_scale*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, m_x_scale*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 2) = m_star_color[star & 0x3f]; } } } @@ -1150,15 +1150,15 @@ inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rect x *= m_x_scale; x += m_h0_start; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; x++; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; x++; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/video/galaxold.cpp b/src/mame/video/galaxold.cpp index 51b18fc6b55..7f3a46a8238 100644 --- a/src/mame/video/galaxold.cpp +++ b/src/mame/video/galaxold.cpp @@ -531,16 +531,13 @@ VIDEO_START_MEMBER(galaxold_state,pisces) #ifdef UNUSED_FUNCTION void galaxold_state::theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i; - - /* same as Galaxian, but all bullets are yellow */ - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { x--; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = BULLETS_COLOR_BASE; + bitmap.pix(y, x) = BULLETS_COLOR_BASE; } } @@ -1040,22 +1037,16 @@ void galaxold_state::drivfrcg_modify_color(uint8_t *color) void galaxold_state::galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i; - - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { x--; if (cliprect.contains(x, y)) { - int color; - - /* yellow missile, white shells (this is the terminology on the schematics) */ - color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); + int const color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } } @@ -1068,7 +1059,7 @@ void galaxold_state::scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangl if (cliprect.contains(x, y)) /* yellow bullets */ - bitmap.pix16(y, x) = BULLETS_COLOR_BASE; + bitmap.pix(y, x) = BULLETS_COLOR_BASE; } void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) @@ -1078,32 +1069,32 @@ void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle x = x - 6; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 32 + m_darkplnt_bullet_color; + bitmap.pix(y, x) = 32 + m_darkplnt_bullet_color; } void galaxold_state::dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i, color; - if (flip_screen_x()) x++; x = x - 6; /* bullets are 2 pixels wide */ - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { + int color; if (offs < 4*4) { color = BULLETS_COLOR_BASE; y--; } - else { + else + { color = BULLETS_COLOR_BASE + 1; x--; } if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } @@ -1368,7 +1359,7 @@ void galaxold_state::plot_star(bitmap_ind16 &bitmap, int x, int y, int color, co y = 255 - y; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_stars_colors_start + color; + bitmap.pix(y, x) = m_stars_colors_start + color; } void galaxold_state::noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/galaxy.cpp b/src/mame/video/galaxy.cpp index a74a5631566..ab6428a993b 100644 --- a/src/mame/video/galaxy.cpp +++ b/src/mame/video/galaxy.cpp @@ -18,7 +18,6 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) { address_space &space = m_maincpu->space(AS_PROGRAM); - int y, x; if (m_interrupts_enabled == true) { uint8_t dat = BIT(m_latch_value, 2, 4); @@ -43,17 +42,17 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = m_p_chargen[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; m_first = 0; } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; - - m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); - m_bitmap.pix16(y, x ) = BIT(m_code, 7); + int y = m_gal_cnt / 48 - 2; + int x = (m_gal_cnt % 48) * 8; + + m_bitmap.pix(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix(y, x ) = BIT(m_code, 7); } else { // Graphics mode @@ -70,8 +69,8 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = space.read_byte(addr) ^ 0xff; m_first = 0; } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; + int y = m_gal_cnt / 48 - 2; + int x = (m_gal_cnt % 48) * 8; /* hack - until calc of R is fixed in Z80 */ if (x == 11 * 8 && y == 0) @@ -83,14 +82,14 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = 0x00; /* end of hack */ - m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); - m_bitmap.pix16(y, x ) = BIT(m_code, 7); + m_bitmap.pix(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix(y, x ) = BIT(m_code, 7); } } m_gal_cnt++; diff --git a/src/mame/video/galpani2.cpp b/src/mame/video/galpani2.cpp index 2168e2d219a..186be0d1c63 100644 --- a/src/mame/video/galpani2.cpp +++ b/src/mame/video/galpani2.cpp @@ -78,13 +78,13 @@ void galpani2_state::copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const int y = + ( *m_bg8_scrolly[layer] + 0x200 - 0x0f5 ); uint16_t* ram = m_bg8[layer]; - const pen_t *clut = &m_bg8palette->pen(0); + pen_t const *const clut = &m_bg8palette->pen(0); for (int xx = 0; xx < 320; xx++) { for (int yy = 0; yy < 240; yy++) { uint16_t pen = ram[(((y + yy) & 0xff) * 512) + ((x + xx) & 0x1ff)]; - if (pen) bitmap.pix32(yy, xx) = clut[pen & 0xff]; + if (pen) bitmap.pix(yy, xx) = clut[pen & 0xff]; } } } @@ -101,13 +101,13 @@ void galpani2_state::copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const //int x = 0; //int y = 0; - const pen_t *clut = &m_bg15palette->pen(0); + pen_t const *const clut = &m_bg15palette->pen(0); for (int xx = 0; xx < 320; xx++) { for (int yy = 0; yy < 240; yy++) { uint16_t pen = ram[(xx * 0x800) + yy]; - bitmap.pix32(yy, xx) = clut[pen & 0x7fff]; + bitmap.pix(yy, xx) = clut[pen & 0x7fff]; } } } diff --git a/src/mame/video/galpanic.cpp b/src/mame/video/galpanic.cpp index 994ce0b799b..a306fc143b9 100644 --- a/src/mame/video/galpanic.cpp +++ b/src/mame/video/galpanic.cpp @@ -28,18 +28,18 @@ void galpanic_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mas int sy = offset / 256; int sx = offset % 256; - m_bitmap.pix16(sy, sx) = 1024 + (data >> 1); + m_bitmap.pix(sy, sx) = 1024 + (data >> 1); } void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { for (int offs = 0;offs < m_fgvideoram.bytes()/2;offs++) { - int sx = offs % 256; - int sy = offs / 256; - int color = m_fgvideoram[offs]; + int const sx = offs % 256; + int const sy = offs / 256; + int const color = m_fgvideoram[offs]; if (color) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } diff --git a/src/mame/video/galspnbl.cpp b/src/mame/video/galspnbl.cpp index d93f8387511..d1c1c611588 100644 --- a/src/mame/video/galspnbl.cpp +++ b/src/mame/video/galspnbl.cpp @@ -22,7 +22,7 @@ void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cli int const y = offs >> 9; int const x = offs & 0x1ff; - bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1); + bitmap.pix(y, x) = 1024 + (m_bgvideoram[offs] >> 1); } } @@ -36,8 +36,8 @@ void galspnbl_state::mix_sprite_layer(screen_device &screen, bitmap_ind16 &bitma { for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dd = &bitmap.pix16(y); - uint16_t *sd2 = &m_sprite_bitmap.pix16(y); + uint16_t *const dd = &bitmap.pix(y); + uint16_t const *const sd2 = &m_sprite_bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp index 70cfd554ac1..2aed5a48e83 100644 --- a/src/mame/video/gamate.cpp +++ b/src/mame/video/gamate.cpp @@ -274,7 +274,7 @@ uint32_t gamate_video_device::screen_update(screen_device &screen, bitmap_ind16 if (m_displayblank) pix = 0; - bitmap.pix16(y, x) = pix; + bitmap.pix(y, x) = pix; } } diff --git a/src/mame/video/gamecom.cpp b/src/mame/video/gamecom.cpp index ea987a07adc..41403441bbb 100644 --- a/src/mame/video/gamecom.cpp +++ b/src/mame/video/gamecom.cpp @@ -23,9 +23,8 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) } else { - uint8_t *line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; + uint8_t const *const line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; int pal[4]; - int i; switch( m_p_ram[SM8521_LCDC] & 0x30 ) { @@ -54,13 +53,13 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) pal[3] = 0; break; } - for( i = 0; i < 40; i++ ) + for( int i = 0; i < 40; i++ ) { uint8_t p = line[i]; - m_bitmap.pix16(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; - m_bitmap.pix16(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; - m_bitmap.pix16(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; - m_bitmap.pix16(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; + m_bitmap.pix(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; + m_bitmap.pix(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; + m_bitmap.pix(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; + m_bitmap.pix(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; } } diff --git a/src/mame/video/gameplan.cpp b/src/mame/video/gameplan.cpp index 85b8d5216a7..0438c012db5 100644 --- a/src/mame/video/gameplan.cpp +++ b/src/mame/video/gameplan.cpp @@ -96,16 +96,15 @@ void gameplan_state::leprechn_get_pens( pen_t *pens ) uint32_t gameplan_state::screen_update_gameplan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[GAMEPLAN_NUM_PENS]; - offs_t offs; gameplan_get_pens(pens); - for (offs = 0; offs < m_videoram_size; offs++) + for (offs_t offs = 0; offs < m_videoram_size; offs++) { uint8_t y = offs >> 8; uint8_t x = offs & 0xff; - bitmap.pix32(y, x) = pens[m_videoram[offs] & 0x07]; + bitmap.pix(y, x) = pens[m_videoram[offs] & 0x07]; } return 0; @@ -115,16 +114,15 @@ uint32_t gameplan_state::screen_update_gameplan(screen_device &screen, bitmap_rg uint32_t gameplan_state::screen_update_leprechn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[LEPRECHN_NUM_PENS]; - offs_t offs; leprechn_get_pens(pens); - for (offs = 0; offs < m_videoram_size; offs++) + for (offs_t offs = 0; offs < m_videoram_size; offs++) { uint8_t y = offs >> 8; uint8_t x = offs & 0xff; - bitmap.pix32(y, x) = pens[m_videoram[offs] & (LEPRECHN_NUM_PENS-1)]; + bitmap.pix(y, x) = pens[m_videoram[offs] & (LEPRECHN_NUM_PENS-1)]; } return 0; diff --git a/src/mame/video/gaplus.cpp b/src/mame/video/gaplus.cpp index 2691ff9bedc..ff72474ac4e 100644 --- a/src/mame/video/gaplus.cpp +++ b/src/mame/video/gaplus.cpp @@ -262,7 +262,7 @@ void gaplus_base_state::starfield_render(bitmap_ind16 &bitmap) if (x >= 0 && x < width && y >= 0 && y < height) { - bitmap.pix16(y, x) = m_stars[i].col; + bitmap.pix(y, x) = m_stars[i].col; } } } diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp index 87120366b7a..08603b09784 100644 --- a/src/mame/video/gauntlet.cpp +++ b/src/mame/video/gauntlet.cpp @@ -168,8 +168,8 @@ uint32_t gauntlet_state::screen_update_gauntlet(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/gic.cpp b/src/mame/video/gic.cpp index 9f9f8d8aff8..65deaf5b7f7 100644 --- a/src/mame/video/gic.cpp +++ b/src/mame/video/gic.cpp @@ -118,7 +118,7 @@ void gic_device::device_start() m_vblank_timer->adjust( screen().time_until_pos(1, END_ACTIVE_SCAN + 18 ), 0, screen().scan_period() ); // allocate the audio stream - m_stream = stream_alloc_legacy( 0, 1, clock()/(2*228) ); + m_stream = stream_alloc( 0, 1, clock()/(2*228) ); m_ram.resolve_safe(0xff); } @@ -147,7 +147,7 @@ void gic_device::draw_char_left(int startx, int starty, uint8_t code, bitmap_ind uint8_t curry= starty+y; for(uint8_t x=0x20;x!=0;x=x/2){ if (current&x) - m_bitmap.pix16(curry,startx+nextx) = GIC_WHITE; + m_bitmap.pix(curry,startx+nextx) = GIC_WHITE; nextx++; } } @@ -161,15 +161,15 @@ void gic_device::draw_char_right(int startx, int starty, uint8_t code, bitmap_in uint8_t nextx=0; uint8_t curry= starty+y; - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; nextx++; for(uint8_t x=0x20;x!=0;x=x/2){ - m_bitmap.pix16(curry,startx+nextx) = (current&x)?GIC_WHITE:bg_col; + m_bitmap.pix(curry,startx+nextx) = (current&x)?GIC_WHITE:bg_col; nextx++; } - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; nextx++; - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; } } @@ -252,9 +252,9 @@ void gic_device::device_timer(emu_timer &timer, device_timer_id id, int param, v #define GIC_AUDIO_BYTE 0x96 -void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gic_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; //Audio is basic and badly implemented (doubt that was the intent) //The datasheet lists the 3 different frequencies the GIC can generate: 500,1000 and 2000Hz @@ -298,8 +298,7 @@ void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_ uint8_t audioByte = m_ram(GIC_AUDIO_BYTE)*2; if(!audioByte){ - for(size_t i = 0; i < samples; i++) - *buffer++ = 0; + buffer.fill(0); m_audioval = 0; m_audiocnt = 0; @@ -314,12 +313,12 @@ void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_ m_audioreset = 0; } - for(size_t i=0; i < samples; i++){ + for(size_t i=0; i < buffer.samples(); i++){ m_audiocnt++; if(m_audiocnt >= audioByte){ m_audioval = !m_audioval; m_audiocnt=0; } - *buffer++ = m_audioval<<13; + buffer.put(i, m_audioval ? 1.0 : 0.0); } } diff --git a/src/mame/video/gic.h b/src/mame/video/gic.h index a393b88c4e2..579ddec7b12 100644 --- a/src/mame/video/gic.h +++ b/src/mame/video/gic.h @@ -74,7 +74,7 @@ protected: virtual const tiny_rom_entry *device_rom_region() const override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; /* timers */ static const device_timer_id TIMER_VBLANK = 0; diff --git a/src/mame/video/gladiatr.cpp b/src/mame/video/gladiatr.cpp index 378c32228c2..bda3c5ed176 100644 --- a/src/mame/video/gladiatr.cpp +++ b/src/mame/video/gladiatr.cpp @@ -278,10 +278,10 @@ uint32_t ppking_state::screen_update_ppking(screen_device &screen, bitmap_ind16 int x = sx; int y = (sy + m_fg_scrolly) & 0x1ff; - uint16_t *dest = &bitmap.pix16(sy, sx); + uint16_t *dest = &bitmap.pix(sy, sx); while( x <= cliprect.max_x ) { - if( flagsbitmap.pix8(y, x)&TILEMAP_PIXEL_LAYER0 ) + if( flagsbitmap.pix(y, x)&TILEMAP_PIXEL_LAYER0 ) { *dest += 512; } diff --git a/src/mame/video/glass.cpp b/src/mame/video/glass.cpp index f0e0d89e453..c20835ac0f6 100644 --- a/src/mame/video/glass.cpp +++ b/src/mame/video/glass.cpp @@ -69,19 +69,17 @@ void glass_state::blitter_w(uint16_t data) /* fill the screen bitmap with the current picture */ { - int i, j; - - uint8_t *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; + uint8_t const *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; if ((m_blitter_command & 0x18) != 0) { - for (j = 0; j < 200; j++) + for (int j = 0; j < 200; j++) { - for (i = 0; i < 320; i++) + for (int i = 0; i < 320; i++) { - int color = *gfx; + int const color = *gfx; gfx++; - m_screen_bitmap->pix16(j, i) = color & 0xff; + m_screen_bitmap->pix(j, i) = color & 0xff; } } } diff --git a/src/mame/video/gomoku.cpp b/src/mame/video/gomoku.cpp index d9e3c77560b..17d6c6266af 100644 --- a/src/mame/video/gomoku.cpp +++ b/src/mame/video/gomoku.cpp @@ -121,7 +121,7 @@ void gomoku_state::video_start() if (bgdata & 0x01) color = 0x21; // board (brown) if (bgdata & 0x02) color = 0x20; // frame line (while) - m_bg_bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + m_bg_bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } @@ -170,7 +170,7 @@ uint32_t gomoku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else continue; - bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } @@ -198,7 +198,7 @@ uint32_t gomoku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else continue; - bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } } diff --git a/src/mame/video/gp9001.cpp b/src/mame/video/gp9001.cpp index 6a42ea9c6e7..04e9cac909a 100644 --- a/src/mame/video/gp9001.cpp +++ b/src/mame/video/gp9001.cpp @@ -778,8 +778,8 @@ void gp9001vdp_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip if (cliprect.contains(drawxx, drawyy)) { const u8 pix = srcdata[count]; - u16* dstptr = &bitmap.pix16(drawyy, drawxx); - u8* dstpri = &this->custom_priority_bitmap->pix8(drawyy, drawxx); + u16 *const dstptr = &bitmap.pix(drawyy, drawxx); + u8 *const dstpri = &this->custom_priority_bitmap->pix(drawyy, drawxx); if (priority >= dstpri[0]) { @@ -820,9 +820,9 @@ void gp9001vdp_device::draw_custom_tilemap( bitmap_ind16 &bitmap, const rectangl { const int realy = (y + scrolly) & 0x1ff; - u16* srcptr = &tmb.pix16(realy); - u16* dstptr = &bitmap.pix16(y); - u8* dstpriptr = &this->custom_priority_bitmap->pix8(y); + u16 const *const srcptr = &tmb.pix(realy); + u16 *const dstptr = &bitmap.pix(y); + u8 *const dstpriptr = &this->custom_priority_bitmap->pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/grchamp.cpp b/src/mame/video/grchamp.cpp index 32a359f7b87..c684ae199cb 100644 --- a/src/mame/video/grchamp.cpp +++ b/src/mame/video/grchamp.cpp @@ -115,15 +115,13 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) const rectangle &visarea = m_screen->visible_area(); int y0 = 240 - m_cpu0_out[3]; int x0 = 256 - m_cpu0_out[2]; - int x,y,sx,sy; - int pixel; int result = 0; if( which==0 ) { /* draw the current player sprite into a work bitmap */ - m_gfxdecode->gfx(4)->opaque(m_work_bitmap, + m_gfxdecode->gfx(4)->opaque(m_work_bitmap, m_work_bitmap.cliprect(), m_cpu0_out[4]&0xf, 1, /* color */ @@ -131,28 +129,28 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) 0,0 ); } - for( y = 0; y <32; y++ ) + for( int y = 0; y <32; y++ ) { - for( x = 0; x<32; x++ ) + for( int x = 0; x<32; x++ ) { - pixel = m_work_bitmap.pix16(y, x); - if( pixel != sprite_transp ){ - sx = x+x0; - sy = y+y0; + int pixel = m_work_bitmap.pix(y, x); + if( pixel != sprite_transp ) + { + int sx = x+x0; + int sy = y+y0; if(visarea->contains(sx, sy)) { // Collision check uses only 16 pens! - pixel = bitmap.pix16(sy, sx) % 16; + pixel = bitmap.pix(sy, sx) % 16; if( pixel != bgcolor ) { result = 1; /* flag collision */ /* wipe this pixel, so collision checks with the ** next layer work */ - bitmap.pix16(sy, sx) = bgcolor; + bitmap.pix(sy, sx) = bgcolor; } } } - } } return result?(1<<which):0; @@ -160,17 +158,15 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) void grchamp_state::draw_fog(bitmap_ind16 &bitmap, const rectangle &cliprect, int fog) { - int x,y,offs; - // Emulation of analog fog effect - for (x = 0; x < 100; x++) + for (int x = 0; x < 100; x++) { - offs = 0x40; + int offs = 0x40; if(x > (100-FOG_SIZE-1)) offs = 0x40*(x-(100-FOG_SIZE-1)); - for(y=16;y<240;y++) + for(int y=16;y<240;y++) { - bitmap.pix16(y, x) = bitmap.pix16(y, x) + offs; + bitmap.pix(y, x) = bitmap.pix(y, x) + offs; } } } @@ -179,8 +175,8 @@ void grchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect { gfx_element *gfx = m_gfxdecode->gfx(5); int bank = (m_cpu0_out[0] & 0x20) ? 0x40 : 0x00; - const uint8_t *source = m_spriteram + 0x40; - const uint8_t *finish = source + 0x40; + uint8_t const *source = m_spriteram + 0x40; + uint8_t const *const finish = source + 0x40; while (source < finish) { @@ -189,7 +185,7 @@ void grchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int color = source[2]; int code = source[1); - gfx->transpen(bitmap,cliprect, + gfx->transpen(bitmap,cliprect, bank + (code & 0x3f), color, code & 0x40, @@ -241,14 +237,13 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) const uint8_t *prom = memregion("proms")->base() + 0x20; gfx_element *gfx; int change = (m_cpu0_out[0] & 0x20) << 3; - int num; /* first clear to 0; this is done as the previous scanline was scanned */ memset(objdata, 0, 256); /* now draw the sprites; this is done during HBLANK */ gfx = m_gfxdecode->gfx(4); - for (num = 0; num < 16; num++) + for (int num = 0; num < 16; num++) { /* Each sprite is 4 bytes. The logic reads one byte every 2H: @@ -278,10 +273,9 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) /* the fourth byte is the X position */ int sx = m_spriteram[0x43 + dataoffs]; - int x; /* draw 16 pixels */ - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { int dx = ~(x + sx) & 0xff; @@ -300,7 +294,7 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) /* finally draw the text characters; this is done as we read out the object buffers */ gfx = m_gfxdecode->gfx(0); - for (num = 0; num < 32; num++) + for (int num = 0; num < 32; num++) { /* The logic reads one byte every 4H, 64 bytes total: @@ -316,10 +310,9 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) int color = (m_spriteram[0x01 + dataoffs] & 0x07) << 2; int code = m_videoram[hprime | ((dy & 0xf8) << 2)] + change; const uint8_t *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes(); - int x; /* draw 8 pixels */ - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { int pix = src[x ^ 7]; @@ -356,74 +349,67 @@ uint32_t grchamp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma rgb_t(RGB_MAX,RGB_MAX,RGB_MAX) }; - const pen_t *bgpen = m_palette->pens(); - const uint8_t *amedata = memregion("gfx5")->base(); - const uint8_t *headdata = memregion("gfx6")->base(); - const uint8_t *pldata = memregion("gfx7")->base(); - bitmap_ind16 &lpixmap = m_left_tilemap->pixmap(); - bitmap_ind16 &rpixmap = m_right_tilemap->pixmap(); - bitmap_ind16 &cpixmap = m_center_tilemap->pixmap(); - int lrxscroll, cxscroll, lyscroll, ryscroll, cyscroll; + pen_t const *const bgpen = m_palette->pens(); + uint8_t const *const amedata = memregion("gfx5")->base(); + uint8_t const *const headdata = memregion("gfx6")->base(); + uint8_t const *const pldata = memregion("gfx7")->base(); + bitmap_ind16 const &lpixmap = m_left_tilemap->pixmap(); + bitmap_ind16 const &rpixmap = m_right_tilemap->pixmap(); + bitmap_ind16 const &cpixmap = m_center_tilemap->pixmap(); int bgcolor = m_cpu1_out[3] & 0x10; int amebase = m_cpu0_out[4] >> 4; int plbase = m_cpu0_out[4] & 0x0f; - int cxmask; - int x, y; /* ensure that the tilemaps are the same size */ assert(lpixmap.width() == rpixmap.width() && lpixmap.width() == cpixmap.width()); assert(lpixmap.height() == rpixmap.height() && lpixmap.height() == cpixmap.height()); /* extract background scroll values; left and right share the same X scroll */ - lrxscroll = m_cpu1_out[0] + (m_cpu1_out[1] & 1) * 256; - lyscroll = m_cpu1_out[2]; - ryscroll = m_cpu1_out[7]; - cxscroll = m_cpu1_out[9] + (m_cpu1_out[10] & 1) * 256; - cyscroll = m_cpu1_out[11]; + int lrxscroll = m_cpu1_out[0] + (m_cpu1_out[1] & 1) * 256; + int lyscroll = m_cpu1_out[2]; + int ryscroll = m_cpu1_out[7]; + int cxscroll = m_cpu1_out[9] + (m_cpu1_out[10] & 1) * 256; + int cyscroll = m_cpu1_out[11]; /* determine the center background mask, controlled by attribute bit 0x20 */ - cxmask = (m_cpu1_out[3] & 0x20) ? 0xff : 0x1ff; + int cxmask = (m_cpu1_out[3] & 0x20) ? 0xff : 0x1ff; /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { /* select either left or right tilemaps based on Y */ - bitmap_ind16 &lrpixmap = (y < 128) ? lpixmap : rpixmap; + bitmap_ind16 const &lrpixmap = (y < 128) ? lpixmap : rpixmap; int lryscroll = (y < 128) ? lyscroll : ryscroll; /* get source/dest pointers */ /* the Y counter starts counting when VBLANK goes to 0, which is at Y=16 */ - uint16_t *lrsrc = &lrpixmap.pix16((lryscroll + y - 16) & 0xff); - uint16_t *csrc = &cpixmap.pix16((cyscroll + y - 16) & 0xff); - uint32_t *dest = &bitmap.pix32(y); + uint16_t const *const lrsrc = &lrpixmap.pix((lryscroll + y - 16) & 0xff); + uint16_t const *const csrc = &cpixmap.pix((cyscroll + y - 16) & 0xff); + uint32_t *const dest = &bitmap.pix(y); uint8_t objdata[256]; /* draw the objects for this scanline */ draw_objects(y, objdata); /* iterate over columns */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - rgb_t finalpix; int headbit = 0; int kill = 0; - int mydh, mydv; - int objpix; - int mvid; /* the X counter starts counting when HSYNC goes to 0 */ /* HYSYNC is high from X=304 through X=336; this means it has */ /* been counting from 336 through 384 before HBLANK is low */ - mvid = csrc[(cxscroll + x + (384-336)) & cxmask]; + int mvid = csrc[(cxscroll + x + (384-336)) & cxmask]; if ((mvid & 0x0f) == 0) mvid = lrsrc[(lrxscroll + x + (384-336)) & 0x1ff]; /* objdata contains the REDA/GREENA/BLUEA states */ - objpix = objdata[x]; + int objpix = objdata[x]; /* if the headlamp is visible, determine that now */ - mydh = (m_cpu0_out[2] - x) & 0xff; - mydv = (m_cpu0_out[3] - (y - 16)) & 0xff; + int mydh = (m_cpu0_out[2] - x) & 0xff; + int mydv = (m_cpu0_out[3] - (y - 16)) & 0xff; if ((m_cpu0_out[0] & 0x10) && (mydh & 0xc0) == 0xc0 && ((mydv ^ (mydv >> 1)) & 0x40) == 0) { int bits = headdata[((mydh & 0x38) >> 3) | @@ -490,7 +476,7 @@ uint32_t grchamp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* handle collision detection between MVID and OBJECT */ if (!(m_collide & 0x1000) && (objpix & 0x08) && (mvid & 0x0f) != 0) { -osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); + osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); m_collide = 0x1000 | 0x8000 | ((~y & 0x80) << 3) | ((~y & 0xf8) << 2) | ((~x & 0xf8) >> 3); } @@ -514,6 +500,8 @@ osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); real headlamp effect */ + rgb_t finalpix; + /* if the object data is non-zero, it gets priority */ if ((objpix & 7) != 0) finalpix = objpix_lookup[objpix & 7]; diff --git a/src/mame/video/gridlee.cpp b/src/mame/video/gridlee.cpp index 9a665c204b6..b5e4cf5320a 100644 --- a/src/mame/video/gridlee.cpp +++ b/src/mame/video/gridlee.cpp @@ -128,12 +128,10 @@ void gridlee_state::gridlee_palette_select_w(uint8_t data) uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const pen_t *pens = &m_palette->pen(m_palettebank_vis * 32); - uint8_t *gfx; - int x, y, i; + pen_t const *const pens = &m_palette->pen(m_palettebank_vis * 32); /* draw scanlines from the VRAM directly */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { /* non-flipped: draw directly from the bitmap */ if (!m_cocktail_flip) @@ -144,29 +142,27 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 { int srcy = GRIDLEE_VBSTART - 1 - y; uint8_t temp[256]; - int xx; - for (xx = 0; xx < 256; xx++) + for (int xx = 0; xx < 256; xx++) temp[xx] = m_local_videoram[srcy * 256 + 255 - xx]; draw_scanline8(bitmap, 0, y, 256, temp, pens + 16); } } /* draw the sprite images */ - gfx = memregion("gfx1")->base(); - for (i = 0; i < 32; i++) + uint8_t const *const gfx = memregion("gfx1")->base(); + for (int i = 0; i < 32; i++) { - uint8_t *sprite = m_spriteram + i * 4; - uint8_t *src; + const uint8_t *sprite = m_spriteram + i * 4; int image = sprite[0]; int ypos = sprite[2] + 17 + GRIDLEE_VBEND; int xpos = sprite[3]; /* get a pointer to the source image */ - src = &gfx[64 * image]; + const uint8_t *src = &gfx[64 * image]; /* loop over y */ - for (y = 0; y < 16; y++, ypos = (ypos + 1) & 255) + for (int y = 0; y < 16; y++, ypos = (ypos + 1) & 255) { int currxor = 0; @@ -182,7 +178,7 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 int currx = xpos; /* loop over x */ - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { int ipixel = *src++; int left = ipixel >> 4; @@ -190,12 +186,12 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 /* left pixel */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx ^ currxor) = pens[left]; + bitmap.pix(ypos, currx ^ currxor) = pens[left]; currx++; /* right pixel */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx ^ currxor) = pens[right]; + bitmap.pix(ypos, currx ^ currxor) = pens[right]; currx++; } } diff --git a/src/mame/video/h01x.cpp b/src/mame/video/h01x.cpp index f5fac3b4f4e..900dee4b01d 100644 --- a/src/mame/video/h01x.cpp +++ b/src/mame/video/h01x.cpp @@ -10,28 +10,27 @@ uint32_t h01x_state::screen_update_h01x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx; - uint16_t sy=0,ma=0,x; - uint8_t skip = 16; + uint16_t sy=0; + uint8_t const skip = 16; //screen.set_visible_area(0, 336-1, 0, 192-1); // 336*192 = 84*4 * 12*16 // 12*16*84 - // uint16_t *p = &bitmap.pix16(sy++); + // uint16_t *p = &bitmap.pix(sy++); // _PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<_PixelType *>(m_base) + y * m_rowpixels + x); } // set_raw(u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) // bitmap.rowpixels() == htotal // printf("%d ", bitmap.rowpixels()); - //uint16_t *p = &bitmap.pix16(0); - for(ra=0; ra<12; ra++) { - for(y=0; y<16; y++) { - ma = ra*84*16+y; - uint16_t *p = &bitmap.pix16(sy++); - for(x=ma; x<ma+84*skip; x+=skip) { - gfx = m_vram_ptr[x]; + //uint16_t *p = &bitmap.pix(0); + for(uint8_t ra=0; ra<12; ra++) { + for(uint8_t y=0; y<16; y++) { + uint16_t const ma = ra*84*16+y; + uint16_t *p = &bitmap.pix(sy++); + for(uint16_t x=ma; x<ma+84*skip; x+=skip) { + uint8_t const gfx = m_vram_ptr[x]; *p++ = BIT(gfx, 3); *p++ = BIT(gfx, 2); *p++ = BIT(gfx, 1); diff --git a/src/mame/video/harddriv.cpp b/src/mame/video/harddriv.cpp index 1a3b8b0f535..b8277e1d88d 100644 --- a/src/mame/video/harddriv.cpp +++ b/src/mame/video/harddriv.cpp @@ -409,15 +409,13 @@ static void display_speedups(void) TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) { - uint8_t *vram_base = &m_gsp_vram[(params->rowaddr << 12) & m_vram_mask]; + if (!m_gsp_vram) return; + uint8_t const *const vram_base = &m_gsp_vram[(params->rowaddr << 12) & m_vram_mask]; - if (!vram_base) return; - - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = (params->yoffset << 9) + ((params->coladdr & 0xff) << 4) - 15 + (m_gfx_finescroll & 0x0f); - int x; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0xfff)]; if (scanline == screen.visible_area().bottom()) @@ -427,15 +425,13 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_multisync) { - uint8_t *vram_base = &m_gsp_vram[(params->rowaddr << 11) & m_vram_mask]; - - if (!vram_base) return; + if (!m_gsp_vram) return; + uint8_t const *const vram_base = &m_gsp_vram[(params->rowaddr << 11) & m_vram_mask]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = (params->yoffset << 9) + ((params->coladdr & 0xff) << 3) - 7 + (m_gfx_finescroll & 0x07); - int x; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0x7ff)]; if (scanline == screen.visible_area().bottom()) diff --git a/src/mame/video/hec2hrp.cpp b/src/mame/video/hec2hrp.cpp index 9212b796b80..77011d332fe 100644 --- a/src/mame/video/hec2hrp.cpp +++ b/src/mame/video/hec2hrp.cpp @@ -45,7 +45,7 @@ void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, uint8_t *page, int ymax, int int ma = 0; for (int y = 0; y <= ymax; y++) { - uint16_t *pix = &bitmap.pix16(sy++); + uint16_t *pix = &bitmap.pix(sy++); for (int x = ma; x < ma + yram; x++) { uint8_t gfx = *(page + x); @@ -71,7 +71,7 @@ void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, uint8_t *page, int ymax, in int ma = 0; for (int y = 0; y <= ymax; y++) { - uint16_t *pix = &bitmap.pix16(sy++); + uint16_t *pix = &bitmap.pix(sy++); for (int x = ma; x < ma + yram; x++) { uint8_t gfx = *(page + x); diff --git a/src/mame/video/hnayayoi.cpp b/src/mame/video/hnayayoi.cpp index ec3c6f95924..8afb5f9359b 100644 --- a/src/mame/video/hnayayoi.cpp +++ b/src/mame/video/hnayayoi.cpp @@ -200,7 +200,7 @@ void hnayayoi_state::draw_layer_interleaved(bitmap_rgb32 &bitmap, const rectangl { uint8_t *src1 = &m_pixmap[left_pixmap][(row & 255) * 256]; uint8_t *src2 = &m_pixmap[right_pixmap][(row & 255) * 256]; - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); const pen_t *pal = &m_palette->pens()[palbase * 16]; diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp index 5b24b36ae62..86d76c647a6 100644 --- a/src/mame/video/hng64.cpp +++ b/src/mame/video/hng64.cpp @@ -240,11 +240,11 @@ do { void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t *tmap, const blit_parameters *blit, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound) { - const pen_t *clut = &m_palette->pen(blit->tilemap_priority_code >> 16); + pen_t const *const clut = &m_palette->pen(blit->tilemap_priority_code >> 16); bitmap_ind8 &priority_bitmap = screen.priority(); bitmap_rgb32 &destbitmap = *blit->bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - bitmap_ind8 &flagsmap = tmap->flagsmap(); + const bitmap_ind16 &srcbitmap = tmap->pixmap(); + const bitmap_ind8 &flagsmap = tmap->flagsmap(); const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; @@ -253,27 +253,16 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * uint8_t mask = blit->mask; uint8_t value = blit->value; uint8_t alpha = blit->alpha; - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; - uint32_t *dest; - uint8_t *pri; - const uint16_t *src; - const uint8_t *maskptr; /* pre-advance based on the cliprect */ startx += blit->cliprect.min_x * incxx + blit->cliprect.min_y * incyx; starty += blit->cliprect.min_x * incxy + blit->cliprect.min_y * incyy; /* extract start/end points */ - sx = blit->cliprect.min_x; - sy = blit->cliprect.min_y; - ex = blit->cliprect.max_x; - ey = blit->cliprect.max_y; + int sx = blit->cliprect.min_x; + int sy = blit->cliprect.min_y; + int ex = blit->cliprect.max_x; + int ey = blit->cliprect.max_y; /* optimized loop for the not rotated case */ if (incxy == 0 && incyx == 0 && !wraparound) @@ -296,15 +285,15 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * if (starty < heightshifted) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty >> 16; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty >> 16; /* get source and priority pointers */ - pri = &priority_bitmap.pix8(sy, sx); - src = &srcbitmap.pix16(cy); - maskptr = &flagsmap.pix8(cy); - dest = &destbitmap.pix32(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); + uint16_t const *const src = &srcbitmap.pix(cy); + uint8_t const *const maskptr = &flagsmap.pix(cy); + uint32_t *dest = &destbitmap.pix(sy, sx); /* loop over columns */ while (x <= ex && cx < widthshifted) @@ -337,21 +326,21 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * while (sy <= ey) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; /* get dest and priority pointers */ - dest = &destbitmap.pix32(sy, sx); - pri = &priority_bitmap.pix8(sy, sx); + uint32_t *dest = &destbitmap.pix(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) { /* plot if we match the mask */ - if ((flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); *pri = (*pri & (priority >> 8)) | priority; } @@ -377,22 +366,22 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * while (sy <= ey) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; /* get dest and priority pointers */ - dest = &destbitmap.pix32(sy, sx); - pri = &priority_bitmap.pix8(sy, sx); + uint32_t *dest = &destbitmap.pix(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) { /* plot if we're within the bitmap and we match the mask */ if (cx < widthshifted && cy < heightshifted) - if ((flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix16(cy >> 16, cx >> 16)); + HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix(cy >> 16, cx >> 16)); *pri = (*pri & (priority >> 8)) | priority; } @@ -573,11 +562,7 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, } // Set the transmask so our manual copy is correct - int transmask = 0x00; - if (bppBit) - transmask = 0xff; - else - transmask = 0xf; + const int transmask = bppBit ? 0xff : 0xf; if (floorModeBit == 0x0000) { @@ -614,7 +599,7 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, //if (lineCount < visarea.height()) //{ // for (int ii = 0; ii < visarea.width(); ii++) - // bitmap.pix32((visarea.height()-lineCount), ii) = 0xff00ff00; + // bitmap.pix((visarea.height()-lineCount), ii) = 0xff00ff00; //} // HACK : Clear RAM - this is "needed" in fatfurwa since it doesn't clear its own ram (buriki does) @@ -654,13 +639,13 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, // } // else // 'simple' mode with linescroll, used in some ss64_2 levels (assumed to be correct, but doesn't do much with it.. so could be wrong) { - int32_t xtopleft, xmiddle; - int32_t ytopleft, ymiddle; - for (int line=0; line < 448; line++) { clip.min_y = clip.max_y = line; + int32_t xtopleft, xmiddle; + int32_t ytopleft, ymiddle; + if (global_zoom_disable) // disable all scrolling / zoom (test screen) (maybe) { // If this bit is active the scroll registers don't seem valid at all? @@ -713,10 +698,6 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, */ - int32_t xtopleft,xmiddle, xalt; - int32_t ytopleft,ymiddle, yalt; - int xinc, xinc2, yinc, yinc2; - #if HNG64_VIDEO_DEBUG if (0) if (tm==2) @@ -732,53 +713,44 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, /*m_videoram[(0x4001c+(scrollbase<<4))/4]);*/ // unused? (dupe value on fatfurwa, 00 on rest) #endif + int32_t xtopleft = (m_videoram[(0x40000+(scrollbase<<4))/4]); + const int32_t xalt = (m_videoram[(0x40004+(scrollbase<<4))/4]); // middle screen point + const int32_t xmiddle = (m_videoram[(0x40010+(scrollbase<<4))/4]); - xtopleft = (m_videoram[(0x40000+(scrollbase<<4))/4]); - xalt = (m_videoram[(0x40004+(scrollbase<<4))/4]); // middle screen point - xmiddle = (m_videoram[(0x40010+(scrollbase<<4))/4]); - - ytopleft = (m_videoram[(0x40008+(scrollbase<<4))/4]); - yalt = (m_videoram[(0x40018+(scrollbase<<4))/4]); // middle screen point - ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); - - xinc = (xmiddle - xtopleft) / 512; - yinc = (ymiddle - ytopleft) / 512; - xinc2 = (xalt-xtopleft) / 512; - yinc2 = (yalt-ytopleft) /512; + int32_t ytopleft = (m_videoram[(0x40008+(scrollbase<<4))/4]); + const int32_t yalt = (m_videoram[(0x40018+(scrollbase<<4))/4]); // middle screen point + const int32_t ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); + const int xinc = (xmiddle - xtopleft) / 512; + const int yinc = (ymiddle - ytopleft) / 512; + const int xinc2 = (xalt-xtopleft) / 512; + const int yinc2 = (yalt-ytopleft) /512; /* manual copy = slooow */ if (BLEND_TEST) { - bitmap_ind16 &bm = tilemap->pixmap(); - int bmheight = bm.height(); - int bmwidth = bm.width(); - const pen_t *paldata = m_palette->pens(); - uint32_t* dstptr; - uint16_t* srcptr; - int xx,yy; - + const bitmap_ind16 &bm = tilemap->pixmap(); + const int bmheight = bm.height(); + const int bmwidth = bm.width(); + pen_t const *const paldata = m_palette->pens(); - int tmp = xtopleft; - int tmp2 = ytopleft; //printf("start %08x end %08x start %08x end %08x\n", xtopleft, xmiddle, ytopleft, ymiddle); - for (yy=0;yy<448;yy++) + for (int yy=0; yy<448; yy++) { - dstptr = &bitmap.pix32(yy); + uint32_t *dstptr = &bitmap.pix(yy); - tmp = xtopleft; - tmp2 = ytopleft; + int tmp = xtopleft; + int tmp2 = ytopleft; - for (xx=0;xx<512;xx++) + for (int xx=0; xx<512; xx++) { int realsrcx = (xtopleft>>16)&(bmwidth-1); int realsrcy = (ytopleft>>16)&(bmheight-1); - uint16_t pen; - srcptr = &bm.pix16(realsrcy); + uint16_t const *const srcptr = &bm.pix(realsrcy); - pen = srcptr[realsrcx]; + uint16_t pen = srcptr[realsrcx]; if (pen&transmask) *dstptr = paldata[pen]; @@ -807,10 +779,6 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, /* in this mode they can only specify the top left and middle screen points for each tilemap, this allows simple zooming, but not rotation */ - int32_t xtopleft,xmiddle; - int32_t ytopleft,ymiddle; - int xinc,yinc; - #if HNG64_VIDEO_DEBUG if (0) if (tm==2) @@ -821,6 +789,9 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, m_videoram[(0x4001c+(scrollbase<<4))/4]); #endif + int32_t xtopleft,xmiddle; + int32_t ytopleft,ymiddle; + if (global_zoom_disable) // disable all scrolling / zoom (test screen) (maybe) { /* If this bit is active the scroll registers don't seem valid at all? @@ -842,40 +813,35 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); // middle screen point } - xinc = (xmiddle - xtopleft) / 512; - yinc = (ymiddle - ytopleft) / 512; + const int xinc = (xmiddle - xtopleft) / 512; + const int yinc = (ymiddle - ytopleft) / 512; /* manual copy = slooow */ if (BLEND_TEST) { - bitmap_ind16 &bm = tilemap->pixmap(); - int bmheight = bm.height(); - int bmwidth = bm.width(); - const pen_t *paldata = m_palette->pens(); - uint32_t* dstptr; - uint16_t* srcptr; - int xx,yy; + const bitmap_ind16 &bm = tilemap->pixmap(); + const int bmheight = bm.height(); + const int bmwidth = bm.width(); + pen_t const *const paldata = m_palette->pens(); int tmp = xtopleft; //printf("start %08x end %08x start %08x end %08x\n", xtopleft, xmiddle, ytopleft, ymiddle); - for (yy=0;yy<448;yy++) + for (int yy=0; yy<448; yy++) { int realsrcy = (ytopleft>>16)&(bmheight-1); - dstptr = &bitmap.pix32(yy); - srcptr = &bm.pix16(realsrcy); + uint32_t *dstptr = &bitmap.pix(yy); + uint16_t const *const srcptr = &bm.pix(realsrcy); xtopleft = tmp; - for (xx=0;xx<512;xx++) + for (int xx=0; xx<512; xx++) { int realsrcx = (xtopleft>>16)&(bmwidth-1); - uint16_t pen; - - pen = srcptr[realsrcx]; + uint16_t pen = srcptr[realsrcx]; if (pen&transmask) *dstptr = paldata[pen]; @@ -980,15 +946,13 @@ uint32_t hng64_state::screen_update_hng64(screen_device &screen, bitmap_rgb32 &b // 3d gets drawn next if(!(m_fbcontrol[0] & 0x01)) { - int x, y; - // Blit the color buffer into the primary bitmap - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *src = &m_poly_renderer->colorBuffer3d().pix32(y, cliprect.min_x); - uint32_t *dst = &bitmap.pix32(y, cliprect.min_x); + const uint32_t *src = &m_poly_renderer->colorBuffer3d().pix(y, cliprect.min_x); + uint32_t *dst = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if(*src & 0xff000000) *dst = *src; @@ -1139,13 +1103,12 @@ void hng64_state::tcram_w(offs_t offset, uint32_t data, uint32_t mem_mask) if(offset == 0x02) { - uint16_t min_x, min_y, max_x, max_y; rectangle visarea = m_screen->visible_area(); - min_x = (hng64_tcram[1] & 0xffff0000) >> 16; - min_y = (hng64_tcram[1] & 0x0000ffff) >> 0; - max_x = (hng64_tcram[2] & 0xffff0000) >> 16; - max_y = (hng64_tcram[2] & 0x0000ffff) >> 0; + const uint16_t min_x = (hng64_tcram[1] & 0xffff0000) >> 16; + const uint16_t min_y = (hng64_tcram[1] & 0x0000ffff) >> 0; + const uint16_t max_x = (hng64_tcram[2] & 0xffff0000) >> 16; + const uint16_t max_y = (hng64_tcram[2] & 0x0000ffff) >> 0; if(max_x == 0 || max_y == 0) // bail out if values are invalid, Fatal Fury WA sets this to disable the screen. { @@ -1173,8 +1136,6 @@ uint32_t hng64_state::tcram_r(offs_t offset) // Very much a work in progress - no hard testing has been done void hng64_state::transition_control( bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - // float colorScaleR, colorScaleG, colorScaleB; int32_t finR, finG, finB; @@ -1192,11 +1153,11 @@ void hng64_state::transition_control( bitmap_rgb32 &bitmap, const rectangle &cli brigG = (int32_t)((m_tcram[0x0000000a] >> 8) & 0xff); brigB = (int32_t)((m_tcram[0x0000000a] >> 16) & 0xff); - for (i = cliprect.min_x; i < cliprect.max_x; i++) + for (int i = cliprect.min_x; i < cliprect.max_x; i++) { - for (j = cliprect.min_y; j < cliprect.max_y; j++) + for (int j = cliprect.min_y; j < cliprect.max_y; j++) { - rgb_t* thePixel = reinterpret_cast<rgb_t *>(&bitmap.pix32(j, i)); + rgb_t* thePixel = reinterpret_cast<rgb_t *>(&bitmap.pix(j, i)); finR = (int32_t)thePixel->r(); finG = (int32_t)thePixel->g(); diff --git a/src/mame/video/hng64_3d.hxx b/src/mame/video/hng64_3d.hxx index 46a12c13a8b..444911ff4c3 100644 --- a/src/mame/video/hng64_3d.hxx +++ b/src/mame/video/hng64_3d.hxx @@ -1206,7 +1206,7 @@ void hng64_poly_renderer::render_scanline(int32_t scanline, const extent_t& exte const float dt = extent.param[6].dpdx; // Pointers to the pixel buffers - uint32_t* colorBuffer = &m_colorBuffer3d.pix32(scanline, extent.startx); + uint32_t* colorBuffer = &m_colorBuffer3d.pix(scanline, extent.startx); float* depthBuffer = &m_depthBuffer3d[(scanline * m_state.m_screen->visible_area().width()) + extent.startx]; const uint8_t *textureOffset = &m_state.m_texturerom[renderData.texIndex * 1024 * 1024]; @@ -1226,7 +1226,7 @@ void hng64_poly_renderer::render_scanline(int32_t scanline, const extent_t& exte if ((renderData.debugColor & 0xff000000) == 0x01000000) { // ST color mode - *colorBuffer = rgb_t(255, (uint8_t)(sCorrect*255.0f), (uint8_t)(tCorrect*255.0f), (uint8_t)(0)); + *colorBuffer = rgb_t(255, uint8_t(sCorrect*255.0f), uint8_t(tCorrect*255.0f), uint8_t(0)); } else if ((renderData.debugColor & 0xff000000) == 0x02000000) { diff --git a/src/mame/video/hp48.cpp b/src/mame/video/hp48.cpp index 0f224bae73d..572610024ef 100644 --- a/src/mame/video/hp48.cpp +++ b/src/mame/video/hp48.cpp @@ -192,7 +192,7 @@ uint32_t hp48_state::screen_update_hp48(screen_device &screen, bitmap_ind16 &bit acc += m_screens[ i ][ y ][ x+8 ]; } acc = (acc * 255) / (33 * HP48_NB_SCREENS); - bitmap.pix16(y, x ) = acc; + bitmap.pix(y, x ) = acc; } } diff --git a/src/mame/video/hyhoo.cpp b/src/mame/video/hyhoo.cpp index c953b2011c1..aeac3bc32ac 100644 --- a/src/mame/video/hyhoo.cpp +++ b/src/mame/video/hyhoo.cpp @@ -67,18 +67,11 @@ void hyhoo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void hyhoo_state::hyhoo_gfxdraw() { - uint8_t *GFX = memregion("gfx1")->base(); + uint8_t const *const GFX = memregion("gfx1")->base(); - int x, y; - int dx1, dx2, dy; int startx, starty; int sizex, sizey; int skipx, skipy; - int ctrx, ctry; - int gfxaddr, gfxlen; - uint8_t color, color1, color2; - int r, g, b; - pen_t pen; m_nb1413m3->m_busyctr = 0; @@ -109,12 +102,12 @@ void hyhoo_state::hyhoo_gfxdraw() skipy = -1; } - gfxlen = memregion("gfx1")->bytes(); - gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); + int const gfxlen = memregion("gfx1")->bytes(); + int gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); - for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) + for (int y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) { - for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) + for (int x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) { if ((gfxaddr > (gfxlen - 1))) { @@ -124,11 +117,11 @@ void hyhoo_state::hyhoo_gfxdraw() gfxaddr = 0; } - color = GFX[gfxaddr++]; + uint8_t color = GFX[gfxaddr++]; - dx1 = (2 * x + 0) & 0x1ff; - dx2 = (2 * x + 1) & 0x1ff; - dy = y & 0xff; + int dx1 = (2 * x + 0) & 0x1ff; + int dx2 = (2 * x + 1) & 0x1ff; + int dy = y & 0xff; if (m_highcolorflag & 0x04) { @@ -143,14 +136,14 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbbggrrr // dst xxbbbxxx_ggxxxrrr - r = ((color & 0x07) >> 0) & 0x07; - g = ((color & 0x18) >> 3) & 0x03; - b = ((color & 0xe0) >> 5) & 0x07; + int r = ((color & 0x07) >> 0) & 0x07; + int g = ((color & 0x18) >> 3) & 0x03; + int b = ((color & 0xe0) >> 5) & 0x07; - pen = rgb_t(pal6bit(r), pal5bit(g), pal5bit(b)); + pen_t pen = rgb_t(pal6bit(r), pal5bit(g), pal5bit(b)); - m_tmpbitmap.pix32(dy, dx1) = m_tmpbitmap.pix32(dy, dx1) | pen; - m_tmpbitmap.pix32(dy, dx2) = m_tmpbitmap.pix32(dy, dx2) | pen; + m_tmpbitmap.pix(dy, dx1) |= pen; + m_tmpbitmap.pix(dy, dx2) |= pen; } else { @@ -159,20 +152,21 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((color & 0x07) >> 0) & 0x07; - g = ((color & 0x38) >> 3) & 0x07; - b = ((color & 0xc0) >> 6) & 0x03; + int r = ((color & 0x07) >> 0) & 0x07; + int g = ((color & 0x38) >> 3) & 0x07; + int b = ((color & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx1) = pen; - m_tmpbitmap.pix32(dy, dx2) = pen; + m_tmpbitmap.pix(dy, dx1) = pen; + m_tmpbitmap.pix(dy, dx2) = pen; } } } else { // lookup table mode + uint8_t color1, color2; if (m_blitter_direction_x) { @@ -192,13 +186,13 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((~m_clut[color1] & 0x07) >> 0) & 0x07; - g = ((~m_clut[color1] & 0x38) >> 3) & 0x07; - b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03; + int r = ((~m_clut[color1] & 0x07) >> 0) & 0x07; + int g = ((~m_clut[color1] & 0x38) >> 3) & 0x07; + int b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx1) = pen; + m_tmpbitmap.pix(dy, dx1) = pen; } if (m_clut[color2]) @@ -206,13 +200,13 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((~m_clut[color2] & 0x07) >> 0) & 0x07; - g = ((~m_clut[color2] & 0x38) >> 3) & 0x07; - b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03; + int r = ((~m_clut[color2] & 0x07) >> 0) & 0x07; + int g = ((~m_clut[color2] & 0x38) >> 3) & 0x07; + int b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx2) = pen; + m_tmpbitmap.pix(dy, dx2) = pen; } } diff --git a/src/mame/video/igs017_igs031.cpp b/src/mame/video/igs017_igs031.cpp index 9248d9074df..a214d93d2e4 100644 --- a/src/mame/video/igs017_igs031.cpp +++ b/src/mame/video/igs017_igs031.cpp @@ -305,8 +305,8 @@ void igs017_igs031_device::draw_sprite(bitmap_ind16 &bitmap, const rectangle &cl { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * dimx; - u16 *dest = &bitmap.pix16(y); + u8 const *const source = source_base + y_index * dimx; + u16 *const dest = &bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { diff --git a/src/mame/video/ikki.cpp b/src/mame/video/ikki.cpp index 38ad37c38f5..f50ab80ac84 100644 --- a/src/mame/video/ikki.cpp +++ b/src/mame/video/ikki.cpp @@ -97,10 +97,10 @@ void ikki_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t const pen = m_sprite_bitmap.pix16(y, x); + uint16_t const pen = m_sprite_bitmap.pix(y, x); if (m_palette->pen_indirect(pen) != 0x100) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } } } diff --git a/src/mame/video/itech8.cpp b/src/mame/video/itech8.cpp index 003b0d2aab3..e89e5ef5496 100644 --- a/src/mame/video/itech8.cpp +++ b/src/mame/video/itech8.cpp @@ -587,9 +587,7 @@ void grmatch_state::palette_update() uint32_t itech8_state::screen_update_2layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -601,19 +599,19 @@ uint32_t itech8_state::screen_update_2layer(screen_device &screen, bitmap_rgb32 return 0; } - /* there are two layers: */ - /* top layer @ 0x00000 is only 4bpp, colors come from the first 16 palettes */ - /* bottom layer @ 0x20000 is full 8bpp */ - page_offset = m_tms34061->m_display.dispstart & 0x0ffff; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two layers: + // top layer @ 0x00000 is only 4bpp, colors come from the first 16 palettes + // bottom layer @ 0x20000 is full 8bpp + uint32_t const page_offset = m_tms34061->m_display.dispstart & 0x0ffff; + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base0 = &m_tms34061->m_display.vram[(0x00000 + page_offset + y * 256) & VRAM_MASK]; - uint8_t *base2 = &m_tms34061->m_display.vram[(0x20000 + page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base0 = &m_tms34061->m_display.vram[(0x00000 + page_offset + y * 256) & VRAM_MASK]; + uint8_t const *const base2 = &m_tms34061->m_display.vram[(0x20000 + page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int pix0 = base0[x] & 0x0f; + int const pix0 = base0[x] & 0x0f; dest[x] = pens[pix0 ? pix0 : base2[x]]; } } @@ -633,22 +631,22 @@ uint32_t grmatch_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma return 0; } - /* there are two layers: */ - /* top layer @ 0x00000 is 4bpp, colors come from TMS34070, enabled via palette control */ - /* bottom layer @ 0x20000 is 4bpp, colors come from TMS34070, enabled via palette control */ - /* 4bpp pixels are packed 2 to a byte */ - /* xscroll is set via a separate register */ - uint32_t page_offset = (m_tms34061->m_display.dispstart & 0x0ffff) | m_xscroll; + // there are two layers: + // top layer @ 0x00000 is 4bpp, colors come from TMS34070, enabled via palette control + // bottom layer @ 0x20000 is 4bpp, colors come from TMS34070, enabled via palette control + // 4bpp pixels are packed 2 to a byte + // xscroll is set via a separate register + uint32_t const page_offset = (m_tms34061->m_display.dispstart & 0x0ffff) | m_xscroll; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base0 = &m_tms34061->m_display.vram[0x00000 + ((page_offset + y * 256) & 0xffff)]; - uint8_t *base2 = &m_tms34061->m_display.vram[0x20000 + ((page_offset + y * 256) & 0xffff)]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base0 = &m_tms34061->m_display.vram[0x00000 + ((page_offset + y * 256) & 0xffff)]; + uint8_t const *const base2 = &m_tms34061->m_display.vram[0x20000 + ((page_offset + y * 256) & 0xffff)]; + uint32_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - uint8_t pix0 = base0[x / 2]; - uint8_t pix2 = base2[x / 2]; + uint8_t const pix0 = base0[x / 2]; + uint8_t const pix2 = base2[x / 2]; if ((pix0 & 0xf0) != 0) dest[x] = m_palette[0][pix0 >> 4]; @@ -667,9 +665,7 @@ uint32_t grmatch_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -681,15 +677,15 @@ uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 & return 0; } - /* there are two pages, each of which is a full 8bpp */ - /* page index is selected by the top bit of the page_select register */ - page_offset = ((m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two pages, each of which is a full 8bpp + // page index is selected by the top bit of the page_select register + uint32_t const page_offset = ((m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = pens[base[x]]; } return 0; @@ -698,9 +694,7 @@ uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 & uint32_t itech8_state::screen_update_2page_large(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -712,18 +706,18 @@ uint32_t itech8_state::screen_update_2page_large(screen_device &screen, bitmap_r return 0; } - /* there are two pages, each of which is a full 8bpp */ - /* the low 4 bits come from the bitmap directly */ - /* the upper 4 bits were latched on each write into a separate bitmap */ - /* page index is selected by the top bit of the page_select register */ - page_offset = ((~m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two pages, each of which is a full 8bpp + // the low 4 bits come from the bitmap directly + // the upper 4 bits were latched on each write into a separate bitmap + // page index is selected by the top bit of the page_select register + uint32_t const page_offset = ((~m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; - uint8_t *latch = &m_tms34061->m_display.latchram[(page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; + uint8_t const *const latch = &m_tms34061->m_display.latchram[(page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { dest[x + 0] = pens[(latch[x/2] & 0xf0) | (base[x/2] >> 4)]; dest[x + 1] = pens[((latch[x/2] << 4) & 0xf0) | (base[x/2] & 0x0f)]; diff --git a/src/mame/video/jaguar.cpp b/src/mame/video/jaguar.cpp index bb745c11dc7..b9a9b89cffb 100644 --- a/src/mame/video/jaguar.cpp +++ b/src/mame/video/jaguar.cpp @@ -775,7 +775,7 @@ void jaguar_state::scanline_update(int param) /* only run if video is enabled and we are past the "display begin" */ if ((m_gpu_regs[VMODE] & 1) && vc >= (m_gpu_regs[VDB] & 0x7ff)) { - uint32_t *dest = &m_screen_bitmap.pix32(vc >> 1); + uint32_t *dest = &m_screen_bitmap.pix(vc >> 1); int maxx = visarea.right(); int hde = effective_hvalue(m_gpu_regs[HDE]) >> 1; uint16_t x,scanline[760]; diff --git a/src/mame/video/jedi.cpp b/src/mame/video/jedi.cpp index ea68c645413..709ea5dd73c 100644 --- a/src/mame/video/jedi.cpp +++ b/src/mame/video/jedi.cpp @@ -124,7 +124,7 @@ void jedi_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect) { for (int y = cliprect.top(); y <= cliprect.bottom(); y++) for(int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix32(y, x) = m_palette->pen(bitmap.pix32(y, x)); + bitmap.pix(y, x) = m_palette->pen(bitmap.pix(y, x)); } @@ -223,8 +223,8 @@ void jedi_state::draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle the next pixel just uses the current value directly. After we done with a pixel save it for later in the line buffer RAM */ const u8 bg_tempcol = prom1[(bg_last_col << 4) | bg_col]; - bitmap.pix32(y, x + 0) = tx_col1 | prom2[(background_line_buffer[x + 0] << 4) | bg_tempcol]; - bitmap.pix32(y, x + 1) = tx_col2 | prom2[(background_line_buffer[x + 1] << 4) | bg_col]; + bitmap.pix(y, x + 0) = tx_col1 | prom2[(background_line_buffer[x + 0] << 4) | bg_tempcol]; + bitmap.pix(y, x + 1) = tx_col2 | prom2[(background_line_buffer[x + 1] << 4) | bg_col]; background_line_buffer[x + 0] = bg_tempcol; background_line_buffer[x + 1] = bg_col; @@ -296,7 +296,7 @@ void jedi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) x = x & 0x1ff; if (col) - bitmap.pix32(y, x) = (bitmap.pix32(y, x) & 0x30f) | col; + bitmap.pix(y, x) = (bitmap.pix(y, x) & 0x30f) | col; /* next pixel */ if (flip_x) diff --git a/src/mame/video/jpmimpct.cpp b/src/mame/video/jpmimpct.cpp index 2edc65cbd58..798316cfcec 100644 --- a/src/mame/video/jpmimpct.cpp +++ b/src/mame/video/jpmimpct.cpp @@ -107,14 +107,13 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_state::from_shiftreg) TMS340X0_SCANLINE_RGB32_CB_MEMBER(jpmimpct_state::scanline_update) { - uint16_t *vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { - uint16_t pixels = vram[coladdr++ & 0xff]; + uint16_t const pixels = vram[coladdr++ & 0xff]; dest[x + 0] = m_palette->pen(pixels & 0xff); dest[x + 1] = m_palette->pen(pixels >> 8); } diff --git a/src/mame/video/k001005.cpp b/src/mame/video/k001005.cpp index 55ae7629a90..b0477c51b21 100644 --- a/src/mame/video/k001005.cpp +++ b/src/mame/video/k001005.cpp @@ -880,12 +880,11 @@ void k001005_renderer::render_polygons() void k001005_renderer::draw_scanline_2d(int32_t scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; - int x; - for (x = extent.startx; x < extent.stopx; x++) + for (int x = extent.startx; x < extent.stopx; x++) { if (color & 0xff000000) { @@ -906,8 +905,8 @@ void k001005_renderer::draw_scanline_2d_tex(int32_t scanline, const extent_t &ex float v = extent.param[POLY_V].start; float du = extent.param[POLY_U].dpdx; float dv = extent.param[POLY_V].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; int texture_mirror_x = extradata.texture_mirror_x; int texture_mirror_y = extradata.texture_mirror_y; @@ -949,8 +948,8 @@ void k001005_renderer::draw_scanline(int32_t scanline, const extent_t &extent, c float dbri = extent.param[POLY_BRI].dpdx; float fog = extent.param[POLY_FOG].start; float dfog = extent.param[POLY_FOG].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; int poly_light_r = extradata.light_r + extradata.ambient_r; @@ -1039,8 +1038,8 @@ void k001005_renderer::draw_scanline_tex(int32_t scanline, const extent_t &exten int poly_fog_g = extradata.fog_g; int poly_fog_b = extradata.fog_b; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); int *x_mirror_table = m_tex_mirror_table[texture_mirror_x][texture_width].get(); int *y_mirror_table = m_tex_mirror_table[texture_mirror_y][texture_height].get(); @@ -1113,8 +1112,8 @@ void k001005_renderer::draw_scanline_gouraud_blend(int32_t scanline, const exten float db = extent.param[POLY_B].dpdx; float a = extent.param[POLY_A].start; float da = extent.param[POLY_A].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -1161,14 +1160,12 @@ void k001005_renderer::draw_scanline_gouraud_blend(int32_t scanline, const exten void k001005_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - for (j = cliprect.min_y; j <= cliprect.max_y; j++) + for (int j = cliprect.min_y; j <= cliprect.max_y; j++) { - uint32_t *bmp = &bitmap.pix32(j); - uint32_t *src = &m_fb[m_fb_page^1]->pix32(j); + uint32_t *const bmp = &bitmap.pix(j); + uint32_t const *const src = &m_fb[m_fb_page^1]->pix(j); - for (i = cliprect.min_x; i <= cliprect.max_x; i++) + for (int i = cliprect.min_x; i <= cliprect.max_x; i++) { if (src[i] & 0xff000000) { diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp index bf3105d065b..bb00c46e75c 100644 --- a/src/mame/video/k001604.cpp +++ b/src/mame/video/k001604.cpp @@ -256,7 +256,7 @@ void k001604_device::draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cli // loop over columns while (x <= ex) { - *dest = clut[pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x)]; + *dest = clut[pixmap.pix(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x)]; // advance in X cx += incxx; @@ -322,7 +322,7 @@ void k001604_device::draw_front_layer( screen_device &screen, bitmap_rgb32 &bitm // loop over columns while (x <= ex) { - uint16_t pix = pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); + uint16_t pix = pixmap.pix(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); if ((pix & 0xff) != 0) { *dest = clut[pix]; diff --git a/src/mame/video/k053246_k053247_k055673.cpp b/src/mame/video/k053246_k053247_k055673.cpp index 93bf4ac03b5..26845ed68d3 100644 --- a/src/mame/video/k053246_k053247_k055673.cpp +++ b/src/mame/video/k053246_k053247_k055673.cpp @@ -496,7 +496,7 @@ void k053247_device::zdrawgfxzoom32GP( pal_base = palette().pens() + m_gfx->colorbase() + (color % m_gfx->colors()) * granularity; shd_base = palette().shadow_table(); - dst_ptr = &bitmap.pix32(0); + dst_ptr = &bitmap.pix(0); dst_pitch = bitmap.rowpixels(); dst_minx = cliprect.min_x; dst_maxx = cliprect.max_x; diff --git a/src/mame/video/k053250.cpp b/src/mame/video/k053250.cpp index 6363569a761..6022f059d68 100644 --- a/src/mame/video/k053250.cpp +++ b/src/mame/video/k053250.cpp @@ -151,16 +151,16 @@ inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t * // calculate target increment for horizontal scanlines which is exactly one dst_adv = 1; dst_offset = dst_length; - pri_base = &priority.pix8(linepos, dst_start + dst_offset); - dst_base = &bitmap.pix32(linepos, dst_start + dst_length); + pri_base = &priority.pix(linepos, dst_start + dst_offset); + dst_base = &bitmap.pix(linepos, dst_start + dst_length); } else { // calculate target increment for vertical scanlines which is the bitmap's pitch value dst_adv = bitmap.rowpixels(); dst_offset= dst_length * dst_adv; - pri_base = &priority.pix8(dst_start, linepos + dst_offset); - dst_base = &bitmap.pix32(dst_start, linepos + dst_offset); + pri_base = &priority.pix(dst_start, linepos + dst_offset); + dst_base = &bitmap.pix(dst_start, linepos + dst_offset); } // generalized diff --git a/src/mame/video/k053250_ps.cpp b/src/mame/video/k053250_ps.cpp index 9f62bd0b0fb..dfb35d4531a 100644 --- a/src/mame/video/k053250_ps.cpp +++ b/src/mame/video/k053250_ps.cpp @@ -195,16 +195,16 @@ inline void k053250ps_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t // calculate target increment for horizontal scanlines which is exactly one dst_adv = 1; dst_offset = dst_length; - pri_base = &priority.pix8(linepos, dst_start + dst_offset); - dst_base = &bitmap.pix32(linepos, dst_start + dst_length); + pri_base = &priority.pix(linepos, dst_start + dst_offset); + dst_base = &bitmap.pix(linepos, dst_start + dst_length); } else { // calculate target increment for vertical scanlines which is the bitmap's pitch value dst_adv = bitmap.rowpixels(); dst_offset= dst_length * dst_adv; - pri_base = &priority.pix8(dst_start, linepos + dst_offset); - dst_base = &bitmap.pix32(dst_start, linepos + dst_offset); + pri_base = &priority.pix(dst_start, linepos + dst_offset); + dst_base = &bitmap.pix(dst_start, linepos + dst_offset); } // generalized diff --git a/src/mame/video/k053936.cpp b/src/mame/video/k053936.cpp index 3be4ff7a48e..a86814041c2 100644 --- a/src/mame/video/k053936.cpp +++ b/src/mame/video/k053936.cpp @@ -589,7 +589,7 @@ static inline void K053936GP_copyroz32clip( running_machine &machine, // adjust entry points and other loop constants dst_pitch = dst_bitmap.rowpixels(); - dst_base = &dst_bitmap.pix32(0); + dst_base = &dst_bitmap.pix(0); dst_base2 = sy * dst_pitch + sx + tx; ecx = tx = -tx; @@ -598,7 +598,7 @@ static inline void K053936GP_copyroz32clip( running_machine &machine, cmask = colormask[tilebpp]; src_pitch = src_bitmap.rowpixels(); - src_base = &src_bitmap.pix16(0); + src_base = &src_bitmap.pix(0); src_size = src_bitmap.width() * src_bitmap.height(); dst_size = dst_bitmap.width() * dst_bitmap.height(); dst_ptr = 0;//dst_base; diff --git a/src/mame/video/k054156_k054157_k056832.cpp b/src/mame/video/k054156_k054157_k056832.cpp index 26bc2f48982..0d50a5a3933 100644 --- a/src/mame/video/k054156_k054157_k056832.cpp +++ b/src/mame/video/k054156_k054157_k056832.cpp @@ -1177,8 +1177,8 @@ int k056832_device::update_linemap( screen_device &screen, BitmapClass &bitmap, { tile_data tileinfo = {0}; - dst_ptr = &pixmap->pix16(line); - xpr_ptr = &xprmap.pix8(line); + dst_ptr = &pixmap->pix(line); + xpr_ptr = &xprmap.pix(line); if (!all_dirty) { @@ -2106,8 +2106,8 @@ int k056832_device::altK056832_update_linemap(screen_device &screen, bitmap_rgb3 { tile_data tileinfo = {0}; - dst_ptr = &pixmap->pix16(line); - xpr_ptr = &xprmap.pix8(line); + dst_ptr = &pixmap->pix(line); + xpr_ptr = &xprmap.pix(line); if (!all_dirty) { diff --git a/src/mame/video/k054338.cpp b/src/mame/video/k054338.cpp index 11374ee01b4..8e0e61fd5c3 100644 --- a/src/mame/video/k054338.cpp +++ b/src/mame/video/k054338.cpp @@ -110,7 +110,7 @@ void k054338_device::fill_backcolor(bitmap_rgb32 &bitmap, const rectangle &clipr } else { - uint32_t *dst_ptr = &bitmap.pix32(cliprect.min_y); + uint32_t *dst_ptr = &bitmap.pix(cliprect.min_y); int dst_pitch = bitmap.rowpixels(); if ((mode & 0x01) == 0) // vertical gradient fill diff --git a/src/mame/video/k057714.cpp b/src/mame/video/k057714.cpp index 6e336987041..a61711be54a 100644 --- a/src/mame/video/k057714.cpp +++ b/src/mame/video/k057714.cpp @@ -370,7 +370,7 @@ void k057714_device::draw_frame(int frame, bitmap_ind16 &bitmap, const rectangle for (int j = 0; j < height; j++) { - uint16_t *d = &bitmap.pix16(j + m_frame[frame].y, m_frame[frame].x); + uint16_t *const d = &bitmap.pix(j + m_frame[frame].y, m_frame[frame].x); int li = (j * fb_pitch); for (int i = 0; i < width; i++) { diff --git a/src/mame/video/k1ge.cpp b/src/mame/video/k1ge.cpp index eb3d5d44447..0dec7b55d8a 100644 --- a/src/mame/video/k1ge.cpp +++ b/src/mame/video/k1ge.cpp @@ -243,13 +243,12 @@ void k1ge_device::draw_sprite_plane( uint16_t *p, uint16_t priority, int line, i void k1ge_device::draw( int line ) { - uint16_t *p = &m_bitmap->pix16(line); + uint16_t *const p = &m_bitmap->pix(line); uint16_t oowcol = m_vram[0x012] & 0x07; - int i; if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) { - for( i = 0; i < 160; i++ ) + for( int i = 0; i < 160; i++ ) { p[i] = oowcol; } @@ -258,7 +257,7 @@ void k1ge_device::draw( int line ) { uint16_t col = ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) ? m_vram[0x118] & 0x07 : 0; - for ( i = 0; i < 160; i++ ) + for ( int i = 0; i < 160; i++ ) p[i] = col; if ( m_vram[0x030] & 0x80 ) @@ -296,12 +295,12 @@ void k1ge_device::draw( int line ) draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); } - for( i = 0; i < m_wba_h; i++ ) + for( int i = 0; i < m_wba_h; i++ ) { p[i] = oowcol; } - for( i = m_wba_h + m_wsi_h; i < 160; i++ ) + for( int i = m_wba_h + m_wsi_h; i < 160; i++ ) { p[i] = oowcol; } @@ -605,17 +604,16 @@ void k2ge_device::k1ge_draw_sprite_plane( uint16_t *p, uint16_t priority, int li void k2ge_device::draw( int line ) { - uint16_t *p = &m_bitmap->pix16(line); + uint16_t *const p = &m_bitmap->pix(line); uint16_t col = 0; uint16_t oowcol; - int i; oowcol = ( m_vram[0x012] & 0x07 ) * 2; oowcol = m_vram[0x3f0 + oowcol ] | ( m_vram[0x3f1 + oowcol ] << 8 ); if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) { - for( i = 0; i < 160; i++ ) + for( int i = 0; i < 160; i++ ) { p[i] = oowcol; } @@ -630,7 +628,7 @@ void k2ge_device::draw( int line ) col = m_vram[0x3e0 + col ] | ( m_vram[0x3e1 + col ] << 8 ); /* Set the bacground color */ - for ( i = 0; i < 160; i++ ) + for ( int i = 0; i < 160; i++ ) { p[i] = col; } @@ -712,12 +710,12 @@ void k2ge_device::draw( int line ) } } - for ( i = 0; i < m_wba_h; i++ ) + for ( int i = 0; i < m_wba_h; i++ ) { p[i] = oowcol; } - for ( i = m_wba_h + m_wsi_h; i < 160; i++ ) + for ( int i = m_wba_h + m_wsi_h; i < 160; i++ ) { p[i] = oowcol; } diff --git a/src/mame/video/kaneko16.cpp b/src/mame/video/kaneko16.cpp index 4f4aff0ed8b..a52fa9ebeb2 100644 --- a/src/mame/video/kaneko16.cpp +++ b/src/mame/video/kaneko16.cpp @@ -132,7 +132,7 @@ void kaneko16_berlwall_state::video_start() if ((r & 0x10) && (b & 0x10)) g = (g - 1) & 0x1f; /* decrease with wraparound */ - m_bg15_bitmap[screen].pix16(y, x) = ((g << 10) | (r << 5) | b) & 0x7fff; + m_bg15_bitmap[screen].pix(y, x) = ((g << 10) | (r << 5) | b) & 0x7fff; } } } @@ -197,16 +197,15 @@ void kaneko16_berlwall_state::render_15bpp_bitmap(bitmap_rgb32 &bitmap, const re scrolly -= 0xff - 0x08; } - const pen_t *pal = m_bgpalette->pens(); - u16* srcbitmap; - u32* dstbitmap; + pen_t const *const pal = m_bgpalette->pens(); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - if (!flip) srcbitmap = &m_bg15_bitmap[screen].pix16( (y - scrolly) & 0xff ); - else srcbitmap = &m_bg15_bitmap[screen].pix16( 255 - ((y - scrolly) & 0xff) ); + u16 const *srcbitmap; + if (!flip) srcbitmap = &m_bg15_bitmap[screen].pix( (y - scrolly) & 0xff ); + else srcbitmap = &m_bg15_bitmap[screen].pix( 255 - ((y - scrolly) & 0xff) ); - dstbitmap = &bitmap.pix32(y); + u32 *const dstbitmap = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/kaneko_spr.cpp b/src/mame/video/kaneko_spr.cpp index 1bd0c19d02f..80800d4665e 100644 --- a/src/mame/video/kaneko_spr.cpp +++ b/src/mame/video/kaneko_spr.cpp @@ -304,9 +304,9 @@ void kaneko16_sprite_device::draw_sprites_custom(const rectangle &clip,gfx_eleme { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &m_sprites_bitmap.pix16(y); - u8 *pri = &m_sprites_maskmap.pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &m_sprites_bitmap.pix(y); + u8 *const pri = &m_sprites_maskmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -549,18 +549,15 @@ void kaneko16_sprite_device::copybitmap(bitmap_rgb32 &bitmap, const rectangle &c template<class BitmapClass> void kaneko16_sprite_device::copybitmap_common(BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap) { - const pen_t *pal = gfx(0)->palette().pens(); + pen_t const *const pal = gfx(0)->palette().pens(); - typename BitmapClass::pixel_t *dstbitmap; - int rgb; - if (sizeof(*dstbitmap) == 2) rgb = 0; - else rgb = 1; + constexpr bool rgb = sizeof(typename BitmapClass::pixel_t) != 2; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - dstbitmap = &bitmap.pix(y); - u8 *dstprimap = &priority_bitmap.pix8(y); - u16* srcbitmap = &m_sprites_bitmap.pix16(y); + typename BitmapClass::pixel_t *const dstbitmap = &bitmap.pix(y); + u8 *const dstprimap = &priority_bitmap.pix(y); + u16 *const srcbitmap = &m_sprites_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/kangaroo.cpp b/src/mame/video/kangaroo.cpp index 89425997add..bd40a7141a5 100644 --- a/src/mame/video/kangaroo.cpp +++ b/src/mame/video/kangaroo.cpp @@ -141,14 +141,13 @@ uint32_t kangaroo_state::screen_update_kangaroo(screen_device &screen, bitmap_rg uint8_t enab = (m_video_control[9] & 0x04); uint8_t pria = (~m_video_control[9] & 0x02); uint8_t prib = (~m_video_control[9] & 0x01); - int x, y; /* iterate over pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint8_t effxa = scrollx + ((x / 2) ^ xora); uint8_t effya = scrolly + (y ^ xora); diff --git a/src/mame/video/kaypro.cpp b/src/mame/video/kaypro.cpp index f2e41fc47a1..03ae32f4547 100644 --- a/src/mame/video/kaypro.cpp +++ b/src/mame/video/kaypro.cpp @@ -29,24 +29,23 @@ u32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bi During the "off" period of blanking, the first half is used. Only 5 pixels are connected from the rom to the shift register, the remaining pixels are held high. */ - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]^0x80; + u8 chr = m_vram[x]^0x80; /* Take care of flashing characters */ if ((chr < 0x80) && (m_framecnt & 0x08)) @@ -73,24 +72,23 @@ u32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bi u32 kaypro_state::screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]; + u8 chr = m_vram[x]; /* Take care of flashing characters */ if ((chr > 0x7f) && (m_framecnt & 0x08)) @@ -137,32 +135,29 @@ u32 kaypro_state::screen_update_kaypro484(screen_device &screen, bitmap_rgb32 &b MC6845_UPDATE_ROW( kaypro_state::kaypro484_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u32 *p = &bitmap.pix32(y); - u16 x; - u8 gfx,fg,bg; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) // for each character + for (u16 x = 0; x < x_count; x++) // for each character { u8 inv=0; if (x == cursor_x) inv=0xff; - u16 mem = (ma + x) & 0x7ff; - u8 chr = m_vram[mem]; - u8 attr = m_vram[mem | 0x800]; + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; + u8 const attr = m_vram[(mem+1) | 0x800]; + u8 fg, bg; if ((attr & 3) == 3) { fg = 0; bg = 2; } - else - if ((attr & 3) == 2) + else if ((attr & 3) == 2) { fg = 2; bg = 0; } - else - if ((attr & 3) == 1) + else if ((attr & 3) == 1) { fg = 0; bg = 1; @@ -178,6 +173,7 @@ MC6845_UPDATE_ROW( kaypro_state::kaypro484_update_row ) fg = bg; /* get pattern of pixels for that character scanline */ + u8 gfx; if ( (ra == 15) & (BIT(attr, 3)) ) /* underline */ gfx = 0xff; else diff --git a/src/mame/video/kc.cpp b/src/mame/video/kc.cpp index 52b37fbbe3b..b9ccc6cdbea 100644 --- a/src/mame/video/kc.cpp +++ b/src/mame/video/kc.cpp @@ -69,19 +69,17 @@ WRITE_LINE_MEMBER( kc_state::video_toggle_blink_state ) /* draw 8 pixels */ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t colour_byte, uint8_t gfx_byte) { - int pens[4]; - int px; - if (m_high_resolution) { /* High resolution: 4 colors for block */ - pens[0] = 0; // black - pens[1] = 2; // red - pens[2] = 5; // cyan - pens[3] = 7; // white + int const pens[4] = { + 0, // black + 2, // red + 5, // cyan + 7 }; // white - px = x; + int px = x; for (int a=0; a<8; a++) { @@ -89,7 +87,7 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) { - bitmap.pix16(y, px) = pen; + bitmap.pix(y, px) = pen; } px++; @@ -121,10 +119,9 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c foreground_pen = background_pen; } - pens[0] = background_pen; - pens[1] = foreground_pen; + int const pens[2] = { background_pen, foreground_pen }; - px = x; + int px = x; for (int a=0; a<8; a++) { @@ -132,10 +129,10 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) { - bitmap.pix16(y, px) = pen; + bitmap.pix(y, px) = pen; } px++; - gfx_byte = gfx_byte<<1; + gfx_byte <<= 1; } } } diff --git a/src/mame/video/klax.cpp b/src/mame/video/klax.cpp index a99221d701c..4ec30e3ae40 100644 --- a/src/mame/video/klax.cpp +++ b/src/mame/video/klax.cpp @@ -98,8 +98,8 @@ u32 klax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - const u16 *mo = &mobitmap.pix16(y); - u16 *pf = &bitmap.pix16(y); + u16 const *const mo = &mobitmap.pix(y); + u16 *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/konamigx.cpp b/src/mame/video/konamigx.cpp index 3f3cef92899..3f246d148c8 100644 --- a/src/mame/video/konamigx.cpp +++ b/src/mame/video/konamigx.cpp @@ -284,7 +284,7 @@ void konamigx_state::konamigx_mixer_init(screen_device &screen, int objdma) m_gx_objdma = 0; m_gx_primode = 0; - m_gx_objzbuf = &screen.priority().pix8(0); + m_gx_objzbuf = &screen.priority().pix(0); m_gx_shdzbuf = std::make_unique<uint8_t[]>(GX_ZBUFSIZE); gx_objpool = auto_alloc_array(machine(), struct GX_OBJ, GX_MAX_OBJECTS); @@ -327,7 +327,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap, int cltc_shdpri, /*prflp,*/ disp; // buffer can move when it's resized, so refresh the pointer - m_gx_objzbuf = &screen.priority().pix8(0); + m_gx_objzbuf = &screen.priority().pix(0); // abort if object database failed to initialize objpool = gx_objpool; @@ -778,22 +778,21 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_2(screen_device &screen, bi { if (extra_bitmap) // soccer superstars roz layer { - int xx,yy; int width = screen.width(); int height = screen.height(); - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); // the output size of the roz layer has to be doubled horizontally // so that it aligns with the sprites and normal tilemaps. This appears // to be done as a post-processing / mixing step effect // // - todo, use the pixeldouble_output I just added for vsnet instead? - for (yy=0;yy<height;yy++) + for (int yy=0;yy<height;yy++) { - uint16_t* src = &extra_bitmap->pix16(yy); - uint32_t* dst = &bitmap.pix32(yy); + uint16_t const *const src = &extra_bitmap->pix(yy); + uint32_t *const dst = &bitmap.pix(yy); int shiftpos = 0; - for (xx=0;xx<width;xx+=2) + for (int xx=0;xx<width;xx+=2) { uint16_t dat = src[(((xx/2)+shiftpos))%width]; if (dat&0xff) @@ -1462,29 +1461,27 @@ uint32_t konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rg /* Hack! draw type-1 roz layer here for testing purposes only */ if (m_gx_specialrozenable == 1) { - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); // hack, draw the roz tilemap if W is held if ( machine().input().code_pressed(KEYCODE_W) ) { - int y,x; - // make it flicker, to compare positioning //if (screen.frame_number() & 1) { - for (y=0;y<256;y++) + for (int y=0;y<256;y++) { - //uint32_t* dst = &bitmap.pix32(y); + //uint32_t *const dst = &bitmap.pix(y); // ths K053936 rendering should probably just be flipped // this is just kludged to align the racing force 2d logo - uint16_t* src = &m_gxtype1_roz_dstbitmap2->pix16(y); - //uint16_t* src = &m_gxtype1_roz_dstbitmap->pix16(y); + uint16_t const *const src = &m_gxtype1_roz_dstbitmap2->pix(y); + //uint16_t const *const src = &m_gxtype1_roz_dstbitmap->pix(y); - uint32_t* dst = &bitmap.pix32((256+16)-y); + uint32_t *const dst = &bitmap.pix((256+16)-y); - for (x=0;x<512;x++) + for (int x=0;x<512;x++) { - uint16_t dat = src[x]; + uint16_t const dat = src[x]; dst[x] = paldata[dat]; } } diff --git a/src/mame/video/ladybug.cpp b/src/mame/video/ladybug.cpp index 13171816a7f..622423fbad3 100644 --- a/src/mame/video/ladybug.cpp +++ b/src/mame/video/ladybug.cpp @@ -207,7 +207,7 @@ void zerohour_stars_device::draw(bitmap_ind16 &bitmap, rectangle const &cliprect if (cliprect.contains(xloc, yloc) && (hcond == vcond)) { if (((state & 0x000ff) == 0x000ff) && !feedback && (xloc >= firstx) && (xloc <= lastx)) - bitmap.pix16(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f); + bitmap.pix(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f); } // update LFSR state diff --git a/src/mame/video/laserbat.cpp b/src/mame/video/laserbat.cpp index 0dae5a95f7d..09af495c61b 100644 --- a/src/mame/video/laserbat.cpp +++ b/src/mame/video/laserbat.cpp @@ -177,8 +177,8 @@ uint32_t laserbat_state_base::screen_update_laserbat(screen_device &screen, bitm for (int y = cliprect.min_y; cliprect.max_y >= y; y++) { - uint16_t const *const src = &m_bitmap.pix16(flip_y ? (offs_y - y) : y); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &m_bitmap.pix(flip_y ? (offs_y - y) : y); + uint16_t *dst = &bitmap.pix(y); for (int x = cliprect.min_x; cliprect.max_x >= x; x++) { dst[x] = uint16_t(m_gfxmix->read(src[flip_x ? (offs_x - x) : x])); @@ -223,7 +223,7 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) int const max_x = m_screen->visible_area().max_x; int const x_offset = min_x - (8 * 3); int const y_offset = m_screen->visible_area().min_y - 8; - uint16_t *const row = &m_bitmap.pix16(y); + uint16_t *const row = &m_bitmap.pix(y); // wait for next scanline m_scanline_timer->adjust(m_screen->time_until_pos(y + 1, 0)); @@ -241,9 +241,9 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) m_pvi[1]->render_next_line(); m_pvi[2]->render_next_line(); } - uint16_t const *const pvi1_row = &m_pvi[0]->bitmap().pix16(y); - uint16_t const *const pvi2_row = &m_pvi[1]->bitmap().pix16(y); - uint16_t const *const pvi3_row = &m_pvi[2]->bitmap().pix16(y); + uint16_t const *const pvi1_row = &m_pvi[0]->bitmap().pix(y); + uint16_t const *const pvi2_row = &m_pvi[1]->bitmap().pix(y); + uint16_t const *const pvi3_row = &m_pvi[2]->bitmap().pix(y); // don't draw outside the visible area m_bitmap.plot_box(0, y, m_bitmap.width(), 1, 0); diff --git a/src/mame/video/lasso.cpp b/src/mame/video/lasso.cpp index edc07e73df0..cd3c1d81cab 100644 --- a/src/mame/video/lasso.cpp +++ b/src/mame/video/lasso.cpp @@ -303,14 +303,10 @@ void lasso_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - offs_t offs; pen_t pen = 0x3f; - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int bit; - uint8_t data; - uint8_t x; uint8_t y = offs >> 5; if (flip_screen_y()) @@ -319,23 +315,23 @@ void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) if ((y < cliprect.min_y) || (y > cliprect.max_y)) continue; - x = (offs & 0x1f) << 3; - data = m_bitmap_ram[offs]; + uint8_t x = (offs & 0x1f) << 3; + uint8_t data = m_bitmap_ram[offs]; if (flip_screen_x()) x = ~x; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x)) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; if (flip_screen_x()) - x = x - 1; + x--; else - x = x + 1; + x++; - data = data << 1; + data <<= 1; } } } diff --git a/src/mame/video/lazercmd.cpp b/src/mame/video/lazercmd.cpp index 818e8abdfcd..7971c9cf3bf 100644 --- a/src/mame/video/lazercmd.cpp +++ b/src/mame/video/lazercmd.cpp @@ -28,25 +28,23 @@ int lazercmd_state::vert_scale(int data) /* meadows lanes normaly use 2x2 pixels and lazer command uses either */ void lazercmd_state::plot_pattern( bitmap_ind16 &bitmap, int x, int y ) { - int xbit, ybit, size; - - size = 2; + int size = 2; if (ioport("DSW")->read() & 0x40) { size = 4; } - for (ybit = 0; ybit < 2; ybit++) + for (int ybit = 0; ybit < 2; ybit++) { if (y + ybit < 0 || y + ybit >= VERT_RES * VERT_CHR) return; - for (xbit = 0; xbit < size; xbit++) + for (int xbit = 0; xbit < size; xbit++) { if (x + xbit < 0 || x + xbit >= HORZ_RES * HORZ_CHR) continue; - bitmap.pix16(y + ybit, x + xbit) = 4; + bitmap.pix(y + ybit, x + xbit) = 4; } } } diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp index e0e33b33c03..6a8b3d065c0 100644 --- a/src/mame/video/leland.cpp +++ b/src/mame/video/leland.cpp @@ -450,7 +450,7 @@ u32 leland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con /* for each scanline in the visible region */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *const dst = &bitmap.pix16(y); + u16 *const dst = &bitmap.pix(y); u8 const *const fg_src = &m_video_ram[y << 8]; /* for each pixel on the scanline */ diff --git a/src/mame/video/lemmings.cpp b/src/mame/video/lemmings.cpp index 5851be91a0a..aa8fa71ab43 100644 --- a/src/mame/video/lemmings.cpp +++ b/src/mame/video/lemmings.cpp @@ -68,22 +68,20 @@ WRITE_LINE_MEMBER(lemmings_state::screen_vblank_lemmings) // RAM based void lemmings_state::lemmings_pixel_0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - int sx, sy, src, old; - - old = m_pixel_data[0][offset]; + int const old = m_pixel_data[0][offset]; COMBINE_DATA(&m_pixel_data[0][offset]); - src = m_pixel_data[0][offset]; + int const src = m_pixel_data[0][offset]; if (old == src) return; - sy = (offset << 1) >> 11; - sx = (offset << 1) & 0x7ff; + int const sy = (offset << 1) >> 11; + int const sx = (offset << 1) & 0x7ff; if (sx > 2047 || sy > 255) return; - m_bitmap0.pix16(sy, sx + 0) = ((src >> 8) & 0xf) | 0x100; - m_bitmap0.pix16(sy, sx + 1) = ((src >> 0) & 0xf) | 0x100; + m_bitmap0.pix(sy, sx + 0) = ((src >> 8) & 0xf) | 0x100; + m_bitmap0.pix(sy, sx + 1) = ((src >> 0) & 0xf) | 0x100; } // RAM based tiles for the FG tilemap @@ -115,16 +113,15 @@ void lemmings_state::lemmings_vram_w(offs_t offset, uint16_t data, uint16_t mem_ void lemmings_state::lemmings_copy_bitmap(bitmap_rgb32& bitmap, int* xscroll, int* yscroll, const rectangle& cliprect) { - int y,x; - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); - for (y=cliprect.top(); y<cliprect.bottom();y++) + for (int y=cliprect.top(); y<cliprect.bottom();y++) { - uint32_t* dst = &bitmap.pix32(y,0); + uint32_t *const dst = &bitmap.pix(y,0); - for (x=cliprect.left(); x<cliprect.right();x++) + for (int x=cliprect.left(); x<cliprect.right();x++) { - uint16_t src = m_bitmap0.pix16((y-*yscroll)&0xff,(x-*xscroll)&0x7ff); + uint16_t const src = m_bitmap0.pix((y-*yscroll)&0xff,(x-*xscroll)&0x7ff); if (src!=0x100) dst[x] = paldata[src]; diff --git a/src/mame/video/lethalj.cpp b/src/mame/video/lethalj.cpp index d813632965b..0eda14955c9 100644 --- a/src/mame/video/lethalj.cpp +++ b/src/mame/video/lethalj.cpp @@ -187,22 +187,22 @@ void lethalj_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) TMS340X0_SCANLINE_IND16_CB_MEMBER(lethalj_state::scanline_update) { - uint16_t *src = &m_screenram[(m_vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_screenram[(m_vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; - int x; /* blank palette: fill with white */ if (m_blank_palette) { - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = 0x7fff; if (scanline == screen.visible_area().max_y) m_blank_palette = 0; - return; } - - /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x++) - dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; + else + { + /* copy the non-blanked portions of this scanline */ + for (int x = params->heblnk; x < params->hsblnk; x++) + dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; + } } diff --git a/src/mame/video/liberatr.cpp b/src/mame/video/liberatr.cpp index 82c5cbcdc25..0c5cdbb8ad6 100644 --- a/src/mame/video/liberatr.cpp +++ b/src/mame/video/liberatr.cpp @@ -249,35 +249,29 @@ void liberatr_state::get_pens(pen_t *pens) void liberatr_state::draw_planet(bitmap_rgb32 &bitmap, pen_t *pens) { - uint8_t latitude; - - uint8_t *buffer = m_planets[m_planet_select].frames[*m_planet_frame]; + uint8_t const *buffer = m_planets[m_planet_select].frames[*m_planet_frame]; /* for each latitude */ - for (latitude = 0; latitude < 0x80; latitude++) + for (uint8_t latitude = 0; latitude < 0x80; latitude++) { - uint8_t segment; - /* grab the color value for the base (if any) at this latitude */ - uint8_t base_color = m_base_ram[latitude >> 3] ^ 0x0f; + uint8_t const base_color = m_base_ram[latitude >> 3] ^ 0x0f; - uint8_t segment_count = *buffer++; + uint8_t const segment_count = *buffer++; uint8_t x = *buffer++; - uint8_t y = 64 + latitude; + uint8_t const y = 64 + latitude; /* run through the segments, drawing its color until its x_array value comes up. */ - for (segment = 0; segment < segment_count; segment++) + for (uint8_t segment = 0; segment < segment_count; segment++) { - uint8_t i; - uint8_t color = *buffer++; uint8_t segment_length = *buffer++; if ((color & 0x0c) == 0x0c) color = base_color; - for (i = 0; i < segment_length; i++, x++) - bitmap.pix32(y, x) = pens[color]; + for (uint8_t i = 0; i < segment_length; i++, x++) + bitmap.pix(y, x) = pens[color]; } } } @@ -285,17 +279,15 @@ void liberatr_state::draw_planet(bitmap_rgb32 &bitmap, pen_t *pens) void liberatr_state::draw_bitmap(bitmap_rgb32 &bitmap, pen_t *pens) { - offs_t offs; - - for (offs = 0; offs < 0x10000; offs++) + for (offs_t offs = 0; offs < 0x10000; offs++) { - uint8_t data = m_videoram[offs]; + uint8_t const data = m_videoram[offs]; - uint8_t y = offs >> 8; - uint8_t x = offs & 0xff; + uint8_t const y = offs >> 8; + uint8_t const x = offs & 0xff; if (data) - bitmap.pix32(y, x) = pens[(data >> 5) | 0x10]; + bitmap.pix(y, x) = pens[(data >> 5) | 0x10]; } } diff --git a/src/mame/video/light.cpp b/src/mame/video/light.cpp index 8092c1db2ca..50fdb9e004b 100644 --- a/src/mame/video/light.cpp +++ b/src/mame/video/light.cpp @@ -132,10 +132,10 @@ void light_video_device::device_reset() uint32_t light_video_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - const uint8_t *src = &m_framebuffer[0]; + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint8_t const *src = &m_framebuffer[0]; for (uint32_t y = 0; y < y_res; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); for (uint32_t x = 0; x < x_res; x++) { *dst++ = pens[*src++]; } diff --git a/src/mame/video/lockon.cpp b/src/mame/video/lockon.cpp index 09051177dc3..f3513693800 100644 --- a/src/mame/video/lockon.cpp +++ b/src/mame/video/lockon.cpp @@ -166,23 +166,19 @@ void lockon_state::lockon_scene_v_scr_w(uint16_t data) void lockon_state::scene_draw( ) { - uint32_t y; - /* 3bpp characters */ const uint8_t *const gfx1 = memregion("gfx2")->base(); const uint8_t *const gfx2 = gfx1 + 0x10000; const uint8_t *const gfx3 = gfx1 + 0x20000; const uint8_t *const clut = gfx1 + 0x30000; - for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) + for (uint32_t y = 0; y < FRAMEBUFFER_MAX_Y; ++y) { - uint32_t x; uint32_t d0 = 0, d1 = 0, d2 = 0; uint32_t colour = 0; uint32_t y_offs; uint32_t x_offs; uint32_t y_gran; - uint16_t *bmpaddr; uint32_t ram_mask = 0x7ff; y_offs = (y + m_scroll_v) & 0x1ff; @@ -208,9 +204,9 @@ void lockon_state::scene_draw( ) d2 = *(gfx3 + tileidx); } - bmpaddr = &m_back_buffer->pix16(y); + uint16_t *bmpaddr = &m_back_buffer->pix(y); - for (x = 0; x < FRAMEBUFFER_MAX_X; ++x) + for (uint32_t x = 0; x < FRAMEBUFFER_MAX_X; ++x) { uint32_t x_gran = (x_offs & 7) ^ 7; uint32_t col; @@ -315,7 +311,7 @@ void lockon_state::ground_draw( ) /* TODO: Clean up and emulate CS of GFX ROMs? */ for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) { - uint16_t *bmpaddr = &m_back_buffer->pix16(y); + uint16_t *bmpaddr = &m_back_buffer->pix(y); uint8_t ls163; uint32_t clut_addr; uint32_t gfx_addr; @@ -426,38 +422,23 @@ do { \ void lockon_state::objects_draw( ) { - uint32_t offs; - const uint8_t *const romlut = memregion("user1")->base(); const uint16_t *const chklut = (uint16_t*)memregion("user2")->base(); const uint8_t *const gfxrom = memregion("gfx5")->base(); const uint8_t *const sproms = memregion("proms")->base() + 0x800; - for (offs = 0; offs < m_object_ram.bytes(); offs += 4) + for (uint32_t offs = 0; offs < m_object_ram.bytes(); offs += 4) { - uint32_t y; - uint32_t xpos; - uint32_t ypos; - uint32_t xsize; - uint32_t ysize; - uint32_t xflip; - uint32_t yflip; - uint32_t scale; - uint32_t pal; - uint32_t lines; - uint32_t opsta; - uint32_t opsta15_8; - /* Retrieve the object attributes */ - ypos = m_object_ram[offs] & 0x03ff; - xpos = m_object_ram[offs + 3] & 0x07ff; - ysize = (m_object_ram[offs] >> 10) & 0x3; - xsize = (m_object_ram[offs] >> 12) & 0x3; - yflip = BIT(m_object_ram[offs], 14); - xflip = BIT(m_object_ram[offs], 15); - scale = m_object_ram[offs + 1] & 0xff; - pal = (m_object_ram[offs + 1] >> 8) & 0x7f; - opsta = m_object_ram[offs + 2]; + uint32_t ypos = m_object_ram[offs] & 0x03ff; + uint32_t xpos = m_object_ram[offs + 3] & 0x07ff; + uint32_t ysize = (m_object_ram[offs] >> 10) & 0x3; + uint32_t xsize = (m_object_ram[offs] >> 12) & 0x3; + uint32_t yflip = BIT(m_object_ram[offs], 14); + uint32_t xflip = BIT(m_object_ram[offs], 15); + uint32_t scale = m_object_ram[offs + 1] & 0xff; + uint32_t pal = (m_object_ram[offs + 1] >> 8) & 0x7f; + uint32_t opsta = m_object_ram[offs + 2]; if (m_iden) { @@ -466,14 +447,14 @@ void lockon_state::objects_draw( ) } /* How many lines will this sprite occupy? The PAL @ IC154 knows... */ - lines = scale >> (3 - ysize); + uint32_t lines = scale >> (3 - ysize); - opsta15_8 = opsta & 0xff00; + uint32_t opsta15_8 = opsta & 0xff00; /* Account for line buffering */ ypos -=1; - for (y = 0; y < FRAMEBUFFER_MAX_Y; y++) + for (uint32_t y = 0; y < FRAMEBUFFER_MAX_Y; y++) { uint32_t cy = (y + ypos) & 0x3ff; uint32_t optab; @@ -481,7 +462,7 @@ void lockon_state::objects_draw( ) uint32_t tile; uint8_t cnt; uint32_t yidx; - uint16_t *line = &m_back_buffer->pix16(y); + uint16_t *line = &m_back_buffer->pix(y); uint32_t px = xpos; /* Outside the limits? */ @@ -683,8 +664,6 @@ do { \ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint32_t y; - /* Counters */ uint32_t cxy = m_xsal & 0xff; uint32_t cyy = m_ysal & 0x1ff; @@ -704,11 +683,10 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect uint32_t axy_en = !BIT(m_dx0ll, 8); uint32_t ayy_en = !BIT(m_dy0ll, 8); - for (y = 0; y <= cliprect.max_y; ++y) + for (uint32_t y = 0; y <= cliprect.max_y; ++y) { uint32_t carry; - uint16_t *dst = &bitmap.pix16(y); - uint32_t x; + uint16_t *dst = &bitmap.pix(y); uint32_t cx = cxy; uint32_t cy = cyy; @@ -716,12 +694,12 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect uint8_t axx = axy; uint8_t ayx = ayy; - for (x = 0; x <= cliprect.max_x; ++x) + for (uint32_t x = 0; x <= cliprect.max_x; ++x) { cx &= 0x1ff; cy &= 0x1ff; - *dst++ = m_front_buffer->pix16(cy, cx); + *dst++ = m_front_buffer->pix(cy, cx); if (axx_en) INCREMENT(axx, cx); @@ -787,12 +765,10 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint8_t *tile_rom = memregion("gfx3")->base(); - uint32_t offs; + uint8_t const *const tile_rom = memregion("gfx3")->base(); - for (offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) + for (uint32_t offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) { - uint32_t y; uint32_t y_pos; uint32_t x_pos; uint32_t y_size; @@ -825,7 +801,7 @@ void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) else y_size = 8; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (uint32_t y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint32_t xt; uint32_t cy; @@ -866,7 +842,7 @@ void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) if (x <= cliprect.max_x) { - uint16_t *dst = &bitmap.pix16(y, x); + uint16_t *const dst = &bitmap.pix(y, x); if (BIT(gfx_strip, px ^ 7) && *dst > 255) *dst = colour; diff --git a/src/mame/video/lordgun.cpp b/src/mame/video/lordgun.cpp index 755a09a887c..84b686eda1b 100644 --- a/src/mame/video/lordgun.cpp +++ b/src/mame/video/lordgun.cpp @@ -309,12 +309,10 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma // Scrolling - int x, y; - m_tilemap[0]->set_scrollx(0, *m_scroll_x[0] ); m_tilemap[0]->set_scrolly(0, *m_scroll_y[0] ); - for (y = 0; y < 0x200; y++) + for (int y = 0; y < 0x200; y++) m_tilemap[1]->set_scrollx(y, (*m_scroll_x[1]) + m_scrollram[y * 4/2 + 2/2]); m_tilemap[1]->set_scrolly(0, *m_scroll_y[1] ); @@ -331,8 +329,7 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma pen_t trans_pen = 0 * 0x800 + 0x3f; // pri = 0, pen = 3f (transparent) - int l; - for (l = 0; l < 5; l++) + for (int l = 0; l < 5; l++) m_bitmaps[l]->fill(trans_pen, cliprect); if (layers_ctrl & 1) m_tilemap[0]->draw(screen, *m_bitmaps[0], cliprect, 0, 0); @@ -348,18 +345,18 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma // layer index (0-3, 4 for sprites) -> priority address bit const int layer2bit[5] = {0,1,2,4,3}; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t pens[5]; int pri_addr = 0; // bits 0-4: layer transparency - for (l = 0; l < 5; l++) + for (int l = 0; l < 5; l++) { - pens[l] = m_bitmaps[l]->pix16(y, x); + pens[l] = m_bitmaps[l]->pix(y, x); if (pens[l] == trans_pen) pri_addr |= 1 << layer2bit[l]; } @@ -375,9 +372,9 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma pri_addr &= 0x7fff; - l = pri2layer[m_priority_ram[pri_addr] & 7]; + int l = pri2layer[m_priority_ram[pri_addr] & 7]; - bitmap.pix16(y, x) = pens[l] & 0x7ff; + bitmap.pix(y, x) = pens[l] & 0x7ff; } } diff --git a/src/mame/video/lviv.cpp b/src/mame/video/lviv.cpp index e53ccfd9768..65aeb6ced32 100644 --- a/src/mame/video/lviv.cpp +++ b/src/mame/video/lviv.cpp @@ -63,18 +63,19 @@ uint32_t lviv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int x = 0; x < 256; x += 4) { const uint8_t data = m_vram[(y << 6) | (x >> 2)]; + int pen; - int pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; - bitmap.pix16(y, x + 0) = pen; + pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; + bitmap.pix(y, x + 0) = pen; pen = m_colortable[0][((data & 0x04) >> 2) | ((data & 0x40) >> (2+3))]; - bitmap.pix16(y, x + 1) = pen; + bitmap.pix(y, x + 1) = pen; pen = m_colortable[0][((data & 0x02) >> 1) | ((data & 0x20) >> (1+3))]; - bitmap.pix16(y, x + 2) = pen; + bitmap.pix(y, x + 2) = pen; pen = m_colortable[0][((data & 0x01) >> 0) | ((data & 0x10) >> (0+3))]; - bitmap.pix16(y, x + 3) = pen; + bitmap.pix(y, x + 3) = pen; } } return 0; diff --git a/src/mame/video/m10.cpp b/src/mame/video/m10.cpp index 3a0a233c961..5cb29654aca 100644 --- a/src/mame/video/m10.cpp +++ b/src/mame/video/m10.cpp @@ -86,12 +86,12 @@ void m10_state::m15_chargen_w(offs_t offset, uint8_t data) } -inline void m10_state::plot_pixel_m10( bitmap_ind16 &bm, int x, int y, int col ) +inline void m10_state::plot_pixel_m10(bitmap_ind16 &bm, int x, int y, int col) { if (!m_flip) - bm.pix16(y, x) = col; + bm.pix(y, x) = col; else - bm.pix16((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND), + bm.pix((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND), (IREMM10_HBSTART - 1) - (x - IREMM10_HBEND)) = col; // only when flip_screen(?) } diff --git a/src/mame/video/m57.cpp b/src/mame/video/m57.cpp index 1fbd130292e..524ef9d1c45 100644 --- a/src/mame/video/m57.cpp +++ b/src/mame/video/m57.cpp @@ -170,36 +170,35 @@ void m57_state::m57_flipscreen_w(uint8_t data) void m57_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y,x; - int16_t scrolly; - // from 64 to 127: not wrapped - for (y = 64; y < 128; y++) + for (int y = 64; y < 128; y++) m_bg_tilemap->set_scrollx(y, m_scrollram[0x40]); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); // from 128 to 255: wrapped - for (y = 128; y <= cliprect.max_y; y++) + for (int y = 128; y <= cliprect.max_y; y++) { - scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8); + int16_t const scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8); if (scrolly >= 0) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if ((x + scrolly) <= cliprect.max_x) - bitmap.pix16(y, x) = bitmap.pix16(y, x + scrolly); + bitmap.pix(y, x) = bitmap.pix(y, x + scrolly); else - bitmap.pix16(y, x) = bitmap.pix16(y, cliprect.max_x); + bitmap.pix(y, x) = bitmap.pix(y, cliprect.max_x); } - } else { - for (x = cliprect.max_x; x >= cliprect.min_x; x--) + } + else + { + for (int x = cliprect.max_x; x >= cliprect.min_x; x--) { if ((x + scrolly) >= cliprect.min_x) - bitmap.pix16(y, x) = bitmap.pix16(y, x + scrolly); + bitmap.pix(y, x) = bitmap.pix(y, x + scrolly); else - bitmap.pix16(y, x) = bitmap.pix16(y, cliprect.min_x); + bitmap.pix(y, x) = bitmap.pix(y, cliprect.min_x); } } } diff --git a/src/mame/video/m58.cpp b/src/mame/video/m58.cpp index f39d9936556..c986639b8ec 100644 --- a/src/mame/video/m58.cpp +++ b/src/mame/video/m58.cpp @@ -125,8 +125,8 @@ void m58_state::scroll_panel_w(offs_t offset, uint8_t data) col = (data >> i) & 0x11; col = ((col >> 3) | col) & 3; - m_scroll_panel_bitmap.pix16(sy, sx + i) = 0x100 + (sy & 0xfc) + col; - m_scroll_panel_bitmap.pix16(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen + m_scroll_panel_bitmap.pix(sy, sx + i) = 0x100 + (sy & 0xfc) + col; + m_scroll_panel_bitmap.pix(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen } } diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp index 12ad7e3af40..b167fa870e2 100644 --- a/src/mame/video/mac.cpp +++ b/src/mame/video/mac.cpp @@ -77,23 +77,17 @@ VIDEO_START_MEMBER(mac_state,mac) uint32_t mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint32_t const video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + uint16_t const *video_ram = (const uint16_t *) (m_ram->pointer() + video_base); - video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const uint16_t *) (m_ram->pointer() + video_base); - - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + uint16_t const word = *(video_ram++); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -104,24 +98,17 @@ uint32_t mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitma uint32_t mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = m_screen_buffer ? 0x8000 : 0; - video_base += (MAC_H_VIS/8); - video_ram = (const uint16_t *) &m_vram[video_base/4]; + uint32_t const video_base = (m_screen_buffer ? 0x8000 : 0) + (MAC_H_VIS/8); + uint16_t const *const video_ram = (const uint16_t *) &m_vram[video_base/4]; - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -132,21 +119,16 @@ uint32_t mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &b uint32_t mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_ram = (const uint16_t *) m_vram16.target(); + uint16_t const *const video_ram = (const uint16_t *) m_vram16.target(); - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = video_ram[((y * 640)/16) + ((x/16))]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * 640)/16) + ((x/16))]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -157,21 +139,16 @@ uint32_t mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &b uint32_t mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint16_t const *const video_ram = (const uint16_t *) m_vram.target(); - video_ram = (const uint16_t *) m_vram.target(); - - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = video_ram[((y * 640)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * 640)/16) + ((x/16)^1)]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -182,18 +159,15 @@ uint32_t mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 & uint32_t mac_state::screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *line; - int y, x; - uint8_t pixels; - uint8_t *vram8 = (uint8_t *)m_vram.target(); + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *line = &bitmap.pix(y); - for (x = 0; x < 640/4; x++) + for (int x = 0; x < 640/4; x++) { - pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; *line++ = ((pixels>>6)&3); *line++ = ((pixels>>4)&3); @@ -359,9 +333,8 @@ VIDEO_START_MEMBER(mac_state,macv8) uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - uint8_t *vram8 = (uint8_t *)m_ram->pointer(); + uint8_t const *vram8 = (uint8_t *)m_ram->pointer(); + int hres, vres; switch (m_rbv_montype) { @@ -392,14 +365,12 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi { case 0: // 1bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0xfe|(pixels>>7)]; *scanline++ = m_rbv_palette[0xfe|((pixels>>6)&1)]; @@ -416,14 +387,12 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 1: // 2bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; @@ -436,15 +405,13 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 2: // 4bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; @@ -455,15 +422,13 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 3: // 8bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -475,9 +440,7 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - + int hres, vres; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -501,15 +464,14 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * 0x400) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * 0x400) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -526,15 +488,14 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; @@ -547,16 +508,15 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; @@ -567,16 +527,15 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -588,9 +547,7 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - + int hres, vres; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -614,15 +571,14 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * 1024) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * 1024) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -639,15 +595,14 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; @@ -660,16 +615,15 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; @@ -680,16 +634,15 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -702,9 +655,7 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres, stride; - + int hres, vres, stride; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -734,15 +685,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -759,15 +709,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; @@ -780,16 +729,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; @@ -800,16 +747,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -818,16 +763,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 4: // 16bpp { - uint16_t *vram16 = (uint16_t *)m_vram.target(); - uint16_t pixels; + uint16_t const *const vram16 = (uint16_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x++) { - pixels = vram16[(y * stride) + (x^1)]; + uint16_t const pixels = vram16[(y * stride) + (x^1)]; *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); } } @@ -838,341 +781,18 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 return 0; } -// DAFB: video for Quadra 700/900 - -void mac_state::dafb_recalc_ints() -{ - if (m_dafb_int_status != 0) - { - nubus_slot_interrupt(0xf, ASSERT_LINE); - } - else - { - nubus_slot_interrupt(0xf, CLEAR_LINE); - } -} - -TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick) -{ - m_dafb_int_status |= 1; - dafb_recalc_ints(); - - m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); -} - -TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick) -{ - m_dafb_int_status |= 4; - dafb_recalc_ints(); - - m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); -} - -VIDEO_START_MEMBER(mac_state,macdafb) -{ - m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_vbl_tick),this)); - m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_cursor_tick),this)); - - m_vbl_timer->adjust(attotime::never); - m_cursor_timer->adjust(attotime::never); -} - -VIDEO_RESET_MEMBER(mac_state,macdafb) -{ - m_rbv_count = 0; - m_rbv_clutoffs = 0; - m_rbv_montype = 6; - m_rbv_vbltime = 0; - m_dafb_int_status = 0; - m_rbv_type = RBV_TYPE_DAFB; - m_dafb_mode = 0; - m_dafb_base = 0x1000; - m_dafb_stride = 256*4; - - memset(m_rbv_palette, 0, sizeof(m_rbv_palette)); -} - -uint32_t mac_state::dafb_r(offs_t offset, uint32_t mem_mask) -{ -// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); - - switch (offset<<2) - { - case 0x1c: // inverse of monitor sense - return 7; // 21" color 2-page - - case 0x24: // SCSI 539x #1 status - return m_dafb_scsi1_drq<<9; - - case 0x28: // SCSI 539x #2 status - return m_dafb_scsi2_drq<<9; - - case 0x108: // IRQ/VBL status - return m_dafb_int_status; - - case 0x10c: // clear cursor scanline int - m_dafb_int_status &= ~4; - dafb_recalc_ints(); - break; - - case 0x114: // clear VBL int - m_dafb_int_status &= ~1; - dafb_recalc_ints(); - break; - } - return 0; -} - -void mac_state::dafb_w(offs_t offset, uint32_t data, uint32_t mem_mask) -{ -// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); - - switch (offset<<2) - { - case 0: // bits 20-9 of base - m_dafb_base &= 0x1ff; - m_dafb_base |= (data & 0xffff) << 9; -// printf("DAFB baseH: %x\n", m_dafb_base); - break; - - case 4: // bits 8-5 of base - m_dafb_base &= ~0x1ff; - m_dafb_base |= (data & 0xf) << 5; -// printf("DAFB baseL: %x\n", m_dafb_base); - break; - - case 8: - m_dafb_stride = data<<2; // stride in DWORDs -// printf("DAFB stride: %x %x\n", m_dafb_stride, data); - break; - - case 0x104: - if (data & 1) // VBL enable - { - m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); - } - else - { - m_vbl_timer->adjust(attotime::never); - m_dafb_int_status &= ~1; - dafb_recalc_ints(); - } - - if (data & 2) // aux scanline interrupt enable - { - fatalerror("DAFB: Aux scanline interrupt enable not supported!\n"); - } - - if (data & 4) // cursor scanline interrupt enable - { - m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); - } - else - { - m_cursor_timer->adjust(attotime::never); - m_dafb_int_status &= ~4; - dafb_recalc_ints(); - } - break; - - case 0x10c: // clear cursor scanline int - m_dafb_int_status &= ~4; - dafb_recalc_ints(); - break; - - case 0x114: // clear VBL int - m_dafb_int_status &= ~1; - dafb_recalc_ints(); - break; - } -} - -uint32_t mac_state::dafb_dac_r(offs_t offset, uint32_t mem_mask) -{ -// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->pc()); - - return 0; -} - -void mac_state::dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask) -{ -// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->pc()); - - switch (offset<<2) - { - case 0: - m_rbv_clutoffs = data & 0xff; - m_rbv_count = 0; - break; - - case 0x10: - m_rbv_colors[m_rbv_count++] = data&0xff; - - if (m_rbv_count == 3) - { - m_palette->set_pen_color(m_rbv_clutoffs, rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2])); - m_rbv_palette[m_rbv_clutoffs] = rgb_t(m_rbv_colors[0], m_rbv_colors[1], m_rbv_colors[2]); - m_rbv_clutoffs++; - m_rbv_count = 0; - } - break; - - case 0x20: - printf("%x to DAFB mode\n", data); - switch (data & 0x9f) - { - case 0x80: - m_dafb_mode = 0; // 1bpp - break; - - case 0x88: - m_dafb_mode = 1; // 2bpp - break; - - case 0x90: - m_dafb_mode = 2; // 4bpp - break; - - case 0x98: - m_dafb_mode = 3; // 8bpp - break; - - case 0x9c: - m_dafb_mode = 4; // 24bpp - break; - } - break; - } -} - -uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - uint32_t *scanline; - int x, y; - - switch (m_dafb_mode) - { - case 0: // 1bpp - { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152; x+=8) - { - pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; - - *scanline++ = m_rbv_palette[(pixels>>7)&1]; - *scanline++ = m_rbv_palette[(pixels>>6)&1]; - *scanline++ = m_rbv_palette[(pixels>>5)&1]; - *scanline++ = m_rbv_palette[(pixels>>4)&1]; - *scanline++ = m_rbv_palette[(pixels>>3)&1]; - *scanline++ = m_rbv_palette[(pixels>>2)&1]; - *scanline++ = m_rbv_palette[(pixels>>1)&1]; - *scanline++ = m_rbv_palette[(pixels&1)]; - } - } - } - break; - - case 1: // 2bpp - { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) - { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[((pixels>>6)&3)]; - *scanline++ = m_rbv_palette[((pixels>>4)&3)]; - *scanline++ = m_rbv_palette[((pixels>>2)&3)]; - *scanline++ = m_rbv_palette[(pixels&3)]; - } - } - } - break; - - case 2: // 4bpp - { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) - { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_rbv_palette[(pixels>>4)]; - *scanline++ = m_rbv_palette[(pixels&0xf)]; - } - } - } - break; - - case 3: // 8bpp - { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; - vram8 += m_dafb_base; - - for (y = 0; y < 870; y++) - { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) - { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; - *scanline++ = m_rbv_palette[pixels]; - } - } - } - break; - - case 4: // 24 bpp - for (y = 0; y < 480; y++) - { - uint32_t *base; - - scanline = &bitmap.pix32(y); - base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } - } - break; - } - - return 0; -} - uint32_t mac_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)/* Color PowerBooks using an off-the-shelf WD video chipset */ { - uint32_t *scanline; - int x, y; - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); // vram8 += 0x40000; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } diff --git a/src/mame/video/madalien.cpp b/src/mame/video/madalien.cpp index 7c1c2154b3c..8303131ca6a 100644 --- a/src/mame/video/madalien.cpp +++ b/src/mame/video/madalien.cpp @@ -209,8 +209,8 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr if ((hx < cliprect.left()) || (hx > cliprect.right())) continue; - if (m_headlight_bitmap->pix16(y, x) != 0) - bitmap.pix16(hy, hx) |= 8; + if (m_headlight_bitmap->pix(y, x) != 0) + bitmap.pix(hy, hx) |= 8; } } } @@ -277,7 +277,7 @@ uint32_t madalien_state::screen_update_madalien(screen_device &screen, bitmap_in for (y = cliprect.top(); y <= cliprect.bottom(); y++) for (x = min_x; x <= max_x; x++) if ((x >= cliprect.left()) && (x <= cliprect.right())) - bitmap.pix16(y, x) |= 8; + bitmap.pix(y, x) |= 8; } draw_headlight(bitmap, cliprect, flip); diff --git a/src/mame/video/magmax.cpp b/src/mame/video/magmax.cpp index 06d8643b448..0f216c1ed05 100644 --- a/src/mame/video/magmax.cpp +++ b/src/mame/video/magmax.cpp @@ -145,7 +145,7 @@ uint32_t magmax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap /*priority: background over sprites*/ if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c)) - m_bitmap.pix16(v, h) = line_data[h]; + m_bitmap.pix(v, h) = line_data[h]; } if (m_flipscreen) diff --git a/src/mame/video/malzak.cpp b/src/mame/video/malzak.cpp index efc9f7ce1b3..48745186ec7 100644 --- a/src/mame/video/malzak.cpp +++ b/src/mame/video/malzak.cpp @@ -95,20 +95,20 @@ uint32_t malzak_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { int sx = x / 2; - int s2636_pix_0 = s2636_0_bitmap.pix16(sy, sx); - int s2636_pix_1 = s2636_1_bitmap.pix16(sy, sx); - rgb_t trom_pix = m_trom_bitmap->pix32(y, x); - rgb_t play_pix = m_playfield_bitmap->pix32(sy, sx); + int s2636_pix_0 = s2636_0_bitmap.pix(sy, sx); + int s2636_pix_1 = s2636_1_bitmap.pix(sy, sx); + rgb_t trom_pix = m_trom_bitmap->pix(y, x); + rgb_t play_pix = m_playfield_bitmap->pix(sy, sx); // SAA5050 > s2636[1] > s2636[0] > playfield if (trom_pix != rgb_t::black()) - bitmap.pix32(y, x) = trom_pix; + bitmap.pix(y, x) = trom_pix; else if (S2636_IS_PIXEL_DRAWN(s2636_pix_1)) - bitmap.pix32(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_1)]; + bitmap.pix(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_1)]; else if (S2636_IS_PIXEL_DRAWN(s2636_pix_0)) - bitmap.pix32(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_0)]; + bitmap.pix(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_0)]; else - bitmap.pix32(y, x) = play_pix; + bitmap.pix(y, x) = play_pix; } } diff --git a/src/mame/video/mappy.cpp b/src/mame/video/mappy.cpp index 215f2d281a5..744ba14f4d2 100644 --- a/src/mame/video/mappy.cpp +++ b/src/mame/video/mappy.cpp @@ -507,7 +507,6 @@ void mappy_state::phozon_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cli uint32_t mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &sprite_bitmap = m_sprite_bitmap; - int x,y; m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); @@ -519,14 +518,14 @@ uint32_t mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 m_bg_tilemap->draw(screen, bitmap, cliprect, 1,0); /* sprite color 0/1 still has priority over that (ghost eyes in Pac 'n Pal) */ - for (y = 0;y < sprite_bitmap.height();y++) + for (int y = 0;y < sprite_bitmap.height();y++) { - for (x = 0;x < sprite_bitmap.width();x++) + for (int x = 0;x < sprite_bitmap.width();x++) { - int spr_entry = sprite_bitmap.pix16(y, x); + int spr_entry = sprite_bitmap.pix(y, x); int spr_pen = m_palette->pen_indirect(spr_entry); if (spr_pen == 0 || spr_pen == 1) - bitmap.pix16(y, x) = spr_entry; + bitmap.pix(y, x) = spr_entry; } } return 0; diff --git a/src/mame/video/maria.cpp b/src/mame/video/maria.cpp index 341ed274573..25e5c497dba 100644 --- a/src/mame/video/maria.cpp +++ b/src/mame/video/maria.cpp @@ -291,8 +291,7 @@ void atari_maria_device::draw_scanline() // draw line buffer to screen m_active_buffer = !m_active_buffer; // switch buffers - uint16_t *scanline; - scanline = &m_bitmap.pix16(m_screen->vpos()); + uint16_t *const scanline = &m_bitmap.pix(m_screen->vpos()); for (int i = 0; i < 160; i++) diff --git a/src/mame/video/mbc55x.cpp b/src/mame/video/mbc55x.cpp index c9ab2aac277..4f586d8e4e0 100644 --- a/src/mame/video/mbc55x.cpp +++ b/src/mame/video/mbc55x.cpp @@ -95,21 +95,12 @@ void mbc55x_state::video_debug(int ref, const std::vector<std::string> ¶ms) MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - uint8_t *ram = &m_ram->pointer()[0]; - uint8_t *red = &m_video_mem[RED_PLANE_OFFSET]; - uint8_t *blue = &m_video_mem[BLUE_PLANE_OFFSET]; - uint8_t *green; - int offset; - uint8_t rpx,gpx,bpx; - uint8_t rb,gb,bb; - - int x_pos; - int pixelno; - uint8_t bitno; - uint8_t shifts; - uint8_t colour; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + + uint8_t const *const ram = &m_ram->pointer()[0]; + uint8_t const *const red = &m_video_mem[RED_PLANE_OFFSET]; + uint8_t const *const blue = &m_video_mem[BLUE_PLANE_OFFSET]; + uint8_t const *green; switch(m_vram_page) { @@ -124,30 +115,30 @@ MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) if(DEBUG_SET(DEBUG_LINES)) logerror("MC6845_UPDATE_ROW: ma=%d, ra=%d, y=%d, x_count=%d\n",ma,ra,y,x_count); - offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; + int offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; if(DEBUG_SET(DEBUG_LINES)) logerror("offset=%05X\n",offset); - for(x_pos=0; x_pos<x_count; x_pos++) + for(int x_pos=0; x_pos<x_count; x_pos++) { uint16_t mem = (offset+(x_pos*4)) % COLOUR_PLANE_SIZE; - rpx=red[mem]; - gpx=green[mem]; - bpx=blue[mem]; + uint8_t rpx=red[mem]; + uint8_t gpx=green[mem]; + uint8_t bpx=blue[mem]; - bitno=0x80; - shifts=7; + uint8_t bitno=0x80; + uint8_t shifts=7; - for(pixelno=0; pixelno<8; pixelno++) + for(int pixelno=0; pixelno<8; pixelno++) { - rb=(rpx & bitno) >> shifts; - gb=(gpx & bitno) >> shifts; - bb=(bpx & bitno) >> shifts; + uint8_t rb=(rpx & bitno) >> shifts; + uint8_t gb=(gpx & bitno) >> shifts; + uint8_t bb=(bpx & bitno) >> shifts; - colour=(rb<<2) | (gb<<1) | (bb<<0); + uint8_t colour=(rb<<2) | (gb<<1) | (bb<<0); - bitmap.pix32(y, (x_pos*8)+pixelno)=palette[colour]; + bitmap.pix(y, (x_pos*8)+pixelno)=palette[colour]; //logerror("set pixel (%d,%d)=%d\n",y, ((x_pos*8)+pixelno),colour); bitno=bitno>>1; shifts--; diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp index 42098b97bc9..9d429184df6 100644 --- a/src/mame/video/mbee.cpp +++ b/src/mame/video/mbee.cpp @@ -102,8 +102,7 @@ void mbee_state::video_high_w(offs_t offset, u8 data) void mbee_state::port0b_w(u8 data) { - if (BIT(m_features, 0)) - m_0b = data & 1; + m_0b = BIT(data, 0); } u8 mbee_state::port08_r() @@ -252,15 +251,19 @@ u32 mbee_state::screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, MC6845_ON_UPDATE_ADDR_CHANGED( mbee_state::crtc_update_addr ) { -// parameters passed are device, address, strobe(always 0) +// parameters passed are address, strobe // not used on 256TC - oldkb_matrix_r(address); + if (strobe) + oldkb_matrix_r(address); } MC6845_UPDATE_ROW( mbee_state::crtc_update_row ) { + if (!de) + return; + const rgb_t *palette = m_palette->palette()->entry_list_raw(); // colours @@ -270,7 +273,7 @@ MC6845_UPDATE_ROW( mbee_state::crtc_update_row ) if ((monopal==0) && !BIT(m_features, 0)) monopal = 2; - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); u8 inv, attr=0, gfx, fg=96+monopal, bg=96, col=0; u16 mem, x, chr; diff --git a/src/mame/video/mcatadv.cpp b/src/mame/video/mcatadv.cpp index 38b7da27c53..56d20dde833 100644 --- a/src/mame/video/mcatadv.cpp +++ b/src/mame/video/mcatadv.cpp @@ -84,8 +84,8 @@ void mcatadv_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, c if ((drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y)) { - u16 *destline = &bitmap.pix16(drawypos); - u8 *priline = &screen.priority().pix8(drawypos); + u16 *const destline = &bitmap.pix(drawypos); + u8 *const priline = &screen.priority().pix(drawypos); for (int xcnt = xstart; xcnt != xend; xcnt += xinc) { diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp index 294bc7cabf8..c6e32759101 100644 --- a/src/mame/video/mcd212.cpp +++ b/src/mame/video/mcd212.cpp @@ -1215,15 +1215,14 @@ void mcd212_device::draw_scanline(int y) uint8_t plane_a_r[768], plane_a_g[768], plane_a_b[768]; uint8_t plane_b_r[768], plane_b_g[768], plane_b_b[768]; uint32_t out[768]; - uint32_t *scanline = &m_bitmap.pix32(y); - int x; process_vsr(0, plane_a_r, plane_a_g, plane_a_b); process_vsr(1, plane_b_r, plane_b_g, plane_b_b); mix_lines(plane_a_r, plane_a_g, plane_a_b, plane_b_r, plane_b_g, plane_b_b, out); - for(x = 0; x < 384; x++) + uint32_t *const scanline = &m_bitmap.pix(y); + for(int x = 0; x < 384; x++) { scanline[x] = out[x*2]; } diff --git a/src/mame/video/mcr.cpp b/src/mame/video/mcr.cpp index 48738c0eeef..ee0aa745b42 100644 --- a/src/mame/video/mcr.cpp +++ b/src/mame/video/mcr.cpp @@ -272,9 +272,9 @@ void mcr_state::render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) if (sy >= cliprect.min_y && sy <= cliprect.max_y) { - const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); - uint16_t *dst = &bitmap.pix16(sy); - uint8_t *pri = &screen.priority().pix8(sy); + uint8_t const *const src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); + uint16_t *const dst = &bitmap.pix(sy); + uint8_t *const pri = &screen.priority().pix(sy); /* loop over columns */ for (int x = 0; x < 32; x++) @@ -339,9 +339,9 @@ void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) if (sy >= 2 && sy >= cliprect.min_y && sy <= cliprect.max_y) { - const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); - uint16_t *dst = &bitmap.pix16(sy); - uint8_t *pri = &screen.priority().pix8(sy); + uint8_t const *const src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); + uint16_t *const dst = &bitmap.pix(sy); + uint8_t *const pri = &screen.priority().pix(sy); /* loop over columns */ for (int x = 0; x < 32; x++) diff --git a/src/mame/video/megasys1.cpp b/src/mame/video/megasys1.cpp index 8a6f6a30d3d..6c1b3b144dd 100644 --- a/src/mame/video/megasys1.cpp +++ b/src/mame/video/megasys1.cpp @@ -334,17 +334,17 @@ void megasys1_state::monkelf_scroll1_w(offs_t offset, u16 data, u16 mem_mask) void megasys1_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *decodegfx = m_gfxdecode->gfx(0); - u16 colorbase = decodegfx->colorbase(); + u16 const colorbase = decodegfx->colorbase(); for (int y = cliprect.min_y;y <= cliprect.max_y;y++) { - u16* srcline = &m_sprite_buffer_bitmap.pix16(y); - u16* dstline = &bitmap.pix16(y); - u8 *prio = &screen.priority().pix8(y); + u16 const *const srcline = &m_sprite_buffer_bitmap.pix(y); + u16 *const dstline = &bitmap.pix(y); + u8 const *const prio = &screen.priority().pix(y); for (int x = cliprect.min_x;x <= cliprect.max_x;x++) { - u16 pixel = srcline[x]; + u16 const pixel = srcline[x]; if ((pixel & 0xf) != 0xf) { @@ -366,11 +366,11 @@ void megasys1_state::partial_clear_sprite_bitmap(screen_device &screen, bitmap_i { for (int y = cliprect.min_y;y <= cliprect.max_y;y++) { - u16* srcline = &m_sprite_buffer_bitmap.pix16(y); + u16 *const srcline = &m_sprite_buffer_bitmap.pix(y); for (int x = cliprect.min_x;x <= cliprect.max_x;x++) { - u16 pixel = srcline[x]; + u16 const pixel = srcline[x]; srcline[x] = pixel & 0x7fff; // wipe our 'drawn here' marker otherwise trails will always have priority over new sprites, which is incorrect. // guess, very unclear from the video refernece we have, used when removing p47 trails @@ -397,9 +397,9 @@ inline void megasys1_state::draw_16x16_priority_sprite(screen_device &screen, bi for (s32 y = 0; y < 16; y++, sy++, sx-=16) { - // u16 *dest = &bitmap.pix16(sy)+ sx; - // u8 *prio = &screen.priority().pix8(sy) + sx; - u16* dest = &m_sprite_buffer_bitmap.pix16(sy)+ sx; + // u16 *const dest = &bitmap.pix(sy)+ sx; + // u8 *const prio = &screen.priority().pix(sy) + sx; + u16 *const dest = &m_sprite_buffer_bitmap.pix(sy)+ sx; for (s32 x = 0; x < 16; x++, sx++) { diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp index 0d3c1be9ed9..d3271d9d4e8 100644 --- a/src/mame/video/mermaid.cpp +++ b/src/mame/video/mermaid.cpp @@ -220,18 +220,14 @@ uint8_t mermaid_state::collision_check( rectangle& rect ) { uint8_t data = 0; - int x; - int y; - - for (y = rect.top(); y <= rect.bottom(); y++) - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) { - uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)) & 0x3f; - uint16_t b = m_palette->pen_indirect(m_helper2.pix16(y, x)) & 0x3f; + uint16_t const a = m_palette->pen_indirect(m_helper.pix(y, x)) & 0x3f; + uint16_t const b = m_palette->pen_indirect(m_helper2.pix(y, x)) & 0x3f; - if (b) - if (a) - data |= 0x01; + if (b && a) + data |= 0x01; } return data; diff --git a/src/mame/video/micro3d.cpp b/src/mame/video/micro3d.cpp index 79e9422b9e2..75f92bf901a 100644 --- a/src/mame/video/micro3d.cpp +++ b/src/mame/video/micro3d.cpp @@ -66,21 +66,18 @@ void micro3d_state::video_reset() TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update) { - uint16_t *src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; + uint16_t *dest = &bitmap.pix(scanline); int coladdr = params->coladdr; int sd_11_7 = (m_creg & 0x1f) << 7; - int x; - - uint16_t *frame_src; scanline = std::max((scanline - params->veblnk), 0); - frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); + uint16_t const *frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); /* TODO: XFER3DK - X/Y offsets for 3D */ /* Copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pix = src[coladdr++ & 0x1ff]; diff --git a/src/mame/video/midtunit.cpp b/src/mame/video/midtunit.cpp index afea37e9f7c..4a74af2b188 100644 --- a/src/mame/video/midtunit.cpp +++ b/src/mame/video/midtunit.cpp @@ -849,8 +849,8 @@ skipdma: TMS340X0_SCANLINE_IND16_CB_MEMBER(midtunit_video_device::scanline_update) { - uint16_t *src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; /* copy the non-blanked portions of this scanline */ @@ -861,8 +861,8 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(midtunit_video_device::scanline_update) TMS340X0_SCANLINE_IND16_CB_MEMBER(midxunit_video_device::scanline_update) { uint32_t fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 3; - uint16_t *src = &m_local_videoram[fulladdr & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[fulladdr & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); /* copy the non-blanked portions of this scanline */ for (int x = params->heblnk; x < params->hsblnk; x++) @@ -1018,7 +1018,7 @@ void midtunit_video_device::log_bitmap(int command, int bpp, bool Skip) } } - png_write_bitmap(file, nullptr, m_log_bitmap, 0, nullptr); + util::png_write_bitmap(file, nullptr, m_log_bitmap, 0, nullptr); if (m_log_json) { diff --git a/src/mame/video/midtview.ipp b/src/mame/video/midtview.ipp index 046a193e8d3..f59a101be40 100644 --- a/src/mame/video/midtview.ipp +++ b/src/mame/video/midtview.ipp @@ -266,7 +266,7 @@ uint32_t midtunit_video_device::debug_screen_update(screen_device &screen, bitma const pen_t *pens = m_debug_palette->pens(); for (int y = 0; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *dest = &bitmap.pix(y); uint16_t *src = &m_debug_videoram[y * 512]; for (int x = 0; x < cliprect.max_x; x++) { diff --git a/src/mame/video/midvunit.cpp b/src/mame/video/midvunit.cpp index 53c51aa6e31..4d8b8e977b6 100644 --- a/src/mame/video/midvunit.cpp +++ b/src/mame/video/midvunit.cpp @@ -548,7 +548,7 @@ uint32_t midvunit_state::midvunit_textureram_r(offs_t offset) uint32_t midvunit_state::screen_update_midvunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, width, xoffs; + int width, xoffs; uint32_t offset; m_poly->wait("Refresh Time"); @@ -574,10 +574,10 @@ uint32_t midvunit_state::screen_update_midvunit(screen_device &screen, bitmap_in offset += 512 * (cliprect.min_y - screen.visible_area().min_y); /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); - for (x = 0; x < width; x++) + uint16_t *dest = &bitmap.pix(y, cliprect.min_x); + for (int x = 0; x < width; x++) *dest++ = m_videoram[offset + x] & 0x7fff; offset += 512; } diff --git a/src/mame/video/midyunit.cpp b/src/mame/video/midyunit.cpp index fe3233e827f..e535d74ab75 100644 --- a/src/mame/video/midyunit.cpp +++ b/src/mame/video/midyunit.cpp @@ -557,13 +557,12 @@ TIMER_CALLBACK_MEMBER(midyunit_state::autoerase_line) TMS340X0_SCANLINE_IND16_CB_MEMBER(midyunit_state::scanline_update) { - uint16_t *src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; - int x; /* adjust the display address to account for ignored bits */ - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_pen_map[src[coladdr++ & 0x1ff]]; /* handle autoerase on the previous line */ diff --git a/src/mame/video/midzeus.cpp b/src/mame/video/midzeus.cpp index a633b565e1e..a75ac49ba13 100644 --- a/src/mame/video/midzeus.cpp +++ b/src/mame/video/midzeus.cpp @@ -281,7 +281,7 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma int xoffs = screen.visible_area().min_x; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = WAVERAM_READPIX(base, y, x - xoffs) & 0x7fff; } @@ -302,10 +302,10 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint8_t tex = get_texel_8bit(base, y, x, m_texel_width); + uint8_t const tex = get_texel_8bit(base, y, x, m_texel_width); dest[x] = (tex << 8) | tex; } } diff --git a/src/mame/video/mikromik.cpp b/src/mame/video/mikromik.cpp index 90c779d5179..ee2fb0f8fe3 100644 --- a/src/mame/video/mikromik.cpp +++ b/src/mame/video/mikromik.cpp @@ -19,7 +19,6 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) int compl_in = rvv; // reverse video int hlt_in = hlgt; // highlight; int color; // 0 = black, 1 = dk green, 2 = lt green; on MikroMikko 1, "highlight" is actually the darker shade of green - int i, qh, video_in; int d7 = BIT(romdata, 7); // save MSB (1 indicates that this is a Visual Attribute or Special Code instead of a normal display character) int d6 = BIT(romdata, 6); // save also first and last char bitmap bits before shifting out the MSB @@ -37,19 +36,19 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) // Step 2: Make sure i8275_device::recompute_parameters() is called in i8275_device::device_start() // Step 3: Fill in missing 2 pixels in the screen bitmap by repeating last column of the char bitmap // (works better with MikroMikko 1 font than duplicating the first and the last column) - qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB - video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; + int qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB + int video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; color = (hlt_in ? 1 : 2) * (video_in ^ compl_in); - bitmap.pix32(y, x + 8) = m_palette->pen(color); - bitmap.pix32(y, x + 9) = m_palette->pen(color); + bitmap.pix(y, x + 8) = m_palette->pen(color); + bitmap.pix(y, x + 9) = m_palette->pen(color); } - for (i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline + for (int i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline { - qh = BIT(data, i); - video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; + int qh = BIT(data, i); + int video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; color = (hlt_in ? 1 : 2)*(video_in ^ compl_in); - bitmap.pix32(y, x + i) = m_palette->pen(color); + bitmap.pix(y, x + i) = m_palette->pen(color); } } } @@ -75,7 +74,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels ) uint16_t data = m_video_ram[address >> 1]; for (int i = 0; i < 16; i++) { - if (BIT(data, i)) bitmap.pix32(y, x + i) = m_palette->pen(2); + if (BIT(data, i)) bitmap.pix(y, x + i) = m_palette->pen(2); } } diff --git a/src/mame/video/mmdisplay2.cpp b/src/mame/video/mmdisplay2.cpp index b3f33d21780..74bd90c4139 100644 --- a/src/mame/video/mmdisplay2.cpp +++ b/src/mame/video/mmdisplay2.cpp @@ -70,7 +70,7 @@ void mephisto_display_module2_device::lcd_palette(palette_device &palette) const HD44780_PIXEL_UPDATE(mephisto_display_module2_device::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line*9 + 1 + y, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(line*9 + 1 + y, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/video/model1.cpp b/src/mame/video/model1.cpp index 9d4c8d428da..783c796551b 100644 --- a/src/mame/video/model1.cpp +++ b/src/mame/video/model1.cpp @@ -91,7 +91,7 @@ void model1_state::view_t::project_point_direct(point_t *p) const void model1_state::draw_hline(bitmap_rgb32 &bitmap, int x1, int x2, int y, int color) { - uint32_t *base = &bitmap.pix32(y); + uint32_t *const base = &bitmap.pix(y); while(x1 <= x2) { base[x1] = color; @@ -101,7 +101,7 @@ void model1_state::draw_hline(bitmap_rgb32 &bitmap, int x1, int x2, int y, int c void model1_state::draw_hline_moired(bitmap_rgb32 &bitmap, int x1, int x2, int y, int color) { - uint32_t *base = &bitmap.pix32(y); + uint32_t *const base = &bitmap.pix(y); while(x1 <= x2) { if((x1^y) & 1) @@ -407,7 +407,7 @@ void model1_state::draw_line(bitmap_rgb32 &bitmap, model1_state::view_t *view, i { if (x >= view->x1 && x <= view->x2 && y >= view->y1 && y <= view->y2) { - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; } x += s1x; y += s1y; @@ -421,7 +421,7 @@ void model1_state::draw_line(bitmap_rgb32 &bitmap, model1_state::view_t *view, i } if (x >= view->x1 && x <= view->x2 && y >= view->y1 && y <= view->y2) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } #endif @@ -1573,9 +1573,9 @@ void model1_state::video_start() m_poly_ram = make_unique_clear<uint32_t[]>(0x400000); m_tgp_ram = make_unique_clear<uint16_t[]>(0x100000-0x40000); - m_pointdb = make_unique_clear<model1_state::point_t[]>(1000000*2); - m_quaddb = make_unique_clear<model1_state::quad_t[]>(1000000); - m_quadind = make_unique_clear<model1_state::quad_t *[]>(1000000); + m_pointdb = std::make_unique<point_t[]>(1000000*2); + m_quaddb = std::make_unique<quad_t[]>(1000000); + m_quadind = make_unique_clear<quad_t *[]>(1000000); m_pointpt = &m_pointdb[0]; m_quadpt = &m_quaddb[0]; diff --git a/src/mame/video/model2.cpp b/src/mame/video/model2.cpp index 427db401050..7749f149bdd 100644 --- a/src/mame/video/model2.cpp +++ b/src/mame/video/model2.cpp @@ -157,7 +157,7 @@ static inline void vector_cross3( poly_vertex *dst, poly_vertex *v0, poly_vertex dst->pz = (p1.x * p2.y) - (p1.y * p2.x); } -static inline void apply_focus( geo_state *geo, poly_vertex *p0) +static inline void apply_focus( model2_state::geo_state *geo, poly_vertex *p0) { p0->x *= geo->focus.x; p0->y *= geo->focus.y; @@ -201,7 +201,7 @@ static int32_t clip_polygon(poly_vertex *v, int32_t num_vertices, poly_vertex *v poly_vertex *cur, *out; float curdot, nextdot, scale; int32_t i, curin, nextin, nextvert, outcount; - plane clip_plane; + model2_state::plane clip_plane; clip_plane.normal.x = 0.0f; clip_plane.normal.y = 0.0f; @@ -285,7 +285,7 @@ inline bool model2_state::check_culling( raster_state *raster, u32 attr, float m void model2_state::raster_init( memory_region *texture_rom ) { - m_raster = make_unique_clear<raster_state>(); + m_raster = std::make_unique<raster_state>(); m_raster->texture_rom = (u16 *)texture_rom->base(); m_raster->texture_rom_mask = (texture_rom->bytes() / 2) - 1; @@ -948,15 +948,14 @@ void model2_state::draw_framebuffer( bitmap_rgb32 &bitmap, const rectangle &clip { for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int r,g,b; int offset = (x + xoffs) + (y + yoffs)*512; - b = (fbvram[offset] >> 0) & 0x1f; - r = (fbvram[offset] >> 5) & 0x1f; - g = (fbvram[offset] >> 10) & 0x1f; + int b = (fbvram[offset] >> 0) & 0x1f; + int r = (fbvram[offset] >> 5) & 0x1f; + int g = (fbvram[offset] >> 10) & 0x1f; r = pal5bit(r); g = pal5bit(g); b = pal5bit(b); - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } @@ -1160,7 +1159,7 @@ void model2_state::model2_3d_push( raster_state *raster, u32 input ) void model2_state::geo_init(memory_region *polygon_rom) { - m_geo = make_unique_clear<geo_state>(); + m_geo = std::make_unique<geo_state>(); m_geo->state = this; m_geo->raster = m_raster.get(); diff --git a/src/mame/video/model2rd.hxx b/src/mame/video/model2rd.hxx index 53325c06b14..7c878868fac 100644 --- a/src/mame/video/model2rd.hxx +++ b/src/mame/video/model2rd.hxx @@ -60,8 +60,7 @@ void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_ex { #if !defined( MODEL2_TRANSLUCENT) model2_state *state = object.state; - bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap; - u32 *p = &destmap->pix32(scanline); + u32 *const p = &m_destmap.pix(scanline); // u8 *gamma_value = &state->m_gamma_table[0]; /* extract color information */ @@ -119,8 +118,7 @@ void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_ex void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid) { model2_state *state = object.state; - bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap; - u32 *p = &destmap->pix32(scanline); + u32 *const p = &m_destmap.pix(scanline); u32 tex_width = object.texwidth; u32 tex_height = object.texheight; diff --git a/src/mame/video/model3.cpp b/src/mame/video/model3.cpp index d2ebec94fa9..918653160ca 100644 --- a/src/mame/video/model3.cpp +++ b/src/mame/video/model3.cpp @@ -245,12 +245,11 @@ TILE_GET_INFO_MEMBER(model3_state::tile_info_layer3_8bit) { MODEL3_TILE_INFO8(0x #ifdef UNUSED_FUNCTION void model3_state::draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - for(y = cliprect.min_y; y <= cliprect.max_y; y++) + for(int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *d = &bitmap.pix16(y); + uint16_t *const d = &bitmap.pix(y); int index = (y*2)*2048; - for(x = cliprect.min_x; x <= cliprect.max_x; x++) { + for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t pix = m_texture_ram[0][index]; index+=4; if(pix != 0) { @@ -292,8 +291,8 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i for (int y = y1; y <= y2; y++) { - uint32_t* dst = &bitmap.pix32(y); - uint16_t* src = &pixmap.pix16(iy & 0x1ff); + uint32_t *const dst = &bitmap.pix(y); + uint16_t const *const src = &pixmap.pix(iy & 0x1ff); int rowscroll = BYTE_REVERSE16(rowscroll_ram[((layer * 0x200) + y) ^ NATIVE_ENDIAN_VALUE_LE_BE(3,0)]) & 0x7fff; if (rowscroll & 0x100) @@ -2024,14 +2023,12 @@ void model3_state::real3d_traverse_display_list() void model3_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - for (j = cliprect.min_y; j <= cliprect.max_y; ++j) + for (int j = cliprect.min_y; j <= cliprect.max_y; ++j) { - uint32_t *dst = &bitmap.pix32(j); - uint32_t *src = &m_fb->pix32(j); + uint32_t *const dst = &bitmap.pix(j); + uint32_t const *const src = &m_fb->pix(j); - for (i = cliprect.min_x; i <= cliprect.max_x; ++i) + for (int i = cliprect.min_x; i <= cliprect.max_x; ++i) { if (src[i] & 0xff000000) { @@ -2191,8 +2188,8 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris void model3_renderer::draw_scanline_solid(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); float z = extent.param[0].start; float dz = extent.param[0].dpdx; @@ -2221,8 +2218,8 @@ void model3_renderer::draw_scanline_solid(int32_t scanline, const extent_t &exte void model3_renderer::draw_scanline_solid_trans(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); float z = extent.param[0].start; float dz = extent.param[0].dpdx; @@ -2289,8 +2286,8 @@ do { void model3_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2333,8 +2330,8 @@ void model3_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent void model3_renderer::draw_scanline_tex_colormod(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2380,8 +2377,8 @@ void model3_renderer::draw_scanline_tex_colormod(int32_t scanline, const extent_ void model3_renderer::draw_scanline_tex_contour(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2432,8 +2429,8 @@ void model3_renderer::draw_scanline_tex_contour(int32_t scanline, const extent_t void model3_renderer::draw_scanline_tex_trans(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2481,8 +2478,8 @@ void model3_renderer::draw_scanline_tex_trans(int32_t scanline, const extent_t & void model3_renderer::draw_scanline_tex_alpha(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; diff --git a/src/mame/video/momoko.cpp b/src/mame/video/momoko.cpp index a6ed40f4971..de5e4a5982d 100644 --- a/src/mame/video/momoko.cpp +++ b/src/mame/video/momoko.cpp @@ -70,8 +70,6 @@ void momoko_state::flipscreen_w(u8 data) void momoko_state::draw_bg_pri(bitmap_ind16 &bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri) { - int px, py; - for (int sy = 0; sy < 8; sy++) { const u32 gfxadr = chr * 16 + sy * 2; @@ -83,16 +81,14 @@ void momoko_state::draw_bg_pri(bitmap_ind16 &bitmap, int chr, int col, int flipx for (int sx = 0; sx < 4; sx++) { const u8 dot = (d0 & 0x08) | ((d0 & 0x80) >> 5) | ((d1 & 0x08) >> 2) | ((d1 & 0x80) >> 7); - if (flipx == 0) px = sx + xx * 4 + x; - else px = 7 - sx - xx * 4 + x; - if (flipy == 0) py = sy + y; - else py = 7 - sy + y; + const int px = (flipx == 0) ? (sx + xx * 4 + x) : (7 - sx - xx * 4 + x); + const int py = (flipy == 0) ? (sy + y) : (7 - sy + y); if (dot >= pri) - bitmap.pix16(py, px) = col * 16 + dot + 256; + bitmap.pix(py, px) = col * 16 + dot + 256; - d0 = d0 << 1; - d1 = d1 << 1; + d0 <<= 1; + d1 <<= 1; } } } diff --git a/src/mame/video/ms32.cpp b/src/mame/video/ms32.cpp index 9b49f28cd9a..a8f16d19a07 100644 --- a/src/mame/video/ms32.cpp +++ b/src/mame/video/ms32.cpp @@ -243,12 +243,25 @@ void ms32_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_pri, con void ms32_state::draw_roz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect,int priority) { - /* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */ - + // TODO: registers 0x40 / 0x44 and 0x50 / 0x54 are used, unknown meaning + // Given how this works out it is most likely that 0x*0 controls X axis while 0x*4 Y, + // nothing is known to diverge between settings so far (i.e. bbbxing sets 0xffff to 0x4* and 0x0000 to 0x5*). + // 0x4* 0x5* ROZ should wrap? + // bbbxing: 0xffff 0x0000 0 (match presentation) + // gratia: 0x0000 0x0000 1 (sky in stage 2) + // p47aces: 0xffff 0x0651 0 (title screen) + // desertwr: 0xffff 0x0651 1 (any stage) + // f1superb: 0xffff 0x0000 ? + // suchie2: 0x0000 0x0000 0? + // bnstars: 0x0000 0x0000 ? + // hayaosi3: 0x0000 0x0000 ? + // Maybe wrapping is done by limit boundaries rather than individual bits, so that bbbxing and p47aces abuses of this behaviour? + // Are we missing a ROZ plane size as well? + if (m_roz_ctrl[0x5c/4] & 1) /* "super" mode */ { rectangle my_clip; - int y,maxy; + int y, maxy; my_clip.min_x = cliprect.min_x; my_clip.max_x = cliprect.max_x; @@ -422,28 +435,20 @@ u32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitmap, the priority ram, probably for per-pixel / pen mixing, or more levels than are supported here.. I don't know, it will need hw tests I think */ { - int xx, yy; int width = screen.width(); int height = screen.height(); - const pen_t *paldata = m_palette->pens(); - - u16* srcptr_tile; - u8* srcptr_tilepri; - u16* srcptr_spri; - //u8* srcptr_spripri; - - u32* dstptr_bitmap; + pen_t const *const paldata = m_palette->pens(); bitmap.fill(0, cliprect); - for (yy=0;yy<height;yy++) + for (int yy=0;yy<height;yy++) { - srcptr_tile = &m_temp_bitmap_tilemaps.pix16(yy); - srcptr_tilepri = &screen.priority().pix8(yy); - srcptr_spri = &m_temp_bitmap_sprites.pix16(yy); - //srcptr_spripri = &m_temp_bitmap_sprites_pri.pix8(yy); - dstptr_bitmap = &bitmap.pix32(yy); - for (xx=0;xx<width;xx++) + u16 const *const srcptr_tile = &m_temp_bitmap_tilemaps.pix(yy); + u8 const *const srcptr_tilepri = &screen.priority().pix(yy); + u16 const *const srcptr_spri = &m_temp_bitmap_sprites.pix(yy); + //u8 const *const srcptr_spripri = &m_temp_bitmap_sprites_pri.pix(yy); + u32 *const dstptr_bitmap = &bitmap.pix(yy); + for (int xx=0;xx<width;xx++) { u16 src_tile = srcptr_tile[xx]; u8 src_tilepri = srcptr_tilepri[xx]; diff --git a/src/mame/video/mw8080bw.cpp b/src/mame/video/mw8080bw.cpp index d7479eb8824..cf86bf10f13 100644 --- a/src/mame/video/mw8080bw.cpp +++ b/src/mame/video/mw8080bw.cpp @@ -21,7 +21,7 @@ uint32_t mw8080bw_state::screen_update_mw8080bw(screen_device &screen, bitmap_rg { // plot the current pixel pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; // next pixel video_data = video_data >> 1; @@ -34,7 +34,7 @@ uint32_t mw8080bw_state::screen_update_mw8080bw(screen_device &screen, bitmap_rg for (int i = 0; i < 4; i++) { pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -144,7 +144,7 @@ uint32_t spcenctr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm if (m_brightness > (pen & 0xff)) pen = rgb_t(m_brightness, m_brightness, m_brightness); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; center = center + 1; width = width + ((center & 0x80) ? -1 : 1); @@ -166,7 +166,7 @@ uint32_t spcenctr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else pen = rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -266,7 +266,7 @@ uint32_t mw8080bw_state::screen_update_phantom2(screen_device &screen, bitmap_rg else pen = bit ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; /* move to next pixel -- if ripple carry is currently set, prepare for loading the shift register */ @@ -300,7 +300,7 @@ uint32_t mw8080bw_state::screen_update_phantom2(screen_device &screen, bitmap_rg for (i = 0; i < 4; i++) { pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -365,9 +365,9 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen; + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; // next pixel video_data = video_data >> 1; @@ -382,9 +382,9 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen; + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } diff --git a/src/mame/video/mz700.cpp b/src/mame/video/mz700.cpp index e2749ec0cc3..e110e986185 100644 --- a/src/mame/video/mz700.cpp +++ b/src/mame/video/mz700.cpp @@ -17,18 +17,18 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx,col,bg=0,fg=0,oldcol=0x7e; - uint16_t sy=0,ma=0,x,chr; + uint8_t bg=0,fg=0,oldcol=0x7e; + uint16_t sy=0,ma=0; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - col = m_colorram[x]; + uint8_t col = m_colorram[x]; if (col != oldcol) { oldcol = col; @@ -36,8 +36,8 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitm bg = col & 7; fg = (col >> 3) & 7; } - chr = m_videoram[x] | (BIT(col, 7)<<8); - gfx = m_p_chargen[(chr<<3) | ra ]; + uint16_t chr = m_videoram[x] | (BIT(col, 7)<<8); + uint8_t gfx = m_p_chargen[(chr<<3) | ra ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -72,20 +72,18 @@ uint32_t mz_state::screen_update_mz800(screen_device &screen, bitmap_ind16 &bitm } else { - int x, y; - - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - bitmap.pix16(y, x * 8 + 0) = BIT(m_videoram[x * 8 + y], 0) ? 7 : 0; - bitmap.pix16(y, x * 8 + 1) = BIT(m_videoram[x * 8 + y], 1) ? 7 : 0; - bitmap.pix16(y, x * 8 + 2) = BIT(m_videoram[x * 8 + y], 2) ? 7 : 0; - bitmap.pix16(y, x * 8 + 3) = BIT(m_videoram[x * 8 + y], 3) ? 7 : 0; - bitmap.pix16(y, x * 8 + 4) = BIT(m_videoram[x * 8 + y], 4) ? 7 : 0; - bitmap.pix16(y, x * 8 + 5) = BIT(m_videoram[x * 8 + y], 5) ? 7 : 0; - bitmap.pix16(y, x * 8 + 6) = BIT(m_videoram[x * 8 + y], 6) ? 7 : 0; - bitmap.pix16(y, x * 8 + 7) = BIT(m_videoram[x * 8 + y], 7) ? 7 : 0; + bitmap.pix(y, x * 8 + 0) = BIT(m_videoram[x * 8 + y], 0) ? 7 : 0; + bitmap.pix(y, x * 8 + 1) = BIT(m_videoram[x * 8 + y], 1) ? 7 : 0; + bitmap.pix(y, x * 8 + 2) = BIT(m_videoram[x * 8 + y], 2) ? 7 : 0; + bitmap.pix(y, x * 8 + 3) = BIT(m_videoram[x * 8 + y], 3) ? 7 : 0; + bitmap.pix(y, x * 8 + 4) = BIT(m_videoram[x * 8 + y], 4) ? 7 : 0; + bitmap.pix(y, x * 8 + 5) = BIT(m_videoram[x * 8 + y], 5) ? 7 : 0; + bitmap.pix(y, x * 8 + 6) = BIT(m_videoram[x * 8 + y], 6) ? 7 : 0; + bitmap.pix(y, x * 8 + 7) = BIT(m_videoram[x * 8 + y], 7) ? 7 : 0; } } } diff --git a/src/mame/video/mz80.cpp b/src/mame/video/mz80.cpp index 3b0c5045e1a..e4ae83a5311 100644 --- a/src/mame/video/mz80.cpp +++ b/src/mame/video/mz80.cpp @@ -38,19 +38,18 @@ uint32_t mz80_state::screen_update_mz80k(screen_device &screen, bitmap_ind16 &bi { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0,ma=0; + uint16_t sy=0,ma=0; - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); @@ -73,19 +72,18 @@ uint32_t mz80_state::screen_update_mz80kj(screen_device &screen, bitmap_ind16 &b { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0,ma=0; + uint16_t sy=0,ma=0; - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0); @@ -108,19 +106,18 @@ uint32_t mz80_state::screen_update_mz80a(screen_device &screen, bitmap_ind16 &bi { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); + uint16_t sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x&0x7ff]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x&0x7ff]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/video/n64.cpp b/src/mame/video/n64.cpp index 2a1ba864bff..e0723dfa953 100644 --- a/src/mame/video/n64.cpp +++ b/src/mame/video/n64.cpp @@ -240,7 +240,7 @@ void n64_periphs::video_update16(bitmap_rgb32 &bitmap) { for(int32_t j = 0; j < vres; j++) { - uint32_t* d = &bitmap.pix32(j); + uint32_t *const d = &bitmap.pix(j); for(int32_t i = 0; i < hres; i++) { @@ -289,7 +289,7 @@ void n64_periphs::video_update32(bitmap_rgb32 &bitmap) { for (int32_t j = 0; j < vres; j++) { - uint32_t* d = &bitmap.pix32(j); + uint32_t *const d = &bitmap.pix(j); for (int32_t i = 0; i < hres; i++) { uint32_t pix = *frame_buffer32++; diff --git a/src/mame/video/n8080.cpp b/src/mame/video/n8080.cpp index 393b89a8ed6..7d7a7147d02 100644 --- a/src/mame/video/n8080.cpp +++ b/src/mame/video/n8080.cpp @@ -128,20 +128,15 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { uint8_t mask = flip_screen() ? 0xff : 0x00; - int x; - int y; + uint8_t const *pRAM = m_videoram; + uint8_t const *const pPROM = memregion("proms")->base(); - const uint8_t* pRAM = m_videoram; - const uint8_t* pPROM = memregion("proms")->base(); - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y ^ mask); + uint16_t *const pLine = &bitmap.pix(y ^ mask); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - int n; - uint8_t color = 0; if (m_red_screen) @@ -172,7 +167,7 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm color = ufo_color[cycle % 6]; } - for (n = color + 1; n < 8; n++) + for (int n = color + 1; n < 8; n++) { if (~val & (1 << n)) { @@ -181,7 +176,7 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } } - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { pLine[(x + n) ^ mask] = (pRAM[x >> 3] & (1 << n)) ? color : 0; } @@ -197,21 +192,15 @@ uint32_t sheriff_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { uint8_t mask = flip_screen() ? 0xff : 0x00; - const uint8_t* pPROM = memregion("proms")->base(); - - int x; - int y; - - const uint8_t* pRAM = m_videoram; + uint8_t const *pRAM = m_videoram; + uint8_t const *const pPROM = memregion("proms")->base(); - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y ^ mask); + uint16_t *const pLine = &bitmap.pix(y ^ mask); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - int n; - uint8_t color = pPROM[32 * (y >> 3) + (x >> 3)]; if (m_sheriff_color_mode == 1 && !(color & 8)) @@ -223,7 +212,7 @@ uint32_t sheriff_state::screen_update(screen_device &screen, bitmap_ind16 &bitma if (m_sheriff_color_mode == 3) color = 7; - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { pLine[(x + n) ^ mask] = ((pRAM[x >> 3] >> n) & 1) ? (color & 7) : 0; } @@ -245,18 +234,15 @@ uint32_t helifire_state::screen_update(screen_device &screen, bitmap_ind16 &bitm unsigned saved_mv = m_mv; unsigned saved_sc = m_sc; - int x; - int y; - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int level = 120 + wave[m_mv & 7]; /* draw sky */ - for (x = level; x < 256; x++) + for (int x = level; x < 256; x++) { pLine[x] = 0x200 + 8 + SUN_BRIGHTNESS + x - level; } @@ -291,20 +277,18 @@ uint32_t helifire_state::screen_update(screen_device &screen, bitmap_ind16 &bitm /* draw sea */ - for (x = 0; x < level; x++) + for (int x = 0; x < level; x++) { pLine[x] = 8 + SEA_BRIGHTNESS + x; } /* draw foreground */ - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { int offset = 32 * y + (x >> 3); - int n; - - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { if (flip_screen()) { diff --git a/src/mame/video/namco_c355spr.cpp b/src/mame/video/namco_c355spr.cpp index cd06bfe1664..570c6a92e7d 100644 --- a/src/mame/video/namco_c355spr.cpp +++ b/src/mame/video/namco_c355spr.cpp @@ -111,8 +111,8 @@ void namco_c355spr_device::zdrawgfxzoom( { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -140,8 +140,8 @@ void namco_c355spr_device::copybitmap(bitmap_ind16 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *dest = &dest_bmp.pix16(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -174,8 +174,8 @@ void namco_c355spr_device::copybitmap(bitmap_ind16 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *dest = &dest_bmp.pix16(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -213,9 +213,9 @@ void namco_c355spr_device::copybitmap(bitmap_rgb32 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *srcrender = &m_screenbitmap.pix16(y); - u32 *dest = &dest_bmp.pix32(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const srcrender = &m_screenbitmap.pix(y); + u32 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -251,9 +251,9 @@ void namco_c355spr_device::copybitmap(bitmap_rgb32 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *srcrender = &m_screenbitmap.pix16(y); - u32 *dest = &dest_bmp.pix32(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const srcrender = &m_screenbitmap.pix(y); + u32 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) diff --git a/src/mame/video/namcona1.cpp b/src/mame/video/namcona1.cpp index 4fcab2c581d..6cedb59394a 100644 --- a/src/mame/video/namcona1.cpp +++ b/src/mame/video/namcona1.cpp @@ -295,10 +295,10 @@ void namcona1_state::pdraw_tile( { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - const u8 *mask_addr = mask_base + y_index * mask->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &screen.priority().pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u8 const *const mask_addr = mask_base + y_index * mask->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &screen.priority().pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -506,8 +506,8 @@ void namcona1_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap //const pen_t *paldata = &m_palette->pen(m_bg_tilemap[which]->palette_offset()); const pen_t *paldata = &m_palette->pen(0); - draw_pixel_line(cliprect, &bitmap.pix16(line), - &screen.priority().pix8(line), + draw_pixel_line(cliprect, &bitmap.pix(line), + &screen.priority().pix(line), m_videoram + ydata + 25, paldata); } diff --git a/src/mame/video/namcos21_3d.cpp b/src/mame/video/namcos21_3d.cpp index 9858a9afcf4..a6f8921c094 100644 --- a/src/mame/video/namcos21_3d.cpp +++ b/src/mame/video/namcos21_3d.cpp @@ -59,14 +59,12 @@ void namcos21_3d_device::swap_and_clear_poly_framebuffer() void namcos21_3d_device::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const rectangle &clip, int zlo, int zhi) { /* blit the visible framebuffer */ - int sy; - for (sy = clip.top(); sy <= clip.bottom(); sy++) + for (int sy = clip.top(); sy <= clip.bottom(); sy++) { - uint16_t *dest = &bitmap.pix16(sy); - const uint16_t *pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy; - const uint16_t *pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy; - int sx; - for (sx = clip.left(); sx <= clip.right(); sx++) + uint16_t *const dest = &bitmap.pix(sy); + uint16_t const *const pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy; + uint16_t const *const pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy; + for (int sx = clip.left(); sx <= clip.right(); sx++) { int z = pZ[sx]; //if( pZ[sx]!=0x7fff ) diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp index 27354f16379..0fb23435b92 100644 --- a/src/mame/video/namcos22.cpp +++ b/src/mame/video/namcos22.cpp @@ -52,12 +52,12 @@ void namcos22_renderer::renderscanline_uvi_full(int32_t scanline, const extent_t int penmask = 0xff; int penshift = 0; int prioverchar = extra.prioverchar; - u32 *dest = &extra.destbase->pix32(scanline); - u8 *primap = &extra.primap->pix8(scanline); - u16 *ttmap = m_state.m_texture_tilemap; - u8 *ttattr = m_state.m_texture_tileattr.get(); - u8 *ttdata = m_state.m_texture_tiledata; - u8 *tt_ayx_to_pixel = m_state.m_texture_ayx_to_pixel.get(); + u32 *const dest = &extra.destbase->pix(scanline); + u8 *const primap = &extra.primap->pix(scanline); + u16 *const ttmap = m_state.m_texture_tilemap; + u8 *const ttattr = m_state.m_texture_tileattr.get(); + u8 *const ttdata = m_state.m_texture_tiledata; + u8 *const tt_ayx_to_pixel = m_state.m_texture_ayx_to_pixel.get(); if (extra.cmode & 4) { @@ -194,9 +194,9 @@ void namcos22_renderer::renderscanline_sprite(int32_t scanline, const extent_t & int fadefactor = 0xff - extra.fadefactor; rgbaint_t fogcolor(extra.fogcolor); rgbaint_t fadecolor(extra.fadecolor); - u8 *source = (u8 *)extra.source + y_index * extra.line_modulo; - u32 *dest = &extra.destbase->pix32(scanline); - u8 *primap = &extra.primap->pix8(scanline); + u8 *const source = (u8 *)extra.source + y_index * extra.line_modulo; + u32 *const dest = &extra.destbase->pix(scanline); + u8 *const primap = &extra.primap->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -1946,9 +1946,9 @@ void namcos22s_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb // mix textlayer with poly/sprites for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *src = &m_mix_bitmap->pix16(y); - u32 *dest = &bitmap.pix32(y); - u8 *pri = &screen.priority().pix8(y); + u16 const *const src = &m_mix_bitmap->pix(y); + u32 *const dest = &bitmap.pix(y); + u8 const *const pri = &screen.priority().pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { // skip if transparent or under poly/sprite @@ -2019,9 +2019,9 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 // mix textlayer with polys + do final mix for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *src = &m_mix_bitmap->pix16(y); - u32 *dest = &bitmap.pix32(y); - u8 *pri = &screen.priority().pix8(y); + u16 const *const src = &m_mix_bitmap->pix(y); + u32 *const dest = &bitmap.pix(y); + u8 const *const pri = &screen.priority().pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { u32 pixel = dest[x]; @@ -2404,7 +2404,7 @@ u32 namcos22s_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb32 const u8 *blut = (const u8 *)&m_mixer[0x300/4]; for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dest = &bitmap.pix32(y); + u32 *const dest = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { int rgb = dest[x]; diff --git a/src/mame/video/namcos2_roz.cpp b/src/mame/video/namcos2_roz.cpp index 04f7f96ce4f..88ba624009f 100644 --- a/src/mame/video/namcos2_roz.cpp +++ b/src/mame/video/namcos2_roz.cpp @@ -75,7 +75,7 @@ draw_roz_helper_block(const struct roz_param *rozInfo, int destx, int desty, int end_incrx = rozInfo->incyx - (width * rozInfo->incxx); int end_incry = rozInfo->incyy - (width * rozInfo->incxy); - uint16_t *dest = &destbitmap.pix16(desty, destx); + uint16_t *dest = &destbitmap.pix(desty, destx); int dest_rowinc = destbitmap.rowpixels() - width; while (desty < desty_end) @@ -96,9 +96,9 @@ draw_roz_helper_block(const struct roz_param *rozInfo, int destx, int desty, goto L_SkipPixel; } - if (flagsbitmap.pix8(ypos, xpos) & TILEMAP_PIXEL_LAYER0) + if (flagsbitmap.pix(ypos, xpos) & TILEMAP_PIXEL_LAYER0) { - *dest = srcbitmap.pix16(ypos, xpos) + rozInfo->color; + *dest = srcbitmap.pix(ypos, xpos) + rozInfo->color; } L_SkipPixel: diff --git a/src/mame/video/namcos2_sprite.cpp b/src/mame/video/namcos2_sprite.cpp index 7d2f2f434b7..2e6f48abf91 100644 --- a/src/mame/video/namcos2_sprite.cpp +++ b/src/mame/video/namcos2_sprite.cpp @@ -117,9 +117,9 @@ void namcos2_sprite_device::zdrawgfxzoom( { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; /* this code was previously shared with the c355 where this was needed if (m_palxor) diff --git a/src/mame/video/nbmj8688.cpp b/src/mame/video/nbmj8688.cpp index 75ab83fd15a..e4b8f58dffa 100644 --- a/src/mame/video/nbmj8688.cpp +++ b/src/mame/video/nbmj8688.cpp @@ -244,7 +244,7 @@ void nbmj8688_state::vramflip() void nbmj8688_state::update_pixel(int x, int y) { int color = m_videoram[(y * 512) + x]; - m_tmpbitmap->pix16(y, x) = color; + m_tmpbitmap->pix(y, x) = color; } void nbmj8688_state::writeram_low(int x, int y, int color) diff --git a/src/mame/video/nbmj8891.cpp b/src/mame/video/nbmj8891.cpp index b041106f96d..4b82c47ace7 100644 --- a/src/mame/video/nbmj8891.cpp +++ b/src/mame/video/nbmj8891.cpp @@ -296,13 +296,13 @@ void nbmj8891_state::vramflip(int vram) void nbmj8891_state::update_pixel0(int x, int y) { uint8_t color = m_videoram0[(y * m_screen->width()) + x]; - m_tmpbitmap0.pix16(y, x) = color; + m_tmpbitmap0.pix(y, x) = color; } void nbmj8891_state::update_pixel1(int x, int y) { uint8_t color = m_videoram1[(y * m_screen->width()) + x]; - m_tmpbitmap1.pix16(y, x) = (color == 0x7f) ? 0xff : color; + m_tmpbitmap1.pix(y, x) = (color == 0x7f) ? 0xff : color; } void nbmj8891_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj8900.cpp b/src/mame/video/nbmj8900.cpp index faf75765d88..f6a1e8deff1 100644 --- a/src/mame/video/nbmj8900.cpp +++ b/src/mame/video/nbmj8900.cpp @@ -188,13 +188,13 @@ void nbmj8900_state::vramflip(int vram) void nbmj8900_state::update_pixel0(int x, int y) { uint8_t color = m_videoram0[(y * m_screen_width) + x]; - m_tmpbitmap0.pix16(y, x) = m_palette->pen(color); + m_tmpbitmap0.pix(y, x) = m_palette->pen(color); } void nbmj8900_state::update_pixel1(int x, int y) { uint8_t color = m_videoram1[(y * m_screen_width) + x]; - m_tmpbitmap1.pix16(y, x) = m_palette->pen(color); + m_tmpbitmap1.pix(y, x) = m_palette->pen(color); } void nbmj8900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj8991.cpp b/src/mame/video/nbmj8991.cpp index e13e5bfb832..5f6862b5a37 100644 --- a/src/mame/video/nbmj8991.cpp +++ b/src/mame/video/nbmj8991.cpp @@ -131,20 +131,18 @@ void nbmj8991_state::clut_w(offs_t offset, uint8_t data) ******************************************************************************/ void nbmj8991_state::vramflip() { - int x, y; - uint8_t color1, color2; int width = m_screen->width(); int height = m_screen->height(); if (m_flipscreen == m_flipscreen_old) return; - for (y = 0; y < height / 2; y++) + for (int y = 0; y < height / 2; y++) { - for (x = 0; x < width / 2; x++) + for (int x = 0; x < width / 2; x++) { // rotate 180 degrees ( 0, 0) - ( 511, 511) - color1 = m_videoram[(y * width) + x]; - color2 = m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; + uint8_t color1 = m_videoram[(y * width) + x]; + uint8_t color2 = m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; m_videoram[(y * width) + x] = color2; m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)] = color1; // rotate 180 degrees ( 512, 0) - (1023, 511) @@ -162,7 +160,7 @@ void nbmj8991_state::vramflip() void nbmj8991_state::update_pixel(int x, int y) { uint8_t color = m_videoram[(y * m_screen->width()) + x]; - m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix(y, x) = color; } void nbmj8991_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj9195.cpp b/src/mame/video/nbmj9195.cpp index 153b420987f..17446bcc76b 100644 --- a/src/mame/video/nbmj9195.cpp +++ b/src/mame/video/nbmj9195.cpp @@ -176,7 +176,7 @@ void nbmj9195_state::vramflip(int vram) void nbmj9195_state::update_pixel(int vram, int x, int y) { uint16_t color = m_videoram[vram][(y * m_screen->width()) + x]; - m_tmpbitmap[vram].pix16(y, x) = color; + m_tmpbitmap[vram].pix(y, x) = color; } void nbmj9195_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nc.cpp b/src/mame/video/nc.cpp index 4770ee94f7c..4da4e3d583e 100644 --- a/src/mame/video/nc.cpp +++ b/src/mame/video/nc.cpp @@ -69,7 +69,7 @@ uint32_t nc_state::screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, for (int b = 0; b < 8; b++) { - bitmap.pix16(y, x) = pens[(byte>>7) & 0x01]; + bitmap.pix(y, x) = pens[(byte>>7) & 0x01]; byte = byte<<1; x++; } diff --git a/src/mame/video/neogeo_spr.cpp b/src/mame/video/neogeo_spr.cpp index b069f8fc143..19dabfc457d 100644 --- a/src/mame/video/neogeo_spr.cpp +++ b/src/mame/video/neogeo_spr.cpp @@ -181,7 +181,7 @@ void neosprite_base_device::draw_fixed_layer(bitmap_rgb32 &bitmap, int scanline) uint8_t* gfx_base = m_fixed_layer_source ? m_region_fixed : m_region_fixedbios->base(); uint32_t addr_mask = ( m_fixed_layer_source ? m_region_fixed_size : m_region_fixedbios->bytes() ) - 1; uint16_t *video_data = &m_videoram_drawsource[0x7000 | (scanline >> 3)]; - uint32_t *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, NEOGEO_HBEND); int garouoffsets[32]; int banked = m_fixed_layer_source && (addr_mask > 0x1ffff); @@ -414,7 +414,7 @@ void neosprite_base_device::draw_sprites(bitmap_rgb32 &bitmap, int scanline) /* draw the line - no wrap-around */ if (x <= 0x01f0) { - uint32_t *pixel_addr = &bitmap.pix32(scanline, x + NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, x + NEOGEO_HBEND); for (int i = 0; i < 0x10; i++) { @@ -436,7 +436,7 @@ void neosprite_base_device::draw_sprites(bitmap_rgb32 &bitmap, int scanline) else { int x_save = x; - uint32_t *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, NEOGEO_HBEND); for (int i = 0; i < 0x10; i++) { diff --git a/src/mame/video/newbrain.cpp b/src/mame/video/newbrain.cpp index 714326050b0..56e7c072b17 100644 --- a/src/mame/video/newbrain.cpp +++ b/src/mame/video/newbrain.cpp @@ -121,10 +121,10 @@ void newbrain_state::do_screen_update(bitmap_rgb32 &bitmap, const rectangle &cli uint8_t sr = gr ? grsr : vsr; int color = BIT(sr, 7) ^ m_rv; - bitmap.pix32(y, x++) = m_palette->pen(color); + bitmap.pix(y, x++) = m_palette->pen(color); if (columns == 40) { - bitmap.pix32(y, x++) = m_palette->pen(color); + bitmap.pix(y, x++) = m_palette->pen(color); } grsr <<= 1; diff --git a/src/mame/video/nick.cpp b/src/mame/video/nick.cpp index 9aa6c940924..ddaf8c0aff2 100644 --- a/src/mame/video/nick.cpp +++ b/src/mame/video/nick.cpp @@ -192,7 +192,7 @@ void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param, if (scanline < ENTERPRISE_SCREEN_HEIGHT) { /* set write address for line */ - m_dest = &m_bitmap.pix32(scanline); + m_dest = &m_bitmap.pix(scanline); m_dest_pos = 0; m_dest_max_pos = m_bitmap.width(); diff --git a/src/mame/video/ninjakd2.cpp b/src/mame/video/ninjakd2.cpp index 700172ce5a9..2ec95db5dff 100644 --- a/src/mame/video/ninjakd2.cpp +++ b/src/mame/video/ninjakd2.cpp @@ -352,7 +352,7 @@ void ninjakd2_state::erase_sprites( bitmap_ind16 &bitmap) { for (int x = 0; x < m_sprites_bitmap.width(); ++x) { - uint16_t* const ptr = &m_sprites_bitmap.pix16(y, x); + uint16_t *const ptr = &m_sprites_bitmap.pix(y, x); if ( (*m_stencil_compare_function)(*ptr) ) *ptr = 0xf; } } diff --git a/src/mame/video/nitedrvr.cpp b/src/mame/video/nitedrvr.cpp index d33c8472bfa..0ccd49114c6 100644 --- a/src/mame/video/nitedrvr.cpp +++ b/src/mame/video/nitedrvr.cpp @@ -16,7 +16,7 @@ void nitedrvr_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, i { for (int x = bx; x < ex; x++) if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; } } diff --git a/src/mame/video/niyanpai.cpp b/src/mame/video/niyanpai.cpp index 3c14c3e1610..6aa036fa502 100644 --- a/src/mame/video/niyanpai.cpp +++ b/src/mame/video/niyanpai.cpp @@ -159,7 +159,7 @@ void niyanpai_state::vramflip(int vram) void niyanpai_state::update_pixel(int vram, int x, int y) { uint16_t color = m_videoram[vram][(y * m_screen->width()) + x]; - m_tmpbitmap[vram].pix16(y, x) = color; + m_tmpbitmap[vram].pix(y, x) = color; } void niyanpai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nmk16spr.cpp b/src/mame/video/nmk16spr.cpp index 22daec39be8..6a6036b09a3 100644 --- a/src/mame/video/nmk16spr.cpp +++ b/src/mame/video/nmk16spr.cpp @@ -53,7 +53,7 @@ nmk_16bit_sprite_device::nmk_16bit_sprite_device(const machine_config &mconfig, void nmk_16bit_sprite_device::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, u16* spriteram, int size) { const bool priority = !m_colpri_cb.isnull(); - struct sprite_t *sprite_ptr = m_spritelist.get(); + sprite_t *sprite_ptr = m_spritelist.get(); const int xpos_max = m_xmask + 1; const int ypos_max = m_ymask + 1; @@ -260,7 +260,7 @@ void nmk_16bit_sprite_device::device_start() m_colpri_cb.resolve(); m_ext_cb.resolve(); m_flip_screen = false; - m_spritelist = make_unique_clear<struct sprite_t[]>((0x1000/0x10) * 16 * 16); + m_spritelist = std::make_unique<sprite_t[]>((0x1000/0x10) * 16 * 16); save_item(NAME(m_flip_screen)); } diff --git a/src/mame/video/nmk16spr.h b/src/mame/video/nmk16spr.h index 5d5a7c24124..192fbe8409a 100644 --- a/src/mame/video/nmk16spr.h +++ b/src/mame/video/nmk16spr.h @@ -34,10 +34,10 @@ protected: private: struct sprite_t { - u32 code, colour; - int x, y; - bool flipx, flipy; - u32 pri_mask; + u32 code = 0, colour = 0; + int x = 0, y = 0; + bool flipx = false, flipy = false; + u32 pri_mask = 0; }; colpri_cb_delegate m_colpri_cb; // callback for colour, priority ext_cb_delegate m_ext_cb; // callback for flipx, flipy or code bit modification @@ -46,7 +46,7 @@ private: int m_xmask, m_ymask; // x,y position masking int m_screen_width, m_screen_height; // screen size related to flipscreen u32 m_max_sprite_clock; // max sprite cycles, related to screen total size? - std::unique_ptr<struct sprite_t[]> m_spritelist; // sprite list caches + std::unique_ptr<sprite_t[]> m_spritelist; // sprite list caches }; DECLARE_DEVICE_TYPE(NMK_16BIT_SPRITE, nmk_16bit_sprite_device) diff --git a/src/mame/video/offtwall.cpp b/src/mame/video/offtwall.cpp index f71c058acf6..d60f75dc519 100644 --- a/src/mame/video/offtwall.cpp +++ b/src/mame/video/offtwall.cpp @@ -89,13 +89,12 @@ uint32_t offtwall_state::screen_update_offtwall(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not yet verified - */ + // not yet verified pf[x] = mo[x]; } } diff --git a/src/mame/video/ojankohs.cpp b/src/mame/video/ojankohs.cpp index db98c744a4b..57509869188 100644 --- a/src/mame/video/ojankohs.cpp +++ b/src/mame/video/ojankohs.cpp @@ -208,18 +208,14 @@ void ojankohs_state::ojankoc_flipscreen(int data) void ojankohs_state::ojankoc_videoram_w(offs_t offset, uint8_t data) { - int i; - uint8_t x, y, xx, px, py ; - uint8_t color, color1, color2; - m_videoram[offset] = data; - color1 = m_videoram[offset & 0x3fff]; - color2 = m_videoram[offset | 0x4000]; + uint8_t color1 = m_videoram[offset & 0x3fff]; + uint8_t color2 = m_videoram[offset | 0x4000]; - y = offset >> 6; - x = (offset & 0x3f) << 2; - xx = 0; + uint8_t y = offset >> 6; + uint8_t x = (offset & 0x3f) << 2; + uint8_t xx = 0; if (m_flipscreen) { @@ -228,14 +224,14 @@ void ojankohs_state::ojankoc_videoram_w(offs_t offset, uint8_t data) xx = 3; } - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { - color = ((color1 & 0x01) >> 0) | ((color1 & 0x10) >> 3) | ((color2 & 0x01) << 2) | ((color2 & 0x10) >> 1); + uint8_t color = ((color1 & 0x01) >> 0) | ((color1 & 0x10) >> 3) | ((color2 & 0x01) << 2) | ((color2 & 0x10) >> 1); - px = x + (i ^ xx); - py = y; + uint8_t px = x + (i ^ xx); + uint8_t py = y; - m_tmpbitmap.pix16(py, px) = color; + m_tmpbitmap.pix(py, px) = color; color1 >>= 1; color2 >>= 1; diff --git a/src/mame/video/orion.cpp b/src/mame/video/orion.cpp index b806f87b150..44e49a2afd0 100644 --- a/src/mame/video/orion.cpp +++ b/src/mame/video/orion.cpp @@ -74,7 +74,7 @@ uint32_t orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 break; } } - bitmap.pix16(y, x*8+(7-b)) = color; + bitmap.pix(y, x*8+(7-b)) = color; } } } diff --git a/src/mame/video/osi.cpp b/src/mame/video/osi.cpp index d06540810e6..222f3fdd560 100644 --- a/src/mame/video/osi.cpp +++ b/src/mame/video/osi.cpp @@ -65,7 +65,7 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; } - bitmap.pix16(y, x++) = color; + bitmap.pix(y, x++) = color; charrom_data <<= 1; } @@ -98,8 +98,8 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; } - bitmap.pix16(y, x++) = color; - bitmap.pix16(y, x++) = color; + bitmap.pix(y, x++) = color; + bitmap.pix(y, x++) = color; charrom_data <<= 1; } @@ -128,7 +128,7 @@ uint32_t uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int bit = 0; bit < 8; bit++) { - bitmap.pix16(y, x) = BIT(charrom_data, 7); + bitmap.pix(y, x) = BIT(charrom_data, 7); x++; charrom_data <<= 1; } diff --git a/src/mame/video/p2000t.cpp b/src/mame/video/p2000t.cpp index ad34ae63073..380ee26a143 100644 --- a/src/mame/video/p2000t.cpp +++ b/src/mame/video/p2000t.cpp @@ -22,14 +22,14 @@ void p2000m_state::video_start() uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; - int offs, sx, sy, code, loop; + uint8_t const *const videoram = m_videoram; - for (offs = 0; offs < 80 * 24; offs++) + for (int offs = 0; offs < 80 * 24; offs++) { - sy = (offs / 80) * 20; - sx = (offs % 80) * 12; + int sy = (offs / 80) * 20; + int sx = (offs % 80) * 12; + int code; if ((m_frame_count > 25) && (videoram[offs + 2048] & 0x40)) code = 32; else @@ -49,10 +49,10 @@ uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 if (videoram[offs] & 0x80) { - for (loop = 0; loop < 12; loop++) + for (int loop = 0; loop < 12; loop++) { - bitmap.pix16(sy + 18, sx + loop) = 0; /* cursor */ - bitmap.pix16(sy + 19, sx + loop) = 0; /* cursor */ + bitmap.pix(sy + 18, sx + loop) = 0; /* cursor */ + bitmap.pix(sy + 19, sx + loop) = 0; /* cursor */ } } } diff --git a/src/mame/video/pacland.cpp b/src/mame/video/pacland.cpp index 30164aeb8bb..7f5be3f9e11 100644 --- a/src/mame/video/pacland.cpp +++ b/src/mame/video/pacland.cpp @@ -334,9 +334,9 @@ void pacland_state::draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const r /* now copy the fg_bitmap to the destination wherever the sprite pixel allows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint8_t *pri = &screen.priority().pix8(y); - uint16_t *src = &m_fg_bitmap.pix16(y); - uint16_t *dst = &bitmap.pix16(y); + uint8_t const *const pri = &screen.priority().pix(y); + uint16_t *const src = &m_fg_bitmap.pix(y); + uint16_t *const dst = &bitmap.pix(y); /* only copy if the priority bitmap is 0 (no high priority sprite) and the source pixel is not the invalid pen; also clear to 0xffff when finished */ @@ -382,8 +382,8 @@ uint32_t pacland_state::screen_update(screen_device &screen, bitmap_ind16 &bitma draw_sprites(screen, m_sprite_bitmap, cliprect, flip, 2); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *spr = &m_sprite_bitmap.pix16(y); - uint16_t *bmp = &bitmap.pix16(y); + uint16_t *const spr = &m_sprite_bitmap.pix(y); + uint16_t const *const bmp = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* clear to 0 if "m_sprite_bitmap" and "bitmap" are different, diff --git a/src/mame/video/paradise.cpp b/src/mame/video/paradise.cpp index 47a012fece8..3aa0a65333a 100644 --- a/src/mame/video/paradise.cpp +++ b/src/mame/video/paradise.cpp @@ -137,15 +137,13 @@ TILE_GET_INFO_MEMBER(paradise_state::get_tile_info_2) void paradise_state::pixmap_w(offs_t offset, uint8_t data) { - int x, y; - m_videoram[offset] = data; - x = (offset & 0x7f) << 1; - y = (offset >> 7); + int x = (offset & 0x7f) << 1; + int y = (offset >> 7); - m_tmpbitmap.pix16(y, x + 0) = 0x80f - (data >> 4); - m_tmpbitmap.pix16(y, x + 1) = 0x80f - (data & 0x0f); + m_tmpbitmap.pix(y, x + 0) = 0x80f - (data >> 4); + m_tmpbitmap.pix(y, x + 1) = 0x80f - (data & 0x0f); } diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp index 8e30aa709a4..c15ea0eea58 100644 --- a/src/mame/video/pastelg.cpp +++ b/src/mame/video/pastelg.cpp @@ -286,7 +286,7 @@ uint32_t pastelg_common_state::screen_update(screen_device &screen, bitmap_ind16 for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) - bitmap.pix16(y, x) = m_videoram[(y * width) + x]; + bitmap.pix(y, x) = m_videoram[(y * width) + x]; } else bitmap.fill(0, cliprect); diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp index 9dc539435cf..2e1d6433c81 100644 --- a/src/mame/video/pc080sn.cpp +++ b/src/mame/video/pc080sn.cpp @@ -362,16 +362,13 @@ static u16 topspeed_get_road_pixel_color( u16 pixel, u16 color ) void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u8 priority, u16 *color_ctrl_ram, u8 pmask) { - u16 *dst16, *src16; - u8 *tsrc; u16 scanline[1024]; /* won't be called by a wide-screen game, but just in case... */ - bitmap_ind16 &srcbitmap = m_tilemap[layer]->pixmap(); - bitmap_ind8 &flagsbitmap = m_tilemap[layer]->flagsmap(); + bitmap_ind16 const &srcbitmap = m_tilemap[layer]->pixmap(); + bitmap_ind8 const &flagsbitmap = m_tilemap[layer]->flagsmap(); - u16 a, color; - int sx, x_index; - int y_index, src_y_index, row_index; + int sx; + int y_index; int flip = 0; @@ -395,21 +392,21 @@ void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &b for (int y = min_y; y <= max_y; y++) { - src_y_index = y_index & 0x1ff; /* tilemaps are 512 px up/down */ - row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff; - color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff]; + int src_y_index = y_index & 0x1ff; /* tilemaps are 512 px up/down */ + int row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff; + u16 color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff]; - x_index = sx - (m_bgscroll_ram[layer][row_index]); + int x_index = sx - (m_bgscroll_ram[layer][row_index]); - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + u16 const *const src16 = &srcbitmap.pix(src_y_index); + u8 const *const tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) { for (int i = 0; i < screen_width; i++) { - a = src16[x_index & width_mask]; + u16 a = src16[x_index & width_mask]; #ifdef TOPSPEED_ROAD_COLORS a = topspeed_get_road_pixel_color(a, color); #endif @@ -423,7 +420,7 @@ void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &b { if (tsrc[x_index & width_mask]) { - a = src16[x_index & width_mask]; + u16 a = src16[x_index & width_mask]; #ifdef TOPSPEED_ROAD_COLORS a = topspeed_get_road_pixel_color(a,color); #endif diff --git a/src/mame/video/pc4.cpp b/src/mame/video/pc4.cpp index 4e427652b5b..6f8b1e8543e 100644 --- a/src/mame/video/pc4.cpp +++ b/src/mame/video/pc4.cpp @@ -30,12 +30,12 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (m_ddram[char_pos] <= 0x10) { //draw CGRAM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); + bitmap.pix(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); } else { //draw CGROM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); + bitmap.pix(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); } @@ -45,12 +45,12 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c //draw the cursor if (m_cursor_on) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + 7, i * 6 + x) = 1; + bitmap.pix(l*9 + 7, i * 6 + x) = 1; if (!m_blink && m_blink_on) for (int y=0; y<7; y++) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + y, i * 6 + x) = 1; + bitmap.pix(l*9 + y, i * 6 + x) = 1; } } diff --git a/src/mame/video/pc6001.cpp b/src/mame/video/pc6001.cpp index 8dcb5121ed0..2874283e3fe 100644 --- a/src/mame/video/pc6001.cpp +++ b/src/mame/video/pc6001.cpp @@ -135,9 +135,6 @@ void pc6001sr_state::video_start() /* this is known as gfx mode 4 */ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr) { - int x,y,xi; - int fgcol,color; - int col_setting; static const uint8_t pen_gattr[4][4] = { { 0, 1, 6, 2 }, //Red / Blue { 0, 6, 1, 2 }, //Blue / Red @@ -150,38 +147,38 @@ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect { 0, 5, 2, 7 }, //Pink / Green { 0, 2, 5, 7 }, //Green / Pink }; - col_setting = m_io_mode4_dsw->read() & 7; + int col_setting = m_io_mode4_dsw->read() & 7; if((attr & 0x0c) != 0x0c) popmessage("Mode 4 vram attr != 0x0c, contact MESSdev"); - for(y=0;y<192;y++) + for(int y=0;y<192;y++) { - for(x=0;x<32;x++) + for(int x=0;x<32;x++) { int tile = m_video_ram[(x+(y*32))+0x200]; if(col_setting == 0x00) //monochrome { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - fgcol = (attr & 2) ? 7 : 2; + int fgcol = (attr & 2) ? 7 : 2; - color = ((tile)>>(7-xi) & 1) ? fgcol : 0; + int color = ((tile)>>(7-xi) & 1) ? fgcol : 0; - bitmap.pix16((y+24), (x*8+xi)+32) = m_palette->pen(color); + bitmap.pix((y+24), (x*8+xi)+32) = m_palette->pen(color); } } else { - for(xi=0;xi<4;xi++) + for(int xi=0;xi<4;xi++) { - fgcol = ((tile)>>(6-(xi*2)) & 3); + int fgcol = ((tile)>>(6-(xi*2)) & 3); - color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); + int color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); - bitmap.pix16((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); - bitmap.pix16((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); + bitmap.pix((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); + bitmap.pix((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); } } } @@ -190,8 +187,6 @@ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr) { - int color,x,y,xi,yi; - int shrink_x = 2*4; int shrink_y = (attr & 8) ? 1 : 2; int w = (shrink_x == 8) ? 32 : 16; @@ -199,22 +194,21 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre if(attr & 4) { - for(y=0;y<(192/shrink_y);y++) + for(int y=0;y<(192/shrink_y);y++) { - for(x=0;x<w;x++) + for(int x=0;x<w;x++) { int tile = m_video_ram[(x+(y*32))+0x200]; - for(yi=0;yi<shrink_y;yi++) + for(int yi=0;yi<shrink_y;yi++) { - for(xi=0;xi<shrink_x;xi++) + for(int xi=0;xi<shrink_x;xi++) { - int i; - i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; - color = ((tile >> i) & 3)+8; + int i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; + int color = ((tile >> i) & 3)+8; color+= col_bank; - bitmap.pix16(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); } } } @@ -222,24 +216,23 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre } else /* TODO: clean this up */ { - for(y=0;y<(192/shrink_y);y+=3) + for(int y=0;y<(192/shrink_y);y+=3) { - for(x=0;x<w;x++) + for(int x=0;x<w;x++) { int tile = m_video_ram[(x+((y/3)*32))+0x200]; - for(yi=0;yi<shrink_y;yi++) + for(int yi=0;yi<shrink_y;yi++) { - for(xi=0;xi<shrink_x;xi++) + for(int xi=0;xi<shrink_x;xi++) { - int i; - i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; - color = ((tile >> i) & 3)+8; + int i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; + int color = ((tile >> i) & 3)+8; color+= col_bank; - bitmap.pix16((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); } } } @@ -249,19 +242,17 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr) { - int color,pen,xi,yi; - + int pen; if(attr & 0x10) //2x2 squares on a single cell pen = (tile & 0x70)>>4; else //2x3 pen = (tile & 0xc0) >> 6 | (attr & 2)<<1; - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int i; - i = (xi & 4)>>2; //x-axis + int i = (xi & 4)>>2; //x-axis if(attr & 0x10) //2x2 { i+= (yi >= 6) ? 2 : 0; //y-axis @@ -272,24 +263,24 @@ void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect i+= (yi & 8)>>1; //y-axis 2 } - color = ((tile >> i) & 1) ? pen+8 : 0; + int color = ((tile >> i) & 1) ? pen+8 : 0; - bitmap.pix16(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); + bitmap.pix(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); } } } void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847) { - int xi,yi,pen,fgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int fgcol,color; if(has_mc6847) { fgcol = (attr & 2) ? 0x12 : 0x10; @@ -310,19 +301,18 @@ void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect color = pen ? fgcol : 0; } - bitmap.pix16(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); + bitmap.pix(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); } } } void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847) { - int x,y,color; - - for(y=0;y<240;y++) + for(int y=0;y<240;y++) { - for(x=0;x<320;x++) + for(int x=0;x<320;x++) { + int color; if(!has_mc6847) //mk2 border color is always black color = 0; else if((attr & 0x90) == 0x80) //2bpp @@ -332,17 +322,14 @@ void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,in else color = 0; //FIXME: other modes not yet checked - bitmap.pix16(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); } } } void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847) { - int x,y; - int tile,attr; - - attr = m_video_ram[0]; + int attr = m_video_ram[0]; draw_border(bitmap,cliprect,attr,has_mc6847); @@ -359,11 +346,11 @@ void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &clip } else // text mode { - for(y=0;y<16;y++) + for(int y=0;y<16;y++) { - for(x=0;x<32;x++) + for(int x=0;x<32;x++) { - tile = m_video_ram[(x+(y*32))+0x200]; + int tile = m_video_ram[(x+(y*32))+0x200]; attr = m_video_ram[(x+(y*32)) & 0x1ff]; if(attr & 0x40) @@ -388,20 +375,16 @@ uint32_t pc6001_state::screen_update_pc6001(screen_device &screen, bitmap_ind16 uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,tile,attr; - /* note: bitmap mode have priority over everything else, check American Truck */ if(m_exgfx_bitmap_mode) { - int count,color,i; + int count = 0; - count = 0; - - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<160;x+=4) + for(int x=0;x<160;x+=4) { - for(i=0;i<4;i++) + for(int i=0;i<4;i++) { int pen[2]; #if 0 @@ -417,16 +400,16 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ pen[0] = m_video_ram[count+0x0000] >> (6-i*2) & 3; pen[1] = m_video_ram[count+0x2000] >> (6-i*2) & 3; - color = 0x10; + int color = 0x10; color |= ((pen[0] & 1) << 2); color |= ((pen[0] & 2) >> 1); color |= ((pen[1] & 1) << 1); color |= ((pen[1] & 2) << 2); if (cliprect.contains((x+i)*2+0, y)) - bitmap.pix16(y, (x+i)*2+0) = m_palette->pen(color); + bitmap.pix(y, (x+i)*2+0) = m_palette->pen(color); if (cliprect.contains((x+i)*2+1, y)) - bitmap.pix16(y, (x+i)*2+1) = m_palette->pen(color); + bitmap.pix(y, (x+i)*2+1) = m_palette->pen(color); } count++; @@ -435,15 +418,13 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } else if(m_exgfx_2bpp_mode) { - int count,color,i; - - count = 0; + int count = 0; - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<320;x+=8) + for(int x=0;x<320;x+=8) { - for(i=0;i<8;i++) + for(int i=0;i<8;i++) { int pen[2]; #if 0 @@ -456,6 +437,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ pen[0] = m_video_ram[count+0x0000] >> (7-i) & 1; pen[1] = m_video_ram[count+0x2000] >> (7-i) & 1; + int color; if(m_bgcol_bank & 4) //PC-6001 emulation mode { color = 0x08; @@ -472,7 +454,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } if (cliprect.contains(x+i, y)) - bitmap.pix16(y, (x+i)) = m_palette->pen(color); + bitmap.pix(y, (x+i)) = m_palette->pen(color); } count++; @@ -482,12 +464,11 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } else if(m_exgfx_text_mode) { - int xi,yi,pen,fgcol,bgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); - for(y=0;y<20;y++) + for(int y=0;y<20;y++) { - for(x=0;x<40;x++) + for(int x=0;x<40;x++) { /* exgfx attr format: @@ -496,23 +477,23 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ ---- xxxx fg color Note that the exgfx banks a different gfx ROM */ - tile = m_video_ram[(x+(y*40))+0x400] + 0x200; - attr = m_video_ram[(x+(y*40)) & 0x3ff]; - tile+= ((attr & 0x80) << 1); + int tile = m_video_ram[(x+(y*40))+0x400] + 0x200; + int attr = m_video_ram[(x+(y*40)) & 0x3ff]; + tile += ((attr & 0x80) << 1); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + int fgcol = (attr & 0x0f) + 0x10; + int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - color = pen ? fgcol : bgcol; + int color = pen ? fgcol : bgcol; if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); } } } @@ -529,35 +510,33 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,tile,attr; - int xi,yi,pen,fgcol,bgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); bitmap.fill(0,cliprect); if(m_sr_text_mode == true) // text mode { - for(y=0;y<m_sr_text_rows;y++) + for(int y=0;y<m_sr_text_rows;y++) { - for(x=0;x<40;x++) + for(int x=0;x<40;x++) { - tile = m_video_ram[(x+(y*40))*2+0]; - attr = m_video_ram[(x+(y*40))*2+1]; - tile+= ((attr & 0x80) << 1); + int tile = m_video_ram[(x+(y*40))*2+0]; + int attr = m_video_ram[(x+(y*40))*2+1]; + tile += ((attr & 0x80) << 1); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + int fgcol = (attr & 0x0f) + 0x10; + int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - color = pen ? fgcol : bgcol; + int color = pen ? fgcol : bgcol; if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); } } } @@ -565,9 +544,9 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in } else //4bpp bitmap mode (TODO) { - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<320;x+=2) + for(int x=0;x<320;x+=2) { uint32_t vram_addr; @@ -576,15 +555,15 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in else vram_addr = x+y*256; - color = (m_gvram[vram_addr] & 0xf0) >> 4; + int color; + color = (m_gvram[vram_addr] & 0xf0) >> 4; if (cliprect.contains(x, y+0)) - bitmap.pix16((y+0), (x+0)) = m_palette->pen(color+0x10); + bitmap.pix((y+0), (x+0)) = m_palette->pen(color+0x10); color = (m_gvram[vram_addr] & 0x0f); - if (cliprect.contains(x+1, y+0)) - bitmap.pix16((y+0), (x+1)) = m_palette->pen(color+0x10); + bitmap.pix((y+0), (x+1)) = m_palette->pen(color+0x10); } } } diff --git a/src/mame/video/pc9801.cpp b/src/mame/video/pc9801.cpp index bddd9e7129e..b069e2af0c4 100644 --- a/src/mame/video/pc9801.cpp +++ b/src/mame/video/pc9801.cpp @@ -41,43 +41,40 @@ uint32_t pc9801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi; - int res_x,res_y; - uint8_t pen; - uint8_t colors16_mode; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(m_video_ff[DISPLAY_REG] == 0) //screen is off return; - colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; + uint8_t colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; if(m_ex_video_ff[ANALOG_256_MODE]) { uint8_t *ext_gvram = (uint8_t *)m_ext_gvram.target(); - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - res_x = x + xi; - res_y = y; + int res_x = x + xi; + int res_y = y; - pen = ext_gvram[(address >> 1)*16+xi+(m_vram_disp*0x40000)]; + uint8_t pen = ext_gvram[(address >> 1)*16+xi+(m_vram_disp*0x40000)]; - bitmap.pix32(res_y, res_x) = palette[pen + 0x20]; + bitmap.pix(res_y, res_x) = palette[pen + 0x20]; } } else { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - res_x = x + xi; - res_y = y; + int res_x = x + xi; + int res_y = y; + uint8_t pen; pen = ((m_video_ram_2[((address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 1 : 0; pen|= ((m_video_ram_2[((address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 2 : 0; pen|= ((m_video_ram_2[((address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 4 : 0; if(m_ex_video_ff[ANALOG_16_MODE]) pen|= ((m_video_ram_2[((address & 0x7fff) + (0) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 8 : 0; - bitmap.pix32(res_y, res_x) = palette[pen + colors16_mode]; + bitmap.pix(res_y, res_x) = palette[pen + colors16_mode]; } } } @@ -90,40 +87,24 @@ UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi; - int x; - uint8_t char_size; -// uint8_t interlace_on; - uint16_t tile; - uint8_t kanji_lr; - uint8_t kanji_sel; - uint8_t x_step; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(m_video_ff[DISPLAY_REG] == 0) //screen is off return; -// interlace_on = m_video_ff[INTERLACE_REG]; - char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - tile = 0; +// uint8_t interlace_on = m_video_ff[INTERLACE_REG]; + uint8_t char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - for(x=0;x<pitch;x+=x_step) + uint8_t x_step; + for(int x=0;x<pitch;x+=x_step) { - uint8_t tile_data,secret,reverse,u_line,v_line,blink; - uint8_t color; - uint8_t attr; - int pen; - uint32_t tile_addr; - uint8_t knj_tile; - uint8_t gfx_mode; - - tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); + uint32_t tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); - kanji_sel = 0; - kanji_lr = 0; + uint8_t kanji_sel = 0; + uint8_t kanji_lr = 0; - tile = m_video_ram_1[tile_addr & 0xfff] & 0xff; - knj_tile = m_video_ram_1[tile_addr & 0xfff] >> 8; + uint16_t tile = m_video_ram_1[tile_addr & 0xfff] & 0xff; + uint8_t knj_tile = m_video_ram_1[tile_addr & 0xfff] >> 8; if(knj_tile) { /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it. @@ -150,36 +131,33 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { /* Rori Rori Rolling definitely uses different colors for brake stop PCG elements, assume that all attributes are recalculated on different strips */ - attr = (m_video_ram_1[((tile_addr+kanji_lr) & 0xfff) | 0x1000] & 0xff); + uint8_t attr = (m_video_ram_1[((tile_addr+kanji_lr) & 0xfff) | 0x1000] & 0xff); - secret = (attr & 1) ^ 1; - blink = attr & 2; - reverse = attr & 4; - u_line = attr & 8; - v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10; - gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0; - color = (attr & 0xe0) >> 5; + uint8_t secret = (attr & 1) ^ 1; + uint8_t blink = attr & 2; + uint8_t reverse = attr & 4; + uint8_t u_line = attr & 8; + uint8_t v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10; + uint8_t gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0; + uint8_t color = (attr & 0xe0) >> 5; - for(yi=0;yi<lr;yi++) + for(int yi=0;yi<lr;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - - res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1); - res_y = y+yi - (m_txt_scroll_reg[3] % 20); + int res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1); + int res_y = y+yi - (m_txt_scroll_reg[3] % 20); if(!m_screen->visible_area().contains(res_x, res_y)) continue; - tile_data = 0; + uint8_t tile_data = 0; if(!secret) { /* TODO: priority */ if(gfx_mode) { - int gfx_bit; tile_data = 0; /* @@ -193,6 +171,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) 33337777 */ + int gfx_bit; gfx_bit = (xi & 4); gfx_bit+= (yi & (2 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); gfx_bit+= (yi & (4 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); @@ -216,13 +195,14 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) if(blink && m_screen->frame_number() & 0x10) tile_data = 0; + int pen; if(yi >= char_size) pen = -1; else pen = (tile_data >> (7-xi) & 1) ? color : -1; if(pen != -1) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; if(m_video_ff[WIDTH40_REG]) { @@ -230,7 +210,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) continue; if(pen != -1) - bitmap.pix32(res_y, res_x+1) = palette[pen]; + bitmap.pix(res_y, res_x+1) = palette[pen]; } } } diff --git a/src/mame/video/pc_t1t.cpp b/src/mame/video/pc_t1t.cpp index 6f122e2638c..28ec71c1fd4 100644 --- a/src/mame/video/pc_t1t.cpp +++ b/src/mame/video/pc_t1t.cpp @@ -185,8 +185,8 @@ void pc_t1t_device::pcjr_palette(palette_device &palette) const MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); if ( y == 0 ) logerror("t1000_text_inten_update_row\n"); for (int i = 0; i < x_count; i++) @@ -203,22 +203,22 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) data = 0xFF; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { @@ -244,24 +244,23 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff; uint8_t chr = m_displayram[ offset ]; @@ -285,157 +284,152 @@ MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) else data = ((i == cursor_x) && (m_pc_framecnt & 8)) ? 0xff: 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_4bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; + uint8_t data = vid[offset]; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; - data = vid[ offset + 1 ]; + data = vid[offset + 1]; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; + uint8_t data = vid[offset]; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 6) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 4) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 2) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 0) & 0x03)]]; - data = vid[ offset+1 ]; + data = vid[offset + 1]; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 6) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 4) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 2) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 0) & 0x03)]]; } } MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjr_gfx_2bpp_high_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data0 = vid[ offset ]; - uint8_t data1 = vid[ offset + 1 ]; - - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x08 ) >> 3 ) | ( ( data1 & 0x08 ) >> 2 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x04 ) >> 2 ) | ( ( data1 & 0x04 ) >> 1 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x02 ) >> 1 ) | ( ( data1 & 0x02 ) ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x01 ) ) | ( ( data1 & 0x01 ) << 1 ) ) ]]; p++; + uint8_t data0 = vid[offset]; + uint8_t data1 = vid[offset + 1]; + + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 7) & 0x01) | ((data1 >> 6) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 6) & 0x01) | ((data1 >> 5) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 5) & 0x01) | ((data1 >> 4) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 4) & 0x01) | ((data1 >> 3) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 3) & 0x01) | ((data1 >> 2) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 2) & 0x01) | ((data1 >> 1) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 1) & 0x01) | ((data1 >> 0) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 0) & 0x01) | ((data1 << 1) & 0x02)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_tga_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n"); - for ( i = 0; i < x_count; i++ ) + if (y == 0) logerror("t1000_gfx_2bpp_tga_update_row\n"); + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; - uint16_t data2 = ( vid[ offset + 1 ] ) << 1; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x20 ) | ( data & 0x10 ) ) >> 4 ) ]]; p++; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x10 ) | ( data & 0x08 ) ) >> 3 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x08 ) | ( data & 0x04 ) ) >> 2 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x04 ) | ( data & 0x02 ) ) >> 1 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( data2 & 0x02 ) | ( data & 0x01 ) ) ]]; p++; + uint8_t data = vid[offset]; + uint8_t data2 = vid[offset + 1] << 1; + + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x100) | (data & 0x80)) >> 7)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x080) | (data & 0x40)) >> 6)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x040) | (data & 0x20)) >> 5)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x020) | (data & 0x10)) >> 4)]]; + + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x010) | (data & 0x08)) >> 3)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x008) | (data & 0x04)) >> 2)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x004) | (data & 0x02)) >> 1)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x002) | (data & 0x01)) >> 0)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_1bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - uint8_t fg = m_palette_base + m_reg.data[0x11]; - uint8_t bg = m_palette_base + m_reg.data[0x10]; - int i; - - if ( y == 0 ) logerror("t1000_gfx_1bpp_update_row\n"); - for ( i = 0; i < x_count; i++ ) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); + uint8_t fg = m_palette_base + m_reg.data[0x11]; + uint8_t bg = m_palette_base + m_reg.data[0x10]; + + if (y == 0) logerror("t1000_gfx_1bpp_update_row\n"); + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - - data = vid[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + uint8_t data = vid[offset]; + + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; + + data = vid[offset + 1]; + + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp index 4e7a9362730..e472116b2cc 100644 --- a/src/mame/video/pcd.cpp +++ b/src/mame/video/pcd.cpp @@ -182,7 +182,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) data = ~data; for(int i = 0; i < 16; i++) { - bitmap.pix32(y, x++) = palette().pen(BIT(data, 15) ? 1 : 0); + bitmap.pix(y, x++) = palette().pen(BIT(data, 15) ? 1 : 0); data <<= 1; } } @@ -209,8 +209,8 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) for(int i = 0; i < 8; i++) { rgb_t pix = palette().pen(BIT(data, 7) ? fgnd : bgnd); - bitmap.pix32(y, x++) = pix; - bitmap.pix32(y, x++) = pix; + bitmap.pix(y, x++) = pix; + bitmap.pix(y, x++) = pix; data <<= 1; } } @@ -229,7 +229,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) for (int i = 0; i < 8; i++) { rgb_t pix = palette().pen(BIT(data, 7) ? 1 : 0); - bitmap.pix32(y, x++) = pix; + bitmap.pix(y, x++) = pix; data <<= 1; } } diff --git a/src/mame/video/pcw.cpp b/src/mame/video/pcw.cpp index 05eeb1a68b7..f0ee1903f5f 100644 --- a/src/mame/video/pcw.cpp +++ b/src/mame/video/pcw.cpp @@ -25,7 +25,7 @@ inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /*************************************************************************** @@ -211,12 +211,12 @@ uint32_t pcw_state::screen_update_pcw_printer(screen_device &screen, bitmap_ind1 rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); feed = -(m_paper_feed / 2); copyscrollbitmap(bitmap,*m_prn_output,0,nullptr,1,&feed,rect); - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; return 0; } diff --git a/src/mame/video/pcw16.cpp b/src/mame/video/pcw16.cpp index 35177c807b8..1fb7c6eb2f5 100644 --- a/src/mame/video/pcw16.cpp +++ b/src/mame/video/pcw16.cpp @@ -55,7 +55,7 @@ static constexpr rgb_t pcw16_palette[PCW16_NUM_COLOURS] = inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* Initialise the palette */ diff --git a/src/mame/video/pdp1.cpp b/src/mame/video/pdp1.cpp index 793f9ea5a56..cbdb3031fbd 100644 --- a/src/mame/video/pdp1.cpp +++ b/src/mame/video/pdp1.cpp @@ -29,7 +29,7 @@ inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } /* @@ -356,13 +356,12 @@ enum void pdp1_typewriter_device::linefeed() { uint8_t buf[typewriter_window_width]; - int y; assert(typewriter_window_width <= m_bitmap.width()); assert(typewriter_window_height <= m_bitmap.height()); - for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) + for (int y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - std::copy_n(&m_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); + std::copy_n(&m_bitmap.pix(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_bitmap, 0, y, typewriter_window_width, buf, m_driver_state->m_palette->pens()); } diff --git a/src/mame/video/pgm.cpp b/src/mame/video/pgm.cpp index 28b579390e1..fab7088207e 100644 --- a/src/mame/video/pgm.cpp +++ b/src/mame/video/pgm.cpp @@ -229,8 +229,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -252,8 +252,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -289,8 +289,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -435,8 +435,8 @@ void pgm_state::draw_sprite_new_basic(int wide, int high, int xpos, int ypos, in if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line_basic(wide, dest, destpri, cliprect, flip, xpos, pri, realxsize, palt, true); } else diff --git a/src/mame/video/pgm2.cpp b/src/mame/video/pgm2.cpp index 3c7dc40e10e..e235549f8c7 100644 --- a/src/mame/video/pgm2.cpp +++ b/src/mame/video/pgm2.cpp @@ -10,7 +10,7 @@ inline void pgm2_state::draw_sprite_pixel(const rectangle &cliprect, u32 palette { u16 const pix = m_sprites_colour[palette_offset] & 0x3f; // there are some stray 0xff bytes in some roms, so mask u16 const pendat = pix + (pal * 0x40); - u16* dstptr_bitmap = &m_sprite_bitmap.pix16(realy); + u16 *const dstptr_bitmap = &m_sprite_bitmap.pix(realy); dstptr_bitmap[realx] = pendat; } } @@ -270,14 +270,12 @@ void pgm2_state::copy_sprites_from_bitmap(bitmap_rgb32 &bitmap, const rectangle { pri <<= 12; - const pen_t *paldata = m_sp_palette->pens(); - u16* srcptr_bitmap; - u32* dstptr_bitmap; + pen_t const *const paldata = m_sp_palette->pens(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - srcptr_bitmap = &m_sprite_bitmap.pix16(y); - dstptr_bitmap = &bitmap.pix32(y); + u16 const *const srcptr_bitmap = &m_sprite_bitmap.pix(y); + u32 *const dstptr_bitmap = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/pitnrun.cpp b/src/mame/video/pitnrun.cpp index a9ff5caa885..7ab1327869f 100644 --- a/src/mame/video/pitnrun.cpp +++ b/src/mame/video/pitnrun.cpp @@ -104,7 +104,7 @@ void pitnrun_state::spotlights() int datapix = ROM[128*16*i + x + y*16]; for(int b=0; b<8; b++) { - m_tmp_bitmap[i]->pix16(y, x*8 + (7 - b)) = (datapix & 1); + m_tmp_bitmap[i]->pix(y, x*8 + (7 - b)) = (datapix & 1); datapix>>=1; } } diff --git a/src/mame/video/pk8000.cpp b/src/mame/video/pk8000.cpp index e47b81066fe..9f5f3ccc5c5 100644 --- a/src/mame/video/pk8000.cpp +++ b/src/mame/video/pk8000.cpp @@ -104,7 +104,6 @@ void pk8000_base_state::_84_portc_w(uint8_t data) uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *videomem) { - int x,y,j,b; uint16_t offset = (m_video_mode & 0xc0) << 8; rectangle my_rect; my_rect.set(0, 256+32-1, 0, 192+32-1); @@ -116,36 +115,36 @@ uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bi // Text mode if (BIT(m_video_mode,5)==0){ // 32 columns - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t chr = videomem[x +(y*32) + ((m_text_start & 0x0f) << 10)+offset] ; uint8_t color= m_color[chr>>3]; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t code = videomem[((chr<<3) + j) + ((m_chargen_start & 0x0e) << 10)+offset]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { uint8_t col = (code >> b) & 0x01 ? (color & 0x0f) : ((color>>4) & 0x0f); - bitmap.pix16((y*8)+j+16, x*8+(7-b)+16) = col; + bitmap.pix((y*8)+j+16, x*8+(7-b)+16) = col; } } } } } else { // 40 columns - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 42; x++) + for (int x = 0; x < 42; x++) { uint8_t chr = videomem[x +(y*64) + ((m_text_start & 0x0e) << 10)+offset] ; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t code = videomem[((chr<<3) + j) + ((m_chargen_start & 0x0e) << 10)+offset]; - for (b = 2; b < 8; b++) + for (int b = 2; b < 8; b++) { uint8_t col = ((code >> b) & 0x01) ? (m_video_color) & 0x0f : (m_video_color>>4) & 0x0f; - bitmap.pix16((y*8)+j+16, x*6+(7-b)+16+8) = col; + bitmap.pix((y*8)+j+16, x*6+(7-b)+16+8) = col; } } } @@ -153,21 +152,21 @@ uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bi } } else { //Graphics - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { uint16_t off_color = (((~m_color_start) & 0x08) << 10)+offset + ((y>>3)<<11); uint16_t off_code = (((~m_video_start) & 0x08) << 10)+offset + ((y>>3)<<11); - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t chr = videomem[x +(y*32) + ((m_chargen_start & 0x0e) << 10)+offset] ; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t color= videomem[((chr<<3) + j)+off_color]; uint8_t code = videomem[((chr<<3) + j)+off_code]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { uint8_t col = (code >> b) & 0x01 ? (color & 0x0f) : ((color>>4) & 0x0f); - bitmap.pix16((y*8)+j+16, x*8+(7-b)+16) = col; + bitmap.pix((y*8)+j+16, x*8+(7-b)+16) = col; } } } diff --git a/src/mame/video/pk8020.cpp b/src/mame/video/pk8020.cpp index b4915f1135b..5ac06457619 100644 --- a/src/mame/video/pk8020.cpp +++ b/src/mame/video/pk8020.cpp @@ -135,17 +135,17 @@ void pk8020_state::gzu_w(offs_t offset, uint8_t data) uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); for (int y = 0; y < 16; y++) { for (int x = 0; x < 64; x++) { - uint8_t chr = ram[x +(y*64) + 0x40000]; - uint8_t attr= ram[x +(y*64) + 0x40400]; + uint8_t const chr = ram[x +(y*64) + 0x40000]; + uint8_t const attr= ram[x +(y*64) + 0x40400]; for (int j = 0; j < 16; j++) { - uint32_t addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); + uint32_t const addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); uint8_t code1 = ram[addr]; uint8_t code2 = ram[addr + 0x4000]; uint8_t code3 = ram[addr + 0x8000]; @@ -157,7 +157,7 @@ uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00); col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00); col |= (((code1 >> b) & 0x01) ? 0x01 : 0x00); - bitmap.pix16((y*16)+j, x*8+(7-b)) = col; + bitmap.pix((y*16)+j, x*8+(7-b)) = col; } } } diff --git a/src/mame/video/playmark.cpp b/src/mame/video/playmark.cpp index dd6eff32dd6..834a363b4b1 100644 --- a/src/mame/video/playmark.cpp +++ b/src/mame/video/playmark.cpp @@ -437,24 +437,20 @@ void playmark_state::bigtwinb_draw_sprites( screen_device &screen, bitmap_ind16 void playmark_state::draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int x, y, count; - int color; - uint8_t *pri; - - count = 0; - for (y = 0; y < 512; y++) + int count = 0; + for (int y = 0; y < 512; y++) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { - color = m_bgvideoram[count] & 0xff; + int const color = m_bgvideoram[count] & 0xff; if (color) { if (m_bg_full_size) { - bitmap.pix16((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color; + bitmap.pix((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color; - pri = &screen.priority().pix8((y + m_bgscrolly) & 0x1ff); + uint8_t *const pri = &screen.priority().pix((y + m_bgscrolly) & 0x1ff); pri[(x + m_bgscrollx) & 0x1ff] |= 2; } else @@ -462,9 +458,9 @@ void playmark_state::draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, c /* 50% size */ if(!(x % 2) && !(y % 2)) { - bitmap.pix16((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color; + bitmap.pix((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color; - pri = &screen.priority().pix8((y / 2 + m_bgscrolly) & 0x1ff); + uint8_t *const pri = &screen.priority().pix((y / 2 + m_bgscrolly) & 0x1ff); pri[(x / 2 + m_bgscrollx) & 0x1ff] |= 2; } } diff --git a/src/mame/video/pocketc.cpp b/src/mame/video/pocketc.cpp index dc845f029df..2226b23bbbd 100644 --- a/src/mame/video/pocketc.cpp +++ b/src/mame/video/pocketc.cpp @@ -44,5 +44,5 @@ void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, con for (int i = 0; i < 5; i++, y++) for (int j = 0; fig[i][j]; j++) if (fig[i][j] != ' ') - bitmap.pix16(y, x + j) = color; + bitmap.pix(y, x + j) = color; } diff --git a/src/mame/video/polepos.cpp b/src/mame/video/polepos.cpp index eeaf594a590..a6bfbcf6679 100644 --- a/src/mame/video/polepos.cpp +++ b/src/mame/video/polepos.cpp @@ -416,7 +416,7 @@ void polepos_state::zoom_sprite(bitmap_ind16 &bitmap,int big, int pen = src[offs/2 ^ flipx]; if (!((transmask >> pen) & 1)) - bitmap.pix16(yy, xx) = pen + coloroffs; + bitmap.pix(yy, xx) = pen + coloroffs; } offs++; diff --git a/src/mame/video/policetr.cpp b/src/mame/video/policetr.cpp index 4fd79e3f28f..1b0ff34ee5d 100644 --- a/src/mame/video/policetr.cpp +++ b/src/mame/video/policetr.cpp @@ -97,8 +97,8 @@ void policetr_state::render_display_list(offs_t offset) { for (int y = 0; y < dsth; y++) { - uint8_t *dst = &m_dstbitmap->pix8(dsty + y,dstx); - memset(dst, pixel, dstw); + uint8_t *dst = &m_dstbitmap->pix(dsty + y,dstx); + std::fill_n(dst, dstw, pixel); } } } @@ -110,8 +110,8 @@ void policetr_state::render_display_list(offs_t offset) uint32_t cury = srcy; for (int y = 0; y < dsth; y++, cury += srcystep) { - const uint8_t *src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH]; - uint8_t *dst = &m_dstbitmap->pix8((dsty + y), dstx); + uint8_t const *const src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH]; + uint8_t *const dst = &m_dstbitmap->pix((dsty + y), dstx); /* loop over columns */ for (int x = 0, curx = srcx; x < dstw; x++, curx += srcxstep) @@ -181,7 +181,7 @@ void policetr_state::video_w(offs_t offset, uint32_t data, uint32_t mem_mask) /* latch 0x50 allows a direct write to the destination bitmap */ case 0x50: if (ACCESSING_BITS_24_31 && m_dst_xoffs < DSTBITMAP_WIDTH && m_dst_yoffs < DSTBITMAP_HEIGHT) - m_dstbitmap->pix8(m_dst_yoffs,m_dst_xoffs) = data >> 24; + m_dstbitmap->pix(m_dst_yoffs,m_dst_xoffs) = data >> 24; break; /* log anything else */ @@ -306,13 +306,13 @@ uint32_t policetr_state::video_r() uint32_t policetr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { const int width = cliprect.width(); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); /* render all the scanlines from the dstbitmap to MAME's bitmap */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint8_t *src = &m_dstbitmap->pix8(y,cliprect.min_x); - uint32_t *dst = &bitmap.pix32(y,cliprect.min_x); + uint8_t const *src = &m_dstbitmap->pix(y,cliprect.min_x); + uint32_t *dst = &bitmap.pix(y,cliprect.min_x); //draw_scanline8(bitmap, cliprect.min_x, y, width, src, nullptr); for (int x = 0; x < width; x++, dst++, src++) *dst = palette[*src]; diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp index 45d09c0ab12..edb10dc7b1f 100644 --- a/src/mame/video/popeye.cpp +++ b/src/mame/video/popeye.cpp @@ -383,14 +383,14 @@ void tnx1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from + bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from else { // TODO: confirm the memory layout int sx = x + (2 * (m_background_scroll[0] | ((m_background_scroll[2] & 1) << 8))) + 0x70; int shift = (sx & 0x200) / 0x80; - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } @@ -409,14 +409,14 @@ void tpp1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from + bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from else { // TODO: confirm the memory layout int sx = x + (2 * m_background_scroll[0]) + 0x70; int shift = (sy & 4); - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } @@ -435,14 +435,14 @@ void tpp2_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf; + bitmap.pix(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf; else { // TODO: confirm the memory layout int sx = x + (2 * m_background_scroll[0]) + 0x70; int shift = (sy & 4); - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index 1584ac823a4..e3d86fb3fa5 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -2420,7 +2420,7 @@ inline void powervr2_device::render_hline(bitmap_rgb32 &bitmap, texinfo *ti, int offl[idx] += ddx * dodx[idx]; } - tdata = &bitmap.pix32(y, xxl); + tdata = &bitmap.pix(y, xxl); wbufline = &wbuffer[y][xxl]; while(xxl < xxr) { @@ -2881,13 +2881,12 @@ void powervr2_device::render_to_accumulation_buffer(bitmap_rgb32 &bitmap, const /* 0555KRGB = 0 */ void powervr2_device::fb_convert_0555krgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2902,13 +2901,12 @@ void powervr2_device::fb_convert_0555krgb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_0555krgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2923,13 +2921,12 @@ void powervr2_device::fb_convert_0555krgb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_0555krgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2944,13 +2941,12 @@ void powervr2_device::fb_convert_0555krgb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_0555krgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2964,13 +2960,12 @@ void powervr2_device::fb_convert_0555krgb_to_888rgb32(address_space &space, int /* 0565RGB = 1 */ void powervr2_device::fb_convert_0565rgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2985,13 +2980,12 @@ void powervr2_device::fb_convert_0565rgb_to_555rgb(address_space &space, int x,i void powervr2_device::fb_convert_0565rgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3006,13 +3000,12 @@ void powervr2_device::fb_convert_0565rgb_to_565rgb(address_space &space, int x,i void powervr2_device::fb_convert_0565rgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3027,13 +3020,12 @@ void powervr2_device::fb_convert_0565rgb_to_888rgb24(address_space &space, int x void powervr2_device::fb_convert_0565rgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3047,13 +3039,12 @@ void powervr2_device::fb_convert_0565rgb_to_888rgb32(address_space &space, int x /* 1555ARGB = 3 */ void powervr2_device::fb_convert_1555argb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3068,13 +3059,12 @@ void powervr2_device::fb_convert_1555argb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_1555argb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3089,13 +3079,12 @@ void powervr2_device::fb_convert_1555argb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_1555argb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3110,13 +3099,12 @@ void powervr2_device::fb_convert_1555argb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_1555argb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3130,13 +3118,12 @@ void powervr2_device::fb_convert_1555argb_to_888rgb32(address_space &space, int /* 888RGB = 4 */ void powervr2_device::fb_convert_888rgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3151,13 +3138,12 @@ void powervr2_device::fb_convert_888rgb_to_555rgb(address_space &space, int x,in void powervr2_device::fb_convert_888rgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3172,13 +3158,12 @@ void powervr2_device::fb_convert_888rgb_to_565rgb(address_space &space, int x,in void powervr2_device::fb_convert_888rgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3193,13 +3178,12 @@ void powervr2_device::fb_convert_888rgb_to_888rgb24(address_space &space, int x, void powervr2_device::fb_convert_888rgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3214,13 +3198,12 @@ void powervr2_device::fb_convert_888rgb_to_888rgb32(address_space &space, int x, /* 8888ARGB = 6 */ void powervr2_device::fb_convert_8888argb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3235,13 +3218,12 @@ void powervr2_device::fb_convert_8888argb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_8888argb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3256,13 +3238,12 @@ void powervr2_device::fb_convert_8888argb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_8888argb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3277,13 +3258,12 @@ void powervr2_device::fb_convert_8888argb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_8888argb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3403,16 +3383,11 @@ void powervr2_device::pvr_accumulationbuffer_to_framebuffer(address_space &space void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle &cliprect) { - int x,y,dy,xi; - uint32_t addrp; - uint32_t *fbaddr; - uint32_t c; - uint32_t r,g,b; + int dy,xi; uint8_t interlace_on = ((spg_control & 0x10) >> 4); int32_t ystart_f1 = (vo_starty & 0x3ff) << interlace_on; //int32_t ystart_f2 = (vo_starty >> 16) & 0x3ff; int32_t hstart = (vo_startx & 0x3ff); - int res_x,res_y; // rectangle fbclip; uint8_t unpackmode = (fb_r_ctrl & 0x0000000c) >>2; // aka fb_depth @@ -3443,29 +3418,29 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & { case 0x00: // 0555 RGB 16-bit, Cleo Fortune Plus // should upsample back to 8-bit output using fb_concat - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x03e0) >> 2; - r = (c & 0x7c00) >> 7; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x03e0) >> 2; + uint32_t r = (c & 0x7c00) >> 7; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); addrp+=2; @@ -3473,17 +3448,17 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; + int res_x = x + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x03e0) >> 2; - r = (c & 0x7c00) >> 7; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x03e0) >> 2; + uint32_t r = (c & 0x7c00) >> 7; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3491,32 +3466,32 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } } } - break; + case 0x01: // 0565 RGB 16-bit // should upsample back to 8-bit output using fb_concat - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x07e0) >> 3; - r = (c & 0xf800) >> 8; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x07e0) >> 3; + uint32_t r = (c & 0xf800) >> 8; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; //res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3526,16 +3501,16 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x07e0) >> 3; - r = (c & 0xf800) >> 8; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x07e0) >> 3; + uint32_t r = (c & 0xf800) >> 8; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3546,34 +3521,31 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & break; case 0x02: ; // 888 RGB 24-bit - suchie3, Soul Calibur - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - b = c; + uint32_t b =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - g = c; + uint32_t g =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); - r = c; + uint32_t r =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3582,20 +3554,17 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - b = c; + uint32_t b =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - g = c; + uint32_t g =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); - r = c; + uint32_t r =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3607,30 +3576,30 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & break; case 0x03: // 0888 ARGB 32-bit - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); - b = (c & 0x0000ff) >> 0; - g = (c & 0x00ff00) >> 8; - r = (c & 0xff0000) >> 16; + uint32_t b = (c & 0x0000ff) >> 0; + uint32_t g = (c & 0x00ff00) >> 8; + uint32_t r = (c & 0xff0000) >> 16; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3639,16 +3608,16 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); - b = (c & 0x0000ff) >> 0; - g = (c & 0x00ff00) >> 8; - r = (c & 0xff0000) >> 16; + uint32_t b = (c & 0x0000ff) >> 0; + uint32_t g = (c & 0x00ff00) >> 8; + uint32_t r = (c & 0xff0000) >> 16; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3665,23 +3634,19 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & #if DEBUG_PALRAM void powervr2_device::debug_paletteram() { - uint64_t pal; - uint32_t r,g,b; - int i; - //popmessage("%02x",pal_ram_ctrl); - for(i=0;i<0x400;i++) + for(int i=0;i<0x400;i++) { - pal = palette[i]; + uint64_t pal = palette[i]; switch(pal_ram_ctrl) { case 0: //argb1555 <- guilty gear uses this mode { //a = (pal & 0x8000)>>15; - r = (pal & 0x7c00)>>10; - g = (pal & 0x03e0)>>5; - b = (pal & 0x001f)>>0; + uint32_t r = (pal & 0x7c00)>>10; + uint32_t g = (pal & 0x03e0)>>5; + uint32_t b = (pal & 0x001f)>>0; //a = a ? 0xff : 0x00; m_palette->set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b)); } @@ -3689,27 +3654,27 @@ void powervr2_device::debug_paletteram() case 1: //rgb565 { //a = 0xff; - r = (pal & 0xf800)>>11; - g = (pal & 0x07e0)>>5; - b = (pal & 0x001f)>>0; + uint32_t r = (pal & 0xf800)>>11; + uint32_t g = (pal & 0x07e0)>>5; + uint32_t b = (pal & 0x001f)>>0; m_palette->set_pen_color(i, pal5bit(r), pal6bit(g), pal5bit(b)); } break; case 2: //argb4444 { //a = (pal & 0xf000)>>12; - r = (pal & 0x0f00)>>8; - g = (pal & 0x00f0)>>4; - b = (pal & 0x000f)>>0; + uint32_t r = (pal & 0x0f00)>>8; + uint32_t g = (pal & 0x00f0)>>4; + uint32_t b = (pal & 0x000f)>>0; m_palette->set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b)); } break; case 3: //argb8888 { //a = (pal & 0xff000000)>>20; - r = (pal & 0x00ff0000)>>16; - g = (pal & 0x0000ff00)>>8; - b = (pal & 0x000000ff)>>0; + uint32_t r = (pal & 0x00ff0000)>>16; + uint32_t g = (pal & 0x0000ff00)>>8; + uint32_t b = (pal & 0x000000ff)>>0; m_palette->set_pen_color(i, r, g, b); } break; @@ -3838,7 +3803,6 @@ uint32_t powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bit // static int useframebuffer=1; // const rectangle &visarea = screen.visible_area(); -// int y,x; #if DEBUG_PALRAM debug_paletteram(); @@ -3846,12 +3810,12 @@ uint32_t powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bit // copy our fake framebuffer bitmap (where things have been rendered) to the screen #if 0 - for (y = visarea->min_y ; y <= visarea->max_y ; y++) + for (int y = visarea->min_y ; y <= visarea->max_y ; y++) { - for (x = visarea->min_x ; x <= visarea->max_x ; x++) + for (int x = visarea->min_x ; x <= visarea->max_x ; x++) { - uint32_t* src = &fake_accumulationbuffer_bitmap->pix32(y, x); - uint32_t* dst = &bitmap.pix32(y, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y, x); + uint32_t *const dst = &bitmap.pix(y, x); dst[0] = src[0]; } } @@ -4012,7 +3976,7 @@ void powervr2_device::device_start() { irq_cb.resolve_safe(); - grab = make_unique_clear<receiveddata[]>(NUM_BUFFERS); + grab = std::make_unique<receiveddata[]>(NUM_BUFFERS); pvr_build_parameterconfig(); diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h index 7abb6ed05fe..520c75f99c0 100644 --- a/src/mame/video/powervr2.h +++ b/src/mame/video/powervr2.h @@ -79,32 +79,33 @@ public: float poly_base_color[4], poly_offs_color[4], poly_last_mode_2_base_color[4]; - struct texinfo { - uint32_t address, vqbase; + struct texinfo + { + uint32_t address = 0, vqbase = 0; - uint32_t tsinstruction; + uint32_t tsinstruction = 0; - int textured, sizex, sizey, stride, sizes, pf, palette, mode, mipmapped, blend_mode, filter_mode; - int coltype; + int textured = 0, sizex = 0, sizey = 0, stride = 0, sizes = 0, pf = 0, palette = 0, mode = 0, mipmapped = 0, blend_mode = 0, filter_mode = 0; + int coltype = 0; - uint32_t (powervr2_device::*r)(struct texinfo *t, float x, float y); - uint32_t (*blend)(uint32_t s, uint32_t d); - int (*u_func)(float uv, int size); - int (*v_func)(float uv, int size); - int palbase, cd; + uint32_t (powervr2_device::*r)(texinfo *t, float x, float y) = nullptr; + uint32_t (*blend)(uint32_t s, uint32_t d) = nullptr; + int (*u_func)(float uv, int size) = nullptr; + int (*v_func)(float uv, int size) = nullptr; + int palbase = 0, cd = 0; }; - typedef struct + struct vert { - float x, y, w, u, v; + float x = 0, y = 0, w = 0, u = 0, v = 0; // base and offset colors - float b[4], o[4]; - } vert; + float b[4] = { 0, 0, 0, 0 }, o[4] = { 0, 0, 0, 0 }; + }; struct strip { - int svert, evert; + int svert = 0, evert = 0; texinfo ti; }; @@ -138,18 +139,18 @@ public: struct poly_group { strip strips[MAX_STRIPS]; - int strips_size; + int strips_size = 0; }; struct receiveddata { vert verts[MAX_VERTS]; struct poly_group groups[DISPLAY_LIST_COUNT]; - uint32_t ispbase; - uint32_t fbwsof1; - uint32_t fbwsof2; - int busy; - int valid; - int verts_size; + uint32_t ispbase = 0; + uint32_t fbwsof1 = 0; + uint32_t fbwsof2 = 0; + int busy = 0; + int valid = 0; + int verts_size = 0; }; enum { diff --git a/src/mame/video/pp01.cpp b/src/mame/video/pp01.cpp index 7afc209d8da..eff118c6b2d 100644 --- a/src/mame/video/pp01.cpp +++ b/src/mame/video/pp01.cpp @@ -27,7 +27,7 @@ uint32_t pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bit for (int b = 0; b < 8; b++) { uint8_t const col = (BIT(code_r, b) << 2) | (BIT(code_g, b) << 1) | (BIT(code_b, b) << 0); - bitmap.pix16(y, x*8+(7-b)) = col; + bitmap.pix(y, x*8+(7-b)) = col; } } } diff --git a/src/mame/video/psikyosh.cpp b/src/mame/video/psikyosh.cpp index beaf8088fdf..219a70b416e 100644 --- a/src/mame/video/psikyosh.cpp +++ b/src/mame/video/psikyosh.cpp @@ -342,7 +342,7 @@ void psikyosh_state::draw_bglayerscroll(u8 const layer, bitmap_rgb32 &bitmap, co g_profiler.start(PROFILER_USER2); u32 tilemap_line[32 * 16]; u32 scr_line[64 * 8]; - std::copy_n(&m_bg_bitmap.pix32(tilemap_scanline, 0), 0x200, tilemap_line); + std::copy_n(&m_bg_bitmap.pix(tilemap_scanline, 0), 0x200, tilemap_line); g_profiler.stop(); /* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */ @@ -514,8 +514,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + (y_index) * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -536,7 +536,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -560,8 +560,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -582,7 +582,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -607,8 +607,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -629,7 +629,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -664,7 +664,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl for (int ypixel = 0; ypixel < gfx->height(); ypixel++) { const u8 *source = code_base + ypixel * gfx->rowbytes(); - u8 *dest = &m_zoom_bitmap.pix8(ypixel + ytile*gfx->height()); + u8 *dest = &m_zoom_bitmap.pix(ypixel + ytile*gfx->height()); for (int xpixel = 0; xpixel < gfx->width(); xpixel++) { @@ -738,9 +738,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -756,8 +756,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -778,9 +778,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -796,8 +796,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -818,9 +818,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -836,8 +836,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -1008,7 +1008,7 @@ void psikyosh_state::prelineblend(bitmap_rgb32 &bitmap, const rectangle &cliprec g_profiler.start(PROFILER_USER8); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dstline = &bitmap.pix32(y); + u32 *dstline = &bitmap.pix(y); /* linefill[y] & 0xff does what? */ for (int x = cliprect.left(); x <= cliprect.right(); x++) @@ -1032,7 +1032,7 @@ void psikyosh_state::postlineblend(bitmap_rgb32 &bitmap, const rectangle &clipre g_profiler.start(PROFILER_USER8); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dstline = &bitmap.pix32(y); + u32 *dstline = &bitmap.pix(y); if (lineblend[y] & 0x80) /* solid */ { diff --git a/src/mame/video/qix.cpp b/src/mame/video/qix.cpp index 87ef3557296..5a10f61d378 100644 --- a/src/mame/video/qix.cpp +++ b/src/mame/video/qix.cpp @@ -281,8 +281,8 @@ MC6845_BEGIN_UPDATE( qix_state::crtc_begin_update ) MC6845_UPDATE_ROW( qix_state::crtc_update_row ) { - uint32_t *dest = &bitmap.pix32(y); - pen_t *pens = &m_pens[m_palette_bank << 8]; + uint32_t *const dest = &bitmap.pix(y); + pen_t const *const pens = &m_pens[m_palette_bank << 8]; /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 6) & 0xf800) | ((ra << 8) & 0x0700); diff --git a/src/mame/video/quasar.cpp b/src/mame/video/quasar.cpp index ad399cdd07c..742256f8cfd 100644 --- a/src/mame/video/quasar.cpp +++ b/src/mame/video/quasar.cpp @@ -108,7 +108,7 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 for (int ox = 0; ox < 8; ox++) for (int oy = 0; oy < 8; oy++) - bitmap.pix16(y + oy, x + ox) = forecolor; + bitmap.pix(y + oy, x + ox) = forecolor; // Main Screen m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, @@ -144,10 +144,10 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 int const bx = 255 - 9 - m_bullet_ram[offs] - ct; // bullet/object Collision - if (s2636_0_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x04; - if (s2636_2_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x08; + if (s2636_0_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x04; + if (s2636_2_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x08; - bitmap.pix16(offs, bx) = 7; + bitmap.pix(offs, bx) = 7; } } } @@ -158,18 +158,18 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 { for (int x = cliprect.left(); x <= cliprect.right(); x++) { - int const pixel0 = s2636_0_bitmap.pix16(y, x); - int const pixel1 = s2636_1_bitmap.pix16(y, x); - int const pixel2 = s2636_2_bitmap.pix16(y, x); + int const pixel0 = s2636_0_bitmap.pix(y, x); + int const pixel1 = s2636_1_bitmap.pix(y, x); + int const pixel2 = s2636_2_bitmap.pix(y, x); int const pixel = pixel0 | pixel1 | pixel2; if (S2636_IS_PIXEL_DRAWN(pixel)) { - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel); /* S2636 vs. background collision detection */ - if (m_palette->pen_indirect(m_collision_background.pix16(y, x))) + if (m_palette->pen_indirect(m_collision_background.pix(y, x))) { if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01; if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; diff --git a/src/mame/video/raiden2.cpp b/src/mame/video/raiden2.cpp index ad98fbe44fd..ff06d5906be 100644 --- a/src/mame/video/raiden2.cpp +++ b/src/mame/video/raiden2.cpp @@ -322,12 +322,12 @@ void raiden2_state::blend_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (layer == -1) return; - const pen_t *pens = &m_palette->pen(0); + pen_t const *const pens = &m_palette->pen(0); layer <<= 14; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *src = &source.pix16(y, cliprect.min_x); - u32 *dst = &bitmap.pix32(y, cliprect.min_x); + const u16 *src = &source.pix(y, cliprect.min_x); + u32 *dst = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { u16 val = *src++; diff --git a/src/mame/video/rallyx.cpp b/src/mame/video/rallyx.cpp index 081f07da6f1..740b587b6b8 100644 --- a/src/mame/video/rallyx.cpp +++ b/src/mame/video/rallyx.cpp @@ -411,8 +411,8 @@ void rallyx_state::plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, i if (flip_screen_y()) y = 255 - y; - if (m_palette->pen_indirect(bitmap.pix16(y, x) % 0x144) == 0) - bitmap.pix16(y, x) = STARS_COLOR_BASE + color; + if (m_palette->pen_indirect(bitmap.pix(y, x) % 0x144) == 0) + bitmap.pix(y, x) = STARS_COLOR_BASE + color; } void rallyx_state::draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect ) diff --git a/src/mame/video/rampart.cpp b/src/mame/video/rampart.cpp index 0d1175045da..1277d658e76 100644 --- a/src/mame/video/rampart.cpp +++ b/src/mame/video/rampart.cpp @@ -76,8 +76,8 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1 for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -101,13 +101,13 @@ void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle /* update any dirty scanlines */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const uint16_t *src = &m_bitmap[256 * y]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &m_bitmap[256 * y]; + uint16_t *const dst = &bitmap.pix(y); /* regenerate the line */ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { - int bits = src[(x - 8) / 2]; + int const bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; dst[x + 1] = bits & 0xff; } diff --git a/src/mame/video/redalert.cpp b/src/mame/video/redalert.cpp index 3e216dec401..a29f0f612bd 100644 --- a/src/mame/video/redalert.cpp +++ b/src/mame/video/redalert.cpp @@ -260,16 +260,11 @@ VIDEO_START_MEMBER(redalert_state,ww3) uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_redalert_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -280,6 +275,7 @@ uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rg offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -291,30 +287,29 @@ uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rg charmap_data_2 = m_charmap_videoram[0x0800 | charmap_data_base]; } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if ((*m_video_control ^ m_control_xor) & 0x04) - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; else - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } @@ -351,16 +346,11 @@ void redalert_state::demoneye_bitmap_layer_w(offs_t offset, uint8_t data) uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_demoneye_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -371,6 +361,7 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -386,30 +377,29 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg //charmap_data_1 = m_charmap_videoram[0x1400 | charmap_data_base]; //charmap_data_2 = m_charmap_videoram[0x1800 | charmap_data_base]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if (*m_video_control & 0x04) - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } @@ -450,7 +440,7 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg int y_dst = 8*width - (y_block*8+iy); int x_dst = 8*width - (x_block*8+7-ix); ccc=pens[NUM_CHARMAP_PENS+ccc]; - bitmap.pix32(y+y_dst, x+x_dst) = ccc; + bitmap.pix(y+y_dst, x+x_dst) = ccc; } l0<<=1; @@ -478,16 +468,11 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_panther_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -498,6 +483,7 @@ uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -509,30 +495,29 @@ uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb charmap_data_2 = m_charmap_videoram[0x0800 | charmap_data_base]; } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if ((*m_video_control ^ m_control_xor) & 0x04) - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; else - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } diff --git a/src/mame/video/redclash.cpp b/src/mame/video/redclash.cpp index 631baba737d..c23f67bda3f 100644 --- a/src/mame/video/redclash.cpp +++ b/src/mame/video/redclash.cpp @@ -232,7 +232,7 @@ void redclash_state::draw_bullets( bitmap_ind16 &bitmap, const rectangle &clipre } if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0x19; + bitmap.pix(sy, sx) = 0x19; } } diff --git a/src/mame/video/relief.cpp b/src/mame/video/relief.cpp index 38e25ce71d4..b8a4d405eb2 100644 --- a/src/mame/video/relief.cpp +++ b/src/mame/video/relief.cpp @@ -108,9 +108,9 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -136,13 +136,13 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 * * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected */ - int cs0 = 0; - int cs1 = 1; /* compute the CS0 signal */ + int cs0 = 0; cs0 = ((mo[x] & 0x0f) == 0); /* compute the CS1 signal */ + int cs1 = 1; if ((!cs0 && (mo[x] & 0xe0) == 0xe0) || ((mo[x] & 0xf0) == 0xe0) || (!pri[x] && !cs0) || diff --git a/src/mame/video/rltennis.cpp b/src/mame/video/rltennis.cpp index 84debeca2f1..6a393babd55 100644 --- a/src/mame/video/rltennis.cpp +++ b/src/mame/video/rltennis.cpp @@ -154,10 +154,6 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) int x_src_step=(m_blitter[BLT_FLAGS] & BLTFLAG_SRC_X_DIR)?1:-1; int y_src_step=(m_blitter[BLT_FLAGS] & BLTFLAG_SRC_Y_DIR)?1:-1; - int x,y; - - int idx_x,idx_y; - int blit_w=src_x1-src_x0; int blit_h=src_y1-src_y0; @@ -193,9 +189,9 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) force_blit=true; } - for( x=dst_x0, idx_x=0 ; idx_x<=blit_w1; x+=x_dst_step, idx_x++ ) + for( int x=dst_x0, idx_x=0 ; idx_x<=blit_w1; x+=x_dst_step, idx_x++ ) { - for( y=dst_y0, idx_y=0 ; idx_y<=blit_h1;y+=y_dst_step, idx_y++) + for( int y=dst_y0, idx_y=0 ; idx_y<=blit_h1;y+=y_dst_step, idx_y++) { int xx=src_x0+(x_src_step*idx_x); int yy=src_y0+(y_src_step*idx_y); @@ -213,7 +209,7 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) if((pix || force_blit)&& screen_x >0 && y >0 && screen_x < 512 && y < 256 ) { - m_tmp_bitmap[layer]->pix16(y , screen_x ) = pix; + m_tmp_bitmap[layer]->pix(y , screen_x ) = pix; } } } diff --git a/src/mame/video/rm380z.cpp b/src/mame/video/rm380z.cpp index 0c03a6805a0..f7ead5a4c27 100644 --- a/src/mame/video/rm380z.cpp +++ b/src/mame/video/rm380z.cpp @@ -271,16 +271,14 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit } } - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); - *dest=chval; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c) = chval; } } // last pixel of underline if (attrUnder&&(!attrRev)) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); - *dest=attrRev?0:1; + bitmap.pix((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX) = attrRev?0:1; } // if reversed, print another column of pixels on the right @@ -288,8 +286,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int r=0;r<RM380Z_CHDIMY;r++) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); - *dest=1; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX) = 1; } } } @@ -319,20 +316,16 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit } } - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); - *dest=chval; - *dest2=chval; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c) = chval; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1) = chval; } } // last 2 pixels of underline if (attrUnder) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1); - *dest=attrRev?0:1; - *dest2=attrRev?0:1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)) = attrRev?0:1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1) = attrRev?0:1; } // if reversed, print another 2 columns of pixels on the right @@ -340,10 +333,8 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int r=0;r<RM380Z_CHDIMY;r++) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1); - *dest=1; - *dest2=1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)) = 1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1) = 1; } } } @@ -357,8 +348,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int c=0;c<RM380Z_CHDIMX;c++) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); - *dest=m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c) = m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; } } } @@ -368,10 +358,8 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int c=0;c<(RM380Z_CHDIMX*2);c+=2) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); - *dest=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; - *dest2=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c) = m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1) = m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; } } } @@ -409,22 +397,21 @@ void rm380z_state::update_screen(bitmap_ind16 &bitmap) // This needs the attributes etc from above to be added uint32_t rm380z_state::screen_update_rm480z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *chargen = memregion("chargen")->base(); - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint8_t const *const chargen = memregion("chargen")->base(); + uint16_t sy=0,ma=0; - for (y = 0; y < RM380Z_SCREENROWS; y++) + for (uint8_t y = 0; y < RM380Z_SCREENROWS; y++) { - for (ra = 0; ra < 11; ra++) + for (uint8_t ra = 0; ra < 11; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 10) { - chr = m_vramchars[x]; + uint8_t chr = m_vramchars[x]; gfx = chargen[(chr<<4) | ra ]; } /* Display a scanline of a character */ diff --git a/src/mame/video/rmnimbus.cpp b/src/mame/video/rmnimbus.cpp index b4faeedf0a1..c7b4d385d02 100644 --- a/src/mame/video/rmnimbus.cpp +++ b/src/mame/video/rmnimbus.cpp @@ -105,9 +105,9 @@ uint8_t rmnimbus_state::get_pixel(uint16_t x, uint16_t y) if((x<640) && (y<250)) { if(IS_80COL) - result=m_video_mem.pix16(y, x) >> 2; + result=m_video_mem.pix(y, x) >> 2; else - result=m_video_mem.pix16(y, x*2); + result=m_video_mem.pix(y, x*2); } return result; @@ -295,9 +295,9 @@ void rmnimbus_state::set_pixel(uint16_t x, uint16_t y, uint8_t colour) if((x<640) && (y<250)) { if(IS_XOR) - m_video_mem.pix16(y, x)^=colour; + m_video_mem.pix(y, x)^=colour; else - m_video_mem.pix16(y, x)=colour; + m_video_mem.pix(y, x)=colour; } } @@ -344,7 +344,7 @@ void rmnimbus_state::move_pixel_line(uint16_t x, uint16_t y, uint8_t pixels) { if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) logerror("x=%d\n",x + i); - m_video_mem.pix16(m_yline, x + i) = m_video_mem.pix16(y, x + i); + m_video_mem.pix(m_yline, x + i) = m_video_mem.pix(y, x + i); } } diff --git a/src/mame/video/rockrage.cpp b/src/mame/video/rockrage.cpp index baf4d3f7551..02fe31a1a7b 100644 --- a/src/mame/video/rockrage.cpp +++ b/src/mame/video/rockrage.cpp @@ -70,7 +70,7 @@ uint32_t rockrage_state::screen_update_rockrage(screen_device &screen, bitmap_in { m_k007342->tilemap_update(); - bitmap.fill(rgb_t::black(), cliprect); + bitmap.fill(0, cliprect); m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); // Tutankhamen eyes go below sprites m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); diff --git a/src/mame/video/rohga.cpp b/src/mame/video/rohga.cpp index 51921233c0e..9c6c6c2b343 100644 --- a/src/mame/video/rohga.cpp +++ b/src/mame/video/rohga.cpp @@ -89,8 +89,8 @@ void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &clipre for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* srcline = &sprite_bitmap->pix16(y,0); - u32* dstline = &bitmap.pix32(y,0); + u16 const *const srcline = &sprite_bitmap->pix(y,0); + u32 *const dstline = &bitmap.pix(y,0); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -168,11 +168,11 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap, for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16 *srcline1 = &sprite_bitmap1->pix16(y,0); - const u16 *srcline2 = &sprite_bitmap2->pix16(y,0); - const u8 *srcpriline = &priority_bitmap->pix8(y,0); + u16 const *const srcline1 = &sprite_bitmap1->pix(y,0); + u16 const *const srcline2 = &sprite_bitmap2->pix(y,0); + u8 const *const srcpriline = &priority_bitmap->pix(y,0); - u32* dstline = &bitmap.pix32(y,0); + u32 *const dstline = &bitmap.pix(y,0); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/route16.cpp b/src/mame/video/route16.cpp index 9d2dc225ac8..97b71c584cd 100644 --- a/src/mame/video/route16.cpp +++ b/src/mame/video/route16.cpp @@ -87,13 +87,13 @@ uint32_t route16_state::screen_update_route16(screen_device &screen, bitmap_rgb3 uint8_t final_color = (color1 | color2) & 0x07; if (m_flipscreen) - bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color); + bitmap.pix(255 - y, 255 - x) = m_palette->pen_color(final_color); else - bitmap.pix32(y, x) = m_palette->pen_color(final_color); + bitmap.pix(y, x) = m_palette->pen_color(final_color); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } @@ -134,13 +134,13 @@ uint32_t route16_state::screen_update_jongpute(screen_device &screen, bitmap_rgb uint8_t final_color = (color1 | color2) & 0x07; if (m_flipscreen) - bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color); + bitmap.pix(255 - y, 255 - x) = m_palette->pen_color(final_color); else - bitmap.pix32(y, x) = m_palette->pen_color(final_color); + bitmap.pix(y, x) = m_palette->pen_color(final_color); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } diff --git a/src/mame/video/rpunch.cpp b/src/mame/video/rpunch.cpp index 90870ee22e1..02e7dcfbd28 100644 --- a/src/mame/video/rpunch.cpp +++ b/src/mame/video/rpunch.cpp @@ -102,7 +102,7 @@ u8 rpunch_state::pixmap_r(offs_t offset) const int sy = offset >> 8; const int sx = (offset & 0xff) << 1; - return ((m_pixmap->pix16(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix16(sy & 0xff, sx | 1) & 0xf); + return ((m_pixmap->pix(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix(sy & 0xff, sx | 1) & 0xf); } void rpunch_state::pixmap_w(offs_t offset, u8 data) @@ -110,8 +110,8 @@ void rpunch_state::pixmap_w(offs_t offset, u8 data) const int sy = offset >> 8; const int sx = (offset & 0xff) << 1; - m_pixmap->pix16(sy & 0xff, sx & ~1) = ((data & 0xf0) >> 4); - m_pixmap->pix16(sy & 0xff, sx | 1) = (data & 0x0f); + m_pixmap->pix(sy & 0xff, sx & ~1) = ((data & 0xf0) >> 4); + m_pixmap->pix(sy & 0xff, sx | 1) = (data & 0x0f); } void rpunch_state::videoram_w(offs_t offset, u16 data, u16 mem_mask) @@ -252,8 +252,8 @@ void rpunch_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *src = &m_pixmap->pix16(y & 0xff); - u16 *dst = &bitmap.pix16(y); + u16 const *const src = &m_pixmap->pix(y & 0xff); + u16 *const dst = &bitmap.pix(y); for(int x = cliprect.min_x / 4; x <= cliprect.max_x; x++) { const u16 pix = src[(x + 4) & 0x1ff]; diff --git a/src/mame/video/segag80r.cpp b/src/mame/video/segag80r.cpp index b3bc8eae218..2fbed33e1ca 100644 --- a/src/mame/video/segag80r.cpp +++ b/src/mame/video/segag80r.cpp @@ -670,7 +670,6 @@ void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectang int xoffset = (m_spaceod_bg_control & 0x02) ? 0x10 : 0x00; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* The H and V counters on this board are independent of the ones on */ /* the main board. The H counter starts counting from 0 when EXT BLK */ @@ -679,14 +678,14 @@ void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectang /* 240, giving us an offset of (262-240) = 22 scanlines. */ /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = (y + m_spaceod_vcounter + 22) ^ flipmask; - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = ((x + m_spaceod_hcounter) ^ flipmask) + xoffset; uint8_t fgpix = m_paletteram[dst[x]]; @@ -726,7 +725,6 @@ void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rec int flipmask = (m_video_control & 0x08) ? 0xff : 0x00; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* if disabled, draw nothing */ if (!m_bg_enable) @@ -736,14 +734,14 @@ void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rec } /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = m_bg_scrolly + (((y ^ flipmask) + (flipmask & 0xe0)) & 0xff); - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = m_bg_scrollx + (x ^ flipmask); dst[x] = src[effx & xmask]; @@ -766,7 +764,6 @@ void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rec int flipmask = (m_video_control & 0x08) ? 0x3ff : 0x000; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* if disabled, draw nothing */ if (!m_bg_enable) @@ -776,14 +773,14 @@ void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rec } /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = (y + m_bg_scrolly) ^ flipmask; - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = (x + m_bg_scrollx) ^ flipmask; dst[x] = src[effx & xmask]; diff --git a/src/mame/video/segaic16.cpp b/src/mame/video/segaic16.cpp index 8577151a4b5..2c060d0c947 100644 --- a/src/mame/video/segaic16.cpp +++ b/src/mame/video/segaic16.cpp @@ -1539,23 +1539,22 @@ void segaic16_video_device::rotate_draw(int which, bitmap_ind16 &bitmap, const r int32_t dxx = (info->buffer[0x3f6] << 16) | info->buffer[0x3f7]; int32_t dxy = (info->buffer[0x3f8] << 16) | info->buffer[0x3f9]; int32_t dyx = (info->buffer[0x3fa] << 16) | info->buffer[0x3fb]; - int x, y; /* advance forward based on the clip rect */ currx += dxx * (cliprect.min_x + 27) + dxy * cliprect.min_y; curry += dyx * (cliprect.min_x + 27) + dyy * cliprect.min_y; /* loop over screen Y coordinates */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &srcbitmap.pix16(0); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t *dest = &bitmap.pix(y); + uint16_t const *const src = &srcbitmap.pix(0); + uint8_t *pri = &priority_bitmap.pix(y); int32_t tx = currx; int32_t ty = curry; /* loop over screen X coordinates */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* fetch the pixel from the source bitmap */ int sx = (tx >> 14) & 0x1ff; diff --git a/src/mame/video/segaic16_road.cpp b/src/mame/video/segaic16_road.cpp index 290d1b15c5f..35d31cb4057 100644 --- a/src/mame/video/segaic16_road.cpp +++ b/src/mame/video/segaic16_road.cpp @@ -91,7 +91,7 @@ static void segaic16_road_hangon_draw(segaic16_road_device::road_info *info, bit /* loop over scanlines */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); const u16 control = roadram[0x000 + y]; int hpos = roadram[0x100 + (control & 0xff)]; const u16 color0 = roadram[0x200 + (control & 0xff)]; @@ -364,7 +364,7 @@ static void segaic16_road_outrun_draw(segaic16_road_device::road_info *info, bit // { 0x80,0x81,0x81,0x83,0,0,0,0x00 }, // { 0x81,0x87,0x87,0x8f,0,0,0,0x00 } }; - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); const u16 data0 = roadram[0x000 + y]; const u16 data1 = roadram[0x100 + y]; diff --git a/src/mame/video/segaic24.cpp b/src/mame/video/segaic24.cpp index 805f6bb4cb1..3b07c9e8fa3 100644 --- a/src/mame/video/segaic24.cpp +++ b/src/mame/video/segaic24.cpp @@ -103,16 +103,13 @@ void segas24_tile_device::device_start() void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind8 &tm, bitmap_ind16 &dm, const uint16_t *mask, uint16_t tpri, uint8_t lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) { - int y; - const uint16_t *source = &bm.pix16(sy, sx); - const uint8_t *trans = &tm.pix8(sy, sx); - uint8_t *prib = &screen.priority().pix8(0); - uint16_t *dest = &dm.pix16(0); + const uint16_t *source = &bm.pix(sy, sx); + const uint8_t *trans = &tm.pix(sy, sx); + uint8_t *prib = &screen.priority().pix(yy1, xx1); + uint16_t *dest = &dm.pix(yy1, xx1); tpri |= TILEMAP_PIXEL_LAYER0; - dest += yy1*dm.rowpixels() + xx1; - prib += yy1*screen.priority().rowpixels() + xx1; mask += yy1*4; yy2 -= yy1; @@ -122,7 +119,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit mask++; } - for(y=0; y<yy2; y++) { + for(int y=0; y<yy2; y++) { const uint16_t *src = source; const uint8_t *srct = trans; uint16_t *dst = dest; @@ -142,8 +139,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x=0; x<128; x++) { + for(int x=0; x<128; x++) { if(*srct++ == tpri) { *dst = *src; *pr |= lpri; @@ -162,8 +158,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=0; x<128; x+=8) { + for(int x=0; x<128; x+=8) { if(!(m & 0x8000)) { int xx; for(xx=0; xx<8; xx++) @@ -185,8 +180,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x = cur_x; x<llx1; x++) { + for(int x = cur_x; x<llx1; x++) { if(*srct++ == tpri) { *dst = *src; *pr |= lpri; @@ -205,8 +199,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=cur_x; x<llx1; x++) { + for(int x=cur_x; x<llx1; x++) { if(*srct++ == tpri && !(m & (0x8000 >> (x >> 3)))) { *dst = *src; *pr |= lpri; @@ -237,15 +230,13 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind8 &tm, bitmap_rgb32 &dm, const uint16_t *mask, uint16_t tpri, uint8_t lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) { - int y; - const uint16_t *source = &bm.pix16(sy, sx); - const uint8_t *trans = &tm.pix8(sy, sx); - uint32_t *dest = &dm.pix32(0); - const pen_t *pens = palette().pens(); + const uint16_t *source = &bm.pix(sy, sx); + const uint8_t *trans = &tm.pix(sy, sx); + uint32_t *dest = &dm.pix(yy1, xx1); + const pen_t *const pens = palette().pens(); tpri |= TILEMAP_PIXEL_LAYER0; - dest += yy1*dm.rowpixels() + xx1; mask += yy1*4; yy2 -= yy1; @@ -255,7 +246,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit mask++; } - for(y=0; y<yy2; y++) { + for(int y=0; y<yy2; y++) { const uint16_t *src = source; const uint8_t *srct = trans; uint32_t *dst = dest; @@ -274,8 +265,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x=0; x<128; x++) { + for(int x=0; x<128; x++) { if(*srct++ == tpri) *dst = pens[*src]; src++; @@ -290,11 +280,9 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=0; x<128; x+=8) { + for(int x=0; x<128; x+=8) { if(!(m & 0x8000)) { - int xx; - for(xx=0; xx<8; xx++) + for(int xx=0; xx<8; xx++) if(srct[xx] == tpri) dst[xx] = pens[src[xx]]; } @@ -310,8 +298,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x = cur_x; x<llx1; x++) { + for(int x = cur_x; x<llx1; x++) { if(*srct++ == tpri) *dst = pens[*src]; src++; @@ -603,16 +590,14 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect { uint16_t curspr = 0; int countspr = 0; - int seen; uint8_t pmt[4]; - int i; uint16_t *sprd[0x2000], *clip[0x2000]; uint16_t *cclip = nullptr; - for(i=0; i<4; i++) + for(int i=0; i<4; i++) pmt[i] = 0xff << (1+spri[3-i]); - for(seen = 0; seen < 0x2000; seen++) { + for(int seen = 0; seen < 0x2000; seen++) { uint16_t *source; uint16_t type; @@ -647,7 +632,6 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect for(countspr--; countspr >= 0; countspr--) { uint16_t *source, *pix; int x, y, sx, sy; - int px, py; uint16_t colors[16]; int flipx, flipy; int zoomx, zoomy; @@ -719,7 +703,7 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect sy = 1 << ((source[4] & 0x7000) >> 12); pix = &sprite_ram[(source[3] & 0x3fff)* 0x8]; - for(px=0; px<8; px++) { + for(int px=0; px<8; px++) { int c; c = pix[px] >> 8; pm[px*2] = pmt[c>>6]; @@ -738,38 +722,36 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect xmod = 0x20; ymod = 0x20; - for(py=0; py<sy; py++) { + for(int py=0; py<sy; py++) { int xmod1 = xmod; int xpos1 = x; int ypos1 = y, ymod1 = ymod; - for(px=0; px<sx; px++) { + for(int px=0; px<sx; px++) { int xmod2 = xmod1, xpos2 = xpos1; - int zy; addoffset = 0x10*(flipx ? sx-px-1 : px) + 0x10*sx*(flipy ? sy-py-1 : py) + (flipy ? 7*2 : 0); newoffset = offset + addoffset; ymod1 = ymod; ypos1 = y; - for(zy=0; zy<8; zy++) { + for(int zy=0; zy<8; zy++) { ymod1 += zoomy; while(ymod1 >= 0x40) { if((ypos1 >= min_y && ypos1 <= max_y) ^ clip_reverse_y) { - int zx; xmod2 = xmod1; xpos2 = xpos1; - for(zx=0; zx<8; zx++) { + for(int zx=0; zx<8; zx++) { xmod2 += zoomx; while(xmod2 >= 0x40) { if(xpos2 >= min_x && xpos2 <= max_x) { int zx1 = flipx ? 7-zx : zx; uint32_t neweroffset = (newoffset+(zx1>>2))&0x1ffff; // crackdown sometimes attempts to use data past the end of spriteram int c = (sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf; - uint8_t *pri = &priority_bitmap.pix8(ypos1, xpos2); + uint8_t *pri = &priority_bitmap.pix(ypos1, xpos2); if(!(*pri & pm[c])) { c = colors[c]; if(c) { - uint16_t *dst = &bitmap.pix16(ypos1, xpos2); + uint16_t *dst = &bitmap.pix(ypos1, xpos2); if(c==1) *dst = (*dst) | 0x2000; else diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp index 58ae7d70632..177a383f851 100644 --- a/src/mame/video/segas32.cpp +++ b/src/mame/video/segas32.cpp @@ -668,21 +668,14 @@ inline void segas32_state::get_tilemaps(int bgnum, tilemap_t **tilemaps) void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect, int bgnum) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - tilemap_t *tilemaps[4]; - uint32_t srcx, srcx_start, srcy; - uint32_t srcxstep, srcystep; - int dstxstep, dstystep; - int opaque; - int x, y; /* get the tilemaps */ + tilemap_t *tilemaps[4]; get_tilemaps(bgnum, tilemaps); /* configure the layer */ - opaque = 0; + int opaque = 0; //opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_Z) && bgnum == 0) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1; @@ -692,13 +685,15 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la compute_tilemap_flips(bgnum, flipx, flipy); /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + int clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* extract the X/Y step values (these are in destination space!) */ - dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + int dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + int dstystep; if (m_videoram[0x1ff00/2] & 0x4000) dstystep = m_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; else @@ -711,13 +706,13 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la dstystep = 0x80; /* compute high-precision reciprocals (in 12.20 format) */ - srcxstep = (0x200 << 20) / dstxstep; - srcystep = (0x200 << 20) / dstystep; + uint32_t srcxstep = (0x200 << 20) / dstxstep; + uint32_t srcystep = (0x200 << 20) / dstystep; /* start with the fractional scroll offsets, in source coordinates */ - srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; + uint32_t srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; srcx_start += (m_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; - srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; + uint32_t srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; srcy += (m_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; /* then account for the destination center coordinates */ @@ -746,32 +741,30 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la } /* loop over the target rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ if (clipdraw || extents[1] <= cliprect.max_x) { int transparent = 0; - uint16_t *src[2]; /* look up the pages and get their source pixmaps */ - bitmap_ind16 &tm0 = tilemaps[((srcy >> 27) & 2) + 0]->pixmap(); - bitmap_ind16 &tm1 = tilemaps[((srcy >> 27) & 2) + 1]->pixmap(); - src[0] = &tm0.pix16((srcy >> 20) & 0xff); - src[1] = &tm1.pix16((srcy >> 20) & 0xff); + bitmap_ind16 const &tm0 = tilemaps[((srcy >> 27) & 2) + 0]->pixmap(); + bitmap_ind16 const &tm1 = tilemaps[((srcy >> 27) & 2) + 1]->pixmap(); + uint16_t const *const src[2] = { &tm0.pix((srcy >> 20) & 0xff), &tm1.pix((srcy >> 20) & 0xff) }; /* loop over extents */ - srcx = srcx_start; + uint32_t srcx = srcx_start; while (1) { /* if we're drawing on this extent, draw it */ if (clipdraw) { - for (x = extents[0]; x < extents[1]; x++) + for (int x = extents[0]; x < extents[1]; x++) { uint16_t pix = src[(srcx >> 29) & 1][(srcx >> 20) & 0x1ff]; srcx += srcxstep; @@ -785,7 +778,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); srcx += srcxstep * pixels; transparent += pixels; } @@ -827,22 +820,14 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect, int bgnum) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - tilemap_t *tilemaps[4]; - int rowscroll, rowselect; - int xscroll, yscroll; - uint16_t *table; - int srcx, srcy; - int opaque; - int x, y; /* get the tilemaps */ + tilemap_t *tilemaps[4]; get_tilemaps(bgnum, tilemaps); /* configure the layer */ - opaque = 0; + int opaque = 0; //opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_C) && bgnum == 2) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_V) && bgnum == 3) opaque = 1; @@ -854,39 +839,40 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + int clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine if row scroll and/or row select is enabled */ - rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; - rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; + int rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; + int rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; if ((m_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) rowscroll = rowselect = 0; /* get a pointer to the table */ - table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; + uint16_t const *const table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; /* start with screen-wide X and Y scrolls */ - xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); - yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); + int xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); + int yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); /* render the tilemap into its bitmap */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ if (clipdraw || extents[1] <= cliprect.max_x) { int transparent = 0; - uint16_t *src[2]; int srcxstep; /* if we're not flipped, things are straightforward */ + int srcx; if (!flipx) { srcx = cliprect.min_x + xscroll; @@ -898,6 +884,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat srcxstep = -1; } + int srcy; if (!flipy) { srcy = yscroll + y; @@ -916,10 +903,9 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* look up the pages and get their source pixmaps */ - bitmap_ind16 &tm0 = tilemaps[((srcy >> 7) & 2) + 0]->pixmap(); - bitmap_ind16 &tm1 = tilemaps[((srcy >> 7) & 2) + 1]->pixmap(); - src[0] = &tm0.pix16(srcy & 0xff); - src[1] = &tm1.pix16(srcy & 0xff); + bitmap_ind16 const &tm0 = tilemaps[((srcy >> 7) & 2) + 0]->pixmap(); + bitmap_ind16 const &tm1 = tilemaps[((srcy >> 7) & 2) + 1]->pixmap(); + uint16_t const *const src[2] = { &tm0.pix(srcy & 0xff), &tm1.pix(srcy & 0xff) }; /* loop over extents */ while (1) @@ -927,7 +913,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* if we're drawing on this extent, draw it */ if (clipdraw) { - for (x = extents[0]; x < extents[1]; x++, srcx += srcxstep) + for (int x = extents[0]; x < extents[1]; x++, srcx += srcxstep) { uint16_t pix = src[(srcx >> 9) & 1][srcx & 0x1ff]; if ((pix & 0x0f) == 0 && !opaque) @@ -940,7 +926,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); srcx += srcxstep * pixels; transparent += pixels; } @@ -979,41 +965,35 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect) { bitmap_ind16 &bitmap = layer.bitmap; - uint16_t *tilebase; - uint16_t *gfxbase; - int startx, starty; - int endx, endy; - int x, y, iy; - int flip; /* determine if we're flipped */ - flip = (m_videoram[0x1ff00/2] >> 9) & 1; + int flip = (m_videoram[0x1ff00/2] >> 9) & 1; /* determine the base of the tilemap and graphics data */ - tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; - gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; + uint16_t const *const tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; + uint16_t const *const gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; /* compute start/end tile numbers */ - startx = cliprect.min_x / 8; - starty = cliprect.min_y / 8; - endx = cliprect.max_x / 8; - endy = cliprect.max_y / 8; + int startx = cliprect.min_x / 8; + int starty = cliprect.min_y / 8; + int endx = cliprect.max_x / 8; + int endy = cliprect.max_y / 8; /* loop over tiles */ - for (y = starty; y <= endy; y++) - for (x = startx; x <= endx; x++) + for (int y = starty; y <= endy; y++) + for (int x = startx; x <= endx; x++) { int tile = tilebase[y * 64 + x]; - uint16_t *src = &gfxbase[(tile & 0x1ff) * 16]; + uint16_t const *src = &gfxbase[(tile & 0x1ff) * 16]; int color = (tile & 0xfe00) >> 5; /* non-flipped case */ if (!flip) { - uint16_t *dst = &bitmap.pix16(y * 8, x * 8); + uint16_t *dst = &bitmap.pix(y * 8, x * 8); /* loop over rows */ - for (iy = 0; iy < 8; iy++) + for (int iy = 0; iy < 8; iy++) { int pixels = *src++; int pix; @@ -1071,10 +1051,10 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la int effdstx = visarea.max_x - x * 8; int effdsty = visarea.max_y - y * 8; - uint16_t *dst = &bitmap.pix16(effdsty, effdstx); + uint16_t *dst = &bitmap.pix(effdsty, effdstx); /* loop over rows */ - for (iy = 0; iy < 8; iy++) + for (int iy = 0; iy < 8; iy++) { int pixels = *src++; int pix; @@ -1137,33 +1117,28 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - int xscroll, yscroll; - int color; - int x, y; - int bpp; /* configure the layer */ - bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; + int bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; - clipout = (m_videoram[0x1ff02/2] >> 10) & 1; - clips = 0x10; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; + int clipout = (m_videoram[0x1ff02/2] >> 10) & 1; + int clips = 0x10; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine x/y scroll */ - xscroll = m_videoram[0x1ff88/2] & 0x1ff; - yscroll = m_videoram[0x1ff8a/2] & 0x1ff; - color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); + int xscroll = m_videoram[0x1ff88/2] & 0x1ff; + int yscroll = m_videoram[0x1ff8a/2] & 0x1ff; + int color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); /* loop over target rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ @@ -1180,8 +1155,8 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in /* 8bpp mode case */ if (bpp == 8) { - uint8_t *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; - for (x = extents[0]; x < extents[1]; x++) + uint8_t const *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; + for (int x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; int pix = src[BYTE_XOR_LE(effx)] + color; @@ -1194,8 +1169,8 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in /* 4bpp mode case */ else { - uint16_t *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; - for (x = extents[0]; x < extents[1]; x++) + uint16_t const *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; + for (int x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; int pix = ((src[effx / 4] >> (4 * (effx & 3))) & 0x0f) + color; @@ -1210,7 +1185,7 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); transparent += pixels; } @@ -1241,11 +1216,10 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in void segas32_state::update_background(segas32_state::layer_info &layer, const rectangle &cliprect) { bitmap_ind16 &bitmap = layer.bitmap; - int x, y; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); int color; /* determine the color */ @@ -1260,7 +1234,7 @@ void segas32_state::update_background(segas32_state::layer_info &layer, const re /* if the color doesn't match, fill */ if (dst[cliprect.min_x] != color) - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = color; } } @@ -1429,7 +1403,7 @@ void segas32_state::sprite_swap_buffers() } \ } -int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) +int segas32_state::draw_one_sprite(uint16_t const *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) { static const int transparency_masks[4][4] = { @@ -1467,9 +1441,9 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r int color = 0x8000 | (data[7] & (bpp8 ? 0x7f00 : 0x7ff0)); int hzoom, vzoom; int xdelta = 1, ydelta = 1; - int x, y, xtarget, ytarget, yacc = 0, pix, transmask; + int xtarget, ytarget, yacc = 0, pix, transmask; const uint32_t *spritedata; - uint32_t addrmask, curaddr; + uint32_t addrmask; uint16_t indtable[16]; /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */ @@ -1484,8 +1458,8 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r /* create the local palette for the indirect case */ if (indirect) { - uint16_t *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; - for (x = 0; x < 16; x++) + uint16_t const *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; + for (int x = 0; x < 16; x++) indtable[x] = (src[x] & (bpp8 ? 0xfff0 : 0xffff)) | ((m_sprite_control_latched[0x0a/2] & 1) ? 0x8000 : 0x0000); } @@ -1560,21 +1534,21 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r } /* loop from top to bottom */ - for (y = ypos; y != ytarget; y += ydelta) + for (int y = ypos; y != ytarget; y += ydelta) { /* skip drawing if not within the inclusive cliprect */ if (y >= clipin.min_y && y <= clipin.max_y) { int do_clipout = (y >= clipout.min_y && y <= clipout.max_y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); int xacc = 0; /* 4bpp case */ if (!bpp8) { /* start at the word before because we preincrement below */ - curaddr = addr - 1; - for (x = xpos; x != xtarget; ) + uint32_t curaddr = addr - 1; + for (int x = xpos; x != xtarget; ) { uint32_t pixels = spritedata[++curaddr & addrmask]; @@ -1598,8 +1572,8 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r else { /* start at the word before because we preincrement below */ - curaddr = addr - 1; - for (x = xpos; x != xtarget; ) + uint32_t curaddr = addr - 1; + for (int x = xpos; x != xtarget; ) { uint32_t pixels = spritedata[++curaddr & addrmask]; @@ -1635,7 +1609,6 @@ void segas32_state::sprite_render_list() int xoffs = 0, yoffs = 0; int numentries = 0; int spritenum = 0; - uint16_t *sprite; g_profiler.start(PROFILER_USER2); @@ -1655,7 +1628,7 @@ void segas32_state::sprite_render_list() while (numentries++ < 0x20000/16) { /* top two bits are a command */ - sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; + uint16_t const *const sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; switch (sprite[0] >> 14) { /* command 0 = draw sprite */ @@ -1764,7 +1737,7 @@ inline uint16_t *segas32_state::get_layer_scanline(int layer, int scanline) { if (m_layer_data[layer].transparent[scanline]) return (layer == MIXER_LAYER_SPRITES) ? m_solid_ffff.get() : m_solid_0000.get(); - return &m_layer_data[layer].bitmap.pix16(scanline); + return &m_layer_data[layer].bitmap.pix(scanline); } void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t enablemask) @@ -1781,14 +1754,6 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c uint8_t mixshift; /* shift from control reg */ uint8_t coloroffs; /* color offset index */ } layerorder[16][8], layersort[8]; - uint8_t sprgroup_shift, sprgroup_mask, sprgroup_or; - int numlayers, laynum, groupnum; - int rgboffs[3][3]; - int sprpixmask, sprshadowmask; - int sprx, spry, sprx_start; - int sprdx, sprdy; - int sprshadow; - int x, y, i; /* if we are the second monitor on multi32, swap in the proper sprite bank */ if (which == 1) @@ -1799,6 +1764,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* extract the RGB offsets */ + int rgboffs[3][3]; rgboffs[0][0] = (int8_t)(m_mixer_control[which][0x40/2] << 2) >> 2; rgboffs[0][1] = (int8_t)(m_mixer_control[which][0x42/2] << 2) >> 2; rgboffs[0][2] = (int8_t)(m_mixer_control[which][0x44/2] << 2) >> 2; @@ -1810,6 +1776,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c rgboffs[2][2] = 0; /* determine the sprite grouping parameters first */ + uint8_t sprgroup_shift, sprgroup_mask, sprgroup_or; switch (m_mixer_control[which][0x4c/2] & 0x0f) { default: @@ -1833,13 +1800,13 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c case 0xe: sprgroup_shift = 11; sprgroup_mask = 0x07; sprgroup_or = 0x00; break; case 0xf: sprgroup_shift = 10; sprgroup_mask = 0x0f; sprgroup_or = 0x00; break; } - sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; - sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; - sprshadow = 0x7ffe & sprpixmask; + int sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; + int sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; + int sprshadow = 0x7ffe & sprpixmask; /* extract info about TEXT, NBG0-3, and BITMAP layers, which all follow the same pattern */ - numlayers = 0; - for (laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) + int numlayers = 0; + for (int laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) { int priority = m_mixer_control[which][0x20/2 + laynum] & 0x0f; if ((enablemask & (1 << laynum)) && priority != 0) @@ -1866,8 +1833,8 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c numlayers++; /* now bubble sort the list by effective priority */ - for (laynum = 0; laynum < numlayers; laynum++) - for (i = laynum + 1; i < numlayers; i++) + for (int laynum = 0; laynum < numlayers; laynum++) + for (int i = laynum + 1; i < numlayers; i++) if (layersort[i].effpri > layersort[laynum].effpri) { mixer_layer_info temp = layersort[i]; @@ -1876,7 +1843,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* for each possible sprite group, insert the sprites into the list at the appropriate point */ - for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) + for (int groupnum = 0; groupnum <= sprgroup_mask; groupnum++) { int effgroup = sprgroup_or | groupnum; int priority = m_mixer_control[which][0x00/2 + effgroup] & 0x0f; @@ -1885,7 +1852,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c int dstnum = 0; /* make a copy of the sorted list, finding a location for the sprite entry */ - for (laynum = 0; laynum < numlayers; laynum++) + for (int laynum = 0; laynum < numlayers; laynum++) { if (effpri > layersort[laynum].effpri && sprindex == numlayers) sprindex = dstnum++; @@ -1904,10 +1871,10 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c layerorder[groupnum][sprindex].sprblendmask = 0; layerorder[groupnum][sprindex].coloroffs = compute_color_offsets(which, (m_mixer_control[which][0x3e/2] >> 6) & 1, (m_mixer_control[which][0x4c/2] >> 15) & 1); } -/*\ +/* { static const char *const layname[] = { "TEXT", "NBG0", "NBG1", "NBG2", "NBG3", "BITM", "SPRI", "LINE" }; - for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) + for (int groupnum = 0; groupnum <= sprgroup_mask; groupnum++) { osd_printf_debug("%X: ", groupnum); for (i = 0; i <= numlayers; i++) @@ -1918,6 +1885,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c /* based on the sprite controller flip bits, the data is scanned to us in different */ /* directions; account for this */ + int sprx_start, sprdx; if (m_sprite_control_latched[0x04/2] & 1) { sprx_start = cliprect.max_x; @@ -1929,6 +1897,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c sprdx = 1; } + int spry, sprdy; if (m_sprite_control_latched[0x04/2] & 2) { spry = cliprect.max_y; @@ -1941,9 +1910,9 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++, spry += sprdy) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++, spry += sprdy) { - uint32_t *dest = &bitmap.pix32(y, xoffs); + uint32_t *const dest = &bitmap.pix(y, xoffs); uint16_t *layerbase[8]; /* get the starting address for each layer */ @@ -1957,18 +1926,15 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c layerbase[MIXER_LAYER_BACKGROUND] = get_layer_scanline(MIXER_LAYER_BACKGROUND, y); /* loop over columns */ - for (x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) + for (int x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) { - mixer_layer_info *first; - int *rgbdelta; - int firstpix; - int sprpix, sprgroup; - int r, g, b; + mixer_layer_info const *first; + int laynum, firstpix; int shadow = 0; /* first grab the current sprite pixel and determine the group */ - sprpix = layerbase[MIXER_LAYER_SPRITES][sprx]; - sprgroup = (sprpix >> sprgroup_shift) & sprgroup_mask; + int sprpix = layerbase[MIXER_LAYER_SPRITES][sprx]; + int sprgroup = (sprpix >> sprgroup_shift) & sprgroup_mask; /* now scan the layers to find the topmost non-transparent pixel */ for (first = &layerorder[sprgroup][0]; ; first++) @@ -2002,15 +1968,15 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c firstpix = m_paletteram[which][(first->palbase + ((firstpix >> first->mixshift) & 0xfff0) + (firstpix & 0x0f)) & 0x3fff]; /* compute R, G, B */ - rgbdelta = &rgboffs[first->coloroffs][0]; - r = ((firstpix >> 0) & 0x1f) + rgbdelta[0]; - g = ((firstpix >> 5) & 0x1f) + rgbdelta[1]; - b = ((firstpix >> 10) & 0x1f) + rgbdelta[2]; + int const *rgbdelta = &rgboffs[first->coloroffs][0]; + int r = ((firstpix >> 0) & 0x1f) + rgbdelta[0]; + int g = ((firstpix >> 5) & 0x1f) + rgbdelta[1]; + int b = ((firstpix >> 10) & 0x1f) + rgbdelta[2]; /* if there are potential blends, keep looking */ if (first->blendmask != 0) { - mixer_layer_info *second; + mixer_layer_info const *second; int secondpix; /* now scan the layers to find the topmost non-transparent pixel */ diff --git a/src/mame/video/seibuspi.cpp b/src/mame/video/seibuspi.cpp index 5a496feeb0f..1654ecf74c2 100644 --- a/src/mame/video/seibuspi.cpp +++ b/src/mame/video/seibuspi.cpp @@ -443,8 +443,8 @@ void seibuspi_state::drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &clipre // draw for (int y = y1; y <= y2; y++) { - u32 *dest = &bitmap.pix32(y); - u8 *pri = &primap.pix8(y); + u32 *const dest = &bitmap.pix(y); + u8 *const pri = &primap.pix(y); int src_i = (py * width) + px; py += yd; @@ -567,9 +567,9 @@ void seibuspi_state::combine_tilemap(bitmap_rgb32 &bitmap, const rectangle &clip if (rowscroll) rx += rowscroll[(y + 19) & yscroll_mask]; // adder value probably not hardcoded but came from CRTC - u32 *dest = &bitmap.pix32(y); - const u16 *src = &pen_bitmap.pix16((y + sy) & yscroll_mask); - const u8 *flags = &flags_bitmap.pix8((y + sy) & yscroll_mask); + u32 *dest = &bitmap.pix(y); + const u16 *src = &pen_bitmap.pix((y + sy) & yscroll_mask); + const u8 *flags = &flags_bitmap.pix((y + sy) & yscroll_mask); for (int x = cliprect.min_x + rx; x <= cliprect.max_x + rx; x++) { if (opaque || (flags[x & xscroll_mask] & (TILEMAP_PIXEL_LAYER0 | TILEMAP_PIXEL_LAYER1))) diff --git a/src/mame/video/senjyo.cpp b/src/mame/video/senjyo.cpp index c52e56294ea..78e587b8800 100644 --- a/src/mame/video/senjyo.cpp +++ b/src/mame/video/senjyo.cpp @@ -182,10 +182,10 @@ void senjyo_state::draw_bgbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect { if (flip) for (int y = 0;y < 256;y++) - bitmap.pix32(y, 255 - x) = m_palette->pen_color(384 + pen); + bitmap.pix(y, 255 - x) = m_palette->pen_color(384 + pen); else for (int y = 0;y < 256;y++) - bitmap.pix32(y, x) = m_palette->pen_color(384 + pen); + bitmap.pix(y, x) = m_palette->pen_color(384 + pen); count += 0x10; if (count >= strwid) @@ -215,7 +215,7 @@ void senjyo_state::draw_radar(bitmap_rgb32 &bitmap, const rectangle &cliprect) } if (cliprect.contains(sx, sy)) - bitmap.pix32(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); + bitmap.pix(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); } } diff --git a/src/mame/video/seta.cpp b/src/mame/video/seta.cpp index 154252c713d..52f09b2cd98 100644 --- a/src/mame/video/seta.cpp +++ b/src/mame/video/seta.cpp @@ -655,24 +655,24 @@ void seta_state::draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectang const bitmap_ind16 &src_bitmap = tilemap->pixmap(); const int opaque_mask = gfx_tilemap->granularity() - 1; const int pixel_effect_mask = gfx_tilemap->colorbase() + (gfx_tilemap->colors() - 1) * gfx_tilemap->granularity(); - int p; const int width_mask = src_bitmap.width() - 1; const int height_mask = src_bitmap.height() - 1; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { + int p; if (!flipscreen) { - p = src_bitmap.pix16((y + scrolly) & height_mask, (x + scrollx) & width_mask); + p = src_bitmap.pix((y + scrolly) & height_mask, (x + scrollx) & width_mask); } else { - p = src_bitmap.pix16((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask); + p = src_bitmap.pix((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask); } // draw not transparent pixels diff --git a/src/mame/video/seta2.cpp b/src/mame/video/seta2.cpp index e165212cf96..cea97916aa6 100644 --- a/src/mame/video/seta2.cpp +++ b/src/mame/video/seta2.cpp @@ -318,7 +318,7 @@ inline void seta2_state::drawgfx_line(bitmap_ind16& bitmap, const rectangle& cli if (!use_shadow) shadow = 0; - uint16_t* dest = &bitmap.pix16(screenline); + uint16_t *const dest = &bitmap.pix(screenline); int minx = cliprect.min_x << 16; int maxx = (cliprect.max_x + 1) << 16; @@ -927,7 +927,7 @@ void staraudi_state::draw_rgbram(bitmap_ind16 &bitmap) { int offs = x * 2/2 + y * 0x400/2; uint32_t data = ((m_rgbram[offs + 0x40000/2] & 0xff) << 16) | m_rgbram[offs]; - bitmap.pix16(y, x) = (data & 0x7fff); + bitmap.pix(y, x) = (data & 0x7fff); } } } diff --git a/src/mame/video/shuuz.cpp b/src/mame/video/shuuz.cpp index dc62d134373..8c2013e8c4a 100644 --- a/src/mame/video/shuuz.cpp +++ b/src/mame/video/shuuz.cpp @@ -88,8 +88,8 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -107,10 +107,10 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, * +PFS7*(LBD7&LBD6)*!M3*!O13 * */ - int o13 = ((pf[x] & 0xf0) == 0xf0); - int mopf = 0; + int const o13 = ((pf[x] & 0xf0) == 0xf0); /* compute the MO/PF signal */ + int mopf = 0; if ((!(pf[x] & 0x80) && ((mo[x] & 0xc0) != 0xc0) && ((mo[x] & 0x0e) != 0x00) && !o13) || ((pf[x] & 0x80) && ((mo[x] & 0xc0) == 0xc0) && ((mo[x] & 0x0e) != 0x00) && !o13)) mopf = 1; diff --git a/src/mame/video/sidearms.cpp b/src/mame/video/sidearms.cpp index 20fef5fa3b4..01d4dddeea1 100644 --- a/src/mame/video/sidearms.cpp +++ b/src/mame/video/sidearms.cpp @@ -207,17 +207,16 @@ void sidearms_state::draw_sprites_region(bitmap_ind16 &bitmap, const rectangle & void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) { - int x, y, i; uint32_t hadd_283, vadd_283, _hflop_74a_n, _hcount_191, _vcount_191; uint8_t *sf_rom; uint16_t *lineptr; int pixadv, lineadv; // clear starfield background - lineptr = &bitmap.pix16(16, 64); + lineptr = &bitmap.pix(16, 64); lineadv = bitmap.rowpixels(); - for (i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } + for (int i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } // bail if not Side Arms or the starfield has been disabled if (m_gameid || !m_staron) return; @@ -240,16 +239,16 @@ void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) } else { - lineptr = &bitmap.pix16(255, 512 - 1); + lineptr = &bitmap.pix(255, 512 - 1); pixadv = -1; lineadv = -lineadv + 512; } - for (y=0; y<256; y++) // 8-bit V-clock input + for (int y=0; y<256; y++) // 8-bit V-clock input { - for (x=0; x<512; lineptr+=pixadv,x++) // 9-bit H-clock input + for (int x=0; x<512; lineptr+=pixadv,x++) // 9-bit H-clock input { - i = hadd_283; // store horizontal adder's previous state in i + int i = hadd_283; // store horizontal adder's previous state in i hadd_283 = _hcount_191 + (x & 0xff); // add lower 8 bits and preserve carry if (x<64 || x>447 || y<16 || y>239) continue; // clip rejection @@ -277,31 +276,31 @@ void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) #else // optimized loop if (!m_flipon) { - lineptr = &bitmap.pix16(16, 64); + lineptr = &bitmap.pix(16, 64); pixadv = 1; lineadv = lineadv - 384; } else { - lineptr = &bitmap.pix16(239, 512 - 64 - 1); + lineptr = &bitmap.pix(239, 512 - 64 - 1); pixadv = -1; lineadv = -lineadv + 384; } - for (y=16; y<240; y++) // 8-bit V-clock input (clipped against vertical visible area) + for (int y=16; y<240; y++) // 8-bit V-clock input (clipped against vertical visible area) { // inner loop pre-entry conditioning hadd_283 = (_hcount_191 + 64) & ~0x1f; vadd_283 = _vcount_191 + y; - i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) + int i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) i |= (_hflop_74a_n^(hadd_283>>8)) << 3; // to starfield EPROM A03 (1 bit) i |= hadd_283>>5 & 7; // to starfield EPROM A00-A02 (3 bits) m_latch_374 = sf_rom[i + 0x3000]; // lines A12-A13 are always high hadd_283 = _hcount_191 + 63; - for (x=64; x<448; lineptr+=pixadv,x++) // 9-bit H-clock input (clipped against horizontal visible area) + for (int x=64; x<448; lineptr+=pixadv,x++) // 9-bit H-clock input (clipped against horizontal visible area) { i = hadd_283; // store horizontal adder's previous state in i hadd_283 = _hcount_191 + (x & 0xff); // add lower 8 bits and preserve carry diff --git a/src/mame/video/sidepckt.cpp b/src/mame/video/sidepckt.cpp index e57b3a86ba0..90cf122c262 100644 --- a/src/mame/video/sidepckt.cpp +++ b/src/mame/video/sidepckt.cpp @@ -77,6 +77,8 @@ void sidepckt_state::video_start() m_bg_tilemap->set_transmask(1,0x01,0xfe); /* split type 1 has pen 0 transparent in front half */ machine().tilemap().set_flip_all(TILEMAP_FLIPX); + + save_item(NAME(m_scroll_y)); } diff --git a/src/mame/video/sknsspr.cpp b/src/mame/video/sknsspr.cpp index 12e70d8536f..43e305321a7 100644 --- a/src/mame/video/sknsspr.cpp +++ b/src/mame/video/sknsspr.cpp @@ -158,7 +158,7 @@ void sknsspr_device::skns_sprite_kludge(int x, int y) #define z_draw_pixel() \ u8 val = src[xs >> 16]; \ if(val) \ - bitmap.pix16(yd>>16, xd>>16) = val + colour; + bitmap.pix(yd>>16, xd>>16) = val + colour; #define z_x_dst(op) \ old = xd; \ @@ -474,81 +474,72 @@ void sknsspr_device::skns_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl sx >>= 6; sy >>= 6; if (!xflip && !yflip) { - int xx,yy; - - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+xx < (cliprect.max_x+1)) && (sx+xx >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+yy < (cliprect.max_y+1)) && (sy+yy >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+yy, sx+xx) = pix+ NewColour; // change later + bitmap.pix(sy+yy, sx+xx) = pix+ NewColour; // change later } } } } } else if (!xflip && yflip) { - int xx,yy; sy -= ysize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+xx < (cliprect.max_x+1)) && (sx+xx >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+(ysize-1-yy) < (cliprect.max_y+1)) && (sy+(ysize-1-yy) >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+(ysize-1-yy), sx+xx) = pix+ NewColour; // change later + bitmap.pix(sy+(ysize-1-yy), sx+xx) = pix+ NewColour; // change later } } } } } else if (xflip && !yflip) { - int xx,yy; sx -= xsize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ( (sx+(xsize-1-xx) < (cliprect.max_x+1)) && (sx+(xsize-1-xx) >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+yy < (cliprect.max_y+1)) && (sy+yy >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+yy, sx+(xsize-1-xx)) = pix+ NewColour; // change later + bitmap.pix(sy+yy, sx+(xsize-1-xx)) = pix+ NewColour; // change later } } } } } else if (xflip && yflip) { - int xx,yy; sx -= xsize; sy -= ysize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+(xsize-1-xx) < (cliprect.max_x+1)) && (sx+(xsize-1-xx) >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+(ysize-1-yy) < (cliprect.max_y+1)) && (sy+(ysize-1-yy) >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+(ysize-1-yy), sx+(xsize-1-xx)) = pix+ NewColour; // change later + bitmap.pix(sy+(ysize-1-yy), sx+(xsize-1-xx)) = pix+ NewColour; // change later } } } diff --git a/src/mame/video/skullxbo.cpp b/src/mame/video/skullxbo.cpp index 757b920645b..0d1e5e926ba 100644 --- a/src/mame/video/skullxbo.cpp +++ b/src/mame/video/skullxbo.cpp @@ -243,8 +243,8 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -275,11 +275,11 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in +!CRAMD*LBMISC*(LBPIX!=0) */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - int mopix = mo[x] & 0x1f; - int pfcolor = (pf[x] >> 4) & 0x0f; - int pfpix = pf[x] & 0x0f; - int o17 = ((pf[x] & 0xc8) == 0xc8); + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopix = mo[x] & 0x1f; + int const pfcolor = (pf[x] >> 4) & 0x0f; + int const pfpix = pf[x] & 0x0f; + int const o17 = ((pf[x] & 0xc8) == 0xc8); /* implement the equations */ if ((mopriority == 0 && !o17 && mopix >= 2) || diff --git a/src/mame/video/skyfox.cpp b/src/mame/video/skyfox.cpp index 80a79461e0e..b16bd5bc831 100644 --- a/src/mame/video/skyfox.cpp +++ b/src/mame/video/skyfox.cpp @@ -220,7 +220,7 @@ void skyfox_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre but when strict compared on "1UP START" screen, it seems the blinking pattern in each star may be different. */ if (((m_bg_ctrl >> 4) & 3) != (pen & 3) || !blinking) - bitmap.pix16(y % 256, x % 512) = pen; + bitmap.pix(y % 256, x % 512) = pen; } } diff --git a/src/mame/video/skyraid.cpp b/src/mame/video/skyraid.cpp index 103b38cb0f0..7e15caa40e3 100644 --- a/src/mame/video/skyraid.cpp +++ b/src/mame/video/skyraid.cpp @@ -110,20 +110,17 @@ void skyraid_state::draw_missiles(bitmap_ind16 &bitmap, const rectangle &cliprec void skyraid_state::draw_trapezoid(bitmap_ind16& dst, bitmap_ind16& src) { - const uint8_t* p = memregion("user2")->base(); + uint8_t const *const p = memregion("user2")->base(); - int x; - int y; - - for (y = 0; y < dst.height(); y++) + for (int y = 0; y < dst.height(); y++) { - uint16_t* pSrc = &src.pix16(y); - uint16_t* pDst = &dst.pix16(y); + uint16_t const *const pSrc = &src.pix(y); + uint16_t *const pDst = &dst.pix(y); - int x1 = 0x000 + p[(y & ~1) + 0]; - int x2 = 0x100 + p[(y & ~1) + 1]; + int const x1 = 0x000 + p[(y & ~1) + 0]; + int const x2 = 0x100 + p[(y & ~1) + 1]; - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) pDst[x] = pSrc[128 * (x - x1) / (x2 - x1)]; } } diff --git a/src/mame/video/spacefb.cpp b/src/mame/video/spacefb.cpp index aee54f523b3..845fc6f2525 100644 --- a/src/mame/video/spacefb.cpp +++ b/src/mame/video/spacefb.cpp @@ -146,7 +146,6 @@ void spacefb_state::get_starfield_pens(pen_t *pens) void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; pen_t pens[NUM_STARFIELD_PENS]; get_starfield_pens(pens); @@ -154,21 +153,17 @@ void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, /* the shift register is always shifting -- do the portion in the top VBLANK */ if (cliprect.min_y == screen.visible_area().min_y) { - int i; - /* one cycle delay introduced by IC10 D flip-flop at the end of the VBLANK */ int clock_count = (SPACEFB_HBSTART - SPACEFB_HBEND) * SPACEFB_VBEND - 1; - for (i = 0; i < clock_count; i++) + for (int i = 0; i < clock_count; i++) shift_star_generator(); } /* visible region of the screen */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - int x; - - for (x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) + for (int x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) { if (m_object_present_map[(y * bitmap.width()) + x] == 0) { @@ -177,9 +172,9 @@ void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, ((m_star_shift_reg & 0x1c0ff) == 0x0c0d7) || ((m_star_shift_reg & 0x1c0ff) == 0x0c0bb) || ((m_star_shift_reg & 0x1c0ff) == 0x0c0db)) - bitmap.pix32(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; + bitmap.pix(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; else - bitmap.pix32(y, x) = pens[0]; + bitmap.pix(y, x) = pens[0]; } shift_star_generator(); @@ -254,20 +249,17 @@ void spacefb_state::get_sprite_pens(pen_t *pens) void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) { - uint8_t sy; - - uint8_t *gfx = memregion("gfx2")->base(); + uint8_t const *const gfx = memregion("gfx2")->base(); uint8_t code = m_videoram[offs + 0x0200] & 0x3f; uint8_t y = ~m_videoram[offs + 0x0100] - 2; - for (sy = 0; sy < 4; sy++) + for (uint8_t sy = 0; sy < 4; sy++) { - uint8_t sx, dy; - uint8_t data = gfx[(code << 2) | sy]; uint8_t x = m_videoram[offs + 0x0000]; + uint8_t dy; if (flip) dy = ~y; else @@ -275,53 +267,49 @@ void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, co if ((dy > cliprect.min_y) && (dy < cliprect.max_y)) { - for (sx = 0; sx < 4; sx++) + for (uint8_t sx = 0; sx < 4; sx++) { if (data & 0x01) { uint16_t dx; - if (flip) dx = (255 - x) * 2; else dx = x * 2; - bitmap.pix32(dy, dx + 0) = pen; - bitmap.pix32(dy, dx + 1) = pen; + bitmap.pix(dy, dx + 0) = pen; + bitmap.pix(dy, dx + 1) = pen; m_object_present_map[(dy * bitmap.width()) + dx + 0] = 1; m_object_present_map[(dy * bitmap.width()) + dx + 1] = 1; } - x = x + 1; - data = data >> 1; + x++; + data >>= 1; } } - y = y + 1; + y++; } } void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) { - uint8_t sy; - - uint8_t *gfx = memregion("gfx1")->base(); + uint8_t const *const gfx = memregion("gfx1")->base(); uint8_t code = ~m_videoram[offs + 0x0200]; uint8_t color_base = (~m_videoram[offs + 0x0300] & 0x0f) << 2; uint8_t y = ~m_videoram[offs + 0x0100] - 2; - for (sy = 0; sy < 8; sy++) + for (uint8_t sy = 0; sy < 8; sy++) { - uint8_t sx, dy; - uint8_t data1 = gfx[0x0000 | (code << 3) | (sy ^ 0x07)]; uint8_t data2 = gfx[0x0800 | (code << 3) | (sy ^ 0x07)]; uint8_t x = m_videoram[offs + 0x0000] - 3; + uint8_t dy; if (flip) dy = ~y; else @@ -329,33 +317,30 @@ void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, if ((dy > cliprect.min_y) && (dy < cliprect.max_y)) { - for (sx = 0; sx < 8; sx++) + for (uint8_t sx = 0; sx < 8; sx++) { uint16_t dx; - uint8_t data; - pen_t pen; - if (flip) dx = (255 - x) * 2; else dx = x * 2; - data = ((data1 << 1) & 0x02) | (data2 & 0x01); - pen = pens[color_base | data]; + uint8_t data = ((data1 << 1) & 0x02) | (data2 & 0x01); + pen_t pen = pens[color_base | data]; - bitmap.pix32(dy, dx + 0) = pen; - bitmap.pix32(dy, dx + 1) = pen; + bitmap.pix(dy, dx + 0) = pen; + bitmap.pix(dy, dx + 1) = pen; m_object_present_map[(dy * bitmap.width()) + dx + 0] = (data != 0); m_object_present_map[(dy * bitmap.width()) + dx + 1] = (data != 0); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } - y = y + 1; + y++; } } diff --git a/src/mame/video/special.cpp b/src/mame/video/special.cpp index da59ddee831..8e4e52c34f7 100644 --- a/src/mame/video/special.cpp +++ b/src/mame/video/special.cpp @@ -21,7 +21,7 @@ uint32_t special_state::screen_update_special(screen_device &screen, bitmap_ind1 { uint8_t const code = m_vram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = BIT(code, b); + bitmap.pix(y, x*8+(7-b)) = BIT(code, b); } } return 0; @@ -35,7 +35,7 @@ uint32_t special_state::screen_update_specialp(screen_device &screen, bitmap_ind { uint8_t const code = m_vram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = BIT(code, b); + bitmap.pix(y, x*8+(7-b)) = BIT(code, b); } } return 0; @@ -75,7 +75,7 @@ uint32_t special_state::screen_update_specimx(screen_device &screen, bitmap_ind1 uint8_t const code = m_ram->pointer()[0x9000 + y + x*256]; uint8_t const color = m_specimx_colorram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f; + bitmap.pix(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f; } } return 0; @@ -100,25 +100,21 @@ void special_state::erik_palette(palette_device &palette) const uint32_t special_state::screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1, code2, color1, color2; - int y, x, b; - uint8_t *erik_video_ram_p1, *erik_video_ram_p2; + uint8_t const *const erik_video_ram_p1 = m_ram->pointer() + 0x9000; + uint8_t const *const erik_video_ram_p2 = m_ram->pointer() + 0xd000; - erik_video_ram_p1 = m_ram->pointer() + 0x9000; - erik_video_ram_p2 = m_ram->pointer() + 0xd000; - - for (x = 0; x < 48; x++) + for (int x = 0; x < 48; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - code1 = erik_video_ram_p1[y + x*256]; - code2 = erik_video_ram_p2[y + x*256]; + uint8_t code1 = erik_video_ram_p1[y + x*256]; + uint8_t code2 = erik_video_ram_p2[y + x*256]; - for (b = 7; b >= 0; b--) + for (int b = 7; b >= 0; b--) { - color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; - color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; - bitmap.pix16(y, x*8+(7-b)) = color1 | color2; + uint8_t color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; + uint8_t color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; + bitmap.pix(y, x*8+(7-b)) = color1 | color2; } } } diff --git a/src/mame/video/spectrum.cpp b/src/mame/video/spectrum.cpp index e3a0226ee74..c3a594ce967 100644 --- a/src/mame/video/spectrum.cpp +++ b/src/mame/video/spectrum.cpp @@ -123,7 +123,7 @@ WRITE_LINE_MEMBER(spectrum_state::screen_vblank_spectrum) inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -235,7 +235,7 @@ void spectrum_state::spectrum_UpdateScreenBitmap(bool eof) { // this can/must be optimised if ((scrx & 7) == 0) { - uint16_t *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x); + uint16_t *bm = &m_screen_bitmap.pix(m_previous_screen_y, m_previous_screen_x); uint8_t attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800); uint8_t scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3)); uint16_t ink = (attr & 0x07) + ((attr >> 3) & 0x08); @@ -284,7 +284,7 @@ void spectrum_state::spectrum_UpdateBorderBitmap() do { - m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; + m_border_bitmap.pix(m_previous_border_y, m_previous_border_x) = border; m_previous_border_x += 1; diff --git a/src/mame/video/splash.cpp b/src/mame/video/splash.cpp index b2f3417cd00..fb8264a6780 100644 --- a/src/mame/video/splash.cpp +++ b/src/mame/video/splash.cpp @@ -151,7 +151,7 @@ void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) } if (sy >= cliprect.min_y && sy <= cliprect.max_y && sx-9 >= cliprect.min_x && sx-9 <= cliprect.max_x) - bitmap.pix16(sy, sx-9) = 0x300+(color^colxor); + bitmap.pix(sy, sx-9) = 0x300+(color^colxor); } } diff --git a/src/mame/video/sprint2.cpp b/src/mame/video/sprint2.cpp index 40b713ac18b..96e04846aa5 100644 --- a/src/mame/video/sprint2.cpp +++ b/src/mame/video/sprint2.cpp @@ -80,13 +80,10 @@ uint8_t sprint2_state::collision_check(rectangle& rect) { uint8_t data = 0; - int x; - int y; - - for (y = rect.top(); y <= rect.bottom(); y++) - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) { - uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)); + uint16_t const a = m_palette->pen_indirect(m_helper.pix(y, x)); if (a == 0) data |= 0x40; diff --git a/src/mame/video/sprint4.cpp b/src/mame/video/sprint4.cpp index 183a91fd058..b6a1ef1b74a 100644 --- a/src/mame/video/sprint4.cpp +++ b/src/mame/video/sprint4.cpp @@ -117,7 +117,7 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank) for (int y = rect.top(); y <= rect.bottom(); y++) for (int x = rect.left(); x <= rect.right(); x++) - if (m_palette->pen_indirect(m_helper.pix16(y, x)) != 0) + if (m_palette->pen_indirect(m_helper.pix(y, x)) != 0) m_collision[i] = 1; } diff --git a/src/mame/video/sprint8.cpp b/src/mame/video/sprint8.cpp index 7b3db9843fc..724d9f4f1ab 100644 --- a/src/mame/video/sprint8.cpp +++ b/src/mame/video/sprint8.cpp @@ -172,8 +172,8 @@ WRITE_LINE_MEMBER(sprint8_state::screen_vblank) for (int y = visarea.top(); y <= visarea.bottom(); y++) { - const uint16_t* p1 = &m_helper1.pix16(y); - const uint16_t* p2 = &m_helper2.pix16(y); + uint16_t const *const p1 = &m_helper1.pix(y); + uint16_t const *const p2 = &m_helper2.pix(y); for (int x = visarea.left(); x <= visarea.right(); x++) if (p1[x] != 0x20 && p2[x] == 0x23) diff --git a/src/mame/video/sspeedr.cpp b/src/mame/video/sspeedr.cpp index 63fa97d3d9c..95849c78231 100644 --- a/src/mame/video/sspeedr.cpp +++ b/src/mame/video/sspeedr.cpp @@ -126,11 +126,11 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) if (counter_x & 2) { - bitmap.pix16(y, x) = m_track[offset] / 16; + bitmap.pix(y, x) = m_track[offset] / 16; } else { - bitmap.pix16(y, x) = m_track[offset] % 16; + bitmap.pix(y, x) = m_track[offset] % 16; } } @@ -138,7 +138,7 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) for (; y < 128 + m_track_vert[1]; y++) { - bitmap.pix16(y, x) = flag ? 15 : 0; + bitmap.pix(y, x) = flag ? 15 : 0; } // lower landscape @@ -154,11 +154,11 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) if (counter_x & 2) { - bitmap.pix16(y, x) = m_track[offset] / 16; + bitmap.pix(y, x) = m_track[offset] / 16; } else { - bitmap.pix16(y, x) = m_track[offset] % 16; + bitmap.pix(y, x) = m_track[offset] % 16; } } } diff --git a/src/mame/video/ssv.cpp b/src/mame/video/ssv.cpp index 4b65573544c..c8629284845 100644 --- a/src/mame/video/ssv.cpp +++ b/src/mame/video/ssv.cpp @@ -135,7 +135,6 @@ #include "emu.h" #include "includes/ssv.h" -#include "render.h" void ssv_state::drawgfx_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int gfx, uint32_t code, uint32_t color, int flipx, int flipy, int base_sx, int base_sy, int shadow, int realline, int line) @@ -171,7 +170,7 @@ void ssv_state::drawgfx_line(bitmap_ind16 &bitmap, const rectangle &cliprect, in const uint8_t gfxbppmask = BPP_MASK_TABLE[gfx & 0x07].gfx_mask; const uint8_t gfxshift = BPP_MASK_TABLE[gfx & 0x07].gfx_shift; - uint16_t *dest = &bitmap.pix16(realline); + uint16_t *const dest = &bitmap.pix(realline); const int x0 = flipx ? (base_sx + gfxelement->width() - 1) : base_sx; const int x1 = flipx ? (base_sx - 1) : (x0 + gfxelement->width()); diff --git a/src/mame/video/st0020.cpp b/src/mame/video/st0020.cpp index 6702174635a..f378dbbc302 100644 --- a/src/mame/video/st0020.cpp +++ b/src/mame/video/st0020.cpp @@ -16,7 +16,9 @@ #include "emu.h" #include "st0020.h" -#include "render.h" + +#include "screen.h" + DEFINE_DEVICE_TYPE(ST0020_SPRITES, st0020_device, "st0020", "Seta ST0020 Sprites") diff --git a/src/mame/video/stactics.cpp b/src/mame/video/stactics.cpp index ddeef5ff89e..fee32be9139 100644 --- a/src/mame/video/stactics.cpp +++ b/src/mame/video/stactics.cpp @@ -214,17 +214,14 @@ void stactics_state::update_beam() inline int stactics_state::get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint8_t x, uint8_t y_scroll) { - uint8_t code; - uint8_t gfx; - /* compute effective row */ y = y - y_scroll; /* get the character code at the given pixel */ - code = videoram[((y >> 3) << 5) | (x >> 3)]; + uint8_t code = videoram[((y >> 3) << 5) | (x >> 3)]; /* get the gfx byte */ - gfx = videoram[0x800 | (code << 3) | (y & 0x07)]; + uint8_t gfx = videoram[0x800 | (code << 3) | (y & 0x07)]; /* return the appropriate pixel within the byte */ return (gfx >> (~x & 0x07)) & 0x01; @@ -233,17 +230,13 @@ inline int stactics_state::get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - bitmap.fill(0, cliprect); /* for every row */ - for (y = 0; y < 0x100; y++) + for (int y = 0; y < 0x100; y++) { - int x; - /* for every pixel on the row */ - for (x = 0; x < 0x100; x++) + for (int x = 0; x < 0x100; x++) { /* get the pixels for the four planes */ int pixel_b = get_pixel_on_plane(m_videoram_b, y, x, 0); @@ -269,7 +262,7 @@ void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clip /* plot if visible */ if ((sy >= 0) && (sy < 0x100) && (sx >= 0) && (sx < 0x100)) - bitmap.pix16(sy, sx) = pen; + bitmap.pix(sy, sx) = pen; } } } diff --git a/src/mame/video/starcrus.cpp b/src/mame/video/starcrus.cpp index f3a9875741e..ca7122e3068 100644 --- a/src/mame/video/starcrus.cpp +++ b/src/mame/video/starcrus.cpp @@ -105,7 +105,7 @@ int starcrus_state::collision_check_s1s2() for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) /* Condition 1 - ship 1 = ship 2 */ - if ((m_ship1_vid->pix16(sy, sx) == 1) && (m_ship2_vid->pix16(sy, sx) == 1)) + if ((m_ship1_vid->pix(sy, sx) == 1) && (m_ship2_vid->pix(sy, sx) == 1)) return 1; return 0; @@ -158,7 +158,7 @@ int starcrus_state::collision_check_p1p2() for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) /* Condition 1 - proj 1 = proj 2 */ - if ((m_proj1_vid->pix16(sy, sx) == 1) && (m_proj2_vid->pix16(sy, sx) == 1)) + if ((m_proj1_vid->pix(sy, sx) == 1) && (m_proj2_vid->pix(sy, sx) == 1)) return 1; return 0; @@ -219,13 +219,13 @@ int starcrus_state::collision_check_s1p1p2() /* Now check for collisions */ for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) - if (m_ship1_vid->pix16(sy, sx) == 1) + if (m_ship1_vid->pix(sy, sx) == 1) { /* Condition 1 - ship 1 = proj 1 */ - if (m_proj1_vid->pix16(sy, sx) == 1) + if (m_proj1_vid->pix(sy, sx) == 1) return 1; /* Condition 2 - ship 1 = proj 2 */ - if (m_proj2_vid->pix16(sy, sx) == 1) + if (m_proj2_vid->pix(sy, sx) == 1) return 1; } @@ -286,13 +286,13 @@ int starcrus_state::collision_check_s2p1p2() /* Now check for collisions */ for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) - if (m_ship2_vid->pix16(sy, sx) == 1) + if (m_ship2_vid->pix(sy, sx) == 1) { /* Condition 1 - ship 2 = proj 1 */ - if (m_proj1_vid->pix16(sy, sx) == 1) + if (m_proj1_vid->pix(sy, sx) == 1) return 1; /* Condition 2 - ship 2 = proj 2 */ - if (m_proj2_vid->pix16(sy, sx) == 1) + if (m_proj2_vid->pix(sy, sx) == 1) return 1; } diff --git a/src/mame/video/starfield_05xx.cpp b/src/mame/video/starfield_05xx.cpp index 2fb46fd0b24..cdba1b1c7ba 100644 --- a/src/mame/video/starfield_05xx.cpp +++ b/src/mame/video/starfield_05xx.cpp @@ -642,7 +642,7 @@ void starfield_05xx_device::draw_starfield(bitmap_ind16 &bitmap, const rectangle color |= (m_lfsr<<2)&0x20; color = (~color)&0x3F; - bitmap.pix16(y, dx) = STARS_COLOR_BASE + color; + bitmap.pix(y, dx) = STARS_COLOR_BASE + color; } } } diff --git a/src/mame/video/starfire.cpp b/src/mame/video/starfire.cpp index 435a0daf108..b87e215dfd5 100644 --- a/src/mame/video/starfire.cpp +++ b/src/mame/video/starfire.cpp @@ -242,14 +242,14 @@ TIMER_CALLBACK_MEMBER(starfire_base_state::scanline_callback) int data = pix[0]; int color = col[0]; - m_screen_bitmap.pix32(y, x + 0) = pens[color | ((data >> 2) & 0x20)]; - m_screen_bitmap.pix32(y, x + 1) = pens[color | ((data >> 1) & 0x20)]; - m_screen_bitmap.pix32(y, x + 2) = pens[color | ((data >> 0) & 0x20)]; - m_screen_bitmap.pix32(y, x + 3) = pens[color | ((data << 1) & 0x20)]; - m_screen_bitmap.pix32(y, x + 4) = pens[color | ((data << 2) & 0x20)]; - m_screen_bitmap.pix32(y, x + 5) = pens[color | ((data << 3) & 0x20)]; - m_screen_bitmap.pix32(y, x + 6) = pens[color | ((data << 4) & 0x20)]; - m_screen_bitmap.pix32(y, x + 7) = pens[color | ((data << 5) & 0x20)]; + m_screen_bitmap.pix(y, x + 0) = pens[color | ((data >> 2) & 0x20)]; + m_screen_bitmap.pix(y, x + 1) = pens[color | ((data >> 1) & 0x20)]; + m_screen_bitmap.pix(y, x + 2) = pens[color | ((data >> 0) & 0x20)]; + m_screen_bitmap.pix(y, x + 3) = pens[color | ((data << 1) & 0x20)]; + m_screen_bitmap.pix(y, x + 4) = pens[color | ((data << 2) & 0x20)]; + m_screen_bitmap.pix(y, x + 5) = pens[color | ((data << 3) & 0x20)]; + m_screen_bitmap.pix(y, x + 6) = pens[color | ((data << 4) & 0x20)]; + m_screen_bitmap.pix(y, x + 7) = pens[color | ((data << 5) & 0x20)]; pix += 256; col += 256; diff --git a/src/mame/video/starshp1.cpp b/src/mame/video/starshp1.cpp index 4ea20f955cf..eb55d4c57cc 100644 --- a/src/mame/video/starshp1.cpp +++ b/src/mame/video/starshp1.cpp @@ -146,16 +146,13 @@ void starshp1_state::draw_starfield(bitmap_ind16 &bitmap) * really needed by the game. Not emulated. */ - int x; - int y; - - for (y = 0; y < bitmap.height(); y++) + for (int y = 0; y < bitmap.height(); y++) { - const uint16_t* p = m_LSFR.get() + (uint16_t) (512 * y); + uint16_t const *const p = m_LSFR.get() + (uint16_t) (512 * y); - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); - for (x = 0; x < bitmap.width(); x++) + for (int x = 0; x < bitmap.width(); x++) if ((p[x] & 0x5b56) == 0x5b44) pLine[x] = (p[x] & 0x0400) ? 0x0e : 0x0f; } @@ -217,15 +214,13 @@ void starshp1_state::draw_spaceship(bitmap_ind16 &bitmap, const rectangle &clipr void starshp1_state::draw_phasor(bitmap_ind16 &bitmap) { - int i; - - for (i = 128; i < 240; i++) + for (int i = 128; i < 240; i++) if (i >= get_sprite_vpos(13)) { - bitmap.pix16(i, 2 * i + 0) = 0x10; - bitmap.pix16(i, 2 * i + 1) = 0x10; - bitmap.pix16(i, 2 * (255 - i) + 0) = 0x10; - bitmap.pix16(i, 2 * (255 - i) + 1) = 0x10; + bitmap.pix(i, 2 * i + 0) = 0x10; + bitmap.pix(i, 2 * i + 1) = 0x10; + bitmap.pix(i, 2 * (255 - i) + 0) = 0x10; + bitmap.pix(i, 2 * (255 - i) + 1) = 0x10; } } @@ -248,9 +243,9 @@ void starshp1_state::draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l) { if (y >= 0 && y <= bitmap.height() - 1) { - const uint16_t* p = m_LSFR.get() + (uint16_t) (512 * y); + uint16_t const *const p = m_LSFR.get() + uint16_t(512 * y); - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int h1 = x - 2 * l; int h2 = x + 2 * l; @@ -305,7 +300,7 @@ int starshp1_state::spaceship_collision(bitmap_ind16 &bitmap, const rectangle &r { for (int y = rect.top(); y <= rect.bottom(); y++) { - const uint16_t* pLine = &m_helper.pix16(y); + uint16_t const *const pLine = &m_helper.pix(y); for (int x = rect.left(); x <= rect.right(); x++) if (pLine[x] != 0) diff --git a/src/mame/video/stfight_dev.cpp b/src/mame/video/stfight_dev.cpp index 40f2f590bd1..6757fd77d9b 100644 --- a/src/mame/video/stfight_dev.cpp +++ b/src/mame/video/stfight_dev.cpp @@ -285,8 +285,8 @@ void stfight_video_device::mix_txlayer(screen_device &screen, bitmap_ind16 &bitm { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &bitmap2.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &bitmap2.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (src[x] == -1) diff --git a/src/mame/video/stic.cpp b/src/mame/video/stic.cpp index c6e12e1e1a5..df3499999ce 100644 --- a/src/mame/video/stic.cpp +++ b/src/mame/video/stic.cpp @@ -516,21 +516,19 @@ const tiny_rom_entry *stic_device::device_rom_region() const void stic_device::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - int w, h; - // output scaling x *= m_x_scale; y *= m_y_scale; color = SET_COLOR(color); - for (h = 0; h < m_y_scale; h++) - for (w = 0; w < m_x_scale; w++) - bitmap.pix16(y + h, x + w) = color; + for (int h = 0; h < m_y_scale; h++) + for (int w = 0; w < m_x_scale; w++) + bitmap.pix(y + h, x + w) = color; } uint32_t stic_device::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y) { - return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale)); + return GET_COLOR(bitmap.pix(y * m_y_scale, x * m_x_scale)); } void stic_device::intv_plot_box(bitmap_ind16 &bitmap, int x, int y, int w, int h, int color) diff --git a/src/mame/video/super80.cpp b/src/mame/video/super80.cpp index ccd746c115b..1f19578ece7 100644 --- a/src/mame/video/super80.cpp +++ b/src/mame/video/super80.cpp @@ -85,7 +85,7 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF { @@ -141,7 +141,7 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -191,7 +191,7 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -245,7 +245,7 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -372,7 +372,7 @@ uint32_t super80v_state::screen_update_super80v(screen_device &screen, bitmap_rg MC6845_UPDATE_ROW( super80v_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) // for each character { diff --git a/src/mame/video/superqix.cpp b/src/mame/video/superqix.cpp index 99105c30c24..da863200d39 100644 --- a/src/mame/video/superqix.cpp +++ b/src/mame/video/superqix.cpp @@ -99,8 +99,8 @@ void superqix_state_base::superqix_bitmapram_w(offs_t offset, uint8_t data) m_bitmapram[offset] = data; - m_fg_bitmap[0]->pix16(y, x) = data >> 4; - m_fg_bitmap[0]->pix16(y, x + 1) = data & 0x0f; + m_fg_bitmap[0]->pix(y, x) = data >> 4; + m_fg_bitmap[0]->pix(y, x + 1) = data & 0x0f; } } @@ -113,8 +113,8 @@ void superqix_state_base::superqix_bitmapram2_w(offs_t offset, uint8_t data) m_bitmapram2[offset] = data; - m_fg_bitmap[1]->pix16(y, x) = data >> 4; - m_fg_bitmap[1]->pix16(y, x + 1) = data & 0x0f; + m_fg_bitmap[1]->pix(y, x) = data >> 4; + m_fg_bitmap[1]->pix(y, x + 1) = data & 0x0f; } } diff --git a/src/mame/video/suprloco.cpp b/src/mame/video/suprloco.cpp index 49b76042936..203fe9d38b0 100644 --- a/src/mame/video/suprloco.cpp +++ b/src/mame/video/suprloco.cpp @@ -155,7 +155,7 @@ inline void suprloco_state::draw_pixel(bitmap_ind16 &bitmap,const rectangle &cli } if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } diff --git a/src/mame/video/suprnova.cpp b/src/mame/video/suprnova.cpp index 802c622ab41..a38456e3f84 100644 --- a/src/mame/video/suprnova.cpp +++ b/src/mame/video/suprnova.cpp @@ -11,21 +11,12 @@ void skns_state::draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const rectangle &cliprect, tilemap_t *tmap, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, uint32_t* scrollram) { //bitmap_ind16 *destbitmap = bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - bitmap_ind8 &srcbitmapflags = tmap->flagsmap(); + const bitmap_ind16 &srcbitmap = tmap->pixmap(); + const bitmap_ind8 &srcbitmapflags = tmap->flagsmap(); const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; const int heightshifted = srcbitmap.height() << 16; - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; - uint16_t *dest; - uint8_t* destflags; // uint8_t *pri; //const uint16_t *src; //const uint8_t *maskptr; @@ -36,55 +27,53 @@ void skns_state::draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const starty += cliprect.min_x * incxy + cliprect.min_y * incyy; /* extract start/end points */ - sx = cliprect.min_x; - sy = cliprect.min_y; - ex = cliprect.max_x; - ey = cliprect.max_y; + int sx = cliprect.min_x; + int sy = cliprect.min_y; + int ex = cliprect.max_x; + int ey = cliprect.max_y; + /* loop over rows */ + while (sy <= ey) { - /* loop over rows */ - while (sy <= ey) - { - /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + /* initialize X counters */ + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; - /* get dest and priority pointers */ - dest = &bitmap.pix16(sy, sx); - destflags = &bitmapflags.pix8(sy, sx); + /* get dest and priority pointers */ + uint16_t *dest = &bitmap.pix(sy, sx); + uint8_t *destflags = &bitmapflags.pix(sy, sx); - /* loop over columns */ - while (x <= ex) + /* loop over columns */ + while (x <= ex) + { + if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. { - if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. + if (columnscroll) { - if (columnscroll) - { - dest[0] = srcbitmap.pix16(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); - destflags[0] = srcbitmapflags.pix8(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); - } - else - { - dest[0] = srcbitmap.pix16((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); - destflags[0] = srcbitmapflags.pix8((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); - } + dest[0] = srcbitmap.pix(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); + destflags[0] = srcbitmapflags.pix(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); + } + else + { + dest[0] = srcbitmap.pix((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); + destflags[0] = srcbitmapflags.pix((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); } - - /* advance in X */ - cx += incxx; - cy += incxy; - x++; - dest++; - destflags++; -// pri++; } - /* advance in Y */ - startx += incyx; - starty += incyy; - sy++; + /* advance in X */ + cx += incxx; + cy += incxy; + x++; + dest++; + destflags++; +// pri++; } + + /* advance in Y */ + startx += incyx; + starty += incyy; + sy++; } } @@ -467,12 +456,10 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, m_tilemap_bitmapflags_higher.fill(0); { - int supernova_pri_a; - int supernova_pri_b; int tran = 0; - supernova_pri_a = (m_v3_regs[0x10/4] & 0x0002)>>1; - supernova_pri_b = (m_v3_regs[0x34/4] & 0x0002)>>1; + int supernova_pri_a = (m_v3_regs[0x10/4] & 0x0002)>>1; + int supernova_pri_b = (m_v3_regs[0x34/4] & 0x0002)>>1; //popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b); @@ -481,39 +468,32 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, draw_a(m_tilemap_bitmap_higher,m_tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; { - int x,y; - uint8_t* srcflags, *src2flags; - uint16_t* src, *src2, *src3; - uint32_t* dst; - uint16_t pri, pri2, pri3; uint16_t bgpri; - const pen_t *clut = &m_palette->pen(0); + pen_t const *const clut = &m_palette->pen(0); // int drawpri; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - src = &m_tilemap_bitmap_lower.pix16(y); - srcflags = &m_tilemap_bitmapflags_lower.pix8(y); + uint16_t const *const src = &m_tilemap_bitmap_lower.pix(y); + uint8_t const *const srcflags = &m_tilemap_bitmapflags_lower.pix(y); - src2 = &m_tilemap_bitmap_higher.pix16(y); - src2flags = &m_tilemap_bitmapflags_higher.pix8(y); + uint16_t const *const src2 = &m_tilemap_bitmap_higher.pix(y); + uint8_t const *const src2flags = &m_tilemap_bitmapflags_higher.pix(y); - src3 = &m_sprite_bitmap.pix16(y); + uint16_t const *const src3 = &m_sprite_bitmap.pix(y); - dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { uint16_t pendata = src[x]&0x7fff; uint16_t pendata2 = src2[x]&0x7fff; uint16_t bgpendata; uint16_t pendata3 = m_alt_enable_sprites ? src3[x]&0x3fff : 0; - uint32_t coldat; - - pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); - pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); - pri3 = ((src3[x]&0xc000)>>12)+3; + uint16_t pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); + uint16_t pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); + uint16_t pri3 = ((src3[x]&0xc000)>>12)+3; // work out which layers bg pixel has the higher priority // note, can the bg layers be blended?? sarukani uses an alpha pen for @@ -560,6 +540,7 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, } // if the sprites are higher than the bg pixel + uint32_t coldat; if (pri3 > bgpri) { if (pendata3&0xff) diff --git a/src/mame/video/system1.cpp b/src/mame/video/system1.cpp index c02ccd4fa27..e13a2cb618c 100644 --- a/src/mame/video/system1.cpp +++ b/src/mame/video/system1.cpp @@ -419,7 +419,7 @@ void system1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* iterate over all rows of the sprite */ for (int y = top; y < bottom; y++) { - u16 *destbase = &bitmap.pix16(y); + u16 *const destbase = &bitmap.pix(y); /* advance by the row counter */ srcaddr += stride; @@ -515,16 +515,14 @@ void system1_state::video_update_common(screen_device &screen, bitmap_ind16 &bit /* iterate over rows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *fgbase = &fgpixmap.pix16(y & 0xff); - const u16 *sprbase = &m_sprite_bitmap.pix16(y & 0xff); - u16 *dstbase = &bitmap.pix16(y); + const u16 *const fgbase = &fgpixmap.pix(y & 0xff); + const u16 *const sprbase = &m_sprite_bitmap.pix(y & 0xff); + u16 *const dstbase = &bitmap.pix(y); const int bgy = (y + bgyscroll) & 0x1ff; const int bgxscroll = bgrowscroll[y >> 3 & 0x1f]; - const u16 *bgbase[2]; /* get the base of the left and right pixmaps for the effective background Y */ - bgbase[0] = &bgpixmaps[(bgy >> 8) * 2 + 0]->pix16(bgy & 0xff); - bgbase[1] = &bgpixmaps[(bgy >> 8) * 2 + 1]->pix16(bgy & 0xff); + const u16 *const bgbase[2] = { &bgpixmaps[(bgy >> 8) * 2 + 0]->pix(bgy & 0xff), &bgpixmaps[(bgy >> 8) * 2 + 1]->pix(bgy & 0xff) }; /* iterate over pixels */ for (int x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/taito_b.cpp b/src/mame/video/taito_b.cpp index f401f246a71..e5a6f90e5f4 100644 --- a/src/mame/video/taito_b.cpp +++ b/src/mame/video/taito_b.cpp @@ -13,8 +13,8 @@ void hitice_state::pixelram_w(offs_t offset, uint16_t data, uint16_t mem_mask) if (ACCESSING_BITS_0_7) { /* bit 15 of pixel_scroll[0] is probably flip screen */ - m_pixel_bitmap->pix16(sy, 2 * sx + 0) = m_b_fg_color_base * 16 + (data & 0xff); - m_pixel_bitmap->pix16(sy, 2 * sx + 1) = m_b_fg_color_base * 16 + (data & 0xff); + m_pixel_bitmap->pix(sy, 2 * sx + 0) = m_b_fg_color_base * 16 + (data & 0xff); + m_pixel_bitmap->pix(sy, 2 * sx + 1) = m_b_fg_color_base * 16 + (data & 0xff); } } @@ -106,9 +106,8 @@ uint32_t taitob_state::screen_update_taitob(screen_device &screen, bitmap_ind16 uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *palette = m_palette->pens(); + pen_t const *const palette = m_palette->pens(); uint8_t const video_control = m_tc0180vcu->get_videoctrl(); - int x, y; /* Video blanked? */ if (!(video_control & 0x20)) @@ -128,9 +127,9 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_tc0180vcu->draw_framebuffer(*m_realpunc_bitmap, cliprect, 0); /* Copy the intermediate bitmap to the output bitmap, applying the palette */ - for (y = 0; y <= cliprect.max_y; y++) - for (x = 0; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = palette[m_realpunc_bitmap->pix16(y, x)]; + for (int y = 0; y <= cliprect.max_y; y++) + for (int x = 0; x <= cliprect.max_x; x++) + bitmap.pix(y, x) = palette[m_realpunc_bitmap->pix(y, x)]; /* Draw the 15bpp raw CRTC frame buffer directly to the output bitmap */ if (m_realpunc_video_ctrl & 0x0002) @@ -140,29 +139,28 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_hd63484->update_screen(screen, *m_realpunc_bitmap, cliprect); - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) + for (int x = 0; x <= cliprect.max_x; x++) { - int r, g, b; - uint16_t srcpix = m_realpunc_bitmap->pix16(cliprect.min_y + y, cliprect.min_x + x); + uint16_t srcpix = m_realpunc_bitmap->pix(cliprect.min_y + y, cliprect.min_x + x); - r = (BIT(srcpix, 1)) | ((srcpix >> 11) & 0x1e); - g = (BIT(srcpix, 2)) | ((srcpix >> 7) & 0x1e); - b = (BIT(srcpix, 3)) | ((srcpix >> 3) & 0x1e); + int r = (BIT(srcpix, 1)) | ((srcpix >> 11) & 0x1e); + int g = (BIT(srcpix, 2)) | ((srcpix >> 7) & 0x1e); + int b = (BIT(srcpix, 3)) | ((srcpix >> 3) & 0x1e); if (srcpix) - bitmap.pix32(y, x) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(y, x) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); } } } /* Draw the 15bpp raw output of the camera ADCs (TODO) */ else if (m_realpunc_video_ctrl & 0x0004) { - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = rgb_t(0x00, 0x00, 0x00); + for (int x = 0; x <= cliprect.max_x; x++) + bitmap.pix(y, x) = rgb_t(0x00, 0x00, 0x00); } } @@ -175,12 +173,12 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_tc0180vcu->tilemap_draw(screen, *m_realpunc_bitmap, cliprect, 2, 0); /* Merge the indexed layers with the output bitmap */ - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) + for (int x = 0; x <= cliprect.max_x; x++) { - if (m_realpunc_bitmap->pix16(y, x)) - bitmap.pix32(y, x) = palette[m_realpunc_bitmap->pix16(y, x)]; + if (m_realpunc_bitmap->pix(y, x)) + bitmap.pix(y, x) = palette[m_realpunc_bitmap->pix(y, x)]; } } diff --git a/src/mame/video/taito_f2.cpp b/src/mame/video/taito_f2.cpp index 4ece4e7b83f..2fac521ca13 100644 --- a/src/mame/video/taito_f2.cpp +++ b/src/mame/video/taito_f2.cpp @@ -50,7 +50,7 @@ void taitof2_state::core_vh_start(int sprite_type, int hide, int flip_hide) m_spriteram_delayed = make_unique_clear<u16[]>(m_spriteram.bytes() / 2); m_spriteram_buffered = make_unique_clear<u16[]>(m_spriteram.bytes() / 2); - m_spritelist = make_unique_clear<struct f2_tempsprite[]>(0x400); + m_spritelist = std::make_unique<f2_tempsprite[]>(0x400); for (int i = 0; i < 8; i ++) { @@ -357,9 +357,9 @@ void taitof2_state::taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_i { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -419,9 +419,9 @@ void taitof2_state::taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_i { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -508,7 +508,7 @@ void taitof2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list while processing sprite ram and then draw them all at the end */ - struct f2_tempsprite *sprite_ptr = m_spritelist.get(); + f2_tempsprite *sprite_ptr = m_spritelist.get(); /* must remember enable status from last frame because driftout fails to reactivate them from a certain point onwards. */ diff --git a/src/mame/video/taito_f3.cpp b/src/mame/video/taito_f3.cpp index 73a5df2a6df..5318be6c6f9 100644 --- a/src/mame/video/taito_f3.cpp +++ b/src/mame/video/taito_f3.cpp @@ -1354,7 +1354,7 @@ inline void taito_f3_state::draw_scanlines( yadvp = -yadvp; } - u8 *dstp0 = &m_pri_alp_bitmap.pix8(ty, x); + u8 *dstp0 = &m_pri_alp_bitmap.pix(ty, x); m_pdest_2a = m_alpha_level_2ad ? 0x10 : 0; m_pdest_2b = m_alpha_level_2bd ? 0x20 : 0; @@ -1366,7 +1366,7 @@ inline void taito_f3_state::draw_scanlines( m_tr_3b =(m_alpha_level_3bs == 0 && m_alpha_level_3bd == 255) ? -1 : 1; { - u32 *dsti0 = &bitmap.pix32(ty, x); + u32 *dsti0 = &bitmap.pix(ty, x); while (1) { int cx = 0; @@ -1909,11 +1909,11 @@ void taito_f3_state::get_line_ram_info(tilemap_t *tmap, int sx, int sy, int pos, /* set pixmap index */ line_t->x_count[y]=x_index_fx & 0xffff; // Fractional part - line_t->src_s[y] = src_s = &srcbitmap.pix16(y_index); + line_t->src_s[y] = src_s = &srcbitmap.pix(y_index); line_t->src_e[y] = &src_s[m_width_mask + 1]; line_t->src[y] = &src_s[x_index_fx >> 16]; - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap.pix8(y_index); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap.pix(y_index); line_t->tsrc[y] = &tsrc_s[x_index_fx >> 16]; } @@ -2022,16 +2022,16 @@ void taito_f3_state::get_vram_info(tilemap_t *vram_tilemap, tilemap_t *pixel_til /* set pixmap index */ line_t->x_count[y] = 0xffff; if (usePixelLayer) - line_t->src_s[y] = src_s = &srcbitmap_pixel.pix16(sy & 0xff); + line_t->src_s[y] = src_s = &srcbitmap_pixel.pix(sy & 0xff); else - line_t->src_s[y] = src_s = &srcbitmap_vram.pix16(sy & 0x1ff); + line_t->src_s[y] = src_s = &srcbitmap_vram.pix(sy & 0x1ff); line_t->src_e[y] = &src_s[vram_width_mask + 1]; line_t->src[y] = &src_s[sx]; if (usePixelLayer) - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_pixel.pix8(sy & 0xff); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_pixel.pix(sy & 0xff); else - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_vram.pix8(sy & 0x1ff); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_vram.pix(sy & 0x1ff); line_t->tsrc[y] = &tsrc_s[sx]; } @@ -2537,8 +2537,8 @@ inline void taito_f3_state::f3_drawgfx(bitmap_rgb32 &dest_bmp, const rectangle & int y = ey - sy; const int x = (ex - sx - 1) | (m_tile_opaque_sp[code % gfx->elements()] << 4); const u8 *source0 = code_base + y_index * 16 + x_index_base; - u32 *dest0 = &dest_bmp.pix32(sy, sx); - u8 *pri0 = &m_pri_alp_bitmap.pix8(sy, sx); + u32 *dest0 = &dest_bmp.pix(sy, sx); + u8 *pri0 = &m_pri_alp_bitmap.pix(sy, sx); const int yadv = dest_bmp.rowpixels(); const int yadvp = m_pri_alp_bitmap.rowpixels(); dy = dy * 16; @@ -2686,8 +2686,8 @@ inline void taito_f3_state::f3_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectang for (int y = sy; y < ey; y++) { const u8 *source = code_base + (y_index >> 16) * 16; - u32 *dest = &dest_bmp.pix32(y); - u8 *pri = &m_pri_alp_bitmap.pix8(y); + u32 *dest = &dest_bmp.pix(y); + u8 *pri = &m_pri_alp_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/taito_helper.cpp b/src/mame/video/taito_helper.cpp index 58c2b3a666c..6785ce576be 100644 --- a/src/mame/video/taito_helper.cpp +++ b/src/mame/video/taito_helper.cpp @@ -9,8 +9,8 @@ void taitoic_drawscanline( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask) { - u16 *dsti = &bitmap.pix16(y, x); - u8 *dstp = &priority.pix8(y, x); + u16 *dsti = &bitmap.pix(y, x); + u8 *dstp = &priority.pix(y, x); int length = cliprect.width(); src += cliprect.min_x; diff --git a/src/mame/video/taitoair.cpp b/src/mame/video/taitoair.cpp index 37ec4ac5e1e..f4953002e38 100644 --- a/src/mame/video/taitoair.cpp +++ b/src/mame/video/taitoair.cpp @@ -172,7 +172,7 @@ void taitoair_state::fill_slope(bitmap_ind16 &bitmap, const rectangle &cliprect, while (xx1 <= xx2) { - bitmap.pix16(y1, xx1) = base_color + grad_col; + bitmap.pix(y1, xx1) = base_color + grad_col; xx1++; } } @@ -396,6 +396,7 @@ u32 taitoair_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { m_tc0080vco->tilemap_update(); + // TODO: Convert TC0430GRW to device (tc0280grd.cpp) u32 counter1 = (m_tc0430grw[0] << 16) | m_tc0430grw[1]; u32 inc1x = s16(m_tc0430grw[2]); u32 inc1y = s16(m_tc0430grw[3]); diff --git a/src/mame/video/taitojc.cpp b/src/mame/video/taitojc.cpp index 382d5cfe2bf..529d0773e87 100644 --- a/src/mame/video/taitojc.cpp +++ b/src/mame/video/taitojc.cpp @@ -123,7 +123,6 @@ void taitojc_state::taitojc_char_w(offs_t offset, uint32_t data, uint32_t mem_ma void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t w1, uint32_t w2, uint8_t bank_type) { int x, y, width, height, palette; - int i, j; int x1, x2, y1, y2; int ix, iy; uint32_t address; @@ -212,11 +211,11 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, return; } - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); - for (i=x1; i < x2; i++) + for (int i=x1; i < x2; i++) { d[i] = 0x78; //TODO: black @@ -228,12 +227,12 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, } else if(!color_depth) // Densha de Go 2/2X "credit text", 4bpp { - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); int index = (iy * (width / 2)) + ix; - for (i=x1; i < x2; i+=2) + for (int i=x1; i < x2; i+=2) { uint8_t pen = (v[BYTE4_XOR_BE(index)] & 0xf0) >> 4; if (pen != 0) @@ -252,12 +251,12 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, else // 8bpp { { - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); int index = (iy * width) + ix; - for (i=x1; i < x2; i++) + for (int i=x1; i < x2; i++) { uint8_t pen = v[BYTE4_XOR_BE(index)]; if (pen != 0) diff --git a/src/mame/video/taitosj.cpp b/src/mame/video/taitosj.cpp index dd453d64d44..2987d159824 100644 --- a/src/mame/video/taitosj.cpp +++ b/src/mame/video/taitosj.cpp @@ -269,7 +269,7 @@ inline gfx_element * taitosj_state::get_sprite_gfx_element(uint8_t which) int taitosj_state::check_sprite_sprite_bitpattern(int sx1, int sy1, int which1,int sx2, int sy2, int which2) { - int x, y, minx, miny, maxx = 16, maxy = 16; + int minx, miny, maxx = 16, maxy = 16; offs_t offs1 = which1 * 4; offs_t offs2 = which2 * 4; @@ -318,10 +318,10 @@ int taitosj_state::check_sprite_sprite_bitpattern(int sx1, int sy1, int which1,i m_spriteram[SPRITE_RAM_PAGE_OFFSET + offs2 + 2] & 0x02, sx2, sy2, 0); - for (y = miny; y < maxy; y++) - for (x = minx; x < maxx; x++) - if ((m_sprite_sprite_collbitmap1.pix16(y, x) != TRANSPARENT_PEN) && - (m_sprite_sprite_collbitmap2.pix16(y, x) != TRANSPARENT_PEN)) + for (int y = miny; y < maxy; y++) + for (int x = minx; x < maxx; x++) + if ((m_sprite_sprite_collbitmap1.pix(y, x) != TRANSPARENT_PEN) && + (m_sprite_sprite_collbitmap2.pix(y, x) != TRANSPARENT_PEN)) return 1; /* collided */ return 0; @@ -439,7 +439,6 @@ void taitosj_state::calculate_sprite_areas(int *sprites_on, rectangle *sprite_ar int taitosj_state::check_sprite_layer_bitpattern(int which, rectangle *sprite_areas) { - int y, x; offs_t offs = which * 4; int result = 0; /* no collisions */ @@ -463,17 +462,17 @@ int taitosj_state::check_sprite_layer_bitpattern(int which, rectangle *sprite_ar flip_x, flip_y, 0,0,0); - for (y = miny; y < maxy; y++) - for (x = minx; x < maxx; x++) - if (m_sprite_layer_collbitmap1.pix16(y - miny, x - minx) != TRANSPARENT_PEN) /* is there anything to check for ? */ + for (int y = miny; y < maxy; y++) + for (int x = minx; x < maxx; x++) + if (m_sprite_layer_collbitmap1.pix(y - miny, x - minx) != TRANSPARENT_PEN) /* is there anything to check for ? */ { - if (check_layer_1 && (m_sprite_layer_collbitmap2[0].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_1 && (m_sprite_layer_collbitmap2[0].pix(y, x) != TRANSPARENT_PEN)) result |= 0x01; /* collided with layer 1 */ - if (check_layer_2 && (m_sprite_layer_collbitmap2[1].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_2 && (m_sprite_layer_collbitmap2[1].pix(y, x) != TRANSPARENT_PEN)) result |= 0x02; /* collided with layer 2 */ - if (check_layer_3 && (m_sprite_layer_collbitmap2[2].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_3 && (m_sprite_layer_collbitmap2[2].pix(y, x) != TRANSPARENT_PEN)) result |= 0x04; /* collided with layer 3 */ } @@ -485,10 +484,8 @@ void taitosj_state::check_sprite_layer_collision(int *sprites_on, rectangle *spr { if (SPRITES_ON) { - int which; - /* check each sprite */ - for (which = 0; which < 0x20; which++) + for (int which = 0; which < 0x20; which++) { if ((which >= 0x10) && (which <= 0x17)) continue; /* no sprites here */ diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp index 1f1aae3220d..2d77a22b2ff 100644 --- a/src/mame/video/tank8.cpp +++ b/src/mame/video/tank8.cpp @@ -195,8 +195,6 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) // on falling edge if (!state) { - int x; - int y; const rectangle &visarea = m_screen->visible_area(); m_tilemap->draw(*m_screen, m_helper1, visarea, 0, 0); @@ -207,21 +205,19 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) draw_sprites(m_helper2, visarea); draw_bullets(m_helper3, visarea); - for (y = visarea.top(); y <= visarea.bottom(); y++) + for (int y = visarea.top(); y <= visarea.bottom(); y++) { int _state = 0; - const uint16_t* p1 = &m_helper1.pix16(y); - const uint16_t* p2 = &m_helper2.pix16(y); - const uint16_t* p3 = &m_helper3.pix16(y); + uint16_t const *const p1 = &m_helper1.pix(y); + uint16_t const *const p2 = &m_helper2.pix(y); + uint16_t const *const p3 = &m_helper3.pix(y); if ((m_screen->frame_number() ^ y) & 1) continue; /* video display is interlaced */ - for (x = visarea.left(); x <= visarea.right(); x++) + for (int x = visarea.left(); x <= visarea.right(); x++) { - uint8_t index; - /* neither wall nor mine */ if ((p1[x] != 0x11) && (p1[x] != 0x13)) { @@ -246,6 +242,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) if (_state) continue; + uint8_t index; if (p3[x] != 8) { index = ((p3[x] & ~0x01) >> 1) | 0x18; diff --git a/src/mame/video/tatsumi.cpp b/src/mame/video/tatsumi.cpp index 6114e9cc8be..cf9c9272170 100644 --- a/src/mame/video/tatsumi.cpp +++ b/src/mame/video/tatsumi.cpp @@ -63,14 +63,14 @@ void tatsumi_state::apply_shadow_bitmap(bitmap_rgb32 &bitmap, const rectangle &c { for(int x=cliprect.min_x;x<cliprect.max_x;x++) { - uint8_t shadow = shadow_bitmap.pix8(y, x); + uint8_t shadow = shadow_bitmap.pix(y, x); // xor_output is enabled during Chen boss fight (where shadows have more brightness than everything else) // TODO: transition before fighting him should also black out all the background tilemaps too!? // (more evidence that we need to mix with color bank 0x1400 instead of doing true RGB mixing). if(shadow ^ xor_output) { - rgb_t shadow_pen = bitmap.pix32(y, x); - bitmap.pix32(y, x) = rgb_t(shadow_pen.r() >> 1,shadow_pen.g() >> 1, shadow_pen.b() >> 1); + rgb_t shadow_pen = bitmap.pix(y, x); + bitmap.pix(y, x) = rgb_t(shadow_pen.r() >> 1,shadow_pen.g() >> 1, shadow_pen.b() >> 1); } } } @@ -96,8 +96,6 @@ inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, co gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy, int scalex, int scaley, int rotate, int write_priority_only ) { - rectangle myclip; - if (!scalex || !scaley) return; /* @@ -108,215 +106,194 @@ inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, co */ /* KW 991012 -- Added code to force clip to bitmap boundary */ - myclip = clip; + rectangle myclip = clip; myclip &= dest_bmp.cliprect(); + if( gfx ) { - if( gfx ) + const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); + const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors())); + const uint8_t *code_base = gfx->get_data(code % gfx->elements()); + + int block_size = 8 * scalex; + int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; + int sprite_screen_width = ((ssx&0xffff)+block_size)>>16; + + if (sprite_screen_width && sprite_screen_height) { - const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); - const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors())); - const uint8_t *code_base = gfx->get_data(code % gfx->elements()); + /* compute sprite increment per screen pixel */ + int dx = (gfx->width()<<16)/sprite_screen_width; + int dy = (gfx->height()<<16)/sprite_screen_height; + + int sx;//=ssx>>16; + int sy;//=ssy>>16; - int block_size = 8 * scalex; - int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; - int sprite_screen_width = ((ssx&0xffff)+block_size)>>16; - if (sprite_screen_width && sprite_screen_height) +// int ex = sx+sprite_screen_width; +// int ey = sy+sprite_screen_height; + + int incxx=0x10000;//(int)((float)dx * cos(theta)); +// int incxy=0x0;//(int)((float)dy * -sin(theta)); + int incyx=0x0;//(int)((float)dx * sin(theta)); +// int incyy=0x10000;//(int)((float)dy * cos(theta)); + + if (flipx) { - /* compute sprite increment per screen pixel */ - int dx = (gfx->width()<<16)/sprite_screen_width; - int dy = (gfx->height()<<16)/sprite_screen_height; + } - int sx;//=ssx>>16; - int sy;//=ssy>>16; + if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16; + if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16; + int ex = sx+sprite_screen_width; + int ey = sy+sprite_screen_height; + int x_index_base; + if( flipx ) + { + x_index_base = (sprite_screen_width-1)*dx; + dx = -dx; + incxx=-incxx; + incyx=-incyx; + } + else + { + x_index_base = 0; + } -// int ex = sx+sprite_screen_width; -// int ey = sy+sprite_screen_height; + int y_index; + if( flipy ) + { + y_index = (sprite_screen_height-1)*dy; + dy = -dy; + } + else + { + y_index = 0; + } - int x_index_base; - int y_index; - int ex,ey; + if( sx < myclip.min_x) + { /* clip left */ + int pixels = myclip.min_x-sx; + sx += pixels; + x_index_base += pixels*dx; + } + if( sy < myclip.min_y ) + { /* clip top */ + int pixels = myclip.min_y-sy; + sy += pixels; + y_index += pixels*dy; + } + /* NS 980211 - fixed incorrect clipping */ + if( ex > myclip.max_x+1 ) + { /* clip right */ + int pixels = ex-myclip.max_x-1; + ex -= pixels; + } + if( ey > myclip.max_y+1 ) + { /* clip bottom */ + int pixels = ey-myclip.max_y-1; + ey -= pixels; + } - int incxx=0x10000;//(int)((float)dx * cos(theta)); -// int incxy=0x0;//(int)((float)dy * -sin(theta)); - int incyx=0x0;//(int)((float)dx * sin(theta)); -// int incyy=0x10000;//(int)((float)dy * cos(theta)); + if( ex>sx ) + { /* skip if inner loop doesn't draw anything */ +#if 0 + int startx=0; + int starty=0; - if (flipx) - { - } +// int incxx=0x10000; +// int incxy=0; +// int incyx=0; +// int incyy=0x10000; + double theta=rotate * ((2.0 * M_PI)/512.0); + double c=cos(theta); + double s=sin(theta); - if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16; - if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16; - ex = sx+sprite_screen_width; - ey = sy+sprite_screen_height; - if( flipx ) - { - x_index_base = (sprite_screen_width-1)*dx; - dx = -dx; - incxx=-incxx; - incyx=-incyx; - } - else + // if (ey-sy > 0) + // dy=dy / (ey-sy); { - x_index_base = 0; - } + float angleAsRadians=(float)rotate * (7.28f / 512.0f); + //float ccx = cosf(angleAsRadians); + //float ccy = sinf(angleAsRadians); + float a=0; - if( flipy ) - { - y_index = (sprite_screen_height-1)*dy; - dy = -dy; - } - else - { - y_index = 0; } - if( sx < myclip.min_x) - { /* clip left */ - int pixels = myclip.min_x-sx; - sx += pixels; - x_index_base += pixels*dx; - } - if( sy < myclip.min_y ) - { /* clip top */ - int pixels = myclip.min_y-sy; - sy += pixels; - y_index += pixels*dy; - } - /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) - { /* clip right */ - int pixels = ex-myclip.max_x-1; - ex -= pixels; - } - if( ey > myclip.max_y+1 ) - { /* clip bottom */ - int pixels = ey-myclip.max_y-1; - ey -= pixels; - } + for( int y=sy; y<ey; y++ ) + { + uint32_t *const dest = &dest_bmp.pix(y); + int cx = startx; + int cy = starty; - if( ex>sx ) - { /* skip if inner loop doesn't draw anything */ - int y; -#if 0 + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { + const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes(); + int c = source[(cx >> 16)]; + if( c != transparent_color ) { - int startx=0; - int starty=0; - -// int incxx=0x10000; -// int incxy=0; -// int incyx=0; -// int incyy=0x10000; - double theta=rotate * ((2.0 * M_PI)/512.0); - double c=cos(theta); - double s=sin(theta); - - - // if (ey-sy > 0) - // dy=dy / (ey-sy); - { - float angleAsRadians=(float)rotate * (7.28f / 512.0f); - //float ccx = cosf(angleAsRadians); - //float ccy = sinf(angleAsRadians); - float a=0; - - } - - for( y=sy; y<ey; y++ ) - { - uint32_t *dest = &dest_bmp.pix32(y); - int cx = startx; - int cy = starty; - - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) - { - const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes(); - int c = source[(cx >> 16)]; - if( c != transparent_color ) - { - if (write_priority_only) - dest[x]=shadow_pens[c]; - else - dest[x]=pal[c]; - } - cx += incxx; - cy += incxy; - } - startx += incyx; - starty += incyy; - } + if (write_priority_only) + dest[x]=shadow_pens[c]; + else + dest[x]=pal[c]; } + cx += incxx; + cy += incxy; } + startx += incyx; + starty += incyy; + } #endif #if 1 // old + for( int y=sy; y<ey; y++ ) + { + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + typename BitmapClass::pixel_t *const dest = &dest_bmp.pix(y); + + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { + int c = source[x_index>>16]; + if( c ) { - for( y=sy; y<ey; y++ ) - { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - typename BitmapClass::pixel_t *dest = &dest_bmp.pix(y); - - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) - { - int c = source[x_index>>16]; - if( c ) - { - // Only draw shadow pens if writing priority buffer - if (write_priority_only) - dest[x]=shadow_pens[c]; - else if (!shadow_pens[c]) - dest[x]=pal[c]; - } - x_index += dx; - } - - y_index += dy; - } + // Only draw shadow pens if writing priority buffer + if (write_priority_only) + dest[x]=shadow_pens[c]; + else if (!shadow_pens[c]) + dest[x]=pal[c]; } + x_index += dx; } -#endif + + y_index += dy; } +#endif } } } } -static void mycopyrozbitmap_core(bitmap_ind8 &bitmap,bitmap_rgb32 &srcbitmap, +static void mycopyrozbitmap_core(bitmap_ind8 &bitmap, const bitmap_rgb32 &srcbitmap, int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy, const rectangle &clip, int transparent_color) { } -static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, +static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap, const bitmap_rgb32 &srcbitmap, int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy, const rectangle &clip, int transparent_color) { - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; // const int xmask = srcbitmap.width()-1; // const int ymask = srcbitmap.height()-1; const int widthshifted = srcwidth << 16; const int heightshifted = srcheight << 16; - uint32_t *dest; uint32_t startx=0; uint32_t starty=0; - sx = dstx; - sy = dsty; - ex = dstx + srcwidth; - ey = dsty + srcheight; + int sx = dstx; + int sy = dsty; + int ex = dstx + srcwidth; + int ey = dsty + srcheight; if (sx<clip.min_x) sx=clip.min_x; if (ex>clip.max_x) ex=clip.max_x; @@ -327,16 +304,16 @@ static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, { while (sy <= ey) { - x = sx; - cx = startx; - cy = starty; - dest = &bitmap.pix32(sy, sx); + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; + uint32_t *dest = &bitmap.pix(sy, sx); while (x <= ex) { if (cx < widthshifted && cy < heightshifted) { - int c = srcbitmap.pix32(cy >> 16, cx >> 16); + int c = srcbitmap.pix(cy >> 16, cx >> 16); if (c != transparent_color) *dest = c; @@ -357,17 +334,8 @@ static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, template<class BitmapClass> void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank) { - int offs, flip_x, flip_y, x, y, color; - int w, h, index, lines, scale, rotate; - uint8_t *src1, *src2; - - int y_offset; - - int render_x, render_y; - int extent_x, extent_y; - // Sprite data is double buffered - for (offs = rambank;offs < rambank + 0x800;offs += 6) + for (int offs = rambank;offs < rambank + 0x800;offs += 6) { /* Sprite RAM itself uses an index into two ROM tables to actually draw the object. @@ -401,15 +369,15 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, Bytes 2/3: Tile index to start fetching tiles from (increments per tile). */ - y = m_spriteram[offs+3]; - x = m_spriteram[offs+2]; - scale = m_spriteram[offs+4] & 0x1ff; - color = m_spriteram[offs+1] >> 3 & 0x1ff; - flip_x = m_spriteram[offs+1] & 0x8000; - flip_y = m_spriteram[offs+1] & 0x4000; - rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now + int y = m_spriteram[offs+3]; + int x = m_spriteram[offs+2]; + int scale = m_spriteram[offs+4] & 0x1ff; + int color = m_spriteram[offs+1] >> 3 & 0x1ff; + int flip_x = m_spriteram[offs+1] & 0x8000; + int flip_y = m_spriteram[offs+1] & 0x4000; + int rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now - index = m_spriteram[offs]; + int index = m_spriteram[offs]; // if (m_spriteram[offs+1]&0x7) // color=machine().rand()%0xff; @@ -421,16 +389,16 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, if (index >= 0x4000) continue; - src1 = m_rom_sprite_lookup[0] + (index * 4); - src2 = m_rom_sprite_lookup[1] + (index * 4); + uint8_t const *src1 = m_rom_sprite_lookup[0] + (index * 4); + uint8_t const *src2 = m_rom_sprite_lookup[1] + (index * 4); - lines = src1[2]; - y_offset = src1[0]&0xf8; + int lines = src1[2]; + int y_offset = src1[0]&0xf8; lines -= y_offset; - render_x = x << 16; - render_y = y << 16; + int render_x = x << 16; + int render_y = y << 16; scale = scale << 9; /* 0x80 becomes 0x10000 */ if (flip_y) @@ -444,10 +412,10 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, m_temp_bitmap.fill(0); } - extent_x = extent_y = 0; + int extent_x = 0, extent_y = 0; src1 += 4; - h = 0; + int h = 0; while (lines > 0) { int base, x_offs, x_width, x_pos, draw_this_line = 1; @@ -478,7 +446,7 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, else x_pos = x_offs; - for (w = 0; w < x_width; w++) { + for (int w = 0; w < x_width; w++) { if (rotate) roundupt_drawgfxzoomrotate( m_temp_bitmap,cliprect,m_gfxdecode->gfx(0), @@ -550,10 +518,9 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, void tatsumi_state::update_cluts(int fake_palette_offset, int object_base, int length) { - int i; const uint8_t* bank1 = m_rom_clut[0]; const uint8_t* bank2 = m_rom_clut[1]; - for (i=0; i<length; i+=8) + for (int i=0; i<length; i+=8) { m_palette->set_pen_color(fake_palette_offset+i+0,m_palette->pen_color(bank1[1]+object_base)); m_shadow_pen_array[i+0]=(bank1[1]==255); @@ -598,22 +565,20 @@ void apache3_state::apache3_road_x_w(offs_t offset, uint8_t data) void apache3_state::draw_sky(bitmap_rgb32 &bitmap,const rectangle &cliprect, int palette_base, int start_offset) { - // all todo - int x,y; - + // all TODO if (start_offset&0x8000) start_offset=-(0x10000 - start_offset); start_offset=-start_offset; start_offset-=48; - for (y=0; y<256; y++) { - for (x=0; x<320; x++) { + for (int y=0; y<256; y++) { + for (int x=0; x<320; x++) { int col=palette_base + y + start_offset; if (col<palette_base) col=palette_base; if (col>palette_base+127) col=palette_base+127; - bitmap.pix32(y, x) = m_palette->pen(col); + bitmap.pix(y, x) = m_palette->pen(col); } } } @@ -623,12 +588,10 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) { if (0) { - int x, y; - uint16_t gva = 0x180; // TODO uint8_t sky_val = m_apache3_rotate_ctrl[1] & 0xff; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint16_t rgdb = 0;//m_apache3_road_x_ram[gva & 0xff]; uint16_t gha = 0xf60; // test @@ -637,9 +600,9 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) if (gva & 0x100) { /* Sky */ - for (x = cliprect.min_x; x <= cliprect.max_x; ++x) + for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - dst.pix32(y, x) = m_palette->pen(0x100 + (sky_val & 0x7f)); + dst.pix(y, x) = m_palette->pen(0x100 + (sky_val & 0x7f)); /* Update horizontal counter? */ gha = (gha + 1) & 0xfff; @@ -648,28 +611,23 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) else { /* Ground */ - for (x = cliprect.min_x; x <= cliprect.max_x; ++x) + for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - uint8_t colour; - uint16_t hval; - uint8_t pixels; - int pix_sel; - - hval = (rgdb + gha) & 0xfff; // Not quite + uint16_t hval = (rgdb + gha) & 0xfff; // Not quite if (hval & 0x800) hval ^= 0x1ff; // TEST //else //hval = hval; - pixels = m_apache3_g_ram[(((gva & 0xff) << 7) | ((hval >> 2) & 0x7f))]; - pix_sel = hval & 3; + uint8_t pixels = m_apache3_g_ram[(((gva & 0xff) << 7) | ((hval >> 2) & 0x7f))]; + int pix_sel = hval & 3; - colour = (pixels >> (pix_sel << 1)) & 3; + uint8_t colour = (pixels >> (pix_sel << 1)) & 3; colour = (BIT(hval, 11) << 4) | (colour << 2) | ln; /* Draw the pixel */ - dst.pix32(y, x) = m_palette->pen(0x200 + colour); + dst.pix(y, x) = m_palette->pen(0x200 + colour); /* Update horizontal counter */ gha = (gha + 1) & 0xfff; @@ -823,8 +781,6 @@ pos is 11.5 fixed point 0x80 */ - int y,x; - int visible_line=0; const uint16_t *data = m_road_ctrl_ram; // Road layer enable (?) @@ -836,12 +792,12 @@ pos is 11.5 fixed point data+=0x400; // Apply clipping: global screen + local road y offsets - y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); + int y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); data+=y*4; - visible_line=0; + int visible_line=0; - for (/*y=0*/; y<cliprect.max_y+1; y++) + for ( ; y<cliprect.max_y+1; y++) { // TODO: tunnels road drawing has a different format? // shift is always 0x88** while data[3] is a variable argument with bit 15 always on @@ -850,7 +806,7 @@ pos is 11.5 fixed point int pal = 4; //(data[3]>>8)&0xf; int step=((data[1]&0xff)<<8)|((data[1]&0xff00)>>8); int samplePos=0; - const uint16_t* linedata=m_road_pixel_ram;// + (0x100 * pal); + uint16_t const *const linedata=m_road_pixel_ram;// + (0x100 * pal); int startPos=0, endPos=0; int palette_byte;//=m_road_color_ram[visible_line/8]; @@ -890,11 +846,13 @@ offset is from last pixel of first road segment? if (step) startPos=((shift<<8) + 0x80 )/ step; + int x; + /* Fill in left of road segment */ for (x=0; (x < startPos) && (x < cliprect.max_x+1); x++) { int col = linedata[0]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col); } /* If startpos is negative, clip it and adjust the sampling position accordingly */ @@ -918,7 +876,7 @@ offset is from last pixel of first road segment? //if ((samplePos>>11) > 0x7f) // col=linedata[0x7f]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col); samplePos+=step; } @@ -946,7 +904,7 @@ offset is from last pixel of first road segment? //if ((samplePos>>11) > 0x7f) // col=linedata[0x7f]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col + 32); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col + 32); } if (endPos<0) @@ -974,7 +932,7 @@ offset is from last pixel of first road segment? if ((samplePos>>11) > 0x7f) col=linedata[0x7f + 0x200]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col + 32); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col + 32); samplePos+=step; } @@ -1016,10 +974,9 @@ void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &clipr color &= 0xf; if(cliprect.contains(x, y+y_scroll) && color) - bitmap.pix32(y+y_scroll, x) = m_palette->pen(color+color_base); + bitmap.pix(y+y_scroll, x) = m_palette->pen(color+color_base); } } - } uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/taxidriv.cpp b/src/mame/video/taxidriv.cpp index 148e133c12e..ddf06c509a5 100644 --- a/src/mame/video/taxidriv.cpp +++ b/src/mame/video/taxidriv.cpp @@ -13,10 +13,6 @@ void taxidriv_state::spritectrl_w(offs_t offset, uint8_t data) uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - int sx,sy; - - if (m_bghide) { bitmap.fill(0, cliprect); @@ -28,10 +24,10 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } else { - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(3)->opaque(bitmap,cliprect, m_vram3[offs], @@ -40,10 +36,10 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm (sx*8-m_scroll[0])&0xff,(sy*8-m_scroll[1])&0xff); } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, m_vram2[offs]+256*m_vram2[offs+0x400], @@ -54,62 +50,56 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (m_spritectrl[2] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; - - sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff; + int sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff; - color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } if (m_spritectrl[5] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; + int sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff; - sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff; - - color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } if (m_spritectrl[8] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; - - sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff; + int sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff; - color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, m_vram1[offs], @@ -118,25 +108,23 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm sx*8,sy*8,0); } - for (offs = 0;offs < 0x2000;offs++) + for (int offs = 0;offs < 0x2000;offs++) { - int color; - - sx = (offs/2) % 64; - sy = (offs/2) / 64; + int sx = (offs/2) % 64; + int sy = (offs/2) / 64; - color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03; if (color) { - bitmap.pix16(sy, sx) = 2 * color; + bitmap.pix(sy, sx) = 2 * color; } } } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, m_vram0[offs], diff --git a/src/mame/video/tc0080vco.cpp b/src/mame/video/tc0080vco.cpp index 7c56dd25701..91726187a2d 100644 --- a/src/mame/video/tc0080vco.cpp +++ b/src/mame/video/tc0080vco.cpp @@ -603,8 +603,8 @@ void tc0080vco_device::bg0_tilemap_draw(screen_device &screen, bitmap_ind16 &bit int x_index = sx - ((m_bgscroll_ram[row_index] << 16)); - u16 *src16 = &srcbitmap.pix16(src_y_index); - u8 *tsrc = &flagsbitmap.pix8(src_y_index); + u16 const *src16 = &srcbitmap.pix(src_y_index); + u8 const *tsrc = &flagsbitmap.pix(src_y_index); u16 *dst16 = scanline; int x_step = zoomx; diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index 2417b1146e1..3fa49244a91 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -630,7 +630,7 @@ void tc0100scn_base_device::tilemap_update() void tc0100scn_base_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u8 priority, u8 pmask ) { const bitmap_ind16 &src_bitmap = tmap->pixmap(); - int width_mask, height_mask, x, y, p; + int width_mask, height_mask; int column_offset, src_x = 0, src_y = 0; int scrollx_delta = - tmap->scrolldx(); int scrolly_delta = - tmap->scrolldy(); @@ -646,24 +646,24 @@ void tc0100scn_base_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 src_y += cliprect.top(); // Row offsets are 'screen space' 0-255 regardless of Y scroll - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { src_x = (m_fgscrollx - m_fgscroll_ram[(y + scrolly_delta) & 0x1ff] + scrollx_delta + cliprect.min_x) & width_mask; if (m_ctrl[0x7] & 1) // Flipscreen src_x = (256 - 64 - src_x) & width_mask; // Col offsets are 'tilemap' space 0-511, and apply to blocks of 8 pixels at once - for (x = 0; x < cliprect.width(); x++) + for (int x = 0; x < cliprect.width(); x++) { column_offset = m_colscroll_ram[(src_x & 0x3ff) / 8]; - p = src_bitmap.pix16((src_y - column_offset) & height_mask, src_x); + int p = src_bitmap.pix((src_y - column_offset) & height_mask, src_x); if ((p & 0xf)!= 0 || (flags & TILEMAP_DRAW_OPAQUE)) { - bitmap.pix16(y, x + cliprect.min_x) = p; + bitmap.pix(y, x + cliprect.min_x) = p; if (screen.priority().valid()) { - u8 *pri = &screen.priority().pix8(y); + u8 *pri = &screen.priority().pix(y); pri[x + cliprect.min_x] = (pri[x + cliprect.min_x] & pmask) | priority; } } diff --git a/src/mame/video/tc0180vcu.cpp b/src/mame/video/tc0180vcu.cpp index fb3df9474de..db1a846e134 100644 --- a/src/mame/video/tc0180vcu.cpp +++ b/src/mame/video/tc0180vcu.cpp @@ -285,7 +285,7 @@ uint16_t tc0180vcu_device::framebuffer_word_r(offs_t offset) int sy = offset >> 8; int sx = 2 * (offset & 0xff); - return (m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 0) << 8) | m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 1); + return (m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 0) << 8) | m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 1); } void tc0180vcu_device::framebuffer_word_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -294,9 +294,9 @@ void tc0180vcu_device::framebuffer_word_w(offs_t offset, uint16_t data, uint16_t int sx = 2 * (offset & 0xff); if (ACCESSING_BITS_8_15) - m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 0) = data >> 8; + m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 0) = data >> 8; if (ACCESSING_BITS_0_7) - m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 1) = data & 0xff; + m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 1) = data & 0xff; } TILE_GET_INFO_MEMBER(tc0180vcu_device::get_bg_tile_info) @@ -521,7 +521,6 @@ void tc0180vcu_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip void tc0180vcu_device::draw_framebuffer( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { rectangle myclip = cliprect; - int x, y; g_profiler.start(PROFILER_USER1); @@ -538,14 +537,12 @@ g_profiler.start(PROFILER_USER1); if (m_video_control & 0x10) /*flip screen*/ { /*popmessage("1. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst; + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(bitmap.height()-1-y, myclip.max_x); - dst = &bitmap.pix16(bitmap.height()-1-y, myclip.max_x); - - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -558,12 +555,12 @@ g_profiler.start(PROFILER_USER1); } else { - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst = &bitmap.pix16(y, myclip.min_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(y, myclip.min_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -580,14 +577,12 @@ g_profiler.start(PROFILER_USER1); if (m_video_control & 0x10) /*flip screen*/ { /*popmessage("3. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ - for (y = myclip.min_y ;y <= myclip.max_y; y++) + for (int y = myclip.min_y ;y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst; - - dst = &bitmap.pix16(bitmap.height()-1-y, myclip.max_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(bitmap.height()-1-y, myclip.max_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -600,12 +595,12 @@ g_profiler.start(PROFILER_USER1); } else { - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst = &bitmap.pix16(y, myclip.min_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(y, myclip.min_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; diff --git a/src/mame/video/tc0480scp.cpp b/src/mame/video/tc0480scp.cpp index d3914e0c4f9..081f918cc2e 100644 --- a/src/mame/video/tc0480scp.cpp +++ b/src/mame/video/tc0480scp.cpp @@ -623,15 +623,12 @@ void tc0480scp_device::bg01_draw(screen_device &screen, bitmap_ind16 &bitmap, co } else /* zoom */ { - u16 *dst16, *src16; - u8 *tsrc; u16 scanline[512]; u32 sx; - bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); + const bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); int flip = m_pri_reg & 0x40; - int y_index, src_y_index, row_index; - int x_index, x_step; + int y_index; u16 screen_width = 512; //cliprect.width(); u16 min_y = cliprect.min_y; @@ -660,20 +657,20 @@ void tc0480scp_device::bg01_draw(screen_device &screen, bitmap_ind16 &bitmap, co for (int y = min_y; y <= max_y; y++) { - src_y_index = (y_index >> 16) & 0x1ff; + int src_y_index = (y_index >> 16) & 0x1ff; /* row areas are the same in flipscreen, so we must read in reverse */ - row_index = src_y_index; + int row_index = src_y_index; if (flip) row_index = 0x1ff - row_index; - x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); + int x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + const u16 *src16 = &srcbitmap.pix(src_y_index); + const u8 *tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; - x_step = zoomx; + int x_step = zoomx; if (flags & TILEMAP_DRAW_OPAQUE) { @@ -744,10 +741,8 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); - u16 *dst16, *src16; - u8 *tsrc; - int y_index, src_y_index, row_index, row_zoom; - int sx, x_index, x_step; + int y_index; + int sx; u32 zoomx, zoomy; u16 scanline[512]; int flipscreen = m_pri_reg & 0x40; @@ -786,29 +781,31 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co for (int y = min_y; y <= max_y; y++) { + int src_y_index; if (!flipscreen) src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][(y - m_y_offset) & 0x1ff]) & 0x1ff; else /* colscroll area is back to front in flipscreen */ src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][0x1ff - ((y - m_y_offset) & 0x1ff)]) & 0x1ff; /* row areas are the same in flipscreen, so we must read in reverse */ - row_index = src_y_index; + int row_index = src_y_index; if (flipscreen) row_index = 0x1ff - row_index; + int row_zoom; if (m_pri_reg & (layer - 1)) /* bit0 enables for BG2, bit1 for BG3 */ row_zoom = m_rowzoom_ram[layer][row_index]; else row_zoom = 0; - x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); + int x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); /* flawed calc ?? */ x_index -= (m_x_offset - 0x1f + layer * 4) * ((row_zoom & 0xff) << 8); /* We used to kludge 270 multiply factor, before adjusting x_index instead */ - x_step = zoomx; + int x_step = zoomx; if (row_zoom) /* need to reduce x_step */ { if (!(row_zoom & 0xff00)) @@ -817,9 +814,9 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co x_step -= (((row_zoom & 0xff) * 256) & 0xffff); } - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + const u16 *src16 = &srcbitmap.pix(src_y_index); + const u8 *tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) { diff --git a/src/mame/video/tc0780fpa.cpp b/src/mame/video/tc0780fpa.cpp index 046a03f8750..3cc9da0d271 100644 --- a/src/mame/video/tc0780fpa.cpp +++ b/src/mame/video/tc0780fpa.cpp @@ -52,8 +52,8 @@ void tc0780fpa_renderer::render_solid_scan(int32_t scanline, const extent_t &ext float z = extent.param[0].start; int color = extent.param[1].start; float dz = extent.param[0].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -75,8 +75,8 @@ void tc0780fpa_renderer::render_shade_scan(int32_t scanline, const extent_t &ext float color = extent.param[1].start; float dz = extent.param[0].dpdx; float dcolor = extent.param[1].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -104,8 +104,8 @@ void tc0780fpa_renderer::render_texture_scan(int32_t scanline, const extent_t &e float du = extent.param[1].dpdx; float dv = extent.param[2].dpdx; float dcolor = extent.param[3].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); int tex_wrap_x = extradata.tex_wrap_x; int tex_wrap_y = extradata.tex_wrap_y; int tex_base_x = extradata.tex_base_x; diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp index 063d0f09a12..912b0078101 100644 --- a/src/mame/video/tceptor.cpp +++ b/src/mame/video/tceptor.cpp @@ -485,13 +485,11 @@ void tceptor_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* if SPR_MASK_COLOR pen is used, restore pixels from previous bitmap */ if (need_mask) { - int x, y; - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - if (m_palette->pen_indirect(bitmap.pix16(y, x)) == SPR_MASK_COLOR) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + if (m_palette->pen_indirect(bitmap.pix(y, x)) == SPR_MASK_COLOR) // restore pixel - bitmap.pix16(y, x) = m_temp_bitmap.pix16(y, x); + bitmap.pix(y, x) = m_temp_bitmap.pix(y, x); } } diff --git a/src/mame/video/tecmo_mix.cpp b/src/mame/video/tecmo_mix.cpp index abcdbca4017..ea40b7c9550 100644 --- a/src/mame/video/tecmo_mix.cpp +++ b/src/mame/video/tecmo_mix.cpp @@ -72,20 +72,17 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, //int frame = (screen.frame_number()) & 1; // note this game has no tx layer, comments relate to other drivers - int y, x; - const pen_t *paldata = palette.pens(); + pen_t const *const paldata = palette.pens(); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dd = &bitmap.pix32(y); - uint16_t *sd2 = &bitmap_sp->pix16(y); - uint16_t *fg = &bitmap_fg->pix16(y); - uint16_t *bg = &bitmap_bg->pix16(y); - uint16_t *tx = nullptr; - if (bitmap_tx != nullptr) - tx = &bitmap_tx->pix16(y); - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + uint32_t *const dd = &bitmap.pix(y); + uint16_t *const sd2 = &bitmap_sp->pix(y); + uint16_t *const fg = &bitmap_fg->pix(y); + uint16_t *const bg = &bitmap_bg->pix(y); + uint16_t *const tx = bitmap_tx ? &bitmap_tx->pix(y) : nullptr; + + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t sprpixel = (sd2[x]); diff --git a/src/mame/video/tecmosys.cpp b/src/mame/video/tecmosys.cpp index b2ef9b96da4..f51d8749d4d 100644 --- a/src/mame/video/tecmosys.cpp +++ b/src/mame/video/tecmosys.cpp @@ -130,7 +130,7 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext else ressy = ycnt; const u32 srcoffs = address + (ressy * xsize); - u16* dstptr = &m_sprite_bitmap.pix16(drawy); + u16 *const dstptr = &m_sprite_bitmap.pix(drawy); for (int drawx = drawx_base, xcnt = srcx; (drawx <= cliprect.max_x) && (xcnt < xsize); xcnt++, drawx++) { @@ -184,7 +184,7 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext else ressy = ycnt; const u32 srcoffs = address + (ressy * xsize); - u16* dstptr = &m_sprite_bitmap.pix16(drawy >> 8); + u16 *const dstptr = &m_sprite_bitmap.pix(drawy >> 8); for (int drawx = drawx_base, xcnt = srcx; (drawx < scaled_cliprect.max_x) && (xcnt < xsize); xcnt++, drawx += zoomx) { @@ -204,17 +204,14 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext void tecmosys_state::tilemap_copy_to_compose(u16 pri, const rectangle &cliprect) { - int y,x; - u16 *srcptr; - u16 *dstptr; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - srcptr = &m_tmp_tilemap_renderbitmap.pix16(y); - dstptr = &m_tmp_tilemap_composebitmap.pix16(y); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + u16 const *const srcptr = &m_tmp_tilemap_renderbitmap.pix(y); + u16 *const dstptr = &m_tmp_tilemap_composebitmap.pix(y); + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { if ((srcptr[x]&0xf)!=0x0) - dstptr[x] = (srcptr[x]&0x7ff) | pri; + dstptr[x] = (srcptr[x]&0x7ff) | pri; } } } @@ -226,10 +223,10 @@ void tecmosys_state::do_final_mix(bitmap_rgb32 &bitmap, const rectangle &cliprec for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - u16 const *const srcptr = &m_tmp_tilemap_composebitmap.pix16(y); - u16 const *const srcptr2 = &m_sprite_bitmap.pix16(y); + u16 const *const srcptr = &m_tmp_tilemap_composebitmap.pix(y); + u16 const *const srcptr2 = &m_sprite_bitmap.pix(y); - u32 *const dstptr = &bitmap.pix32(y); + u32 *const dstptr = &bitmap.pix(y); for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { u16 const pri = srcptr[x] & 0xc000; diff --git a/src/mame/video/thief.cpp b/src/mame/video/thief.cpp index 25fdb7e1e71..1a16e5b6bf4 100644 --- a/src/mame/video/thief.cpp +++ b/src/mame/video/thief.cpp @@ -101,10 +101,8 @@ void thief_state::video_start(){ } uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ - uint8_t *videoram = m_videoram.get(); - uint32_t offs; int flipscreen = m_video_control&1; - const uint8_t *source = videoram; + const uint8_t *source = m_videoram.get(); if (m_tms->screen_reset()) { @@ -115,17 +113,16 @@ uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &b if( m_video_control&4 ) /* visible page */ source += 0x2000*4; - for( offs=0; offs<0x2000; offs++ ){ + for( uint32_t offs=0; offs<0x2000; offs++ ){ int ypos = offs/32; int xpos = (offs%32)*8; int plane0 = source[0x2000*0+offs]; int plane1 = source[0x2000*1+offs]; int plane2 = source[0x2000*2+offs]; int plane3 = source[0x2000*3+offs]; - int bit; if( flipscreen ){ - for( bit=0; bit<8; bit++ ){ - bitmap.pix16(0xff - ypos, 0xff - (xpos+bit)) = + for( int bit=0; bit<8; bit++ ){ + bitmap.pix(0xff - ypos, 0xff - (xpos+bit)) = (((plane0<<bit)&0x80)>>7) | (((plane1<<bit)&0x80)>>6) | (((plane2<<bit)&0x80)>>5) | @@ -133,8 +130,8 @@ uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &b } } else { - for( bit=0; bit<8; bit++ ){ - bitmap.pix16(ypos, xpos+bit) = + for( int bit=0; bit<8; bit++ ){ + bitmap.pix(ypos, xpos+bit) = (((plane0<<bit)&0x80)>>7) | (((plane1<<bit)&0x80)>>6) | (((plane2<<bit)&0x80)>>5) | diff --git a/src/mame/video/thunderj.cpp b/src/mame/video/thunderj.cpp index e5628e9a555..db6dc0fc7ff 100644 --- a/src/mame/video/thunderj.cpp +++ b/src/mame/video/thunderj.cpp @@ -120,9 +120,9 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -184,19 +184,19 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in * +MPX0*!CS1*CS0 * +!CS1*!CS0*APIX0 */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - int pfm = 0; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) continue; /* determine pf/m signal */ + int pfm = 0; if ((mo[x] & 0xff) == 1) pfm = 1; else if (pf[x] & 8) { - int pfpriority = (pri[x] & 0x80) ? ((pri[x] >> 2) & 3) : (pri[x] & 3); + int const pfpriority = (pri[x] & 0x80) ? ((pri[x] >> 2) & 3) : (pri[x] & 3); if (((pfpriority == 3) && !(mopriority & 1)) || ((pfpriority & 1) && (mopriority == 0)) || ((pfpriority & 2) && !(mopriority & 2))) @@ -218,12 +218,12 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/ti85.cpp b/src/mame/video/ti85.cpp index 65a9697d431..8bdf1283dec 100644 --- a/src/mame/video/ti85.cpp +++ b/src/mame/video/ti85.cpp @@ -145,39 +145,36 @@ void ti85_state::video_start() uint32_t ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space &space = m_maincpu->space(AS_PROGRAM); - int x,y,b; - int brightnes; - int lcdmem; if (!m_LCD_status || !m_timer_interrupt_mask) { - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) - for (b=0; b<8; b++) - bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6]; + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) + for (int b=0; b<8; b++) + bitmap.pix(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6]; return 0; } - lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; + int lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; memcpy (m_frames.get(), m_frames.get()+m_ti_video_memory_size, sizeof (uint8_t) * (m_ti_number_of_frames-1) * m_ti_video_memory_size); - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) *(m_frames.get()+(m_ti_number_of_frames-1)*m_ti_video_memory_size+y*m_ti_screen_x_size+x) = space.read_byte(lcdmem+y*m_ti_screen_x_size+x); - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) - for (b=0; b<8; b++) + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) + for (int b=0; b<8; b++) { - brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + int brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); - bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes]; + bitmap.pix(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes]; } return 0; } diff --git a/src/mame/video/tia.cpp b/src/mame/video/tia.cpp index d3c939aa5b7..36ee0175fbc 100644 --- a/src/mame/video/tia.cpp +++ b/src/mame/video/tia.cpp @@ -701,9 +701,6 @@ void tia_video_device::setup_pXgfx(void) void tia_video_device::update_bitmap(int next_x, int next_y) { - int x; - int y; - uint8_t linePF[160]; uint8_t lineP0[160]; uint8_t lineP1[160]; @@ -753,16 +750,14 @@ void tia_video_device::update_bitmap(int next_x, int next_y) } } - for (y = prev_y; y <= next_y; y++) + for (int y = prev_y; y <= next_y; y++) { - uint16_t* p; - int x1 = prev_x; int x2 = next_x; int colx1; /* Check if we have crossed a line boundary */ - if ( y != prev_y ) { + if (y != prev_y ) { int redraw_line = 0; HMOVE_started_previous = HMOVE_INACTIVE; @@ -952,19 +947,18 @@ void tia_video_device::update_bitmap(int next_x, int next_y) if (collision_check(lineM0, lineM1, colx1, x2)) CXPPMM |= 0x40; - p = &helper[current_bitmap].pix16(y % screen_height, 34); + uint16_t *p = &helper[current_bitmap].pix(y % screen_height, 34); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { p[x] = temp[x]; } if ( x2 == 160 && y % screen_height == (screen_height - 1) ) { - int t_y; - for ( t_y = 0; t_y < buffer.height(); t_y++ ) { - uint16_t* l0 = &helper[current_bitmap].pix16(t_y); - uint16_t* l1 = &helper[1 - current_bitmap].pix16(t_y); - uint32_t* l2 = &buffer.pix32(t_y); + for ( int t_y = 0; t_y < buffer.height(); t_y++ ) { + uint16_t* l0 = &helper[current_bitmap].pix(t_y); + uint16_t* l1 = &helper[1 - current_bitmap].pix(t_y); + uint32_t* l2 = &buffer.pix(t_y); int t_x; for( t_x = 0; t_x < buffer.width(); t_x++ ) { if ( l0[t_x] != l1[t_x] ) { @@ -1321,7 +1315,7 @@ void tia_video_device::HMOVE_w(uint8_t data) } if (curr_y < screen_height) { - memset(&helper[current_bitmap].pix16(curr_y, 34), 0, 16); + memset(&helper[current_bitmap].pix(curr_y, 34), 0, 16); } prev_x = 8; diff --git a/src/mame/video/timex.cpp b/src/mame/video/timex.cpp index e0d811f24d0..24b8c4a4a47 100644 --- a/src/mame/video/timex.cpp +++ b/src/mame/video/timex.cpp @@ -22,7 +22,7 @@ inline void timex_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* Update FLASH status for ts2068. Assumes flash update every 1/2s. */ diff --git a/src/mame/video/tmnt.cpp b/src/mame/video/tmnt.cpp index 64a297f9de4..d4f9f3895b3 100644 --- a/src/mame/video/tmnt.cpp +++ b/src/mame/video/tmnt.cpp @@ -650,7 +650,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[0] >= 0x30 && m_layerpri[1] < 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k052109->tilemap_draw(screen, bitmap, cliprect, m_sorted_layer[1], 0, 2); @@ -658,7 +658,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[1] >= 0x30 && m_layerpri[2] < 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k052109->tilemap_draw(screen, bitmap, cliprect, m_sorted_layer[2], 0, 4); @@ -666,7 +666,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[2] >= 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k053245->sprites_draw(bitmap, cliprect, screen.priority()); diff --git a/src/mame/video/toaplan1.cpp b/src/mame/video/toaplan1.cpp index 369c5bd0486..5fd0be9203e 100644 --- a/src/mame/video/toaplan1.cpp +++ b/src/mame/video/toaplan1.cpp @@ -742,9 +742,9 @@ void toaplan1_state::draw_sprite_custom(screen_device &screen, bitmap_rgb32 &des { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/toaplan2.cpp b/src/mame/video/toaplan2.cpp index de02afcda96..9a542579022 100644 --- a/src/mame/video/toaplan2.cpp +++ b/src/mame/video/toaplan2.cpp @@ -274,8 +274,8 @@ u32 toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_ind16 & { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16* src_vdp0 = &bitmap.pix16(y); - const u16* src_vdp1 = &m_secondary_render_bitmap.pix16(y); + u16 *const src_vdp0 = &bitmap.pix(y); + u16 const *const src_vdp1 = &m_secondary_render_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/toaplan_scu.cpp b/src/mame/video/toaplan_scu.cpp index 84afffe2d0a..a7bb72c6e3b 100644 --- a/src/mame/video/toaplan_scu.cpp +++ b/src/mame/video/toaplan_scu.cpp @@ -93,12 +93,12 @@ void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, u void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) { - const pen_t *pens = &palette().pen(gfx(0)->colorbase()); + pen_t const *const pens = &palette().pen(gfx(0)->colorbase()); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *srcline = &m_temp_spritebitmap.pix16(y); - u32 *dstline = &bitmap.pix32(y); + u16 const *const srcline = &m_temp_spritebitmap.pix(y); + u32 *const dstline = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/toobin.cpp b/src/mame/video/toobin.cpp index ea0a163b78c..d1fe95c1e7e 100644 --- a/src/mame/video/toobin.cpp +++ b/src/mame/video/toobin.cpp @@ -218,13 +218,13 @@ uint32_t toobin_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); - const pen_t *palette = m_palette->pens(); + pen_t const *const palette = m_palette->pens(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *dest = &bitmap.pix32(y); - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &m_pfbitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint32_t *const dest = &bitmap.pix(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t const *const pf = &m_pfbitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint16_t pix = pf[x]; diff --git a/src/mame/video/triplhnt.cpp b/src/mame/video/triplhnt.cpp index f3775c905d4..0937758003f 100644 --- a/src/mame/video/triplhnt.cpp +++ b/src/mame/video/triplhnt.cpp @@ -88,27 +88,21 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec rect &= cliprect; /* check for collisions and copy sprite */ - + for (int x = rect.left(); x <= rect.right(); x++) { - int x; - int y; - - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) { - for (y = rect.top(); y <= rect.bottom(); y++) - { - pen_t a = m_helper.pix16(y, x); - pen_t b = bitmap.pix16(y, x); + pen_t const a = m_helper.pix(y, x); + pen_t const b = bitmap.pix(y, x); - if (a == 2 && b == 7) - { - hit_code = j; - hit_line = y; - } - - if (a != 1) - bitmap.pix16(y, x) = a; + if (a == 2 && b == 7) + { + hit_code = j; + hit_line = y; } + + if (a != 1) + bitmap.pix(y, x) = a; } } } diff --git a/src/mame/video/trs80.cpp b/src/mame/video/trs80.cpp index 9ad2452dd26..8fd52de2dda 100644 --- a/src/mame/video/trs80.cpp +++ b/src/mame/video/trs80.cpp @@ -14,10 +14,9 @@ /* 7 or 8-bit video, 32/64 characters per line = trs80, trs80l2, sys80 */ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; - uint8_t cols = BIT(m_mode, 0) ? 32 : 64; - uint8_t skip = BIT(m_mode, 0) ? 2 : 1; + uint16_t sy=0,ma=0; + uint8_t const cols = BIT(m_mode, 0) ? 32 : 64; + uint8_t const skip = BIT(m_mode, 0) ? 2 : 1; if (m_mode != m_size_store) { @@ -25,19 +24,19 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -52,6 +51,7 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b if (BIT(m_mode, 1) & (chr < 32)) chr+=64; // if g,j,p,q,y; lower the descender + uint8_t gfx; if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) { if ((ra < 10) && (ra > 1)) @@ -86,10 +86,9 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b /* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; - uint8_t cols = BIT(m_mode, 0) ? 32 : 64; - uint8_t skip = BIT(m_mode, 0) ? 2 : 1; + uint16_t sy=0,ma=0; + uint8_t const cols = BIT(m_mode, 0) ? 32 : 64; + uint8_t const skip = BIT(m_mode, 0) ? 2 : 1; if (m_mode != m_size_store) { @@ -97,19 +96,19 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -124,7 +123,7 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 if (BIT(m_mode, 1) && (chr < 32)) chr+=64; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra ]; + uint8_t gfx = m_p_chargen[(chr<<4) | ra ]; /* Display a scanline of a character (6 pixels) */ *p++ = BIT(gfx, 7); @@ -145,8 +144,7 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { static const uint16_t rows[] = { 0, 0x200, 0x100, 0x300, 1, 0x201, 0x101, 0x301 }; - uint8_t chr,gfx,gfxbit,bg=7,fg=0; - uint16_t sy=0,ma=0,x,y,ra; + uint16_t sy=0,ma=0; uint8_t cols = BIT(m_lnw_mode, 1) ? 80 : 64; /* Although the OS can select 32-character mode, it is not supported by hardware */ @@ -156,6 +154,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } + uint8_t bg=7,fg=0; if (BIT(m_lnw_mode, 1)) { bg = 0; @@ -165,19 +164,19 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b switch (m_lnw_mode & 0x06) { case 0: // MODE 0 - for (y = 0; y < 16; y++) + for (uint16_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint16_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit) ? fg : bg; *p++ = BIT(chr, gfxbit) ? fg : bg; @@ -190,6 +189,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b else { /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[(chr<<1) | rows[ra] ]; else @@ -210,15 +210,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b break; case 0x02: // MODE 1 - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; /* Display 6 pixels in normal region */ *p++ = BIT(gfx, 0) ? fg : bg; *p++ = BIT(gfx, 1) ? fg : bg; @@ -228,9 +228,9 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b *p++ = BIT(gfx, 5) ? fg : bg; } - for (x = 0; x < 0x10; x++) + for (uint16_t x = 0; x < 0x10; x++) { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + uint8_t gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; /* Display 6 pixels in extended region */ *p++ = BIT(gfx, 0) ? fg : bg; *p++ = BIT(gfx, 1) ? fg : bg; @@ -246,15 +246,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b case 0x04: // MODE 2 /* it seems the text video ram can have an effect in this mode, not explained clearly, so not emulated */ - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; /* Display 6 pixels in normal region */ fg = (gfx & 0x38) >> 3; *p++ = fg; @@ -273,15 +273,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b /* the manual does not explain at all how colour is determined for the extended area. Further, the background colour is not mentioned anywhere. Black is assumed. */ - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; fg = (m_p_videoram[ x | y ] & 0x38) >> 3; /* Display 6 pixels in normal region */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -293,9 +293,9 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b *p++ = BIT(gfx, 5) ? fg : bg; } - for (x = 0; x < 0x10; x++) + for (uint16_t x = 0; x < 0x10; x++) { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + uint8_t gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; fg = (m_p_gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; /* Display 6 pixels in extended region */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -316,8 +316,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b /* lores characters are in the character generator. Each character is 8x16. */ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; uint8_t cols = BIT(m_mode, 0) ? 32 : 64; uint8_t skip = BIT(m_mode, 0) ? 2 : 1; @@ -327,18 +326,18 @@ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 screen.set_visible_area(0, cols*8-1, 0, 16*16-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; + uint8_t gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 0); diff --git a/src/mame/video/trs80m3.cpp b/src/mame/video/trs80m3.cpp index 28fc64012dc..4b44cc62534 100644 --- a/src/mame/video/trs80m3.cpp +++ b/src/mame/video/trs80m3.cpp @@ -39,8 +39,7 @@ void trs80m3_state::port_88_w(offs_t offset, uint8_t data) /* 8-bit video, 32/64/40/80 characters per line = trs80m3, trs80m4. */ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; uint8_t skip=1; uint8_t cols = BIT(m_mode, 2) ? 80 : 64; uint8_t rows = BIT(m_mode, 2) ? 24 : 16; @@ -60,18 +59,19 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 screen.set_visible_area(0, s_cols*8-1, 0, rows*lines-1); } - for (y = 0; y < rows; y++) + for (uint8_t y = 0; y < rows; y++) { - for (ra = 0; ra < lines; ra++) + for (uint8_t ra = 0; ra < lines; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + cols; x+=skip) + for (uint16_t x = ma; x < ma + cols; x+=skip) { - chr = m_p_videoram[x+m_start_address]; + uint8_t chr = m_p_videoram[x+m_start_address]; if (((chr & 0xc0) == 0xc0) && (~m_mode & 8)) { + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[((chr&mask)<<3) | ra ]; else @@ -86,10 +86,9 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 *p++ = BIT(gfx, 1); *p++ = BIT(gfx, 0); } - else - if ((chr & 0x80) && (~m_mode & 8)) + else if ((chr & 0x80) && (~m_mode & 8)) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -104,6 +103,7 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 else { /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[((chr&0x7f)<<3) | ra ]; else diff --git a/src/mame/video/truco.cpp b/src/mame/video/truco.cpp index ba885d7c4d6..ac2019b3914 100644 --- a/src/mame/video/truco.cpp +++ b/src/mame/video/truco.cpp @@ -42,7 +42,7 @@ uint32_t truco_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { int const pixel = (videoram[x >> 1] >> ((x & 1) ? 0 : 4)) & 0x0f; - bitmap.pix32(y, x) = m_palette->pen(pixel); + bitmap.pix(y, x) = m_palette->pen(pixel); } videoram += 0x80; diff --git a/src/mame/video/tubep.cpp b/src/mame/video/tubep.cpp index af4b49d0e76..3273086647f 100644 --- a/src/mame/video/tubep.cpp +++ b/src/mame/video/tubep.cpp @@ -572,15 +572,13 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b pen_t pen_base = 32; //change it later - uint32_t v; uint8_t *text_gfx_base = memregion("gfx1")->base(); uint8_t *romBxx = memregion("user1")->base() + 0x2000*m_background_romsel; /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect.min_y, cliprect.max_y+1); */ - for (v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ + for (uint32_t v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ { - uint32_t h; uint32_t sp_data0=0,sp_data1=0,sp_data2=0; // It appears there is a 1 pixel delay when renderer switches from background to sprite/text, @@ -588,7 +586,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b // See the gameplay video on the PCB. https://www.youtube.com/watch?v=xxONzbUOOsw bool prev_text_or_sprite_pixel = true; - for (h = 0*8; h < 32*8; h++) + for (uint32_t h = 0*8; h < 32*8; h++) { bool draw_text_or_sprite_pixel = false; @@ -606,7 +604,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b if (text_gfx_data & (0x80 >> (h & 0x07))) { - bitmap.pix16(v, h) = (m_textram[text_offs + 1] & 0x0f) | m_color_A4; + bitmap.pix(v, h) = (m_textram[text_offs + 1] & 0x0f) | m_color_A4; draw_text_or_sprite_pixel = true; } else @@ -652,12 +650,12 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b draw_text_or_sprite_pixel = true; } - bitmap.pix16(v, h) = pen_base + bg_data*64 + romB_data_h; + bitmap.pix(v, h) = pen_base + bg_data*64 + romB_data_h; } // text and sprite drop shadow if (draw_text_or_sprite_pixel && !prev_text_or_sprite_pixel && h > 0) - bitmap.pix16(v, h - 1) = 0x0; + bitmap.pix(v, h - 1) = 0x0; prev_text_or_sprite_pixel = draw_text_or_sprite_pixel; } } @@ -744,7 +742,6 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 { int DISP_ = m_DISP^1; - uint32_t v; uint8_t *text_gfx_base = memregion("gfx1")->base(); uint8_t *rom13D = memregion("user1")->base(); uint8_t *rom11BD = rom13D+0x1000; @@ -754,9 +751,8 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 /* especially read from ROM19C can be done once per 8 pixels*/ /* and the data could be bitswapped beforehand */ - for (v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ + for (uint32_t v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ { - uint32_t h; uint32_t sp_data0=0,sp_data1=0,sp_data2=0; uint8_t pal14h4_pin19; uint8_t pal14h4_pin18; @@ -769,7 +765,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 pal14h4_pin13 = (rom19C[addr] >> ((v&7)^7) ) &1; pal14h4_pin19 = (ram_data>>13) & 1; - for (h = 0*8; h < 32*8; h++) + for (uint32_t h = 0*8; h < 32*8; h++) { offs_t text_offs; uint8_t text_code; @@ -784,7 +780,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 text_gfx_data = text_gfx_base[(text_code << 3) | (v & 0x07)]; if (text_gfx_data & (0x80 >> (h & 0x07))) - bitmap.pix16(v, h) = 0x10 | (m_textram[text_offs + 1] & 0x0f); + bitmap.pix(v, h) = 0x10 | (m_textram[text_offs + 1] & 0x0f); else { uint32_t sp_data; @@ -795,7 +791,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 sp_data = sp_data1; if (sp_data != 0x0f) - bitmap.pix16(v, h) = 0x00 + sp_data; + bitmap.pix(v, h) = 0x00 + sp_data; else { uint32_t bg_data; @@ -848,7 +844,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 color_bank = (pal14h4_pin13 & ((bg_data&0x08)>>3) & ((bg_data&0x04)>>2) & (((bg_data&0x02)>>1)^1) & (bg_data&0x01) ) | (pal14h4_pin18 & ((bg_data&0x08)>>3) & ((bg_data&0x04)>>2) & ((bg_data&0x02)>>1) & ((bg_data&0x01)^1) ) | (pal14h4_pin19); - bitmap.pix16(v, h) = 0x20 + color_bank*0x10 + bg_data; + bitmap.pix(v, h) = 0x20 + color_bank*0x10 + bg_data; } } } diff --git a/src/mame/video/tunhunt.cpp b/src/mame/video/tunhunt.cpp index 588f6253274..a5712f2afa1 100644 --- a/src/mame/video/tunhunt.cpp +++ b/src/mame/video/tunhunt.cpp @@ -223,10 +223,10 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl const int color = ((span_data >> 6) & 0x3) ^ 0x3; int count = (span_data & 0x1f) + 1; while (count-- && x < 256) - tmpbitmap.pix16(line, x++) = color; + tmpbitmap.pix(line, x++) = color; } while (x < 256) - tmpbitmap.pix16(line, x++) = 0; + tmpbitmap.pix(line, x++) = 0; } int scaley; @@ -303,7 +303,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect) } } if (x >= cliprect.left() && x <= cliprect.right()) - bitmap.pix16(0xff-y, x) = color; + bitmap.pix(0xff-y, x) = color; } } } diff --git a/src/mame/video/turbo.cpp b/src/mame/video/turbo.cpp index d52f2d9fdfa..723aa15054e 100644 --- a/src/mame/video/turbo.cpp +++ b/src/mame/video/turbo.cpp @@ -352,22 +352,21 @@ uint32_t turbo_state::turbo_get_sprite_bits(uint8_t road, sprite_info *sprinfo) uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr1114 = &m_proms[0x000]; - const uint8_t *pr1115 = &m_proms[0x020]; - const uint8_t *pr1116 = &m_proms[0x040]; - const uint8_t *pr1117 = &m_proms[0x060]; - const uint8_t *pr1118 = &m_proms[0x100]; - const uint8_t *pr1121 = &m_proms[0x600]; - const uint8_t *pr1122 = &m_proms[0x800]; - const uint8_t *pr1123 = &m_proms[0xc00]; - int x, y; + uint8_t const *const pr1114 = &m_proms[0x000]; + uint8_t const *const pr1115 = &m_proms[0x020]; + uint8_t const *const pr1116 = &m_proms[0x040]; + uint8_t const *const pr1117 = &m_proms[0x060]; + uint8_t const *const pr1118 = &m_proms[0x100]; + uint8_t const *const pr1121 = &m_proms[0x600]; + uint8_t const *const pr1122 = &m_proms[0x800]; + uint8_t const *const pr1123 = &m_proms[0xc00]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); - int sel, coch, babit, slipar_acciar, area, offs, areatmp, road = 0; + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); + int road = 0; sprite_info sprinfo; /* compute the Y sum between opa and the current scanline (p. 141) */ @@ -382,25 +381,22 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b turbo_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - int bacol, red, grn, blu, priority, foreraw, forebits, mx, ix; int xx = x / TURBO_X_SCALE; - uint8_t carry; - uint32_t sprbits; - uint16_t he; /* load the bitmask from the sprite position for both halves of the sprites (p. 139) */ - he = m_sprite_position[xx] | (m_sprite_position[xx + 0x100] << 8); + uint16_t he = m_sprite_position[xx] | (m_sprite_position[xx + 0x100] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* compute the X sum between opb and the current column; only the carry matters (p. 141) */ - carry = (xx + m_turbo_opb) >> 8; + uint8_t carry = (xx + m_turbo_opb) >> 8; /* the carry selects which inputs to use (p. 141) */ + int sel, coch; if (carry) { sel = m_turbo_ipb; @@ -413,6 +409,7 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b } /* look up AREA1 and AREA2 (p. 142) */ + int area, offs, areatmp; offs = va | /* A0- A7 = VA0-VA7 */ ((sel & 0x0f) << 8); /* A8-A11 = SEL0-3 */ @@ -447,27 +444,27 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* compute the final area value and look it up in IC18/PR1115 (p. 144) */ /* note: SLIPAR is 0 on the road surface only */ /* ACCIAR is 0 on the road surface and the striped edges only */ - babit = pr1115[area]; - slipar_acciar = babit & 0x30; + int babit = pr1115[area]; + int slipar_acciar = babit & 0x30; if (!road && (slipar_acciar & 0x20)) road = 1; /* also use the coch value to look up color info in IC13/PR1114 and IC21/PR1117 (p. 144) */ offs = (coch & 0x0f) | /* A0-A3: CONT0-3 = COCH0-3 */ ((m_turbo_fbcol & 0x01) << 4); /* A4: COL0 */ - bacol = pr1114[offs] | (pr1117[offs] << 8); + int bacol = pr1114[offs] | (pr1117[offs] << 8); /* at this point, do the character lookup; due to the shift register loading in */ /* the sync PROM, we latch character 0 during pixel 6 and start clocking in pixel */ /* 8, effectively shifting the display by 8; at pixel 0x108, the color latch is */ /* forced clear and isn't touched until the next shift register load */ - foreraw = (xx < 8 || xx >= 0x108) ? 0 : fore[xx - 8]; + int foreraw = (xx < 8 || xx >= 0x108) ? 0 : fore[xx - 8]; /* perform the foreground color table lookup in IC99/PR1118 (p. 137) */ - forebits = pr1118[foreraw]; + int forebits = pr1118[foreraw]; /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { /* iterate over live sprites and update them */ /* the final 32-bit value is: */ @@ -475,18 +472,18 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* CDG0-7 = D8 -D15 */ /* CDR0-7 = D16-D23 */ /* PLB0-7 = D24-D31 */ - sprbits = turbo_get_sprite_bits(road, &sprinfo); + uint32_t sprbits = turbo_get_sprite_bits(road, &sprinfo); /* perform collision detection here via lookup in IC20/PR1116 (p. 144) */ m_turbo_collision |= pr1116[((sprbits >> 24) & 7) | (slipar_acciar >> 1)]; /* look up the sprite priority in IC11/PR1122 (p. 144) */ - priority = ((sprbits & 0xfe000000) >> 25) | /* A0-A6: PLB1-7 */ + int priority = ((sprbits & 0xfe000000) >> 25) | /* A0-A6: PLB1-7 */ ((m_turbo_fbpla & 0x07) << 7); /* A7-A9: PLA0-2 */ priority = pr1122[priority]; /* use that to look up the overall priority in IC12/PR1123 (p. 144) */ - mx = (priority & 7) | /* A0-A2: PR-1122 output, bits 0-2 */ + int mx = (priority & 7) | /* A0-A2: PR-1122 output, bits 0-2 */ ((sprbits & 0x01000000) >> 21) | /* A3: PLB0 */ ((foreraw & 0x80) >> 3) | /* A4: PLBE */ ((forebits & 0x08) << 2) | /* A5: PLBF */ @@ -496,19 +493,19 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* the MX output selects one of 16 inputs; build up a 16-bit pattern to match */ /* these in red, green, and blue (p. 144) */ - red = ((sprbits & 0x0000ff) >> 0) | /* D0- D7: CDR0-CDR7 */ + int red = ((sprbits & 0x0000ff) >> 0) | /* D0- D7: CDR0-CDR7 */ ((forebits & 0x01) << 8) | /* D8: CDRF */ ((bacol & 0x001f) << 9) | /* D9-D13: BAR0-BAR4 */ (1 << 14) | /* D14: 1 */ (0 << 15); /* D15: 0 */ - grn = ((sprbits & 0x00ff00) >> 8) | /* D0- D7: CDG0-CDG7 */ + int grn = ((sprbits & 0x00ff00) >> 8) | /* D0- D7: CDG0-CDG7 */ ((forebits & 0x02) << 7) | /* D8: CDGF */ ((bacol & 0x03e0) << 4) | /* D9-D13: BAG0-BAG4 */ (1 << 14) | /* D14: 1 */ (0 << 15); /* D15: 0 */ - blu = ((sprbits & 0xff0000) >> 16) | /* D0- D7: CDB0-CDB7 */ + int blu = ((sprbits & 0xff0000) >> 16) | /* D0- D7: CDB0-CDB7 */ ((forebits & 0x04) << 6) | /* D8: CDBF */ ((bacol & 0x7c00) >> 1) | /* D9-D13: BAB0-BAB4 */ (1 << 14) | /* D14: 1 */ @@ -703,17 +700,16 @@ uint32_t turbo_state::subroc3d_get_sprite_bits(sprite_info *sprinfo, uint8_t *pl uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr1419 = &m_proms[0x000]; - const uint8_t *pr1620 = &m_proms[0x200]; - const uint8_t *pr1450 = &m_proms[0x500]; - const uint8_t *pr1454 = &m_proms[0x920]; - int x, y; + uint8_t const *const pr1419 = &m_proms[0x000]; + uint8_t const *const pr1620 = &m_proms[0x200]; + uint8_t const *const pr1450 = &m_proms[0x500]; + uint8_t const *const pr1454 = &m_proms[0x920]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); sprite_info sprinfo; /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ @@ -721,47 +717,48 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 subroc3d_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - int offs, finalbits, ix; uint8_t xx = x / TURBO_X_SCALE; - uint8_t foreraw, forebits, mux, cd, plb, mplb; - uint16_t he; - uint32_t sprbits; /* load the bitmask from the sprite position for both halves of the sprites (p. 143) */ - he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); + uint16_t he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* at this point, do the character lookup */ + uint8_t foreraw; if (!m_subroc3d_flip) foreraw = fore[xx]; else foreraw = fore[(pr1454[(xx >> 3) & 0x1f] << 3) | (xx & 0x07)]; /* perform the foreground color table lookup in IC62/PR1620 (p. 141) */ - forebits = pr1620[foreraw]; + uint8_t forebits = pr1620[foreraw]; /* MPLB is set based on the high bit of the raw foreground data, as an OR over the output */ /* of the foreground color PROM */ - mplb = (foreraw & 0x80) || ((forebits & 0x0f) == 0); + uint8_t mplb = (foreraw & 0x80) || ((forebits & 0x0f) == 0); /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { + int offs; + /* iterate over live sprites and update them */ /* the final 32-bit value is: */ /* CDA0-7 = D0 -D7 */ /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); + uint8_t plb; + uint32_t sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); /* MUX0-3 is selected by PLY0-3 and the sprite enable bits, and is the output */ /* of IC21/PR1450 (p. 141), unless MPLB = 0, in which case the values are grounded (p. 141) */ + uint8_t mux; if (mplb) { offs = (plb ^ 0xff) | /* A0-A7: /PLB0-7 */ @@ -773,9 +770,10 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 /* CD0-3 are selected from the sprite bits and MUX0-2 (p. 141) */ sprbits = (sprbits >> (mux & 0x07)) & 0x01010101; - cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; + uint8_t cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; /* MUX3 selects either CD0-3 or the foreground output (p. 141) */ + int finalbits; if (mux & 0x08) finalbits = cd; else @@ -802,26 +800,23 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) { - const uint8_t *pr5196 = &m_proms[0x100]; - int sprnum; + uint8_t const *const pr5196 = &m_proms[0x100]; /* initialize the line enable signals to 0 */ info->ve = 0; info->lst = 0; /* compute the sprite information, which was done on the previous scanline during HBLANK */ - for (sprnum = 0; sprnum < 16; sprnum++) + for (int sprnum = 0; sprnum < 16; sprnum++) { - uint8_t *rambase = &m_spriteram[sprnum * 8]; + uint8_t *const rambase = &m_spriteram[sprnum * 8]; int level = sprnum & 7; - uint8_t clo, chi; - uint32_t sum; /* perform the first ALU to see if we are within the scanline */ - sum = y + (rambase[0]/* ^ 0xff*/); - clo = (sum >> 8) & 1; + uint32_t sum = y + (rambase[0]/* ^ 0xff*/); + uint8_t clo = (sum >> 8) & 1; sum += (y << 8) + ((rambase[1]/* ^ 0xff*/) << 8); - chi = (sum >> 16) & 1; + uint8_t chi = (sum >> 16) & 1; /* the AND of the low carry and the inverse of the high carry clocks an enable bit */ /* for this sprite; note that the logic in the Turbo schematics is reversed here */ @@ -830,7 +825,6 @@ void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) int xscale = rambase[2] ^ 0xff; int yscale = rambase[3];// ^ 0xff; uint16_t offset = rambase[6] + (rambase[7] << 8); - int offs; /* mark this entry enabled */ info->ve |= 1 << sprnum; @@ -838,7 +832,7 @@ void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) /* look up the low byte of the sum plus the yscale value in */ /* IC50/PR1119 to determine if we write back the sum of the */ /* offset and the rowbytes this scanline (p. 138) */ - offs = (sum & 0xff) | /* A0-A7 = AL0-AL7 */ + int offs = (sum & 0xff) | /* A0-A7 = AL0-AL7 */ ((yscale & 0x08) << 5); /* A8-A9 = /RO11-/RO12 */ /* one of the bits is selected based on the low 7 bits of yscale */ @@ -870,12 +864,11 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb */ static const uint8_t plb_end[16] = { 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,2 }; uint32_t sprdata = 0; - int level; *plb = 0; /* loop over all live levels */ - for (level = 0; level < 8; level++) + for (int level = 0; level < 8; level++) if (sprinfo->lst & (1 << level)) { /* latch the data and advance the offset */ @@ -887,12 +880,11 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb while (sprinfo->frac[level] >= 0x800000) { uint32_t offs = sprinfo->offset[level]; - uint8_t pixdata; /* bit 0 controls which half of the byte to use */ /* bits 1-13 go to address lines */ /* bit 14 selects which of the two ROMs to read from */ - pixdata = m_spriteroms[(level << 15) | ((offs >> 1) & 0x7fff)] >> ((~offs & 1) * 4); + uint8_t pixdata = m_spriteroms[(level << 15) | ((offs >> 1) & 0x7fff)] >> ((~offs & 1) * 4); sprinfo->latched[level] = sprite_expand[pixdata & 0x0f] << level; sprinfo->plb[level] = (plb_end[pixdata & 0x0f] & 1) << level; @@ -920,16 +912,15 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr5194 = &m_proms[0x000]; - const uint8_t *pr5198 = &m_proms[0x500]; - const uint8_t *pr5199 = &m_proms[0x700]; - int x, y; + uint8_t const *const pr5194 = &m_proms[0x000]; + uint8_t const *const pr5198 = &m_proms[0x500]; + uint8_t const *const pr5199 = &m_proms[0x700]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); sprite_info sprinfo; /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ @@ -937,33 +928,30 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 buckrog_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - uint8_t foreraw, forebits, cd, plb, star, mux; uint8_t xx = x / TURBO_X_SCALE; - uint16_t he; - uint32_t sprbits; - int palbits, offs, ix; + int offs; /* load the bitmask from the sprite position for both halves of the sprites (p. 143) */ - he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); + uint16_t he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* at this point, do the character lookup and the foreground color table lookup in IC93/PR1598 (SH 5/5)*/ - foreraw = fore[(pr5194[((xx >> 3) - 1) & 0x1f] << 3) | (xx & 0x07)]; + uint8_t foreraw = fore[(pr5194[((xx >> 3) - 1) & 0x1f] << 3) | (xx & 0x07)]; offs = ((foreraw & 0x03) << 0) | /* A0-A1: BIT0-1 */ ((foreraw & 0xf8) >> 1) | /* A2-A6: BANK3-7 */ ((m_buckrog_fchg & 0x03) << 7); /* A7-A9: FCHG0-2 */ - forebits = pr5198[offs]; + uint8_t forebits = pr5198[offs]; /* fetch the STAR bit */ - star = m_buckrog_bitmap_ram[y * 256 + xx]; + uint8_t star = m_buckrog_bitmap_ram[y * 256 + xx]; /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { /* iterate over live sprites and update them */ /* the final 32-bit value is: */ @@ -971,9 +959,11 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); + uint8_t plb; + uint32_t sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); /* the PLB bits go into an LS148 8-to-1 decoder and become MUX0-3 (PROM board SH 2/10) */ + uint8_t mux; if (plb == 0) mux = 8; else @@ -988,11 +978,12 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 /* MUX then selects one of the sprites and selects CD0-3 */ sprbits = (sprbits >> (mux & 0x07)) & 0x01010101; - cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; + uint8_t cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; /* this info goes into an LS148 8-to-3 decoder to determine the priorities (SH 5/5) */ /* priority 7 is if bit 0x80 of the foreground color is 0; CHNG = 0 */ + int palbits; if (!(forebits & 0x80)) { palbits = ((forebits & 0x3c) << 2) | diff --git a/src/mame/video/turrett.cpp b/src/mame/video/turrett.cpp index c03e5ec440b..7672daf96c5 100644 --- a/src/mame/video/turrett.cpp +++ b/src/mame/video/turrett.cpp @@ -44,7 +44,7 @@ uint32_t turrett_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint16_t *src = &vram[y * X_VISIBLE + cliprect.min_x]; - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); + uint16_t *dest = &bitmap.pix(y, cliprect.min_x); if (m_video_fade != 0) { diff --git a/src/mame/video/tutankhm.cpp b/src/mame/video/tutankhm.cpp index 9487065e945..f3503f5c802 100644 --- a/src/mame/video/tutankhm.cpp +++ b/src/mame/video/tutankhm.cpp @@ -48,7 +48,7 @@ uint32_t tutankhm_state::screen_update_tutankhm_bootleg(screen_device &screen, b for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x / GALAXIAN_XSCALE; x <= cliprect.max_x / GALAXIAN_XSCALE; x++) { @@ -75,9 +75,9 @@ uint32_t tutankhm_state::screen_update_tutankhm_bootleg(screen_device &screen, b if (m_stars_enabled && enab && (shifted & 0x02) == 0 && (star & 0x80) != 0 && x > 63) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } else if (shifted) @@ -101,7 +101,7 @@ uint32_t tutankhm_state::screen_update_tutankhm_scramble(screen_device &screen, for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x / GALAXIAN_XSCALE; x <= cliprect.max_x / GALAXIAN_XSCALE; x++) { @@ -392,7 +392,7 @@ void tutankhm_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0) - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ star = m_stars[star_offs++]; @@ -400,8 +400,8 @@ void tutankhm_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 star_offs = 0; if (enable_star && (star & 0x80) != 0) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } } } diff --git a/src/mame/video/twin16.cpp b/src/mame/video/twin16.cpp index a85a9e018b0..d64d6824edc 100644 --- a/src/mame/video/twin16.cpp +++ b/src/mame/video/twin16.cpp @@ -274,7 +274,6 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { int xpos = source[1]; int ypos = source[2]; - int x,y; int pal_base = ((attributes&0xf)+0x10)*16; int height = 16<<((attributes>>6)&0x3); @@ -335,15 +334,15 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co if( ypos>=256 ) ypos -= 65536; /* slow slow slow, but it's ok for now */ - for( y=0; y<height; y++, pen_data += width/4 ) + for( int y=0; y<height; y++, pen_data += width/4 ) { int sy = (flipy)?(ypos+height-1-y):(ypos+y); if( sy>=cliprect.min_y && sy<=cliprect.max_y ) { - uint16_t *dest = &bitmap.pix16(sy); - uint8_t *pdest = &screen.priority().pix8(sy); + uint16_t *const dest = &bitmap.pix(sy); + uint8_t *const pdest = &screen.priority().pix(sy); - for( x=0; x<width; x++ ) + for( int x=0; x<width; x++ ) { int sx = (flipx)?(xpos+width-1-x):(xpos+x); if( sx>=cliprect.min_x && sx<=cliprect.max_x ) diff --git a/src/mame/video/tx0.cpp b/src/mame/video/tx0.cpp index 1e7c5c0a147..a797864d4a0 100644 --- a/src/mame/video/tx0.cpp +++ b/src/mame/video/tx0.cpp @@ -19,7 +19,7 @@ inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } /* @@ -346,13 +346,12 @@ enum void tx0_state::tx0_typewriter_linefeed() { uint8_t buf[typewriter_window_width]; - int y; assert(typewriter_window_width <= m_typewriter_bitmap.width()); assert(typewriter_window_height <= m_typewriter_bitmap.height()); - for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) + for (int y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - std::copy_n(&m_typewriter_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); + std::copy_n(&m_typewriter_bitmap.pix(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/tx1.cpp b/src/mame/video/tx1.cpp index e11b7bb806d..08b74e80462 100644 --- a/src/mame/video/tx1.cpp +++ b/src/mame/video/tx1.cpp @@ -7,10 +7,10 @@ ****************************************************************************/ #include "emu.h" -#include "render.h" +#include "includes/tx1.h" + #include "video/resnet.h" #include "cpu/i86/i86.h" -#include "includes/tx1.h" #define OBJ_FRAC 16 @@ -1123,14 +1123,13 @@ WRITE_LINE_MEMBER(tx1_state::screen_vblank_tx1) void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) { - int x, y; - uint8_t *chr_pal = &m_proms[0x900]; + uint8_t const *const chr_pal = &m_proms[0x900]; int x_offset = screen * 256; - for (y = 0; y < 240; ++y) + for (int y = 0; y < 240; ++y) { - uint16_t *bmp_addr = &bitmap.pix16(y); + uint16_t *bmp_addr = &bitmap.pix(y); uint32_t bmp_offset = y * 768 + x_offset; @@ -1138,7 +1137,7 @@ void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) uint8_t *rod_addr = m_rod_bmp.get() + bmp_offset; uint8_t *obj_addr = m_obj_bmp.get() + bmp_offset; - for (x = 0; x < 256; ++x) + for (int x = 0; x < 256; ++x) { uint8_t out_val; uint32_t char_val = chr_addr[x]; @@ -2918,10 +2917,9 @@ void tx1_state::buggyboy_scolst_w(uint16_t data) void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) { - uint8_t *chr_pal = &m_proms[0x400]; + uint8_t const *const chr_pal = &m_proms[0x400]; uint32_t bmp_stride; uint32_t x_offset; - uint32_t y; if (screen < 0) { @@ -2934,10 +2932,8 @@ void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) x_offset = 256 * screen; } - for (y = 0; y < 240; ++y) + for (uint32_t y = 0; y < 240; ++y) { - uint32_t x; - uint32_t bmp_offset = y * bmp_stride + x_offset; uint8_t *chr_addr = m_chr_bmp.get() + bmp_offset; @@ -2947,9 +2943,9 @@ void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) uint32_t sky_en = BIT(m_vregs.sky, 7); uint32_t sky_val = (((m_vregs.sky & 0x7f) + y) >> 2) & 0x3f; - uint16_t *bmp_addr = &bitmap.pix16(y); + uint16_t *bmp_addr = &bitmap.pix(y); - for (x = 0; x < 256; ++x) + for (uint32_t x = 0; x < 256; ++x) { uint32_t out_val; diff --git a/src/mame/video/ultratnk.cpp b/src/mame/video/ultratnk.cpp index b6bd759460c..d5dc308c3d8 100644 --- a/src/mame/video/ultratnk.cpp +++ b/src/mame/video/ultratnk.cpp @@ -122,7 +122,7 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank) for (int y = rect.top(); y <= rect.bottom(); y++) for (int x = rect.left(); x <= rect.right(); x++) - if (m_palette->pen_indirect(m_helper.pix16(y, x)) != BG) + if (m_palette->pen_indirect(m_helper.pix(y, x)) != BG) m_collision[i] = 1; } diff --git a/src/mame/video/usgames.cpp b/src/mame/video/usgames.cpp index b9c65025012..af8721edf66 100644 --- a/src/mame/video/usgames.cpp +++ b/src/mame/video/usgames.cpp @@ -34,7 +34,7 @@ void usgames_state::charram_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW(usgames_state::update_row) { - uint32_t *pix = &bitmap.pix32(y); + uint32_t *pix = &bitmap.pix(y); ra &= 0x07; for (int x = 0; x < x_count; x++) diff --git a/src/mame/video/uv201.cpp b/src/mame/video/uv201.cpp index 4ad0ac9c746..82710b3dcf7 100644 --- a/src/mame/video/uv201.cpp +++ b/src/mame/video/uv201.cpp @@ -81,7 +81,7 @@ ((_y >= cliprect.min_y) && (_y <= cliprect.max_y)) #define DRAW_PIXEL(_scanline, _dot) \ - if (IS_VISIBLE(_scanline)) bitmap.pix32((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; + if (IS_VISIBLE(_scanline)) bitmap.pix((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; diff --git a/src/mame/video/v1050.cpp b/src/mame/video/v1050.cpp index d2f5096562f..b045e93f1c7 100644 --- a/src/mame/video/v1050.cpp +++ b/src/mame/video/v1050.cpp @@ -57,15 +57,13 @@ void v1050_state::videoram_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) { - int column, bit; - - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { uint16_t address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column); uint8_t data = m_video_ram[address & V1050_VIDEORAM_MASK]; uint8_t attr = (m_attr & 0xfc) | (m_attr_ram[address] & 0x03); - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; int color = BIT(data, 7); @@ -82,7 +80,7 @@ MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) /* display blank */ if (attr & V1050_ATTR_BLANK) color = 0; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); data <<= 1; } diff --git a/src/mame/video/vc4000.cpp b/src/mame/video/vc4000.cpp index 5d4c1325266..fa52c41fd20 100644 --- a/src/mame/video/vc4000.cpp +++ b/src/mame/video/vc4000.cpp @@ -382,27 +382,23 @@ static const char led[20][12+1] = void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line) { - static const int digit_to_segment[0x10]={ - 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff - }; + static const int digit_to_segment[0x10]={ 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff }; - int i=line,j; + int i=line; - for (j=0; j<sizeof(led[0])-1; j++) + for (int j=0; j<sizeof(led[0])-1; j++) { if (led[i][j] != ' ' && digit_to_segment[d]&(1<<(led[i][j]-'a')) ) - bitmap.pix16(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; + bitmap.pix(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; } } inline void vc4000_state::vc4000_collision_plot(uint8_t *collision, uint8_t data, uint8_t color, int scale) { - int i,j,m; - - for (j=0,m=0x80; j<8; j++, m>>=1) + for (int j=0, m=0x80; j<8; j++, m>>=1) { if (data&m) - for (i=0; i<scale; i++, collision++) *collision|=color; + for (int i=0; i<scale; i++, collision++) *collision|=color; else collision+=scale; } @@ -576,7 +572,6 @@ inline void vc4000_state::vc4000_draw_grid(uint8_t *collision) INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) { - int x,y,i; uint8_t collision[400]={0}; // better alloca or gcc feature of non constant long automatic arrays const rectangle &visarea = m_screen->visible_area(); assert(ARRAY_LENGTH(collision) >= m_screen->width()); @@ -604,7 +599,7 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) vc4000_draw_grid(collision); /* init object colours */ - for (i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; + for (int i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; /* calculate object colours and OR overlapping object colours */ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[0]); @@ -612,20 +607,20 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[2]); vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[3]); - for (i=visarea.min_x; i<visarea.max_x; i++) + for (int i=visarea.min_x; i<visarea.max_x; i++) { m_video.sprite_collision|=m_sprite_collision[collision[i]]; m_video.background_collision|=m_background_collision[collision[i]]; /* display final object colours */ if (m_objects[i] < 8) - m_bitmap->pix16(m_video.line, i) = m_objects[i]; + m_bitmap->pix(m_video.line, i) = m_objects[i]; } - y = m_video.reg.d.score_control&1?200:20; + int y = m_video.reg.d.score_control&1?200:20; if ((m_video.line>=y)&&(m_video.line<y+20)) { - x = 60; + int x = 60; vc4000_draw_digit(*m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y); vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); if (m_video.reg.d.score_control&2) x -= 16; diff --git a/src/mame/video/vector06.cpp b/src/mame/video/vector06.cpp index 9acc3d1c823..285583f030a 100644 --- a/src/mame/video/vector06.cpp +++ b/src/mame/video/vector06.cpp @@ -15,36 +15,33 @@ uint32_t vector06_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1,code2,code3,code4; - uint8_t col; - int y, x, b,draw_y; - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); - u16 width = (m_video_mode) ? 512 : 256; + u16 const width = (m_video_mode) ? 512 : 256; rectangle screen_area(0,width+64-1,0,256+64-1); // fill border color bitmap.fill(m_color_index, screen_area); // draw image - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { // port A of 8255 also used as scroll - draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; - code1 = ram[0x8000 + x*256 + y]; - code2 = ram[0xa000 + x*256 + y]; - code3 = ram[0xc000 + x*256 + y]; - code4 = ram[0xe000 + x*256 + y]; - for (b = 0; b < 8; b++) + int const draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; + uint8_t const code1 = ram[0x8000 + x*256 + y]; + uint8_t const code2 = ram[0xa000 + x*256 + y]; + uint8_t const code3 = ram[0xc000 + x*256 + y]; + uint8_t const code4 = ram[0xe000 + x*256 + y]; + for (int b = 0; b < 8; b++) { - col = BIT(code1, b) * 8 + BIT(code2, b) * 4 + BIT(code3, b)* 2+ BIT(code4, b); + uint8_t const col = BIT(code1, b) * 8 + BIT(code2, b) * 4 + BIT(code3, b)* 2+ BIT(code4, b); if (!m_video_mode) - bitmap.pix16(draw_y, x*8+(7-b)+32) = col; + bitmap.pix(draw_y, x*8+(7-b)+32) = col; else { - bitmap.pix16(draw_y, x*16+(7-b)*2+1+32) = BIT(code2, b) * 2; - bitmap.pix16(draw_y, x*16+(7-b)*2+32) = BIT(code3, b) * 2; + bitmap.pix(draw_y, x*16+(7-b)*2+1+32) = BIT(code2, b) * 2; + bitmap.pix(draw_y, x*16+(7-b)*2+32) = BIT(code3, b) * 2; } } } diff --git a/src/mame/video/vicdual.cpp b/src/mame/video/vicdual.cpp index bbf4c0636cb..a0b0b6a25cd 100644 --- a/src/mame/video/vicdual.cpp +++ b/src/mame/video/vicdual.cpp @@ -38,8 +38,6 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi while (1) { - pen_t pen; - if ((x & 0x07) == 0) { offs_t offs; @@ -55,12 +53,12 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi } /* plot the current pixel */ - pen = (video_data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + pen_t pen = (video_data & 0x80) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = pen; /* next pixel */ - video_data = video_data << 1; - x = x + 1; + video_data <<= 1; + x++; /* end of line? */ if (x == 0) @@ -72,7 +70,7 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi } /* next row */ - y = y + 1; + y++; } } @@ -82,7 +80,7 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *color_prom = (uint8_t *)m_proms->base(); + uint8_t const *const color_prom = (uint8_t *)m_proms->base(); uint8_t x = 0; uint8_t y = cliprect.min_y; uint8_t video_data = 0; @@ -91,16 +89,13 @@ uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 while (1) { - pen_t pen; - if ((x & 0x07) == 0) { offs_t offs; - uint8_t char_code; /* read the character code */ offs = (y >> 3 << 5) | (x >> 3); - char_code = m_videoram[offs]; + uint8_t char_code = m_videoram[offs]; /* read the appropriate line of the character ram */ offs = (char_code << 3) | (y & 0x07); @@ -116,12 +111,12 @@ uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 back_pen = choose_pen(x, y, back_pen); /* plot the current pixel */ - pen = (video_data & 0x80) ? fore_pen : back_pen; - bitmap.pix32(y, x) = pen; + pen_t pen = (video_data & 0x80) ? fore_pen : back_pen; + bitmap.pix(y, x) = pen; /* next pixel */ - video_data = video_data << 1; - x = x + 1; + video_data <<= 1; + x++; /* end of line? */ if (x == 0) diff --git a/src/mame/video/victory.cpp b/src/mame/video/victory.cpp index 68545d6016d..c8179b29e18 100644 --- a/src/mame/video/victory.cpp +++ b/src/mame/video/victory.cpp @@ -1095,7 +1095,6 @@ uint32_t victory_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { int bgcollmask = (m_video_control & 4) ? 4 : 7; int count = 0; - int x, y; /* copy the palette from palette RAM */ set_palette(); @@ -1105,15 +1104,15 @@ uint32_t victory_state::screen_update(screen_device &screen, bitmap_ind16 &bitma update_background(); /* blend the bitmaps and do collision detection */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t *scanline = &bitmap.pix16(y); + uint16_t *scanline = &bitmap.pix(y); uint8_t sy = m_scrolly + y; uint8_t *fg = &m_fgbitmap[y * 256]; uint8_t *bg = &m_bgbitmap[sy * 256]; /* do the blending */ - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { int fpix = *fg++; int bpix = bg[(x + m_scrollx) & 255]; diff --git a/src/mame/video/vindictr.cpp b/src/mame/video/vindictr.cpp index dae56f5d4cd..1cdd69d0ee4 100644 --- a/src/mame/video/vindictr.cpp +++ b/src/mame/video/vindictr.cpp @@ -215,8 +215,8 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -229,7 +229,7 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in MOG3-1 = ~MAT3-1 if MAT6==1 and MSD3==1 */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -255,8 +255,8 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/volfied.cpp b/src/mame/video/volfied.cpp index dcee9a9142d..d99365cadcb 100644 --- a/src/mame/video/volfied.cpp +++ b/src/mame/video/volfied.cpp @@ -113,7 +113,7 @@ void volfied_state::refresh_pixel_layer( bitmap_ind16 &bitmap ) else color |= p[x] & 0xf; - bitmap.pix16(y, x - 1) = color; + bitmap.pix(y, x - 1) = color; } p += 512; diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp index f70e2c58b95..3429879e962 100644 --- a/src/mame/video/vtvideo.cpp +++ b/src/mame/video/vtvideo.cpp @@ -595,18 +595,18 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, // Double, 'double_height + double_width', then normal. if (double_width) { - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1)) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + (b << 1)) = bit; if (double_height) { - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; + bitmap.pix(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; } } else { - bitmap.pix16(y_preset, x_preset + b) = bit; + bitmap.pix(y_preset, x_preset + b) = bit; } } // for (8 bit) @@ -614,21 +614,21 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, if (double_width) { // double chars: 18 or 20 bits - bitmap.pix16(y_preset, DOUBLE_x_preset + 16) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 17) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 16) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 17) = bit; if (m_columns == 80) { - bitmap.pix16(y_preset, DOUBLE_x_preset + 18) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 19) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 18) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 19) = bit; } } else { // normal chars: 9 or 10 bits - bitmap.pix16(y_preset, x_preset + 8) = bit; + bitmap.pix(y_preset, x_preset + 8) = bit; if (m_columns == 80) - bitmap.pix16(y_preset, x_preset + 9) = bit; + bitmap.pix(y_preset, x_preset + 9) = bit; } /* The DEC terminals use a single ROM bitmap font and @@ -652,27 +652,27 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, { if (double_width) { - if (bitmap.pix16(y_preset, DOUBLE_x_preset + b) == fg_intensity) + if (bitmap.pix(y_preset, DOUBLE_x_preset + b) == fg_intensity) { prev_bit = fg_intensity; } else { if (prev_bit == fg_intensity) - bitmap.pix16(y_preset, DOUBLE_x_preset + b) = fg_intensity; + bitmap.pix(y_preset, DOUBLE_x_preset + b) = fg_intensity; prev_bit = back_intensity; } } else { - if (bitmap.pix16(y_preset, x_preset + b) == fg_intensity) + if (bitmap.pix(y_preset, x_preset + b) == fg_intensity) { prev_bit = fg_intensity; } else { if (prev_bit == fg_intensity) - bitmap.pix16(y_preset, x_preset + b) = fg_intensity; + bitmap.pix(y_preset, x_preset + b) = fg_intensity; prev_bit = back_intensity; } } diff --git a/src/mame/video/warpwarp.cpp b/src/mame/video/warpwarp.cpp index 53685316957..d4b05326db0 100644 --- a/src/mame/video/warpwarp.cpp +++ b/src/mame/video/warpwarp.cpp @@ -245,7 +245,7 @@ void warpwarp_state::warpwarp_videoram_w(offs_t offset, uint8_t data) inline void warpwarp_state::plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) { if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } void warpwarp_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen) diff --git a/src/mame/video/wecleman.cpp b/src/mame/video/wecleman.cpp index e771a50e8ce..2a7ec37d4cc 100644 --- a/src/mame/video/wecleman.cpp +++ b/src/mame/video/wecleman.cpp @@ -542,29 +542,21 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c }; - const uint8_t *src_ptr; - const pen_t *pal_ptr, *rgb_ptr; - - int scrollx, sy, sx; - int mdy, tdy, i; - - rgb_ptr = m_palette->pens(); + pen_t const *const rgb_ptr = m_palette->pens(); if (priority == 0x02) { // draw sky; each scanline is assumed to be dword aligned - for (sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) + for (int sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) { - uint32_t *dst = &bitmap.pix32(sy+BMP_PAD, BMP_PAD); - uint32_t pix; - uint16_t road; + uint32_t *const dst = &bitmap.pix(sy+BMP_PAD, BMP_PAD); - road = m_roadram[sy]; + uint16_t road = m_roadram[sy]; if ((road>>8) != 0x02) continue; - pix = rgb_ptr[(m_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0]; + uint32_t pix = rgb_ptr[(m_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0]; - for (sx = 0; sx < DST_WIDTH; sx++) + for (int sx = 0; sx < DST_WIDTH; sx++) dst[sx] = pix; } } @@ -573,23 +565,21 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c // draw road pen_t road_rgb[48]; - for (i=0; i<48; i++) + for (int i=0; i<48; i++) { int color = road_color[i]; road_rgb[i] = color ? rgb_ptr[color] : 0xffffffff; } - for (sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) + for (int sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) { - uint32_t *dst = &bitmap.pix32(sy+BMP_PAD, BMP_PAD); - uint32_t pix; - uint16_t road; + uint32_t *const dst = &bitmap.pix(sy+BMP_PAD, BMP_PAD); - road = m_roadram[sy]; + uint16_t road = m_roadram[sy]; if ((road>>8) != 0x04) continue; road &= YMASK; - src_ptr = m_gfxdecode->gfx(1)->get_data((road << 3)); + uint8_t const *const src_ptr = m_gfxdecode->gfx(1)->get_data((road << 3)); m_gfxdecode->gfx(1)->get_data((road << 3) + 1); m_gfxdecode->gfx(1)->get_data((road << 3) + 2); m_gfxdecode->gfx(1)->get_data((road << 3) + 3); @@ -597,20 +587,20 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c m_gfxdecode->gfx(1)->get_data((road << 3) + 5); m_gfxdecode->gfx(1)->get_data((road << 3) + 6); m_gfxdecode->gfx(1)->get_data((road << 3) + 7); - mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels(); - tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels(); + int mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels(); + int tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels(); - scrollx = m_roadram[sy+YSIZE] + (0x18 - 0xe00); + int scrollx = m_roadram[sy+YSIZE] + (0x18 - 0xe00); - pal_ptr = road_rgb + ((m_roadram[sy+(YSIZE*2)]<<3) & 8); + pen_t const *const pal_ptr = road_rgb + ((m_roadram[sy+(YSIZE*2)]<<3) & 8); - for (sx = 0; sx < DST_WIDTH; sx++, scrollx++) + for (int sx = 0; sx < DST_WIDTH; sx++, scrollx++) { if (scrollx >= 0 && scrollx < XSIZE) { pen_t temp; - pix = src_ptr[scrollx]; + uint32_t pix = src_ptr[scrollx]; dst[sx] = pal_ptr[pix]; temp = pal_ptr[pix + 16]; @@ -643,45 +633,35 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, int tmw_l2, int tmh_l2, // tilemap width and height in log(2) int alpha, int pal_offset ) // alpha(0-3f), # of color codes to shift { - const uint8_t *src_ptr; - uint16_t *tmap_ptr; - uint32_t *dst_base, *dst_ptr; - const pen_t *pal_base, *pal_ptr; - - int tilew, tileh; - int tmskipx, tmskipy, tmscanx, tmmaskx, tmmasky; - int dx, dy; - int i, j, tx, ty; - if (alpha > 0x1f) return; - tilew = gfx->width(); - tileh = gfx->height(); + int const tilew = gfx->width(); + int const tileh = gfx->height(); - tmmaskx = (1<<tmw_l2) - 1; - tmmasky = (1<<tmh_l2) - 1; + int const tmmaskx = (1<<tmw_l2) - 1; + int const tmmasky = (1<<tmh_l2) - 1; scrollx &= ((tilew<<tmw_l2) - 1); scrolly &= ((tileh<<tmh_l2) - 1); - tmskipx = scrollx / tilew; - dx = -(scrollx & (tilew-1)); - tmskipy = scrolly / tileh; - dy = -(scrolly & (tileh-1)); + int tmskipx = scrollx / tilew; + int const dx = -(scrollx & (tilew-1)); + int tmskipy = scrolly / tileh; + int const dy = -(scrolly & (tileh-1)); - dst_base = &bitmap.pix32(y0+dy, x0+dx); + uint32_t *dst_base = &bitmap.pix(y0+dy, x0+dx); - pal_base = m_palette->pens() + pal_offset * gfx->granularity(); + pen_t const *const pal_base = m_palette->pens() + pal_offset * gfx->granularity(); alpha <<= 6; dst_base += 8; - for (i = 0; i < ycount; i++) + for (int i = 0; i < ycount; i++) { - tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2); - tmscanx = tmskipx; + uint16_t const *const tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2); + int tmscanx = tmskipx; - for (j = 0; j < xcount; j++) + for (int j = 0; j < xcount; j++) { uint16_t tiledata = tmap_ptr[tmscanx++ & tmmaskx]; @@ -691,29 +671,28 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, // Wec Le Mans specific: decodes tile color in EAX uint16_t tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12); - src_ptr = gfx->get_data(tile_index); - pal_ptr = pal_base + tile_color * gfx->granularity(); - dst_ptr = dst_base + j * tilew; + uint8_t const *src_ptr = gfx->get_data(tile_index); + pen_t const *const pal_ptr = pal_base + tile_color * gfx->granularity(); + uint32_t *dst_ptr = dst_base + j * tilew; /* alpha case */ if (alpha > 0) { - for (ty = 0; ty < tileh; ty++) + for (int ty = 0; ty < tileh; ty++) { - for (tx = 0; tx < tilew; tx++) + for (int tx = 0; tx < tilew; tx++) { uint8_t srcpix = *src_ptr++; pen_t srcrgb = pal_ptr[srcpix]; uint32_t dstrgb = dst_ptr[tx]; - int sr, sg, sb, dr, dg, db; - sr = (srcrgb >> 3) & 0x1f; - sg = (srcrgb >> 11) & 0x1f; - sb = (srcrgb >> 19) & 0x1f; + int sr = (srcrgb >> 3) & 0x1f; + int sg = (srcrgb >> 11) & 0x1f; + int sb = (srcrgb >> 19) & 0x1f; - dr = (dstrgb >> 3) & 0x1f; - dg = (dstrgb >> 11) & 0x1f; - db = (dstrgb >> 19) & 0x1f; + int dr = (dstrgb >> 3) & 0x1f; + int dg = (dstrgb >> 11) & 0x1f; + int db = (dstrgb >> 19) & 0x1f; dr = (m_t32x32pm[dr - sr + alpha] >> 5) + dr; dg = (m_t32x32pm[dg - sg + alpha] >> 5) + dg; @@ -728,9 +707,9 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, /* non-alpha case */ else { - for (ty = 0; ty < tileh; ty++) + for (int ty = 0; ty < tileh; ty++) { - for (tx = 0; tx < tilew; tx++) + for (int tx = 0; tx < tilew; tx++) dst_ptr[tx] = pal_ptr[*src_ptr++]; dst_ptr += bitmap.rowpixels(); } diff --git a/src/mame/video/welltris.cpp b/src/mame/video/welltris.cpp index 3e1c60d8234..f02af708da4 100644 --- a/src/mame/video/welltris.cpp +++ b/src/mame/video/welltris.cpp @@ -85,15 +85,12 @@ void welltris_state::video_start() void welltris_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int pixdata; + for (int y = 0; y < 256; y++) { + for (int x = 0; x < 512 / 2; x++) { + int pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - for (y = 0; y < 256; y++) { - for (x = 0; x < 512 / 2; x++) { - pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - - bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; - bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; } } } diff --git a/src/mame/video/wgp.cpp b/src/mame/video/wgp.cpp index 50d77ff8f8e..f0e7b5c857d 100644 --- a/src/mame/video/wgp.cpp +++ b/src/mame/video/wgp.cpp @@ -453,8 +453,8 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const static inline void bryan2_drawscanline(bitmap_ind16 &bitmap, int x, int y, int length, const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask = 0xff) { - u16 *dsti = &bitmap.pix16(y, x); - u8 *dstp = &priority.pix8(y, x); + u16 *dsti = &bitmap.pix(y, x); + u8 *dstp = &priority.pix(y, x); if (transparent) { @@ -558,8 +558,8 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons x_step += (((0x7f - row_zoom) << 8) & 0xffff); } - u16 *src16 = &srcbitmap.pix16(src_y_index); - u8 *tsrc = &flagsbitmap.pix8(src_y_index); + const u16 *const src16 = &srcbitmap.pix(src_y_index); + const u8 *const tsrc = &flagsbitmap.pix(src_y_index); u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) diff --git a/src/mame/video/williams.cpp b/src/mame/video/williams.cpp index ec10b269a3e..0ca0c180aad 100644 --- a/src/mame/video/williams.cpp +++ b/src/mame/video/williams.cpp @@ -209,22 +209,21 @@ void williams2_state::video_start() uint32_t williams_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { rgb_t pens[16]; - int x, y; /* precompute the palette */ - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) pens[x] = m_palette->pen_color(m_paletteram[x]); /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ - for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; dest[x+0] = pens[pix >> 4]; dest[x+1] = pens[pix & 0x0f]; } @@ -249,8 +248,8 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int erase_behind = m_video_control & m_scanline_control[y] & 2; - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* latch a new color0 pen? */ if (m_video_control & m_scanline_control[y] & 1) @@ -259,7 +258,7 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; /* clear behind us if requested */ if (erase_behind) @@ -288,13 +287,13 @@ uint32_t williams2_state::screen_update(screen_device &screen, bitmap_rgb32 &bit /* loop over rows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; @@ -322,13 +321,13 @@ uint32_t mysticm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 1; x < 16; x++) pens[x] = m_palette->pen_color(color_decode(m_fg_color, 1, y) * 16 + x); - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; diff --git a/src/mame/video/wolfpack.cpp b/src/mame/video/wolfpack.cpp index 276f053dca5..ecbaea61e32 100644 --- a/src/mame/video/wolfpack.cpp +++ b/src/mame/video/wolfpack.cpp @@ -163,31 +163,24 @@ void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprec { int count = 0; - int x; - int y; - - - m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, + m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, m_torpedo_pic, 0, 0, 0, 2 * (244 - m_torpedo_h), 224 - m_torpedo_v, 0); - for (y = 16; y < 224 - m_torpedo_v; y++) + for (int y = 16; y < 224 - m_torpedo_v; y++) { - int x1; - int x2; - if (y % 16 == 1) count = (count - 1) & 7; - x1 = 248 - m_torpedo_h - count; - x2 = 248 - m_torpedo_h + count; + int const x1 = 248 - m_torpedo_h - count; + int const x2 = 248 - m_torpedo_h + count; - for (x = 2 * x1; x < 2 * x2; x++) + for (int x = 2 * x1; x < 2 * x2; x++) if (m_LFSR[(m_current_index + 0x300 * y + x) % 0x8000]) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; } } @@ -220,7 +213,7 @@ void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, c { for (int y = cliprect.top(); y <= (std::min)(cliprect.bottom(), 127); y++) { - uint16_t* p = &bitmap.pix16(y); + uint16_t *const p = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) p[x] = palette.pen_indirect(p[x]) | 0x08; @@ -286,7 +279,7 @@ WRITE_LINE_MEMBER(wolfpack_state::screen_vblank) if (y < 0 || y >= m_helper.height()) continue; - if (m_helper.pix16(y, x)) + if (m_helper.pix(y, x)) m_collision = 1; } } diff --git a/src/mame/video/wswan.cpp b/src/mame/video/wswan.cpp index 258925e2058..541e1277f42 100644 --- a/src/mame/video/wswan.cpp +++ b/src/mame/video/wswan.cpp @@ -9,7 +9,8 @@ TODO: - remove the redundant parts of m_regs - - split the Color VDP from the Mono VDP? + - split the Color VDP from the Mono VDP + - Add support for WSC high/low contrast (register 14, bit 1) ***************************************************************************/ @@ -306,11 +307,11 @@ void wswan_video_device::draw_background() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else { /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } } @@ -319,9 +320,9 @@ void wswan_video_device::draw_background() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -415,10 +416,10 @@ void wswan_video_device::draw_foreground_0() if (col) { // if (m_color_mode) { - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; // } else { // /* Hmmmm, what should we do here... Is this correct?? */ -// m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; +// m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; // } } } @@ -427,9 +428,9 @@ void wswan_video_device::draw_foreground_0() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -524,10 +525,10 @@ void wswan_video_device::draw_foreground_2() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -535,9 +536,9 @@ void wswan_video_device::draw_foreground_2() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -631,10 +632,10 @@ void wswan_video_device::draw_foreground_3() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -642,9 +643,9 @@ void wswan_video_device::draw_foreground_3() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -774,10 +775,10 @@ void wswan_video_device::handle_sprites(int mask) if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -785,9 +786,9 @@ void wswan_video_device::handle_sprites(int mask) if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -804,8 +805,7 @@ void wswan_video_device::refresh_scanline() rectangle rec(0, WSWAN_X_PIXELS, m_current_line, m_current_line); if (m_lcd_control) { - /* Not sure if these background color checks and settings are correct */ - if (m_color_mode && m_colors_16) + if (m_color_mode) m_bitmap.fill(m_pal[m_bg_control >> 4][m_bg_control & 0x0f], rec); else m_bitmap.fill(m_main_palette[m_bg_control & 0x07], rec); @@ -1007,7 +1007,8 @@ void wswan_video_device::reg_w(offs_t offset, uint8_t data) break; case 0x14: // LCD control // Bit 0 - LCD enable - // Bit 1-7 - Unknown + // Bit 1 - WSC only, brightness low/high + // Bit 2-7 - Unknown m_lcd_control = data; break; case 0x15: // LCD icons diff --git a/src/mame/video/wswan.h b/src/mame/video/wswan.h index a7df4401e77..0ca4b6d3c1d 100644 --- a/src/mame/video/wswan.h +++ b/src/mame/video/wswan.h @@ -16,20 +16,6 @@ #pragma once - -enum -{ - VDP_TYPE_WSWAN = 0, - VDP_TYPE_WSC -}; - -#define WSWAN_X_PIXELS (28*8) -#define WSWAN_Y_PIXELS (18*8) - - -#define WSWAN_VIDEO_IRQ_CB_MEMBER(_name) void _name(int irq) -#define WSWAN_VIDEO_DMASND_CB_MEMBER(_name) void _name() - class wswan_video_device : public device_t, public device_video_interface { public: @@ -51,6 +37,15 @@ public: uint8_t reg_r(offs_t offset); void reg_w(offs_t offset, uint8_t data); + enum + { + VDP_TYPE_WSWAN = 0, + VDP_TYPE_WSC + }; + + static const u16 WSWAN_X_PIXELS = (28*8); + static const u16 WSWAN_Y_PIXELS = (18*8); + protected: // device-level overrides virtual void device_start() override; diff --git a/src/mame/video/x1.cpp b/src/mame/video/x1.cpp index af20bf5577d..e9946209f01 100644 --- a/src/mame/video/x1.cpp +++ b/src/mame/video/x1.cpp @@ -41,23 +41,23 @@ void x1_state::x1_draw_pixel(bitmap_rgb32 &bitmap, int y, int x, uint16_t pen, u if(width && height) { - bitmap.pix32(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); } else if(width) { - bitmap.pix32(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); } else if(height) { - bitmap.pix32(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); } else - bitmap.pix32(y+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+m_xstart) = m_palette->pen(pen); } #define mc6845_h_char_total (m_crtc_vreg[0]) diff --git a/src/mame/video/x68k.cpp b/src/mame/video/x68k.cpp index 170ba8f38da..661a16c55a5 100644 --- a/src/mame/video/x68k.cpp +++ b/src/mame/video/x68k.cpp @@ -51,7 +51,7 @@ rgb_t x68k_state::GGGGGRRRRRBBBBBI(uint32_t raw) inline void x68k_state::plot_pixel(bitmap_rgb32 &bitmap, int x, int y, uint32_t color) { - bitmap.pix32(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* bitmap_rgb32* ::x68k_get_gfx_page(int pri,int type) @@ -219,7 +219,7 @@ void x68k_state::draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle r + (((m_tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); // Colour 0 is displayable if the text layer is at the priority level 2 if((m_pcgpalette->pen(colour) & 0xffffff) || ((m_video.reg[1] & 0x0c00) == 0x0800)) - bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); + bitmap.pix(line, pixel) = m_pcgpalette->pen(colour); bit--; if(bit < 0) { @@ -234,17 +234,15 @@ void x68k_state::draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle r bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, uint8_t priority) { int pixel; - int page; uint32_t loc; // location in GVRAM uint32_t lineoffset; uint16_t xscr,yscr; uint16_t colour = 0; int shift; - int scanline; bool blend, ret = false; uint16_t *pal = (uint16_t *)m_gfxpalette->basemem().base(); - for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline + for(int scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline { if(m_crtc->is_1024x1024()) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer { @@ -275,11 +273,11 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui if(colour || (priority == 3)) { if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - bitmap.pix16(scanline, pixel) = colour; - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; } } loc++; @@ -291,7 +289,7 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(m_video.reg[2] & (1 << priority)) { - page = m_video.gfxlayer_pri[priority]; + int page = m_video.gfxlayer_pri[priority]; // adjust for scroll registers switch(m_video.reg[0] & 0x03) { @@ -317,23 +315,23 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(ret) { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + if(blend && bitmap.pix(scanline, pixel)) + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + bitmap.pix(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - m_special.pix16(scanline, pixel) = 0; - bitmap.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; } } - else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix16(scanline, pixel)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix(scanline, pixel)) { - bitmap.pix16(scanline, pixel) = m_special.pix16(scanline, pixel); - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = m_special.pix(scanline, pixel); + m_special.pix(scanline, pixel) = 0; } loc++; loc &= 0x1ff; @@ -363,23 +361,23 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(ret) { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + if(blend && bitmap.pix(scanline, pixel)) + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + bitmap.pix(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - bitmap.pix16(scanline, pixel) = colour; - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; } } - else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix16(scanline, pixel)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix(scanline, pixel)) { - bitmap.pix16(scanline, pixel) = m_special.pix16(scanline, pixel); - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = m_special.pix(scanline, pixel); + m_special.pix(scanline, pixel) = 0; } loc++; loc &= 0x1ff; @@ -395,7 +393,7 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { colour = m_gvram[lineoffset + loc]; if(colour || (priority == 3)) - bitmap.pix16(scanline, pixel) = colour; + bitmap.pix(scanline, pixel) = colour; loc++; loc &= 0x1ff; } @@ -435,13 +433,13 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) { if((m_video.reg[0] & 0x03) == 3) { - colour = m_gfxbitmap.pix16(scanline, pixel); + colour = m_gfxbitmap.pix(scanline, pixel); if(colour || (m_video.gfx_pri == 2)) - bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI(colour); + bitmap.pix(scanline, pixel) = GGGGGRRRRRBBBBBI(colour); } else if(gfxblend) { - colour = m_gfxbitmap.pix16(scanline, pixel); + colour = m_gfxbitmap.pix(scanline, pixel); if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) blend = true; else @@ -449,14 +447,14 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) if(colour || (m_video.gfx_pri == 2)) { if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); else - bitmap.pix32(scanline, pixel) = pal555(colour, 6, 11, 1); + bitmap.pix(scanline, pixel) = pal555(colour, 6, 11, 1); } } else { - colour = m_gfxbitmap.pix16(scanline, pixel) & 0xff; + colour = m_gfxbitmap.pix(scanline, pixel) & 0xff; if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) { blend = true; @@ -467,9 +465,9 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) if((colour && (m_gfxpalette->pen(colour) & 0xffffff)) || (m_video.gfx_pri == 2)) { if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); else - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); + bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour); } } } @@ -733,9 +731,9 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { - uint8_t colour = m_pcgbitmap.pix16(scanline, pixel) & 0xff; + uint8_t colour = m_pcgbitmap.pix(scanline, pixel) & 0xff; if((colour && (m_pcgpalette->pen(colour) & 0xffffff)) || ((m_video.reg[1] & 0x3000) == 0x2000)) - bitmap.pix32(scanline, pixel) = m_pcgpalette->pen(colour); + bitmap.pix(scanline, pixel) = m_pcgpalette->pen(colour); } } } @@ -757,9 +755,9 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { - colour = m_special.pix16(scanline, pixel) & 0xff; + colour = m_special.pix(scanline, pixel) & 0xff; if(colour) - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour & ~1); + bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour & ~1); } } } diff --git a/src/mame/video/xavix.cpp b/src/mame/video/xavix.cpp index a276ec4c662..3e5fa11035a 100644 --- a/src/mame/video/xavix.cpp +++ b/src/mame/video/xavix.cpp @@ -754,7 +754,7 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, co if ((col >= cliprect.min_x && col <= cliprect.max_x)) { - uint16_t* zyposptr = &m_zbuffer.pix16(ypos); + uint16_t *const zyposptr = &m_zbuffer.pix(ypos); if (zval >= zyposptr[col]) { @@ -762,7 +762,7 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, co if ((m_palram_sh[pen] & 0x1f) < 24) // hue values 24-31 are transparent { - uint32_t* yposptr = &bitmap.pix32(ypos); + uint32_t *const yposptr = &bitmap.pix(ypos); yposptr[col] = paldata[pen]; zyposptr[col] = zval; @@ -867,8 +867,8 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int x = 0; x < width; x++) { - uint32_t* yposptr = &bitmap.pix32(y); - uint16_t* zyposptr = &m_zbuffer.pix16(y); + uint32_t *const yposptr = &bitmap.pix(y); + uint16_t *const zyposptr = &m_zbuffer.pix(y); uint8_t dat = 0; for (int i = 0; i < bpp; i++) diff --git a/src/mame/video/xmen.cpp b/src/mame/video/xmen.cpp index 929d5b76cde..913f33100e4 100644 --- a/src/mame/video/xmen.cpp +++ b/src/mame/video/xmen.cpp @@ -106,8 +106,8 @@ uint32_t xmen_state::screen_update_xmen6p_left(screen_device &screen, bitmap_ind { for(int y = 0; y < 32 * 8; y++) { - uint16_t* line_dest = &bitmap.pix16(y); - uint16_t* line_src = &m_screen_left->pix16(y); + uint16_t *const line_dest = &bitmap.pix(y); + uint16_t const *const line_src = &m_screen_left->pix(y); for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; @@ -120,8 +120,8 @@ uint32_t xmen_state::screen_update_xmen6p_right(screen_device &screen, bitmap_in { for(int y = 0; y < 32 * 8; y++) { - uint16_t* line_dest = &bitmap.pix16(y); - uint16_t* line_src = &m_screen_right->pix16(y); + uint16_t *const line_dest = &bitmap.pix(y); + uint16_t const *const line_src = &m_screen_right->pix(y); for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; diff --git a/src/mame/video/xybots.cpp b/src/mame/video/xybots.cpp index a512800da3d..9da142807b9 100644 --- a/src/mame/video/xybots.cpp +++ b/src/mame/video/xybots.cpp @@ -98,8 +98,8 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -117,9 +117,9 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 else GPC(P3-0) = ~MOCOL3-0 */ - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) ^ 15; - int pfcolor = (pf[x] >> 4) & 0x0f; - int prien = ((mo[x] & 0x0f) > 1); + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) ^ 15; + int const pfcolor = (pf[x] >> 4) & 0x0f; + int const prien = ((mo[x] & 0x0f) > 1); if (prien) { diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index a095f703de2..3d7c47724ea 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -1221,21 +1221,19 @@ inline void ygv608_device::draw_layer_roz(screen_device &screen, bitmap_ind16 &b void ygv608_device::ygv608_draw_mosaic(bitmap_ind16 &bitmap, const rectangle &cliprect, int n) { - int x, y, mask; - if (n <= 0) { return; } // mask to drop the lowest n-bits - mask = ~((1 << n) - 1); + int const mask = ~((1 << n) - 1); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - bitmap.pix16(y, x) = bitmap.pix16(y & mask, x & mask); + bitmap.pix(y, x) = bitmap.pix(y & mask, x & mask); } } } diff --git a/src/mame/video/z88.cpp b/src/mame/video/z88.cpp index ce89fb011bb..3619cd33847 100644 --- a/src/mame/video/z88.cpp +++ b/src/mame/video/z88.cpp @@ -15,7 +15,7 @@ inline void z88_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint16_t color) { if (x < Z88_SCREEN_WIDTH) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } // convert absolute offset into correct address to get data from diff --git a/src/mame/video/zac2650.cpp b/src/mame/video/zac2650.cpp index 1102d31c7c3..8fdbe48d159 100644 --- a/src/mame/video/zac2650.cpp +++ b/src/mame/video/zac2650.cpp @@ -51,7 +51,6 @@ uint8_t zac2650_state::tinvader_port_0_r() int zac2650_state::SpriteCollision(int first,int second) { int Checksum=0; - int x,y; const rectangle &visarea = m_screen->visible_area(); if((m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (m_s2636_0_ram[second * 0x10 + 10] < 0xf0)) @@ -70,12 +69,12 @@ int zac2650_state::SpriteCollision(int first,int second) /* Get fingerprint */ - for (x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++) + for (int y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - Checksum += m_spritebitmap.pix16(y, x); + Checksum += m_spritebitmap.pix(y, x); } } @@ -89,12 +88,12 @@ int zac2650_state::SpriteCollision(int first,int second) /* Remove fingerprint */ - for (x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = fy; y < fy +m_gfxdecode->gfx(expand)->height(); y++) + for (int y = fy; y < fy +m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - Checksum -= m_spritebitmap.pix16(y, x); + Checksum -= m_spritebitmap.pix(y, x); } } @@ -137,7 +136,6 @@ void zac2650_state::video_start() void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; const rectangle &visarea = m_screen->visible_area(); /* -------------------------------------------------------------- */ @@ -156,7 +154,7 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect // for collision detection checking copybitmap(m_bitmap,bitmap,0,0,0,0,visarea); - for(offs=0;offs<0x50;offs+=0x10) + for(int offs=0;offs<0x50;offs+=0x10) { if((m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30)) { @@ -164,7 +162,6 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int expand = ((m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1; int bx = (m_s2636_0_ram[offs+10] * 4) - 22; int by = (m_s2636_0_ram[offs+12] * 3) + 3; - int x,y; /* Sprite->Background collision detection */ m_gfxdecode->gfx(expand)->transpen(bitmap,cliprect, @@ -173,12 +170,12 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect 0,0, bx,by, 0); - for (x = bx; x < bx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = bx; x < bx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = by; y < by +m_gfxdecode->gfx(expand)->height(); y++) + for (int y = by; y < by +m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - if (bitmap.pix16(y, x) != m_bitmap.pix16(y, x)) + if (bitmap.pix(y, x) != m_bitmap.pix(y, x)) { m_CollisionBackground = 0x80; break; diff --git a/src/mame/video/zaxxon.cpp b/src/mame/video/zaxxon.cpp index b85421f90e8..b9985fd4d41 100644 --- a/src/mame/video/zaxxon.cpp +++ b/src/mame/video/zaxxon.cpp @@ -304,7 +304,6 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre int ymask = pixmap.height() - 1; int flipmask = m_flip_screen ? 0xff : 0x00; int flipoffs = m_flip_screen ? 0x38 : 0x40; - int x, y; /* the starting X value is offset by 1 pixel (normal) or 7 pixels */ /* (flipped) due to a delay in the loading */ @@ -314,25 +313,23 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre flipoffs += 7; /* loop over visible rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); - int srcx, srcy, vf; - uint16_t *src; + uint16_t *const dst = &bitmap.pix(y); /* VF = flipped V signals */ - vf = y ^ flipmask; + int vf = y ^ flipmask; /* base of the source row comes from VF plus the scroll value */ /* this is done by the 3 4-bit adders at U56, U74, U75 */ - srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; - src = &pixmap.pix16(srcy & ymask); + int srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; + uint16_t const *src = &pixmap.pix(srcy & ymask); /* loop over visible columns */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* start with HF = flipped H signals */ - srcx = x ^ flipmask; + int srcx = x ^ flipmask; if (skew) { /* position within source row is a two-stage addition */ diff --git a/src/mame/video/zx.cpp b/src/mame/video/zx.cpp index d5fd7ef136d..7ce719a7e1c 100644 --- a/src/mame/video/zx.cpp +++ b/src/mame/video/zx.cpp @@ -67,7 +67,7 @@ void zx_state::refresh_w(offs_t offset, uint8_t data) if(m_ula_char_buffer & 0x80) pixels = ~pixels; if(x < 384-8 && y < 311) { - uint16_t *dest = &m_bitmap_render->pix16(y, x); + uint16_t *dest = &m_bitmap_render->pix(y, x); for(int i=0; i<8; i++) *dest++ |= pixels & (0x80 >> i) ? 1 : 0; } diff --git a/src/mame/video/zx8301.cpp b/src/mame/video/zx8301.cpp index 5904091ee2a..3e7e858f1d0 100644 --- a/src/mame/video/zx8301.cpp +++ b/src/mame/video/zx8301.cpp @@ -261,7 +261,7 @@ void zx8301_device::draw_line_mode4(bitmap_rgb32 &bitmap, int y, uint16_t da) int green = BIT(byte_high, 7); int color = (green << 1) | red; - bitmap.pix32(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; + bitmap.pix(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; byte_high <<= 1; byte_low <<= 1; @@ -306,8 +306,8 @@ void zx8301_device::draw_line_mode8(bitmap_rgb32 &bitmap, int y, uint16_t da) flash_color = color; } - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix(y, x++) = PALETTE_ZX8301[color]; byte_high <<= 2; byte_low <<= 2; diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp index b8c0bbe7b80..80e808ed38f 100644 --- a/src/osd/modules/debugger/debuggdbstub.cpp +++ b/src/osd/modules/debugger/debuggdbstub.cpp @@ -889,7 +889,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_q(const char *buf) if ( !hex_decode(&data, buf, strlen(buf) / 2) ) return REPLY_ENN; std::string command(data.begin(), data.end()); - text_buffer *textbuf = m_debugger_console->get_console_textbuf(); + text_buffer &textbuf = m_debugger_console->get_console_textbuf(); text_buffer_clear(textbuf); m_debugger_console->execute_command(command, false); uint32_t nlines = text_buffer_num_lines(textbuf); diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 296b148c5db..5e1e7f5c080 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -225,11 +225,7 @@ static void view_list_remove(debug_area* item) static debug_area *dview_alloc(running_machine &machine, debug_view_type type) { - debug_area *dv; - - dv = global_alloc(debug_area(machine, type)); - - return dv; + return new debug_area(machine, type); } static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) @@ -357,7 +353,7 @@ void debug_imgui::handle_keys() { switch (event.event_type) { - case ui_event::IME_CHAR: + case ui_event::type::IME_CHAR: m_key_char = event.ch; if(focus_view != nullptr) focus_view->view->process_char(m_key_char); @@ -1406,7 +1402,7 @@ void debug_imgui::update() if(to_delete != nullptr) { view_list_remove(to_delete); - global_free(to_delete); + delete to_delete; } ImGui::PopStyleColor(12); diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp index e6ad4c0986f..5589a48018a 100644 --- a/src/osd/modules/debugger/win/consolewininfo.cpp +++ b/src/osd/modules/debugger/win/consolewininfo.cpp @@ -30,10 +30,10 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : goto cleanup; // create the views - m_views[1].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_STATE))); + m_views[1].reset(new debugview_info(debugger, *this, window(), DVT_STATE)); if (!m_views[1]->is_valid()) goto cleanup; - m_views[2].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_CONSOLE))); + m_views[2].reset(new debugview_info(debugger, *this, window(), DVT_CONSOLE)); if (!m_views[2]->is_valid()) goto cleanup; diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp index 800443b47c1..f68a7652c77 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp +++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp @@ -26,7 +26,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo if (!window()) return; - m_views[0].reset(global_alloc(disasmview_info(debugger, *this, window()))); + m_views[0].reset(new disasmview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp index 6d2cd59b554..88b6022aa9a 100644 --- a/src/osd/modules/debugger/win/logwininfo.cpp +++ b/src/osd/modules/debugger/win/logwininfo.cpp @@ -19,7 +19,7 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(logview_info(debugger, *this, window()))); + m_views[0].reset(new logview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp index 93151cc018d..18f28252f12 100644 --- a/src/osd/modules/debugger/win/memorywininfo.cpp +++ b/src/osd/modules/debugger/win/memorywininfo.cpp @@ -23,7 +23,7 @@ memorywin_info::memorywin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(memoryview_info(debugger, *this, window()))); + m_views[0].reset(new memoryview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/pointswininfo.cpp b/src/osd/modules/debugger/win/pointswininfo.cpp index 24a8f865e6f..eb2ca1875e2 100644 --- a/src/osd/modules/debugger/win/pointswininfo.cpp +++ b/src/osd/modules/debugger/win/pointswininfo.cpp @@ -20,7 +20,7 @@ pointswin_info::pointswin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS))); + m_views[0].reset(new debugview_info(debugger, *this, window(), DVT_BREAK_POINTS)); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); @@ -96,7 +96,7 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) { case ID_SHOW_BREAKPOINTS: m_views[0].reset(); - m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS))); + m_views[0].reset(new debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS)); if (!m_views[0]->is_valid()) m_views[0].reset(); win_set_window_text_utf8(window(), "All Breakpoints"); @@ -105,7 +105,7 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) case ID_SHOW_WATCHPOINTS: m_views[0].reset(); - m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS))); + m_views[0].reset(new debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS)); if (!m_views[0]->is_valid()) m_views[0].reset(); win_set_window_text_utf8(window(), "All Watchpoints"); diff --git a/src/osd/modules/file/posixptty.cpp b/src/osd/modules/file/posixptty.cpp index 5b38acc750a..5ecb37057ad 100644 --- a/src/osd/modules/file/posixptty.cpp +++ b/src/osd/modules/file/posixptty.cpp @@ -19,7 +19,7 @@ #include <unistd.h> #include <cstdlib> -#if defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) #include <termios.h> #include <libutil.h> #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp index 82f70c17672..b8a60aee200 100644 --- a/src/osd/modules/font/font_dwrite.cpp +++ b/src/osd/modules/font/font_dwrite.cpp @@ -146,7 +146,7 @@ HRESULT SaveBitmap2(bitmap_argb32 &bitmap, const WCHAR *filename) uint32_t* pRow = pBitmap.get() + (y * bitmap.width()); for (int x = 0; x < bitmap.width(); x++) { - uint32_t pixel = bitmap.pix32(y, x); + uint32_t pixel = bitmap.pix(y, x); pRow[x] = (pixel == 0xFFFFFFFF) ? rgb_t(0xFF, 0x00, 0x00, 0x00) : rgb_t(0xFF, 0xFF, 0xFF, 0xFF); } } @@ -570,7 +570,7 @@ public: // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &pixels[(y + actbounds.min_y) * bmwidth]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index a473b71b35a..08c1f076970 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -174,7 +174,7 @@ bool osd_font_sdl::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_ // copy the rendered character image into it for (int y = 0; y < bitmap.height(); y++) { - std::uint32_t *const dstrow = &bitmap.pix32(y); + std::uint32_t *const dstrow = &bitmap.pix(y); std::uint8_t const *const srcrow = reinterpret_cast<std::uint8_t const *>(drawsurf->pixels) + (y * drawsurf->pitch); for (int x = 0; x < drawsurf->w; x++) diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp index 95f10c0a051..4cb286c9deb 100644 --- a/src/osd/modules/font/font_windows.cpp +++ b/src/osd/modules/font/font_windows.cpp @@ -28,6 +28,7 @@ namespace { + class osd_font_windows : public osd_font { public: @@ -260,7 +261,7 @@ bool osd_font_windows::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, int32_t // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &bits[(y + actbounds.min_y) * rowbytes]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 25d4b979e87..a04952bcdbc 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -290,42 +290,42 @@ void osd_common_t::register_options() int num; std::vector<const char *> dnames; - m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, num, names); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_MONITOR_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_FONT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_KEYBOARDINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_MOUSEINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_LIGHTGUNINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_JOYSTICKINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); @@ -333,7 +333,7 @@ void osd_common_t::register_options() #if 0 // Register midi options and update options - m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); @@ -341,13 +341,13 @@ void osd_common_t::register_options() #endif // Register debugger options and update options - m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_DEBUG_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 9fb1b1eef6b..2df6a91b827 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -216,7 +216,7 @@ public: virtual osd_font::ptr font_alloc() override { return m_font_module->font_alloc(); } virtual bool get_font_families(std::string const &font_path, std::vector<std::pair<std::string, std::string> > &result) override { return m_font_module->get_font_families(font_path, result); } - virtual osd_midi_device *create_midi_device() override { return m_midi->create_midi_device(); } + virtual std::unique_ptr<osd_midi_device> create_midi_device() override { return m_midi->create_midi_device(); } // FIXME: everything below seems to be osd specific and not part of // this INTERFACE but part of the osd IMPLEMENTATION @@ -311,10 +311,10 @@ private: // this template function creates a stub which constructs a debugger -template<class _DeviceClass> +template<class DeviceClass> debug_module *osd_debugger_creator() { - return global_alloc(_DeviceClass()); + return new DeviceClass(); } #endif // MAME_OSD_LIB_OSDOBJ_COMMON_H diff --git a/src/osd/modules/midi/midi_module.h b/src/osd/modules/midi/midi_module.h index 6c50cdd3edc..8e64800622e 100644 --- a/src/osd/modules/midi/midi_module.h +++ b/src/osd/modules/midi/midi_module.h @@ -4,13 +4,17 @@ * midi_module.h * */ +#ifndef MAME_OSD_MODULES_MIDI_MIDI_MODULE_H +#define MAME_OSD_MODULES_MIDI_MIDI_MODULE_H -#ifndef MIDI_MODULE_H_ -#define MIDI_MODULE_H_ +#pragma once #include "osdepend.h" #include "modules/osdmodule.h" +#include <memory> + + //============================================================ // CONSTANTS //============================================================ @@ -23,10 +27,9 @@ public: virtual ~midi_module() { } // specific routines - virtual osd_midi_device *create_midi_device() = 0; + virtual std::unique_ptr<osd_midi_device> create_midi_device() = 0; // FIXME: should return a list of strings ... - virtual void list_midi_devices(void) = 0; + virtual void list_midi_devices() = 0; }; - -#endif /* MIDI_MODULE_H_ */ +#endif // MAME_OSD_MODULES_MIDI_MIDI_MODULE_H diff --git a/src/osd/modules/midi/none.cpp b/src/osd/modules/midi/none.cpp index 822de79bd08..25f83b45fbe 100644 --- a/src/osd/modules/midi/none.cpp +++ b/src/osd/modules/midi/none.cpp @@ -17,8 +17,7 @@ class none_module : public osd_module, public midi_module { public: - none_module() - : osd_module(OSD_MIDI_PROVIDER, "pm"), midi_module() + none_module() : osd_module(OSD_MIDI_PROVIDER, "pm"), midi_module() { } virtual ~none_module() { } @@ -26,7 +25,7 @@ public: virtual int init(const osd_options &options) override; virtual void exit() override; - virtual osd_midi_device *create_midi_device() override; + virtual std::unique_ptr<osd_midi_device> create_midi_device() override; virtual void list_midi_devices() override; }; @@ -43,9 +42,9 @@ public: virtual void write(uint8_t data) override; }; -osd_midi_device *none_module::create_midi_device() +std::unique_ptr<osd_midi_device> none_module::create_midi_device() { - return global_alloc(osd_midi_device_none()); + return std::make_unique<osd_midi_device_none>(); } diff --git a/src/osd/modules/midi/portmidi.cpp b/src/osd/modules/midi/portmidi.cpp index 64f71ca6689..9deca98ea2d 100644 --- a/src/osd/modules/midi/portmidi.cpp +++ b/src/osd/modules/midi/portmidi.cpp @@ -29,7 +29,7 @@ public: virtual int init(const osd_options &options)override; virtual void exit()override; - virtual osd_midi_device *create_midi_device() override; + virtual std::unique_ptr<osd_midi_device> create_midi_device() override; virtual void list_midi_devices() override; }; @@ -60,9 +60,9 @@ private: bool rx_sysex; }; -osd_midi_device *pm_module::create_midi_device() +std::unique_ptr<osd_midi_device> pm_module::create_midi_device() { - return global_alloc(osd_midi_device_pm()); + return std::make_unique<osd_midi_device_pm>(); } diff --git a/src/osd/modules/netdev/pcap.cpp b/src/osd/modules/netdev/pcap.cpp index 799cff9ec0e..2ae32df0f3b 100644 --- a/src/osd/modules/netdev/pcap.cpp +++ b/src/osd/modules/netdev/pcap.cpp @@ -250,7 +250,7 @@ netdev_pcap::~netdev_pcap() static CREATE_NETDEV(create_pcap) { - auto *dev = global_alloc(netdev_pcap(ifname, ifdev, rate)); + auto *dev = new netdev_pcap(ifname, ifdev, rate); return dynamic_cast<osd_netdev *>(dev); } diff --git a/src/osd/modules/netdev/taptun.cpp b/src/osd/modules/netdev/taptun.cpp index 1b549f5b3b2..baa45da0d5d 100644 --- a/src/osd/modules/netdev/taptun.cpp +++ b/src/osd/modules/netdev/taptun.cpp @@ -337,7 +337,7 @@ int netdev_tap::recv_dev(uint8_t **buf) static CREATE_NETDEV(create_tap) { - auto *dev = global_alloc(netdev_tap(ifname, ifdev, rate)); + auto *dev = new netdev_tap(ifname, ifdev, rate); return dynamic_cast<osd_netdev *>(dev); } diff --git a/src/osd/modules/opengl/osd_opengl.h b/src/osd/modules/opengl/osd_opengl.h index 47d0b3c429c..d3e2a758d73 100644 --- a/src/osd/modules/opengl/osd_opengl.h +++ b/src/osd/modules/opengl/osd_opengl.h @@ -21,7 +21,7 @@ #ifdef _MSC_VER #include <windows.h> #include "GL/GL.h" - #include "bgfx/3rdparty/khronos/gl/glext.h " + #include "bgfx/3rdparty/khronos/gl/glext.h" #ifndef USE_DISPATCH_GL #include "bgfx/3rdparty/khronos/wgl/wglext.h" #endif diff --git a/src/osd/modules/osdmodule.cpp b/src/osd/modules/osdmodule.cpp index 75adc5c75bb..fec18ac5335 100644 --- a/src/osd/modules/osdmodule.cpp +++ b/src/osd/modules/osdmodule.cpp @@ -12,36 +12,23 @@ osd_module_manager::osd_module_manager() { - for (int i=0; i<MAX_MODULES; i++) - { - m_modules[i] = nullptr; - m_selected[i] = nullptr; - } } + osd_module_manager::~osd_module_manager() { - for (int i = 0; m_modules[i] != nullptr; i++) - { - global_free(m_modules[i]); - } } void osd_module_manager::register_module(const module_type &mod_type) { - auto const slot = std::find(std::begin(m_modules), std::end(m_modules), nullptr); - if (std::end(m_modules) == slot) - throw emu_fatalerror("osd_module_manager::register_module: Module registration beyond MAX_MODULES!"); - - osd_module *module = mod_type(); + std::unique_ptr<osd_module> module = mod_type(); if (module->probe()) { osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type()); - *slot = module; + m_modules.emplace_back(std::move(module)); } else { osd_printf_verbose("===> not supported %s %s\n", module->name(), module->type()); - global_free(module); } } @@ -54,7 +41,7 @@ osd_module *osd_module_manager::get_module_generic(const char *type, const char { int const i = get_module_index(type, name); if (i >= 0) - return m_modules[i]; + return m_modules[i].get(); else return nullptr; } @@ -64,54 +51,43 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name osd_module *m = get_module_generic(type, name); // FIXME: check if already exists! - int i; - for (i = 0; m_selected[i] != nullptr; i++) - ; - m_selected[i] = m; + if (m) + m_selected.emplace_back(*m); return m; } void osd_module_manager::init(const osd_options &options) { - for (int i = 0; m_selected[i] != nullptr; i++) - { - m_selected[i]->init(options); - } + for (osd_module &m : m_selected) + m.init(options); } void osd_module_manager::exit() { // Find count - int cnt; - for (cnt = 0; m_selected[cnt] != nullptr; cnt++) - ; - for (int i = cnt - 1; i >= 0; i--) + while (!m_selected.empty()) { - m_selected[i]->exit(); - m_selected[i] = nullptr; + m_selected.back().get().exit(); + m_selected.pop_back(); } } int osd_module_manager::get_module_index(const char *type, const char *name) const { - for (int i = 0; m_modules[i] != nullptr; i++) + for (int i = 0; m_modules.size() > i; i++) { - if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0))) + if ((m_modules[i]->type() == type) && (!name[0] || (m_modules[i]->name() == name))) return i; } return -1; } -void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) const +void osd_module_manager::get_module_names(const char *type, const int max, int &num, const char *names[]) const { - *num = 0; - for (int i = 0; m_modules[i] != nullptr; i++) + num = 0; + for (int i = 0; (m_modules.size() > i) && (max > num); i++) { - if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max)) - { - names[*num] = m_modules[i]->name(); - *num = *num + 1; - } - + if (m_modules[i]->type() == type) + names[num++] = m_modules[i]->name().c_str(); } } diff --git a/src/osd/modules/osdmodule.h b/src/osd/modules/osdmodule.h index 95178b27f70..cd72ad2c480 100644 --- a/src/osd/modules/osdmodule.h +++ b/src/osd/modules/osdmodule.h @@ -7,62 +7,63 @@ OSD module management *******************************************************************c********/ - -//#pragma once - #ifndef MAME_OSD_MODULES_OSDMODULE_H #define MAME_OSD_MODULES_OSDMODULE_H +#pragma once + #include "osdcore.h" #include "osdepend.h" +#include <functional> +#include <memory> +#include <string> +#include <vector> + + //============================================================ // TYPE DEFINITIONS //============================================================ class osd_options; -class osd_module; // ======================> osd_module class osd_module { public: - - osd_module(const char *type, const char *name) - : m_name(name), m_type(type) - {} virtual ~osd_module() { } - const char * name() const { return m_name.c_str(); } - const char * type() const { return m_type.c_str(); } + std::string const &name() const { return m_name; } + std::string const &type() const { return m_type; } virtual bool probe() { return true; } virtual int init(const osd_options &options) = 0; virtual void exit() { } +protected: + osd_module(const char *type, const char *name) : m_name(name), m_type(type) { } + osd_module(osd_module const &) = delete; + private: - std::string m_name; - std::string m_type; + std::string const m_name; + std::string const m_type; }; // a module_type is simply a pointer to its alloc function -typedef osd_module *(*module_type)(); +typedef std::unique_ptr<osd_module> (*module_type)(); // this template function creates a stub which constructs a module -template<class ModuleClass> -osd_module *module_creator() +template <class ModuleClass> +std::unique_ptr<osd_module> module_creator() { - return global_alloc(ModuleClass()); + return std::unique_ptr<osd_module>(new ModuleClass); } class osd_module_manager { public: - - static const int MAX_MODULES = 64; - osd_module_manager(); ~osd_module_manager(); @@ -79,7 +80,7 @@ public: osd_module *select_module(const char *type, const char *name = ""); - void get_module_names(const char *type, const int max, int *num, const char *names[]) const; + void get_module_names(const char *type, const int max, int &num, const char *names[]) const; void init(const osd_options &options); @@ -88,8 +89,8 @@ public: private: int get_module_index(const char *type, const char *name) const; - osd_module *m_modules[MAX_MODULES]; - osd_module *m_selected[MAX_MODULES]; + std::vector<std::unique_ptr<osd_module> > m_modules; + std::vector<std::reference_wrapper<osd_module> > m_selected; }; #define MODULE_DEFINITION(mod_id, mod_class) \ diff --git a/src/osd/modules/output/win32_output.cpp b/src/osd/modules/output/win32_output.cpp index f01c46b735d..98731b32164 100644 --- a/src/osd/modules/output/win32_output.cpp +++ b/src/osd/modules/output/win32_output.cpp @@ -162,7 +162,7 @@ void output_win32::exit() { registered_client *temp = m_clientlist; m_clientlist = temp->next; - global_free(temp); + delete temp; } // broadcast a shutdown message @@ -266,7 +266,7 @@ LRESULT output_win32::register_client(HWND hwnd, LPARAM id) } // add us to the end - *client = global_alloc(registered_client); + *client = new registered_client; (*client)->next = nullptr; (*client)->id = id; (*client)->hwnd = hwnd; @@ -293,7 +293,7 @@ LRESULT output_win32::unregister_client(HWND hwnd, LPARAM id) { registered_client *temp = *client; *client = (*client)->next; - global_free(temp); + delete temp; found = true; break; } diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp index 297d7686837..0efea9b6622 100644 --- a/src/osd/modules/render/bgfx/chain.cpp +++ b/src/osd/modules/render/bgfx/chain.cpp @@ -81,7 +81,7 @@ void bgfx_chain::process(chain_manager::screen_prim &prim, int view, int screen, screen_device_iterator screen_iterator(window.machine().root_device()); screen_device* screen_device = screen_iterator.byindex(screen); - uint16_t screen_count(window.target()->current_view().screen_count()); + uint16_t screen_count(window.target()->current_view().visible_screen_count()); uint16_t screen_width = prim.m_quad_width; uint16_t screen_height = prim.m_quad_height; uint32_t rotation_type = diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 6c22a640913..fb3c52e1fb0 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -405,7 +405,7 @@ void chain_manager::create_selection_slider(uint32_t screen_index) return; } - std::unique_ptr<slider_state> state = make_unique_clear<slider_state>(); + std::unique_ptr<slider_state> state = std::make_unique<slider_state>(); state->minval = 0; state->defval = m_current_chain[screen_index]; diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp index 9fd2b0e6855..60d3c8791fe 100644 --- a/src/osd/modules/render/bgfx/inputpair.cpp +++ b/src/osd/modules/render/bgfx/inputpair.cpp @@ -111,7 +111,7 @@ int32_t bgfx_input_pair::texture_changed(int32_t id, std::string *str, int32_t n void bgfx_input_pair::create_selection_slider(uint32_t screen_index) { - m_slider_state = make_unique_clear<slider_state>(); + m_slider_state = std::make_unique<slider_state>(); m_slider_state->minval = 0; m_slider_state->defval = m_current_texture; diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp index 4d51edfc0c4..927898be5a5 100644 --- a/src/osd/modules/render/bgfx/slider.cpp +++ b/src/osd/modules/render/bgfx/slider.cpp @@ -54,7 +54,7 @@ void bgfx_slider::import(float val) std::unique_ptr<slider_state> bgfx_slider::create_core_slider() { - auto state = make_unique_clear<slider_state>(); + auto state = std::make_unique<slider_state>(); state->minval = int32_t(floor(m_min / m_step + 0.5f)); state->defval = int32_t(floor(m_default / m_step + 0.5f)); diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp index a03a6b46125..d539d1aae46 100644 --- a/src/osd/modules/render/bgfx/texturemanager.cpp +++ b/src/osd/modules/render/bgfx/texturemanager.cpp @@ -59,7 +59,11 @@ bgfx_texture* texture_manager::create_png_texture(std::string path, std::string { bitmap_argb32 bitmap; emu_file file(path.c_str(), OPEN_FLAG_READ); - render_load_png(bitmap, file, nullptr, file_name.c_str()); + if (file.open(file_name) == osd_file::error::NONE) + { + render_load_png(bitmap, file); + file.close(); + } if (bitmap.width() == 0 || bitmap.height() == 0) { diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 78e3e2f226f..57ab4943adb 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -115,7 +115,7 @@ public: for (int y = 0; y < m_height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &m_frame.pix32(y); + uint32_t *dst = &m_frame.pix(y); for (int x = 0; x < m_width; x++) { @@ -223,7 +223,7 @@ shaders::~shaders() if (options != nullptr) { - global_free(options); + delete options; options = nullptr; } } @@ -343,7 +343,7 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface) for (int y = 0; y < height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &snapshot.pix32(y); + uint32_t *dst = &snapshot.pix(y); for (int x = 0; x < width; x++) { @@ -359,14 +359,14 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface) // add two text entries describing the image std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine->system().manufacturer).append(" ").append(machine->system().type.fullname()); - png_info pnginfo; + util::png_info pnginfo; pnginfo.add_text("Software", text1.c_str()); pnginfo.add_text("System", text2.c_str()); // now do the actual work - png_error error = png_write_bitmap(file, &pnginfo, snapshot, 1 << 24, nullptr); - if (error != PNGERR_NONE) - osd_printf_error("Error generating PNG for HLSL snapshot: png_error = %d\n", error); + util::png_error error = util::png_write_bitmap(file, &pnginfo, snapshot, 1 << 24, nullptr); + if (error != util::png_error::NONE) + osd_printf_error("Error generating PNG for HLSL snapshot: png_error = %d\n", std::underlying_type_t<util::png_error>(error)); result = snap_copy_target->UnlockRect(); if (FAILED(result)) @@ -499,7 +499,7 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r snap_width = winoptions.d3d_snap_width(); snap_height = winoptions.d3d_snap_height(); - this->options = (hlsl_options*)global_alloc_clear<hlsl_options>(); + this->options = make_unique_clear<hlsl_options>().release(); this->options->params_init = false; // copy last options if initialized @@ -721,7 +721,11 @@ int shaders::create_resources() osd_printf_verbose("Direct3D: Error %08lX during device SetRenderTarget call\n", result); emu_file file(machine->options().art_path(), OPEN_FLAG_READ); - render_load_png(shadow_bitmap, file, nullptr, options->shadow_mask_texture); + if (file.open(options->shadow_mask_texture) == osd_file::error::NONE) + { + render_load_png(shadow_bitmap, file); + file.close(); + } // experimental: if we have a shadow bitmap, create a texture for it if (shadow_bitmap.valid()) @@ -742,7 +746,11 @@ int shaders::create_resources() d3d->get_texture_manager()->m_texture_list.push_back(std::move(tex)); } - render_load_png(lut_bitmap, file, nullptr, options->lut_texture); + if (file.open(options->lut_texture) == osd_file::error::NONE) + { + render_load_png(lut_bitmap, file); + file.close(); + } if (lut_bitmap.valid()) { render_texinfo texture; @@ -761,7 +769,11 @@ int shaders::create_resources() d3d->get_texture_manager()->m_texture_list.push_back(std::move(tex)); } - render_load_png(ui_lut_bitmap, file, nullptr, options->ui_lut_texture); + if (file.open(options->ui_lut_texture) == osd_file::error::NONE) + { + render_load_png(ui_lut_bitmap, file); + file.close(); + } if (ui_lut_bitmap.valid()) { render_texinfo texture; @@ -1976,7 +1988,7 @@ static void get_vector(const char *data, int count, float *out, bool report_erro std::unique_ptr<slider_state> shaders::slider_alloc(int id, const char *title, int32_t minval, int32_t defval, int32_t maxval, int32_t incval, void *arg) { - auto state = make_unique_clear<slider_state>(); + auto state = std::make_unique<slider_state>(); state->minval = minval; state->defval = defval; @@ -2431,7 +2443,7 @@ void uniform::update() } case CU_SCREEN_COUNT: { - int screen_count = win->target()->current_view().screen_count(); + int screen_count = win->target()->current_view().visible_screen_count(); m_shader->set_int("ScreenCount", screen_count); break; } diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 96b04efc3d9..af7c8559ca0 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -335,7 +335,7 @@ int renderer_sdl2::RendererSupportsFormat(Uint32 format, Uint32 access, const ch void renderer_sdl2::add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm) { - copy_info_t *newci = global_alloc(copy_info_t); + copy_info_t *newci = new copy_info_t; *newci = *element; newci->bm_mask = bm; @@ -917,7 +917,7 @@ void renderer_sdl2::exit() (int) bi->perf); copy_info_t *freeme = bi; bi = bi->next; - global_free(freeme); + delete freeme; } s_blit_info[i] = nullptr; } @@ -942,7 +942,7 @@ texture_info * renderer_sdl2::texture_update(const render_primitive &prim) // if we didn't find one, create a new texture if (texture == nullptr && prim.texture.base != nullptr) { - texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags)); + texture = new texture_info(this, prim.texture, setup, prim.flags); /* add us to the texture list */ m_texlist.prepend(*texture); } diff --git a/src/osd/modules/render/draw13.h b/src/osd/modules/render/draw13.h index 26a6bb565bf..21126e8d76a 100644 --- a/src/osd/modules/render/draw13.h +++ b/src/osd/modules/render/draw13.h @@ -8,10 +8,10 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_RENDER_DRAW13_H +#define MAME_OSD_MODULES_RENDER_DRAW13_H -#ifndef __DRAW20__ -#define __DRAW20__ +#pragma once // OSD headers #ifndef OSD_WINDOWS @@ -210,4 +210,4 @@ private: static const copy_info_t s_blit_info_default[]; }; -#endif // __DRAW20__ +#endif // MAME_OSD_MODULES_RENDER_DRAW13_H diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 3052d5fcbca..39f11a26d37 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -957,7 +957,7 @@ void renderer_bgfx::update_recording() int i = 0; for (int y = 0; y < m_avi_bitmap.height(); y++) { - uint32_t *dst = &m_avi_bitmap.pix32(y); + uint32_t *dst = &m_avi_bitmap.pix(y); for (int x = 0; x < m_avi_bitmap.width(); x++) { diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index df1e31a0c25..ee5dffdeaf0 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -118,7 +118,7 @@ static inline uint32_t ycc_to_rgb(uint8_t y, uint8_t cb, uint8_t cr) // drawd3d_init //============================================================ -static d3d_base * d3dintf; // FIX ME +static d3d_base *d3dintf = nullptr; // FIX ME //============================================================ @@ -202,14 +202,15 @@ render_primitive_list *renderer_d3d9::get_primitives() bool renderer_d3d9::init(running_machine &machine) { - d3dintf = global_alloc(d3d_base); + d3dintf = new d3d_base; d3dintf->d3d9_dll = osd::dynamic_module::open({ "d3d9.dll" }); d3d9_create_fn d3d9_create_ptr = d3dintf->d3d9_dll->bind<d3d9_create_fn>("Direct3DCreate9"); if (d3d9_create_ptr == nullptr) { - global_free(d3dintf); + delete d3dintf; + d3dintf = nullptr; osd_printf_verbose("Direct3D: Unable to find Direct3D 9 runtime library\n"); return true; } @@ -217,7 +218,8 @@ bool renderer_d3d9::init(running_machine &machine) d3dintf->d3dobj = (*d3d9_create_ptr)(D3D_SDK_VERSION); if (d3dintf->d3dobj == nullptr) { - global_free(d3dintf); + delete d3dintf; + d3dintf = nullptr; osd_printf_verbose("Direct3D: Unable to initialize Direct3D 9\n"); return true; } @@ -462,7 +464,7 @@ void d3d_texture_manager::create_resources() void d3d_texture_manager::delete_resources() { // is part of m_texlist and will be free'd there - //global_free(m_default_texture); + //delete m_default_texture; m_default_texture = nullptr; // free all textures @@ -505,7 +507,7 @@ renderer_d3d9::renderer_d3d9(std::shared_ptr<osd_window> window) : osd_renderer(window, FLAG_NONE), m_adapter(0), m_width(0), m_height(0), m_refresh(0), m_create_error_count(0), m_device(nullptr), m_gamma_supported(0), m_pixformat(), m_vertexbuf(nullptr), m_lockedbuf(nullptr), m_numverts(0), m_vectorbatch(nullptr), m_batchindex(0), m_numpolys(0), m_toggle(false), m_screen_format(), m_last_texture(nullptr), m_last_texture_flags(0), m_last_blendenable(0), m_last_blendop(0), m_last_blendsrc(0), m_last_blenddst(0), m_last_filter(0), - m_last_wrap(), m_last_modmode(0), m_shaders(nullptr), m_texture_manager(nullptr) + m_last_wrap(), m_last_modmode(0), m_shaders(nullptr), m_texture_manager() { } @@ -811,7 +813,7 @@ int renderer_d3d9::device_create(HWND hwnd) return 1; } - m_texture_manager = global_alloc(d3d_texture_manager(this)); + m_texture_manager = std::make_unique<d3d_texture_manager>(this); // try for XRGB first m_screen_format = D3DFMT_X8R8G8B8; @@ -871,7 +873,7 @@ int renderer_d3d9::device_create_resources() // create shaders only once if (m_shaders == nullptr) { - m_shaders = (shaders*)global_alloc_clear<shaders>(); + m_shaders = new shaders; } if (m_shaders->init(d3dintf, &win->machine(), this)) @@ -962,7 +964,7 @@ renderer_d3d9::~renderer_d3d9() //if (m_shaders != nullptr) //{ // // delete the HLSL interface - // global_free(m_shaders); + // delete m_shaders; // m_shaders = nullptr; //} } @@ -972,7 +974,7 @@ void renderer_d3d9::exit() if (d3dintf != nullptr) { d3dintf->d3dobj->Release(); - global_free(d3dintf); + delete d3dintf; d3dintf = nullptr; } } @@ -984,11 +986,7 @@ void renderer_d3d9::device_delete() // we do not delete the HLSL interface here - if (m_texture_manager != nullptr) - { - global_free(m_texture_manager); - m_texture_manager = nullptr; - } + m_texture_manager.reset(); // free the device itself if (m_device != nullptr) diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index 03527d7374e..2fa4a30873c 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -5,11 +5,11 @@ // drawd3d.h - Win32 Direct3D header // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWD3D_H +#define MAME_OSD_MODULES_RENDER_DRAWD3D_H #pragma once -#ifndef __WIN_DRAWD3D__ -#define __WIN_DRAWD3D__ #ifdef OSD_WINDOWS @@ -127,7 +127,7 @@ public: uint32_t get_last_texture_flags() const { return m_last_texture_flags; } - d3d_texture_manager * get_texture_manager() const { return m_texture_manager; } + d3d_texture_manager * get_texture_manager() const { return m_texture_manager.get(); } texture_info * get_default_texture(); shaders * get_shaders() const { return m_shaders; } @@ -171,9 +171,9 @@ private: shaders * m_shaders; // HLSL interface - d3d_texture_manager * m_texture_manager; // texture manager + std::unique_ptr<d3d_texture_manager> m_texture_manager; // texture manager }; #endif // OSD_WINDOWS -#endif // __WIN_DRAWD3D__ +#endif // MAME_OSD_MODULES_RENDER_DRAWD3D_H diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index bd0e6425b6e..32dac94c24a 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -16,9 +16,6 @@ renderer_gdi::~renderer_gdi() { - // free the bitmap memory - if (m_bmdata != nullptr) - global_free_array(m_bmdata); } //============================================================ @@ -83,13 +80,13 @@ int renderer_gdi::draw(const int update) if (pitch * height * 4 > m_bmsize) { m_bmsize = pitch * height * 4 * 2; - global_free_array(m_bmdata); - m_bmdata = global_alloc_array(uint8_t, m_bmsize); + m_bmdata.reset(); + m_bmdata = std::make_unique<uint8_t []>(m_bmsize); } // draw the primitives to the bitmap win->m_primlist->acquire_lock(); - software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win->m_primlist, m_bmdata, width, height, pitch); + software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win->m_primlist, m_bmdata.get(), width, height, pitch); win->m_primlist->release_lock(); // fill in bitmap-specific info @@ -97,8 +94,9 @@ int renderer_gdi::draw(const int update) m_bminfo.bmiHeader.biHeight = -height; // blit to the screen - StretchDIBits(win->m_dc, 0, 0, width, height, - 0, 0, width, height, - m_bmdata, &m_bminfo, DIB_RGB_COLORS, SRCCOPY); + StretchDIBits( + win->m_dc, 0, 0, width, height, + 0, 0, width, height, + m_bmdata.get(), &m_bminfo, DIB_RGB_COLORS, SRCCOPY); return 0; } diff --git a/src/osd/modules/render/drawgdi.h b/src/osd/modules/render/drawgdi.h index 49d05c18daa..7984998f4bc 100644 --- a/src/osd/modules/render/drawgdi.h +++ b/src/osd/modules/render/drawgdi.h @@ -5,11 +5,11 @@ // drawgdi.h - Win32 GDI drawing // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWGDI_H +#define MAME_OSD_MODULES_RENDER_DRAWGDI_H #pragma once -#ifndef __DRAWGDI__ -#define __DRAWGDI__ // standard windows headers #include <windows.h> @@ -47,9 +47,9 @@ public: virtual void toggle_fsfx() override {}; private: - BITMAPINFO m_bminfo; - uint8_t * m_bmdata; - size_t m_bmsize; + BITMAPINFO m_bminfo; + std::unique_ptr<uint8_t []> m_bmdata; + size_t m_bmsize; }; -#endif // __DRAWGDI__ +#endif // MAME_OSD_MODULES_RENDER_DRAWGDI_H diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index ae030224e74..6d3eae1e8ad 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -307,7 +307,7 @@ renderer_ogl::~renderer_ogl() // free the memory in the window destroy_all_textures(); - global_free(m_gl_context); + delete m_gl_context; m_gl_context = nullptr; } @@ -366,7 +366,7 @@ static void loadgl_functions(osd_gl_context *context) //============================================================ #ifdef USE_DISPATCH_GL -osd_gl_dispatch *gl_dispatch; +osd_gl_dispatch *gl_dispatch = nullptr; #endif void renderer_ogl::load_gl_lib(running_machine &machine) @@ -394,7 +394,7 @@ void renderer_ogl::load_gl_lib(running_machine &machine) #endif #endif #ifdef USE_DISPATCH_GL - gl_dispatch = global_alloc(osd_gl_dispatch); + gl_dispatch = new osd_gl_dispatch; #endif s_dll_loaded = true; } @@ -566,12 +566,12 @@ int renderer_ogl::create() // create renderer #if defined(OSD_WINDOWS) - m_gl_context = global_alloc(win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window())); + m_gl_context = new win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window()); #elif defined(OSD_MAC) // TODO -// m_gl_context = global_alloc(mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window())); +// m_gl_context = new mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window()); #else - m_gl_context = global_alloc(sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window())); + m_gl_context = new sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window()); #endif if (m_gl_context->LastErrorMsg() != nullptr) { @@ -696,7 +696,7 @@ void renderer_ogl::destroy_all_textures() texture->data=nullptr; texture->data_own=false; } - global_free(texture); + delete texture; } i++; } @@ -1907,7 +1907,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, ogl_texture_info *texture; // allocate a new texture - texture = global_alloc(ogl_texture_info); + texture = new ogl_texture_info; // fill in the core data texture->hash = texture_compute_hash(texsource, flags); @@ -1979,7 +1979,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, { if ( texture_shader_create(texsource, texture, flags) ) { - global_free(texture); + delete texture; return nullptr; } } diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h index 525ba0c3ffa..891c5cec814 100644 --- a/src/osd/modules/render/drawogl.h +++ b/src/osd/modules/render/drawogl.h @@ -7,12 +7,11 @@ // SDLMAME by Olivier Galibert and R. Belmont // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWOGL_H +#define MAME_OSD_MODULES_RENDER_DRAWOGL_H #pragma once -#ifndef __DRAWOGL__ -#define __DRAWOGL__ - // OSD headers #ifndef OSD_WINDOWS #ifdef OSD_MAC @@ -239,4 +238,4 @@ private: static bool s_dll_loaded; }; -#endif // __DRAWOGL__ +#endif // MAME_OSD_MODULES_RENDER_DRAWOGL_H diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 76dc1375e5b..1797c5be597 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -111,11 +111,7 @@ void renderer_sdl1::setup_texture(const osd_dim &size) // Determine preferred pixelformat and set up yuv if necessary SDL_GetCurrentDisplayMode(win->monitor()->oshandle(), &mode); - if (m_yuv_bitmap) - { - global_free_array(m_yuv_bitmap); - m_yuv_bitmap = nullptr; - } + m_yuv_bitmap.reset(); fmt = (sdl_sm->pixel_format ? sdl_sm->pixel_format : mode.format); @@ -134,7 +130,7 @@ void renderer_sdl1::setup_texture(const osd_dim &size) m_hw_scale_width = (m_hw_scale_width + 1) & ~1; } if (sdl_sm->is_yuv) - m_yuv_bitmap = global_alloc_array(uint16_t, m_hw_scale_width * m_hw_scale_height); + m_yuv_bitmap = std::make_unique<uint16_t []>(m_hw_scale_width * m_hw_scale_height); int w = m_hw_scale_width * sdl_sm->mult_w; int h = m_hw_scale_height * sdl_sm->mult_h; @@ -257,16 +253,6 @@ renderer_sdl1::~renderer_sdl1() { destroy_all_textures(); - if (m_yuv_lookup != nullptr) - { - global_free_array(m_yuv_lookup); - m_yuv_lookup = nullptr; - } - if (m_yuv_bitmap != nullptr) - { - global_free_array(m_yuv_bitmap); - m_yuv_bitmap = nullptr; - } SDL_DestroyRenderer(m_sdl_renderer); } @@ -448,8 +434,8 @@ int renderer_sdl1::draw(int update) { assert (m_yuv_bitmap != nullptr); assert (surfptr != nullptr); - software_renderer<uint16_t, 3,3,3, 10,5,0>::draw_primitives(*win->m_primlist, m_yuv_bitmap, mamewidth, mameheight, mamewidth); - sm->yuv_blit((uint16_t *)m_yuv_bitmap, surfptr, pitch, m_yuv_lookup, mamewidth, mameheight); + software_renderer<uint16_t, 3,3,3, 10,5,0>::draw_primitives(*win->m_primlist, m_yuv_bitmap.get(), mamewidth, mameheight, mamewidth); + sm->yuv_blit(m_yuv_bitmap.get(), surfptr, pitch, m_yuv_lookup.get(), mamewidth, mameheight); } win->m_primlist->release_lock(); @@ -525,12 +511,11 @@ void renderer_sdl1::yuv_lookup_set(unsigned int pen, unsigned char red, void renderer_sdl1::yuv_init() { - unsigned char r,g,b; - if (m_yuv_lookup == nullptr) - m_yuv_lookup = global_alloc_array(uint32_t, 65536); - for (r = 0; r < 32; r++) - for (g = 0; g < 32; g++) - for (b = 0; b < 32; b++) + if (!m_yuv_lookup) + m_yuv_lookup = std::make_unique<uint32_t []>(65536); + for (unsigned char r = 0; r < 32; r++) + for (unsigned char g = 0; g < 32; g++) + for (unsigned char b = 0; b < 32; b++) { int idx = (r << 10) | (g << 5) | b; yuv_lookup_set(idx, diff --git a/src/osd/modules/render/drawsdl.h b/src/osd/modules/render/drawsdl.h index 6c0b51c0663..bc8246a632d 100644 --- a/src/osd/modules/render/drawsdl.h +++ b/src/osd/modules/render/drawsdl.h @@ -10,10 +10,10 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_RENDER_DRAWSDL_H +#define MAME_OSD_MODULES_RENDER_DRAWSDL_H -#ifndef __DRAWSDL1__ -#define __DRAWSDL1__ +#pragma once #include <SDL2/SDL.h> @@ -26,8 +26,8 @@ public: : osd_renderer(w, FLAG_NEEDS_OPENGL | extra_flags) , m_sdl_renderer(nullptr) , m_texture_id(nullptr) - , m_yuv_lookup(nullptr) - , m_yuv_bitmap(nullptr) + , m_yuv_lookup() + , m_yuv_bitmap() //, m_hw_scale_width(0) //, m_hw_scale_height(0) , m_last_hofs(0) @@ -61,8 +61,8 @@ private: SDL_Texture *m_texture_id; // YUV overlay - uint32_t *m_yuv_lookup; - uint16_t *m_yuv_bitmap; + std::unique_ptr<uint32_t []> m_yuv_lookup; + std::unique_ptr<uint16_t []> m_yuv_bitmap; // if we leave scaling to SDL and the underlying driver, this // is the render_target_width/height to use @@ -85,4 +85,4 @@ struct sdl_scale_mode void (*yuv_blit)(const uint16_t *bitmap, uint8_t *ptr, const int pitch, const uint32_t *lookup, const int width, const int height); }; -#endif // __DRAWSDL1__ +#endif // MAME_OSD_MODULES_RENDER_DRAWSDL_H diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index f2c4e36c0e5..ad7b52049a6 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -91,7 +91,7 @@ public: virtual bool execute_command(const char *command) = 0; // midi interface - virtual osd_midi_device *create_midi_device() = 0; + virtual std::unique_ptr<osd_midi_device> create_midi_device() = 0; protected: virtual ~osd_interface() { } diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp index 070b4e96a2d..b90a139731c 100644 --- a/src/osd/osdnet.cpp +++ b/src/osd/osdnet.cpp @@ -7,7 +7,7 @@ static class std::vector<std::unique_ptr<osd_netdev::entry_t>> netdev_list; void add_netdev(const char *name, const char *description, create_netdev func) { - auto entry = make_unique_clear<osd_netdev::entry_t>(); + auto entry = std::make_unique<osd_netdev::entry_t>(); entry->id = netdev_list.size(); strncpy(entry->name, name, 255); entry->name[255] = '\0'; diff --git a/src/osd/osdnet.h b/src/osd/osdnet.h index 226ae2319a9..32e41663dcc 100644 --- a/src/osd/osdnet.h +++ b/src/osd/osdnet.h @@ -5,6 +5,8 @@ #pragma once +#include <algorithm> + class osd_netdev; #define CREATE_NETDEV(name) class osd_netdev *name(const char *ifname, class device_network_interface *ifdev, int rate) @@ -15,10 +17,16 @@ class osd_netdev public: struct entry_t { - int id; + entry_t() + { + std::fill(std::begin(name), std::end(name), 0); + std::fill(std::begin(description), std::end(description), 0); + } + + int id = 0; char name[256]; char description[256]; - create_netdev func; + create_netdev func = nullptr; }; osd_netdev(class device_network_interface *ifdev, int rate); virtual ~osd_netdev(); diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 70886d76a73..9f07ce7cd49 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -1137,12 +1137,11 @@ sdl_window_info::sdl_window_info( m_prescale = video_config.prescale; m_windowed_dim = osd_dim(config->width, config->height); - m_original_mode = global_alloc(SDL_DM_Wrapper); + m_original_mode = std::make_unique<SDL_DM_Wrapper>(); } sdl_window_info::~sdl_window_info() { - global_free(m_original_mode); } diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index d6010e91ed2..bfe32e6e8a0 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -8,8 +8,8 @@ // //============================================================ -#ifndef __SDLWINDOW__ -#define __SDLWINDOW__ +#ifndef MAME_OSD_SDL_WINDOW_H +#define MAME_OSD_SDL_WINDOW_H #include "osdsdl.h" #include "video.h" @@ -87,7 +87,7 @@ private: render_target * m_target; // Original display_mode - SDL_DM_Wrapper *m_original_mode; + std::unique_ptr<SDL_DM_Wrapper> m_original_mode; int m_extra_flags; @@ -152,4 +152,4 @@ int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks); int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks); -#endif /* __SDLWINDOW__ */ +#endif // MAME_OSD_SDL_WINDOW_H diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 6f8dc3671c9..5a292f78ff6 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -14,11 +14,9 @@ // standard C headers #include <process.h> +#include <algorithm> #include <atomic> #include <cstring> -#include <chrono> -#include <list> -#include <memory> // MAME headers #include "emu.h" @@ -96,7 +94,7 @@ static DWORD main_threadid; //============================================================ // event handling -static std::chrono::system_clock::time_point last_event_check; +static std::chrono::steady_clock::time_point last_event_check; static int ui_temp_pause; static int ui_temp_was_paused; @@ -295,29 +293,31 @@ void windows_osd_interface::window_exit() CloseHandle(ui_pause_event); } + win_window_info::win_window_info( - running_machine &machine, - int index, - std::shared_ptr<osd_monitor_info> monitor, - const osd_window_config *config) : osd_window_t(*config), - m_next(nullptr), - m_init_state(0), - m_startmaximized(0), - m_isminimized(0), - m_ismaximized(0), - m_monitor(monitor), - m_fullscreen(!video_config.windowed), - m_fullscreen_safe(0), - m_aspect(0), - m_target(nullptr), - m_targetview(0), - m_targetorient(0), - m_targetvismask(0), - m_lastclicktime(std::chrono::system_clock::time_point::min()), - m_lastclickx(0), - m_lastclicky(0), - m_machine(machine), - m_attached_mode(false) + running_machine &machine, + int index, + std::shared_ptr<osd_monitor_info> monitor, + const osd_window_config *config) + : osd_window_t(*config) + , m_next(nullptr) + , m_init_state(0) + , m_startmaximized(0) + , m_isminimized(0) + , m_ismaximized(0) + , m_monitor(monitor) + , m_fullscreen(!video_config.windowed) + , m_fullscreen_safe(0) + , m_aspect(0) + , m_target(nullptr) + , m_targetview(0) + , m_targetorient(0) + , m_targetvismask(0) + , m_lastclicktime(std::chrono::steady_clock::time_point::min()) + , m_lastclickx(0) + , m_lastclicky(0) + , m_machine(machine) + , m_attached_mode(false) { memset(m_title,0,sizeof(m_title)); m_non_fullscreen_bounds.left = 0; @@ -350,7 +350,7 @@ void win_window_info::hide_pointer() { GetCursorPos(&s_saved_cursor_pos); - while (ShowCursor(FALSE) >= -1) {}; + while (ShowCursor(FALSE) >= -1) { } ShowCursor(TRUE); } @@ -402,7 +402,7 @@ void win_window_info::show_pointer() void winwindow_process_events_periodic(running_machine &machine) { - auto currticks = std::chrono::system_clock::now(); + auto currticks = std::chrono::steady_clock::now(); assert(GetCurrentThreadId() == main_threadid); @@ -465,7 +465,7 @@ void winwindow_process_events(running_machine &machine, bool ingame, bool nodisp assert(GetCurrentThreadId() == main_threadid); // remember the last time we did this - last_event_check = std::chrono::system_clock::now(); + last_event_check = std::chrono::steady_clock::now(); do { @@ -1185,7 +1185,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR auto *window = (win_window_info *)ptr; // we may get called before SetWindowLongPtr is called - if (window != nullptr) + if (window) { assert(GetCurrentThreadId() == window_threadid); window->update_minmax_state(); @@ -1194,8 +1194,8 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR // handle a few messages switch (message) { - // paint: redraw the last bitmap - case WM_PAINT: + // paint: redraw the last bitmap + case WM_PAINT: { PAINTSTRUCT pstruct; HDC hdc = BeginPaint(wnd, &pstruct); @@ -1203,37 +1203,37 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR if (window->win_has_menu()) DrawMenuBar(window->platform_window()); EndPaint(wnd, &pstruct); - break; } + break; - // non-client paint: punt if full screen - case WM_NCPAINT: - if (!window->fullscreen() || window->win_has_menu()) - return DefWindowProc(wnd, message, wparam, lparam); - break; + // non-client paint: punt if full screen + case WM_NCPAINT: + if (!window->fullscreen() || window->win_has_menu()) + return DefWindowProc(wnd, message, wparam, lparam); + break; - // input: handle the raw input - case WM_INPUT: - downcast<windows_osd_interface&>(window->machine().osd()).handle_input_event(INPUT_EVENT_RAWINPUT, &lparam); - break; + // input: handle the raw input + case WM_INPUT: + downcast<windows_osd_interface&>(window->machine().osd()).handle_input_event(INPUT_EVENT_RAWINPUT, &lparam); + break; - // syskeys - ignore - case WM_SYSKEYUP: - case WM_SYSKEYDOWN: - break; + // syskeys - ignore + case WM_SYSKEYUP: + case WM_SYSKEYDOWN: + break; - // input events - case WM_MOUSEMOVE: - window->machine().ui_input().push_mouse_move_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + // input events + case WM_MOUSEMOVE: + window->machine().ui_input().push_mouse_move_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_MOUSELEAVE: - window->machine().ui_input().push_mouse_leave_event(window->m_target); - break; + case WM_MOUSELEAVE: + window->machine().ui_input().push_mouse_leave_event(window->m_target); + break; - case WM_LBUTTONDOWN: + case WM_LBUTTONDOWN: { - auto ticks = std::chrono::system_clock::now(); + auto const ticks = std::chrono::steady_clock::now(); window->machine().ui_input().push_mouse_down_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); // check for a double-click @@ -1241,7 +1241,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR GET_X_LPARAM(lparam) >= window->m_lastclickx - 4 && GET_X_LPARAM(lparam) <= window->m_lastclickx + 4 && GET_Y_LPARAM(lparam) >= window->m_lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->m_lastclicky + 4) { - window->m_lastclicktime = std::chrono::system_clock::time_point::min(); + window->m_lastclicktime = std::chrono::steady_clock::time_point::min(); window->machine().ui_input().push_mouse_double_click_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); } else @@ -1250,26 +1250,26 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->m_lastclickx = GET_X_LPARAM(lparam); window->m_lastclicky = GET_Y_LPARAM(lparam); } - break; } + break; - case WM_LBUTTONUP: - window->machine().ui_input().push_mouse_up_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + case WM_LBUTTONUP: + window->machine().ui_input().push_mouse_up_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_RBUTTONDOWN: - window->machine().ui_input().push_mouse_rdown_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + case WM_RBUTTONDOWN: + window->machine().ui_input().push_mouse_rdown_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_RBUTTONUP: - window->machine().ui_input().push_mouse_rup_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + case WM_RBUTTONUP: + window->machine().ui_input().push_mouse_rup_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_CHAR: - window->machine().ui_input().push_char_event(window->m_target, (char32_t) wparam); - break; + case WM_CHAR: + window->machine().ui_input().push_char_event(window->m_target, (char32_t) wparam); + break; - case WM_MOUSEWHEEL: + case WM_MOUSEWHEEL: { UINT ucNumLines = 3; // default SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ucNumLines, 0); @@ -1277,32 +1277,33 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR break; } - // pause the system when we start a menu or resize - case WM_ENTERSIZEMOVE: - window->m_resize_state = RESIZE_STATE_RESIZING; - case WM_ENTERMENULOOP: - winwindow_ui_pause(window->machine(), TRUE); - break; - - // unpause the system when we stop a menu or resize and force a redraw - case WM_EXITSIZEMOVE: - window->m_resize_state = RESIZE_STATE_PENDING; - case WM_EXITMENULOOP: - winwindow_ui_pause(window->machine(), FALSE); - InvalidateRect(wnd, nullptr, FALSE); - break; - - // get min/max info: set the minimum window size - case WM_GETMINMAXINFO: + // pause the system when we start a menu or resize + case WM_ENTERSIZEMOVE: + window->m_resize_state = RESIZE_STATE_RESIZING; + case WM_ENTERMENULOOP: + winwindow_ui_pause(window->machine(), TRUE); + break; + + // unpause the system when we stop a menu or resize and force a redraw + case WM_EXITSIZEMOVE: + window->m_resize_state = RESIZE_STATE_PENDING; + case WM_EXITMENULOOP: + winwindow_ui_pause(window->machine(), FALSE); + InvalidateRect(wnd, nullptr, FALSE); + break; + + // get min/max info: set the minimum window size + case WM_GETMINMAXINFO: { auto *minmax = (MINMAXINFO *)lparam; minmax->ptMinTrackSize.x = MIN_WINDOW_DIMX; minmax->ptMinTrackSize.y = MIN_WINDOW_DIMY; break; } + break; - // sizing: constrain to the aspect ratio unless control key is held down - case WM_SIZING: + // sizing: constrain to the aspect ratio unless control key is held down + case WM_SIZING: { RECT *rect = (RECT *)lparam; if (video_config.keepaspect && !(GetAsyncKeyState(VK_CONTROL) & 0x8000)) @@ -1314,11 +1315,11 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR rect->right = r.right(); } InvalidateRect(wnd, nullptr, FALSE); - break; } + break; - // syscommands: catch win_start_maximized - case WM_SYSCOMMAND: + // syscommands: catch win_start_maximized + case WM_SYSCOMMAND: { uint16_t cmd = wparam & 0xfff0; @@ -1339,22 +1340,22 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->maximize_window(); break; } - return DefWindowProc(wnd, message, wparam, lparam); } + return DefWindowProc(wnd, message, wparam, lparam); - // close: cause MAME to exit - case WM_CLOSE: - window->machine().schedule_exit(); - break; + // close: cause MAME to exit + case WM_CLOSE: + window->machine().schedule_exit(); + break; - // destroy: clean up all attached rendering bits and nullptr out our hwnd - case WM_DESTROY: - window->renderer_reset(); - window->set_platform_window(nullptr); - return DefWindowProc(wnd, message, wparam, lparam); + // destroy: clean up all attached rendering bits and nullptr out our hwnd + case WM_DESTROY: + window->renderer_reset(); + window->set_platform_window(nullptr); + return DefWindowProc(wnd, message, wparam, lparam); - // self redraw: draw ourself in a non-painty way - case WM_USER_REDRAW: + // self redraw: draw ourself in a non-painty way + case WM_USER_REDRAW: { HDC hdc = GetDC(wnd); @@ -1362,46 +1363,46 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->draw_video_contents(hdc, false); ReleaseDC(wnd, hdc); - break; } - - // fullscreen set - case WM_USER_SET_FULLSCREEN: - window->set_fullscreen(wparam); - break; - - // minimum size set - case WM_USER_SET_MINSIZE: - window->minimize_window(); - break; - - // maximum size set - case WM_USER_SET_MAXSIZE: - window->maximize_window(); - break; - - // maximum size set - case WM_DISPLAYCHANGE: - /* FIXME: The current codebase has an issue with setting aspect - * ratios correctly after display change. set_aspect should - * be set_forced_aspect and on a refresh this forced aspect should - * be preserved if set. If not, the standard aspect calculation - * should be used. - */ - window->m_monitor->refresh(); - window->m_monitor->update_resolution(LOWORD(lparam), HIWORD(lparam)); - break; - - // set focus: if we're not the primary window, switch back - // commented out ATM because this prevents us from resizing secondary windows -// case WM_SETFOCUS: -// if (window != osd_common_t::s_window_list && osd_common_t::s_window_list != nullptr) -// SetFocus(osd_common_t::s_window_list->m_hwnd); -// break; - - // everything else: defaults - default: - return DefWindowProc(wnd, message, wparam, lparam); + break; + + // fullscreen set + case WM_USER_SET_FULLSCREEN: + window->set_fullscreen(wparam); + break; + + // minimum size set + case WM_USER_SET_MINSIZE: + window->minimize_window(); + break; + + // maximum size set + case WM_USER_SET_MAXSIZE: + window->maximize_window(); + break; + + // maximum size set + case WM_DISPLAYCHANGE: + /* FIXME: The current codebase has an issue with setting aspect + * ratios correctly after display change. set_aspect should + * be set_forced_aspect and on a refresh this forced aspect should + * be preserved if set. If not, the standard aspect calculation + * should be used. + */ + window->m_monitor->refresh(); + window->m_monitor->update_resolution(LOWORD(lparam), HIWORD(lparam)); + break; + + // set focus: if we're not the primary window, switch back + // commented out ATM because this prevents us from resizing secondary windows +// case WM_SETFOCUS: +// if (window != osd_common_t::s_window_list && osd_common_t::s_window_list != nullptr) +// SetFocus(osd_common_t::s_window_list->m_hwnd); +// break; + + // everything else: defaults + default: + return DefWindowProc(wnd, message, wparam, lparam); } return 0; diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 3dccc520a83..22065135efe 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -5,27 +5,27 @@ // window.h - Win32 window handling // //============================================================ +#ifndef MAME_OSD_WINDOWS_WINDOW_H +#define MAME_OSD_WINDOWS_WINDOW_H -#ifndef __WIN_WINDOW__ -#define __WIN_WINDOW__ - -// standard windows headers -#include <windows.h> -#include <windowsx.h> -#include <mmsystem.h> - -#include <chrono> -#include <mutex> -#include <memory> -#include <list> +#pragma once #include "render.h" #include "modules/osdwindow.h" +#include "modules/lib/osdlib.h" -//============================================================ -// PARAMETERS -//============================================================ +#include <chrono> +#include <list> +#include <memory> +#include <mutex> +#include <utility> +#include <vector> + +// standard windows headers +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> //============================================================ @@ -128,7 +128,7 @@ public: u32 m_targetvismask; // input info - std::chrono::system_clock::time_point m_lastclicktime; + std::chrono::steady_clock::time_point m_lastclicktime; int m_lastclickx; int m_lastclicky; @@ -206,4 +206,4 @@ static inline int rect_height(const RECT *rect) return rect->bottom - rect->top; } -#endif +#endif // MAME_OSD_WINDOWS_WINDOW_H diff --git a/src/tools/castool.cpp b/src/tools/castool.cpp index 0b2b4230f8b..e03a15203d5 100644 --- a/src/tools/castool.cpp +++ b/src/tools/castool.cpp @@ -10,15 +10,6 @@ ***************************************************************************/ -#include <cstdio> -#include <cstring> -#include <cctype> -#include <cstdlib> -#include <ctime> -#include <cassert> - -#include "corestr.h" - #include "formats/a26_cas.h" #include "formats/ace_tap.h" #include "formats/adam_cas.h" @@ -61,10 +52,20 @@ #include "formats/x1_tap.h" #include "formats/zx81_p.h" +#include "corestr.h" + +#include <cassert> +#include <cctype> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <ctime> + + struct SupportedCassetteFormats { const char *name; - const struct CassetteFormat * const *formats; + const cassette_image::Format * const *formats; const char *desc; }; @@ -159,8 +160,8 @@ int CLIB_DECL main(int argc, char *argv[]) { int i; int found =0; - const struct CassetteFormat * const *selected_formats = nullptr; - cassette_image *cassette; + const cassette_image::Format * const *selected_formats = nullptr; + cassette_image::ptr cassette; FILE *f; if (argc > 1) @@ -193,14 +194,14 @@ int CLIB_DECL main(int argc, char *argv[]) return -1; } - if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette) != cassette_image::error::SUCCESS) { + if (cassette_image::open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, cassette_image::FLAG_READONLY, cassette) != cassette_image::error::SUCCESS) { fprintf(stderr, "Invalid format of input file.\n"); fclose(f); return -1; } - cassette_dump(cassette,argv[4]); - cassette_close(cassette); + cassette->dump(argv[4]); + cassette.reset(); fclose(f); goto theend; } diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 0444bea3da1..06f2373f5ca 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -507,7 +507,7 @@ public: if (m_info.height == 524/2 || m_info.height == 624/2) { vbi_metadata vbi; - vbi_parse_all(&subbitmap.pix16(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); + vbi_parse_all(&subbitmap.pix(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); vbi_metadata_pack(&m_ldframedata[framenum * VBI_PACKED_BYTES], framenum, &vbi); } @@ -2641,9 +2641,11 @@ static void do_extract_ld(parameters_map ¶ms) report_error(1, "Unable to open file (%s)", output_file_str->second->c_str()); // create the codec configuration - avhuff_decompress_config avconfig; + avhuff_decoder::config avconfig; + bitmap_yuy16 avvideo; std::vector<int16_t> audio_data[16]; uint32_t actsamples; + avconfig.video = &avvideo; avconfig.maxsamples = max_samples_per_frame; avconfig.actsamples = &actsamples; for (int chnum = 0; chnum < ARRAY_LENGTH(audio_data); chnum++) @@ -2659,7 +2661,7 @@ static void do_extract_ld(parameters_map ¶ms) progress(framenum == input_start, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); // set up the fake bitmap for this frame - avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); + avvideo.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the hunk into the buffers diff --git a/src/tools/imgtool/modules/hp85_tape.cpp b/src/tools/imgtool/modules/hp85_tape.cpp index dada87e290a..fbdef06a7cb 100644 --- a/src/tools/imgtool/modules/hp85_tape.cpp +++ b/src/tools/imgtool/modules/hp85_tape.cpp @@ -866,7 +866,7 @@ namespace { tape_image_85& get_tape_image(tape_state_t& ts) { if (ts.img == nullptr) { - ts.img = global_alloc(tape_image_85); + ts.img = new tape_image_85; } return *(ts.img); @@ -916,7 +916,7 @@ namespace { delete state.stream; // Free tape_image - global_free(&tape_image); + delete &tape_image; } imgtoolerr_t hp85_tape_begin_enum (imgtool::directory &enumeration, const char *path) diff --git a/src/tools/imgtool/modules/hp9845_tape.cpp b/src/tools/imgtool/modules/hp9845_tape.cpp index d3416deaefd..e9abc99789c 100644 --- a/src/tools/imgtool/modules/hp9845_tape.cpp +++ b/src/tools/imgtool/modules/hp9845_tape.cpp @@ -985,7 +985,7 @@ static tape_state_t& get_tape_state(imgtool::image &img) static tape_image_t& get_tape_image(tape_state_t& ts) { if (ts.img == nullptr) { - ts.img = global_alloc(tape_image_t); + ts.img = new tape_image_t; } return *(ts.img); @@ -1034,7 +1034,7 @@ static void hp9845_tape_close(imgtool::image &image) delete state.stream; // Free tape_image - global_free(&tape_image); + delete &tape_image; } static imgtoolerr_t hp9845_tape_begin_enum (imgtool::directory &enumeration, const char *path) diff --git a/src/tools/ldresample.cpp b/src/tools/ldresample.cpp index 57c20f7777c..a7dd165c2f9 100644 --- a/src/tools/ldresample.cpp +++ b/src/tools/ldresample.cpp @@ -237,8 +237,8 @@ static chd_error create_chd(chd_file_compressor &file, const char *filename, chd static bool read_chd(chd_file &file, uint32_t field, movie_info &info, uint32_t soundoffs) { // configure the codec - avhuff_decompress_config avconfig; - avconfig.video.wrap(info.bitmap, info.bitmap.cliprect()); + avhuff_decoder::config avconfig; + avconfig.video = &info.bitmap; avconfig.maxsamples = info.lsound.size(); avconfig.actsamples = &info.samples; avconfig.audio[0] = &info.lsound[soundoffs]; diff --git a/src/tools/ldverify.cpp b/src/tools/ldverify.cpp index deee9afba36..e8df214734c 100644 --- a/src/tools/ldverify.cpp +++ b/src/tools/ldverify.cpp @@ -235,8 +235,10 @@ static int read_chd(void *file, int frame, bitmap_yuy16 &bitmap, int16_t *lsound for (int fieldnum = 0; fieldnum < interlace_factor; fieldnum++) { // make a fake bitmap for this field - avhuff_decompress_config avconfig; - avconfig.video.wrap(&bitmap.pix16(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + bitmap_yuy16 video; + video.wrap(&bitmap.pix(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + avhuff_decoder::config avconfig; + avconfig.video = &video; // configure the codec uint32_t numsamples; @@ -320,7 +322,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) // parse the VBI data vbi_metadata metadata; - vbi_parse_all(&bitmap.pix16(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); + vbi_parse_all(&bitmap.pix(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); // if we have data in both 17 and 18, it should match if (metadata.line17 != 0 && metadata.line18 != 0 && metadata.line17 != metadata.line18) @@ -484,11 +486,11 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) { for (int x = 16; x < 720 - 16; x++) { - yhisto[bitmap.pix16(y, x) >> 8]++; + yhisto[bitmap.pix(y, x) >> 8]++; if (x % 2 == 0) - cbhisto[bitmap.pix16(y, x) & 0xff]++; + cbhisto[bitmap.pix(y, x) & 0xff]++; else - crhisto[bitmap.pix16(y, x) & 0xff]++; + crhisto[bitmap.pix(y, x) & 0xff]++; } pixels += 720 - 16 - 16; } diff --git a/src/tools/pngcmp.cpp b/src/tools/pngcmp.cpp index eb56d4a7ee7..714700a3824 100644 --- a/src/tools/pngcmp.cpp +++ b/src/tools/pngcmp.cpp @@ -74,10 +74,8 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img int width, height, maxwidth; util::core_file::ptr file; osd_file::error filerr; - png_error pngerr; + util::png_error pngerr; int error = 100; - bool bitmaps_differ; - int x, y; /* open the source image */ filerr = util::core_file::open(imgfile1, OPEN_FLAG_READ, file); @@ -88,11 +86,11 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img } /* load the source image */ - pngerr = png_read_bitmap(*file, bitmap1); + pngerr = util::png_read_bitmap(*file, bitmap1); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) { - printf("Could not read %s (%d)\n", imgfile1.c_str(), pngerr); + printf("Could not read %s (%d)\n", imgfile1.c_str(), int(pngerr)); goto error; } @@ -105,24 +103,26 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img } /* load the source image */ - pngerr = png_read_bitmap(*file, bitmap2); + pngerr = util::png_read_bitmap(*file, bitmap2); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) { - printf("Could not read %s (%d)\n", imgfile2.c_str(), pngerr); + printf("Could not read %s (%d)\n", imgfile2.c_str(), int(pngerr)); goto error; } /* if the sizes are different, we differ; otherwise start off assuming we are the same */ + bool bitmaps_differ; bitmaps_differ = (bitmap2.width() != bitmap1.width() || bitmap2.height() != bitmap1.height()); /* compare scanline by scanline */ - for (y = 0; y < bitmap2.height() && !bitmaps_differ; y++) + for (int y = 0; y < bitmap2.height() && !bitmaps_differ; y++) { - uint32_t *base = &bitmap1.pix32(y); - uint32_t *curr = &bitmap2.pix32(y); + uint32_t const *base = &bitmap1.pix(y); + uint32_t const *curr = &bitmap2.pix(y); /* scan the scanline */ + int x; for (x = 0; x < bitmap2.width(); x++) if (*base++ != *curr++) break; @@ -148,16 +148,16 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img /* now copy and compare each set of bitmaps */ int curheight = std::max(bitmap1.height(), bitmap2.height()); /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(y); - uint32_t *dst2 = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(y); + uint32_t *dst2 = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; @@ -176,11 +176,11 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img printf("Could not open %s (%d)\n", outfilename.c_str(), int(filerr)); goto error; } - pngerr = png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); + pngerr = util::png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) { - printf("Could not write %s (%d)\n", outfilename.c_str(), pngerr); + printf("Could not write %s (%d)\n", outfilename.c_str(), int(pngerr)); goto error; } } diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp index f45351272a7..49637c2eb16 100644 --- a/src/tools/regrep.cpp +++ b/src/tools/regrep.cpp @@ -607,7 +607,6 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT]; summary_file *curfile; std::string title("MAME Regressions"); - std::string tempname; int listnum, bucknum; util::core_file::ptr indexfile; int count = 0, total; @@ -686,7 +685,7 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st *buckettailptr[bucknum] = nullptr; /* output header */ - tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); if (!indexfile) { @@ -721,10 +720,9 @@ static int compare_screenshots(summary_file *curfile) bitmap_argb32 bitmaps[MAX_COMPARES]; int unique[MAX_COMPARES]; int numunique = 0; - int listnum; /* iterate over all files and load their bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->status[listnum] == STATUS_SUCCESS) { std::string fullname; @@ -750,12 +748,13 @@ static int compare_screenshots(summary_file *curfile) /* if that worked, load the file */ if (filerr == osd_file::error::NONE) { - png_read_bitmap(*file, bitmaps[listnum]); + util::png_read_bitmap(*file, bitmaps[listnum]); file.reset(); } } /* now find all the different bitmap types */ + int listnum; for (listnum = 0; listnum < list_count; listnum++) { curfile->matchbitmap[listnum] = 0xff; @@ -774,8 +773,8 @@ static int compare_screenshots(summary_file *curfile) /* compare scanline by scanline */ for (int y = 0; y < this_bitmap.height() && !bitmaps_differ; y++) { - uint32_t *base = &base_bitmap.pix32(y); - uint32_t *curr = &this_bitmap.pix32(y); + uint32_t const *base = &base_bitmap.pix(y); + uint32_t const *curr = &this_bitmap.pix(y); /* scan the scanline */ int x; @@ -831,14 +830,12 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, bitmap_argb32 bitmaps[MAX_COMPARES]; std::string srcimgname; std::string dstfilename; - std::string tempname; bitmap_argb32 finalbitmap; int width, height, maxwidth; int bitmapcount = 0; - int listnum, bmnum; util::core_file::ptr file; osd_file::error filerr; - png_error pngerr; + util::png_error pngerr; int error = -1; int starty; @@ -847,10 +844,10 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, srcimgname = string_format("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); /* open and load all unique bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->matchbitmap[listnum] == listnum) { - tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); /* open the source image */ filerr = util::core_file::open(tempname, OPEN_FLAG_READ, file); @@ -858,9 +855,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, goto error; /* load the source image */ - pngerr = png_read_bitmap(*file, bitmaps[bitmapcount++]); + pngerr = util::png_read_bitmap(*file, bitmaps[bitmapcount++]); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) goto error; } @@ -871,7 +868,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* determine the size of the final bitmap */ height = width = 0; maxwidth = bitmaps[0].width(); - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { int curwidth; @@ -891,24 +888,23 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* now copy and compare each set of bitmaps */ starty = 0; - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { - bitmap_argb32 &bitmap1 = bitmaps[0]; - bitmap_argb32 &bitmap2 = bitmaps[bmnum]; + bitmap_argb32 const &bitmap1 = bitmaps[0]; + bitmap_argb32 const &bitmap2 = bitmaps[bmnum]; int curheight = std::max(bitmap1.height(), bitmap2.height()); - int x, y; /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(starty + y, 0); - uint32_t *dst2 = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(starty + y, 0); + uint32_t *dst2 = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; @@ -928,9 +924,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, filerr = util::core_file::open(dstfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file); if (filerr != osd_file::error::NONE) goto error; - pngerr = png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); + pngerr = util::png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr); file.reset(); - if (pngerr != PNGERR_NONE) + if (pngerr != util::png_error::NONE) goto error; /* if we get here, we are error free */ diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index b5a175c1d96..a7cae6968c0 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -73,6 +73,7 @@ using util::BIT; #include "cpu/ie15/ie15dasm.h" #include "cpu/jaguar/jagdasm.h" #include "cpu/ks0164/ks0164d.h" +#include "cpu/lc58/lc58d.h" #include "cpu/lc8670/lc8670dsm.h" #include "cpu/lh5801/5801dasm.h" #include "cpu/lr35902/lr35902d.h" @@ -434,6 +435,7 @@ static const dasm_table_entry dasm_table[] = { "jaguargpu", be, 0, []() -> util::disasm_interface * { return new jaguar_disassembler(jaguar_disassembler::variant::GPU); } }, { "konami", be, 0, []() -> util::disasm_interface * { return new konami_disassembler; } }, { "ks0164", be, 0, []() -> util::disasm_interface * { return new ks0164_disassembler; } }, + { "lc58", be, -1, []() -> util::disasm_interface * { return new lc58_disassembler; } }, { "lc8670", be, 0, []() -> util::disasm_interface * { return new lc8670_disassembler; } }, { "lh5801", le, 0, []() -> util::disasm_interface * { return new lh5801_disassembler; } }, { "lr35902", le, 0, []() -> util::disasm_interface * { return new lr35902_disassembler; } }, diff --git a/src/zexall/main.cpp b/src/zexall/main.cpp index 5996f3b582b..eb6f24edf6d 100644 --- a/src/zexall/main.cpp +++ b/src/zexall/main.cpp @@ -106,6 +106,8 @@ void emulator_info::periodic_check() { } bool emulator_info::frame_hook() { return false; } +void emulator_info::sound_hook() { } + void emulator_info::layout_file_cb(util::xml::data_node const &layout) { } const char * emulator_info::get_appname() { return nullptr; } diff --git a/src/zexall/zexall.cpp b/src/zexall/zexall.cpp index 8de1121304d..6bc3544a4d0 100644 --- a/src/zexall/zexall.cpp +++ b/src/zexall/zexall.cpp @@ -31,6 +31,7 @@ public: void output_data_w(uint8_t data); void z80_mem(address_map &map); + void zexall(machine_config &config); private: required_device<cpu_device> m_maincpu; required_shared_ptr<uint8_t> m_main_ram; @@ -41,7 +42,6 @@ private: std::string terminate_string; virtual void machine_reset() override; - void zexall(machine_config &config); }; @@ -123,9 +123,9 @@ void zexall_state::output_data_w(uint8_t data) void zexall_state::z80_mem(address_map &map) { map(0x0000, 0xffff).ram().share("main_ram"); - map(0xfffd, 0xfffd).rw(this, FUNC(zexall_state::output_ack_r), FUNC(zexall_state::output_ack_w)); - map(0xfffe, 0xfffe).rw(this, FUNC(zexall_state::output_req_r), FUNC(zexall_state::output_req_w)); - map(0xffff, 0xffff).rw(this, FUNC(zexall_state::output_data_r), FUNC(zexall_state::output_data_w)); + map(0xfffd, 0xfffd).rw(FUNC(zexall_state::output_ack_r), FUNC(zexall_state::output_ack_w)); + map(0xfffe, 0xfffe).rw(FUNC(zexall_state::output_req_r), FUNC(zexall_state::output_req_w)); + map(0xffff, 0xffff).rw(FUNC(zexall_state::output_data_r), FUNC(zexall_state::output_data_w)); } @@ -162,5 +162,5 @@ ROM_END Drivers ******************************************************************************/ -/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ -COMP( 2009, zexall, 0, 0, zexall, zexall, zexall_state, 0, "Frank Cringle / Kevin Horton", "Zexall (FPGA Z80 test interface)", MACHINE_NO_SOUND_HW ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS */ +COMP( 2009, zexall, 0, 0, zexall, zexall, zexall_state, empty_init, "Frank Cringle / Kevin Horton", "Zexall (FPGA Z80 test interface)", MACHINE_NO_SOUND_HW ) |