diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/devices/machine/pseudovia.cpp | 1 | ||||
| -rw-r--r-- | src/devices/sound/asc.cpp | 86 | ||||
| -rw-r--r-- | src/devices/sound/asc.h | 3 | ||||
| -rw-r--r-- | src/mame/apple/macii.cpp | 12 | ||||
| -rw-r--r-- | src/mame/apple/macquadra700.cpp | 10 | ||||
| -rw-r--r-- | src/mame/canon/x07.cpp | 314 | ||||
| -rw-r--r-- | src/mame/canon/x07.h | 199 | ||||
| -rw-r--r-- | src/mame/igs/igs011.cpp | 5 | ||||
| -rw-r--r-- | src/mame/igs/igs011_video.cpp | 5 | ||||
| -rw-r--r-- | src/mame/igs/igs011_video.h | 1 | ||||
| -rw-r--r-- | src/mame/jaleco/bnstars.cpp | 93 | ||||
| -rw-r--r-- | src/mame/jaleco/megasys1.cpp | 32 | ||||
| -rw-r--r-- | src/mame/jaleco/ms32.cpp | 3 | ||||
| -rw-r--r-- | src/mame/roland/roland_cm32p.cpp | 139 | ||||
| -rw-r--r-- | src/mame/roland/roland_r8.cpp | 50 |
15 files changed, 449 insertions, 504 deletions
diff --git a/src/devices/machine/pseudovia.cpp b/src/devices/machine/pseudovia.cpp index 77786c106f9..418a8121d15 100644 --- a/src/devices/machine/pseudovia.cpp +++ b/src/devices/machine/pseudovia.cpp @@ -42,6 +42,7 @@ DEFINE_DEVICE_TYPE(APPLE_SONORA_PSEUDOVIA, sonora_pseudovia_device, "snpsvia", " DEFINE_DEVICE_TYPE(APPLE_MSC_PSEUDOVIA, msc_pseudovia_device, "mspsvia", "Apple pseudo-VIA (MSC)") DEFINE_DEVICE_TYPE(APPLE_PB030_PSEUDOVIA, pb030_pseudovia_device, "pbpsvia", "Apple pseudo-VIA (Misc. GLU)") DEFINE_DEVICE_TYPE(APPLE_QUADRA_PSEUDOVIA, quadra_pseudovia_device, "qdpsvia", "Apple pseudo-VIA (IOSB/PrimeTime/PrimeTime II)") + enum { PVIA_PB = 0, diff --git a/src/devices/sound/asc.cpp b/src/devices/sound/asc.cpp index 99f2d6ad56a..916ab49da11 100644 --- a/src/devices/sound/asc.cpp +++ b/src/devices/sound/asc.cpp @@ -3,6 +3,7 @@ /*************************************************************************** asc.cpp + Apple Sound Chip (ASC) 344S0053 (original), 344S0063 (cost-reduced) Enhanced Apple Sound Chip (EASC) 343S1036 Audio portion of "V8" ASIC (343S0116) @@ -99,11 +100,6 @@ static constexpr u8 STAT_EMPTY_OR_FULL_B = 0x08; // asc_base_device - constructor //------------------------------------------------- -asc_base_device::asc_base_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - :asc_base_device(mconfig, ASC, tag, owner, clock) -{ -} - asc_base_device::asc_base_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) @@ -178,13 +174,12 @@ TIMER_CALLBACK_MEMBER(asc_base_device::delayed_stream_update) void asc_base_device::sound_stream_update(sound_stream &stream) { - int i, ch; - static u32 wtoffs[2] = { 0, 0x200 }; + constexpr u32 wtoffs[2] = { 0, 0x200 }; switch (m_regs[R_MODE] & 3) { case 0: // chip off - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { stream.put_int(0, i, m_last_left, 32768 / 64); stream.put_int(1, i, m_last_right, 32768 / 64); @@ -193,12 +188,10 @@ void asc_base_device::sound_stream_update(sound_stream &stream) case 1: // FIFO mode { - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { - s8 smpll, smplr; - - smpll = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; - smplr = (s8)m_fifo[1][m_fifo_rdptr[1]] ^ 0x80; + s8 smpll = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; + s8 smplr = (s8)m_fifo[1][m_fifo_rdptr[1]] ^ 0x80; if (!BIT(m_regs[R_CONTROL], CONTROL_STEREO)) { smplr = smpll; @@ -254,21 +247,21 @@ void asc_base_device::sound_stream_update(sound_stream &stream) case 2: // wavetable mode { - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { s32 mixL, mixR; - s8 smpl; mixL = mixR = 0; // update channel pointers - for (ch = 0; ch < 4; ch++) + for (int ch = 0; ch < 4; ch++) { m_phase[ch] += m_incr[ch]; + s8 smpl; if (ch < 2) { - smpl = (s8)m_fifo[0][((m_phase[ch]>>15)&0x1ff) + wtoffs[ch&1]]; + smpl = (s8)m_fifo[0][((m_phase[ch]>>15)&0x1ff) + wtoffs[ch&1]]; } else { @@ -309,7 +302,7 @@ u8 asc_base_device::read(offs_t offset) } else if (offset < 0x800) { - return m_fifo[1][offset-0x400]; + return m_fifo[1][offset - 0x400]; } else { @@ -328,11 +321,14 @@ u8 asc_base_device::read(offs_t offset) case R_FIFOSTAT: rv = m_regs[R_FIFOSTAT]; - // reading this register clears all bits, but only on original ASC - m_regs[R_FIFOSTAT] = 0; + if (!machine().side_effects_disabled()) + { + // reading this register clears all bits, but only on original ASC + m_regs[R_FIFOSTAT] = 0; - // reading this clears interrupts - set_irq_line(CLEAR_LINE); + // reading this clears interrupts + set_irq_line(CLEAR_LINE); + } return rv; // these are known to return 1 on original ASC @@ -366,7 +362,7 @@ u8 asc_base_device::read(offs_t offset) return 0xff; } - return m_regs[offset-0x800]; + return m_regs[offset - 0x800]; } //------------------------------------------------- @@ -805,9 +801,7 @@ Cancel 0 0 0 0 0 $00 0 void asc_v8_device::sound_stream_update(sound_stream &stream) { - int i; - - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { const s8 smpl = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; @@ -864,7 +858,7 @@ u8 asc_v8_device::read(offs_t offset) case R_FIFOSTAT: // reading this clears interrupts, but not the FIFO status bits - if (!(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_A)) + if (!machine().side_effects_disabled() && !(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_A)) { set_irq_line(CLEAR_LINE); } @@ -972,8 +966,6 @@ void asc_sonora_device::device_reset() void asc_sonora_device::sound_stream_update(sound_stream &stream) { - int i; - // if we're in playback mode, FIFO A always reads empty if (!(m_regs[R_PLAYRECA] & 1)) { @@ -985,12 +977,10 @@ void asc_sonora_device::sound_stream_update(sound_stream &stream) } } - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { - s8 smpll, smplr; - - smpll = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; - smplr = (s8)m_fifo[1][m_fifo_rdptr[1]] ^ 0x80; + const s8 smpll = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; + const s8 smplr = (s8)m_fifo[1][m_fifo_rdptr[1]] ^ 0x80; m_last_left = smpll; m_last_right = smplr; @@ -1058,7 +1048,7 @@ u8 asc_sonora_device::read(offs_t offset) case R_FIFOSTAT: // reading this clears interrupts, but not the FIFO status bits - if (!(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_B)) + if (!machine().side_effects_disabled() && !(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_B)) { set_irq_line(CLEAR_LINE); } @@ -1177,13 +1167,11 @@ Cancel 1 1 1 1 1 $0E 0 */ void asc_iosb_device::sound_stream_update(sound_stream &stream) { - int i; - // printf("ASC-IOSB mode %d fl %02x cap A %x cap B %x\n", m_regs[R_MODE] & 3, m_regs[R_FIFOSTAT], m_fifo_cap[0], m_fifo_cap[1]); switch (m_regs[R_MODE]) { case 0: // chip off - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { stream.put_int(0, i, m_last_left, 32768 / 64); stream.put_int(1, i, m_last_right, 32768 / 64); @@ -1205,12 +1193,10 @@ void asc_iosb_device::sound_stream_update(sound_stream &stream) } } - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { - s8 smpll, smplr; - - smpll = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; - smplr = (s8)m_fifo[1][m_fifo_rdptr[1]] ^ 0x80; + const s8 smpll = (s8)m_fifo[0][m_fifo_rdptr[0]] ^ 0x80; + const s8 smplr = (s8)m_fifo[1][m_fifo_rdptr[1]] ^ 0x80; m_last_left = smpll; m_last_right = smplr; @@ -1276,7 +1262,7 @@ u8 asc_iosb_device::read(offs_t offset) case R_FIFOSTAT: // reading this clears interrupts, but not the FIFO status bits - if (!(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_B)) + if (!machine().side_effects_disabled() && !(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_B)) { set_irq_line(CLEAR_LINE); } @@ -1361,11 +1347,11 @@ u16 asc_iosb_device::read_w(offs_t offset) { if (offset < 0x800) { - return ((m_fifo[0][m_fifo_rdptr[0]] ^ 0x80) << 8 | (m_fifo[1][m_fifo_rdptr[0]] ^ 0x80)); + return ((m_fifo[0][m_fifo_rdptr[0]] ^ 0x80) << 8) | (m_fifo[1][m_fifo_rdptr[0]] ^ 0x80); } else { - return read(offset<<1) << 8 | read((offset<<1) + 1); + return (read(offset << 1) << 8) | read((offset << 1) + 1); } } @@ -1470,12 +1456,10 @@ FIFO IRQ 1 0 0 0 void asc_easc_device::sound_stream_update(sound_stream &stream) { - int i; - switch (m_regs[R_MODE] & 3) { case 0: // chip off - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { stream.put_int(0, i, m_last_left, 32768); stream.put_int(1, i, m_last_right, 32768); @@ -1487,7 +1471,7 @@ void asc_easc_device::sound_stream_update(sound_stream &stream) case 1: // FIFO mode { - for (i = 0; i < stream.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { s16 smpll = m_last_left; s16 smplr = m_last_right; @@ -1669,7 +1653,7 @@ u8 asc_easc_device::read(offs_t offset) { case R_FIFOSTAT: // reading this clears interrupts, but not the FIFO status bits - if (!(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_B)) + if (!machine().side_effects_disabled() && !(m_regs[R_FIFOSTAT] & STAT_HALF_FULL_B)) { set_irq_line(CLEAR_LINE); } diff --git a/src/devices/sound/asc.h b/src/devices/sound/asc.h index 65572ae6c4f..75cc4ac4abc 100644 --- a/src/devices/sound/asc.h +++ b/src/devices/sound/asc.h @@ -17,11 +17,10 @@ #define MAME_SOUND_ASC_H #pragma once + class asc_base_device : public device_t, public device_sound_interface { public: - asc_base_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - static constexpr feature_type imperfect_features() { return feature::SOUND; } auto irqf_callback() { return write_irq.bind(); } diff --git a/src/mame/apple/macii.cpp b/src/mame/apple/macii.cpp index b6c2d5df837..c90aaac6ea5 100644 --- a/src/mame/apple/macii.cpp +++ b/src/mame/apple/macii.cpp @@ -1175,9 +1175,9 @@ ROM_END } // anonymous namespace // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME -COMP( 1987, macii, 0, 0, macii, macii, macii_state, macii_init, "Apple Computer", "Macintosh II", MACHINE_SUPPORTS_SAVE ) -COMP( 1987, maciihmu, macii, 0, maciihmu, macii, macii_state, macii_init, "Apple Computer", "Macintosh II (w/o 68851 MMU)", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, mac2fdhd, 0, 0, maciihd, macii, macii_state, macii_init, "Apple Computer", "Macintosh II (FDHD)", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, maciix, mac2fdhd, 0, maciix, macii, macii_state, macii_init, "Apple Computer", "Macintosh IIx", MACHINE_SUPPORTS_SAVE ) -COMP( 1989, macse30, mac2fdhd, 0, macse30, macii, macii_state, macii_init, "Apple Computer", "Macintosh SE/30", MACHINE_SUPPORTS_SAVE ) -COMP( 1989, maciicx, mac2fdhd, 0, maciicx, macii, macii_state, macii_init, "Apple Computer", "Macintosh IIcx", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, macii, 0, 0, macii, macii, macii_state, macii_init, "Apple Computer", "Macintosh II", MACHINE_SUPPORTS_SAVE ) +COMP( 1987, maciihmu, macii, 0, maciihmu, macii, macii_state, macii_init, "Apple Computer", "Macintosh II (w/o 68851 MMU)", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, mac2fdhd, 0, 0, maciihd, macii, macii_state, macii_init, "Apple Computer", "Macintosh II (FDHD)", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, maciix, mac2fdhd, 0, maciix, macii, macii_state, macii_init, "Apple Computer", "Macintosh IIx", MACHINE_SUPPORTS_SAVE ) +COMP( 1989, macse30, mac2fdhd, 0, macse30, macii, macii_state, macii_init, "Apple Computer", "Macintosh SE/30", MACHINE_SUPPORTS_SAVE ) +COMP( 1989, maciicx, mac2fdhd, 0, maciicx, macii, macii_state, macii_init, "Apple Computer", "Macintosh IIcx", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/apple/macquadra700.cpp b/src/mame/apple/macquadra700.cpp index 2caf7f9953b..10943857a0c 100644 --- a/src/mame/apple/macquadra700.cpp +++ b/src/mame/apple/macquadra700.cpp @@ -757,10 +757,12 @@ void eclipse_state::via2_out_b_q900(u8 data) NSCSI_CONNECTOR(config, "scsi:0", mac_scsi_devices, nullptr); NSCSI_CONNECTOR(config, "scsi:1", mac_scsi_devices, nullptr); NSCSI_CONNECTOR(config, "scsi:2", mac_scsi_devices, nullptr); - NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config([](device_t *device) - { - device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0); - device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1); }); + NSCSI_CONNECTOR(config, "scsi:3").option_set("cdrom", NSCSI_CDROM_APPLE).machine_config( + [] (device_t *device) + { + device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 1.0, 0); + device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 1.0, 1); + }); NSCSI_CONNECTOR(config, "scsi:4", mac_scsi_devices, nullptr); NSCSI_CONNECTOR(config, "scsi:5", mac_scsi_devices, nullptr); NSCSI_CONNECTOR(config, "scsi:6", mac_scsi_devices, "harddisk"); diff --git a/src/mame/canon/x07.cpp b/src/mame/canon/x07.cpp index be5cc24d101..d048b656be3 100644 --- a/src/mame/canon/x07.cpp +++ b/src/mame/canon/x07.cpp @@ -38,6 +38,144 @@ #include <algorithm> +//default value for user defined keys, taken for official documentation +static const char *const udk_ini[12] = { + "tim?TIME$\r", + "cldCLOAD\"", + "locLOCATE ", + "lstLIST ", + "runRUN\r", + "", + "dat?DATE$\r", + "csvCSAVE\"", + "prtPRINT ", + "slpSLEEP", + "cntCONT\r", + "" +}; + +static const uint16_t udk_offset[12] = +{ + 0x0000, 0x002a, 0x0054, 0x007e, 0x00a8, 0x00d2, + 0x0100, 0x012a, 0x0154, 0x017e, 0x01a8, 0x01d2 +}; + +static const uint8_t printer_charcode[256] = +{ + 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, + 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, + 0xf7, 0x77, 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, + 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, + 0xfb, 0x7b, 0xbb, 0x3b, 0xdb, 0x5b, 0x9b, 0x1b, + 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, + 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, 0x93, 0x13, + 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, + 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, + 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, + 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, + 0xe5, 0x65, 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, + 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, + 0xe9, 0x69, 0xa9, 0x29, 0xc9, 0x49, 0x89, 0x09, + 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, + 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, 0x81, 0x01, + 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, + 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, + 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, + 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, + 0xfa, 0x7a, 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, + 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, + 0xf2, 0x72, 0xb2, 0x32, 0xd2, 0x52, 0x92, 0x12, + 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, + 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, 0x9c, 0x1c, + 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, + 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, + 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, + 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, + 0xe8, 0x68, 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, + 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, + 0xe0, 0x60, 0xa0, 0x20, 0xc0, 0x40, 0x80, 0x00 +}; + +static const uint8_t t6834_cmd_len[0x47] = +{ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x04, 0x03, + 0x01, 0x02, 0x09, 0x01, 0x09, 0x01, 0x01, 0x02, + 0x03, 0x03, 0x03, 0x03, 0x05, 0x04, 0x82, 0x02, + 0x01, 0x01, 0x0a, 0x02, 0x01, 0x81, 0x81, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x03, + 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x82, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x09, 0x01, 0x03, 0x03, 0x01, 0x01 +}; + +struct x07_kb +{ + uint8_t tag; //input port tag + uint8_t mask; //bit mask + uint8_t codes[7]; //port codes +}; + +static const x07_kb x07_keycodes[56] = +{ + {8, 0x01, {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}}, + {0, 0x01, {0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12}}, + {0, 0x02, {0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16}}, + {0, 0x04, {0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c}}, + {0, 0x08, {0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d}}, + {0, 0x10, {0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}}, + {0, 0x20, {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}}, + {0, 0x40, {0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20}}, + {1, 0x01, {0x5a, 0x7a, 0x1a, 0x00, 0xc2, 0xaf, 0xe1}}, + {1, 0x02, {0x58, 0x78, 0x18, 0x00, 0xbb, 0x00, 0x98}}, + {1, 0x04, {0x43, 0x63, 0x03, 0x00, 0xbf, 0x00, 0xe4}}, + {1, 0x08, {0x56, 0x76, 0x16, 0x00, 0xcb, 0x00, 0x95}}, + {1, 0x10, {0x42, 0x62, 0x02, 0x00, 0xba, 0x00, 0xed}}, + {1, 0x20, {0x4e, 0x6e, 0x0e, 0x00, 0xd0, 0x00, 0x89}}, + {1, 0x40, {0x4d, 0x6d, 0x0d, 0x30, 0xd3, 0x00, 0xf5}}, + {1, 0x80, {0x2c, 0x3c, 0x00, 0x00, 0xc8, 0xa4, 0x9c}}, + {2, 0x01, {0x41, 0x61, 0x01, 0x00, 0xc1, 0x00, 0x88}}, + {2, 0x02, {0x53, 0x73, 0x13, 0x00, 0xc4, 0x00, 0x9f}}, + {2, 0x04, {0x44, 0x64, 0x04, 0x00, 0xbc, 0x00, 0xef}}, + {2, 0x08, {0x46, 0x66, 0x06, 0x00, 0xca, 0x00, 0xfd}}, + {2, 0x10, {0x47, 0x67, 0x07, 0x00, 0xb7, 0x00, 0x9d}}, + {2, 0x20, {0x48, 0x68, 0x08, 0x00, 0xb8, 0x00, 0xfe}}, + {2, 0x40, {0x4a, 0x6a, 0x0a, 0x31, 0xcf, 0x00, 0xe5}}, + {2, 0x80, {0x4b, 0x6b, 0x0b, 0x32, 0xc9, 0x00, 0x9b}}, + {3, 0x01, {0x51, 0x71, 0x11, 0x00, 0xc0, 0x00, 0x8b}}, + {3, 0x02, {0x57, 0x77, 0x17, 0x00, 0xc3, 0x00, 0xfb}}, + {3, 0x04, {0x45, 0x65, 0x05, 0x00, 0xb2, 0xa8, 0x99}}, + {3, 0x08, {0x52, 0x72, 0x12, 0x00, 0xbd, 0x00, 0xf6}}, + {3, 0x10, {0x54, 0x74, 0x14, 0x00, 0xb6, 0x00, 0x97}}, + {3, 0x20, {0x59, 0x79, 0x19, 0x35, 0xdd, 0x00, 0x96}}, + {3, 0x40, {0x55, 0x75, 0x15, 0x34, 0xc5, 0x00, 0x94}}, + {3, 0x80, {0x49, 0x69, 0x09, 0x00, 0xc6, 0x00, 0xf9}}, + {4, 0x01, {0x31, 0x21, 0x00, 0x00, 0xc7, 0x00, 0xe9}}, + {4, 0x02, {0x32, 0x22, 0x00, 0x00, 0xcc, 0x00, 0x90}}, + {4, 0x04, {0x33, 0x23, 0x00, 0x00, 0xb1, 0xa7, 0x91}}, + {4, 0x08, {0x34, 0x24, 0x00, 0x00, 0xb3, 0xa9, 0x92}}, + {4, 0x10, {0x35, 0x25, 0x00, 0x00, 0xb4, 0xaa, 0x93}}, + {4, 0x20, {0x36, 0x26, 0x00, 0x00, 0xb5, 0xab, 0xec}}, + {4, 0x40, {0x37, 0x27, 0x37, 0x00, 0xd4, 0xac, 0xe0}}, + {4, 0x80, {0x38, 0x28, 0x37, 0x00, 0xd5, 0xad, 0xf2}}, + {6, 0x01, {0x2e, 0x3e, 0x00, 0x2e, 0xd9, 0xa1, 0x9a}}, + {6, 0x02, {0x2f, 0x3f, 0x00, 0x00, 0xd2, 0xa5, 0x80}}, + {6, 0x04, {0x3f, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00}}, + {6, 0x08, {0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d}}, + {6, 0x10, {0x4f, 0x6f, 0x0f, 0x36, 0xd7, 0x00, 0x9e}}, + {6, 0x20, {0x50, 0x70, 0x10, 0x00, 0xbe, 0x00, 0xf7}}, + {6, 0x40, {0x40, 0x60, 0x00, 0x00, 0xde, 0x00, 0xe7}}, + {6, 0x80, {0x5b, 0x7b, 0x00, 0x00, 0xdf, 0xa2, 0x84}}, + {7, 0x01, {0x4c, 0x6c, 0x0c, 0x33, 0xd8, 0x00, 0xf4}}, + {7, 0x02, {0x3b, 0x2b, 0x00, 0x00, 0xda, 0x00, 0x82}}, + {7, 0x04, {0x3a, 0x2a, 0x00, 0x00, 0xb9, 0x00, 0x81}}, + {7, 0x08, {0x5d, 0x7d, 0x00, 0x00, 0xd1, 0xa3, 0x85}}, + {7, 0x10, {0x39, 0x29, 0x39, 0x00, 0xd6, 0xae, 0xf1}}, + {7, 0x20, {0x30, 0x7c, 0x00, 0x00, 0xdc, 0xa6, 0x8a}}, + {7, 0x40, {0x2d, 0x3d, 0x00, 0x00, 0xce, 0x00, 0xf0}}, + {7, 0x80, {0x3d, 0x7e, 0x00, 0x00, 0xcd, 0x00, 0xfc}} +}; + /*************************************************************************** T6834 IMPLEMENTATION ***************************************************************************/ @@ -58,7 +196,7 @@ static constexpr uint8_t F4_W_SETBC = 0x80; // load BRG counter from F2/F3 // BRG is active when running in buzzer mode (MD1=MD0=1) with BRGST set. static constexpr uint8_t F4_BRG_ACTIVE = F4_W_BRGST | F4_W_MD1 | F4_W_MD0; -void x07_state::t6834_cmd (uint8_t cmd) +void x07_state::t6834_cmd(uint8_t cmd) { switch (cmd) { @@ -84,7 +222,7 @@ void x07_state::t6834_cmd (uint8_t cmd) { uint8_t data; - switch (ioport("S1")->read() & 0x3c) + switch (m_io_keyboard[0]->read() & 0x3c) { case 0x04: data = 0x33; break; //right case 0x08: data = 0x37; break; //left @@ -98,13 +236,13 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x03: //STRIG(0) { - m_out.data[m_out.write++] = (ioport("S6")->read() & 0x20 ? 0x00 : 0xff); + m_out.data[m_out.write++] = (m_io_keyboard[5]->read() & 0x20) ? 0x00 : 0xff; } break; case 0x04: //STRIG(1) { - m_out.data[m_out.write++] = (ioport("S1")->read() & 0x40 ? 0x00 : 0xff); + m_out.data[m_out.write++] = (m_io_keyboard[0]->read() & 0x40) ? 0x00 : 0xff; } break; @@ -115,9 +253,9 @@ void x07_state::t6834_cmd (uint8_t cmd) address = m_in.data[m_in.read++]; address |= (m_in.data[m_in.read++] << 8); - if(address == 0xc00e) + if (address == 0xc00e) data = 0x0a; - else if(address == 0xd000) + else if (address == 0xd000) data = ioport("BATTERY")->read(); else if (address >= 0xe000 && address < 0xe200 && ((address & 0xf) != 0xf)) // VRAM and col 0-119 ? { @@ -167,12 +305,12 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x08: //scroll exec { - if(m_scroll_min <= m_scroll_max && m_scroll_max < 4) + if (m_scroll_min <= m_scroll_max && m_scroll_max < 4) { - for(int i = m_scroll_min * 8; i < m_scroll_max * 8; i++) + for (int i = m_scroll_min * 8; i < m_scroll_max * 8; i++) memcpy(&m_lcd_map[i][0], &m_lcd_map[i + 8][0], 120); - for(int i = m_scroll_max * 8; i < (m_scroll_max + 1) * 8; i++) + for (int i = m_scroll_max * 8; i < (m_scroll_max + 1) * 8; i++) memset(&m_lcd_map[i][0], 0, 120); } } @@ -181,7 +319,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x09: //line clear { uint8_t line = m_in.data[m_in.read++] & 3; - for(uint8_t l = line * 8; l < (line + 1) * 8; l++) + for (uint8_t l = line * 8; l < (line + 1) * 8; l++) memset(&m_lcd_map[l][0], 0, 120); } break; @@ -199,7 +337,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x0c: //ALM$ write { - for(auto & elem : m_alarm) + for (auto &elem : m_alarm) elem = m_in.data[m_in.read++]; } break; @@ -211,7 +349,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x0f: //read LCD line { uint8_t line = m_in.data[m_in.read++]; - for(int i = 0; i < 120; i++) + for (int i = 0; i < 120; i++) m_out.data[m_out.write++] = (line < 32) ? m_lcd_map[line][i] : 0; } break; @@ -220,7 +358,7 @@ void x07_state::t6834_cmd (uint8_t cmd) { uint8_t x = m_in.data[m_in.read++]; uint8_t y = m_in.data[m_in.read++]; - if(x < 120 && y < 32) + if (x < 120 && y < 32) m_out.data[m_out.write++] = (m_lcd_map[y][x] ? 0xff : 0); else m_out.data[m_out.write++] = 0; @@ -247,7 +385,7 @@ void x07_state::t6834_cmd (uint8_t cmd) { uint8_t x = m_in.data[m_in.read++]; uint8_t y = m_in.data[m_in.read++]; - if(x < 120 && y < 32) + if (x < 120 && y < 32) m_lcd_map[y][x] = !m_lcd_map[y][x]; } break; @@ -265,12 +403,12 @@ void x07_state::t6834_cmd (uint8_t cmd) step_x = (p3 < p1) ? -1 : 1; step_y = (p4 < p2) ? -1 : 1; - if(delta_x > delta_y) + if (delta_x > delta_y) { frac = delta_y - delta_x / 2; - while(next_x != p3) + while (next_x != p3) { - if(frac >= 0) + if (frac >= 0) { next_y += step_y; frac -= delta_x; @@ -282,9 +420,9 @@ void x07_state::t6834_cmd (uint8_t cmd) } else { frac = delta_x - delta_y / 2; - while(next_y != p4) + while (next_y != p4) { - if(frac >= 0) + if (frac >= 0) { next_x += step_x; frac -= delta_y; @@ -305,13 +443,13 @@ void x07_state::t6834_cmd (uint8_t cmd) uint8_t p2 = m_in.data[m_in.read++]; uint8_t p3 = m_in.data[m_in.read++]; - for(int x = 0, y = p3; x <= sqrt((double)(p3 * p3) / 2) ; x++) + for (int x = 0, y = p3; x <= sqrt(double(p3 * p3) * 0.5) ; x++) { /* * The old code produced results most likely not intended: * uint32_t d1 = (x * x + y * y) - p3 * p3; * uint32_t d2 = (x * x + (y - 1) * (y - 1)) - p3 * p3; - * if(abs((double)d1) > abs((double)d2)) + * if (abs((double)d1) > abs((double)d2)) * * (double)(-1) = 4294967294.000000 * abs((double)(-1)) = -2147483648; @@ -339,11 +477,11 @@ void x07_state::t6834_cmd (uint8_t cmd) uint8_t pos = m_in.data[m_in.read++] - 1; uint8_t udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; - for(int i = 0; i < udk_size; i++) + for (int i = 0; i < udk_size; i++) { uint8_t udk_char = m_in.data[m_in.read++]; m_t6834_ram[udk_offset[pos] + i] = udk_char; - if(!udk_char) break; + if (!udk_char) break; } } break; @@ -353,11 +491,11 @@ void x07_state::t6834_cmd (uint8_t cmd) uint8_t pos = m_in.data[m_in.read++] - 1; uint8_t udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; - for(int i = 0; i < udk_size; i++) + for (int i = 0; i < udk_size; i++) { uint8_t udk_char = m_t6834_ram[udk_offset[pos] + i]; m_out.data[m_out.write++] = udk_char; - if(!udk_char) break; + if (!udk_char) break; } } break; @@ -371,11 +509,11 @@ void x07_state::t6834_cmd (uint8_t cmd) { uint8_t udc_code = m_in.data[m_in.read++]; - if(udc_code>=128 && udc_code<=159) - for(int i = 0; i < 8; i++) + if (udc_code>=128 && udc_code<=159) + for (int i = 0; i < 8; i++) m_t6834_ram[(udc_code<<3) + i - 0x200] = m_in.data[m_in.read++]; - else if(udc_code>=224) - for(int i = 0; i < 8; i++) + else if (udc_code>=224) + for (int i = 0; i < 8; i++) m_t6834_ram[(udc_code<<3) + i - 0x400] = m_in.data[m_in.read++]; } break; @@ -383,7 +521,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x1b: //UDC read { uint16_t address = m_in.data[m_in.read++] << 3; - for(int i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) m_out.data[m_out.write++] = get_char(address + i); } break; @@ -396,7 +534,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x1d: //start program write { - for(int i = 0; i < 0x80; i++) + for (int i = 0; i < 0x80; i++) { uint8_t sp_char = m_in.data[m_in.read++]; m_t6834_ram[0x500 + i] = sp_char; @@ -407,7 +545,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x1e: //start program write cont { - for(int i = (int)strlen((char*)&m_t6834_ram[0x500]); i < 0x80; i++) + for (int i = (int)strlen((char*)&m_t6834_ram[0x500]); i < 0x80; i++) { uint8_t sp_char = m_in.data[m_in.read++]; m_t6834_ram[0x500 + i] = sp_char; @@ -423,7 +561,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x21: //start program read { - for(int i = 0; i < 0x80; i++) + for (int i = 0; i < 0x80; i++) { uint8_t sp_data = m_t6834_ram[0x500 + i]; m_out.data[m_out.write++] = sp_data; @@ -448,7 +586,7 @@ void x07_state::t6834_cmd (uint8_t cmd) const uint8_t y = m_cursor.y = m_in.data[m_in.read++]; uint8_t char_code = m_in.data[m_in.read++]; - if(char_code) + if (char_code) draw_char(x, y, char_code); } break; @@ -460,15 +598,13 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x27: //test key { - static const char *const lines[] = {"S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "BZ", "A1"}; - uint16_t matrix; - uint8_t data = 0; - matrix = m_in.data[m_in.read++]; + uint16_t matrix = m_in.data[m_in.read++]; matrix |= (m_in.data[m_in.read++] << 8); + uint8_t data = 0; for (int i=0 ;i<10; i++) - if (matrix & (1<<i)) - data |= ioport(lines[i])->read(); + if (BIT(matrix, i)) + data |= m_io_keyboard[i]->read(); m_out.data[m_out.write++] = data; } @@ -477,7 +613,7 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x28: //test chr { uint8_t idx = kb_get_index(m_in.data[m_in.read++]); - m_out.data[m_out.write++] = (ioport(x07_keycodes[idx].tag)->read() & x07_keycodes[idx].mask) ? 0x00 : 0xff; + m_out.data[m_out.write++] = (m_io_keyboard[x07_keycodes[idx].tag]->read() & x07_keycodes[idx].mask) ? 0x00 : 0xff; } break; @@ -511,7 +647,7 @@ void x07_state::t6834_cmd (uint8_t cmd) if (m_draw_udk) draw_udk(); else - for(uint8_t l = 3 * 8; l < (3 + 1) * 8; l++) + for (uint8_t l = 3 * 8; l < (3 + 1) * 8; l++) memset(&m_lcd_map[l][0], 0, 120); } break; @@ -529,18 +665,18 @@ void x07_state::t6834_cmd (uint8_t cmd) uint8_t pos = m_in.data[m_in.read++] - 1; uint8_t udk_size = (pos != 5 && pos != 11) ? 0x2a : 0x2e; - for(int i = (int)strlen((char*)&m_t6834_ram[udk_offset[pos]]); i < udk_size; i++) + for (int i = (int)strlen((char*)&m_t6834_ram[udk_offset[pos]]); i < udk_size; i++) { uint8_t udk_char = m_in.data[m_in.read++]; m_t6834_ram[udk_offset[pos] + i] = udk_char; - if(!udk_char) break; + if (!udk_char) break; } } break; case 0x36: //alarm read { - for(auto & elem : m_alarm) + for (auto &elem : m_alarm) m_out.data[m_out.write++] = elem; } break; @@ -578,18 +714,18 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x40: //UDK init { memset(m_t6834_ram, 0, 0x200); - for(int i = 0; i < 12; i++) + for (int i = 0; i < 12; i++) strcpy((char*)m_t6834_ram + udk_offset[i], udk_ini[i]); } break; case 0x41: //char write { - for(int cy = 0; cy < 8; cy++) + for (int cy = 0; cy < 8; cy++) { uint8_t cl = m_in.data[m_in.read++]; - for(int cx = 0; cx < 6; cx++) + for (int cx = 0; cx < 6; cx++) m_lcd_map[m_cursor.y * 8 + cy][m_cursor.x * 6 + cx] = (cl & (0x80>>cx)) ? 1 : 0; } } @@ -597,11 +733,11 @@ void x07_state::t6834_cmd (uint8_t cmd) case 0x42: //char read { - for(int cy = 0; cy < 8; cy++) + for (int cy = 0; cy < 8; cy++) { uint8_t cl = 0x00; - for(int cx = 0; cx < 6; cx++) + for (int cx = 0; cx < 6; cx++) cl |= (m_lcd_map[m_cursor.y * 8 + cy][m_cursor.x * 6 + cx] != 0) ? (1<<(7-cx)) : 0; m_out.data[m_out.write++] = cl; @@ -631,7 +767,7 @@ void x07_state::t6834_r () { m_out.read++; m_regs_r[2] &= 0xfe; - if(m_out.write > m_out.read) + if (m_out.write > m_out.read) { m_regs_r[0] = 0x40; m_regs_r[1] = m_out.data[m_out.read]; @@ -657,20 +793,20 @@ void x07_state::t6834_w () uint8_t cmd_len = t6834_cmd_len[m_in.data[m_in.read]]; - if(cmd_len & 0x80) + if (cmd_len & 0x80) { - if((cmd_len & 0x7f) < m_in.write && !data) + if ((cmd_len & 0x7f) < m_in.write && !data) cmd_len = m_in.write; } - if(m_in.write == cmd_len) + if (m_in.write == cmd_len) { m_out.write = 0; m_out.read = 0; t6834_cmd(m_in.data[m_in.read++]); m_in.write = 0; m_in.read = 0; - if(m_out.write) + if (m_out.write) { m_regs_r[0] = 0x40; m_regs_r[1] = m_out.data[m_out.read]; @@ -929,7 +1065,7 @@ void x07_state::printer_w() inline uint8_t x07_state::kb_get_index(uint8_t char_code) { - for(uint8_t i=0 ; i< std::size(x07_keycodes); i++) + for (uint8_t i=0 ; i< std::size(x07_keycodes); i++) if (x07_keycodes[i].codes[0] == char_code) return i; @@ -940,11 +1076,11 @@ inline uint8_t x07_state::get_char(uint16_t pos) { uint8_t code = pos>>3; - if(code>=128 && code<=159) //UDC 0 + if (code>=128 && code<=159) //UDC 0 { return m_t6834_ram[pos - 0x200]; } - else if(code>=224) //UDC 1 + else if (code>=224) //UDC 1 { return m_t6834_ram[pos - 0x400]; } @@ -961,7 +1097,7 @@ INPUT_CHANGED_MEMBER( x07_state::kb_func_keys ) if (m_kb_on && newval) { - uint8_t shift = (ioport("A1")->read() & 0x01); + uint8_t shift = m_io_keyboard[9]->read() & 0x01; uint16_t udk_s = udk_offset[(shift*6) + idx - 1]; /* First 3 chars are used for description */ @@ -973,7 +1109,7 @@ INPUT_CHANGED_MEMBER( x07_state::kb_func_keys ) if (m_kb_size < 0xff && data != 0) m_t6834_ram[0x400 + m_kb_size++] = data; - } while(data != 0); + } while (data != 0); kb_irq(); } @@ -982,8 +1118,8 @@ INPUT_CHANGED_MEMBER( x07_state::kb_func_keys ) INPUT_CHANGED_MEMBER( x07_state::kb_keys ) { uint8_t modifier; - uint8_t a1 = ioport("A1")->read(); - uint8_t bz = ioport("BZ")->read(); + uint8_t a1 = m_io_keyboard[9]->read(); + uint8_t bz = m_io_keyboard[8]->read(); uint8_t keycode = (uint8_t)param; if (m_kb_on && !newval) @@ -1069,32 +1205,34 @@ void x07_state::kb_irq() inline void x07_state::draw_char(uint8_t x, uint8_t y, uint8_t char_pos) { - if(x < 20 && y < 4) - for(int cy = 0; cy < 8; cy++) - for(int cx = 0; cx < 6; cx++) + if (x < 20 && y < 4) + { + for (int cy = 0; cy < 8; cy++) + for (int cx = 0; cx < 6; cx++) m_lcd_map[y * 8 + cy][x * 6 + cx] = (get_char(((char_pos << 3) + cy) & 0x7ff) & (0x80>>cx)) ? 1 : 0; + } } inline void x07_state::draw_point(uint8_t x, uint8_t y, uint8_t color) { - if(x < 120 && y < 32) + if (x < 120 && y < 32) m_lcd_map[y][x] = color; } inline void x07_state::draw_udk() { - uint8_t i, x, j; - if (m_draw_udk) - for(i = 0, x = 0; i < 5; i++) + { + for (int i = 0, x = 0; i < 5; i++) { - uint16_t ofs = udk_offset[i + ((ioport("A1")->read()&0x01) ? 6 : 0)]; + uint16_t ofs = udk_offset[i + ((m_io_keyboard[9]->read()&0x01) ? 6 : 0)]; draw_char(x++, 3, 0x83); - for(j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) draw_char(x++, 3, m_t6834_ram[ofs++]); } + } } DEVICE_IMAGE_LOAD_MEMBER( x07_state::card_load ) @@ -1131,14 +1269,22 @@ uint32_t x07_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (m_lcd_on) { - for(int py = 0; py < 4; py++) - for(int px = 0; px < 20; px++) - for(int y = 0; y < 8; y++) + for (int py = 0; py < 4; py++) + { + for (int px = 0; px < 20; px++) + { + 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) + { + if (m_cursor.on && m_blink && m_cursor.x == px && m_cursor.y == py) bitmap.pix(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; else bitmap.pix(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; + } + } + } + } } @@ -1154,7 +1300,7 @@ uint8_t x07_state::x07_io_r(offs_t offset) { uint8_t data = 0xff; - switch(offset) + switch (offset) { case 0x80: case 0x81: @@ -1188,7 +1334,7 @@ uint8_t x07_state::x07_io_r(offs_t offset) break; case 0xf2: - if(m_regs_w[5] & 4) + if (m_regs_w[5] & 4) m_regs_r[2] |= 2; else m_regs_r[2] &= 0xfd; @@ -1202,7 +1348,7 @@ uint8_t x07_state::x07_io_r(offs_t offset) void x07_state::x07_io_w(offs_t offset, uint8_t data) { - switch(offset) + switch (offset) { case 0x80: m_font_code = data; @@ -1238,22 +1384,22 @@ void x07_state::x07_io_w(offs_t offset, uint8_t data) m_cass_tick->reset(); } - if((data & F4_BRG_ACTIVE) == F4_BRG_ACTIVE) + if ((data & F4_BRG_ACTIVE) == F4_BRG_ACTIVE) t6834_set_audio(); else t6834_reset_audio(); break; case 0xf5: - if(data & 0x01) + if (data & 0x01) t6834_r(); - if(data & 0x02) + if (data & 0x02) t6834_w(); - if(data & 0x04) + if (data & 0x04) cassette_r(); - if(data & 0x08) + if (data & 0x08) cassette_w(); - if(data & 0x20) + if (data & 0x20) printer_w(); m_regs_w[5] = data; diff --git a/src/mame/canon/x07.h b/src/mame/canon/x07.h index 3acc30a85d7..cfc72d25bc3 100644 --- a/src/mame/canon/x07.h +++ b/src/mame/canon/x07.h @@ -10,155 +10,19 @@ #pragma once +#include "bus/generic/carts.h" +#include "bus/generic/slot.h" #include "cpu/z80/nsc800.h" -#include "sound/beep.h" +#include "imagedev/cassette.h" +#include "imagedev/printer.h" #include "machine/nvram.h" #include "machine/ram.h" #include "machine/timer.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "formats/x07_cas.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "emupal.h" - -//default value for user defined keys, taken for official documentation -static const char *const udk_ini[12] = { - "tim?TIME$\r", - "cldCLOAD\"", - "locLOCATE ", - "lstLIST ", - "runRUN\r", - "", - "dat?DATE$\r", - "csvCSAVE\"", - "prtPRINT ", - "slpSLEEP", - "cntCONT\r", - "" -}; - -static const uint16_t udk_offset[12] = -{ - 0x0000, 0x002a, 0x0054, 0x007e, 0x00a8, 0x00d2, - 0x0100, 0x012a, 0x0154, 0x017e, 0x01a8, 0x01d2 -}; - -static const uint8_t printer_charcode[256] = -{ - 0xff, 0x7f, 0xbf, 0x3f, 0xdf, 0x5f, 0x9f, 0x1f, - 0xef, 0x6f, 0xaf, 0x2f, 0xcf, 0x4f, 0x8f, 0x0f, - 0xf7, 0x77, 0xb7, 0x37, 0xd7, 0x57, 0x97, 0x17, - 0xe7, 0x67, 0xa7, 0x27, 0xc7, 0x47, 0x87, 0x07, - 0xfb, 0x7b, 0xbb, 0x3b, 0xdb, 0x5b, 0x9b, 0x1b, - 0xeb, 0x6b, 0xab, 0x2b, 0xcb, 0x4b, 0x8b, 0x0b, - 0xf3, 0x73, 0xb3, 0x33, 0xd3, 0x53, 0x93, 0x13, - 0xe3, 0x63, 0xa3, 0x23, 0xc3, 0x43, 0x83, 0x03, - 0xfd, 0x7d, 0xbd, 0x3d, 0xdd, 0x5d, 0x9d, 0x1d, - 0xed, 0x6d, 0xad, 0x2d, 0xcd, 0x4d, 0x8d, 0x0d, - 0xf5, 0x75, 0xb5, 0x35, 0xd5, 0x55, 0x95, 0x15, - 0xe5, 0x65, 0xa5, 0x25, 0xc5, 0x45, 0x85, 0x05, - 0xf9, 0x79, 0xb9, 0x39, 0xd9, 0x59, 0x99, 0x19, - 0xe9, 0x69, 0xa9, 0x29, 0xc9, 0x49, 0x89, 0x09, - 0xf1, 0x71, 0xb1, 0x31, 0xd1, 0x51, 0x91, 0x11, - 0xe1, 0x61, 0xa1, 0x21, 0xc1, 0x41, 0x81, 0x01, - 0xfe, 0x7e, 0xbe, 0x3e, 0xde, 0x5e, 0x9e, 0x1e, - 0xee, 0x6e, 0xae, 0x2e, 0xce, 0x4e, 0x8e, 0x0e, - 0xf6, 0x76, 0xb6, 0x36, 0xd6, 0x56, 0x96, 0x16, - 0xe6, 0x66, 0xa6, 0x26, 0xc6, 0x46, 0x86, 0x06, - 0xfa, 0x7a, 0xba, 0x3a, 0xda, 0x5a, 0x9a, 0x1a, - 0xea, 0x6a, 0xaa, 0x2a, 0xca, 0x4a, 0x8a, 0x0a, - 0xf2, 0x72, 0xb2, 0x32, 0xd2, 0x52, 0x92, 0x12, - 0xe2, 0x62, 0xa2, 0x22, 0xc2, 0x42, 0x82, 0x02, - 0xfc, 0x7c, 0xbc, 0x3c, 0xdc, 0x5c, 0x9c, 0x1c, - 0xec, 0x6c, 0xac, 0x2c, 0xcc, 0x4c, 0x8c, 0x0c, - 0xf4, 0x74, 0xb4, 0x34, 0xd4, 0x54, 0x94, 0x14, - 0xe4, 0x64, 0xa4, 0x24, 0xc4, 0x44, 0x84, 0x04, - 0xf8, 0x78, 0xb8, 0x38, 0xd8, 0x58, 0x98, 0x18, - 0xe8, 0x68, 0xa8, 0x28, 0xc8, 0x48, 0x88, 0x08, - 0xf0, 0x70, 0xb0, 0x30, 0xd0, 0x50, 0x90, 0x10, - 0xe0, 0x60, 0xa0, 0x20, 0xc0, 0x40, 0x80, 0x00 -}; - -static const uint8_t t6834_cmd_len[0x47] = -{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x04, 0x03, - 0x01, 0x02, 0x09, 0x01, 0x09, 0x01, 0x01, 0x02, - 0x03, 0x03, 0x03, 0x03, 0x05, 0x04, 0x82, 0x02, - 0x01, 0x01, 0x0a, 0x02, 0x01, 0x81, 0x81, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x03, - 0x02, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x82, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x09, 0x01, 0x03, 0x03, 0x01, 0x01 -}; +#include "sound/beep.h" -struct x07_kb -{ - const char *tag; //input port tag - uint8_t mask; //bit mask - uint8_t codes[7]; //port codes -}; +#include "emupal.h" -static const x07_kb x07_keycodes[56] = -{ - {"BZ", 0x01, {0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b}}, - {"S1", 0x01, {0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12}}, - {"S1", 0x02, {0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16}}, - {"S1", 0x04, {0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c}}, - {"S1", 0x08, {0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d}}, - {"S1", 0x10, {0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}}, - {"S1", 0x20, {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}}, - {"S1", 0x40, {0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20}}, - {"S2", 0x01, {0x5a, 0x7a, 0x1a, 0x00, 0xc2, 0xaf, 0xe1}}, - {"S2", 0x02, {0x58, 0x78, 0x18, 0x00, 0xbb, 0x00, 0x98}}, - {"S2", 0x04, {0x43, 0x63, 0x03, 0x00, 0xbf, 0x00, 0xe4}}, - {"S2", 0x08, {0x56, 0x76, 0x16, 0x00, 0xcb, 0x00, 0x95}}, - {"S2", 0x10, {0x42, 0x62, 0x02, 0x00, 0xba, 0x00, 0xed}}, - {"S2", 0x20, {0x4e, 0x6e, 0x0e, 0x00, 0xd0, 0x00, 0x89}}, - {"S2", 0x40, {0x4d, 0x6d, 0x0d, 0x30, 0xd3, 0x00, 0xf5}}, - {"S2", 0x80, {0x2c, 0x3c, 0x00, 0x00, 0xc8, 0xa4, 0x9c}}, - {"S3", 0x01, {0x41, 0x61, 0x01, 0x00, 0xc1, 0x00, 0x88}}, - {"S3", 0x02, {0x53, 0x73, 0x13, 0x00, 0xc4, 0x00, 0x9f}}, - {"S3", 0x04, {0x44, 0x64, 0x04, 0x00, 0xbc, 0x00, 0xef}}, - {"S3", 0x08, {0x46, 0x66, 0x06, 0x00, 0xca, 0x00, 0xfd}}, - {"S3", 0x10, {0x47, 0x67, 0x07, 0x00, 0xb7, 0x00, 0x9d}}, - {"S3", 0x20, {0x48, 0x68, 0x08, 0x00, 0xb8, 0x00, 0xfe}}, - {"S3", 0x40, {0x4a, 0x6a, 0x0a, 0x31, 0xcf, 0x00, 0xe5}}, - {"S3", 0x80, {0x4b, 0x6b, 0x0b, 0x32, 0xc9, 0x00, 0x9b}}, - {"S4", 0x01, {0x51, 0x71, 0x11, 0x00, 0xc0, 0x00, 0x8b}}, - {"S4", 0x02, {0x57, 0x77, 0x17, 0x00, 0xc3, 0x00, 0xfb}}, - {"S4", 0x04, {0x45, 0x65, 0x05, 0x00, 0xb2, 0xa8, 0x99}}, - {"S4", 0x08, {0x52, 0x72, 0x12, 0x00, 0xbd, 0x00, 0xf6}}, - {"S4", 0x10, {0x54, 0x74, 0x14, 0x00, 0xb6, 0x00, 0x97}}, - {"S4", 0x20, {0x59, 0x79, 0x19, 0x35, 0xdd, 0x00, 0x96}}, - {"S4", 0x40, {0x55, 0x75, 0x15, 0x34, 0xc5, 0x00, 0x94}}, - {"S4", 0x80, {0x49, 0x69, 0x09, 0x00, 0xc6, 0x00, 0xf9}}, - {"S5", 0x01, {0x31, 0x21, 0x00, 0x00, 0xc7, 0x00, 0xe9}}, - {"S5", 0x02, {0x32, 0x22, 0x00, 0x00, 0xcc, 0x00, 0x90}}, - {"S5", 0x04, {0x33, 0x23, 0x00, 0x00, 0xb1, 0xa7, 0x91}}, - {"S5", 0x08, {0x34, 0x24, 0x00, 0x00, 0xb3, 0xa9, 0x92}}, - {"S5", 0x10, {0x35, 0x25, 0x00, 0x00, 0xb4, 0xaa, 0x93}}, - {"S5", 0x20, {0x36, 0x26, 0x00, 0x00, 0xb5, 0xab, 0xec}}, - {"S5", 0x40, {0x37, 0x27, 0x37, 0x00, 0xd4, 0xac, 0xe0}}, - {"S5", 0x80, {0x38, 0x28, 0x37, 0x00, 0xd5, 0xad, 0xf2}}, - {"S7", 0x01, {0x2e, 0x3e, 0x00, 0x2e, 0xd9, 0xa1, 0x9a}}, - {"S7", 0x02, {0x2f, 0x3f, 0x00, 0x00, 0xd2, 0xa5, 0x80}}, - {"S7", 0x04, {0x3f, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {"S7", 0x08, {0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d}}, - {"S7", 0x10, {0x4f, 0x6f, 0x0f, 0x36, 0xd7, 0x00, 0x9e}}, - {"S7", 0x20, {0x50, 0x70, 0x10, 0x00, 0xbe, 0x00, 0xf7}}, - {"S7", 0x40, {0x40, 0x60, 0x00, 0x00, 0xde, 0x00, 0xe7}}, - {"S7", 0x80, {0x5b, 0x7b, 0x00, 0x00, 0xdf, 0xa2, 0x84}}, - {"S8", 0x01, {0x4c, 0x6c, 0x0c, 0x33, 0xd8, 0x00, 0xf4}}, - {"S8", 0x02, {0x3b, 0x2b, 0x00, 0x00, 0xda, 0x00, 0x82}}, - {"S8", 0x04, {0x3a, 0x2a, 0x00, 0x00, 0xb9, 0x00, 0x81}}, - {"S8", 0x08, {0x5d, 0x7d, 0x00, 0x00, 0xd1, 0xa3, 0x85}}, - {"S8", 0x10, {0x39, 0x29, 0x39, 0x00, 0xd6, 0xae, 0xf1}}, - {"S8", 0x20, {0x30, 0x7c, 0x00, 0x00, 0xdc, 0xa6, 0x8a}}, - {"S8", 0x40, {0x2d, 0x3d, 0x00, 0x00, 0xce, 0x00, 0xf0}}, - {"S8", 0x80, {0x3d, 0x7e, 0x00, 0x00, 0xcd, 0x00, 0xfc}} -}; +#include "formats/x07_cas.h" class x07_state : public driver_device { @@ -173,30 +37,24 @@ public: , m_nvram2(*this, "nvram2") , m_cassette(*this, "cassette") , m_card(*this, "cardslot") + , m_io_keyboard(*this, { "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "BZ", "A1" }) , m_warm_start(1) { } - void x07(machine_config &config); + void x07(machine_config &config) ATTR_COLD; - void init_x07(); + void init_x07() ATTR_COLD; DECLARE_INPUT_CHANGED_MEMBER( kb_keys ); DECLARE_INPUT_CHANGED_MEMBER( kb_func_keys ); DECLARE_INPUT_CHANGED_MEMBER( kb_break ); DECLARE_INPUT_CHANGED_MEMBER( kb_update_udk ); -private: - required_device<cpu_device> m_maincpu; - required_device<printer_image_device> m_printer; - required_device<beep_device> m_beep; - required_device<ram_device> m_ram; - required_device<nvram_device> m_nvram1; - required_device<nvram_device> m_nvram2; - required_device<cassette_image_device> m_cassette; - required_device<generic_slot_device> m_card; - +protected: void machine_start() override ATTR_COLD; void machine_reset() override ATTR_COLD; + +private: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint8_t x07_io_r(offs_t offset); void x07_io_w(offs_t offset, uint8_t data); @@ -225,6 +83,27 @@ private: DECLARE_DEVICE_IMAGE_LOAD_MEMBER( card_load ); + TIMER_CALLBACK_MEMBER(cassette_tick); + TIMER_CALLBACK_MEMBER(cassette_poll); + TIMER_CALLBACK_MEMBER(rsta_clear); + TIMER_CALLBACK_MEMBER(rstb_clear); + TIMER_CALLBACK_MEMBER(audio_tick); + TIMER_CALLBACK_MEMBER(click_stop); + TIMER_DEVICE_CALLBACK_MEMBER(blink_timer); + + void x07_io(address_map &map) ATTR_COLD; + void x07_mem(address_map &map) ATTR_COLD; + + required_device<cpu_device> m_maincpu; + required_device<printer_image_device> m_printer; + required_device<beep_device> m_beep; + required_device<ram_device> m_ram; + required_device<nvram_device> m_nvram1; + required_device<nvram_device> m_nvram2; + required_device<cassette_image_device> m_cassette; + required_device<generic_slot_device> m_card; + required_ioport_array<10> m_io_keyboard; + /* general */ uint8_t m_sleep = 0; uint8_t m_warm_start; @@ -287,16 +166,6 @@ private: uint8_t m_prn_buffer[0x100]{}; uint8_t m_prn_size = 0; void x07_palette(palette_device &palette) const; - TIMER_CALLBACK_MEMBER(cassette_tick); - TIMER_CALLBACK_MEMBER(cassette_poll); - TIMER_CALLBACK_MEMBER(rsta_clear); - TIMER_CALLBACK_MEMBER(rstb_clear); - TIMER_CALLBACK_MEMBER(audio_tick); - TIMER_CALLBACK_MEMBER(click_stop); - TIMER_DEVICE_CALLBACK_MEMBER(blink_timer); - - void x07_io(address_map &map) ATTR_COLD; - void x07_mem(address_map &map) ATTR_COLD; }; #endif // MAME_CANON_X07_H diff --git a/src/mame/igs/igs011.cpp b/src/mame/igs/igs011.cpp index dff14bc9d46..f783ff52845 100644 --- a/src/mame/igs/igs011.cpp +++ b/src/mame/igs/igs011.cpp @@ -393,11 +393,12 @@ u16 igs011_state_base::dips_r() u16 ret = 0xff; for (int i = 0; i < Num; i++) + { if (BIT(~m_dips_sel, i)) ret &= m_io_dsw[i]->read(); + } - // 0x0100 is blitter busy - return (ret & 0xff) | 0x0000; + return (ret & 0xff) | (m_igs011->blitter_busy_r() ? 0x0100 : 0x0000); } /*************************************************************************** diff --git a/src/mame/igs/igs011_video.cpp b/src/mame/igs/igs011_video.cpp index 7451191f88c..8c5de9b5645 100644 --- a/src/mame/igs/igs011_video.cpp +++ b/src/mame/igs/igs011_video.cpp @@ -123,6 +123,11 @@ void igs011_device::priority_ram_w(offs_t offset, u16 data, u16 mem_mask) COMBINE_DATA(&m_priority_ram[offset]); } +int igs011_device::blitter_busy_r() +{ + return 0; // TODO +} + u32 igs011_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { #ifdef MAME_DEBUG diff --git a/src/mame/igs/igs011_video.h b/src/mame/igs/igs011_video.h index 8902ec89d9e..d028fe8bd0d 100644 --- a/src/mame/igs/igs011_video.h +++ b/src/mame/igs/igs011_video.h @@ -22,6 +22,7 @@ public: void layers_w(offs_t offset, u8 data); u16 priority_ram_r(offs_t offset); void priority_ram_w(offs_t offset, u16 data, u16 mem_mask = ~0); + int blitter_busy_r(); void prot_w(offs_t offset, u8 data); u16 prot_r(); diff --git a/src/mame/jaleco/bnstars.cpp b/src/mame/jaleco/bnstars.cpp index 60e9b1e6801..5d70a1a11ac 100644 --- a/src/mame/jaleco/bnstars.cpp +++ b/src/mame/jaleco/bnstars.cpp @@ -89,15 +89,18 @@ ROMs : MR96004-10.1 [125661cd] (IC5 - Samples) #include "emu.h" #include "ms32.h" +#include "jalcrpt.h" + +#include "mahjong.h" -#include "cpu/z80/z80.h" #include "cpu/v60/v60.h" -#include "jalcrpt.h" +#include "cpu/z80/z80.h" -#include "layout/generic.h" #include "speaker.h" #include "tilemap.h" +#include "layout/generic.h" + namespace { @@ -120,8 +123,7 @@ public: , m_rotate_ctrl(*this, "rotate_ctrl.%u", 0U) , m_sprite(*this, "sprite.%u", 0U) , m_object_vram(*this, "objram_%u", 0U, 0x10000U, ENDIANNESS_LITTLE) - , m_p1_keys(*this, "P1KEY.%u", 0) - , m_p2_keys(*this, "P2KEY.%u", 0) + , m_io_keys{ { *this, "KEY%u", 0 }, { *this, "KEY%u", 5 } } { } void bnstars(machine_config &config); @@ -152,8 +154,7 @@ private: required_device_array<ms32_sprite_device, 2> m_sprite; memory_share_array_creator<u16, 2> m_object_vram; - required_ioport_array<4> m_p1_keys; - required_ioport_array<4> m_p2_keys; + required_ioport_array<4> m_io_keys[2]; u32 m_bnstars1_mahjong_select = 0; template <int chip> void ascii_vram_w(offs_t offset, u16 data, u16 mem_mask = ~0); @@ -437,10 +438,10 @@ template <int chip> void ms32_bnstars_state::palette_ram_w(offs_t offset, u16 da template <int P> ioport_value ms32_bnstars_state::mahjong_ctrl_r() { - required_ioport_array<4> &keys = (P == 0) ? m_p1_keys : m_p2_keys; - // different routing than other ms32.cpp mahjong games, using 0x2080 as mask - u8 which = bitswap<2>(m_bnstars1_mahjong_select, 13, 7); - return keys[which]->read(); + // different routing than other ms32.cpp mahjong games + // uses 0x2080 as multiplexer input rather than switch matrix + const u8 which = bitswap<2>(m_bnstars1_mahjong_select, 13, 7); + return bitswap<6>(m_io_keys[P][which]->read(), 4, 2, 3, 1, 0, 5) | 0xc0; } void ms32_bnstars_state::bnstars1_mahjong_select_w(u32 data) @@ -515,41 +516,6 @@ static INPUT_PORTS_START( bnstars ) PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Test?") PORT_CODE(KEYCODE_F1) - PORT_START("P1KEY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_A ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_E ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_I ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P1KEY.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_F ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_J ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P1KEY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_C ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_K ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P1KEY.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_D ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_H ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_L ) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("P2") PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC(ms32_bnstars_state::mahjong_ctrl_r<1>)) PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -558,40 +524,7 @@ static INPUT_PORTS_START( bnstars ) PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Test?") PORT_CODE(KEYCODE_F2) - PORT_START("P2KEY.0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2KEY.1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2KEY.2") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2) - PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2KEY.3") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2) - PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_INCLUDE(mahjong_matrix_2p) PORT_START("DSW") PORT_DIPNAME( 0x00000001, 0x00000001, "Test Mode" ) PORT_DIPLOCATION("SW1:8") diff --git a/src/mame/jaleco/megasys1.cpp b/src/mame/jaleco/megasys1.cpp index 77e4b371b28..6fa5477425d 100644 --- a/src/mame/jaleco/megasys1.cpp +++ b/src/mame/jaleco/megasys1.cpp @@ -110,7 +110,7 @@ RAM RW 0e0000-0effff* < < bootleg version of rodlandj has one instruction patched out to do exactly the same thing that we are doing (ignoring the 6295 status). -- Understand properly how irqs truly works, kazan / iganinju solution seems hacky +- Understand properly how IRQs truly works, kazan / iganinju solution seems hacky - P47 intro effect is imperfect ( https://www.youtube.com/watch?v=eozZGcVspVw ) @@ -210,20 +210,20 @@ TIMER_DEVICE_CALLBACK_MEMBER(megasys1_state::megasys_base_scanline) { int scanline = param; - // stdragon: irq 1 is raster irq ("press start" behaviour), happens at around scanline 90(-16), 2 vblank, 3 is RTE. - // p47: irq 2 valid, others RTE - // kickoff: irq 3 valid, others RTE - // tshingen: irq 3 RTE, irq 1 reads inputs, irq 2 sets vregs values (pending further investigation ...) - // kazan: irq 3 disables irq in SW then execute a routine, irq 2 just execute this routine, irq 1 RTR - // astyanax: irq 3 RTE, irq 1 sets "ffff0210" OR 2, irq 2 vblank - // hachoo: irq 2 vblank, irq 3 & 1 sets 0xf004e buffer with the level number - // jitsupro: irq 3 RTE, irq 2 sets palette and vregs, irq 1 reads inputs - // plusalph: irq 1 & 3 RTE, irq 2 valid - // rodland: irq 1 & 3 RTE, irq 2 valid (sets palette, vregs ...) - // soldam: irq 1 & 3 RTE, irq 2 valid - // edfp: irq 1?, 2 sets vregs etc, 3 RTE - - if(scanline == 224+16) // vblank-out irq + // stdragon: IRQ 1 is raster IRQ ("press start" behaviour), happens at around scanline 90(-16), 2 vblank, 3 is RTE. + // p47: IRQ 2 valid, others RTE + // kickoff: IRQ 3 valid, others RTE + // tshingen: IRQ 3 RTE, IRQ 1 reads inputs, IRQ 2 sets vregs values (pending further investigation ...) + // kazan: IRQ 3 disables IRQ in SW then execute a routine, IRQ 2 just execute this routine, IRQ 1 RTR + // astyanax: IRQ 3 RTE, IRQ 1 sets "ffff0210" OR 2, IRQ 2 vblank + // hachoo: IRQ 2 vblank, IRQ 3 & 1 sets 0xf004e buffer with the level number + // jitsupro: IRQ 3 RTE, IRQ 2 sets palette and vregs, IRQ 1 reads inputs + // plusalph: IRQ 1 & 3 RTE, IRQ 2 valid + // rodland: IRQ 1 & 3 RTE, IRQ 2 valid (sets palette, vregs ...) + // soldam: IRQ 1 & 3 RTE, IRQ 2 valid + // edfp: IRQ 1?, 2 sets vregs etc, 3 RTE + + if(scanline == 224+16) // vblank-out IRQ m_maincpu->set_input_line(2, HOLD_LINE); if(scanline == 80+16) @@ -246,7 +246,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(megasys1_typea_state::megasys1A_iganinju_scanline) if(m_ram[0] == 0) return; - if(scanline == 240) // vblank-out irq + if(scanline == 240) // vblank-out IRQ m_maincpu->set_input_line(2, HOLD_LINE); } diff --git a/src/mame/jaleco/ms32.cpp b/src/mame/jaleco/ms32.cpp index e637b63ddc0..9c46d3d0919 100644 --- a/src/mame/jaleco/ms32.cpp +++ b/src/mame/jaleco/ms32.cpp @@ -475,8 +475,9 @@ Notes from Charles MacDonald #include "mahjong.h" -#include "cpu/z80/z80.h" #include "cpu/v60/v60.h" +#include "cpu/z80/z80.h" + #include "speaker.h" #include "f1superb.lh" diff --git a/src/mame/roland/roland_cm32p.cpp b/src/mame/roland/roland_cm32p.cpp index 57d61bc21d0..5760fad726e 100644 --- a/src/mame/roland/roland_cm32p.cpp +++ b/src/mame/roland/roland_cm32p.cpp @@ -10,14 +10,14 @@ Notes: -- When booting, it does a basic check by writing values 0..0xFF to 0x108A. +- When booting, it does a basic check by writing values 0..0xff to 0x108a. It then expects (value & 0x03) to be read back from 0x1080 and (value) to be read back from 0x1081/0x1082. The routine for doing the check begins at 0x4686. Succeeding means it ends up at 0x4801. -- When in test mode, the firmware gets stuck in the loop at 0xBB06, waiting for Interrupt #5 (calls 0x4014) to fire. - It gets there by calling function 0xBBBB, which writes text (address w@0x40, num characters b@0x43) to the LCD screen. +- When in test mode, the firmware gets stuck in the loop at 0xbb06, waiting for Interrupt #5 (calls 0x4014) to fire. + It gets there by calling function 0xbbbb, which writes text (address w@0x40, num characters b@0x43) to the LCD screen. This can be worked around by setting b@BB2D = 03. -- The firmware gets also stuck in the loop at 0x7D70, waiting for Interrupt #8 (calls 0x4020). +- The firmware gets also stuck in the loop at 0x7d70, waiting for Interrupt #8 (calls 0x4020). This might be related to finding the best free voice? You can exit the loop by setting b@7D80 = 00. - Test Mode shows the results of 4 checks: @@ -28,9 +28,9 @@ Notes: Errors in check 2 and 3 are "not abnormal". In order to make check 2 pass successfully, you need to connect MIDI Out with MIDI In, creating a loopback. Check 3 requires the SN-U110-04 PCM card ("Electric Grand & Clavi") to be inserted in order to succeed. -- In order to access the built-in PCM ROM (IC18), the CPU asks the sound chip to read offsets 0x000000 .. 0x07FFFF. - The PCM card is accessed via offsets 0x080000 .. 0x0FFFFF. - The additional PCM ROMs are mapped to 0x100000 .. 0x17FFFF (IC19) and 0x200000 .. 0x27FFFF according to the sample table in IC18. +- In order to access the built-in PCM ROM (IC18), the CPU asks the sound chip to read offsets 0x000000 .. 0x07ffff. + The PCM card is accessed via offsets 0x080000 .. 0x0fffff. + The additional PCM ROMs are mapped to 0x100000 .. 0x17ffff (IC19) and 0x200000 .. 0x27ffff according to the sample table in IC18. - The sound chip has 32 voices. Voice 0 is reserved by the firmware for reading data from the PCM ROM. The firmware allocates voices from back to front, i.e. voice 31 first. - The "PCM sound chip" itself doesn't seem to support panning. @@ -38,7 +38,7 @@ Notes: TODO: -- figure out how "freeing a voice" works - right now the firmware gets stuck when playing the 32th note. +- figure out how "freeing a voice" works - right now the firmware gets stuck when playing the 32nd note. PCB Layout @@ -141,7 +141,7 @@ external internal external internal A17 - - - A17 A18 - - - A18 -Line scramling for the address and data lines matches the SN-U110 cards. +Line scrambling for the address and data lines matches the SN-U110 cards. PCM ROM Tables @@ -202,8 +202,8 @@ CM-32P Firmware Work RAM Layout 2344..23C1 - Part 1..6 "Patch temporary area" (see manual page 21, 0x15 bytes per partial) 23C4..23D4 - "System area" settings (see manual page 22, master volume, reverb setting, channel assignments) 23CE-23D3 - Part 1..6 MIDI channel -23D6..25B5 - Part 1..6 instrument data (0x50 bytes per partial, from PCM ROM at 0x1000/0x1050/0x10A0/...) -25B8..2B57 - Part 1..6 sample table data (0xF0 bytes per partial, from PCM ROM at 0x0100/0x010A/0x0114/...) +23D6..25B5 - Part 1..6 instrument data (0x50 bytes per partial, from PCM ROM at 0x1000/0x1050/0x10a0/...) +25B8..2B57 - Part 1..6 sample table data (0xf0 bytes per partial, from PCM ROM at 0x0100/0x010a/0x0114/...) 34DC..34E1 - Part 1..6 Modulation (CC #1, initialized with 0) 34E2..34E7 - Part 1..6 Pitch Bend LSB (initialized with 0) @@ -211,9 +211,9 @@ CM-32P Firmware Work RAM Layout 34EE..34F3 - Part 1..6 Expression setting (CC #11, initialized with 100) 34F4..34F9 - Part 1..6 Sustain setting (CC #64, initialized with 0) 34FA..34FF - Part 1..6 unused (initialized with 0) -3500..3505 - Part 1..6 RPN LSB (CC #98, initialized with 0xFF) -3506..350B - Part 1..6 RPN MSB (CC #99, initialized with 0xFF) -350C..3511 - Part 1..6 NRPN received (initialized with 0xFF, set to 0 when RPN LSB/MSB is received, set to 0xFF when NRPN is received) +3500..3505 - Part 1..6 RPN LSB (CC #98, initialized with 0xff) +3506..350B - Part 1..6 RPN MSB (CC #99, initialized with 0xff) +350C..3511 - Part 1..6 NRPN received (initialized with 0xff, set to 0 when RPN LSB/MSB is received, set to 0xff when NRPN is received) 3512..3517 - Part 1..6 ?? (initialized with 0) 3518..351D - Part 1..6 Instrument setting 351E - Reverb Mode @@ -234,31 +234,33 @@ CM-32P Firmware Work RAM Layout Some routine locations ---------------------- 0x4014 LCD related interrupt handler -0x401C serial input (MIDI data) interrupt handler +0x401c serial input (MIDI data) interrupt handler 0x4020 some interrupt handler required while playing notes -0x45CB Initialization (memory clear + checks), external memory is checked from 0x4679 on +0x45cb Initialization (memory clear + checks), external memory is checked from 0x4679 on 0x5024 decide whether or not Test Mode is entered (normal boot == jump to 0x502A) -0x50F5 MIDI handling code -0x65E8 PCM ROM instrument check +0x50f5 MIDI handling code +0x65e8 PCM ROM instrument check 0x6650 PCM card instrument check (Note: assumes that the SN-U110-04 PCM card is inserted) -0x6EA4 play a note (parameters: 0040 - part, 0041 = note pitch, 0042 - velocity) -0xB027 load instrument data from PCM ROM (writes to 23D6 + 50*i) -0xB12B load instrument sample data from PCM ROM (reads sample IDs from 23D6+1B + 50*i, writes to 25B8 + F0*i) -0xB1A0 load secondary instrument sample data from PCM ROM (reads sample IDs from 23D6+3B + 50h*i, writes to 25B8+50 + F0*i) -0xB1E8 load 1 sample table entry from PCM ROM +0x6ea4 play a note (parameters: 0040 - part, 0041 = note pitch, 0042 - velocity) +0xb027 load instrument data from PCM ROM (writes to 23D6 + 50*i) +0xb12b load instrument sample data from PCM ROM (reads sample IDs from 23D6+1B + 50*i, writes to 25B8 + F0*i) +0xb1a0 load secondary instrument sample data from PCM ROM (reads sample IDs from 23D6+3B + 50h*i, writes to 25B8+50 + F0*i) +0xb1e8 load 1 sample table entry from PCM ROM 0xB316 PCM ROM signature check -0xBBBB write text to LCD +0xbbbb write text to LCD */ #include "emu.h" + +#include "bus/generic/carts.h" +#include "bus/generic/slot.h" #include "cpu/mcs96/i8x9x.h" #include "machine/ram.h" #include "machine/timer.h" #include "sound/roland_lp.h" #include "video/msm6222b.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" + #include "emupal.h" #include "screen.h" #include "softlist_dev.h" @@ -268,14 +270,15 @@ Some routine locations namespace { // unscramble address: ROM dump offset -> proper (descrambled) offset -#define UNSCRAMBLE_ADDR(_offset) \ - bitswap<19>(_offset,18,17,15,14,16,12,11, 7, 9,13,10, 8, 3, 2, 1, 6, 4, 5, 0) +template <typename T> constexpr auto UNSCRAMBLE_ADDR(T &&offset) +{ return bitswap<19>(offset,18,17,15,14,16,12,11, 7, 9,13,10, 8, 3, 2, 1, 6, 4, 5, 0); } + // scramble address: proper offset -> ROM dump offset -#define SCRAMBLE_ADDR(_offset) \ - bitswap<19>(_offset,18,17,14,16,15, 9,13,12, 8,10, 7,11, 3, 1, 2, 6, 5, 4, 0) +template <typename T> constexpr auto SCRAMBLE_ADDR(T &&offset) +{ return bitswap<19>(offset,18,17,14,16,15, 9,13,12, 8,10, 7,11, 3, 1, 2, 6, 5, 4, 0); } -#define UNSCRAMBLE_DATA(_data) \ - bitswap<8>(_data,1,2,7,3,5,0,4,6) +constexpr u8 UNSCRAMBLE_DATA(u8 data) +{ return bitswap<8>(data,1,2,7,3,5,0,4,6); } static INPUT_PORTS_START( cm32p ) @@ -303,27 +306,18 @@ class cm32p_state : public driver_device public: cm32p_state(const machine_config &mconfig, device_type type, const char *tag); - void cm32p(machine_config &config); + void cm32p(machine_config &config) ATTR_COLD; - void init_cm32p(); + void init_cm32p() ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; virtual void machine_reset() override ATTR_COLD; private: - required_device<i8x9x_device> cpu; - required_device<mb87419_mb87420_device> pcm; - required_device<generic_slot_device> pcmcard; - required_device<msm6222b_device> lcd; - required_device<timer_device> midi_timer; - required_device<ram_device> some_ram; - required_ioport test_sw; - required_ioport service_port; - void mt32_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); void midi_w(u16 data); @@ -346,7 +340,16 @@ private: void cm32p_map(address_map &map) ATTR_COLD; - void descramble_pcm_rom(u8* dst, const u8* src); + void descramble_pcm_rom(u8 *dst, const u8 *src); + + required_device<i8x9x_device> cpu; + required_device<mb87419_mb87420_device> pcm; + required_device<generic_slot_device> pcmcard; + required_device<msm6222b_device> lcd; + required_device<timer_device> midi_timer; + required_device<ram_device> some_ram; + required_ioport test_sw; + required_ioport service_port; bool pcmard_loaded; u8 midi; @@ -370,7 +373,7 @@ 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) +u32 cm32p_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { u16 sy=0; u8 const *const data = lcd->render(); @@ -406,10 +409,10 @@ void cm32p_state::machine_start() // TODO: The IC8 gate array has an "LCD INT" line that needs to be emulated. Then, the hack can be removed. // Note: The hack is not necessary when *not* using test mode. - rom[0xBB2D] = 0x03; // hack to make test mode not freeze when displaying the LCD text + rom[0xbb2d] = 0x03; // hack to make test mode not freeze when displaying the LCD text // TODO: remove this hack - rom[0x7D80] = 0x00; // hack to exit some loop waiting for interrupt #8 + rom[0x7d80] = 0x00; // hack to exit some loop waiting for interrupt #8 } void cm32p_state::machine_reset() @@ -420,7 +423,7 @@ void cm32p_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) { - uint32_t const size = pcmcard->common_get_size("rom"); + u32 const size = pcmcard->common_get_size("rom"); if (size > 0x080000) return std::make_pair(image_error::INVALIDLENGTH, "Invalid size (maximum supported is 512K)"); @@ -429,10 +432,10 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) u8 *base = pcmcard->get_rom_base(); if (size < 0x080000) { - uint32_t mirror = (1 << (31 - count_leading_zeros_32(size))); + u32 mirror = (1 << (31 - count_leading_zeros_32(size))); if (mirror < 0x020000) // due to how address descrambling works, we can currently only do mirroring for 128K pages mirror = 0x020000; - for (uint32_t ofs = mirror; ofs < 0x080000; ofs += mirror) + for (u32 ofs = mirror; ofs < 0x080000; ofs += mirror) memcpy(base + ofs, base, mirror); } @@ -495,7 +498,7 @@ u16 cm32p_state::port0_r() u8 cm32p_state::pcmrom_r(offs_t offset) { - const u8* pcm_rom = memregion("pcm")->base(); + const u8 *pcm_rom = memregion("pcm")->base(); return pcm_rom[offset]; } @@ -515,16 +518,16 @@ void cm32p_state::dsp_io_w(offs_t offset, u8 data) break; case 0x06: { - u8* ram = some_ram->pointer(); + u8 *ram = some_ram->pointer(); offs_t ofs = data; ram[0x000 | ofs] = dsp_io_buffer[0x00] & 0x03; ram[0x100 | ofs] = dsp_io_buffer[0x01]; ram[0x200 | ofs] = dsp_io_buffer[0x02]; } break; - case 0x0A: + case 0x0a: { - const u8* ram = some_ram->pointer(); + const u8 *ram = some_ram->pointer(); offs_t ofs = data; dsp_io_buffer[0x00] = ram[0x000 | ofs]; dsp_io_buffer[0x01] = ram[0x100 | ofs]; @@ -551,18 +554,18 @@ u8 cm32p_state::snd_io_r(offs_t offset) if (offset == 0x01) { - // code for reading from the PCM sample table is at 0xB027 - // The code at 0xB0AC writes to 1411/1F (??), then 1403/02 (bank), then 1409/08/0B/0A (address). - // It waits a few cycles and at 0xB0F7 it reads the resulting data from 1401. + // code for reading from the PCM sample table is at 0xb027 + // The code at 0xb0ac writes to 1411/1F (??), then 1403/02 (bank), then 1409/08/0B/0A (address). + // It waits a few cycles and at 0xb0f7 it reads the resulting data from 1401. offs_t bank = sound_io_buffer[0x03]; - offs_t addr = (sound_io_buffer[0x09] << 0) | (sound_io_buffer[0x0A] << 8) | (sound_io_buffer[0x0B] << 16); - addr = ((addr >> 6) + 2) & 0x3FFFF; + offs_t addr = (sound_io_buffer[0x09] << 0) | (sound_io_buffer[0x0a] << 8) | (sound_io_buffer[0x0b] << 16); + addr = ((addr >> 6) + 2) & 0x3ffff; addr |= (bank << 16); // write actual ROM address to 1440..1443 for debugging - sound_io_buffer[0x43] = (addr >> 0) & 0xFF; - sound_io_buffer[0x42] = (addr >> 8) & 0xFF; - sound_io_buffer[0x41] = (addr >> 16) & 0xFF; - sound_io_buffer[0x40] = (addr >> 24) & 0xFF; + sound_io_buffer[0x43] = (addr >> 0) & 0xff; + sound_io_buffer[0x42] = (addr >> 8) & 0xff; + sound_io_buffer[0x41] = (addr >> 16) & 0xff; + sound_io_buffer[0x40] = (addr >> 24) & 0xff; return pcmrom_r(addr); } return sound_io_buffer[offset]; @@ -658,8 +661,8 @@ void cm32p_state::init_cm32p() // Roland did a fair amount of scrambling on the address and data lines. // Only the first 0x80 bytes of the ROMs are readable text in a raw dump. // The CM-32P actually checks some of these header bytes, but it uses post-scrambling variants of offsets/values. - u8* src = static_cast<u8*>(memregion("pcmorg")->base()); - u8* dst = static_cast<u8*>(memregion("pcm")->base()); + u8 *src = static_cast<u8 *>(memregion("pcmorg")->base()); + u8 *dst = static_cast<u8 *>(memregion("pcm")->base()); // descramble internal ROMs descramble_pcm_rom(&dst[0x000000], &src[0x000000]); descramble_pcm_rom(&dst[0x100000], &src[0x100000]); @@ -668,7 +671,7 @@ void cm32p_state::init_cm32p() descramble_pcm_rom(&dst[0x080000], &src[0x080000]); } -void cm32p_state::descramble_pcm_rom(u8* dst, const u8* src) +void cm32p_state::descramble_pcm_rom(u8 *dst, const u8 *src) { for (offs_t srcpos = 0x00; srcpos < 0x80000; srcpos ++) { @@ -684,7 +687,7 @@ ROM_START( cm32p ) ROM_REGION( 0x400000, "pcmorg", 0 ) // ROMs before descrambling ROM_LOAD( "roland__r15179970__mb834000a-20__3b1_aa__8917_r00.45f.ic18", 0x000000, 0x80000, CRC(8e53b2a3) SHA1(4872530870d5079776e80e477febe425dc0ec1df) ) // markings under chip footprint are "MB834000A-20P-G-3B1" - // 0x080000 .. 0x0FFFFF is reserved for the PCM card + // 0x080000 .. 0x0fffff is reserved for the PCM card ROM_LOAD( "roland__r15179971__mb834000a-20__3b2_aa__8919_r02.34f.ic19", 0x100000, 0x80000, CRC(c8220761) SHA1(49e55fa672020f95fd9c858ceaae94d6db93df7d) ) // markings under chip footprint are "MB834000A20P-G-3B2" (including the missing dash, which is a typo on the board silkscreen) ROM_LOAD( "roland__r15179972__hn62304bpe98__9d1_japan.3f.ic20", 0x200000, 0x80000, CRC(733c4054) SHA1(9b6b59ab74e5bf838702abb087c408aaa85b7b1f) ) // markings under chip footprint are "HN62304BPE98" ROM_REGION( 0x400000, "pcm", ROMREGION_ERASEFF ) // ROMs after descrambling diff --git a/src/mame/roland/roland_r8.cpp b/src/mame/roland/roland_r8.cpp index 69a86119b45..5c19c54d472 100644 --- a/src/mame/roland/roland_r8.cpp +++ b/src/mame/roland/roland_r8.cpp @@ -16,7 +16,7 @@ General Layout Pos Len Description 80 01 card ID (00 for SN-R8-01, 01 for SN-R8-02, etc.) 81 01 number of tones - 82 0E padding (byte 0xFF) + 82 0E padding (byte 0xff) 90 70 tone offsets, 2 bytes per offset, relative to 0x100, each value points to the start of a "tone" definition 100 500 tone list 600 200 demo song header? @@ -28,17 +28,17 @@ Tone List (address: 0x100) --------- Pos Len Description 00 08 tone name -08 01 ?? (always 0x8F) +08 01 ?? (always 0x8f) 09 01 ?? -0A 01 frequency (0xE0 == 44100 Hz) +0A 01 frequency (0xe0 == 44100 Hz) 0B 02 ?? 0C 02 sample A bank/flags sample cards: - Bit 10 (0x0400) = bank (0 = card offsets 0x00000..0x3FFFF, 1 = card offsets 0x40000..0x7FFFF) + Bit 10 (0x0400) = bank (0 = card offsets 0x00000..0x3ffff, 1 = card offsets 0x40000..0x7ffff) R8 internal ROM: - Bit 10 (0x0400) = bank bit 0 (0 = offsets 0x00000..0x3FFFF, 1 = offsets 0x40000..0x7FFFF) - Bit 12 (0x1000) = bank bit 1 (0 = offsets 0x00000..0x7FFFF, 1 = offsets 0x80000..0xFFFFF) - Bits 14-15 (0xC000) - play/loop mode + Bit 10 (0x0400) = bank bit 0 (0 = offsets 0x00000..0x3ffff, 1 = offsets 0x40000..0x7ffff) + Bit 12 (0x1000) = bank bit 1 (0 = offsets 0x00000..0x7ffff, 1 = offsets 0x80000..0xfffff) + Bits 14-15 (0xc000) - play/loop mode 0 = normal loop 1 = no loop? (not used) 2 = ping-pong 1? (forwards, backwards, forwards, backwards, ...) @@ -64,11 +64,11 @@ Pos Len Description -> 30h bytes per entry "sample A" is what is heard. The use for "sample B" is unknown. -The 8 unknwon consecutive bytes (0x16..0x1D and 0x28..0x2F) are probably related to the envelope generation. +The 8 unknown consecutive bytes (0x16..0x1d and 0x28..0x2f) are probably related to the envelope generation. -R8/R8M internal tone list offsets: 0x018C10 -R8/R8M internal tone list data: 0x018CA0 +R8/R8M internal tone list offsets: 0x018c10 +R8/R8M internal tone list data: 0x018ca0 R8 mkII doesn't seem to store the tone list in the program ROM. */ @@ -90,11 +90,11 @@ R8 mkII doesn't seem to store the tone list in the program ROM. namespace { // PCM card address line scrambling -#define UNSCRAMBLE_ADDR(_offset) \ - bitswap<19>(_offset,18,17,15,14,16,12,11, 7, 9,13,10, 8, 3, 2, 1, 6, 4, 5, 0) +template <typename T> constexpr auto UNSCRAMBLE_ADDR(T &&offset) +{ return bitswap<19>(offset,18,17,15,14,16,12,11, 7, 9,13,10, 8, 3, 2, 1, 6, 4, 5, 0); } -#define UNSCRAMBLE_DATA(_data) \ - bitswap<8>(_data,1,2,7,3,5,0,4,6) +constexpr u8 UNSCRAMBLE_DATA(u8 data) +{ return bitswap<8>(data,1,2,7,3,5,0,4,6); } // PCM card offsets in PCM chip memory space // Right now this is an assumption based on the existing sample tables and wasn't confirmed with the firmware yet. @@ -111,16 +111,16 @@ public: { } - void r8_common(machine_config &config); - void init_r8(); + void r8_common(machine_config &config) ATTR_COLD; + void init_r8() ATTR_COLD; protected: void mk1_map(address_map &map) ATTR_COLD; void mk2_map(address_map &map) ATTR_COLD; - std::pair<std::error_condition, std::string> pcmrom_load(generic_slot_device* pcmcard, int card_id, device_image_interface &image); + std::pair<std::error_condition, std::string> pcmrom_load(generic_slot_device *pcmcard, int card_id, device_image_interface &image); void pcmrom_unload(int card_id); - void descramble_pcm_rom(u8* dst, const u8* src); + void descramble_pcm_rom(u8 *dst, const u8 *src); required_device<upd78k2_device> m_maincpu; required_device<mb87419_mb87420_device> m_pcm; @@ -188,7 +188,7 @@ private: std::pair<std::error_condition, std::string> roland_r8_base_state::pcmrom_load(generic_slot_device *pcmcard, int card_id, device_image_interface &image) { - uint32_t const size = pcmcard->common_get_size("rom"); + u32 const size = pcmcard->common_get_size("rom"); if (size > PCMCARD_SIZE) return std::make_pair(image_error::INVALIDLENGTH, "Invalid size (maximum supported is 512K)"); @@ -197,10 +197,10 @@ std::pair<std::error_condition, std::string> roland_r8_base_state::pcmrom_load(g u8 *base = pcmcard->get_rom_base(); if (size < PCMCARD_SIZE) { - uint32_t mirror = (1 << (31 - count_leading_zeros_32(size))); + u32 mirror = (1 << (31 - count_leading_zeros_32(size))); if (mirror < 0x020000) // due to how address descrambling works, we can currently only do mirroring for 128K pages mirror = 0x020000; - for (uint32_t ofs = mirror; ofs < PCMCARD_SIZE; ofs += mirror) + for (u32 ofs = mirror; ofs < PCMCARD_SIZE; ofs += mirror) memcpy(base + ofs, base, mirror); } @@ -283,7 +283,7 @@ void roland_r8m_state::r8m(machine_config &config) UPD78213(config.replace(), m_maincpu, 12_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &roland_r8m_state::mk1_map); - for (auto& pcmcard : m_pcmcards) + for (auto &pcmcard : m_pcmcards) GENERIC_CARTSLOT(config, pcmcard, generic_romram_plain_slot, "r8_card", "bin"); m_pcmcards[0]->set_device_load(FUNC(roland_r8m_state::pcmcard0_load)); m_pcmcards[0]->set_device_unload(FUNC(roland_r8m_state::pcmcard0_unload)); @@ -333,7 +333,7 @@ void roland_r8_base_state::init_r8() } } -void roland_r8_base_state::descramble_pcm_rom(u8* dst, const u8* src) +void roland_r8_base_state::descramble_pcm_rom(u8 *dst, const u8 *src) { for (offs_t srcpos = 0x00; srcpos < PCMCARD_SIZE; srcpos ++) { @@ -349,7 +349,7 @@ ROM_START(r8) ROM_REGION(0x200000, "pcmorg", ROMREGION_ERASE00) // ROMs before descrambling ROM_LOAD("r15179929-mn234000rle.ic30", 0x000000, 0x080000, NO_DUMP) - // 0x80000..0xFFFFF is reserved for PCM cards, according to the sample list + // 0x80000..0xfffff is reserved for PCM cards, according to the sample list ROM_LOAD("r15179930-mn234000rlf.ic31", 0x100000, 0x080000, NO_DUMP) ROM_REGION(0x200000, "pcm", ROMREGION_ERASE00) // ROMs after descrambling ROM_END @@ -361,7 +361,7 @@ ROM_START(r8m) ROM_REGION(0x400000, "pcmorg", ROMREGION_ERASE00) // ROMs before descrambling (must be large enough to allow for 3 PCM cards at offsets 0.5M, 1.5M and 2.5M) // same ROMs as R-8 assumed ROM_LOAD("r15179929-mn234000rle.bin", 0x000000, 0x080000, NO_DUMP) - // 0x80000..0xFFFFF is reserved for PCM cards, according to the sample list + // 0x80000..0xfffff is reserved for PCM cards, according to the sample list ROM_LOAD("r15179930-mn234000rlf.bin", 0x100000, 0x080000, NO_DUMP) ROM_REGION(0x400000, "pcm", ROMREGION_ERASE00) // ROMs after descrambling ROM_END |
