summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/devices/machine/68230pit.cpp4
-rw-r--r--src/devices/machine/scnxx562.cpp4
-rw-r--r--src/devices/machine/z80scc.cpp478
-rw-r--r--src/emu/rendfont.cpp1381
-rw-r--r--src/emu/rendfont.h41
-rw-r--r--src/emu/ui/cmddata.h220
-rw-r--r--src/emu/ui/cmdrender.h150
-rw-r--r--src/frontend/mame/ui/selmenu.cpp87
-rw-r--r--src/frontend/mame/ui/selmenu.h35
-rw-r--r--src/lib/util/bitmap.cpp103
-rw-r--r--src/lib/util/bitmap.h86
-rw-r--r--src/lib/util/coretmpl.h389
-rw-r--r--src/mame/drivers/by35.cpp2
-rw-r--r--src/mame/drivers/de_2.cpp14
-rw-r--r--src/mame/drivers/dec0.cpp104
-rw-r--r--src/mame/drivers/esq5505.cpp17
-rw-r--r--src/mame/drivers/fromance.cpp21
-rw-r--r--src/mame/drivers/rainbow.cpp118
-rw-r--r--src/mame/drivers/tnzs.cpp415
-rw-r--r--src/mame/includes/dec0.h1
-rw-r--r--src/mame/includes/fromance.h5
-rw-r--r--src/mame/mame.lst2
-rw-r--r--src/mame/video/fromance.cpp41
-rw-r--r--src/mame/video/m58.cpp19
-rw-r--r--src/mame/video/phoenix.cpp30
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp26
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.h5
27 files changed, 2597 insertions, 1201 deletions
diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp
index 6b19873be6a..0b3888ca47d 100644
--- a/src/devices/machine/68230pit.cpp
+++ b/src/devices/machine/68230pit.cpp
@@ -437,7 +437,7 @@ void pit68230_device::wr_pitreg_pacr(uint8_t data)
}
else
{
- LOG((" - H2 cleared because beeing disabled in PGCR\n"));
+ LOG((" - H2 cleared because being disabled in PGCR\n"));
m_h2_out_cb(CLEAR_LINE);
}
}
@@ -473,7 +473,7 @@ void pit68230_device::wr_pitreg_pbcr(uint8_t data)
}
else
{
- LOG((" - H4 cleared because beeing disabled in PGCR\n"));
+ LOG((" - H4 cleared because being disabled in PGCR\n"));
m_h4_out_cb(CLEAR_LINE);
}
}
diff --git a/src/devices/machine/scnxx562.cpp b/src/devices/machine/scnxx562.cpp
index 7dfdfdc624f..87655eeed02 100644
--- a/src/devices/machine/scnxx562.cpp
+++ b/src/devices/machine/scnxx562.cpp
@@ -2544,13 +2544,13 @@ void duscc_channel::update_serial()
if (m_brg_rx_rate != 0)
{
- if (m_brg_rx_rate == 1) m_brg_rx_rate = 0; // BRG beeing disabled
+ if (m_brg_rx_rate == 1) m_brg_rx_rate = 0; // BRG being disabled
set_rcv_rate(m_brg_rx_rate);
LOG((" - Baud Rate Generator: %d mode: RX:%dx\n", m_brg_rx_rate, get_rx_clock_mode()));
}
if (m_brg_tx_rate != 0)
{
- if (m_brg_tx_rate == 1) m_brg_tx_rate = 0; // BRG beeing disabled
+ if (m_brg_tx_rate == 1) m_brg_tx_rate = 0; // BRG being disabled
set_tra_rate(m_brg_tx_rate);
LOG((" - Baud Rate Generator: %d mode: TX:%dx\n", m_brg_tx_rate, get_tx_clock_mode()));
}
diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp
index ef665d29970..b6616f425c7 100644
--- a/src/devices/machine/z80scc.cpp
+++ b/src/devices/machine/z80scc.cpp
@@ -79,17 +79,17 @@ DONE (x) (p=partly) NMOS CMOS ESCC EMSCC
// printf("TAG %lld %s%s Data:%d\n", machine().firstcpu->total_cycles(), __PRETTY_FUNCTION__, m_owner->tag(), data);
#define VERBOSE 0
-#define LOGPRINT(x) do { if (VERBOSE) logerror x; } while (0)
-#define LOG(x) {} LOGPRINT(x)
-#define LOGR(x) {}
-#define LOGSETUP(x) {} LOGPRINT(x)
-#define LOGINT(x) {}
-#define LOGCMD(x) {}
-#define LOGTX(x) {}
-#define LOGRCV(x) {}
-#define LOGCTS(x) {}
-#define LOGDCD(x) {}
-#define LOGSYNC(x) {}
+#define LOGPRINT(...) do { if (VERBOSE) logerror(__VA_ARGS__); } while (0)
+#define LOG(...) {} LOGPRINT(__VA_ARGS__)
+#define LOGR(...) {}
+#define LOGSETUP(...) {} LOGPRINT(__VA_ARGS__)
+#define LOGINT(...) {}
+#define LOGCMD(...) {}
+#define LOGTX(...) {}
+#define LOGRCV(...) {}
+#define LOGCTS(...) {}
+#define LOGDCD(...) {}
+#define LOGSYNC(...) {}
#if VERBOSE == 2
#define logerror printf
#endif
@@ -236,7 +236,7 @@ scc8523L_device::scc8523L_device(const machine_config &mconfig, const char *tag,
void z80scc_device::device_start()
{
- LOGSETUP(("%s\n", FUNCNAME));
+ LOGSETUP("%s\n", FUNCNAME);
// resolve callbacks
m_out_txda_cb.resolve_safe();
m_out_dtra_cb.resolve_safe();
@@ -259,7 +259,7 @@ void z80scc_device::device_start()
save_item(NAME(m_int_source));
save_item(NAME(m_wr9));
save_item(NAME(m_wr0_ptrbits));
- LOG((" - SCC variant %02x\n", m_variant));
+ LOG(" - SCC variant %02x\n", m_variant);
}
@@ -269,7 +269,7 @@ void z80scc_device::device_start()
void z80scc_device::device_reset()
{
- LOGSETUP(("%s %s \n",tag(), FUNCNAME));
+ LOGSETUP("%s %s \n",tag(), FUNCNAME);
// Do channel reset on both channels
m_chanA->reset();
@@ -333,9 +333,9 @@ int z80scc_device::z80daisy_irq_state()
{
int state = 0;
- LOGINT(("%s %s A:%d%d%d B:%d%d%d ",tag(), FUNCNAME,
+ LOGINT("%s %s A:%d%d%d B:%d%d%d ", tag(), FUNCNAME,
m_int_state[0], m_int_state[1], m_int_state[2],
- m_int_state[3], m_int_state[4], m_int_state[5]));
+ m_int_state[3], m_int_state[4], m_int_state[5]);
// loop over all interrupt sources
for (auto & elem : m_int_state)
@@ -352,7 +352,7 @@ int z80scc_device::z80daisy_irq_state()
// Last chance to keep the control of the interrupt line
state |= (m_wr9 & z80scc_channel::WR9_BIT_DLC) ? Z80_DAISY_IEO : 0;
- LOGINT(("- Interrupt State %u\n", state));
+ LOGINT("- Interrupt State %u\n", state);
return state;
}
@@ -363,7 +363,7 @@ int z80scc_device::z80daisy_irq_state()
//-------------------------------------------------
int z80scc_device::z80daisy_irq_ack()
{
- LOGINT(("%s %s \n",tag(), FUNCNAME));
+ LOGINT("%s %s \n",tag(), FUNCNAME);
// loop over all interrupt sources
for (auto & elem : m_int_state)
{
@@ -372,15 +372,15 @@ int z80scc_device::z80daisy_irq_ack()
{
elem = Z80_DAISY_IEO; // Set IUS bit (called IEO in z80 daisy lingo)
check_interrupts();
- LOGINT((" - Found an INT request, "));
+ LOGINT(" - Found an INT request, ");
if (m_wr9 & z80scc_channel::WR9_BIT_VIS)
{
- LOGINT(("but WR9 D1 set to use autovector, returning -1\n"));
+ LOGINT("but WR9 D1 set to use autovector, returning -1\n");
return -1;
}
else
{
- LOGINT(("returning RR2: %02x\n", m_chanB->m_rr2 ));
+ LOGINT("returning RR2: %02x\n", m_chanB->m_rr2 );
return m_chanB->m_rr2;
}
}
@@ -402,7 +402,7 @@ daisy chain, the SCC has a Disable Lower Chain (DLC) software command (WR9 bit 2
*/
void z80scc_device::z80daisy_irq_reti()
{
- LOGINT(("%s %s - No RETI detection needed on SCC\n",tag(), FUNCNAME));
+ LOGINT("%s %s - No RETI detection needed on SCC\n",tag(), FUNCNAME);
}
@@ -413,7 +413,7 @@ void z80scc_device::z80daisy_irq_reti()
void z80scc_device::check_interrupts()
{
int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE;
- LOGINT(("%s %s \n",tag(), FUNCNAME));
+ LOGINT("%s %s \n",tag(), FUNCNAME);
m_out_int_cb(state);
}
@@ -424,7 +424,7 @@ void z80scc_device::check_interrupts()
void z80scc_device::reset_interrupts()
{
- LOGINT(("%s %s \n",tag(), FUNCNAME));
+ LOGINT("%s %s \n",tag(), FUNCNAME);
// reset internal interrupt sources
for (auto & elem : m_int_state)
{
@@ -479,7 +479,7 @@ int z80scc_device::get_extint_priority(int type)
case z80scc_channel::INT_EXTERNAL: prio = z80scc_channel::INT_EXTERNAL_PRIO; break;
case z80scc_channel::INT_TRANSMIT: prio = z80scc_channel::INT_TRANSMIT_PRIO; break;
case z80scc_channel::INT_SPECIAL: prio = z80scc_channel::INT_SPECIAL_PRIO; break;
- default: logerror("Bad interrupt source beeing prioritized!");
+ default: logerror("Bad interrupt source being prioritized!");
}
return prio;
}
@@ -495,12 +495,12 @@ void z80scc_device::trigger_interrupt(int index, int type)
int prio_level = 0;
- LOGINT(("%s %s:%c %02x \n",FUNCNAME, tag(), 'A' + index, type));
+ LOGINT("%s %s:%c %02x \n",FUNCNAME, tag(), 'A' + index, type);
/* The Master Interrupt Enable (MIE) bit, WR9 D3, must be set to enable the SCC to generate interrupts.*/
if (!(m_wr9 & z80scc_channel::WR9_BIT_MIE))
{
- LOGINT(("Master Interrupt Enable is not set, blocking attempt to interrupt\n"));
+ LOGINT("Master Interrupt Enable is not set, blocking attempt to interrupt\n");
return;
}
@@ -517,7 +517,7 @@ void z80scc_device::trigger_interrupt(int index, int type)
vector = modify_vector(vector, index, source);
}
- LOGINT((" Interrupt Request fired of type %u and vector %02x\n", type, vector));
+ LOGINT(" Interrupt Request fired of type %u and vector %02x\n", type, vector);
// update vector register
m_chanB->m_rr2 = vector;
@@ -554,11 +554,11 @@ int z80scc_device::update_extint(int index)
uint8_t wr15 = (index == CHANNEL_A ? m_chanA->m_wr15 : m_chanB->m_wr15);
uint8_t lrr0 = (index == CHANNEL_A ? m_chanA->m_extint_states : m_chanB->m_extint_states);
- LOGINT(("%s(%02x)\n", FUNCNAME, index));
+ LOGINT("%s(%02x)\n", FUNCNAME, index);
// Check if any of the enabled external interrupt sources has changed and requiresd service TODO: figure out Zero Count
if ( ((lrr0 & wr15 & 0xf8) ^ (rr0 & wr15 & 0xf8)) == 0 ) // mask off disabled and non relevant bits
{
- LOGINT((" - All interrupts serviced\n"));
+ LOGINT(" - All interrupts serviced\n");
// Reset IP bit for external interrupts in both internal structure and rr3
// - External and Special interripts has the same prio, just add channel offset
@@ -569,7 +569,7 @@ int z80scc_device::update_extint(int index)
}
else
{
- LOGINT((" - More external/status interrupts to serve: %02x\n", ((lrr0 & wr15 & 0xf8) ^ (rr0 & wr15 & 0xf8))));
+ LOGINT(" - More external/status interrupts to serve: %02x\n", ((lrr0 & wr15 & 0xf8) ^ (rr0 & wr15 & 0xf8)));
}
return ret;
}
@@ -606,7 +606,7 @@ READ8_MEMBER( z80scc_device::zbus_r )
case z80scc_channel::WR0_Z_SEL_SHFT_RIGHT: ba = offset & 0x10; reg = (offset >> 1) & 0x0f; break; /* Shift Right mode */
default:
logerror("Malformed Z-bus SCC read: offset %02x WR0 bits %02x\n", offset, m_chanB->m_wr0);
- LOG(("Malformed Z-bus SCC read: offset %02x WR0 bits %02x\n", offset, m_chanB->m_wr0));
+ LOG("Malformed Z-bus SCC read: offset %02x WR0 bits %02x\n", offset, m_chanB->m_wr0);
return data;
}
@@ -639,7 +639,7 @@ WRITE8_MEMBER( z80scc_device::zbus_w )
case z80scc_channel::WR0_Z_SEL_SHFT_RIGHT: ba = offset & 0x10; reg = (offset >> 1) & 0x0f; break; /* Shift Right mode */
default:
logerror("Malformed Z-bus SCC write: offset %02x WR0 bits %02x\n", offset, m_chanB->m_wr0);
- LOG(("Malformed Z-bus SCC write: offset %02x WR0 bits %02x\n", offset, m_chanB->m_wr0));
+ LOG("Malformed Z-bus SCC write: offset %02x WR0 bits %02x\n", offset, m_chanB->m_wr0);
}
if (ba == 0)
@@ -666,7 +666,7 @@ READ8_MEMBER( z80scc_device::cd_ab_r )
return 0;
}
- // LOG(("z80scc_device::cd_ba_r ba:%02x cd:%02x\n", ba, cd));
+ // LOG("z80scc_device::cd_ba_r ba:%02x cd:%02x\n", ba, cd);
return cd ? channel->data_read() : channel->control_read();
}
@@ -686,7 +686,7 @@ WRITE8_MEMBER( z80scc_device::cd_ab_w )
return;
}
- LOG((" cd_ab_w %02x => ba:%02x cd:%02x (ofs %d)\n", data, ba, cd, offset&3));
+ LOG(" cd_ab_w %02x => ba:%02x cd:%02x (ofs %d)\n", data, ba, cd, offset&3);
if (cd)
channel->data_write(data);
else
@@ -709,7 +709,7 @@ READ8_MEMBER( z80scc_device::cd_ba_r )
return 0;
}
- // LOG(("z80scc_device::cd_ba_r ba:%02x cd:%02x\n", ba, cd));
+ // LOG("z80scc_device::cd_ba_r ba:%02x cd:%02x\n", ba, cd);
return cd ? channel->control_read() : channel->data_read();
}
@@ -729,7 +729,7 @@ WRITE8_MEMBER( z80scc_device::cd_ba_w )
return;
}
- // LOG(("z80scc_device::cd_ba_w ba:%02x cd:%02x\n", ba, cd));
+ // LOG("z80scc_device::cd_ba_w ba:%02x cd:%02x\n", ba, cd);
if (cd)
channel->control_write(data);
else
@@ -754,7 +754,7 @@ READ8_MEMBER( z80scc_device::ba_cd_r )
return 0;
}
- // LOG(("z80scc_device::ba_cd_r ba:%02x cd:%02x\n", ba, cd));
+ // LOG("z80scc_device::ba_cd_r ba:%02x cd:%02x\n", ba, cd);
return cd ? channel->control_read() : channel->data_read();
}
@@ -776,7 +776,7 @@ WRITE8_MEMBER( z80scc_device::ba_cd_w )
return;
}
- LOG(("z80scc_device::ba_cd_w ba:%02x cd:%02x\n", ba, cd));
+ LOG("z80scc_device::ba_cd_w ba:%02x cd:%02x\n", ba, cd);
if (cd)
channel->control_write(data);
@@ -801,7 +801,7 @@ READ8_MEMBER( z80scc_device::ba_cd_inv_r )
return 0;
}
- // LOG(("z80scc_device::ba_cd_inv_r ba:%02x cd:%02x\n", ba, cd));
+ // LOG("z80scc_device::ba_cd_inv_r ba:%02x cd:%02x\n", ba, cd);
return cd ? channel->data_read() : channel->control_read();
}
@@ -823,7 +823,7 @@ WRITE8_MEMBER( z80scc_device::ba_cd_inv_w )
return;
}
- LOG(("z80scc_device::ba_cd_inv_w ba:%02x cd:%02x\n", ba, cd));
+ LOG("z80scc_device::ba_cd_inv_w ba:%02x cd:%02x\n", ba, cd);
if (cd)
channel->data_write(data);
@@ -863,7 +863,7 @@ z80scc_channel::z80scc_channel(const machine_config &mconfig, const char *tag, d
,m_rcv_mode(RCV_IDLE)
#endif
{
- LOG(("%s\n",FUNCNAME));
+ LOG("%s\n",FUNCNAME);
// Reset all registers
m_rr0 = m_rr1 = m_rr2 = m_rr3 = m_rr4 = m_rr5 = m_rr6 = m_rr7 = m_rr7p = m_rr8
@@ -888,7 +888,7 @@ z80scc_channel::z80scc_channel(const machine_config &mconfig, const char *tag, d
void z80scc_channel::device_start()
{
- LOGSETUP(("%s\n", FUNCNAME));
+ LOGSETUP("%s\n", FUNCNAME);
m_uart = downcast<z80scc_device *>(owner());
m_index = m_uart->get_channel_index(this);
@@ -970,7 +970,7 @@ void z80scc_channel::device_start()
void z80scc_channel::device_reset()
{
- LOGSETUP(("%s\n", FUNCNAME));
+ LOGSETUP("%s\n", FUNCNAME);
// Reset RS232 emulation
receive_register_reset();
@@ -1013,7 +1013,7 @@ void z80scc_channel::device_reset()
void z80scc_channel::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
-// LOG(("%s %d\n", FUNCNAME, id));
+// LOG("%s %d\n", FUNCNAME, id);
#if LOCAL_BRG
switch(id)
@@ -1032,7 +1032,7 @@ void z80scc_channel::device_timer(emu_timer &timer, device_timer_id id, int para
}
else
{
- LOG((" - turning off Baudrate timer\n"));
+ LOG(" - turning off Baudrate timer\n");
timer.adjust(attotime::never, 0, attotime::never);
}
}
@@ -1056,7 +1056,7 @@ void z80scc_channel::tra_callback()
{
if (!(m_wr5 & WR5_TX_ENABLE))
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c transmit mark 1 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c transmit mark 1 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5);
// transmit mark
if (m_index == z80scc_device::CHANNEL_A)
m_uart->m_out_txda_cb(1);
@@ -1065,7 +1065,7 @@ void z80scc_channel::tra_callback()
}
else if (m_wr5 & WR5_SEND_BREAK)
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c send break 1 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c send break 1 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5);
// transmit break
if (m_index == z80scc_device::CHANNEL_A)
m_uart->m_out_txda_cb(0);
@@ -1076,7 +1076,7 @@ void z80scc_channel::tra_callback()
{
int db = transmit_register_get_data_bit();
- LOG((LLFORMAT " %s() \"%s \"Channel %c transmit data bit %d m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, db, m_wr5));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c transmit data bit %d m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, db, m_wr5);
// transmit data
if (m_index == z80scc_device::CHANNEL_A)
m_uart->m_out_txda_cb(db);
@@ -1085,7 +1085,7 @@ void z80scc_channel::tra_callback()
}
else
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c Failed to transmit m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c Failed to transmit m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5);
logerror("%s \"%s \"Channel %c Failed to transmit\n", FUNCNAME, m_owner->tag(), 'A' + m_index);
}
}
@@ -1102,7 +1102,7 @@ void z80scc_channel::tra_complete()
{
m_delayed_tx_brg_change = 0;
set_tra_rate(m_brg_rate);
- LOG(("Delayed Init - Baud Rate Generator: %d mode: %dx\n", m_brg_rate, get_clock_mode() ));
+ LOG("Delayed Init - Baud Rate Generator: %d mode: %dx\n", m_brg_rate, get_clock_mode() );
}
if ((m_wr5 & WR5_TX_ENABLE) && !(m_wr5 & WR5_SEND_BREAK))
@@ -1110,15 +1110,15 @@ void z80scc_channel::tra_complete()
if ( (m_rr0 & RR0_TX_BUFFER_EMPTY) == 0 || // Takes care of the NMOS/CMOS 1 slot TX FIFO
m_tx_fifo_rp != m_tx_fifo_wp) // or there are more characters to send in a longer FIFO.
{
- LOGTX((" %s() %s %c done sending, loading data from fifo:%02x '%c'\n", FUNCNAME, m_owner->tag(), 'A' + m_index,
- m_tx_data_fifo[m_tx_fifo_rp], isascii(m_tx_data_fifo[m_tx_fifo_rp]) ? m_tx_data_fifo[m_tx_fifo_rp] : ' '));
+ LOGTX(" %s() %s %c done sending, loading data from fifo:%02x '%c'\n", FUNCNAME, m_owner->tag(), 'A' + m_index,
+ m_tx_data_fifo[m_tx_fifo_rp], isascii(m_tx_data_fifo[m_tx_fifo_rp]) ? m_tx_data_fifo[m_tx_fifo_rp] : ' ');
transmit_register_setup(m_tx_data_fifo[m_tx_fifo_rp]); // Reload the shift register
m_tx_fifo_rp_step();
m_rr0 |= RR0_TX_BUFFER_EMPTY; // Now here is room in the tx fifo again
}
else
{
- LOGTX((" %s() %s %c done sending, setting all sent bit\n", FUNCNAME, m_owner->tag(), 'A' + m_index));
+ LOGTX(" %s() %s %c done sending, setting all sent bit\n", FUNCNAME, m_owner->tag(), 'A' + m_index);
m_rr1 |= RR1_ALL_SENT;
// when the RTS bit is reset, the _RTS output goes high after the transmitter empties
@@ -1142,7 +1142,7 @@ void z80scc_channel::tra_complete()
}
else if (m_wr5 & WR5_SEND_BREAK)
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c Transmit Break 0 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c Transmit Break 0 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5);
// transmit break
if (m_index == z80scc_device::CHANNEL_A)
m_uart->m_out_txda_cb(0);
@@ -1151,7 +1151,7 @@ void z80scc_channel::tra_complete()
}
else
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c Transmit Mark 1 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c Transmit Mark 1 m_wr5:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_wr5);
// transmit mark
if (m_index == z80scc_device::CHANNEL_A)
m_uart->m_out_txda_cb(1);
@@ -1169,13 +1169,13 @@ void z80scc_channel::rcv_callback()
{
if (m_wr3 & WR3_RX_ENABLE)
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c receive data bit %d m_wr3:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_rxd, m_wr3));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c receive data bit %d m_wr3:%02x\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, m_rxd, m_wr3);
receive_register_update_bit(m_rxd);
}
#if 1
else
{
- LOG((LLFORMAT " %s() \"%s \"Channel %c Received Data Bit but receiver is disabled\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c Received Data Bit but receiver is disabled\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index);
logerror("%s \"%s \"Channel %c Received data dit but receiver is disabled\n", FUNCNAME, m_owner->tag(), 'A' + m_index);
}
#endif
@@ -1192,7 +1192,7 @@ void z80scc_channel::rcv_complete()
receive_register_extract();
data = get_received_char();
- LOG((LLFORMAT " %s() \"%s \"Channel %c Received Data %c\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, data));
+ LOG(LLFORMAT " %s() \"%s \"Channel %c Received Data %c\n", machine().firstcpu->total_cycles(), FUNCNAME, m_owner->tag(), 'A' + m_index, data);
receive_data(data);
#if START_BIT_HUNT
m_rcv_mode = RCV_SEEKING;
@@ -1232,7 +1232,7 @@ TODO:
*/
void z80scc_channel::set_rts(int state)
{
- LOG(("%s(%d) \"%s\": %c \n", FUNCNAME, state, m_owner->tag(), 'A' + m_index));
+ LOG("%s(%d) \"%s\": %c \n", FUNCNAME, state, m_owner->tag(), 'A' + m_index);
if (m_index == z80scc_device::CHANNEL_A)
m_uart->m_out_rtsa_cb(state);
else
@@ -1241,7 +1241,7 @@ void z80scc_channel::set_rts(int state)
void z80scc_channel::update_rts()
{
-// LOG(("%s(%d) \"%s\": %c \n", FUNCNAME, state, m_owner->tag(), 'A' + m_index));
+// LOG("%s(%d) \"%s\": %c \n", FUNCNAME, state, m_owner->tag(), 'A' + m_index);
if (m_wr5 & WR5_RTS)
{
// when the RTS bit is set, the _RTS output goes low
@@ -1322,16 +1322,16 @@ uint8_t z80scc_channel::do_sccreg_rr0()
{
uint8_t rr0 = m_rr0;
- LOG(("%s %c %s <- %02x\n",tag(), 'A' + m_index, FUNCNAME, m_rr0));
+ LOG("%s %c %s <- %02x\n",tag(), 'A' + m_index, FUNCNAME, m_rr0);
if (m_extint_latch == 1)
{
rr0 &= ((~m_wr15) | WR15_WR7PRIME | WR15_STATUS_FIFO); // clear enabled bits, saving 2 unrelated bits
rr0 |= (m_extint_states & ~((~m_wr15) | WR15_WR7PRIME | WR15_STATUS_FIFO)); // set enabled bits to latched states
- LOGINT(("- %c returning latched value RR0:%02x WR15:%02x => %02x\n", 'A' + m_index, m_rr0, m_wr15, rr0));
+ LOGINT("- %c returning latched value RR0:%02x WR15:%02x => %02x\n", 'A' + m_index, m_rr0, m_wr15, rr0);
}
else
{
- LOG(("- %c returning unlatched value: %02x\n", 'A' + m_index, rr0));
+ LOG("- %c returning unlatched value: %02x\n", 'A' + m_index, rr0);
}
return rr0;
@@ -1342,7 +1342,7 @@ uint8_t z80scc_channel::do_sccreg_rr0()
* codes for the I-Field in the SDLC Receive Mode. */
uint8_t z80scc_channel::do_sccreg_rr1()
{
- LOGR(("%s %s <- %02x\n",tag(), FUNCNAME, m_rr1));
+ LOGR("%s %s <- %02x\n",tag(), FUNCNAME, m_rr1);
return m_rr1;
}
@@ -1354,7 +1354,7 @@ on the state of the Status High/Status Low bit in WR9 and independent of the sta
in WR9."*/
uint8_t z80scc_channel::do_sccreg_rr2()
{
- LOGINT(("%s\n", FUNCNAME));
+ LOGINT("%s\n", FUNCNAME);
// Assume the unmodified in polled mode
m_rr2 = m_uart->m_chanA->m_wr2;
@@ -1364,18 +1364,18 @@ uint8_t z80scc_channel::do_sccreg_rr2()
{
int i = 0;
- LOGINT((" - Channel B so we might need to update the vector modification\n"));
+ LOGINT(" - Channel B so we might need to update the vector modification\n");
// loop over all interrupt sources
for (auto & elem : m_uart->m_int_state)
{
// find the first channel with an interrupt requested
if (elem & Z80_DAISY_INT)
{
- LOGINT((" - Checking an INT source %d\n", i));
+ LOGINT(" - Checking an INT source %d\n", i);
m_rr2 = m_uart->modify_vector(m_rr2, i < 3 ? z80scc_device::CHANNEL_A : z80scc_device::CHANNEL_B, m_uart->m_int_source[i] & 3);
if ((m_uart->m_variant & (SET_ESCC | SET_CMOS)) && (m_uart->m_wr9 & WR9_BIT_IACK))
{
- LOGINT((" - Found an INT request to ack while reading RR2\n"));
+ LOGINT(" - Found an INT request to ack while reading RR2\n");
elem = Z80_DAISY_IEO; // Set IUS bit (called IEO in z80 daisy lingo)
m_uart->check_interrupts();
}
@@ -1394,7 +1394,7 @@ B, all 0s are returned. The two unused bits are always returned as 0. Figure dis
*/
uint8_t z80scc_channel::do_sccreg_rr3()
{
- LOGINT(("%s(%02x)\n", FUNCNAME, m_rr3));
+ LOGINT("%s(%02x)\n", FUNCNAME, m_rr3);
return m_rr3; // TODO Update all bits of this status register
}
@@ -1405,7 +1405,7 @@ uint8_t z80scc_channel::do_sccreg_rr3()
a read to this location returns an image of RR0.*/
uint8_t z80scc_channel::do_sccreg_rr4()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (m_uart->m_variant & (SET_ESCC | z80scc_device::TYPE_SCC85C30))
return (BIT(m_wr7, 6) ? m_wr4 : m_rr0);
else
@@ -1418,7 +1418,7 @@ uint8_t z80scc_channel::do_sccreg_rr4()
a read to this register returns an image of RR1.*/
uint8_t z80scc_channel::do_sccreg_rr5()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (m_uart->m_variant & (SET_ESCC | z80scc_device::TYPE_SCC85C30))
return BIT(m_wr7, 6) ? m_wr5 : m_rr1;
else
@@ -1433,10 +1433,10 @@ uint8_t z80scc_channel::do_sccreg_rr5()
On the NMOS version, a read to this register location returns an image of RR2.*/
uint8_t z80scc_channel::do_sccreg_rr6()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (m_wr15 & WR15_STATUS_FIFO)
{
- LOGSYNC((" - Status FIFO for synchronous mode - not implemented\n"));
+ LOGSYNC(" - Status FIFO for synchronous mode - not implemented\n");
logerror(" - Status FIFO for synchronous mode - not implemented\n");
return 0;
}
@@ -1453,7 +1453,7 @@ uint8_t z80scc_channel::do_sccreg_rr6()
RR7, RR6, RR1.*/
uint8_t z80scc_channel::do_sccreg_rr7()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (!(m_uart->m_variant & (SET_NMOS)))
{
logerror(" %s() not implemented feature\n", FUNCNAME);
@@ -1476,7 +1476,7 @@ uint8_t z80scc_channel::do_sccreg_rr8()
of RR13. TODO: Check what is returned if Extended Read option is turned off */
uint8_t z80scc_channel::do_sccreg_rr9()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (m_uart->m_variant & (SET_ESCC | z80scc_device::TYPE_SCC85C30))
return BIT(m_wr7, 6) ? m_wr3 : m_rr13;
else
@@ -1486,7 +1486,7 @@ uint8_t z80scc_channel::do_sccreg_rr9()
/* RR10 contains some SDLC related miscellaneous status bits. Unused bits are always 0. */
uint8_t z80scc_channel::do_sccreg_rr10()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
logerror("%s() not implemented feature\n", FUNCNAME);
return m_rr10;
}
@@ -1497,7 +1497,7 @@ uint8_t z80scc_channel::do_sccreg_rr10()
On the NMOS/CMOS version, a read to this location returns an image of RR15.*/
uint8_t z80scc_channel::do_sccreg_rr11()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (m_uart->m_variant & (SET_ESCC | z80scc_device::TYPE_SCC85C30))
return BIT(m_wr7, 6) ? m_wr10 : m_rr15;
else
@@ -1508,7 +1508,7 @@ uint8_t z80scc_channel::do_sccreg_rr11()
RR12 returns the value stored in WR12, the lower byte of the time constant, for the BRG.*/
uint8_t z80scc_channel::do_sccreg_rr12()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
return m_wr12;
}
@@ -1516,7 +1516,7 @@ uint8_t z80scc_channel::do_sccreg_rr12()
RR13 returns the value stored in WR13, the upper byte of the time constant for the BRG. */
uint8_t z80scc_channel::do_sccreg_rr13()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
return m_wr13;
}
@@ -1526,7 +1526,7 @@ Extended Read option has been enabled. Otherwise, this register returns an image
On the NMOS/CMOS version, a read to this location returns an image of RR10.*/
uint8_t z80scc_channel::do_sccreg_rr14()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
if (m_uart->m_variant & (SET_ESCC | z80scc_device::TYPE_SCC85C30))
return BIT(m_wr7, 6) ? m_wr7 : m_rr10;
else
@@ -1538,7 +1538,7 @@ uint8_t z80scc_channel::do_sccreg_rr14()
always returned as Os. */
uint8_t z80scc_channel::do_sccreg_rr15()
{
- LOGR(("%s\n", FUNCNAME));
+ LOGR("%s\n", FUNCNAME);
return m_wr15 & 0xfa; // Mask out the used bits
}
@@ -1549,7 +1549,7 @@ uint8_t z80scc_channel::do_sccreg_rr15()
uint8_t z80scc_channel::scc_register_read( uint8_t reg)
{
if (reg > 1)
- LOG(("%s %02x\n", FUNCNAME, reg));
+ LOG("%s %02x\n", FUNCNAME, reg);
uint8_t data = 0;
uint8_t wreg = 0;
@@ -1611,19 +1611,19 @@ uint8_t z80scc_channel::control_read()
int reg = m_uart->m_wr0_ptrbits;
int regmask = (WR0_REGISTER_MASK | (m_uart->m_wr0_ptrbits & WR0_POINT_HIGH));
- LOGR(("%s(%02x) reg %02x, regmask %02x, WR0 %02x\n", FUNCNAME, data, reg, regmask, m_wr0));
+ LOGR("%s(%02x) reg %02x, regmask %02x, WR0 %02x\n", FUNCNAME, data, reg, regmask, m_wr0);
m_uart->m_wr0_ptrbits = 0;
reg &= regmask;
if (reg != 0)
{
- LOG(("%s(%02x) reg %02x, regmask %02x, WR0 %02x\n", FUNCNAME, data, reg, regmask, m_wr0));
+ LOG("%s(%02x) reg %02x, regmask %02x, WR0 %02x\n", FUNCNAME, data, reg, regmask, m_wr0);
m_wr0 &= ~regmask; // mask out register index
}
data = scc_register_read(reg);
- //LOG(("%s \"%s\": %c : Register R%d read '%02x'\n", FUNCNAME, m_owner->tag(), 'A' + m_index, reg, data));
+ //LOG("%s \"%s\": %c : Register R%d read '%02x'\n", FUNCNAME, m_owner->tag(), 'A' + m_index, reg, data);
return data;
}
@@ -1646,11 +1646,11 @@ void z80scc_channel::do_sccreg_wr0(uint8_t data)
addressing*/
if (m_uart->m_variant & SET_Z85X3X)
{
- LOG(("%s %s: %c : - Point High command\n", FUNCNAME, m_owner->tag(), 'A' + m_index));
+ LOG("%s %s: %c : - Point High command\n", FUNCNAME, m_owner->tag(), 'A' + m_index);
m_uart->m_wr0_ptrbits |= 8;
}
else
- LOG(("%s %s: %c : - NULL command 2\n", FUNCNAME, m_owner->tag(), 'A' + m_index));
+ LOG("%s %s: %c : - NULL command 2\n", FUNCNAME, m_owner->tag(), 'A' + m_index);
break;
case WR0_RESET_EXT_STATUS:
/*After an External/Status interrupt (a change on a modem line or a break condition,
@@ -1665,8 +1665,8 @@ void z80scc_channel::do_sccreg_wr0(uint8_t data)
(there are two transitions), another interrupt is not generated. Exceptions to this
rule are detailed in the RR0 description.*/
- LOGCMD(("%s %c - Reset External/Status Interrupt, latch %s\n", m_owner->tag(), 'A' + m_index,
- m_extint_latch == 1? "is released" : "was already released"));
+ LOGCMD("%s %c - Reset External/Status Interrupt, latch %s\n", m_owner->tag(), 'A' + m_index,
+ m_extint_latch == 1? "is released" : "was already released");
// Release latch if no other external or status sources are active
if ((m_extint_latch = m_uart->update_extint(m_index)) == 0)
m_uart->check_interrupts();
@@ -1679,18 +1679,18 @@ void z80scc_channel::do_sccreg_wr0(uint8_t data)
if (m_uart->m_variant & (SET_NMOS))
{
logerror("WR0 SWI ack command not supported on NMOS\n");
- LOGCMD(("%s: %c : WR0_RESET_HIGHEST_IUS command not available on NMOS!\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : WR0_RESET_HIGHEST_IUS command not available on NMOS!\n", m_owner->tag(), 'A' + m_index);
}
else
{
- LOGCMD(("%s: %c : Reset Highest IUS\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : Reset Highest IUS\n", m_owner->tag(), 'A' + m_index);
// loop over all interrupt sources
for (auto & elem : m_uart->m_int_state)
{
// find the first channel with an interrupt requested
if (elem & Z80_DAISY_INT)
{
- LOGCMD(("- %c found IUS bit to clear\n", 'A' + m_index));
+ LOGCMD("- %c found IUS bit to clear\n", 'A' + m_index);
elem = 0; // Clear IUS bit (called IEO in z80 daisy lingo)
m_uart->check_interrupts();
break;
@@ -1704,21 +1704,21 @@ void z80scc_channel::do_sccreg_wr0(uint8_t data)
data with the special condition is held in the Receive FIFO until this command is issued. If either
of these modes is selected and this command is issued before the data has been read from the
Receive FIFO, the data is lost */
- LOGCMD(("%s: %c : WR0_ERROR_RESET - not implemented\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : WR0_ERROR_RESET - not implemented\n", m_owner->tag(), 'A' + m_index);
m_rx_fifo_rp_step(); // Reset error state in fifo and unlock it. unlock == step to next slot in fifo.
break;
case WR0_SEND_ABORT: // Flush transmitter and Send 8-13 bits of '1's, used with SDLC
- LOGCMD(("%s: %c : WR0_SEND_ABORT - not implemented\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : WR0_SEND_ABORT - not implemented\n", m_owner->tag(), 'A' + m_index);
break;
case WR0_NULL: // Do nothing
- LOGCMD(("%s: %c : WR0_NULL\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : WR0_NULL\n", m_owner->tag(), 'A' + m_index);
break;
case WR0_ENABLE_INT_NEXT_RX: // enable interrupt on next receive character
- LOGCMD(("%s: %c : WR0_ENABLE_INT_NEXT\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : WR0_ENABLE_INT_NEXT\n", m_owner->tag(), 'A' + m_index);
m_rx_first = 1;
break;
case WR0_RESET_TX_INT: // reset transmitter interrupt pending
- LOGCMD(("%s: %c : WR0_RESET_TX_INT - not implemented\n", m_owner->tag(), 'A' + m_index));
+ LOGCMD("%s: %c : WR0_RESET_TX_INT - not implemented\n", m_owner->tag(), 'A' + m_index);
break;
default:
break;
@@ -1728,16 +1728,16 @@ void z80scc_channel::do_sccreg_wr0(uint8_t data)
switch (data & WR0_CRC_RESET_CODE_MASK)
{
case WR0_CRC_RESET_NULL:
- LOGCMD((" CRC_RESET_NULL\n"));
+ LOGCMD(" CRC_RESET_NULL\n");
break;
case WR0_CRC_RESET_RX: /* In Synchronous mode: all Os (zeros) (CCITT-O CRC-16) */
- LOGCMD((" CRC_RESET_RX - not implemented\n"));
+ LOGCMD(" CRC_RESET_RX - not implemented\n");
break;
case WR0_CRC_RESET_TX: /* In HDLC mode: all 1s (ones) (CCITT-1) */
- LOGCMD((" CRC_RESET_TX - not implemented\n"));
+ LOGCMD(" CRC_RESET_TX - not implemented\n");
break;
case WR0_CRC_RESET_TX_UNDERRUN: /* Resets Tx underrun/EOM bit (D6 of the RRO register) */
- LOGCMD((" CRC_RESET_TX_UNDERRUN - not implemented\n"));
+ LOGCMD(" CRC_RESET_TX_UNDERRUN - not implemented\n");
break;
default: /* Will not happen unless someone messes with the mask */
logerror(" Wrong CRC reset/init command:%02x\n", data & WR0_CRC_RESET_CODE_MASK);
@@ -1753,38 +1753,38 @@ void z80scc_channel::do_sccreg_wr0(uint8_t data)
/* Write Register 1 is the control register for the various SCC interrupt and Wait/Request modes.*/
void z80scc_channel::do_sccreg_wr1(uint8_t data)
{
- LOG(("%s(%02x) \"%s\": %c : %s - %02x\n", FUNCNAME, data, m_owner->tag(), 'A' + m_index, FUNCNAME, data));
+ LOG("%s(%02x) \"%s\": %c : %s - %02x\n", FUNCNAME, data, m_owner->tag(), 'A' + m_index, FUNCNAME, data);
/* TODO: Sort out SCC specific behaviours from legacy SIO behaviours:
- Channel B only bits vs
- Parity Is Special Condition, bit2 */
m_wr1 = data;
- LOG(("- External Interrupt Enable %u\n", (data & WR1_EXT_INT_ENABLE) ? 1 : 0));
- LOG(("- Transmit Interrupt Enable %u\n", (data & WR1_TX_INT_ENABLE) ? 1 : 0));
- LOG(("- Parity is special condition %u\n", (data & WR1_PARITY_IS_SPEC_COND) ? 1 : 0));
- LOG(("- Wait/Ready Enable %u\n", (data & WR1_WRDY_ENABLE) ? 1 : 0));
- LOG(("- Wait/Ready Function %s\n", (data & WR1_WRDY_FUNCTION) ? "Ready" : "Wait"));
- LOG(("- Wait/Ready on %s\n", (data & WR1_WRDY_ON_RX_TX) ? "Receive" : "Transmit"));
+ LOG("- External Interrupt Enable %u\n", (data & WR1_EXT_INT_ENABLE) ? 1 : 0);
+ LOG("- Transmit Interrupt Enable %u\n", (data & WR1_TX_INT_ENABLE) ? 1 : 0);
+ LOG("- Parity is special condition %u\n", (data & WR1_PARITY_IS_SPEC_COND) ? 1 : 0);
+ LOG("- Wait/Ready Enable %u\n", (data & WR1_WRDY_ENABLE) ? 1 : 0);
+ LOG("- Wait/Ready Function %s\n", (data & WR1_WRDY_FUNCTION) ? "Ready" : "Wait");
+ LOG("- Wait/Ready on %s\n", (data & WR1_WRDY_ON_RX_TX) ? "Receive" : "Transmit");
switch (data & WR1_RX_INT_MODE_MASK)
{
case WR1_RX_INT_DISABLE:
- LOG(("- Receiver Interrupt Disabled\n"));
+ LOG("- Receiver Interrupt Disabled\n");
break;
case WR1_RX_INT_FIRST:
- LOG(("- Receiver Interrupt on First Character or Special Conditions\n"));
+ LOG("- Receiver Interrupt on First Character or Special Conditions\n");
break;
case WR1_RX_INT_ALL:
- LOG(("- Receiver Interrupt on All Characters or Special Conditions\n"));
+ LOG("- Receiver Interrupt on All Characters or Special Conditions\n");
break;
case WR1_RX_INT_PARITY:
- LOG(("- Receiver Interrupt on Special Conditions only\n"));
+ LOG("- Receiver Interrupt on Special Conditions only\n");
break;
}
if ((data & WR1_RX_INT_MODE_MASK) == WR1_PARITY_IS_SPEC_COND)
- LOG(("- Parity error is a Special Condition\n"));
+ LOG("- Parity error is a Special Condition\n");
m_uart->check_interrupts();
}
@@ -1793,7 +1793,7 @@ void z80scc_channel::do_sccreg_wr1(uint8_t data)
is controlled by the Vector Includes Status (VIS) and the Status High/Status Low bits in WR9.*/
void z80scc_channel::do_sccreg_wr2(uint8_t data)
{
- LOG(("%s(%02x) Setting the interrupt vector\n", FUNCNAME, data));
+ LOG("%s(%02x) Setting the interrupt vector\n", FUNCNAME, data);
m_wr2 = data;
m_uart->m_chanA->m_rr2 = data;
m_uart->m_chanB->m_rr2 = data; /* TODO: Sort out the setting of ChanB depending on bits in WR9 */
@@ -1810,15 +1810,15 @@ void z80scc_channel::do_sccreg_wr2(uint8_t data)
the Sync/Hunt bit is set again is by the Enter Hunt Mode command or by disabling the receiver.*/
void z80scc_channel::do_sccreg_wr3(uint8_t data)
{
- LOG(("%s(%02x) Setting up the receiver\n", FUNCNAME, data));
+ LOG("%s(%02x) Setting up the receiver\n", FUNCNAME, data);
m_wr3 = data;
- LOG(("- Receiver Enable: %u\n", (data & WR3_RX_ENABLE) ? 1 : 0));
- LOG(("- Sync Char Load Inhibit %u\n", (data & WR3_SYNC_CHAR_LOAD_INHIBIT) ? 1 : 0));
- LOG(("- Address Search Mode %u\n", (data & WR3_ADDRESS_SEARCH_MODE) ? 1 : 0));
- LOG(("- Rx CRC Enable %u\n", (data & WR3_RX_CRC_ENABLE) ? 1 : 0));
- LOG(("- Enter Hunt Mode %u\n", (data & WR3_ENTER_HUNT_MODE) ? 1 : 0));
- LOG(("- Auto Enables %u\n", (data & WR3_AUTO_ENABLES) ? 1 : 0));
- LOG(("- Receiver Bits/Character %u\n", get_rx_word_length()));
+ LOG("- Receiver Enable: %u\n", (data & WR3_RX_ENABLE) ? 1 : 0);
+ LOG("- Sync Char Load Inhibit %u\n", (data & WR3_SYNC_CHAR_LOAD_INHIBIT) ? 1 : 0);
+ LOG("- Address Search Mode %u\n", (data & WR3_ADDRESS_SEARCH_MODE) ? 1 : 0);
+ LOG("- Rx CRC Enable %u\n", (data & WR3_RX_CRC_ENABLE) ? 1 : 0);
+ LOG("- Enter Hunt Mode %u\n", (data & WR3_ENTER_HUNT_MODE) ? 1 : 0);
+ LOG("- Auto Enables %u\n", (data & WR3_AUTO_ENABLES) ? 1 : 0);
+ LOG("- Receiver Bits/Character %u\n", get_rx_word_length());
if ((m_wr3 & WR3_ENTER_HUNT_MODE) || ((m_wr3 & WR3_RX_ENABLE) == 0))
{
@@ -1830,7 +1830,7 @@ void z80scc_channel::do_sccreg_wr3(uint8_t data)
void z80scc_channel::do_sccreg_wr4(uint8_t data)
{
- LOG(("%s(%02x) Setting up asynchronous frame format and clock\n", FUNCNAME, data));
+ LOG("%s(%02x) Setting up asynchronous frame format and clock\n", FUNCNAME, data);
if (data == m_wr4)
{
logerror("- suppressing reinit of Tx as write to wr4 is identical to previous value\n");
@@ -1838,14 +1838,14 @@ void z80scc_channel::do_sccreg_wr4(uint8_t data)
else
{
m_wr4 = data;
- LOG(("- Parity : %s\n", (data & WR4_PARITY_ENABLE) ? ((data & WR4_PARITY_EVEN) ? "Even" : "Odd") : "None"));
- LOG(("- Stop Bits : %s\n", data & WR4_STOP_BITS_MASK ? stop_bits_tostring(get_stop_bits()) : "not used, sync modes enabled" ));
- LOG(("- Sync Mode : %s\n", !(data & WR4_STOP_BITS_MASK) ?
+ LOG("- Parity : %s\n", (data & WR4_PARITY_ENABLE) ? ((data & WR4_PARITY_EVEN) ? "Even" : "Odd") : "None");
+ LOG("- Stop Bits : %s\n", data & WR4_STOP_BITS_MASK ? stop_bits_tostring(get_stop_bits()) : "not used, sync modes enabled" );
+ LOG("- Sync Mode : %s\n", !(data & WR4_STOP_BITS_MASK) ?
(data & WR4_BIT5 ?
(data & WR4_BIT4 ? "External Sync Mode - /SYNC is used as input!" : "SDLC - not implemented")
: (data & WR4_BIT4 ? "16 bit" : "8 bit"))
- : "Disabled"));
- LOG(("- Clock Mode: %uX\n", get_clock_mode()));
+ : "Disabled");
+ LOG("- Clock Mode: %uX\n", get_clock_mode());
update_serial();
safe_transmit_register_reset();
receive_register_reset();
@@ -1854,7 +1854,7 @@ void z80scc_channel::do_sccreg_wr4(uint8_t data)
void z80scc_channel::do_sccreg_wr5(uint8_t data)
{
- LOG(("%s(%02x) Setting up the transmitter\n", FUNCNAME, data));
+ LOG("%s(%02x) Setting up the transmitter\n", FUNCNAME, data);
if (data == m_wr5)
{
logerror("- suppressing reinit of Tx as write to wr5 is identical to previous value\n");
@@ -1862,11 +1862,11 @@ void z80scc_channel::do_sccreg_wr5(uint8_t data)
else
{
m_wr5 = data;
- LOG(("- Transmitter Enable %u\n", (data & WR5_TX_ENABLE) ? 1 : 0));
- LOG(("- Transmitter Bits/Character %u\n", get_tx_word_length()));
- LOG(("- Send Break %u\n", (data & WR5_SEND_BREAK) ? 1 : 0));
- LOG(("- Request to Send %u\n", (data & WR5_RTS) ? 1 : 0));
- LOG(("- Data Terminal Ready %u\n", (data & WR5_DTR) ? 1 : 0));
+ LOG("- Transmitter Enable %u\n", (data & WR5_TX_ENABLE) ? 1 : 0);
+ LOG("- Transmitter Bits/Character %u\n", get_tx_word_length());
+ LOG("- Send Break %u\n", (data & WR5_SEND_BREAK) ? 1 : 0);
+ LOG("- Request to Send %u\n", (data & WR5_RTS) ? 1 : 0);
+ LOG("- Data Terminal Ready %u\n", (data & WR5_DTR) ? 1 : 0);
update_serial();
safe_transmit_register_reset();
update_rts(); // Will also update DTR accordingly
@@ -1875,20 +1875,20 @@ void z80scc_channel::do_sccreg_wr5(uint8_t data)
void z80scc_channel::do_sccreg_wr6(uint8_t data)
{
- LOG(("%s(%02x) Transmit sync\n", FUNCNAME, data));
+ LOG("%s(%02x) Transmit sync\n", FUNCNAME, data);
m_sync_pattern = (m_sync_pattern & 0xff00) | data;
}
void z80scc_channel::do_sccreg_wr7(uint8_t data)
{
- LOG(("%s(%02x) Receive sync\n", FUNCNAME, data));
+ LOG("%s(%02x) Receive sync\n", FUNCNAME, data);
m_sync_pattern = (data << 8) | (m_sync_pattern & 0xff);
}
/* WR8 is the transmit buffer register */
void z80scc_channel::do_sccreg_wr8(uint8_t data)
{
- LOG(("%s(%02x) \"%s\": %c : Transmit Buffer write %02x\n", FUNCNAME, data, m_owner->tag(), 'A' + m_index, data));
+ LOG("%s(%02x) \"%s\": %c : Transmit Buffer write %02x\n", FUNCNAME, data, m_owner->tag(), 'A' + m_index, data);
data_write(data);
}
@@ -1903,18 +1903,18 @@ void z80scc_channel::do_sccreg_wr9(uint8_t data)
switch (data & WR9_CMD_MASK)
{
case WR9_CMD_NORESET:
- LOG(("\"%s\": %c : Master Interrupt Control - No reset %02x\n", m_owner->tag(), 'A' + m_index, data));
+ LOG("\"%s\": %c : Master Interrupt Control - No reset %02x\n", m_owner->tag(), 'A' + m_index, data);
break;
case WR9_CMD_CHNB_RESET:
- LOGINT(("\"%s\": %c : Master Interrupt Control - Channel B reset %02x\n", m_owner->tag(), 'A' + m_index, data));
+ LOGINT("\"%s\": %c : Master Interrupt Control - Channel B reset %02x\n", m_owner->tag(), 'A' + m_index, data);
m_uart->m_chanB->reset();
break;
case WR9_CMD_CHNA_RESET:
- LOGINT(("\"%s\": %c : Master Interrupt Control - Channel A reset %02x\n", m_owner->tag(), 'A' + m_index, data));
+ LOGINT("\"%s\": %c : Master Interrupt Control - Channel A reset %02x\n", m_owner->tag(), 'A' + m_index, data);
m_uart->m_chanA->reset();
break;
case WR9_CMD_HW_RESET:
- LOGINT(("\"%s\": %c : Master Interrupt Control - Device reset %02x\n", m_owner->tag(), 'A' + m_index, data));
+ LOGINT("\"%s\": %c : Master Interrupt Control - Device reset %02x\n", m_owner->tag(), 'A' + m_index, data);
/*"The effects of this command are identical to those of a hardware reset, except that the Shift Right/Shift Left bit is
not changed and the MIE, Status High/Status Low and DLC bits take the programmed values that accompany this command."
*/
@@ -1944,16 +1944,16 @@ void z80scc_channel::do_sccreg_wr9(uint8_t data)
void z80scc_channel::do_sccreg_wr10(uint8_t data)
{
m_wr10 = data;
- LOG(("\"%s\": %c : %s Misc Tx/Rx Control %02x - not implemented \n", m_owner->tag(), 'A' + m_index, FUNCNAME, data));
- LOG(("- 6/8 bit sync %d\n", data & WR10_8_6_BIT_SYNC ? 1 : 0));
- LOG(("- Loop Mode %d\n", data & WR10_LOOP_MODE ? 1 : 0));
- LOG(("- Abort/Flag on underrun %d\n", data & WR10_ABORT_FLAG_UNDERRUN ? 1 : 0));
- LOG(("- Mark/Flag Idle line %d\n", data & WR10_MARK_FLAG_IDLE ? 1 : 0));
- LOG(("- Go active on poll %d\n", data & WR10_GO_ACTIVE_ON_POLL ? 1 : 0));
- LOG(("- Encoding %s\n", data & WR10_BIT6 ?
+ LOG("\"%s\": %c : %s Misc Tx/Rx Control %02x - not implemented \n", m_owner->tag(), 'A' + m_index, FUNCNAME, data);
+ LOG("- 6/8 bit sync %d\n", data & WR10_8_6_BIT_SYNC ? 1 : 0);
+ LOG("- Loop Mode %d\n", data & WR10_LOOP_MODE ? 1 : 0);
+ LOG("- Abort/Flag on underrun %d\n", data & WR10_ABORT_FLAG_UNDERRUN ? 1 : 0);
+ LOG("- Mark/Flag Idle line %d\n", data & WR10_MARK_FLAG_IDLE ? 1 : 0);
+ LOG("- Go active on poll %d\n", data & WR10_GO_ACTIVE_ON_POLL ? 1 : 0);
+ LOG("- Encoding %s\n", data & WR10_BIT6 ?
(data & WR10_BIT5 ? "FM0" : "FM1") :
- (data & WR10_BIT5 ? "NRZI" : "NRZ") ));
- LOG(("- CRC Preset %d\n", data & WR10_CRC_PRESET ? 1 : 0));
+ (data & WR10_BIT5 ? "NRZI" : "NRZ"));
+ LOG("- CRC Preset %d\n", data & WR10_CRC_PRESET ? 1 : 0);
}
/* WR11 is the Clock Mode Control register. The bits in this register control the sources of both the
@@ -1961,7 +1961,7 @@ receive and transmit clocks, the type of signal on the /SYNC and /RTxC pins, and
the /TRxC pin.*/
void z80scc_channel::do_sccreg_wr11(uint8_t data)
{
- LOG(("\"%s\": %c : %s Clock Mode Control %02x\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data));
+ LOG("\"%s\": %c : %s Clock Mode Control %02x\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data);
m_wr11 = data;
/*Bit 7: This bit controls the type of input signal the SCC expects to see on the /RTxC pin. If this bit is set
to 0, the SCC expects a TTL-compatible signal as an input to this pin. If this bit is set to 1, the SCC
@@ -1971,19 +1971,19 @@ void z80scc_channel::do_sccreg_wr11(uint8_t data)
/SYNC pin is unavailable for other use. The /SYNC signal is forced to zero internally. A hardware
reset forces /NO XTAL. (At least 20 ms should be allowed after this bit is set to allow the oscillator
to stabilize.)*/
- LOG((" Clock type %s\n", data & WR11_RCVCLK_TYPE ? "Crystal oscillator between RTxC and /SYNC pins" : "TTL level on RTxC pin and /SYNC can be used"));
+ LOG(" Clock type %s\n", data & WR11_RCVCLK_TYPE ? "Crystal oscillator between RTxC and /SYNC pins" : "TTL level on RTxC pin and /SYNC can be used");
/*Bits 6 and 5: Receiver Clock select bits 1 and 0
These bits determine the source of the receive clock as listed below. They do not
interfere with any of the modes of operation in the SCC, but simply control a multiplexer just
before the internal receive clock input. A hardware reset forces the receive clock to come from the
/RTxC pin.*/
- LOG((" Receive clock source is: "));
+ LOG(" Receive clock source is: ");
switch (data & WR11_RCVCLK_SRC_MASK)
{
- case WR11_RCVCLK_SRC_RTXC: LOG(("RTxC - not implemented\n")); break;
- case WR11_RCVCLK_SRC_TRXC: LOG(("TRxC - not implemented\n")); break;
- case WR11_RCVCLK_SRC_BR: LOG(("Baudrate Generator\n")); break;
- case WR11_RCVCLK_SRC_DPLL: LOG(("DPLL - not implemented\n")); break;
+ case WR11_RCVCLK_SRC_RTXC: LOG("RTxC - not implemented\n"); break;
+ case WR11_RCVCLK_SRC_TRXC: LOG("TRxC - not implemented\n"); break;
+ case WR11_RCVCLK_SRC_BR: LOG("Baudrate Generator\n"); break;
+ case WR11_RCVCLK_SRC_DPLL: LOG("DPLL - not implemented\n"); break;
default: logerror("Wrong!\n");/* Will not happen unless someone messes with the mask */
}
/*Bits 4 and 3: Transmit Clock select bits 1 and 0.
@@ -1993,13 +1993,13 @@ void z80scc_channel::do_sccreg_wr11(uint8_t data)
degrees the output of the DPLL used by the receiver. This makes the received and transmitted bit
cells occur simultaneously, neglecting delays. A hardware reset selects the /TRxC pin as the
source of the transmit clocks.*/
- LOG((" Transmit clock source is: "));
+ LOG(" Transmit clock source is: ");
switch (data & WR11_TRACLK_SRC_MASK)
{
- case WR11_TRACLK_SRC_RTXC: LOG(("RTxC - not implemented\n")); break;
- case WR11_TRACLK_SRC_TRXC: LOG(("TRxC - not implemented\n")); break;
- case WR11_TRACLK_SRC_BR: LOG(("Baudrate Generator\n")); break;
- case WR11_TRACLK_SRC_DPLL: LOG(("DPLL - not implemented\n")); break;
+ case WR11_TRACLK_SRC_RTXC: LOG("RTxC - not implemented\n"); break;
+ case WR11_TRACLK_SRC_TRXC: LOG("TRxC - not implemented\n"); break;
+ case WR11_TRACLK_SRC_BR: LOG("Baudrate Generator\n"); break;
+ case WR11_TRACLK_SRC_DPLL: LOG("DPLL - not implemented\n"); break;
default: logerror("Wrong!\n");/* Will not happen unless someone messes with the mask */
}
/* Bit 2: TRxC Pin I/O control bit
@@ -2008,7 +2008,7 @@ void z80scc_channel::do_sccreg_wr11(uint8_t data)
transmit clock is programmed to come from the /TRxC pin, /TRxC is an input, regardless of the
state of this bit. The /TRxC pin is also an input if this bit is set to 0. A hardware reset forces this bit
to 0.*/
- LOG((" TRxC pin is %s\n", data & WR11_TRXC_DIRECTION ? "Output" : "Input"));
+ LOG(" TRxC pin is %s\n", data & WR11_TRXC_DIRECTION ? "Output" : "Input");
/*Bits 1 and 0: /TRxC Output Source select bits 1 and 0
These bits determine the signal to be echoed out of the SCC via the /TRxC pin as listed in Table
on page 167. No signal is produced if /TRxC has been programmed as the source of either the
@@ -2018,13 +2018,13 @@ void z80scc_channel::do_sccreg_wr11(uint8_t data)
Hardware reset selects the XTAL oscillator as the output source*/
if (data & WR11_TRXC_DIRECTION)
{
- LOG((" TRxC pin output is: "));
+ LOG(" TRxC pin output is: ");
switch (data & WR11_TRXSRC_SRC_MASK)
{
- case WR11_TRXSRC_SRC_XTAL: LOG(("the Oscillator - not implemented\n")); break;
- case WR11_TRXSRC_SRC_TRA: LOG(("Transmit clock - not_implemented\n")); break;
- case WR11_TRXSRC_SRC_BR: LOG(("Baudrate Generator\n")); break;
- case WR11_TRXSRC_SRC_DPLL: LOG(("DPLL - not implemented\n")); break;
+ case WR11_TRXSRC_SRC_XTAL: LOG("the Oscillator - not implemented\n"); break;
+ case WR11_TRXSRC_SRC_TRA: LOG("Transmit clock - not_implemented\n"); break;
+ case WR11_TRXSRC_SRC_BR: LOG("Baudrate Generator\n"); break;
+ case WR11_TRXSRC_SRC_DPLL: LOG("DPLL - not implemented\n"); break;
default: logerror("Wrong!\n");/* Will not happen unless someone messes with the mask */
}
}
@@ -2049,7 +2049,7 @@ void z80scc_channel::do_sccreg_wr12(uint8_t data)
{
m_wr12 = data;
update_serial();
- LOG(("\"%s\": %c : %s %02x Low byte of Time Constant for Baudrate generator\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data));
+ LOG("\"%s\": %c : %s %02x Low byte of Time Constant for Baudrate generator\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data);
}
/* WR13 contains the upper byte of the time constant for the baud rate generator. */
@@ -2057,7 +2057,7 @@ void z80scc_channel::do_sccreg_wr13(uint8_t data)
{
m_wr13 = data;
update_serial();
- LOG(("\"%s\": %c : %s %02x High byte of Time Constant for Baudrate generator\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data));
+ LOG("\"%s\": %c : %s %02x High byte of Time Constant for Baudrate generator\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data);
}
/*
@@ -2067,7 +2067,7 @@ void z80scc_channel::do_sccreg_wr14(uint8_t data)
switch (data & WR14_DPLL_CMD_MASK)
{
case WR14_CMD_NULL:
- LOG(("\"%s\": %c : %s Misc Control Bits Null Command %02x\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data));
+ LOG("\"%s\": %c : %s Misc Control Bits Null Command %02x\n", m_owner->tag(), 'A' + m_index, FUNCNAME, data);
break;
case WR14_CMD_ESM:
/* Issuing this command causes the DPLL to enter the Search mode, where the DPLL searches for a locking edge in the
@@ -2089,44 +2089,44 @@ void z80scc_channel::do_sccreg_wr14(uint8_t data)
see an edge during the expected window, the one clock missing bit in RR10 is set. If the DPLL does not see an edge
after two successive attempts, the two clocks missing bits in RR10 are set and the DPLL automatically enters the
Search mode. This command resets both clocks missing latches.*/
- LOG(("\"%s\": %c : %s Misc Control Bits Enter Search Mode Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Misc Control Bits Enter Search Mode Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
case WR14_CMD_RMC:
/* Issuing this command disables the DPLL, resets the clock missing latches in RR10, and forces a continuous Search mode state */
- LOG(("\"%s\": %c : %s Misc Control Bits Reset Missing Clocks Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Misc Control Bits Reset Missing Clocks Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
case WR14_CMD_DISABLE_DPLL:
/* Issuing this command disables the DPLL, resets the clock missing latches in RR10, and forces a continuous Search mode state.*/
- LOG(("\"%s\": %c : %s Misc Control Bits Disable DPLL Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Misc Control Bits Disable DPLL Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
case WR14_CMD_SS_BRG:
/* Issuing this command forces the clock for the DPLL to come from the output of the BRG. */
- LOG(("\"%s\": %c : %s Misc Control Bits Baudrate Generator Input DPLL Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Misc Control Bits Baudrate Generator Input DPLL Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
case WR14_CMD_SS_RTXC:
/* Issuing the command forces the clock for the DPLL to come from the /RTxC pin or the crystal oscillator, depending on
the state of the XTAL/no XTAL bit in WR11. This mode is selected by a channel or hardware reset*/
- LOG(("\"%s\": %c : %s Misc Control Bits RTxC Input DPLL Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Misc Control Bits RTxC Input DPLL Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
case WR14_CMD_SET_FM:
/* This command forces the DPLL to operate in the FM mode and is used to recover the clock from FM or Manchester-Encoded
data. (Manchester is decoded by placing the receiver in NRZ mode while the DPLL is in FM mode.)*/
- LOG(("\"%s\": %c : %s Misc Control Bits Set FM Mode Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Misc Control Bits Set FM Mode Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
case WR14_CMD_SET_NRZI:
/* Issuing this command forces the DPLL to operate in the NRZI mode. This mode is also selected by a hardware or channel reset.*/
- LOG(("\"%s\": %c : %s Mics Control Bits Set NRZI Mode Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Mics Control Bits Set NRZI Mode Command - not implemented\n", m_owner->tag(), 'A' + m_index, FUNCNAME);
break;
default:
logerror("\"%s\": %c : %s Mics Control Bits command %02x - not implemented \n", m_owner->tag(), 'A' + m_index, FUNCNAME, data);
}
/* Based on baudrate code from 8530scc.cpp */
- if ( !(m_wr14 & WR14_BRG_ENABLE) && (data & WR14_BRG_ENABLE) ) // baud rate generator beeing enabled?
+ if ( !(m_wr14 & WR14_BRG_ENABLE) && (data & WR14_BRG_ENABLE) ) // baud rate generator being enabled?
{
- LOG(("\"%s\": %c : %s Mics Control Bits Baudrate generator enabled with ", m_owner->tag(), 'A' + m_index, FUNCNAME));
+ LOG("\"%s\": %c : %s Mics Control Bits Baudrate generator enabled with ", m_owner->tag(), 'A' + m_index, FUNCNAME);
if (data & WR14_BRG_SOURCE) // Do we use the PCLK as baudrate source
{
- LOG((" - PCLK as source\n"));
+ LOG(" - PCLK as source\n");
#if LOCAL_BRG
baudtimer->adjust(attotime::from_hz(rate), TIMER_ID_BAUD, attotime::from_hz(rate)); // Start the baudrate generator
@@ -2137,10 +2137,10 @@ void z80scc_channel::do_sccreg_wr14(uint8_t data)
}
else
{
- LOG(("external clock source\n"));
+ LOG("external clock source\n");
}
}
- else if ( (m_wr14 & WR14_BRG_ENABLE) && !(data & WR14_BRG_ENABLE) ) // baud rate generator beeing disabled?
+ else if ( (m_wr14 & WR14_BRG_ENABLE) && !(data & WR14_BRG_ENABLE) ) // baud rate generator being disabled?
{
#if LOCAL_BRG
baudtimer->adjust(attotime::never, TIMER_ID_BAUD, attotime::never); // Stop the baudrate generator
@@ -2160,16 +2160,16 @@ void z80scc_channel::do_sccreg_wr14(uint8_t data)
#define WR15NO "not implemented"
void z80scc_channel::do_sccreg_wr15(uint8_t data)
{
- LOG(("%s(%02x) \"%s\": %c : External/Status Control Bits\n",
- FUNCNAME, data, m_owner->tag(), 'A' + m_index));
- LOG(("WR7 prime ints : %s\n", data & WR15_WR7PRIME ? WR15NO : "disabled"));
- LOG(("Zero count ints : %s\n", data & WR15_ZEROCOUNT ? WR15NO : "disabled"));
- LOG(("14 bit Status FIFO : %s\n", data & WR15_STATUS_FIFO ? WR15NO : "disabled"));
- LOG(("DCD ints : %s\n", data & WR15_DCD ? WR15EN : "disabled"));
- LOG(("SYNC/Hunt ints : %s\n", data & WR15_SYNC ? WR15NO : "disabled"));
- LOG(("CTS ints : %s\n", data & WR15_CTS ? WR15EN : "disabled"));
- LOG(("Tx underr./EOM ints: %s\n", data & WR15_TX_EOM ? WR15NO : "disabled"));
- LOG(("Break/Abort ints : %s\n", data & WR15_BREAK_ABORT ? WR15NO : "disabled"));
+ LOG("%s(%02x) \"%s\": %c : External/Status Control Bits\n",
+ FUNCNAME, data, m_owner->tag(), 'A' + m_index);
+ LOG("WR7 prime ints : %s\n", data & WR15_WR7PRIME ? WR15NO : "disabled");
+ LOG("Zero count ints : %s\n", data & WR15_ZEROCOUNT ? WR15NO : "disabled");
+ LOG("14 bit Status FIFO : %s\n", data & WR15_STATUS_FIFO ? WR15NO : "disabled");
+ LOG("DCD ints : %s\n", data & WR15_DCD ? WR15EN : "disabled");
+ LOG("SYNC/Hunt ints : %s\n", data & WR15_SYNC ? WR15NO : "disabled");
+ LOG("CTS ints : %s\n", data & WR15_CTS ? WR15EN : "disabled");
+ LOG("Tx underr./EOM ints: %s\n", data & WR15_TX_EOM ? WR15NO : "disabled");
+ LOG("Break/Abort ints : %s\n", data & WR15_BREAK_ABORT ? WR15NO : "disabled");
m_wr15 = data;
}
@@ -2234,8 +2234,8 @@ void z80scc_channel::control_write(uint8_t data)
m_wr0 &= ~regmask;
}
- //LOG(("\n%s(%02x) reg %02x, regmask %02x\n", FUNCNAME, data, reg, regmask));
- LOGSETUP((" * %s %c Reg %02x <- %02x \n", m_owner->tag(), 'A' + m_index, reg, data));
+ //LOG("\n%s(%02x) reg %02x, regmask %02x\n", FUNCNAME, data, reg, regmask);
+ LOGSETUP(" * %s %c Reg %02x <- %02x \n", m_owner->tag(), 'A' + m_index, reg, data);
scc_register_write(reg, data);
}
@@ -2249,7 +2249,7 @@ uint8_t z80scc_channel::data_read()
{
uint8_t data = 0;
- LOG(("%s \"%s\": %c : Data Register Read: ", FUNCNAME, m_owner->tag(), 'A' + m_index));
+ LOG("%s \"%s\": %c : Data Register Read: ", FUNCNAME, m_owner->tag(), 'A' + m_index);
if (m_rx_fifo_wp != m_rx_fifo_rp)
{
@@ -2287,11 +2287,11 @@ uint8_t z80scc_channel::data_read()
}
else
{
- LOG(("data_read: Attempt to read out character from empty FIFO\n"));
+ LOG("data_read: Attempt to read out character from empty FIFO\n");
logerror("data_read: Attempt to read out character from empty FIFO\n");
}
- LOG((" '%c' %02x\n", isascii(data) ? data : ' ', data));
+ LOG(" '%c' %02x\n", isascii(data) ? data : ' ', data);
return data;
}
@@ -2333,17 +2333,17 @@ WRITE8_MEMBER (z80scc_device::db_w) { m_chanB->data_write(data); }
void z80scc_channel::data_write(uint8_t data)
{
/* Tx FIFO is full or...? */
- LOGTX(("%s \"%s\": %c : Data Register Write: %02d '%c'\n", FUNCNAME, m_owner->tag(), 'A' + m_index, data, isprint(data) ? data : ' '));
+ LOGTX("%s \"%s\": %c : Data Register Write: %02d '%c'\n", FUNCNAME, m_owner->tag(), 'A' + m_index, data, isprint(data) ? data : ' ');
if ( !(m_rr0 & RR0_TX_BUFFER_EMPTY) && // NMOS/CMOS 1 slot "FIFO" is controlled by the TBE bit instead of fifo logic
( (m_tx_fifo_wp + 1 == m_tx_fifo_rp) || ( (m_tx_fifo_wp + 1 == m_tx_fifo_sz) && (m_tx_fifo_rp == 0) )))
{
logerror("- TX FIFO is full, discarding data\n");
- LOGTX(("- TX FIFO is full, discarding data\n"));
+ LOGTX("- TX FIFO is full, discarding data\n");
}
else // ..there is still room
{
- LOGTX(("- TX FIFO has room\n"));
+ LOGTX("- TX FIFO has room\n");
m_tx_data_fifo[m_tx_fifo_wp++] = data;
if (m_tx_fifo_wp >= m_tx_fifo_sz)
{
@@ -2353,30 +2353,30 @@ void z80scc_channel::data_write(uint8_t data)
// Check FIFO fullness and set TBE bit accordingly
if (m_tx_fifo_sz == 1)
{
- LOGTX(("- TX FIFO has only one slot so is now completelly filled, clearing TBE bit\n"));
+ LOGTX("- TX FIFO has only one slot so is now completelly filled, clearing TBE bit\n");
m_rr0 &= ~RR0_TX_BUFFER_EMPTY; // If only one FIFO position it is full now!
}
else if (m_tx_fifo_wp + 1 == m_tx_fifo_rp || ( (m_tx_fifo_wp + 1 == m_tx_fifo_sz) && (m_tx_fifo_rp == 0) ))
{
- LOGTX(("- TX FIFO has filled all slots so now completelly filled, clearing TBE bit\n"));
+ LOGTX("- TX FIFO has filled all slots so now completelly filled, clearing TBE bit\n");
m_rr0 &= ~RR0_TX_BUFFER_EMPTY; // Indicate that the TX fifo is full
}
else
{
- LOGTX(("- TX FIFO has more room, setting TBE bit\n"));
+ LOGTX("- TX FIFO has more room, setting TBE bit\n");
m_rr0 |= RR0_TX_BUFFER_EMPTY; // or there is a slot in the FIFO available
}
- LOGTX(("- TX FIFO now has data to send, clearing ALL_SENT bit\n"));
+ LOGTX("- TX FIFO now has data to send, clearing ALL_SENT bit\n");
m_rr1 &= ~RR1_ALL_SENT; // All is definitelly not sent anymore
}
/* Transmitter enabled? */
if (m_wr5 & WR5_TX_ENABLE)
{
- LOGTX(("- TX is enabled\n"));
+ LOGTX("- TX is enabled\n");
if (is_transmit_register_empty()) // Is the shift register loaded?
{
- LOGTX(("- Setting up transmitter\n"));
+ LOGTX("- Setting up transmitter\n");
transmit_register_setup(m_tx_data_fifo[m_tx_fifo_rp]); // Load the shift register, reload is done in tra_complete()
m_tx_fifo_rp_step();
m_rr1 |= RR1_ALL_SENT; // Now stuff is on its way again
@@ -2384,19 +2384,19 @@ void z80scc_channel::data_write(uint8_t data)
}
else
{
- LOGTX(("- Transmitter not empty\n"));
+ LOGTX("- Transmitter not empty\n");
}
}
else
{
- LOGTX(("- Transmitter disabled\n"));
+ LOGTX("- Transmitter disabled\n");
}
/* "While transmit interrupts are enabled, the nmos/cmos version sets the transmit interrupt pending
(TxIP) bit whenever the transmit buffer becomes empty. this means that the transmit buffer
must be full before the TxIP can be set. thus, when transmit interrupts are first enabled, the TxIP
will not be set until after the first character is written to the nmos/cmos." */
// check if to fire interrupt
- LOG(("- TX interrupt are %s\n", (m_wr1 & WR1_TX_INT_ENABLE) ? "enabled" : "disabled" ));
+ LOG("- TX interrupt are %s\n", (m_wr1 & WR1_TX_INT_ENABLE) ? "enabled" : "disabled" );
if (m_wr1 & WR1_TX_INT_ENABLE)
{
if ((m_uart->m_variant & SET_ESCC) &&
@@ -2419,7 +2419,7 @@ void z80scc_channel::data_write(uint8_t data)
void z80scc_channel::receive_data(uint8_t data)
{
- LOG(("\"%s\": %c : Received Data Byte '%c'/%02x put into FIFO\n", m_owner->tag(), 'A' + m_index, isprint(data) ? data : ' ', data));
+ LOG("\"%s\": %c : Received Data Byte '%c'/%02x put into FIFO\n", m_owner->tag(), 'A' + m_index, isprint(data) ? data : ' ', data);
if (m_rx_fifo_wp + 1 == m_rx_fifo_rp || ( (m_rx_fifo_wp + 1 == m_rx_fifo_sz) && (m_rx_fifo_rp == 0) ))
{
@@ -2472,17 +2472,17 @@ void z80scc_channel::receive_data(uint8_t data)
WRITE_LINE_MEMBER( z80scc_channel::cts_w )
{
- LOG(("\"%s\" %s: %c : CTS %u\n", m_owner->tag(), FUNCNAME, 'A' + m_index, state));
+ LOG("\"%s\" %s: %c : CTS %u\n", m_owner->tag(), FUNCNAME, 'A' + m_index, state);
if ((m_rr0 & RR0_CTS) != (state ? RR0_CTS : 0)) // SCC change detection logic
{
// enable transmitter if in auto enables mode
if (!state)
{
- LOGCTS((" - CTS active\n"));
+ LOGCTS(" - CTS active\n");
if (m_wr3 & WR3_AUTO_ENABLES)
{
- LOGCTS((" - TX auto enabled\n"));
+ LOGCTS(" - TX auto enabled\n");
m_wr5 |= WR5_TX_ENABLE;
}
}
@@ -2492,11 +2492,11 @@ WRITE_LINE_MEMBER( z80scc_channel::cts_w )
if (m_extint_latch == 0 && (m_wr1 & WR1_EXT_INT_ENABLE) && (m_wr15 & WR15_CTS))
{
// trigger interrupt
- LOGCTS((" - Trigger CTS interrupt\n"));
+ LOGCTS(" - Trigger CTS interrupt\n");
m_uart->trigger_interrupt(m_index, INT_EXTERNAL);
// latch read register 0
- LOGCTS((" - Latches RR0\n"));
+ LOGCTS(" - Latches RR0\n");
m_extint_latch = 1;
m_extint_states = m_rr0;
}
@@ -2509,17 +2509,17 @@ WRITE_LINE_MEMBER( z80scc_channel::cts_w )
//-------------------------------------------------
WRITE_LINE_MEMBER( z80scc_channel::dcd_w )
{
- LOGDCD(("\"%s\": %c : DCD %u\n", m_owner->tag(), 'A' + m_index, state));
+ LOGDCD("\"%s\": %c : DCD %u\n", m_owner->tag(), 'A' + m_index, state);
if ((m_rr0 & RR0_DCD) != (state ? RR0_DCD : 0)) // SCC change detection logic
{
// enable transmitter if in auto enables mode
if (!state)
{
- LOGDCD((" - DCD active\n"));
+ LOGDCD(" - DCD active\n");
if (m_wr3 & WR3_AUTO_ENABLES)
{
- LOGDCD((" - RX auto enabled\n"));
+ LOGDCD(" - RX auto enabled\n");
m_wr3 |= WR3_RX_ENABLE;
#if START_BIT_HUNT
m_rcv_mode = RCV_SEEKING;
@@ -2532,12 +2532,12 @@ WRITE_LINE_MEMBER( z80scc_channel::dcd_w )
if (m_extint_latch == 0 && (m_wr1 & WR1_EXT_INT_ENABLE) && (m_wr15 & WR15_DCD))
{
// latch read register 0
- LOGINT((" - Latches RR0\n"));
+ LOGINT(" - Latches RR0\n");
m_extint_latch = 1;
m_extint_states = m_rr0;
// trigger interrupt
- LOGINT((" - Trigger DCD interrupt\n"));
+ LOGINT(" - Trigger DCD interrupt\n");
m_uart->trigger_interrupt(m_index, INT_EXTERNAL);
}
}
@@ -2549,7 +2549,7 @@ WRITE_LINE_MEMBER( z80scc_channel::dcd_w )
//-------------------------------------------------
WRITE_LINE_MEMBER( z80scc_channel::ri_w )
{
- LOGINT(("\"%s\": %c : RI %u - not implemented\n", m_owner->tag(), 'A' + m_index, state));
+ LOGINT("\"%s\": %c : RI %u - not implemented\n", m_owner->tag(), 'A' + m_index, state);
#if 0 // TODO: This code is inherited from another device driver and not correct for SCC
if (m_ri != state)
@@ -2582,7 +2582,7 @@ WRITE_LINE_MEMBER( z80scc_channel::ri_w )
//-------------------------------------------------
WRITE_LINE_MEMBER( z80scc_channel::sync_w )
{
- LOGSYNC(("\"%s\": %c : SYNC %u\n", m_owner->tag(), 'A' + m_index, state));
+ LOGSYNC("\"%s\": %c : SYNC %u\n", m_owner->tag(), 'A' + m_index, state);
if ((m_rr0 & RR0_SYNC_HUNT) != (state ? RR0_SYNC_HUNT : 0)) // SCC change detection logic
{
if (state) m_rr0 |= RR0_SYNC_HUNT; else m_rr0 &= ~RR0_SYNC_HUNT; // Raw pin/status value
@@ -2596,7 +2596,7 @@ WRITE_LINE_MEMBER( z80scc_channel::rxc_w )
{
/* Support for external clock as source for BRG yet to be finished */
#if 0
- //LOG(("\"%s\": %c : Receiver Clock Pulse\n", m_owner->tag(), m_index + 'A'));
+ //LOG("\"%s\": %c : Receiver Clock Pulse\n", m_owner->tag(), m_index + 'A');
if ( ((m_wr3 & WR3_RX_ENABLE) | (m_wr5 & WR5_TX_ENABLE)) && m_wr14 & WR14_BRG_ENABLE)
{
if (!(m_wr14 & WR14_BRG_SOURCE)) // Is the Baud rate Generator driven by RTxC?
@@ -2646,7 +2646,7 @@ WRITE_LINE_MEMBER( z80scc_channel::rxc_w )
//-------------------------------------------------
WRITE_LINE_MEMBER( z80scc_channel::txc_w )
{
- //LOG(("\"%s\": %c : Transmitter Clock Pulse\n", m_owner->tag(), m_index + 'A'));
+ //LOG("\"%s\": %c : Transmitter Clock Pulse\n", m_owner->tag(), m_index + 'A');
if (m_wr5 & WR5_TX_ENABLE)
{
int clocks = get_clock_mode();
@@ -2696,13 +2696,13 @@ unsigned int z80scc_channel::get_brg_rate()
if (m_wr14 & WR14_BRG_SOURCE) // Do we use the PCLK as baudrate source
{
rate = m_owner->clock() / (brg_const == 0 ? 1 : brg_const);
- LOG((" - Source bit rate (%d) = PCLK (%d) / (%d)\n", rate, m_owner->clock(), brg_const));
+ LOG(" - Source bit rate (%d) = PCLK (%d) / (%d)\n", rate, m_owner->clock(), brg_const);
}
else // Else we use the RTxC as BRG source
{
unsigned int source = (m_index == z80scc_device::CHANNEL_A) ? m_uart->m_rxca : m_uart->m_rxcb;
rate = source / (brg_const == 0 ? 1 : brg_const);
- LOG((" - Source bit rate (%d) = RTxC (%d) / (%d)\n", rate, source, brg_const));
+ LOG(" - Source bit rate (%d) = RTxC (%d) / (%d)\n", rate, source, brg_const);
}
return (rate / (2 * get_clock_mode()));
@@ -2729,8 +2729,8 @@ void z80scc_channel::update_serial()
parity = PARITY_NONE;
}
- LOG((" %s() \"%s \"Channel %c setting data frame %d+%d%c%d\n", FUNCNAME, m_owner->tag(), 'A' + m_index, 1,
- data_bit_count, parity == PARITY_NONE ? 'N' : parity == PARITY_EVEN ? 'E' : 'O', (stop_bits + 1) / 2));
+ LOG(" %s() \"%s \"Channel %c setting data frame %d+%d%c%d\n", FUNCNAME, m_owner->tag(), 'A' + m_index, 1,
+ data_bit_count, parity == PARITY_NONE ? 'N' : parity == PARITY_EVEN ? 'E' : 'O', (stop_bits + 1) / 2);
set_data_frame(1, data_bit_count, parity, stop_bits);
@@ -2742,26 +2742,26 @@ void z80scc_channel::update_serial()
if (m_wr14 & WR14_BRG_ENABLE)
{
- LOG(("- BRG enabled\n"));
+ LOG("- BRG enabled\n");
m_brg_rate = get_brg_rate();
- LOG(("- BRG rate %d\n", m_brg_rate));
+ LOG("- BRG rate %d\n", m_brg_rate);
set_rcv_rate(m_brg_rate);
if (is_transmit_register_empty())
{
set_tra_rate(m_brg_rate);
- LOGTX((" - Baud Rate Generator: %d clock mode: %dx\n", m_brg_rate, get_clock_mode() ));
+ LOGTX(" - Baud Rate Generator: %d clock mode: %dx\n", m_brg_rate, get_clock_mode());
}
else
{
m_delayed_tx_brg_change = 1;
- LOGTX((" - Baud Rate Generator delay init: %d clock mode: %dx\n", m_brg_rate, get_clock_mode() ));
+ LOGTX(" - Baud Rate Generator delay init: %d clock mode: %dx\n", m_brg_rate, get_clock_mode());
}
}
else
{
- LOG(("- BRG disabled\n"));
+ LOG("- BRG disabled\n");
set_rcv_rate(0);
set_tra_rate(0);
}
@@ -2770,13 +2770,13 @@ void z80scc_channel::update_serial()
if (m_rxc > 0)
{
set_rcv_rate(m_rxc / clocks); // TODO Check/Fix this to get the right tx/rx clocks, seems to be missing a divider or two
- LOG((" - Receiver clock: %d mode: %d rate: %d/%xh\n", m_rxc, clocks, m_rxc / clocks, m_rxc / clocks));
+ LOG(" - Receiver clock: %d mode: %d rate: %d/%xh\n", m_rxc, clocks, m_rxc / clocks, m_rxc / clocks);
}
if (m_txc > 0 && !(m_wr14 & WR14_BRG_ENABLE))
{
set_tra_rate(m_txc / clocks);
- LOG((" - Transmit clock: %d mode: %d rate: %d/%xh\n", m_rxc, clocks, m_rxc / clocks, m_rxc / clocks));
+ LOG(" - Transmit clock: %d mode: %d rate: %d/%xh\n", m_rxc, clocks, m_rxc / clocks, m_rxc / clocks);
}
}
@@ -2785,7 +2785,7 @@ void z80scc_channel::update_serial()
//-------------------------------------------------
void z80scc_channel::set_dtr(int state)
{
- LOG(("%s(%d)\n", FUNCNAME, state));
+ LOG("%s(%d)\n", FUNCNAME, state);
m_dtr = state;
if (m_index == z80scc_device::CHANNEL_A)
@@ -2810,7 +2810,7 @@ WRITE_LINE_MEMBER(z80scc_channel::write_rx)
}
#endif
- LOGRCV(("%s(%d)\n", FUNCNAME, state));
+ LOGRCV("%s(%d)\n", FUNCNAME, state);
m_rxd = state;
//only use rx_w when self-clocked
if(m_rxc != 0 || m_brg_rate != 0)
diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp
index 9adbbe2dc33..5e7f0329fd2 100644
--- a/src/emu/rendfont.cpp
+++ b/src/emu/rendfont.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders:Aaron Giles, Vas Crabb
/***************************************************************************
rendfont.c
@@ -16,10 +16,432 @@
#include "osdepend.h"
#include "uismall.fh"
-#include "ui/cmdrender.h"
+#include "ui/uicmd14.fh"
+#include "ui/cmddata.h"
+#include <algorithm>
#include <cstddef>
#include <cstring>
+#include <iterator>
+#include <limits>
+
+
+#define VERBOSE 0
+
+#define LOG(...) do { if (VERBOSE) osd_printf_verbose(__VA_ARGS__); } while (0)
+
+
+namespace {
+
+template <typename Iterator>
+class bdf_helper
+{
+public:
+ bdf_helper(Iterator const &begin, Iterator const &end)
+ : m_keyword_begin(begin)
+ , m_keyword_end(begin)
+ , m_value_begin(begin)
+ , m_value_end(begin)
+ , m_line_end(begin)
+ , m_end(end)
+ {
+ next_line();
+ }
+
+ bool at_end() const { return m_end == m_keyword_begin; }
+
+ void next_line()
+ {
+ m_keyword_begin = m_line_end;
+ while ((m_end != m_keyword_begin) && (('\r' == *m_keyword_begin) || ('\n' == *m_keyword_begin)))
+ ++m_keyword_begin;
+
+ m_keyword_end = m_keyword_begin;
+ while ((m_end != m_keyword_end) && (' ' != *m_keyword_end) && ('\t' != *m_keyword_end) && ('\r' != *m_keyword_end) && ('\n' != *m_keyword_end))
+ ++m_keyword_end;
+
+ m_value_begin = m_keyword_end;
+ while ((m_end != m_value_begin) && ((' ' == *m_value_begin) || ('\t' == *m_value_begin)) && ('\r' != *m_value_begin) && ('\n' != *m_value_begin))
+ ++m_value_begin;
+
+ m_value_end = m_line_end = m_value_begin;
+ while ((m_end != m_line_end) && ('\r' != *m_line_end) && ('\n' != *m_line_end))
+ {
+ if ((' ' != *m_line_end) && ('\t' != *m_line_end))
+ m_value_end = ++m_line_end;
+ else
+ ++m_line_end;
+ }
+ }
+
+ bool is_keyword(char const *keyword) const
+ {
+ Iterator pos(m_keyword_begin);
+ while (true)
+ {
+ if (m_keyword_end == pos)
+ {
+ return '\0' == *keyword;
+ }
+ else if (('\0' == *keyword) || (*pos != *keyword))
+ {
+ return false;
+ }
+ else
+ {
+ ++pos;
+ ++keyword;
+ }
+ }
+ }
+
+ Iterator const &keyword_begin() const { return m_keyword_begin; }
+ Iterator const &keyword_end() const { return m_keyword_end; }
+ auto keyword_length() const { return std::distance(m_keyword_begin, m_keyword_end); }
+
+ Iterator const &value_begin() const { return m_value_begin; }
+ Iterator const &value_end() const { return m_value_end; }
+ auto value_length() const { return std::distance(m_value_begin, m_value_end); }
+
+private:
+ Iterator m_keyword_begin;
+ Iterator m_keyword_end;
+ Iterator m_value_begin;
+ Iterator m_value_end;
+ Iterator m_line_end;
+ Iterator const m_end;
+};
+
+
+class bdc_header
+{
+public:
+ static constexpr unsigned MAJVERSION = 1;
+ static constexpr unsigned MINVERSION = 0;
+
+ bool read(emu_file &f)
+ {
+ return f.read(m_data, sizeof(m_data)) == sizeof(m_data);
+ }
+ bool write(emu_file &f)
+ {
+ return f.write(m_data, sizeof(m_data)) == sizeof(m_data);
+ }
+
+ bool check_magic() const
+ {
+ return !std::memcmp(MAGIC, m_data + OFFS_MAGIC, OFFS_MAJVERSION - OFFS_MAGIC);
+ }
+ unsigned get_major_version() const
+ {
+ return m_data[OFFS_MAJVERSION];
+ }
+ unsigned get_minor_version() const
+ {
+ return m_data[OFFS_MINVERSION];
+ }
+ u64 get_original_length() const
+ {
+ return
+ (u64(m_data[OFFS_ORIGLENGTH + 0]) << (7 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 1]) << (6 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 2]) << (5 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 3]) << (4 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 4]) << (3 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 5]) << (2 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 6]) << (1 * 8)) |
+ (u64(m_data[OFFS_ORIGLENGTH + 7]) << (0 * 8));
+ }
+ u32 get_original_hash() const
+ {
+ return
+ (u32(m_data[OFFS_ORIGHASH + 0]) << (3 * 8)) |
+ (u32(m_data[OFFS_ORIGHASH + 1]) << (2 * 8)) |
+ (u32(m_data[OFFS_ORIGHASH + 2]) << (1 * 8)) |
+ (u32(m_data[OFFS_ORIGHASH + 3]) << (0 * 8));
+ }
+ u32 get_glyph_count() const
+ {
+ return
+ (u32(m_data[OFFS_GLYPHCOUNT + 0]) << (3 * 8)) |
+ (u32(m_data[OFFS_GLYPHCOUNT + 1]) << (2 * 8)) |
+ (u32(m_data[OFFS_GLYPHCOUNT + 2]) << (1 * 8)) |
+ (u32(m_data[OFFS_GLYPHCOUNT + 3]) << (0 * 8));
+ }
+ u16 get_height() const
+ {
+ return
+ (u16(m_data[OFFS_HEIGHT + 0]) << (1 * 8)) |
+ (u16(m_data[OFFS_HEIGHT + 1]) << (0 * 8));
+ }
+ s16 get_y_offset() const
+ {
+ return
+ (u16(m_data[OFFS_YOFFSET + 0]) << (1 * 8)) |
+ (u16(m_data[OFFS_YOFFSET + 1]) << (0 * 8));
+ }
+ s32 get_default_character() const
+ {
+ return
+ (u32(m_data[OFFS_DEFCHAR + 0]) << (3 * 8)) |
+ (u32(m_data[OFFS_DEFCHAR + 1]) << (2 * 8)) |
+ (u32(m_data[OFFS_DEFCHAR + 2]) << (1 * 8)) |
+ (u32(m_data[OFFS_DEFCHAR + 3]) << (0 * 8));
+ }
+
+ void set_magic()
+ {
+ std::memcpy(m_data + OFFS_MAGIC, MAGIC, OFFS_MAJVERSION - OFFS_MAGIC);
+ }
+ void set_version()
+ {
+ m_data[OFFS_MAJVERSION] = MAJVERSION;
+ m_data[OFFS_MINVERSION] = MINVERSION;
+ }
+ void set_original_length(u64 value)
+ {
+ m_data[OFFS_ORIGLENGTH + 0] = u8((value >> (7 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 1] = u8((value >> (6 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 2] = u8((value >> (5 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 3] = u8((value >> (4 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 4] = u8((value >> (3 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 5] = u8((value >> (2 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 6] = u8((value >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGLENGTH + 7] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_original_hash(u32 value)
+ {
+ m_data[OFFS_ORIGHASH + 0] = u8((value >> (3 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGHASH + 1] = u8((value >> (2 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGHASH + 2] = u8((value >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_ORIGHASH + 3] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_glyph_count(u32 value)
+ {
+ m_data[OFFS_GLYPHCOUNT + 0] = u8((value >> (3 * 8)) & 0x00ff);
+ m_data[OFFS_GLYPHCOUNT + 1] = u8((value >> (2 * 8)) & 0x00ff);
+ m_data[OFFS_GLYPHCOUNT + 2] = u8((value >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_GLYPHCOUNT + 3] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_height(u16 value)
+ {
+ m_data[OFFS_HEIGHT + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_HEIGHT + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_y_offset(s16 value)
+ {
+ m_data[OFFS_YOFFSET + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_YOFFSET + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_default_character(s32 value)
+ {
+ m_data[OFFS_DEFCHAR + 0] = u8((value >> (3 * 8)) & 0x00ff);
+ m_data[OFFS_DEFCHAR + 1] = u8((value >> (2 * 8)) & 0x00ff);
+ m_data[OFFS_DEFCHAR + 2] = u8((value >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_DEFCHAR + 3] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+
+private:
+ static constexpr std::size_t OFFS_MAGIC = 0x00; // 0x06 bytes
+ static constexpr std::size_t OFFS_MAJVERSION = 0x06; // 0x01 bytes (binary integer)
+ static constexpr std::size_t OFFS_MINVERSION = 0x07; // 0x01 bytes (binary integer)
+ static constexpr std::size_t OFFS_ORIGLENGTH = 0x08; // 0x08 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_ORIGHASH = 0x10; // 0x04 bytes
+ static constexpr std::size_t OFFS_GLYPHCOUNT = 0x14; // 0x04 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_HEIGHT = 0x18; // 0x02 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_YOFFSET = 0x1a; // 0x02 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_DEFCHAR = 0x1c; // 0x04 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_END = 0x20;
+
+ static u8 const MAGIC[OFFS_MAJVERSION - OFFS_MAGIC];
+
+ u8 m_data[OFFS_END];
+};
+
+u8 const bdc_header::MAGIC[OFFS_MAJVERSION - OFFS_MAGIC] = { 'b', 'd', 'c', 'f', 'n', 't' };
+
+
+class bdc_table_entry
+{
+public:
+ bdc_table_entry(void *bytes)
+ : m_ptr(reinterpret_cast<u8 *>(bytes))
+ {
+ }
+ bdc_table_entry(bdc_table_entry const &that) = default;
+ bdc_table_entry(bdc_table_entry &&that) = default;
+
+ bdc_table_entry get_next() const
+ {
+ return bdc_table_entry(m_ptr + OFFS_END);
+ }
+
+ u32 get_encoding() const
+ {
+ return
+ (u32(m_ptr[OFFS_ENCODING + 0]) << (3 * 8)) |
+ (u32(m_ptr[OFFS_ENCODING + 1]) << (2 * 8)) |
+ (u32(m_ptr[OFFS_ENCODING + 2]) << (1 * 8)) |
+ (u32(m_ptr[OFFS_ENCODING + 3]) << (0 * 8));
+ }
+ u16 get_x_advance() const
+ {
+ return
+ (u16(m_ptr[OFFS_XADVANCE + 0]) << (1 * 8)) |
+ (u16(m_ptr[OFFS_XADVANCE + 1]) << (0 * 8));
+ }
+ s16 get_bb_x_offset() const
+ {
+ return
+ (u16(m_ptr[OFFS_BBXOFFSET + 0]) << (1 * 8)) |
+ (u16(m_ptr[OFFS_BBXOFFSET + 1]) << (0 * 8));
+ }
+ s16 get_bb_y_offset() const
+ {
+ return
+ (u16(m_ptr[OFFS_BBYOFFSET + 0]) << (1 * 8)) |
+ (u16(m_ptr[OFFS_BBYOFFSET + 1]) << (0 * 8));
+ }
+ u16 get_bb_width() const
+ {
+ return
+ (u16(m_ptr[OFFS_BBWIDTH + 0]) << (1 * 8)) |
+ (u16(m_ptr[OFFS_BBWIDTH + 1]) << (0 * 8));
+ }
+ u16 get_bb_height() const
+ {
+ return
+ (u16(m_ptr[OFFS_BBHEIGHT + 0]) << (1 * 8)) |
+ (u16(m_ptr[OFFS_BBHEIGHT + 1]) << (0 * 8));
+ }
+
+ void set_encoding(u32 value)
+ {
+ m_ptr[OFFS_ENCODING + 0] = u8((value >> (3 * 8)) & 0x00ff);
+ m_ptr[OFFS_ENCODING + 1] = u8((value >> (2 * 8)) & 0x00ff);
+ m_ptr[OFFS_ENCODING + 2] = u8((value >> (1 * 8)) & 0x00ff);
+ m_ptr[OFFS_ENCODING + 3] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_x_advance(u16 value)
+ {
+ m_ptr[OFFS_XADVANCE + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_ptr[OFFS_XADVANCE + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_bb_x_offset(s16 value)
+ {
+ m_ptr[OFFS_BBXOFFSET + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_ptr[OFFS_BBXOFFSET + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_bb_y_offset(s16 value)
+ {
+ m_ptr[OFFS_BBYOFFSET + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_ptr[OFFS_BBYOFFSET + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_bb_width(u16 value)
+ {
+ m_ptr[OFFS_BBWIDTH + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_ptr[OFFS_BBWIDTH + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+ void set_bb_height(u16 value)
+ {
+ m_ptr[OFFS_BBHEIGHT + 0] = u8((value >> (1 * 8)) & 0x00ff);
+ m_ptr[OFFS_BBHEIGHT + 1] = u8((value >> (0 * 8)) & 0x00ff);
+ }
+
+ bdc_table_entry &operator=(bdc_table_entry const &that) = default;
+ bdc_table_entry &operator=(bdc_table_entry &&that) = default;
+
+ static std::size_t size()
+ {
+ return OFFS_END;
+ }
+
+private:
+ static constexpr std::size_t OFFS_ENCODING = 0x00; // 0x04 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_XADVANCE = 0x04; // 0x02 bytes (big-endian binary integer)
+ // two bytes reserved
+ static constexpr std::size_t OFFS_BBXOFFSET = 0x08; // 0x02 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_BBYOFFSET = 0x0a; // 0x02 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_BBWIDTH = 0x0c; // 0x02 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_BBHEIGHT = 0x0e; // 0x02 bytes (big-endian binary integer)
+ static constexpr std::size_t OFFS_END = 0x10;
+
+ u8 *m_ptr;
+};
+
+} // anonymous namespace
+
+
+void convert_command_glyph(std::string &str)
+{
+ str.c_str(); // force NUL-termination - we depend on it later
+ std::size_t const len(str.length());
+ std::vector<char> buf(2 * (len + 1));
+ std::size_t j(0);
+ for (std::size_t i = 0; len > i; )
+ {
+ // decode UTF-8
+ char32_t uchar;
+ int const codelen(uchar_from_utf8(&uchar, &str[i], len - i));
+ if (0 >= codelen)
+ break;
+ i += codelen;
+
+ // check for three metacharacters
+ fix_command_t const *fixcmd(nullptr);
+ switch (uchar)
+ {
+ case COMMAND_CONVERT_TEXT:
+ for (fix_strings_t *fixtext = convert_text; fixtext->glyph_code; ++fixtext)
+ {
+ if (!fixtext->glyph_str_len)
+ fixtext->glyph_str_len = std::strlen(fixtext->glyph_str);
+
+ if (!std::strncmp(fixtext->glyph_str, &str[i], fixtext->glyph_str_len))
+ {
+ uchar = fixtext->glyph_code + COMMAND_UNICODE;
+ i += strlen(fixtext->glyph_str);
+ break;
+ }
+ }
+ break;
+
+ case COMMAND_DEFAULT_TEXT:
+ fixcmd = default_text;
+ break;
+
+ case COMMAND_EXPAND_TEXT:
+ fixcmd = expand_text;
+ break;
+ }
+
+ // this substitutes a single character
+ if (fixcmd)
+ {
+ if (str[i] == uchar)
+ {
+ ++i;
+ }
+ else
+ {
+ while (fixcmd->glyph_code && (fixcmd->glyph_char != str[i]))
+ ++fixcmd;
+ if (fixcmd->glyph_code)
+ {
+ uchar = COMMAND_UNICODE + fixcmd->glyph_code;
+ ++i;
+ }
+ }
+ }
+
+ // copy character to output
+ int const outlen(utf8_from_uchar(&buf[j], buf.size() - j, uchar));
+ if (0 >= outlen)
+ break;
+ j += outlen;
+ }
+ str.assign(&buf[0], j);
+}
const u64 render_font::CACHED_BDF_HASH_SIZE;
@@ -58,30 +480,36 @@ inline render_font::glyph &render_font::get_char(char32_t chnum)
{
static glyph dummy_glyph;
- // grab the table; if none, return the dummy character
- if ((chnum / 256) >= ARRAY_LENGTH(m_glyphs))
- return dummy_glyph;
- if (!m_glyphs[chnum / 256] && m_format == FF_OSD)
- m_glyphs[chnum / 256] = new glyph[256];
- if (!m_glyphs[chnum / 256])
+ unsigned const page(chnum / 256);
+ if (page >= ARRAY_LENGTH(m_glyphs))
+ {
+ if ((0 <= m_defchar) && (chnum != m_defchar))
+ return get_char(m_defchar);
+ else
+ return dummy_glyph;
+ }
+ else if (!m_glyphs[page])
{
//mamep: make table for command glyph
- if (chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + MAX_GLYPH_FONT)
- m_glyphs[chnum / 256] = new glyph[256];
+ if ((m_format == format::OSD) || ((chnum >= COMMAND_UNICODE) && (chnum < COMMAND_UNICODE + MAX_GLYPH_FONT)))
+ m_glyphs[page] = new glyph[256];
+ else if ((0 <= m_defchar) && (chnum != m_defchar))
+ return get_char(m_defchar);
else
return dummy_glyph;
}
// if the character isn't generated yet, do it now
- glyph &gl = m_glyphs[chnum / 256][chnum % 256];
+ glyph &gl = m_glyphs[page][chnum % 256];
if (!gl.bitmap.valid())
{
//mamep: command glyph support
if (m_height_cmd && chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + MAX_GLYPH_FONT)
{
- glyph &glyph_ch = m_glyphs_cmd[chnum / 256][chnum % 256];
- float scale = (float)m_height / (float)m_height_cmd;
- if (m_format == FF_OSD) scale *= 0.90f;
+ glyph &glyph_ch = m_glyphs_cmd[page][chnum % 256];
+ float scale = float(m_height) / float(m_height_cmd);
+ if (m_format == format::OSD)
+ scale *= 0.90f;
if (!glyph_ch.bitmap.valid())
char_expand(chnum, glyph_ch);
@@ -89,11 +517,11 @@ inline render_font::glyph &render_font::get_char(char32_t chnum)
//mamep: for color glyph
gl.color = glyph_ch.color;
- gl.width = (int)(glyph_ch.width * scale + 0.5f);
- gl.xoffs = (int)(glyph_ch.xoffs * scale + 0.5f);
- gl.yoffs = (int)(glyph_ch.yoffs * scale + 0.5f);
- gl.bmwidth = (int)(glyph_ch.bmwidth * scale + 0.5f);
- gl.bmheight = (int)(glyph_ch.bmheight * scale + 0.5f);
+ gl.width = int(glyph_ch.width * scale + 0.5f);
+ gl.xoffs = int(glyph_ch.xoffs * scale + 0.5f);
+ gl.yoffs = int(glyph_ch.yoffs * scale + 0.5f);
+ gl.bmwidth = int(glyph_ch.bmwidth * scale + 0.5f);
+ gl.bmheight = int(glyph_ch.bmheight * scale + 0.5f);
gl.bitmap.allocate(gl.bmwidth, gl.bmheight);
rectangle clip;
@@ -107,10 +535,11 @@ inline render_font::glyph &render_font::get_char(char32_t chnum)
gl.texture->set_bitmap(gl.bitmap, gl.bitmap.cliprect(), TEXFORMAT_ARGB32);
}
else
+ {
char_expand(chnum, gl);
+ }
}
- // return the resulting character
return gl;
}
@@ -125,55 +554,53 @@ inline render_font::glyph &render_font::get_char(char32_t chnum)
//-------------------------------------------------
render_font::render_font(render_manager &manager, const char *filename)
- : m_manager(manager),
- m_format(FF_UNKNOWN),
- m_height(0),
- m_yoffs(0),
- m_scale(1.0f),
- m_rawsize(0),
- m_osdfont(),
- m_height_cmd(0),
- m_yoffs_cmd(0)
+ : m_manager(manager)
+ , m_format(format::UNKNOWN)
+ , m_height(0)
+ , m_yoffs(0)
+ , m_defchar(-1)
+ , m_scale(1.0f)
+ , m_rawsize(0)
+ , m_osdfont()
+ , m_height_cmd(0)
+ , m_yoffs_cmd(0)
{
memset(m_glyphs, 0, sizeof(m_glyphs));
memset(m_glyphs_cmd, 0, sizeof(m_glyphs_cmd));
// if this is an OSD font, we're done
- if (filename != nullptr)
+ if (filename)
{
m_osdfont = manager.machine().osd().font_alloc();
- if (m_osdfont)
+ if (m_osdfont && m_osdfont->open(manager.machine().options().font_path(), filename, m_height))
{
- if (m_osdfont->open(manager.machine().options().font_path(), filename, m_height))
- {
- m_scale = 1.0f / (float)m_height;
- m_format = FF_OSD;
+ m_scale = 1.0f / float(m_height);
+ m_format = format::OSD;
- //mamep: allocate command glyph font
- render_font_command_glyph();
- return;
- }
- m_osdfont.reset();
+ //mamep: allocate command glyph font
+ render_font_command_glyph();
+ return;
}
+ m_osdfont.reset();
}
// if the filename is 'default' default to 'ui.bdf' for backwards compatibility
- if (filename != nullptr && core_stricmp(filename, "default") == 0)
+ if (filename && !core_stricmp(filename, "default"))
filename = "ui.bdf";
- // attempt to load the cached version of the font first
- if (filename != nullptr && load_cached_bdf(filename))
+ // attempt to load an external BDF font first
+ if (filename && load_cached_bdf(filename))
{
//mamep: allocate command glyph font
render_font_command_glyph();
return;
}
- // load the raw data instead
+ // load the compiled in data instead
emu_file ramfile(OPEN_FLAG_READ);
- osd_file::error filerr = ramfile.open_ram(font_uismall, sizeof(font_uismall));
- if (filerr == osd_file::error::NONE)
- load_cached(ramfile, 0);
+ osd_file::error const filerr(ramfile.open_ram(font_uismall, sizeof(font_uismall)));
+ if (osd_file::error::NONE == filerr)
+ load_cached(ramfile, 0, 0);
render_font_command_glyph();
}
@@ -216,15 +643,15 @@ render_font::~render_font()
void render_font::char_expand(char32_t chnum, glyph &gl)
{
- rgb_t color = rgb_t(0xff,0xff,0xff,0xff);
- bool is_cmd = (chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + MAX_GLYPH_FONT);
+ LOG("render_font::char_expand: expanding character %u\n", unsigned(chnum));
- if (gl.color)
- color = gl.color;
+ rgb_t const fgcol(gl.color ? gl.color : rgb_t(0xff, 0xff, 0xff, 0xff));
+ rgb_t const bgcol(0x00, 0xff, 0xff, 0xff);
+ bool const is_cmd((chnum >= COMMAND_UNICODE) && (chnum < COMMAND_UNICODE + MAX_GLYPH_FONT));
if (is_cmd)
{
- // punt if nothing there
+ // abort if nothing there
if (gl.bmwidth == 0 || gl.bmheight == 0 || gl.rawdata == nullptr)
return;
@@ -245,37 +672,47 @@ void render_font::char_expand(char32_t chnum, glyph &gl)
if (accumbit == 7)
accum = *ptr++;
if (dest != nullptr)
- *dest++ = (accum & (1 << accumbit)) ? color : rgb_t(0x00,0xff,0xff,0xff);
+ *dest++ = (accum & (1 << accumbit)) ? fgcol : bgcol;
accumbit = (accumbit - 1) & 7;
}
}
}
}
- // if we're an OSD font, query the info
- else if (m_format == FF_OSD)
+ else if (m_format == format::OSD)
{
- // we set bmwidth to -1 if we've previously queried and failed
- if (gl.bmwidth == -1)
+ // if we're an OSD font, query the info
+ if (0 > gl.bmwidth)
+ {
+ // we set bmwidth to -1 if we've previously queried and failed
+ LOG("render_font::char_expand: previously failed to get bitmap from OSD font\n");
return;
-
- // attempt to get the font bitmap; if we fail, set bmwidth to -1
+ }
if (!m_osdfont->get_bitmap(chnum, gl.bitmap, gl.width, gl.xoffs, gl.yoffs))
{
+ // attempt to get the font bitmap failed - set bmwidth to -1
+ LOG("render_font::char_expand: get bitmap from OSD font failed\n");
gl.bitmap.reset();
gl.bmwidth = -1;
return;
}
-
- // populate the bmwidth/bmheight fields
- gl.bmwidth = gl.bitmap.width();
- gl.bmheight = gl.bitmap.height();
+ else
+ {
+ // populate the bmwidth/bmheight fields
+ LOG("render_font::char_expand: got %dx%d bitmap from OSD font\n", gl.bitmap.width(), gl.bitmap.height());
+ gl.bmwidth = gl.bitmap.width();
+ gl.bmheight = gl.bitmap.height();
+ }
+ }
+ else if (!gl.bmwidth || !gl.bmheight || !gl.rawdata)
+ {
+ // abort if nothing there
+ LOG("render_font::char_expand: empty bitmap bounds or no raw data\n");
+ return;
}
- // other formats need to parse their data
else
{
- // punt if nothing there
- if (gl.bmwidth == 0 || gl.bmheight == 0 || gl.rawdata == nullptr)
- return;
+ // other formats need to parse their data
+ LOG("render_font::char_expand: building bitmap from raw data\n");
// allocate a new bitmap of the size we need
gl.bitmap.allocate(gl.bmwidth, m_height);
@@ -283,55 +720,55 @@ void render_font::char_expand(char32_t chnum, glyph &gl)
// extract the data
const char *ptr = gl.rawdata;
- u8 accum = 0, accumbit = 7;
- for (int y = 0; y < gl.bmheight; y++)
+ u8 accum(0), accumbit(7);
+ for (int y = 0; y < gl.bmheight; ++y)
{
- int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight;
- u32 *dest = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr;
+ int const desty(y + m_height + m_yoffs - gl.yoffs - gl.bmheight);
+ u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix32(desty) : nullptr);
- // text format
- if (m_format == FF_TEXT)
+ if (m_format == format::TEXT)
{
- // loop over bytes
- for (int x = 0; x < gl.bmwidth; x += 4)
+ if (dest)
{
- // scan for the next hex digit
- int bits = -1;
- while (*ptr != 13 && bits == -1)
+ for (int x = 0; gl.bmwidth > x; )
{
- if (*ptr >= '0' && *ptr <= '9')
- bits = *ptr++ - '0';
- else if (*ptr >= 'A' && *ptr <= 'F')
- bits = *ptr++ - 'A' + 10;
- else if (*ptr >= 'a' && *ptr <= 'f')
- bits = *ptr++ - 'a' + 10;
- else
- ptr++;
- }
+ // scan for the next hex digit
+ int bits = -1;
+ while (('\r' != *ptr) && ('\n' != *ptr) && (0 > bits))
+ {
+ if (*ptr >= '0' && *ptr <= '9')
+ bits = *ptr++ - '0';
+ else if (*ptr >= 'A' && *ptr <= 'F')
+ bits = *ptr++ - 'A' + 10;
+ else if (*ptr >= 'a' && *ptr <= 'f')
+ bits = *ptr++ - 'a' + 10;
+ else
+ ptr++;
+ }
- // expand the four bits
- if (dest != nullptr)
- {
- *dest++ = (bits & 8) ? color : rgb_t(0x00,0xff,0xff,0xff);
- *dest++ = (bits & 4) ? color : rgb_t(0x00,0xff,0xff,0xff);
- *dest++ = (bits & 2) ? color : rgb_t(0x00,0xff,0xff,0xff);
- *dest++ = (bits & 1) ? color : rgb_t(0x00,0xff,0xff,0xff);
+ // expand the four bits
+ *dest++ = (bits & 8) ? fgcol : bgcol;
+ if (gl.bmwidth > ++x)
+ *dest++ = (bits & 4) ? fgcol : bgcol;
+ if (gl.bmwidth > ++x)
+ *dest++ = (bits & 2) ? fgcol : bgcol;
+ if (gl.bmwidth > ++x)
+ *dest++ = (bits & 1) ? fgcol : bgcol;
+ ++x;
}
}
// advance to the next line
ptr = next_line(ptr);
}
-
- // cached format
- else if (m_format == FF_CACHED)
+ else if (m_format == format::CACHED)
{
for (int x = 0; x < gl.bmwidth; x++)
{
if (accumbit == 7)
accum = *ptr++;
if (dest != nullptr)
- *dest++ = (accum & (1 << accumbit)) ? color : rgb_t(0x00,0xff,0xff,0xff);
+ *dest++ = (accum & (1 << accumbit)) ? fgcol : bgcol;
accumbit = (accumbit - 1) & 7;
}
}
@@ -479,27 +916,45 @@ float render_font::utf8string_width(float height, float aspect, const char *utf8
bool render_font::load_cached_bdf(const char *filename)
{
+ osd_file::error filerr;
+ u32 chunk;
+ u64 bytes;
+
// first try to open the BDF itself
emu_file file(m_manager.machine().options().font_path(), OPEN_FLAG_READ);
- osd_file::error filerr = file.open(filename);
+ filerr = file.open(filename);
if (filerr != osd_file::error::NONE)
return false;
// determine the file size and allocate memory
- m_rawsize = file.size();
- m_rawdata.resize(m_rawsize + 1);
-
- // read the first chunk
- u32 bytes = file.read(&m_rawdata[0], std::min(CACHED_BDF_HASH_SIZE, m_rawsize));
- if (bytes != std::min(CACHED_BDF_HASH_SIZE, m_rawsize))
+ try
+ {
+ m_rawsize = file.size();
+ std::vector<char>::size_type const sz(m_rawsize + 1);
+ if (u64(sz) != (m_rawsize + 1))
+ return false;
+ m_rawdata.resize(sz);
+ }
+ catch (...)
+ {
return false;
+ }
- // has the chunk
- u32 hash = core_crc32(0, (const u8 *)&m_rawdata[0], bytes) ^ u32(m_rawsize);
+ // read the first chunk and hash it
+ chunk = u32((std::min<u64>)(CACHED_BDF_HASH_SIZE, m_rawsize));
+ bytes = file.read(&m_rawdata[0], chunk);
+ if (bytes != chunk)
+ {
+ m_rawdata.clear();
+ return false;
+ }
+ u32 const hash(core_crc32(0, reinterpret_cast<u8 const *>(&m_rawdata[0]), bytes));
// create the cached filename, changing the 'F' to a 'C' on the extension
std::string cachedname(filename);
- cachedname.erase(cachedname.length() - 3, 3).append("bdc");
+ if ((4U < cachedname.length()) && !core_stricmp(&cachedname[cachedname.length() - 4], ".bdf"))
+ cachedname.erase(cachedname.length() - 4);
+ cachedname.append(".bdc");
// attempt to open the cached version of the font
{
@@ -508,38 +963,36 @@ bool render_font::load_cached_bdf(const char *filename)
if (filerr == osd_file::error::NONE)
{
// if we have a cached version, load it
- bool result = load_cached(cachefile, hash);
+ bool const result = load_cached(cachefile, m_rawsize, hash);
// if that worked, we're done
if (result)
- {
- // don't do that - glyphs data point into this array ...
- // m_rawdata.reset();
return true;
- }
}
}
- // read in the rest of the font
- if (bytes < m_rawsize)
+ // read in the rest of the font and NUL-terminate it
+ while (bytes < m_rawsize)
{
- u32 read = file.read(&m_rawdata[bytes], m_rawsize - bytes);
- if (read != m_rawsize - bytes)
+ chunk = u32((std::min<u64>)(std::numeric_limits<u32>::max(), m_rawsize - bytes));
+ u32 const read(file.read(&m_rawdata[bytes], chunk));
+ bytes += read;
+ if (read != chunk)
{
m_rawdata.clear();
return false;
}
}
-
- // NULL-terminate the data and attach it to the font
- m_rawdata[m_rawsize] = 0;
+ m_rawdata[m_rawsize] = '\0';
// load the BDF
- bool result = load_bdf();
+ bool const result = load_bdf();
// if we loaded okay, create a cached one
if (result)
- save_cached(cachedname.c_str(), hash);
+ save_cached(cachedname.c_str(), m_rawsize, hash);
+ else
+ m_rawdata.clear();
// close the file
return result;
@@ -553,109 +1006,344 @@ bool render_font::load_cached_bdf(const char *filename)
bool render_font::load_bdf()
{
// set the format to text
- m_format = FF_TEXT;
+ m_format = format::TEXT;
- // first find the FONTBOUNDINGBOX tag
- const char *ptr;
- for (ptr = &m_rawdata[0]; ptr != nullptr; ptr = next_line(ptr))
+ bdf_helper<std::vector<char>::const_iterator> helper(std::cbegin(m_rawdata), std::cend(m_rawdata));
+
+ // the first thing we want to see is the STARTFONT declaration, failing that we can't do much
+ for ( ; !helper.is_keyword("STARTFONT"); helper.next_line())
+ {
+ if (helper.at_end())
+ {
+ osd_printf_error("render_font::load_bdf: expected STARTFONT\n");
+ return false;
+ }
+ }
+
+ // parse out the global information we need
+ bool have_bbox(false);
+ bool have_properties(false);
+ bool have_defchar(false);
+ for (helper.next_line(); !helper.is_keyword("CHARS"); helper.next_line())
{
- // we only care about a tiny few fields
- if (strncmp(ptr, "FONTBOUNDINGBOX ", 16) == 0)
+ if (helper.at_end())
{
- int dummy1, dummy2;
- if (sscanf(ptr + 16, "%d %d %d %d", &dummy1, &m_height, &dummy2, &m_yoffs) != 4)
+ // font with no characters is useless
+ osd_printf_error("render_font::load_bdf: no glyph section found\n");
+ return false;
+ }
+ else if (helper.is_keyword("FONTBOUNDINGBOX"))
+ {
+ // check for duplicate bounding box
+ if (have_bbox)
+ {
+ osd_printf_error("render_font::load_bdf: found additional bounding box \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
return false;
- break;
+ }
+ have_bbox = true;
+
+ // parse bounding box and check that it's at least half sane
+ int width, xoffs;
+ if (4 == sscanf(&*helper.value_begin(), "%d %d %d %d", &width, &m_height, &xoffs, &m_yoffs))
+ {
+ LOG("render_font::load_bdf: got bounding box %dx%d %d,%d\n", width, m_height, xoffs, m_yoffs);
+ if ((0 >= m_height) || (0 >= width))
+ {
+ osd_printf_error("render_font::load_bdf: bounding box is invalid\n");
+ return false;
+ }
+ }
+ else
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse bounding box \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ }
+ else if (helper.is_keyword("STARTPROPERTIES"))
+ {
+ // check for duplicated properties section
+ if (have_properties)
+ {
+ osd_printf_error("render_font::load_bdf: found additional properties\n");
+ return false;
+ }
+ have_properties = true;
+
+ // get property count for sanity check
+ int propcount;
+ if (1 != sscanf(&*helper.value_begin(), "%d", &propcount))
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse property count \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+
+ int actual(0);
+ for (helper.next_line(); !helper.is_keyword("ENDPROPERTIES"); helper.next_line())
+ {
+ ++actual;
+ if (helper.at_end())
+ {
+ // unterminated properties section
+ osd_printf_error("render_font::load_bdf: end of properties not found\n");
+ return false;
+ }
+ else if (helper.is_keyword("DEFAULT_CHAR"))
+ {
+ // check for duplicate default character
+ if (have_defchar)
+ {
+ osd_printf_error("render_font::load_bdf: found additional default character \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ have_defchar = true;
+
+ // parse default character
+ if (1 == sscanf(&*helper.value_begin(), "%d", &m_defchar))
+ {
+ LOG("render_font::load_bdf: got default character 0x%x\n", m_defchar);
+ }
+ else
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse default character \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ }
+ }
+
+ // sanity check on number of properties
+ if (actual != propcount)
+ {
+ osd_printf_error("render_font::load_bdf: incorrect number of properties %d\n", actual);
+ return false;
+ }
}
}
// compute the scale factor
- m_scale = 1.0f / (float)m_height;
+ if (!have_bbox)
+ {
+ osd_printf_error("render_font::load_bdf: no bounding box found\n");
+ return false;
+ }
+ m_scale = 1.0f / float(m_height);
+
+ // get expected character count
+ int expected;
+ if (1 == sscanf(&*helper.value_begin(), "%d", &expected))
+ {
+ LOG("render_font::load_bdf: got character count %d\n", expected);
+ }
+ else
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse character count \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
// now scan for characters
+ auto const nothex([] (char ch) { return (('0' > ch) || ('9' < ch)) && (('A' > ch) || ('Z' < ch)) && (('a' > ch) || ('z' < ch)); });
int charcount = 0;
- for ( ; ptr != nullptr; ptr = next_line(ptr))
+ for (helper.next_line(); !helper.is_keyword("ENDFONT"); helper.next_line())
{
- // stop at ENDFONT
- if (strncmp(ptr, "ENDFONT", 7) == 0)
- break;
-
- // once we hit a STARTCHAR, parse until the end
- if (strncmp(ptr, "STARTCHAR ", 10) == 0)
+ if (helper.at_end())
{
- int bmwidth = -1, bmheight = -1, xoffs = -1, yoffs = -1;
- const char *rawdata = nullptr;
- int charnum = -1;
- int width = -1;
-
- // scan for interesting per-character tags
- for ( ; ptr != nullptr; ptr = next_line(ptr))
+ // unterminated font
+ osd_printf_error("render_font::load_bdf: end of font not found\n");
+ return false;
+ }
+ else if (helper.is_keyword("STARTCHAR"))
+ {
+ // required glyph properties
+ bool have_encoding(false);
+ bool have_advance(false);
+ bool have_bbounds(false);
+ int encoding(-1);
+ int xadvance(-1);
+ int bbw(-1), bbh(-1), bbxoff(-1), bbyoff(-1);
+
+ // stuff for the bitmap data
+ bool in_bitmap(false);
+ int bitmap_rows(0);
+ char const *bitmap_data(nullptr);
+
+ // parse a glyph
+ for (helper.next_line(); !helper.is_keyword("ENDCHAR"); helper.next_line())
{
- // ENCODING tells us which character
- if (strncmp(ptr, "ENCODING ", 9) == 0)
+ if (helper.at_end())
{
- if (sscanf(ptr + 9, "%d", &charnum) != 1)
- return 1;
+ // unterminated glyph
+ osd_printf_error("render_font::load_bdf: end of glyph not found\n");
+ return false;
}
-
- // DWIDTH tells us the width to the next character
- else if (strncmp(ptr, "DWIDTH ", 7) == 0)
+ else if (in_bitmap)
{
- int dummy1;
- if (sscanf(ptr + 7, "%d %d", &width, &dummy1) != 2)
- return 1;
+ // quick sanity check
+ if ((2 * ((bbw + 7) / 8)) != helper.keyword_length())
+ {
+ osd_printf_error("render_font::load_bdf: incorrect length for bitmap line \"%.*s\"\n", int(helper.keyword_length()), &*helper.keyword_begin());
+ return false;
+ }
+ else if (std::find_if(helper.keyword_begin(), helper.keyword_end(), nothex) != helper.keyword_end())
+ {
+ osd_printf_error("render_font::load_bdf: found invalid character in bitmap line \"%.*s\"\n", int(helper.keyword_length()), &*helper.keyword_begin());
+ return false;
+ }
+
+ // track number of rows
+ if (1 == ++bitmap_rows)
+ bitmap_data = &*helper.keyword_begin();
+
}
+ else if (helper.is_keyword("ENCODING"))
+ {
+ // check for duplicate glyph encoding
+ if (have_encoding)
+ {
+ osd_printf_error("render_font::load_bdf: found additional glyph encoding \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ have_encoding = true;
- // BBX tells us the height/width of the bitmap and the offsets
- else if (strncmp(ptr, "BBX ", 4) == 0)
+ // need to support Adobe Standard Encoding "123" and non-standard glyph index "-1 123"
+ std::string const value(helper.value_begin(), helper.value_end());
+ int aux;
+ int const cnt(sscanf(value.c_str(), "%d %d", &encoding, &aux));
+ if ((2 == cnt) && (-1 == encoding) && (0 <= aux))
+ {
+ encoding = aux;
+ }
+ else if ((1 != cnt) || (0 > encoding))
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse glyph encoding \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ LOG("render_font::load_bdf: got glyph encoding %d\n", encoding);
+ }
+ else if (helper.is_keyword("DWIDTH"))
{
- if (sscanf(ptr + 4, "%d %d %d %d", &bmwidth, &bmheight, &xoffs, &yoffs) != 4)
- return 1;
+ // check for duplicate advance
+ if (have_advance)
+ {
+ osd_printf_error("render_font::load_bdf: found additional pixel width \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ have_advance = true;
+
+ // completely ignore vertical advance
+ int yadvance;
+ if (2 == sscanf(&*helper.value_begin(), "%d %d", &xadvance, &yadvance))
+ {
+ LOG("render_font::load_bdf: got pixel width %d,%d\n", xadvance, yadvance);
+ }
+ else
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse pixel width \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
}
+ else if (helper.is_keyword("BBX"))
+ {
+ // check for duplicate black pixel box
+ if (have_bbounds)
+ {
+ osd_printf_error("render_font::load_bdf: found additional pixel width \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ have_bbounds = true;
- // BITMAP is the start of the data
- else if (strncmp(ptr, "BITMAP", 6) == 0)
+ // extract position/size of black pixel area
+ if (4 == sscanf(&*helper.value_begin(), "%d %d %d %d", &bbw, &bbh, &bbxoff, &bbyoff))
+ {
+ LOG("render_font::load_bdf: got black pixel box %dx%d %d,%d\n", bbw, bbh, bbxoff, bbyoff);
+ if ((0 > bbw) || (0 > bbh))
+ {
+ osd_printf_error("render_font::load_bdf: black pixel box is invalid\n");
+ return false;
+ }
+ }
+ else
+ {
+ osd_printf_error("render_font::load_bdf: failed to parse black pixel box \"%.*s\"\n", int(helper.value_length()), &*helper.value_begin());
+ return false;
+ }
+ }
+ else if (helper.is_keyword("BITMAP"))
{
- // stash the raw pointer and scan for the end of the character
- for (rawdata = ptr = next_line(ptr); ptr != nullptr && strncmp(ptr, "ENDCHAR", 7) != 0; ptr = next_line(ptr)) { }
- break;
+ // this is the bitmap - we need to already have properties before we get here
+ if (!have_advance)
+ {
+ osd_printf_error("render_font::load_bdf: glyph has no pixel width\n");
+ return false;
+ }
+ else if (!have_bbounds)
+ {
+ osd_printf_error("render_font::load_bdf: glyph has no black pixel box\n");
+ return false;
+ }
+ in_bitmap = true;
}
}
- // if we have everything, allocate a new character
- if (charnum >= 0 && charnum < (256 * ARRAY_LENGTH(m_glyphs)) && rawdata != nullptr && bmwidth >= 0 && bmheight >= 0)
+ // now check that we have what we need
+ if (!in_bitmap)
+ {
+ osd_printf_error("render_font::load_bdf: glyph has no bitmap\n");
+ return false;
+ }
+ else if (bitmap_rows != bbh)
+ {
+ osd_printf_error("render_font::load_bdf: incorrect number of bitmap lines %d\n", bitmap_rows);
+ return false;
+ }
+
+ // some kinds of characters will screw us up
+ if (0 > xadvance)
+ {
+ LOG("render_font::load_bdf: ignoring character with negative x advance\n");
+ }
+ else if ((256 * ARRAY_LENGTH(m_glyphs)) <= encoding)
+ {
+ LOG("render_font::load_bdf: ignoring character with encoding outside range\n");
+ }
+ else
{
// if we don't have a subtable yet, make one
- if (!m_glyphs[charnum / 256])
- m_glyphs[charnum / 256] = new glyph[256];
+ if (!m_glyphs[encoding / 256])
+ {
+ try
+ {
+ m_glyphs[encoding / 256] = new glyph[256];
+ }
+ catch (...)
+ {
+ osd_printf_error("render_font::load_bdf: allocation failed\n");
+ return false;
+ }
+ }
// fill in the entry
- glyph &gl = m_glyphs[charnum / 256][charnum % 256];
- gl.width = width;
- gl.bmwidth = bmwidth;
- gl.bmheight = bmheight;
- gl.xoffs = xoffs;
- gl.yoffs = yoffs;
- gl.rawdata = rawdata;
+ glyph &gl = m_glyphs[encoding / 256][encoding % 256];
+ gl.width = xadvance;
+ gl.bmwidth = bbw;
+ gl.bmheight = bbh;
+ gl.xoffs = bbxoff;
+ gl.yoffs = bbyoff;
+ gl.rawdata = bitmap_data;
}
// some progress for big fonts
- if (++charcount % 256 == 0)
+ if (0 == (++charcount % 256))
osd_printf_warning("Loading BDF font... (%d characters loaded)\n", charcount);
}
}
- // make sure all the numbers are the same width
- if (m_glyphs[0])
+ // check number of characters
+ if (expected != charcount)
{
- int maxwidth = 0;
- for (int ch = '0'; ch <= '9'; ch++)
- if (m_glyphs[0][ch].bmwidth > maxwidth)
- maxwidth = m_glyphs[0][ch].width;
- for (int ch = '0'; ch <= '9'; ch++)
- m_glyphs[0][ch].width = maxwidth;
+ osd_printf_error("render_font::load_bdf: incorrect character count %d\n", charcount);
+ return false;
}
+ // should have bailed by now if something went wrong
return true;
}
@@ -664,69 +1352,104 @@ bool render_font::load_bdf()
// load_cached - load a font in cached format
//-------------------------------------------------
-bool render_font::load_cached(emu_file &file, u32 hash)
+bool render_font::load_cached(emu_file &file, u64 length, u32 hash)
{
- // get the file size
- u64 filesize = file.size();
-
- // first read the header
- u8 header[CACHED_HEADER_SIZE];
- u32 bytes_read = file.read(header, CACHED_HEADER_SIZE);
- if (bytes_read != CACHED_HEADER_SIZE)
+ // get the file size, read the header, and check that it looks good
+ u64 const filesize(file.size());
+ bdc_header header;
+ if (!header.read(file))
+ {
+ osd_printf_warning("render_font::load_cached: error reading BDC header\n");
return false;
-
- // validate the header
- if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't')
+ }
+ else if (!header.check_magic() || (bdc_header::MAJVERSION != header.get_major_version()) || (bdc_header::MINVERSION != header.get_minor_version()))
+ {
+ LOG("render_font::load_cached: incompatible BDC file\n");
return false;
- if (hash && (header[4] != u8(hash >> 24) || header[5] != u8(hash >> 16) || header[6] != u8(hash >> 8) || header[7] != u8(hash)))
+ }
+ else if (length && ((header.get_original_length() != length) || (header.get_original_hash() != hash)))
+ {
+ LOG("render_font::load_cached: BDC file does not match original BDF file\n");
return false;
- m_height = (header[8] << 8) | header[9];
- m_scale = 1.0f / (float)m_height;
- m_yoffs = s16((header[10] << 8) | header[11]);
- u32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15];
- if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE)
+ }
+
+ // get global properties from the header
+ m_height = header.get_height();
+ m_scale = 1.0f / float(m_height);
+ m_yoffs = header.get_y_offset();
+ m_defchar = header.get_default_character();
+ u32 const numchars(header.get_glyph_count());
+ if ((file.tell() + (u64(numchars) * bdc_table_entry::size())) > filesize)
+ {
+ LOG("render_font::load_cached: BDC file is too small to hold glyph table\n");
return false;
+ }
// now read the rest of the data
- m_rawdata.resize(filesize - CACHED_HEADER_SIZE);
- bytes_read = file.read(&m_rawdata[0], filesize - CACHED_HEADER_SIZE);
- if (bytes_read != filesize - CACHED_HEADER_SIZE)
+ u64 const remaining(filesize - file.tell());
+ try
{
- m_rawdata.clear();
- return false;
+ m_rawdata.resize(std::size_t(remaining));
+ }
+ catch (...)
+ {
+ osd_printf_error("render_font::load_cached: allocation error\n");
+ }
+ for (u64 bytes_read = 0; remaining > bytes_read; )
+ {
+ u32 const chunk((std::min)(u64(std::numeric_limits<u32>::max()), remaining));
+ if (file.read(&m_rawdata[bytes_read], chunk) != chunk)
+ {
+ osd_printf_error("render_font::load_cached: error reading BDC data\n");
+ m_rawdata.clear();
+ return false;
+ }
+ bytes_read += chunk;
}
// extract the data from the data
- u64 offset = numchars * CACHED_CHAR_SIZE;
- for (int chindex = 0; chindex < numchars; chindex++)
+ std::size_t offset(std::size_t(numchars) * bdc_table_entry::size());
+ bdc_table_entry entry(m_rawdata.empty() ? nullptr : &m_rawdata[0]);
+ for (unsigned chindex = 0; chindex < numchars; chindex++, entry = entry.get_next())
{
- const u8 *info = reinterpret_cast<u8 *>(&m_rawdata[chindex * CACHED_CHAR_SIZE]);
- int chnum = (info[0] << 8) | info[1];
-
// if we don't have a subtable yet, make one
+ int const chnum(entry.get_encoding());
+ LOG("render_font::load_cached: loading character %d\n", chnum);
if (!m_glyphs[chnum / 256])
- m_glyphs[chnum / 256] = new glyph[256];
+ {
+ try
+ {
+ m_glyphs[chnum / 256] = new glyph[256];
+ }
+ catch (...)
+ {
+ osd_printf_error("render_font::load_cached: allocation error\n");
+ m_rawdata.clear();
+ return false;
+ }
+ }
// fill in the entry
glyph &gl = m_glyphs[chnum / 256][chnum % 256];
- gl.width = (info[2] << 8) | info[3];
- gl.xoffs = s16((info[4] << 8) | info[5]);
- gl.yoffs = s16((info[6] << 8) | info[7]);
- gl.bmwidth = (info[8] << 8) | info[9];
- gl.bmheight = (info[10] << 8) | info[11];
+ gl.width = entry.get_x_advance();
+ gl.xoffs = entry.get_bb_x_offset();
+ gl.yoffs = entry.get_bb_y_offset();
+ gl.bmwidth = entry.get_bb_width();
+ gl.bmheight = entry.get_bb_height();
gl.rawdata = &m_rawdata[offset];
// advance the offset past the character
offset += (gl.bmwidth * gl.bmheight + 7) / 8;
- if (offset > filesize - CACHED_HEADER_SIZE)
+ if (m_rawdata.size() < offset)
{
+ osd_printf_verbose("render_font::load_cached: BDC file too small to hold all glyphs\n");
m_rawdata.clear();
return false;
}
}
- // reuse the chartable as a temporary buffer
- m_format = FF_CACHED;
+ // got everything
+ m_format = format::CACHED;
return true;
}
@@ -735,76 +1458,73 @@ bool render_font::load_cached(emu_file &file, u32 hash)
// save_cached - save a font in cached format
//-------------------------------------------------
-bool render_font::save_cached(const char *filename, u32 hash)
+bool render_font::save_cached(const char *filename, u64 length, u32 hash)
{
osd_printf_warning("Generating cached BDF font...\n");
// attempt to open the file
emu_file file(m_manager.machine().options().font_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE);
- osd_file::error filerr = file.open(filename);
- if (filerr != osd_file::error::NONE)
+ osd_file::error const filerr = file.open(filename);
+ if (osd_file::error::NONE != filerr)
return false;
- // determine the number of characters
- int numchars = 0;
- for (int chnum = 0; chnum < (256 * ARRAY_LENGTH(m_glyphs)); chnum++)
+ // count glyphs
+ unsigned numchars = 0;
+ for (glyph const *const page : m_glyphs)
{
- if (m_glyphs[chnum / 256])
+ for (unsigned chnum = 0; page && (256 > chnum); ++chnum)
{
- glyph &gl = m_glyphs[chnum / 256][chnum % 256];
- if (gl.width > 0)
- numchars++;
+ if (0 < page[chnum].width)
+ ++numchars;
}
}
+ LOG("render_font::save_cached: %u glyphs with positive advance to save\n", numchars);
try
{
+ u32 bytes_written;
+
+ {
+ LOG("render_font::save_cached: writing header\n");
+ bdc_header hdr;
+ hdr.set_magic();
+ hdr.set_version();
+ hdr.set_original_length(length);
+ hdr.set_original_hash(hash);
+ hdr.set_glyph_count(numchars);
+ hdr.set_height(m_height);
+ hdr.set_y_offset(m_yoffs);
+ hdr.set_default_character(m_defchar);
+ if (!hdr.write(file))
+ throw emu_fatalerror("Error writing cached file");
+ }
+ u64 const table_offs(file.tell());
+
// allocate an array to hold the character data
- std::vector<u8> chartable(numchars * CACHED_CHAR_SIZE, 0);
+ std::vector<u8> chartable(std::size_t(numchars) * bdc_table_entry::size(), 0);
// allocate a temp buffer to compress into
std::vector<u8> tempbuffer(65536);
- // write the header
- u8 *dest = &tempbuffer[0];
- *dest++ = 'f';
- *dest++ = 'o';
- *dest++ = 'n';
- *dest++ = 't';
- *dest++ = hash >> 24;
- *dest++ = hash >> 16;
- *dest++ = hash >> 8;
- *dest++ = hash & 0xff;
- *dest++ = m_height >> 8;
- *dest++ = m_height & 0xff;
- *dest++ = m_yoffs >> 8;
- *dest++ = m_yoffs & 0xff;
- *dest++ = numchars >> 24;
- *dest++ = numchars >> 16;
- *dest++ = numchars >> 8;
- *dest++ = numchars & 0xff;
- assert(dest == &tempbuffer[CACHED_HEADER_SIZE]);
- u32 bytes_written = file.write(&tempbuffer[0], CACHED_HEADER_SIZE);
- if (bytes_written != dest - &tempbuffer[0])
- throw emu_fatalerror("Error writing cached file");
-
// write the empty table to the beginning of the file
- bytes_written = file.write(&chartable[0], numchars * CACHED_CHAR_SIZE);
- if (bytes_written != numchars * CACHED_CHAR_SIZE)
+ bytes_written = file.write(&chartable[0], chartable.size());
+ if (bytes_written != chartable.size())
throw emu_fatalerror("Error writing cached file");
// loop over all characters
- int tableindex = 0;
- for (int chnum = 0; chnum < (256 * ARRAY_LENGTH(m_glyphs)); chnum++)
+ bdc_table_entry table_entry(chartable.empty() ? nullptr : &chartable[0]);
+ for (unsigned chnum = 0; chnum < (256 * ARRAY_LENGTH(m_glyphs)); chnum++)
{
- glyph &gl = get_char(chnum);
- if (gl.width > 0)
+ if (m_glyphs[chnum / 256] && (0 < m_glyphs[chnum / 256][chnum % 256].width))
{
+ LOG("render_font::save_cached: writing glyph %u\n", chnum);
+ glyph &gl(get_char(chnum));
+
// write out a bit-compressed bitmap if we have one
if (gl.bitmap.valid())
{
// write the data to the tempbuffer
- dest = &tempbuffer[0];
+ u8 *dest = &tempbuffer[0];
u8 accum = 0;
u8 accbit = 7;
@@ -842,27 +1562,34 @@ bool render_font::save_cached(const char *filename, u32 hash)
}
// compute the table entry
- dest = &chartable[tableindex++ * CACHED_CHAR_SIZE];
- *dest++ = chnum >> 8;
- *dest++ = chnum & 0xff;
- *dest++ = gl.width >> 8;
- *dest++ = gl.width & 0xff;
- *dest++ = gl.xoffs >> 8;
- *dest++ = gl.xoffs & 0xff;
- *dest++ = gl.yoffs >> 8;
- *dest++ = gl.yoffs & 0xff;
- *dest++ = gl.bmwidth >> 8;
- *dest++ = gl.bmwidth & 0xff;
- *dest++ = gl.bmheight >> 8;
- *dest++ = gl.bmheight & 0xff;
+ table_entry.set_encoding(chnum);
+ table_entry.set_x_advance(gl.width);
+ table_entry.set_bb_x_offset(gl.xoffs);
+ table_entry.set_bb_y_offset(gl.yoffs);
+ table_entry.set_bb_width(gl.bmwidth);
+ table_entry.set_bb_height(gl.bmheight);
+ table_entry = table_entry.get_next();
}
}
// seek back to the beginning and rewrite the table
- file.seek(CACHED_HEADER_SIZE, SEEK_SET);
- bytes_written = file.write(&chartable[0], numchars * CACHED_CHAR_SIZE);
- if (bytes_written != numchars * CACHED_CHAR_SIZE)
- throw emu_fatalerror("Error writing cached file");
+ if (!chartable.empty())
+ {
+ LOG("render_font::save_cached: writing character table\n");
+ file.seek(table_offs, SEEK_SET);
+ u8 const *bytes(&chartable[0]);
+ for (u64 remaining = chartable.size(); remaining; )
+ {
+ u32 const chunk((std::min<u64>)(std::numeric_limits<u32>::max(), remaining));
+ bytes_written = file.write(bytes, chunk);
+ if (chunk != bytes_written)
+ throw emu_fatalerror("Error writing cached file");
+ bytes += chunk;
+ remaining -= chunk;
+ }
+ }
+
+ // no trouble?
return true;
}
catch (...)
@@ -871,3 +1598,99 @@ bool render_font::save_cached(const char *filename, u32 hash)
return false;
}
}
+
+
+void render_font::render_font_command_glyph()
+{
+ // FIXME: this is copy/pasta from the BDC loading, and it shouldn't be injected into every font
+ emu_file file(OPEN_FLAG_READ);
+ if (file.open_ram(font_uicmd14, sizeof(font_uicmd14)) == osd_file::error::NONE)
+ {
+ // get the file size, read the header, and check that it looks good
+ u64 const filesize(file.size());
+ bdc_header header;
+ if (!header.read(file))
+ {
+ osd_printf_warning("render_font::render_font_command_glyph: error reading BDC header\n");
+ return;
+ }
+ else if (!header.check_magic() || (bdc_header::MAJVERSION != header.get_major_version()) || (bdc_header::MINVERSION != header.get_minor_version()))
+ {
+ LOG("render_font::render_font_command_glyph: incompatible BDC file\n");
+ return;
+ }
+
+ // get global properties from the header
+ m_height_cmd = header.get_height();
+ m_yoffs_cmd = header.get_y_offset();
+ u32 const numchars(header.get_glyph_count());
+ if ((file.tell() + (u64(numchars) * bdc_table_entry::size())) > filesize)
+ {
+ LOG("render_font::render_font_command_glyph: BDC file is too small to hold glyph table\n");
+ return;
+ }
+
+ // now read the rest of the data
+ u64 const remaining(filesize - file.tell());
+ try
+ {
+ m_rawdata_cmd.resize(std::size_t(remaining));
+ }
+ catch (...)
+ {
+ osd_printf_error("render_font::render_font_command_glyph: allocation error\n");
+ }
+ for (u64 bytes_read = 0; remaining > bytes_read; )
+ {
+ u32 const chunk((std::min)(u64(std::numeric_limits<u32>::max()), remaining));
+ if (file.read(&m_rawdata_cmd[bytes_read], chunk) != chunk)
+ {
+ osd_printf_error("render_font::render_font_command_glyph: error reading BDC data\n");
+ m_rawdata_cmd.clear();
+ return;
+ }
+ bytes_read += chunk;
+ }
+
+ // extract the data from the data
+ std::size_t offset(std::size_t(numchars) * bdc_table_entry::size());
+ bdc_table_entry entry(m_rawdata_cmd.empty() ? nullptr : &m_rawdata_cmd[0]);
+ for (unsigned chindex = 0; chindex < numchars; chindex++, entry = entry.get_next())
+ {
+ // if we don't have a subtable yet, make one
+ int const chnum(entry.get_encoding());
+ LOG("render_font::render_font_command_glyph: loading character %d\n", chnum);
+ if (!m_glyphs_cmd[chnum / 256])
+ {
+ try
+ {
+ m_glyphs_cmd[chnum / 256] = new glyph[256];
+ }
+ catch (...)
+ {
+ osd_printf_error("render_font::render_font_command_glyph: allocation error\n");
+ m_rawdata_cmd.clear();
+ return;
+ }
+ }
+
+ // fill in the entry
+ glyph &gl = m_glyphs_cmd[chnum / 256][chnum % 256];
+ gl.width = entry.get_x_advance();
+ gl.xoffs = entry.get_bb_x_offset();
+ gl.yoffs = entry.get_bb_y_offset();
+ gl.bmwidth = entry.get_bb_width();
+ gl.bmheight = entry.get_bb_height();
+ gl.rawdata = &m_rawdata_cmd[offset];
+
+ // advance the offset past the character
+ offset += (gl.bmwidth * gl.bmheight + 7) / 8;
+ if (m_rawdata_cmd.size() < offset)
+ {
+ osd_printf_verbose("render_font::render_font_command_glyph: BDC file too small to hold all glyphs\n");
+ m_rawdata_cmd.clear();
+ return;
+ }
+ }
+ }
+}
diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h
index 558b5c55aa5..589388855a6 100644
--- a/src/emu/rendfont.h
+++ b/src/emu/rendfont.h
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders:Aaron Giles, Vas Crabb
/***************************************************************************
rendfont.h
@@ -8,8 +8,8 @@
***************************************************************************/
-#ifndef __RENDFONT_H__
-#define __RENDFONT_H__
+#ifndef MAME_EMU_RENDFONT_H
+#define MAME_EMU_RENDFONT_H
#include "render.h"
@@ -53,11 +53,15 @@ private:
{
public:
glyph()
- : width(0),
- xoffs(0), yoffs(0),
- bmwidth(0), bmheight(0),
- rawdata(nullptr),
- texture(nullptr) { }
+ : width(-1)
+ , xoffs(-1), yoffs(-1)
+ , bmwidth(0), bmheight(0)
+ , rawdata(nullptr)
+ , texture(nullptr)
+ , bitmap()
+ , color()
+ {
+ }
s32 width; // width from this character to the next
s32 xoffs, yoffs; // X and Y offset from baseline to top,left of bitmap
@@ -67,16 +71,15 @@ private:
bitmap_argb32 bitmap; // pointer to the bitmap containing the raw data
rgb_t color;
-
};
// internal format
- enum format
+ enum class format
{
- FF_UNKNOWN,
- FF_TEXT,
- FF_CACHED,
- FF_OSD
+ UNKNOWN,
+ TEXT,
+ CACHED,
+ OSD
};
// helpers
@@ -84,9 +87,8 @@ private:
void char_expand(char32_t chnum, glyph &ch);
bool load_cached_bdf(const char *filename);
bool load_bdf();
- bool load_cached(emu_file &file, u32 hash);
- bool load_cached_cmd(emu_file &file, u32 hash);
- bool save_cached(const char *filename, u32 hash);
+ bool load_cached(emu_file &file, u64 length, u32 hash);
+ bool save_cached(const char *filename, u64 length, u32 hash);
void render_font_command_glyph();
@@ -95,6 +97,7 @@ private:
format m_format; // format of font data
int m_height; // height of the font, from ascent to descent
int m_yoffs; // y offset from baseline to descent
+ int m_defchar; // default substitute character
float m_scale; // 1 / height precomputed
glyph *m_glyphs[17*256]; // array of glyph subtables
std::vector<char> m_rawdata; // pointer to the raw data for the font
@@ -107,11 +110,9 @@ private:
std::vector<char> m_rawdata_cmd; // pointer to the raw data for the font
// constants
- static const int CACHED_CHAR_SIZE = 12;
- static const int CACHED_HEADER_SIZE = 16;
static const u64 CACHED_BDF_HASH_SIZE = 1024;
};
void convert_command_glyph(std::string &s);
-#endif /* __RENDFONT_H__ */
+#endif /* MAME_EMU_RENDFONT_H */
diff --git a/src/emu/ui/cmddata.h b/src/emu/ui/cmddata.h
index 14c09c73883..675195f7c76 100644
--- a/src/emu/ui/cmddata.h
+++ b/src/emu/ui/cmddata.h
@@ -50,7 +50,7 @@ enum
#define COMMAND_CONVERT_TEXT '@'
// Defined Game Command Font Color Array
-static rgb_t color_table[] =
+static rgb_t const color_table[] =
{
0, // dummy
BUTTON_COLOR_RED, // BTN_A
@@ -147,19 +147,19 @@ static rgb_t color_table[] =
struct fix_command_t
{
- unsigned char glyph_char;
- const int glyph_code;
+ char glyph_char;
+ unsigned glyph_code;
};
struct fix_strings_t
{
- const char *glyph_str;
- const int glyph_code;
- int glyph_str_len;
+ char const *glyph_str;
+ int const glyph_code;
+ unsigned glyph_str_len;
};
-static fix_command_t default_text[] =
+static fix_command_t const default_text[] =
{
// Alphabetic Buttons (NeoGeo): A~D,H,Z
{ 'A', 1 }, // BTN_A
@@ -248,7 +248,7 @@ static fix_command_t default_text[] =
{ 0, 0 } // end of array
};
-static fix_command_t expand_text[] =
+static fix_command_t const expand_text[] =
{
// Alphabetic Buttons (NeoGeo): S (Slash Button)
{ 's', 19 }, // BTN_S
@@ -289,114 +289,114 @@ static fix_command_t expand_text[] =
static fix_strings_t convert_text[] =
{
// Alphabetic Buttons: A~Z
- { "A-button", 1 }, // BTN_A
- { "B-button", 2 }, // BTN_B
- { "C-button", 3 }, // BTN_C
- { "D-button", 4 }, // BTN_D
- { "E-button", 5 }, // BTN_E
- { "F-button", 6 }, // BTN_F
- { "G-button", 7 }, // BTN_G
- { "H-button", 8 }, // BTN_H
- { "I-button", 9 }, // BTN_I
- { "J-button", 10 }, // BTN_J
- { "K-button", 11 }, // BTN_K
- { "L-button", 12 }, // BTN_L
- { "M-button", 13 }, // BTN_M
- { "N-button", 14 }, // BTN_N
- { "O-button", 15 }, // BTN_O
- { "P-button", 16 }, // BTN_P
- { "Q-button", 17 }, // BTN_Q
- { "R-button", 18 }, // BTN_R
- { "S-button", 19 }, // BTN_S
- { "T-button", 20 }, // BTN_T
- { "U-button", 21 }, // BTN_U
- { "V-button", 22 }, // BTN_V
- { "W-button", 23 }, // BTN_W
- { "X-button", 24 }, // BTN_X
- { "Y-button", 25 }, // BTN_Y
- { "Z-button", 26 }, // BTN_Z
+ { "A-button", 1, 0 }, // BTN_A
+ { "B-button", 2, 0 }, // BTN_B
+ { "C-button", 3, 0 }, // BTN_C
+ { "D-button", 4, 0 }, // BTN_D
+ { "E-button", 5, 0 }, // BTN_E
+ { "F-button", 6, 0 }, // BTN_F
+ { "G-button", 7, 0 }, // BTN_G
+ { "H-button", 8, 0 }, // BTN_H
+ { "I-button", 9, 0 }, // BTN_I
+ { "J-button", 10, 0 }, // BTN_J
+ { "K-button", 11, 0 }, // BTN_K
+ { "L-button", 12, 0 }, // BTN_L
+ { "M-button", 13, 0 }, // BTN_M
+ { "N-button", 14, 0 }, // BTN_N
+ { "O-button", 15, 0 }, // BTN_O
+ { "P-button", 16, 0 }, // BTN_P
+ { "Q-button", 17, 0 }, // BTN_Q
+ { "R-button", 18, 0 }, // BTN_R
+ { "S-button", 19, 0 }, // BTN_S
+ { "T-button", 20, 0 }, // BTN_T
+ { "U-button", 21, 0 }, // BTN_U
+ { "V-button", 22, 0 }, // BTN_V
+ { "W-button", 23, 0 }, // BTN_W
+ { "X-button", 24, 0 }, // BTN_X
+ { "Y-button", 25, 0 }, // BTN_Y
+ { "Z-button", 26, 0 }, // BTN_Z
// Special Moves and Buttons
- { "decrease", 37 }, // BTN_DEC
- { "increase", 38 }, // BTN_INC
- { "BALL", 45 }, // Joystick Ball
- { "start", 51 }, // BTN_START
- { "select", 52 }, // BTN_SELECT
- { "punch", 53 }, // BTN_PUNCH
- { "kick", 54 }, // BTN_KICK
- { "guard", 55 }, // BTN_GUARD
- { "L-punch", 57 }, // Light Punch
- { "M-punch", 58 }, // Middle Punch
- { "S-punch", 59 }, // Strong Punch
- { "L-kick", 60 }, // Light Kick
- { "M-kick", 61 }, // Middle Kick
- { "S-kick", 62 }, // Strong Kick
- { "3-kick", 63 }, // 3 Kick
- { "3-punch", 64 }, // 3 Punch
- { "2-kick", 65 }, // 2 Kick
- { "2-punch", 66 }, // 2 Pick
+ { "decrease", 37, 0 }, // BTN_DEC
+ { "increase", 38, 0 }, // BTN_INC
+ { "BALL", 45, 0 }, // Joystick Ball
+ { "start", 51, 0 }, // BTN_START
+ { "select", 52, 0 }, // BTN_SELECT
+ { "punch", 53, 0 }, // BTN_PUNCH
+ { "kick", 54, 0 }, // BTN_KICK
+ { "guard", 55, 0 }, // BTN_GUARD
+ { "L-punch", 57, 0 }, // Light Punch
+ { "M-punch", 58, 0 }, // Middle Punch
+ { "S-punch", 59, 0 }, // Strong Punch
+ { "L-kick", 60, 0 }, // Light Kick
+ { "M-kick", 61, 0 }, // Middle Kick
+ { "S-kick", 62, 0 }, // Strong Kick
+ { "3-kick", 63, 0 }, // 3 Kick
+ { "3-punch", 64, 0 }, // 3 Punch
+ { "2-kick", 65, 0 }, // 2 Kick
+ { "2-punch", 66, 0 }, // 2 Pick
// Custom Buttons and Cursor Buttons
- { "custom1", 67 }, // CUSTOM_1
- { "custom2", 68 }, // CUSTOM_2
- { "custom3", 69 }, // CUSTOM_3
- { "custom4", 70 }, // CUSTOM_4
- { "custom5", 71 }, // CUSTOM_5
- { "custom6", 72 }, // CUSTOM_6
- { "custom7", 73 }, // CUSTOM_7
- { "custom8", 74 }, // CUSTOM_8
- { "up", 75 }, // (Cursor Up)
- { "down", 76 }, // (Cursor Down)
- { "left", 77 }, // (Cursor Left)
- { "right", 78 }, // (Cursor Right)
+ { "custom1", 67, 0 }, // CUSTOM_1
+ { "custom2", 68, 0 }, // CUSTOM_2
+ { "custom3", 69, 0 }, // CUSTOM_3
+ { "custom4", 70, 0 }, // CUSTOM_4
+ { "custom5", 71, 0 }, // CUSTOM_5
+ { "custom6", 72, 0 }, // CUSTOM_6
+ { "custom7", 73, 0 }, // CUSTOM_7
+ { "custom8", 74, 0 }, // CUSTOM_8
+ { "up", 75, 0 }, // (Cursor Up)
+ { "down", 76, 0 }, // (Cursor Down)
+ { "left", 77, 0 }, // (Cursor Left)
+ { "right", 78, 0 }, // (Cursor Right)
// Player Lever
- { "lever", 79 }, // Non Player Lever
- { "nplayer", 80 }, // Gray Color Lever
- { "1player", 81 }, // 1 Player Lever
- { "2player", 82 }, // 2 Player Lever
- { "3player", 83 }, // 3 Player Lever
- { "4player", 84 }, // 4 Player Lever
- { "5player", 85 }, // 5 Player Lever
- { "6player", 86 }, // 6 Player Lever
- { "7player", 87 }, // 7 Player Lever
- { "8player", 88 }, // 8 Player Lever
+ { "lever", 79, 0 }, // Non Player Lever
+ { "nplayer", 80, 0 }, // Gray Color Lever
+ { "1player", 81, 0 }, // 1 Player Lever
+ { "2player", 82, 0 }, // 2 Player Lever
+ { "3player", 83, 0 }, // 3 Player Lever
+ { "4player", 84, 0 }, // 4 Player Lever
+ { "5player", 85, 0 }, // 5 Player Lever
+ { "6player", 86, 0 }, // 6 Player Lever
+ { "7player", 87, 0 }, // 7 Player Lever
+ { "8player", 88, 0 }, // 8 Player Lever
// Composition of Arrow Directions
- { "-->", 90 }, // Arrow
- { "==>", 91 }, // Continue Arrow
- { "hcb", 100 }, // Half Circle Back
- { "huf", 101 }, // Half Circle Front Up
- { "hcf", 102 }, // Half Circle Front
- { "hub", 103 }, // Half Circle Back Up
- { "qfd", 104 }, // 1/4 Cir For 2 Down
- { "qdb", 105 }, // 1/4 Cir Down 2 Back
- { "qbu", 106 }, // 1/4 Cir Back 2 Up
- { "quf", 107 }, // 1/4 Cir Up 2 For
- { "qbd", 108 }, // 1/4 Cir Back 2 Down
- { "qdf", 109 }, // 1/4 Cir Down 2 For
- { "qfu", 110 }, // 1/4 Cir For 2 Up
- { "qub", 111 }, // 1/4 Cir Up 2 Back
- { "fdf", 112 }, // Full Clock Forward
- { "fub", 113 }, // Full Clock Back
- { "fuf", 114 }, // Full Count Forward
- { "fdb", 115 }, // Full Count Back
- { "xff", 116 }, // 2x Forward
- { "xbb", 117 }, // 2x Back
- { "dsf", 118 }, // Dragon Screw Forward
- { "dsb", 119 }, // Dragon Screw Back
+ { "-->", 90, 0 }, // Arrow
+ { "==>", 91, 0 }, // Continue Arrow
+ { "hcb", 100, 0 }, // Half Circle Back
+ { "huf", 101, 0 }, // Half Circle Front Up
+ { "hcf", 102, 0 }, // Half Circle Front
+ { "hub", 103, 0 }, // Half Circle Back Up
+ { "qfd", 104, 0 }, // 1/4 Cir For 2 Down
+ { "qdb", 105, 0 }, // 1/4 Cir Down 2 Back
+ { "qbu", 106, 0 }, // 1/4 Cir Back 2 Up
+ { "quf", 107, 0 }, // 1/4 Cir Up 2 For
+ { "qbd", 108, 0 }, // 1/4 Cir Back 2 Down
+ { "qdf", 109, 0 }, // 1/4 Cir Down 2 For
+ { "qfu", 110, 0 }, // 1/4 Cir For 2 Up
+ { "qub", 111, 0 }, // 1/4 Cir Up 2 Back
+ { "fdf", 112, 0 }, // Full Clock Forward
+ { "fub", 113, 0 }, // Full Clock Back
+ { "fuf", 114, 0 }, // Full Count Forward
+ { "fdb", 115, 0 }, // Full Count Back
+ { "xff", 116, 0 }, // 2x Forward
+ { "xbb", 117, 0 }, // 2x Back
+ { "dsf", 118, 0 }, // Dragon Screw Forward
+ { "dsb", 119, 0 }, // Dragon Screw Back
// Big letter Text
- { "AIR", 121 }, // AIR
- { "DIR", 122 }, // DIR
- { "MAX", 123 }, // MAX
- { "TAP", 124 }, // TAP
+ { "AIR", 121, 0 }, // AIR
+ { "DIR", 122, 0 }, // DIR
+ { "MAX", 123, 0 }, // MAX
+ { "TAP", 124, 0 }, // TAP
// Condition of Positions
- { "jump", 125 }, // Jump
- { "hold", 126 }, // Hold
- { "air", 127 }, // Air
- { "sit", 128 }, // Squatting
- { "close", 129 }, // Close
- { "away", 130 }, // Away
- { "charge", 131 }, // Charge
- { "tap", 132 }, // Serious Tap
- { "button", 133 }, // Any Button
- { nullptr, 0 } // end of array
+ { "jump", 125, 0 }, // Jump
+ { "hold", 126, 0 }, // Hold
+ { "air", 127, 0 }, // Air
+ { "sit", 128, 0 }, // Squatting
+ { "close", 129, 0 }, // Close
+ { "away", 130, 0 }, // Away
+ { "charge", 131, 0 }, // Charge
+ { "tap", 132, 0 }, // Serious Tap
+ { "button", 133, 0 }, // Any Button
+ { nullptr, 0, 0 } // end of array
};
#endif /* __UI_CMDDATA_H__ */
diff --git a/src/emu/ui/cmdrender.h b/src/emu/ui/cmdrender.h
deleted file mode 100644
index 905b681f746..00000000000
--- a/src/emu/ui/cmdrender.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Maurizio Petrarota
-/***************************************************************************
-
- ui/cmdrender.h
-
- UI command render fonts.
-
-***************************************************************************/
-
-#include "ui/uicmd14.fh"
-#include "ui/cmddata.h"
-
-void convert_command_glyph(std::string &str)
-{
- int j;
- int len = str.length();
- int buflen = (len + 2) * 2;
- char *d = global_alloc_array(char, buflen);
-
- for (int i = j = 0; i < len;)
- {
- fix_command_t *fixcmd = nullptr;
- char32_t uchar;
- int ucharcount = uchar_from_utf8(&uchar, str.substr(i).c_str(), len - i);
- if (ucharcount == -1)
- break;
- else if (ucharcount != 1)
- goto process_next;
- else if (str[i] == '\n')
- uchar = '\n';
- else if (str[i] == COMMAND_CONVERT_TEXT)
- {
- if (str[i] == str[i + 1])
- ++i;
- else
- {
- fix_strings_t *fixtext = convert_text;
- for (; fixtext->glyph_code; ++fixtext)
- {
- if (!fixtext->glyph_str_len)
- fixtext->glyph_str_len = strlen(fixtext->glyph_str);
-
- if (strncmp(fixtext->glyph_str, str.substr(i + 1).c_str(), fixtext->glyph_str_len) == 0)
- {
- uchar = fixtext->glyph_code + COMMAND_UNICODE;
- i += strlen(fixtext->glyph_str);
- break;
- }
- }
- }
- }
- else if (str[i] == COMMAND_DEFAULT_TEXT)
- fixcmd = default_text;
- else if (str[i] == COMMAND_EXPAND_TEXT)
- fixcmd = expand_text;
-
- if (fixcmd)
- {
- if (str[i] == str[i + 1])
- i++;
- else
- {
- for (; fixcmd->glyph_code; ++fixcmd)
- if (str[i + 1] == fixcmd->glyph_char)
- {
- uchar = fixcmd->glyph_code + COMMAND_UNICODE;
- ++i;
- break;
- }
- }
- }
-process_next:
- i += ucharcount;
- ucharcount = utf8_from_uchar(d + j, buflen - j - 1, uchar);
- if (ucharcount == -1)
- break;
- j += ucharcount;
- }
- d[j] = '\0';
- str = d;
- global_free_array(d);
-}
-
-void render_font::render_font_command_glyph()
-{
- emu_file ramfile(OPEN_FLAG_READ);
-
- if (ramfile.open_ram(font_uicmd14, sizeof(font_uicmd14)) == osd_file::error::NONE)
- load_cached_cmd(ramfile, 0);
-}
-
-bool render_font::load_cached_cmd(emu_file &file, u32 hash)
-{
- u64 filesize = file.size();
- u8 header[CACHED_HEADER_SIZE];
- u32 bytes_read = file.read(header, CACHED_HEADER_SIZE);
-
- if (bytes_read != CACHED_HEADER_SIZE)
- return false;
-
- if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't')
- return false;
- if (header[4] != u8(hash >> 24) || header[5] != u8(hash >> 16) || header[6] != u8(hash >> 8) || header[7] != u8(hash))
- return false;
- m_height_cmd = (header[8] << 8) | header[9];
- m_yoffs_cmd = s16((header[10] << 8) | header[11]);
- u32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15];
- if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE)
- return false;
-
- m_rawdata_cmd.resize(filesize - CACHED_HEADER_SIZE);
- bytes_read = file.read(&m_rawdata_cmd[0], filesize - CACHED_HEADER_SIZE);
- if (bytes_read != filesize - CACHED_HEADER_SIZE)
- {
- m_rawdata_cmd.clear();
- return false;
- }
-
- u64 offset = numchars * CACHED_CHAR_SIZE;
- for (int chindex = 0; chindex < numchars; chindex++)
- {
- const u8 *info = reinterpret_cast<u8 *>(&m_rawdata_cmd[chindex * CACHED_CHAR_SIZE]);
- int chnum = (info[0] << 8) | info[1];
-
- if (!m_glyphs_cmd[chnum / 256])
- m_glyphs_cmd[chnum / 256] = new glyph[256];
-
- glyph &gl = m_glyphs_cmd[chnum / 256][chnum % 256];
-
- if (chnum >= COMMAND_UNICODE && chnum < COMMAND_UNICODE + COLOR_BUTTONS)
- gl.color = color_table[chnum - COMMAND_UNICODE];
-
- gl.width = (info[2] << 8) | info[3];
- gl.xoffs = s16((info[4] << 8) | info[5]);
- gl.yoffs = s16((info[6] << 8) | info[7]);
- gl.bmwidth = (info[8] << 8) | info[9];
- gl.bmheight = (info[10] << 8) | info[11];
- gl.rawdata = &m_rawdata_cmd[offset];
-
- offset += (gl.bmwidth * gl.bmheight + 7) / 8;
- if (offset > filesize - CACHED_HEADER_SIZE)
- {
- m_rawdata_cmd.clear();
- return false;
- }
- }
-
- return true;
-}
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp
index 84c0300d628..9c9ba409a93 100644
--- a/src/frontend/mame/ui/selmenu.cpp
+++ b/src/frontend/mame/ui/selmenu.cpp
@@ -78,8 +78,8 @@ menu_select_launch::cache::cache(running_machine &machine)
, m_snapx_texture()
, m_snapx_driver(nullptr)
, m_snapx_software(nullptr)
- , m_no_avail_bitmap(std::make_unique<bitmap_argb32>(256, 256))
- , m_star_bitmap(std::make_unique<bitmap_argb32>(32, 32))
+ , m_no_avail_bitmap(256, 256)
+ , m_star_bitmap(32, 32)
, m_star_texture()
, m_toolbar_bitmap()
, m_sw_toolbar_bitmap()
@@ -92,11 +92,11 @@ menu_select_launch::cache::cache(running_machine &machine)
// create a texture for snapshot
m_snapx_texture = texture_ptr(render.texture_alloc(render_texture::hq_scale), texture_free);
- std::memcpy(&m_no_avail_bitmap->pix32(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t));
+ std::memcpy(&m_no_avail_bitmap.pix32(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.pix32(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t));
m_star_texture = texture_ptr(render.texture_alloc(), texture_free);
- m_star_texture->set_bitmap(*m_star_bitmap, m_star_bitmap->cliprect(), TEXFORMAT_ARGB32);
+ m_star_texture->set_bitmap(m_star_bitmap, m_star_bitmap.cliprect(), TEXFORMAT_ARGB32);
m_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
m_sw_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
@@ -105,28 +105,28 @@ menu_select_launch::cache::cache(running_machine &machine)
for (std::size_t i = 0; i < UI_TOOLBAR_BUTTONS; ++i)
{
- m_toolbar_bitmap.emplace_back(std::make_unique<bitmap_argb32>(32, 32));
- m_sw_toolbar_bitmap.emplace_back(std::make_unique<bitmap_argb32>(32, 32));
+ m_toolbar_bitmap.emplace_back(32, 32);
+ m_sw_toolbar_bitmap.emplace_back(32, 32);
m_toolbar_texture.emplace_back(texture_ptr(render.texture_alloc(), texture_free));
m_sw_toolbar_texture.emplace_back(texture_ptr(render.texture_alloc(), texture_free));
- std::memcpy(&m_toolbar_bitmap.back()->pix32(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);
+ std::memcpy(&m_toolbar_bitmap.back().pix32(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
- m_toolbar_bitmap.back()->reset();
+ m_toolbar_bitmap.back().reset();
if ((i == 0U) || (i == 2U))
{
- std::memcpy(&m_sw_toolbar_bitmap.back()->pix32(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);
+ std::memcpy(&m_sw_toolbar_bitmap.back().pix32(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
- m_sw_toolbar_bitmap.back()->reset();
+ m_sw_toolbar_bitmap.back().reset();
}
else
{
- m_sw_toolbar_bitmap.back()->reset();
+ m_sw_toolbar_bitmap.back().reset();
}
}
}
@@ -139,12 +139,6 @@ menu_select_launch::cache::~cache()
menu_select_launch::~menu_select_launch()
{
- // need to manually clean up icon textures for now
- for (auto &texture : m_icons_texture)
- {
- if (texture)
- machine().render().texture_free(texture);
- }
}
@@ -164,6 +158,7 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c
, m_pressed(false)
, m_repeat(0)
, m_right_visible_lines(0)
+ , m_icons(MAX_ICONS_RENDER)
{
// set up persistent cache for machine run
{
@@ -181,18 +176,6 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c
add_cleanup_callback(&menu_select_launch::exit);
}
}
-
- // initialise icon cache
- if (is_swlist)
- {
- std::fill(std::begin(m_icons_texture), std::end(m_icons_texture), nullptr);
- }
- else
- {
- std::generate(std::begin(m_icons_texture), std::end(m_icons_texture), [&render = machine().render()]() { return render.texture_alloc(); });
- std::generate(std::begin(m_icons_bitmap), std::end(m_icons_bitmap), []() { return std::make_unique<bitmap_argb32>(); });
- }
- std::fill(std::begin(m_old_icons), std::end(m_old_icons), nullptr);
}
@@ -551,9 +534,9 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
y2 -= UI_BOX_TB_BORDER;
texture_ptr_vector const &t_texture(m_is_swlist ? m_cache->sw_toolbar_texture() : m_cache->toolbar_texture());
- bitmap_ptr_vector const &t_bitmap(m_is_swlist ? m_cache->sw_toolbar_bitmap() : m_cache->toolbar_bitmap());
+ bitmap_vector const &t_bitmap(m_is_swlist ? m_cache->sw_toolbar_bitmap() : m_cache->toolbar_bitmap());
- auto const num_valid(std::count_if(std::begin(t_bitmap), std::end(t_bitmap), [](bitmap_ptr const &e) { return e && e->valid(); }));
+ auto const num_valid(std::count_if(std::begin(t_bitmap), std::end(t_bitmap), [](bitmap_argb32 const &e) { return e.valid(); }));
float const space_x = (y2 - y1) * container().manager().ui_aspect(&container());
float const total = (float(num_valid) * space_x) + (float(num_valid - 1) * 0.001f);
@@ -562,7 +545,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
for (int z = 0; z < UI_TOOLBAR_BUTTONS; ++z)
{
- if (t_bitmap[z] && t_bitmap[z]->valid())
+ if (t_bitmap[z].valid())
{
rgb_t color(0xEFEFEFEF);
if (mouse_in_rect(x1, y1, x2, y2))
@@ -624,9 +607,17 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
auto x1 = x0 + ud_arrow_width;
auto y1 = y0 + ui().get_line_height();
- if (m_old_icons[linenum] != driver || ui_globals::redraw_icon)
+ icon_cache::iterator icon(m_icons.find(driver));
+ if ((m_icons.end() == icon) || ui_globals::redraw_icon)
{
- m_old_icons[linenum] = driver;
+ if (m_icons.end() == icon)
+ {
+ texture_ptr texture(machine().render().texture_alloc(), [&render = machine().render()] (render_texture *texture) { render.texture_free(texture); });
+ icon = m_icons.emplace(
+ std::piecewise_construct,
+ std::forward_as_tuple(driver),
+ std::forward_as_tuple(std::piecewise_construct, std::forward_as_tuple(std::move(texture)), std::tuple<>())).first;
+ }
// set clone status
bool cloneof = strcmp(driver->parent, "0");
@@ -657,6 +648,7 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
render_load_ico(*tmp, snapfile, nullptr, fullname.c_str());
}
+ bitmap_argb32 &bitmap(icon->second.second);
if (tmp->valid())
{
float panel_width = x1 - x0;
@@ -697,24 +689,25 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
else
dest_bitmap = tmp;
- m_icons_bitmap[linenum]->allocate(panel_width_pixel, panel_height_pixel);
-
+ bitmap.allocate(panel_width_pixel, panel_height_pixel);
for (int x = 0; x < dest_xPixel; x++)
for (int y = 0; y < dest_yPixel; y++)
- m_icons_bitmap[linenum]->pix32(y, x) = dest_bitmap->pix32(y, x);
+ bitmap.pix32(y, x) = dest_bitmap->pix32(y, x);
auto_free(machine(), dest_bitmap);
- m_icons_texture[linenum]->set_bitmap(*m_icons_bitmap[linenum], m_icons_bitmap[linenum]->cliprect(), TEXFORMAT_ARGB32);
+ icon->second.first->set_bitmap(bitmap, bitmap.cliprect(), TEXFORMAT_ARGB32);
+ }
+ else
+ {
+ bitmap.reset();
}
- else if (m_icons_bitmap[linenum] != nullptr)
- m_icons_bitmap[linenum]->reset();
auto_free(machine(), tmp);
}
- if (m_icons_bitmap[linenum] != nullptr && m_icons_bitmap[linenum]->valid())
- container().add_quad(x0, y0, x1, y1, rgb_t::white(), m_icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ if (icon->second.second.valid())
+ container().add_quad(x0, y0, x1, y1, rgb_t::white(), icon->second.first.get(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
return ud_arrow_width * 1.5f;
}
diff --git a/src/frontend/mame/ui/selmenu.h b/src/frontend/mame/ui/selmenu.h
index f5d4deac84c..6bd63b4355c 100644
--- a/src/frontend/mame/ui/selmenu.h
+++ b/src/frontend/mame/ui/selmenu.h
@@ -62,7 +62,7 @@ protected:
bool m_ui_error;
private:
- using bitmap_ptr_vector = std::vector<bitmap_ptr>;
+ using bitmap_vector = std::vector<bitmap_argb32>;
using texture_ptr_vector = std::vector<texture_ptr>;
class cache
@@ -78,11 +78,11 @@ private:
void set_snapx_driver(game_driver const *value) { m_snapx_driver = value; }
void set_snapx_software(ui_software_info const *software) { m_snapx_software = software; }
- bitmap_argb32 &no_avail_bitmap() { return *m_no_avail_bitmap; }
+ bitmap_argb32 &no_avail_bitmap() { return m_no_avail_bitmap; }
render_texture *star_texture() { return m_star_texture.get(); }
- bitmap_ptr_vector const &toolbar_bitmap() { return m_toolbar_bitmap; }
- bitmap_ptr_vector const &sw_toolbar_bitmap() { return m_sw_toolbar_bitmap; }
+ bitmap_vector const &toolbar_bitmap() { return m_toolbar_bitmap; }
+ bitmap_vector const &sw_toolbar_bitmap() { return m_sw_toolbar_bitmap; }
texture_ptr_vector const &toolbar_texture() { return m_toolbar_texture; }
texture_ptr_vector const &sw_toolbar_texture() { return m_sw_toolbar_texture; }
@@ -92,19 +92,21 @@ private:
game_driver const *m_snapx_driver;
ui_software_info const *m_snapx_software;
- bitmap_ptr m_no_avail_bitmap;
- bitmap_ptr m_star_bitmap;
+ bitmap_argb32 m_no_avail_bitmap;
+ bitmap_argb32 m_star_bitmap;
texture_ptr m_star_texture;
- bitmap_ptr_vector m_toolbar_bitmap;
- bitmap_ptr_vector m_sw_toolbar_bitmap;
+ bitmap_vector m_toolbar_bitmap;
+ bitmap_vector m_sw_toolbar_bitmap;
texture_ptr_vector m_toolbar_texture;
texture_ptr_vector m_sw_toolbar_texture;
};
using cache_ptr = std::shared_ptr<cache>;
using cache_ptr_map = std::map<running_machine *, cache_ptr>;
- static constexpr std::size_t MAX_ICONS_RENDER = 40;
+ using icon_cache = util::lru_cache_map<game_driver const *, std::pair<texture_ptr, bitmap_argb32> >;
+
+ static constexpr std::size_t MAX_ICONS_RENDER = 128;
void reset_pressed() { m_pressed = false; m_repeat = 0; }
bool mouse_pressed() const { return (osd_ticks() >= m_repeat); }
@@ -115,11 +117,11 @@ private:
// draw left panel
virtual float draw_left_panel(float x1, float y1, float x2, float y2) = 0;
- game_driver const *m_info_driver;
- ui_software_info const *m_info_software;
- int m_info_view;
- std::vector<std::string> m_items_list;
- std::string m_info_buffer;
+ game_driver const *m_info_driver;
+ ui_software_info const *m_info_software;
+ int m_info_view;
+ std::vector<std::string> m_items_list;
+ std::string m_info_buffer;
// draw infos
void infos_render(float x1, float y1, float x2, float y2);
@@ -187,10 +189,7 @@ private:
int m_right_visible_lines; // right box lines
-
- render_texture *m_icons_texture[MAX_ICONS_RENDER];
- bitmap_ptr m_icons_bitmap[MAX_ICONS_RENDER];
- game_driver const *m_old_icons[MAX_ICONS_RENDER];
+ icon_cache m_icons;
static std::mutex s_cache_guard;
static cache_ptr_map s_caches;
diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp
index 82f28e7755f..c8ceb5d3eab 100644
--- a/src/lib/util/bitmap.cpp
+++ b/src/lib/util/bitmap.cpp
@@ -37,7 +37,7 @@ inline int32_t bitmap_t::compute_rowpixels(int width, int xslop)
inline void bitmap_t::compute_base(int xslop, int yslop)
{
- m_base = m_alloc + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
+ m_base = m_alloc.get() + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
}
@@ -46,8 +46,24 @@ inline void bitmap_t::compute_base(int xslop, int yslop)
// BITMAP ALLOCATION/CONFIGURATION
//**************************************************************************
+bitmap_t::bitmap_t(bitmap_t &&that)
+ : m_alloc(std::move(that.m_alloc))
+ , m_allocbytes(that.m_allocbytes)
+ , m_base(that.m_base)
+ , m_rowpixels(that.m_rowpixels)
+ , m_width(that.m_width)
+ , m_height(that.m_height)
+ , m_format(that.m_format)
+ , m_bpp(that.m_bpp)
+ , m_palette(nullptr)
+ , m_cliprect(that.m_cliprect)
+{
+ set_palette(that.m_palette);
+ that.reset();
+}
+
/**
- * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop)
+ * @fn bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, int width, int height, int xslop, int yslop)
*
* @brief -------------------------------------------------
* bitmap_t - basic constructor
@@ -61,19 +77,19 @@ inline void bitmap_t::compute_base(int xslop, int yslop)
* @param yslop The yslop.
*/
-bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop)
- : m_alloc(nullptr),
- m_allocbytes(0),
- m_format(format),
- m_bpp(bpp),
- m_palette(nullptr)
+bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, int width, int height, int xslop, int yslop)
+ : m_alloc()
+ , m_allocbytes(0)
+ , m_format(format)
+ , m_bpp(bpp)
+ , m_palette(nullptr)
{
// allocate intializes all other fields
allocate(width, height, xslop, yslop);
}
/**
- * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels)
+ * @fn bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int height, int rowpixels)
*
* @brief Constructor.
*
@@ -85,22 +101,22 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xsl
* @param rowpixels The rowpixels.
*/
-bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels)
- : m_alloc(nullptr),
- m_allocbytes(0),
- m_base(base),
- m_rowpixels(rowpixels),
- m_width(width),
- m_height(height),
- m_format(format),
- m_bpp(bpp),
- m_palette(nullptr),
- m_cliprect(0, width - 1, 0, height - 1)
+bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int height, int rowpixels)
+ : m_alloc()
+ , m_allocbytes(0)
+ , m_base(base)
+ , m_rowpixels(rowpixels)
+ , m_width(width)
+ , m_height(height)
+ , m_format(format)
+ , m_bpp(bpp)
+ , m_palette(nullptr)
+ , m_cliprect(0, width - 1, 0, height - 1)
{
}
/**
- * @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect)
+ * @fn bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect)
*
* @brief Constructor.
*
@@ -110,17 +126,17 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int hei
* @param subrect The subrect.
*/
-bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect)
- : m_alloc(nullptr),
- m_allocbytes(0),
- m_base(source.raw_pixptr(subrect.min_y, subrect.min_x)),
- m_rowpixels(source.m_rowpixels),
- m_width(subrect.width()),
- m_height(subrect.height()),
- m_format(format),
- m_bpp(bpp),
- m_palette(nullptr),
- m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
+bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect)
+ : m_alloc()
+ , m_allocbytes(0)
+ , m_base(source.raw_pixptr(subrect.min_y, subrect.min_x))
+ , m_rowpixels(source.m_rowpixels)
+ , m_width(subrect.width())
+ , m_height(subrect.height())
+ , m_format(format)
+ , m_bpp(bpp)
+ , m_palette(nullptr)
+ , m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
{
assert(format == source.m_format);
assert(bpp == source.m_bpp);
@@ -141,6 +157,22 @@ bitmap_t::~bitmap_t()
reset();
}
+bitmap_t &bitmap_t::operator=(bitmap_t &&that)
+{
+ m_alloc = std::move(that.m_alloc);
+ m_allocbytes = that.m_allocbytes;
+ m_base = that.m_base;
+ m_rowpixels = that.m_rowpixels;
+ m_width = that.m_width;
+ m_height = that.m_height;
+ m_format = that.m_format;
+ m_bpp = that.m_bpp;
+ set_palette(that.m_palette);
+ m_cliprect = that.m_cliprect;
+ that.reset();
+ return *this;
+}
+
/**
* @fn void bitmap_t::allocate(int width, int height, int xslop, int yslop)
*
@@ -175,10 +207,10 @@ void bitmap_t::allocate(int width, int height, int xslop, int yslop)
// allocate memory for the bitmap itself
m_allocbytes = m_rowpixels * (m_height + 2 * yslop) * m_bpp / 8;
- m_alloc = new uint8_t[m_allocbytes];
+ m_alloc.reset(new uint8_t[m_allocbytes]);
// clear to 0 by default
- memset(m_alloc, 0, m_allocbytes);
+ memset(m_alloc.get(), 0, m_allocbytes);
// compute the base
compute_base(xslop, yslop);
@@ -242,8 +274,7 @@ void bitmap_t::reset()
{
// delete any existing stuff
set_palette(nullptr);
- delete[] m_alloc;
- m_alloc = nullptr;
+ m_alloc.reset();
m_base = nullptr;
// reset all fields
diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h
index 7d367bcb5cb..7b0fc34610f 100644
--- a/src/lib/util/bitmap.h
+++ b/src/lib/util/bitmap.h
@@ -8,10 +8,10 @@
***************************************************************************/
-#pragma once
+#ifndef MAME_UTIL_BITMAP_H
+#define MAME_UTIL_BITMAP_H
-#ifndef __BITMAP_H__
-#define __BITMAP_H__
+#pragma once
#include "osdcore.h"
#include "palette.h"
@@ -106,10 +106,10 @@ public:
void offsety(int32_t delta) { min_y += delta; max_y += delta; }
// internal state
- int32_t min_x; // minimum X, or left coordinate
- int32_t max_x; // maximum X, or right coordinate (inclusive)
- int32_t min_y; // minimum Y, or top coordinate
- int32_t max_y; // maximum Y, or bottom coordinate (inclusive)
+ int32_t min_x; // minimum X, or left coordinate
+ int32_t max_x; // maximum X, or right coordinate (inclusive)
+ int32_t min_y; // minimum Y, or top coordinate
+ int32_t max_y; // maximum Y, or bottom coordinate (inclusive)
};
@@ -118,18 +118,19 @@ public:
// bitmaps describe a rectangular array of pixels
class bitmap_t
{
-private:
- // prevent implicit copying
- bitmap_t(const bitmap_t &);
- bitmap_t &operator=(const bitmap_t &);
-
protected:
// construction/destruction -- subclasses only to ensure type correctness
- bitmap_t(bitmap_format format, int bpp, int width = 0, int height = 0, int xslop = 0, int yslop = 0);
- bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels);
- bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect);
+ bitmap_t(const bitmap_t &) = delete;
+ bitmap_t(bitmap_t &&that);
+ bitmap_t(bitmap_format format, uint8_t bpp, int width = 0, int height = 0, int xslop = 0, int yslop = 0);
+ bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int height, int rowpixels);
+ bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect);
virtual ~bitmap_t();
+ // prevent implicit copying
+ bitmap_t &operator=(const bitmap_t &) = delete;
+ bitmap_t &operator=(bitmap_t &&that);
+
public:
// allocation/deallocation
void reset();
@@ -175,16 +176,16 @@ private:
void compute_base(int xslop, int yslop);
// internal state
- uint8_t * m_alloc; // pointer to allocated pixel memory
- uint32_t m_allocbytes; // size of our allocation
- void * m_base; // pointer to pixel (0,0) (adjusted for padding)
- int32_t m_rowpixels; // pixels per row (including padding)
- int32_t m_width; // width of the bitmap
- int32_t m_height; // height of the bitmap
- bitmap_format m_format; // format of the bitmap
- uint8_t m_bpp; // bits per pixel
- palette_t * m_palette; // optional palette
- rectangle m_cliprect; // a clipping rectangle covering the full bitmap
+ std::unique_ptr<uint8_t []> m_alloc; // pointer to allocated pixel memory
+ uint32_t m_allocbytes; // size of our allocation
+ void * m_base; // pointer to pixel (0,0) (adjusted for padding)
+ int32_t m_rowpixels; // pixels per row (including padding)
+ int32_t m_width; // width of the bitmap
+ int32_t m_height; // height of the bitmap
+ bitmap_format m_format; // format of the bitmap
+ uint8_t m_bpp; // bits per pixel
+ palette_t * m_palette; // optional palette
+ rectangle m_cliprect; // a clipping rectangle covering the full bitmap
};
@@ -199,10 +200,13 @@ private:
protected:
// construction/destruction -- subclasses only
+ bitmap8_t(bitmap8_t &&) = default;
bitmap8_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 8, width, height, xslop, yslop) { }
bitmap8_t(bitmap_format format, uint8_t *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap8_t(bitmap_format format, bitmap8_t &source, const rectangle &subrect) : bitmap_t(format, 8, source, subrect) { }
+ bitmap8_t &operator=(bitmap8_t &&) = default;
+
public:
// getters
uint8_t bpp() const { return 8; }
@@ -222,10 +226,13 @@ private:
protected:
// construction/destruction -- subclasses only
+ bitmap16_t(bitmap16_t &&) = default;
bitmap16_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 16, width, height, xslop, yslop) { assert(valid_format(format)); }
bitmap16_t(bitmap_format format, uint16_t *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap16_t(bitmap_format format, bitmap16_t &source, const rectangle &subrect) : bitmap_t(format, 16, source, subrect) { }
+ bitmap16_t &operator=(bitmap16_t &&) = default;
+
public:
// getters
uint8_t bpp() const { return 16; }
@@ -245,10 +252,13 @@ private:
protected:
// construction/destruction -- subclasses only
+ bitmap32_t(bitmap32_t &&) = default;
bitmap32_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 32, width, height, xslop, yslop) { assert(valid_format(format)); }
bitmap32_t(bitmap_format format, uint32_t *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap32_t(bitmap_format format, bitmap32_t &source, const rectangle &subrect) : bitmap_t(format, 32, source, subrect) { }
+ bitmap32_t &operator=(bitmap32_t &&) = default;
+
public:
// getters
uint8_t bpp() const { return 32; }
@@ -268,10 +278,13 @@ private:
protected:
// construction/destruction -- subclasses only
+ bitmap64_t(bitmap64_t &&) = default;
bitmap64_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 64, width, height, xslop, yslop) { assert(valid_format(format)); }
bitmap64_t(bitmap_format format, uint64_t *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap64_t(bitmap_format format, bitmap64_t &source, const rectangle &subrect) : bitmap_t(format, 64, source, subrect) { }
+ bitmap64_t &operator=(bitmap64_t &&) = default;
+
public:
// getters
uint8_t bpp() const { return 64; }
@@ -292,6 +305,7 @@ class bitmap_ind8 : public bitmap8_t
public:
// construction/destruction
+ bitmap_ind8(bitmap_ind8 &&) = default;
bitmap_ind8(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap8_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -300,6 +314,8 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_ind8 &operator=(bitmap_ind8 &&) = default;
};
// BITMAP_FORMAT_IND16 bitmaps
@@ -309,6 +325,7 @@ class bitmap_ind16 : public bitmap16_t
public:
// construction/destruction
+ bitmap_ind16(bitmap_ind16 &&) = default;
bitmap_ind16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -317,6 +334,8 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_ind16 &operator=(bitmap_ind16 &&) = default;
};
// BITMAP_FORMAT_IND32 bitmaps
@@ -326,6 +345,7 @@ class bitmap_ind32 : public bitmap32_t
public:
// construction/destruction
+ bitmap_ind32(bitmap_ind32 &&) = default;
bitmap_ind32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -334,6 +354,8 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_ind32 &operator=(bitmap_ind32 &&) = default;
};
// BITMAP_FORMAT_IND64 bitmaps
@@ -343,6 +365,7 @@ class bitmap_ind64 : public bitmap64_t
public:
// construction/destruction
+ bitmap_ind64(bitmap_ind64 &&) = default;
bitmap_ind64(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap64_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -351,6 +374,8 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_ind64 &operator=(bitmap_ind64 &&) = default;
};
@@ -363,6 +388,7 @@ class bitmap_yuy16 : public bitmap16_t
public:
// construction/destruction
+ bitmap_yuy16(bitmap_yuy16 &&) = default;
bitmap_yuy16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -371,6 +397,8 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_yuy16 &operator=(bitmap_yuy16 &&) = default;
};
// BITMAP_FORMAT_RGB32 bitmaps
@@ -380,6 +408,7 @@ class bitmap_rgb32 : public bitmap32_t
public:
// construction/destruction
+ bitmap_rgb32(bitmap_rgb32 &&) = default;
bitmap_rgb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -388,6 +417,8 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_rgb32 &operator=(bitmap_rgb32 &&) = default;
};
// BITMAP_FORMAT_ARGB32 bitmaps
@@ -397,6 +428,7 @@ class bitmap_argb32 : public bitmap32_t
public:
// construction/destruction
+ bitmap_argb32(bitmap_argb32 &&) = default;
bitmap_argb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
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) { }
@@ -405,7 +437,9 @@ public:
// getters
bitmap_format format() const { return k_bitmap_format; }
+
+ bitmap_argb32 &operator=(bitmap_argb32 &&) = default;
};
-#endif // __BITMAP_H__
+#endif // MAME_UTIL_BITMAP_H
diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h
index 758e4821aa3..0633a10c06e 100644
--- a/src/lib/util/coretmpl.h
+++ b/src/lib/util/coretmpl.h
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
+// copyright-holders:Aaron Giles, Vas Crabb
/***************************************************************************
coretmpl.h
@@ -17,9 +17,18 @@
#include "corealloc.h"
#include <array>
+#include <cassert>
#include <cstddef>
+#include <functional>
+#include <initializer_list>
#include <iterator>
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
#include <stdexcept>
+#include <tuple>
+#include <type_traits>
#include <utility>
#include <vector>
@@ -433,6 +442,384 @@ private:
};
+// LRU cache that behaves like std::map with differences:
+// * drops least-recently used items if necessary on insert to prevent size from exceeding max_size
+// * operator[], at, insert, emplace and find freshen existing entries
+// * iterates from least- to most-recently used rather than in order by key
+// * iterators to dropped items are invalidated
+// * not all map interfaces implemented
+// * copyable and swappable but not movable
+// * swap may invalidate past-the-end iterator, other iterators refer to new container
+template <typename Key, typename T, typename Compare = std::less<Key>, class Allocator = std::allocator<std::pair<Key const, T> > >
+class lru_cache_map
+{
+private:
+ class iterator_compare;
+ typedef std::list<std::pair<Key const, T>, Allocator> value_list;
+ typedef typename std::allocator_traits<Allocator>::template rebind_alloc<typename value_list::iterator> iterator_allocator_type;
+ typedef std::set<typename value_list::iterator, iterator_compare, iterator_allocator_type> iterator_set;
+
+ class iterator_compare
+ {
+ public:
+ typedef std::true_type is_transparent;
+ iterator_compare(Compare const &comp) : m_comp(comp) { }
+ iterator_compare(iterator_compare const &that) = default;
+ iterator_compare(iterator_compare &&that) = default;
+ Compare key_comp() const { return m_comp; }
+ iterator_compare &operator=(iterator_compare const &that) = default;
+ iterator_compare &operator=(iterator_compare &&that) = default;
+ bool operator()(typename value_list::iterator const &lhs, typename value_list::iterator const &rhs) const { return m_comp(lhs->first, rhs->first); }
+ template <typename K> bool operator()(typename value_list::iterator const &lhs, K const &rhs) const { return m_comp(lhs->first, rhs); }
+ template <typename K> bool operator()(K const &lhs, typename value_list::iterator const &rhs) const { return m_comp(lhs, rhs->first); }
+ private:
+ Compare m_comp;
+ };
+
+public:
+ typedef Key key_type;
+ typedef T mapped_type;
+ typedef std::pair<Key const, T> value_type;
+ typedef typename value_list::size_type size_type;
+ typedef typename value_list::difference_type difference_type;
+ typedef Compare key_compare;
+ typedef Allocator allocator_type;
+ typedef value_type &reference;
+ typedef value_type const &const_reference;
+ typedef typename std::allocator_traits<Allocator>::pointer pointer;
+ typedef typename std::allocator_traits<Allocator>::const_pointer const_pointer;
+ typedef typename value_list::iterator iterator;
+ typedef typename value_list::const_iterator const_iterator;
+ typedef typename value_list::reverse_iterator reverse_iterator;
+ typedef typename value_list::const_reverse_iterator const_reverse_iterator;
+
+ explicit lru_cache_map(size_type max_size)
+ : lru_cache_map(max_size, key_compare())
+ {
+ }
+ lru_cache_map(size_type max_size, key_compare const &comp, allocator_type const &alloc = allocator_type())
+ : m_max_size(max_size)
+ , m_size(0U)
+ , m_elements(alloc)
+ , m_mapping(iterator_compare(comp), iterator_allocator_type(alloc))
+ {
+ assert(0U < m_max_size);
+ }
+ lru_cache_map(lru_cache_map const &that)
+ : m_max_size(that.m_max_size)
+ , m_size(that.m_size)
+ , m_elements(that.m_elements)
+ , m_mapping(that.m_mapping.key_comp(), that.m_mapping.get_allocator())
+ {
+ for (iterator it = m_elements.begin(); it != m_elements.end(); ++it)
+ m_mapping.insert(it);
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ }
+
+ allocator_type get_allocator() const { return m_elements.get_allocator(); }
+
+ iterator begin() { return m_elements.begin(); }
+ const_iterator begin() const { return m_elements.cbegin(); }
+ const_iterator cbegin() const { return m_elements.cbegin(); }
+ iterator end() { return m_elements.end(); }
+ const_iterator end() const { return m_elements.cend(); }
+ const_iterator cend() const { return m_elements.cend(); }
+ reverse_iterator rbegin() { return m_elements.rbegin(); }
+ const_reverse_iterator rbegin() const { return m_elements.crbegin(); }
+ const_reverse_iterator crbegin() const { return m_elements.crbegin(); }
+ reverse_iterator rend() { return m_elements.end(); }
+ const_reverse_iterator rend() const { return m_elements.crend(); }
+ const_reverse_iterator crend() const { return m_elements.crend(); }
+
+ bool empty() const { return !m_size; }
+ size_type size() const { return m_size; }
+ size_type max_size() const { return m_max_size; }
+
+ mapped_type &operator[](key_type const &key)
+ {
+ typename iterator_set::iterator existing(m_mapping.lower_bound(key));
+ if ((m_mapping.end() != existing) && !m_mapping.key_comp()(key, *existing))
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *existing);
+ return (*existing)->second;
+ }
+ make_space(existing);
+ iterator const inserted(m_elements.emplace(m_elements.end(), std::piecewise_construct, std::forward_as_tuple(key), std::tuple<>()));
+ m_mapping.insert(existing, inserted);
+ ++m_size;
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return inserted->second;
+ }
+ mapped_type &operator[](key_type &&key)
+ {
+ typename iterator_set::iterator existing(m_mapping.lower_bound(key));
+ if ((m_mapping.end() != existing) && !m_mapping.key_comp()(key, *existing))
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *existing);
+ return (*existing)->second;
+ }
+ make_space(existing);
+ iterator const inserted(m_elements.emplace(m_elements.end(), std::piecewise_construct, std::forward_as_tuple(std::move(key)), std::tuple<>()));
+ m_mapping.insert(existing, inserted);
+ ++m_size;
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return inserted->second;
+ }
+ mapped_type &at(key_type const &key)
+ {
+ typename iterator_set::iterator existing(m_mapping.find(key));
+ if (m_mapping.end() != existing)
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *existing);
+ return (*existing)->second;
+ }
+ else
+ {
+ throw std::out_of_range("lru_cache_map::at");
+ }
+ }
+ mapped_type const &at(key_type const &key) const
+ {
+ typename iterator_set::iterator existing(m_mapping.find(key));
+ if (m_mapping.end() != existing)
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *existing);
+ return (*existing)->second;
+ }
+ else
+ {
+ throw std::out_of_range("lru_cache_map::at");
+ }
+ }
+
+ void clear()
+ {
+ m_size = 0U;
+ m_elements.clear();
+ m_mapping.clear();
+ }
+ std::pair<iterator, bool> insert(value_type const &value)
+ {
+ typename iterator_set::iterator existing(m_mapping.lower_bound(value.first));
+ if ((m_mapping.end() != existing) && !m_mapping.key_comp()(value.first, *existing))
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *existing);
+ return std::pair<iterator, bool>(*existing, false);
+ }
+ make_space(existing);
+ iterator const inserted(m_elements.emplace(m_elements.end(), value));
+ m_mapping.insert(existing, inserted);
+ ++m_size;
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return std::pair<iterator, bool>(inserted, true);
+ }
+ std::pair<iterator, bool> insert(value_type &&value)
+ {
+ typename iterator_set::iterator existing(m_mapping.lower_bound(value.first));
+ if ((m_mapping.end() != existing) && !m_mapping.key_comp()(value.first, *existing))
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *existing);
+ return std::pair<iterator, bool>(*existing, false);
+ }
+ make_space(existing);
+ iterator const inserted(m_elements.emplace(m_elements.end(), std::move(value)));
+ m_mapping.insert(existing, inserted);
+ ++m_size;
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return std::pair<iterator, bool>(inserted, true);
+ }
+ template <typename P>
+ std::pair<iterator, bool> insert(P &&value)
+ {
+ // FIXME: should only participate in overload resolution if std::is_constructible<value_type, P&&>::value
+ return emplace(std::forward<P>(value));
+ }
+ template <typename InputIt>
+ void insert(InputIt first, InputIt last)
+ {
+ while (first != last)
+ {
+ insert(*first);
+ ++first;
+ }
+ }
+ void insert(std::initializer_list<value_type> ilist)
+ {
+ for (value_type const &value : ilist)
+ insert(value);
+ }
+ template <typename... Params>
+ std::pair<iterator, bool> emplace(Params &&... args)
+ {
+ // TODO: is there a more efficient way than depending on value_type being efficiently movable?
+ return insert(value_type(std::forward<Params>(args)...));
+ }
+ iterator erase(const_iterator pos)
+ {
+ m_mapping.erase(m_elements.erase(pos, pos));
+ iterator const result(m_elements.erase(pos));
+ --m_size;
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return result;
+ }
+ iterator erase(const_iterator first, const_iterator last)
+ {
+ iterator pos(m_elements.erase(first, first));
+ while (pos != last)
+ {
+ m_mapping.erase(pos);
+ pos = m_elements.erase(pos);
+ --m_size;
+ }
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return pos;
+ }
+ size_type erase(key_type const &key)
+ {
+ typename iterator_set::iterator const found(m_mapping.find(key));
+ if (m_mapping.end() == found)
+ {
+ return 0U;
+ }
+ else
+ {
+ m_elements.erase(*found);
+ m_mapping.erase(found);
+ --m_size;
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ return 1U;
+ }
+ }
+ void swap(lru_cache_map &that)
+ {
+ using std::swap;
+ swap(m_max_size, that.m_max_size);
+ swap(m_size, that.m_size);
+ swap(m_elements, that.m_elements);
+ swap(m_mapping, that.m_mapping);
+ }
+
+ size_type count(key_type const &key) const
+ {
+ // TODO: perhaps this should freshen an element
+ return m_mapping.count(key);
+ }
+ template <typename K>
+ size_type count(K const &x) const
+ {
+ // FIXME: should only enable this overload if Compare::is_transparent
+ // TODO: perhaps this should freshen an element
+ return m_mapping.count(x);
+ }
+ iterator find(key_type const &key)
+ {
+ typename iterator_set::const_iterator const found(m_mapping.find(key));
+ if (m_mapping.end() == found)
+ {
+ return m_elements.end();
+ }
+ else
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *found);
+ return *found;
+ }
+ }
+ iterator find(key_type const &key) const
+ {
+ typename iterator_set::const_iterator const found(m_mapping.find(key));
+ if (m_mapping.end() == found)
+ {
+ return m_elements.end();
+ }
+ else
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *found);
+ return *found;
+ }
+ }
+ template <typename K>
+ iterator find(K const &x)
+ {
+ // FIXME: should only enable this overload if Compare::is_transparent
+ typename iterator_set::const_iterator const found(m_mapping.find(x));
+ if (m_mapping.end() == found)
+ {
+ return m_elements.end();
+ }
+ else
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *found);
+ return *found;
+ }
+ }
+ template <typename K>
+ iterator find(K const &x) const
+ {
+ // FIXME: should only enable this overload if Compare::is_transparent
+ typename iterator_set::const_iterator const found(m_mapping.find(x));
+ if (m_mapping.end() == found)
+ {
+ return m_elements.end();
+ }
+ else
+ {
+ m_elements.splice(m_elements.cend(), m_elements, *found);
+ return *found;
+ }
+ }
+
+ key_compare key_comp() const
+ {
+ return m_mapping.key_comp().key_comp();
+ }
+
+ lru_cache_map &operator=(lru_cache_map const &that)
+ {
+ m_max_size = that.m_max_size;
+ m_size = that.m_size;
+ m_elements = that.m_elements;
+ m_mapping.clear();
+ for (iterator it = m_elements.begin(); it != m_elements.end(); ++it)
+ m_mapping.insert(it);
+ assert(m_elements.size() == m_size);
+ assert(m_mapping.size() == m_size);
+ }
+
+private:
+ void make_space(typename iterator_set::iterator &existing)
+ {
+ while (m_max_size <= m_size)
+ {
+ if ((m_mapping.end() != existing) && (m_elements.begin() == *existing))
+ existing = m_mapping.erase(existing);
+ else
+ m_mapping.erase(m_elements.begin());
+ m_elements.erase(m_elements.begin());
+ --m_size;
+ }
+ }
+
+ size_type m_max_size;
+ size_type m_size;
+ mutable value_list m_elements;
+ iterator_set m_mapping;
+};
+
+template <typename Key, typename T, typename Compare, class Allocator>
+void swap(lru_cache_map<Key, T, Compare, Allocator> &lhs, lru_cache_map<Key, T, Compare, Allocator> &rhs)
+{
+ lhs.swap(rhs);
+}
+
+
template <typename T, std::size_t N, bool WriteWrap = false, bool ReadWrap = WriteWrap>
class fifo : protected std::array<T, N>
{
diff --git a/src/mame/drivers/by35.cpp b/src/mame/drivers/by35.cpp
index 604de9afebd..58755594b42 100644
--- a/src/mame/drivers/by35.cpp
+++ b/src/mame/drivers/by35.cpp
@@ -2306,7 +2306,7 @@ ROM_START(uboat65)
ROM_RELOAD(0x28000, 0x8000)
ROM_RELOAD(0x38000, 0x8000)
ROM_REGION(0x10000, "cpu2", 0)
- ROM_COPY("sound1", 0x0000, 0x8000,0x8000)
+ ROM_LOAD("snd_u8.bin", 0x8000, 0x8000, CRC(d00fd4fd) SHA1(23f6b7c5d60821eb7fa2fdcfc85caeb536eef99a))
ROM_END
/*--------------------------------
/ Big Ball Bowling (Bowler)
diff --git a/src/mame/drivers/de_2.cpp b/src/mame/drivers/de_2.cpp
index 7e2daaa3025..37f8b1cf0bc 100644
--- a/src/mame/drivers/de_2.cpp
+++ b/src/mame/drivers/de_2.cpp
@@ -725,6 +725,17 @@ ROM_END
/*-----------------------------------------------------------------------------------
/ Monday Night Football - CPU Rev 2 /Alpha Type 3 16/32K Roms - 32/64K Sound Roms
/----------------------------------------------------------------------------------*/
+ROM_START(mnfb_c29)
+ ROM_REGION(0x10000, "maincpu", 0)
+ ROM_LOAD("mnfb2-9.b5", 0x4000, 0x4000, BAD_DUMP CRC(2d6805d1) SHA1(f222cbf30d07975279eea210738f7d4f73b3fcf4)) // patched by PINMAME dev
+ ROM_LOAD("mnfb2-9.c5", 0x8000, 0x8000, CRC(98d50cf5) SHA1(59d3b16f8195ab95cece71a12dab3349dfeb2c2b))
+ ROM_REGION(0x10000, "audiocpu", 0)
+ ROM_LOAD("mnf-f7.256", 0x8000, 0x8000, CRC(fbc2d6f6) SHA1(33173c081de776d32e926481e94b265ec48d770b))
+ ROM_REGION(0x40000, "sound1", 0)
+ ROM_LOAD("mnf-f5-6.512", 0x00000, 0x10000, CRC(0c6ea963) SHA1(8c88fa588222ef8a6c872b8c5b49639b108384d4))
+ ROM_LOAD("mnf-f4-5.512", 0x10000, 0x10000, CRC(efca5d80) SHA1(9655c885dd64aa170205170b6a0c052bd9367379))
+ROM_END
+
ROM_START(mnfb_c27)
ROM_REGION(0x10000, "maincpu", 0)
ROM_LOAD("mnfb2-7.b5", 0x4000, 0x4000, CRC(995eb9b8) SHA1(d05d74393fda59ffd8d7b5546313779cdb10d23e))
@@ -932,7 +943,8 @@ GAME(1990, kiko_a10, 0, de_type3, de_2, de_2_state, de_2,
GAME(1987, lwar_a83, 0, de_type1, de_2, de_2_state, de_2, ROT0, "Data East", "Laser War (8.3)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1987, lwar_a81, lwar_a83, de_type1, de_2, de_2_state, de_2, ROT0, "Data East", "Laser War (8.1)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1987, lwar_e90, lwar_a83, de_type1, de_2, de_2_state, de_2, ROT0, "Data East", "Laser War (9.0 Europe)", MACHINE_IS_SKELETON_MECHANICAL)
-GAME(1989, mnfb_c27, 0, de_type2_alpha3, de_2, de_2_state, de_2, ROT0, "Data East", "Monday Night Football (2.7, 50cts)", MACHINE_IS_SKELETON_MECHANICAL)
+GAME(1989, mnfb_c29, 0, de_type2_alpha3, de_2, de_2_state, de_2, ROT0, "Data East", "Monday Night Football (2.9, 50cts)", MACHINE_IS_SKELETON_MECHANICAL)
+GAME(1989, mnfb_c27, mnfb_c29, de_type2_alpha3, de_2, de_2_state, de_2, ROT0, "Data East", "Monday Night Football (2.7, 50cts)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1990, poto_a32, 0, de_type2_alpha3, de_2, de_2_state, de_2, ROT0, "Data East", "The Phantom of the Opera (3.2)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1990, poto_a29, poto_a32, de_type2_alpha3, de_2, de_2_state, de_2, ROT0, "Data East", "The Phantom of the Opera (2.9)", MACHINE_IS_SKELETON_MECHANICAL)
GAME(1989, play_a24, 0, de_type2, de_2, de_2_state, de_2, ROT0, "Data East", "Playboy 35th Anniversary (2.4)", MACHINE_IS_SKELETON_MECHANICAL)
diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp
index 996cd071389..1b21ab2514e 100644
--- a/src/mame/drivers/dec0.cpp
+++ b/src/mame/drivers/dec0.cpp
@@ -44,7 +44,8 @@ Original Service Manuals and Service Mode (when available).
ToDo:
- Fix protection simulation in Birdie Try (that part needs at least comparison with a real board);
- Fix remaining graphical problems in Automat (bootleg);
-- graphics and sound are completely broken in Secret Agent (bootleg);
+- Fix remaining sound problems in Secret Agent (bootleg);
+- graphics are completely broken in Secret Agent (bootleg);
- Fighting Fantasy (bootleg) doesn't boot at all;
- Hook up the 68705 in Midnight Resistance (bootleg) (it might not be used, leftover from the Fighting Fantasy bootleg on the same PCB?)
- Get rid of ROM patches in Sly Spy and Hippodrome;
@@ -281,6 +282,15 @@ WRITE16_MEMBER(dec0_state::midres_sound_w)
}
}
+WRITE16_MEMBER(dec0_automat_state::secretab_sound_w)
+{
+ if (ACCESSING_BITS_0_7)
+ {
+ m_soundlatch->write(space, 0, data & 0xff);
+ m_audiocpu->set_input_line(0, HOLD_LINE);
+ }
+}
+
/******************************************************************************/
static ADDRESS_MAP_START( dec0_map, AS_PROGRAM, 16, dec0_state )
@@ -538,7 +548,7 @@ void dec0_automat_state::machine_start()
save_item(NAME(m_adpcm_toggle2));
save_item(NAME(m_automat_scroll_regs));
- m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x4000);
+ m_soundbank->configure_entries(0, 8, memregion("audiocpu")->base(), 0x4000);
m_soundbank->set_entry(0);
}
@@ -611,7 +621,7 @@ static ADDRESS_MAP_START( secretab_map, AS_PROGRAM, 16, dec0_automat_state )
// AM_RANGE(0x340400, 0x3407ff) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_rowscroll_r, pf_rowscroll_w)
AM_RANGE(0x314008, 0x31400f) AM_READ(slyspy_controls_r)
-// AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w)
+ AM_RANGE(0x314000, 0x314001) AM_WRITE(secretab_sound_w)
AM_RANGE(0x300000, 0x300007) AM_RAM
AM_RANGE(0x300010, 0x300017) AM_RAM
@@ -636,6 +646,18 @@ static ADDRESS_MAP_START( automat_s_map, AS_PROGRAM, 8, dec0_automat_state )
AM_RANGE(0xf000, 0xf000) AM_DEVWRITE("adpcm_select1", ls157_device, ba_w)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( secretab_s_map, AS_PROGRAM, 8, dec0_automat_state )
+ AM_RANGE(0x0000, 0x7fff) AM_ROM
+ AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("soundbank")
+ AM_RANGE(0xc000, 0xc7ff) AM_RAM
+ AM_RANGE(0xc800, 0xc801) AM_DEVREADWRITE("2203a", ym2203_device, read, write)
+ AM_RANGE(0xd000, 0xd001) AM_DEVREADWRITE("ym3812", ym3812_device, read, write)
+ AM_RANGE(0xd800, 0xd800) AM_READ(sound_command_r)
+ AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("adpcm_select2", ls157_device, ba_w)
+ AM_RANGE(0xe800, 0xe800) AM_WRITE(sound_bankswitch_w)
+ AM_RANGE(0xf000, 0xf000) AM_DEVWRITE("adpcm_select1", ls157_device, ba_w)
+ADDRESS_MAP_END
+
static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, dec0_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(dec0_mcu_port_r, dec0_mcu_port_w)
@@ -1374,7 +1396,7 @@ WRITE8_MEMBER(dec0_automat_state::sound_bankswitch_w)
m_msm1->reset_w(BIT(data, 3));
m_msm2->reset_w(BIT(data, 4));
- m_soundbank->set_entry(data & 3);
+ m_soundbank->set_entry(data & 7);
}
WRITE_LINE_MEMBER(dec0_automat_state::msm1_vclk_cb)
@@ -1479,7 +1501,7 @@ static MACHINE_CONFIG_START( secretab, dec0_automat_state )
MCFG_CPU_VBLANK_INT_DRIVER("screen", dec0_state, irq6_line_hold)/* VBL */
MCFG_CPU_ADD("audiocpu", Z80, 3000000)// ?
- MCFG_CPU_PROGRAM_MAP(automat_s_map)
+ MCFG_CPU_PROGRAM_MAP(secretab_s_map)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(dec0_state,dec0_nodma)
@@ -1521,11 +1543,8 @@ static MACHINE_CONFIG_START( secretab, dec0_automat_state )
MCFG_SOUND_ROUTE(2, "mono", 0.90)
MCFG_SOUND_ROUTE(3, "mono", 0.35)
- MCFG_SOUND_ADD("2203b", YM2203, 1250000)
- MCFG_SOUND_ROUTE(0, "mono", 0.90)
- MCFG_SOUND_ROUTE(1, "mono", 0.90)
- MCFG_SOUND_ROUTE(2, "mono", 0.90)
- MCFG_SOUND_ROUTE(3, "mono", 0.35)
+ MCFG_SOUND_ADD("ym3812", YM3812, 2500000)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MCFG_DEVICE_ADD("adpcm_select1", LS157, 0)
MCFG_74LS157_OUT_CB(DEVWRITE8("msm1", msm5205_device, data_w))
@@ -2376,13 +2395,14 @@ enjoy..
ROM_START( automat )
ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */
- ROM_LOAD16_BYTE( "5.bin", 0x00000, 0x10000, CRC(fb6faa74) SHA1(0af03c06193b5ba1422571b9504a7f655c608d94) )
- ROM_LOAD16_BYTE( "2.bin", 0x00001, 0x10000, CRC(7ecf8309) SHA1(59dd50bcb528ece42a67154bcc4f432770420986) )
- ROM_LOAD16_BYTE( "4.bin", 0x20000, 0x10000, CRC(9d7b79e0) SHA1(e0d901b9b3cd62f7c947da04f7447ebfa88bf44a) )
- ROM_LOAD16_BYTE( "3.bin", 0x20001, 0x10000, CRC(e655f9c3) SHA1(d5e99d542303d009277ccfc245f877e4e28603c9) )
+ ROM_LOAD16_BYTE( "5.ic50", 0x00000, 0x10000, CRC(fb6faa74) SHA1(0af03c06193b5ba1422571b9504a7f655c608d94) )
+ ROM_LOAD16_BYTE( "2.ic54", 0x00001, 0x10000, CRC(7ecf8309) SHA1(59dd50bcb528ece42a67154bcc4f432770420986) )
+ ROM_LOAD16_BYTE( "4.ic51", 0x20000, 0x10000, CRC(9d7b79e0) SHA1(e0d901b9b3cd62f7c947da04f7447ebfa88bf44a) )
+ ROM_LOAD16_BYTE( "3.ic53", 0x20001, 0x10000, CRC(e655f9c3) SHA1(d5e99d542303d009277ccfc245f877e4e28603c9) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 Sound */
- ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(72ea6024) SHA1(debd30219879ec01f43cc116a6cfa17209940ecc) )
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 Sound */
+ ROM_LOAD( "1.ic26", 0x00000, 0x10000, CRC(72ea6024) SHA1(debd30219879ec01f43cc116a6cfa17209940ecc) )
+ ROM_RELOAD( 0x10000, 0x10000 ) // IC25 socket unpopulated
ROM_REGION( 0x40000, "gfxload1", 0 ) /* chars */
ROM_LOAD( "8.bin", 0x00000, 0x10000, CRC(dcfffc7a) SHA1(e250626473917d397381210ef536efbc93c46474) ) // y?
@@ -2914,19 +2934,20 @@ from sa_15 to sa_22
ROM_START( secretab )
ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */
- ROM_LOAD16_BYTE( "sa_05.bin", 0x00000, 0x10000, CRC(54869474) SHA1(88c1894d1b6d8dd3d37e97d566aafef9c9409d6e) )
- ROM_LOAD16_BYTE( "sa_03.bin", 0x00001, 0x10000, CRC(36ab1874) SHA1(baa47c466ab13ac792761531f77ee8e639d19203) )
- ROM_LOAD16_BYTE( "sa_06.bin", 0x20000, 0x10000, CRC(8e691f23) SHA1(eb08c9539b699af124fcf87be07a33d2d5a71ada) )
- ROM_LOAD16_BYTE( "sa_04.bin", 0x20001, 0x10000, CRC(c838b205) SHA1(8c7a453ec7a00d4f5bbf9fadba6d551909647ed8) )
+ ROM_LOAD16_BYTE( "sa_05.ic94", 0x00000, 0x10000, CRC(54869474) SHA1(88c1894d1b6d8dd3d37e97d566aafef9c9409d6e) ) // misnumbered; should be IC84
+ ROM_LOAD16_BYTE( "sa_03.ic67", 0x00001, 0x10000, CRC(36ab1874) SHA1(baa47c466ab13ac792761531f77ee8e639d19203) )
+ ROM_LOAD16_BYTE( "sa_06.ic83", 0x20000, 0x10000, CRC(8e691f23) SHA1(eb08c9539b699af124fcf87be07a33d2d5a71ada) )
+ ROM_LOAD16_BYTE( "sa_04.ic66", 0x20001, 0x10000, CRC(c838b205) SHA1(8c7a453ec7a00d4f5bbf9fadba6d551909647ed8) )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */
- ROM_LOAD( "sa_01.bin", 0x00000, 0x10000, CRC(9fdc503b) SHA1(7b258e0734ca88a7d3f574d75116f0fe3b628898) )
+ ROM_REGION( 0x20000, "audiocpu", 0 ) /* Sound CPU */
+ ROM_LOAD( "sa_01.ic41", 0x00000, 0x10000, CRC(9fdc503b) SHA1(7b258e0734ca88a7d3f574d75116f0fe3b628898) )
+ ROM_LOAD( "sa_02.ic40", 0x10000, 0x10000, CRC(439eb5a9) SHA1(8d6baad8a1e89279ef0a378941d3d9b49a606864) ) // both halves identical
ROM_REGION( 0x40000, "charset", 0 )
- ROM_LOAD( "sa_08.bin", 0x00000, 0x10000,CRC(4806b951) SHA1(a2fa5b8587132747067d7d64ccfd14129a34ef58) )
- ROM_LOAD( "sa_12.bin", 0x10000, 0x10000,CRC(f9e2cd5f) SHA1(f2c3f6e763c6f80307e9daee533d316b05cd02c5) )
- ROM_LOAD( "sa_10.bin", 0x20000, 0x10000,CRC(843c4679) SHA1(871f3e77aa7e628e924a40d06ddec700487e23fb) )
- ROM_LOAD( "sa_14.bin", 0x30000, 0x10000,CRC(3dac9128) SHA1(f3a2068e90973c1f04f1bbaa209111e3f9669ee0) )
+ ROM_LOAD( "sa_08.ic105", 0x00000, 0x10000,CRC(4806b951) SHA1(a2fa5b8587132747067d7d64ccfd14129a34ef58) )
+ ROM_LOAD( "sa_12.ic156", 0x10000, 0x10000,CRC(f9e2cd5f) SHA1(f2c3f6e763c6f80307e9daee533d316b05cd02c5) )
+ ROM_LOAD( "sa_10.ic138", 0x20000, 0x10000,CRC(843c4679) SHA1(871f3e77aa7e628e924a40d06ddec700487e23fb) )
+ ROM_LOAD( "sa_14.ic188", 0x30000, 0x10000,CRC(3dac9128) SHA1(f3a2068e90973c1f04f1bbaa209111e3f9669ee0) )
ROM_REGION( 0x20000, "gfx1", ROMREGION_INVERT ) /* chars */
ROM_COPY( "charset", 0x00000, 0x00000, 0x8000 )
@@ -2941,23 +2962,20 @@ ROM_START( secretab )
ROM_COPY( "charset", 0x38000, 0x18000, 0x8000 )
ROM_REGION( 0x40000, "gfx3", ROMREGION_INVERT ) /* tiles */
- ROM_LOAD( "sa_09.bin", 0x00000, 0x10000,CRC(9e412267) SHA1(482cd6e772fa21f15db66c27acf85e8f97f7c5a5) )
- ROM_LOAD( "sa_11.bin", 0x10000, 0x10000,CRC(e87650db) SHA1(381352428b12fd4a8cd13270009ff7602aa41a0b) )
- ROM_LOAD( "sa_07.bin", 0x20000, 0x10000,CRC(6ad2e575) SHA1(b6b159cb36e222fe62fc10271602226f027440e4) )
- ROM_LOAD( "sa_13.bin", 0x30000, 0x10000,CRC(e8601057) SHA1(fd73a36fb84049154248d250ffea68b1ee39a43f) )
+ ROM_LOAD( "sa_09.ic139", 0x00000, 0x10000,CRC(9e412267) SHA1(482cd6e772fa21f15db66c27acf85e8f97f7c5a5) )
+ ROM_LOAD( "sa_11.ic157", 0x10000, 0x10000,CRC(e87650db) SHA1(381352428b12fd4a8cd13270009ff7602aa41a0b) )
+ ROM_LOAD( "sa_07.ic106", 0x20000, 0x10000,CRC(6ad2e575) SHA1(b6b159cb36e222fe62fc10271602226f027440e4) )
+ ROM_LOAD( "sa_13.ic189", 0x30000, 0x10000,CRC(e8601057) SHA1(fd73a36fb84049154248d250ffea68b1ee39a43f) )
ROM_REGION( 0x80000, "gfx4", 0 ) /* sprites */
- ROM_LOAD( "sa_20.bin", 0x00000, 0x10000,CRC(447e4f0b) SHA1(97db103e505a6e11eb9bdb3622e4aa3b796a9714) )
- ROM_LOAD( "sa_19.bin", 0x10000, 0x10000,CRC(d29bc22e) SHA1(ce0935d09f7e94fa32247c86e14a74b73514b29e) )
- ROM_LOAD( "sa_16.bin", 0x20000, 0x10000,CRC(ff72b838) SHA1(fdc48ecdd2225fc69472313f34973f6add8fb558) )
- ROM_LOAD( "sa_15.bin", 0x30000, 0x10000,CRC(54fcbc39) SHA1(293a6799193b01424c3eac86cf90cc023aa771db) )
- ROM_LOAD( "sa_22.bin", 0x40000, 0x10000,CRC(d234cae5) SHA1(0cd07bf087a4da19a5da29785385de9eee52d0fb) )
- ROM_LOAD( "sa_21.bin", 0x50000, 0x10000,CRC(dc6a38df) SHA1(9043df911389d3f085299f2f2202cab356473a32) )
- ROM_LOAD( "sa_18.bin", 0x60000, 0x10000,CRC(4f989f00) SHA1(ae7ae6e62e6a516ae3c8ebbeb5e39887c1961add) )
- ROM_LOAD( "sa_17.bin", 0x70000, 0x10000,CRC(f61972c8) SHA1(fa9ddca3473091b4879171d8f3b302e8f2b45149) )
-
- ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM samples */
- ROM_LOAD( "sa_02.bin", 0x00000, 0x10000,CRC(439eb5a9) SHA1(8d6baad8a1e89279ef0a378941d3d9b49a606864) ) // both halves identical
+ ROM_LOAD( "sa_20.ic176", 0x00000, 0x10000,CRC(447e4f0b) SHA1(97db103e505a6e11eb9bdb3622e4aa3b796a9714) )
+ ROM_LOAD( "sa_19.ic177", 0x10000, 0x10000,CRC(d29bc22e) SHA1(ce0935d09f7e94fa32247c86e14a74b73514b29e) )
+ ROM_LOAD( "sa_16.ic180", 0x20000, 0x10000,CRC(ff72b838) SHA1(fdc48ecdd2225fc69472313f34973f6add8fb558) )
+ ROM_LOAD( "sa_15.ic181", 0x30000, 0x10000,CRC(54fcbc39) SHA1(293a6799193b01424c3eac86cf90cc023aa771db) )
+ ROM_LOAD( "sa_22.ic174", 0x40000, 0x10000,CRC(d234cae5) SHA1(0cd07bf087a4da19a5da29785385de9eee52d0fb) )
+ ROM_LOAD( "sa_21.ic175", 0x50000, 0x10000,CRC(dc6a38df) SHA1(9043df911389d3f085299f2f2202cab356473a32) )
+ ROM_LOAD( "sa_18.ic178", 0x60000, 0x10000,CRC(4f989f00) SHA1(ae7ae6e62e6a516ae3c8ebbeb5e39887c1961add) )
+ ROM_LOAD( "sa_17.ic179", 0x70000, 0x10000,CRC(f61972c8) SHA1(fa9ddca3473091b4879171d8f3b302e8f2b45149) )
ROM_END
@@ -3375,5 +3393,5 @@ GAME( 1989, ffantasybl, hippodrm, ffantasybl, ffantasybl, dec0_state, ffantasybl
GAME( 1988, drgninjab2, baddudes, baddudes, drgninja, dec0_state, baddudes, ROT0, "bootleg", "Dragonninja (bootleg with 68705)", MACHINE_SUPPORTS_SAVE ) // is this the same board as above? (region warning hacked to World, but still shows Japanese text)
// these are different to the above but quite similar to each other
-GAME( 1988, automat, robocop, automat, robocop, dec0_state, robocop, ROT0, "bootleg", "Automat (bootleg of Robocop)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // sound rom / music from section z with mods for ADPCM?
-GAME( 1989, secretab, secretag, secretab, slyspy, driver_device, 0, ROT0, "bootleg", "Secret Agent (bootleg)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+GAME( 1988, automat, robocop, automat, robocop, dec0_state, robocop, ROT0, "bootleg", "Automat (bootleg of Robocop)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // sound rom / music from section z with mods for ADPCM?
+GAME( 1989, secretab, secretag, secretab, slyspy, driver_device, 0, ROT0, "bootleg", "Secret Agent (bootleg)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/esq5505.cpp b/src/mame/drivers/esq5505.cpp
index b09ea857a02..0dcd32508cd 100644
--- a/src/mame/drivers/esq5505.cpp
+++ b/src/mame/drivers/esq5505.cpp
@@ -923,6 +923,22 @@ ROM_START( sqrack )
ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00)
ROM_END
+ROM_START( sq2 )
+ ROM_REGION(0x40000, "osrom", 0)
+ ROM_LOAD16_BYTE( "sq232_2.03_9193_lower.u27", 0x000000, 0x010000, CRC(e37fbc2c) SHA1(4a74f3540756745073c8768b384905db03da47c0) )
+ ROM_LOAD16_BYTE( "sq232_2.03_cbcd_upper.u32", 0x000001, 0x020000, CRC(5a7dc228) SHA1(d25adecc0dbba93a094c49fae105dcc7aad317f1) )
+
+ ROM_REGION(0x200000, "waverom", 0)
+ ROM_LOAD16_BYTE( "sq1-u25.bin", 0x000001, 0x080000, CRC(26312451) SHA1(9f947a11592fd8420fc581914bf16e7ade75390c) )
+ ROM_LOAD16_BYTE( "sq1-u26.bin", 0x100001, 0x080000, CRC(2edaa9dc) SHA1(72fead505c4f44e5736ff7d545d72dfa37d613e2) )
+
+ ROM_REGION(0x200000, "waverom2", ROMREGION_ERASE00) // BS=1 region (16-bit)
+ ROM_LOAD( "rom2.u39", 0x000000, 0x100000, CRC(8d1b5e91) SHA1(12991083a6c574133a1a799813fa4573a33d2297) )
+ ROM_LOAD( "rom3.u38", 0x100000, 0x100000, CRC(cb9875ce) SHA1(82021bdc34953e9be97d45746a813d7882250ae0) )
+
+ ROM_REGION(0x80000, "nibbles", ROMREGION_ERASE00)
+ROM_END
+
ROM_START( eps )
ROM_REGION(0x20000, "osrom", 0)
ROM_LOAD16_BYTE( "eps-l.bin", 0x000000, 0x008000, CRC(382beac1) SHA1(110e31edb03fcf7bbde3e17423b21929e5b32db2) )
@@ -999,4 +1015,5 @@ CONS( 1990, eps16p,eps, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS-16
CONS( 1990, sd1, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (21 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD
CONS( 1990, sq1, 0, 0, sq1, sq1, esq5505_state, sq1, "Ensoniq", "SQ-1", MACHINE_NOT_WORKING ) // 2x16 LCD
CONS( 1990, sqrack,sq1, 0, sq1, sq1, esq5505_state, sq1, "Ensoniq", "SQ-Rack", MACHINE_NOT_WORKING ) // 2x16 LCD
+CONS( 1991, sq2, 0, 0, sq1, sq1, esq5505_state, sq1, "Ensoniq", "SQ-2", MACHINE_NOT_WORKING ) // 2x16 LCD
CONS( 1991, sd132, sd1,0, vfx32, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (32 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD
diff --git a/src/mame/drivers/fromance.cpp b/src/mame/drivers/fromance.cpp
index f135a184c0d..d36ea891740 100644
--- a/src/mame/drivers/fromance.cpp
+++ b/src/mame/drivers/fromance.cpp
@@ -37,6 +37,13 @@ Memo:
- 2player's input is not supported.
+- Identify CRT Controller and fix layer misalignment in nekkyoku.
+
+- nekkyoku: soft reset enables flip screen without any real reason.
+
+- nekkyoku writes to a VRAM mirror for showing the OL gal, I guess ROM mirroring
+ is the same for all empty slots for this HW.
+
- Communication between MAIN CPU and SUB CPU can be wrong.
Notes:
@@ -880,11 +887,10 @@ MACHINE_START_MEMBER(fromance_state,fromance)
membank("bank1")->configure_entries(0, 0x100, &ROM[0x10000], 0x4000);
-
save_item(NAME(m_directionflag));
save_item(NAME(m_commanddata));
save_item(NAME(m_portselect));
-
+
save_item(NAME(m_adpcm_reset));
save_item(NAME(m_adpcm_data));
save_item(NAME(m_vclk_left));
@@ -1071,7 +1077,14 @@ ROM_START( nekkyoku )
ROM_LOAD( "ic8a.bin", 0x000000, 0x080000, CRC(599790d8) SHA1(4e4ade1a89d6cb93b0808867883d70c4c7ed78dd) )
ROM_LOAD( "ic9a.bin", 0x080000, 0x040000, CRC(78c1906f) SHA1(54459e0120ec58a962d3f4a1287e68d2fbb28be9) )
ROM_LOAD( "5-ic10a.bin", 0x0c0000, 0x008000, CRC(2e78515f) SHA1(397985c082ffc0df07cd44d54e4fef909c30a4f1) )
- ROM_FILL( 0x0c8000, 0x038000, 0xff )
+ // 'D' OL girl is displayed via one of these mirrors
+ ROM_RELOAD( 0x0c8000, 0x008000 )
+ ROM_RELOAD( 0x0d0000, 0x008000 )
+ ROM_RELOAD( 0x0d8000, 0x008000 )
+ ROM_RELOAD( 0x0e0000, 0x008000 )
+ ROM_RELOAD( 0x0e8000, 0x008000 )
+ ROM_RELOAD( 0x0f0000, 0x008000 )
+ ROM_RELOAD( 0x0f8000, 0x008000 )
ROM_FILL( 0x100000, 0x100000, 0xff )
ROM_END
@@ -1253,7 +1266,7 @@ ROM_END
*
*************************************/
-GAME( 1988, nekkyoku, 0, nekkyoku, nekkyoku, driver_device, 0, ROT0, "Video System Co.", "Rettou Juudan Nekkyoku Janshi - Higashi Nippon Hen (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
+GAME( 1988, nekkyoku, 0, nekkyoku, nekkyoku, driver_device, 0, ROT0, "Video System Co.", "Rettou Juudan Nekkyoku Janshi - Higashi Nippon Hen (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, idolmj, 0, idolmj, idolmj, driver_device, 0, ROT0, "System Service", "Idol-Mahjong Housoukyoku (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, mjnatsu, 0, fromance, mjnatsu, driver_device, 0, ROT0, "Video System Co.", "Mahjong Natsu Monogatari (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, natsuiro, mjnatsu, fromance, mjnatsu, driver_device, 0, ROT0, "Video System Co.", "Natsuiro Mahjong (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp
index 4e8b1880f6b..09c0de945de 100644
--- a/src/mame/drivers/rainbow.cpp
+++ b/src/mame/drivers/rainbow.cpp
@@ -2,7 +2,7 @@
// ENABLE BY UNCOMMENTING. ADDITIONALLY, SET SMOOTH SCROLL IN EMULATION (DISABLE BY SETTING JUMP SCROLL. To enter SETUP hit ScrollLock)-
//#define BOOST_DEBUG_PERFORMANCE
-
+
/* GDC COLOR EMULATION
//-------------------- Differences to VT240: ---------------------------------------------------
// - Registers of graphics option not directly mapped (indirect access via mode register)
@@ -40,32 +40,34 @@ Details
a. (Rainbow driver) : interaction between DEC's external hardware and the NEC 7220 isn't fully understood (see page 173 of AA-AE36A)
It is also unclear what port $50 actually does when it 'synchronizes R-M-W cycles'.
For now, we provide sane defaults for both vector and bitmap units without disturbing display mode(s) or the NEC 7220.
-b. the HBLANK / VBLANK ratio is plainly wrong (QUICK TEST / subtest #6),
-c. IRQs are flagged as 'erratic' (QUICK TEST / subtest #12).
-d. (7220) : incorrect fifo stati are handed out (GDC reports FIFO_EMPTY instead of _FULL when QUICK TEST #4 floods the queue)
+b. the HBLANK / VBLANK ratio is plainly wrong (quick test / subtest #6),
+c. IRQs are flagged as 'erratic' (quick test / subtest #12).
+d. (7220) : incorrect fifo stati are handed out (GDC reports FIFO_EMPTY instead of _FULL when quick test #4 floods the queue)
e. (7220) : RDAT with MOD 2 used extensively here, but unimplemented (modes other than 0 undocumented by NEC / Intel)
-Programs with initialization / redraw / reentrance problems (invocation order after reset * matters *, at least in emulation):
-- CANON (high resolution + vectors), Solitaire (SOLIT.EXE) and GDEMO (from GRPHCS.ARC, interactive graphics interpreter '85),
- plus the Monitor Aligment Test (from the GDC test disk).
-
-Graphical apps. that work well: MMIND (MasterMind), PACMAN, SCRAM, (G)OTELO.
-
UNIMPLEMENTED:
-// - Rainbow 100 A palette quirks (2 bit palette... applies to certain modes only)
+- Rainbow 100 A palette quirks (2 bit palette... applies to certain modes only)
UNKNOWN IMPLEMENTATION DETAILS:
-// 1. READBACK (hard copy programs like JOBSDUMP definitely use it. See also GDC diagnostics). VRAM_R ?
+1. READBACK (hard copy programs like JOBSDUMP definitely use it. See also GDC diagnostics). VRAM_R ?
-// 2. UNVERIFIED DIVIDER (31.188 Mhz / 32) is at least close to 1 Mhz (as on the VT240, which uses a very similar design)
+2. UNVERIFIED DIVIDERS (31.188 Mhz / 32) is at least close to 1 Mhz (as on the VT240, which uses a very similar design)
-// 3. UPD7220 / CORE oddities:
-// 3.1. occasional redraw problems (only when screen 1 runs at 60 Hz and screen 2 at 29.99 Hz interlaced = HIRES ?).
-// Quote from Haze: "if you have 2 screens running at different refresh rates one of them won't update properly
-// (the partial update system gets very confused because it expects both the screens to end at the same time
-// and if that isn't the case large parts of one screen end up not updating at all)
+3. UPD7220 / CORE oddities
+
+To obtain pixel exact graphics use 'Graphics Only' in Video Options plus command line switches -nowindow -aspect1 auto -nokeepaspect
+(Over-Under or Side-by-Side modes always distorted on my 1600 x 900 laptop)
+
+Programs with initialization / redraw / reentrance problems (invocation order after reset matters in emulation):
+
+- CANON (high resolution + vectors), Solitaire (SOLIT.EXE) and GDEMO (from GRPHCS.ARC, interactive graphics interpreter '85),
+ plus 'Monitor Aligment' (from the GDC test disk). Sloppy programming or a bug related to a) to e)...?
- 3.2 pixels are stretched out too wide at 384 x 240 (not fixable in Rainbow driver, -keepaspect seems to have no effect)
+ Quote from Haze: "if you have 2 screens running at different refresh rates one of them won't update properly
+ (the partial update system gets very confused because it expects both the screens to end at the same time
+ and if that isn't the case large parts of one screen end up not updating at all)
+
+The following games work well: MMIND (MasterMind), (G)OTELO (requires GSX), PACMAN, SCRAM (last one uses scroll extensively).
*/
// license:GPL-2.0+
@@ -126,9 +128,7 @@ CURRENTY UNEMULATED
(a) the serial port does work one way only (incomplete null modem or wiring?), no reception yet.
The printer interface does not work, so a non fatal ERROR 40 (serial printer interface) will appear.
-(b1) LOOPBACK circuit not emulated, NMI from RAM card also unemulated (NMI vector 02).
-The former is used in startup tests, the latter seems less relevant (must use menu self test "S"
- or memory diagnostic test. TODO: mem.test causes a CPU crash when reaching higher RAM regions.
+(b1) LOOPBACK circuit not emulated ( used in startup tests ).
(b2) system interaction tests HALT Z80 CPU at location $0211 (forever). Boot the RX50 diag.disk
to see what happens (key 3 - individual tests, then 12 - system interaction). Uses LOOPBACK too?
@@ -308,14 +308,14 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND).
#define RD51_SECTORS_PER_TRACK 17 // OLD: #define RD51_SECTORS_PER_TRACK 16
#define RTC_BASE 0xFC000
-// Do not pretend to emulate newer RAM board; stick with the old one:
-// (only affects presence bit in 'system_parameter_r')
-#define OLD_RAM_BOARD_PRESENT
#ifdef ASSUME_MODEL_A_HARDWARE
// Define standard and maximum RAM sizes (A model):
#define MOTHERBOARD_RAM 0x0ffff // 64 K base RAM (100-A)
#define END_OF_RAM 0xcffff // Very last byte (theretical; on 100-A) DO NOT CHANGE.
+
+ // Pretend to emulate older RAM board (no NMI, also affects presence bit in 'system_parameter_r'):
+ #define OLD_RAM_BOARD_PRESENT
#else
// DEC-100-B probes until a 'flaky' area is found (BOOT ROM around F400:0E04).
// It is no longer possible to key in the RAM size from within the 100-B BIOS.
@@ -468,6 +468,7 @@ public:
m_p_nvram(*this, "nvram"),
m_shared(*this, "sh_ram"),
+ m_ext_ram(*this, "ext_ram"),
m_rtc(*this, "rtc"),
m_hgdc(*this, "upd7220"), // GDC-NEW
@@ -537,6 +538,8 @@ public:
DECLARE_READ8_MEMBER(rtc_enable);
DECLARE_READ8_MEMBER(rtc_r);
+ DECLARE_WRITE8_MEMBER(ext_ram_w);
+
DECLARE_WRITE_LINE_MEMBER(mpsc_irq);
DECLARE_WRITE8_MEMBER(comm_bitrate_w);
DECLARE_WRITE8_MEMBER(printer_bitrate_w);
@@ -608,6 +611,7 @@ private:
required_shared_ptr<uint8_t> m_p_vol_ram;
required_shared_ptr<uint8_t> m_p_nvram;
required_shared_ptr<uint8_t> m_shared;
+ required_shared_ptr<uint8_t> m_ext_ram;
optional_device<ds1315_device> m_rtc;
@@ -838,7 +842,7 @@ void rainbow_state::machine_start()
static ADDRESS_MAP_START(rainbow8088_map, AS_PROGRAM, 8, rainbow_state)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x00000, 0x0ffff) AM_RAM AM_SHARE("sh_ram")
-AM_RANGE(0x10000, END_OF_RAM) AM_RAM
+AM_RANGE(0x10000, END_OF_RAM) AM_RAM AM_SHARE("ext_ram") AM_WRITE(ext_ram_w)
// There is a 2212 (256 x 4 bit) NVRAM from 0xed000 to 0xed0ff (*)
// shadowed at $ec000 - $ecfff and from $ed100 - $edfff.
@@ -1065,6 +1069,10 @@ INPUT_PORTS_END
void rainbow_state::machine_reset()
{
+ // 'F3' (in partial emulation) here replaces 'CTRL-SETUP' (soft reboot on an original Rainbow)
+ // FIXME: BIOS reports error 19 when CTRL-SETUP is pressed (Z80 or flags aren't fully reset then?)
+ popmessage("Reset");
+
// Configure RAM
address_space &program = machine().device<cpu_device>("maincpu")->space(AS_PROGRAM);
uint32_t unmap_start = m_inp8->read();
@@ -1099,7 +1107,10 @@ void rainbow_state::machine_reset()
printf("\nNOTE: RAM configuration does not match NVRAM.\nUNMAP_START = %05x NVRAM VALUE = %02x SHOULD BE: %02x\n", unmap_start, NVRAM_LOCATION, check);
if(END_OF_RAM > unmap_start)
+ {
+ printf("\nUnmapping from %x to %x",unmap_start, END_OF_RAM);
program.unmap_readwrite(unmap_start, END_OF_RAM);
+ }
m_crtc->MHFU(MHFU_RESET_and_DISABLE);
@@ -1112,7 +1123,6 @@ void rainbow_state::machine_reset()
m_rtc->chip_reset(); // * Reset RTC to a defined state *
-
// *********** HARD DISK CONTROLLER...
if (m_inp5->read() == 0x01) // ...PRESENT?
{
@@ -1200,9 +1210,6 @@ void rainbow_state::machine_reset()
output().set_value("led_compose", 0); // led9
output().set_value("led_lock", 0); // led10
output().set_value("led_hold", 0); // led11
-
- if (m_POWER_GOOD) // When user presses F3, a hard reset is executed.
- machine().schedule_hard_reset(); // better ask via GUI? How...?
}
// Simulate AC_OK signal (power good) and RESET after ~ 108 ms.
@@ -1410,6 +1417,17 @@ WRITE8_MEMBER(rainbow_state::share_z80_w)
return;
}
+// NMI logic (parity test)
+WRITE8_MEMBER(rainbow_state::ext_ram_w)
+{
+ m_ext_ram[offset] = data;
+
+#ifndef OLD_RAM_BOARD_PRESENT
+ if(m_diagnostic & 0x08)
+ if( (offset + 0x10000) >= (MOTHERBOARD_RAM + 1))
+ m_i8088->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+#endif
+}
// ------------------------ClikClok (for model B; DS1315) ---------------------------------
// DESCRIPTION: version for 100-A plugs into NVRAM chip socket (unemulated yet)
@@ -1524,18 +1542,15 @@ hard_disk_file *(rainbow_state::rainbow_hdc_file(int drv))
}
else
{
- printf("\n <<< === REJECTED = (SANITY CHECK FAILED) === >>> \n");
-
uint32_t max_sector = info->cylinders * info->heads * info->sectors;
- printf("\n%u (%3.2f) MB HARD DISK REJECTED. GEOMETRY: %d HEADS (1..%d ARE OK).\n%d CYLINDERS (151 to %d ARE OK).\n%d SECTORS / TRACK (up to %d ARE OK). \n%d BYTES / SECTOR (128 to 1024 ARE OK).\n",
+ popmessage("\n%u (%3.2f) MB HARD DISK REJECTED. GEOMETRY: %d HEADS (1..%d ARE OK).\n%d CYLINDERS (151 to %d ARE OK).\n%d SECTORS / TRACK (up to %d ARE OK). \n%d BYTES / SECTOR (128 to 1024 ARE OK).\n",
max_sector * info->sectorbytes / 1000000,
(float)max_sector * (float)info->sectorbytes / 1048576.0f,
info->heads, RD51_MAX_HEAD,
info->cylinders, RD51_MAX_CYLINDER,
info->sectors, RD51_SECTORS_PER_TRACK,
info->sectorbytes);
-
- printf("\n <<< === REJECTED = (SANITY CHECK FAILED) === >>> \n");
+ printf("\n <<< === HARD DISK IMAGE REJECTED = (invalid geometry) === >>> \n");
return nullptr;
}
}
@@ -2478,7 +2493,6 @@ WRITE_LINE_MEMBER(rainbow_state::GDC_vblank_irq)
printf(" [HINT: DUAL MONITOR (DIP SWITCH) WRONG! NO GREEN PALETTE] ");
} // color map changed?
-
} // 7220 vblank IRQ
@@ -2508,7 +2522,7 @@ WRITE_LINE_MEMBER(rainbow_state::clear_video_interrupt)
// Reflects bits from 'diagnostic_w' (1:1), except test jumpers
READ8_MEMBER(rainbow_state::diagnostic_r) // 8088 (port 0A READ). Fig.4-29 + table 4-15
-{
+{
return ((m_diagnostic & (0xf1)) |
m_inp1->read() |
m_inp2->read() |
@@ -2565,13 +2579,9 @@ WRITE8_MEMBER(rainbow_state::diagnostic_w) // 8088 (port 0A WRITTEN). Fig.4-28 +
printf("DATA: %x (PC=%x)\n", data, machine().device("maincpu")->safe_pc());
}
- // BIT 3: PARITY TEST (1 = enables parity test on memory option board).
- if(data & 0x08)
- {
- printf("\n*** UNEMULATED PARITY TEST [on RAM EXTENSION] - (bit 3 in diagnostic_w) ");
- // FIXME: parity test = NMI? When should NMI fire? Per RAM bank?
- // m_i8088->set_input_line_and_vector(INPUT_LINE_NMI, ASSERT_LINE, 0x02);
- }
+ // BIT 3: PARITY (1 enables parity test on memory board. Usually 64K per bank). -> ext_ram_w.
+ if(data & 0x08)
+ printf("\n*** PARITY TEST [on RAM EXTENSION] - (bit 3 - diagnostic_w) ");
// MISSING BITS (* not vital for normal operation, see diag.disk) -
// * BIT 4: DIAG LOOPBACK (0 at power-up; 1 directs RX50 and DC12 output to printer port)
@@ -3071,10 +3081,7 @@ MCFG_CPU_VBLANK_INT_DRIVER("screen", rainbow_state, vblank_irq)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
-MCFG_SCREEN_REFRESH_RATE(60)
-MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
-MCFG_SCREEN_SIZE(132 * 10, 49 * 10)
-MCFG_SCREEN_VISIBLE_AREA(0, 80 * 10 - 1, 0, 48 * 10 - 1)
+MCFG_SCREEN_RAW_PARAMS(XTAL_24_0734MHz / 6, 442, 0, 400, 264, 0, 240) // ~NTSC compatible video timing (?)
MCFG_SCREEN_UPDATE_DRIVER(rainbow_state, screen_update_rainbow)
MCFG_SCREEN_PALETTE("vt100_video:palette")
@@ -3088,7 +3095,7 @@ MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r))
MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt))
// *************************** COLOR GRAPHICS (OPTION) **************************************
-// While the OSC frequency is confirmed, the divider is not. Refresh rate is ~60 Hz with 32.
+// While the OSC frequency is confirmed, the divider is not (refresh rate is ~60 Hz with 32).
MCFG_DEVICE_ADD("upd7220", UPD7220, 31188000 / 32) // Duell schematics shows a 31.188 Mhz oscillator (confirmed by RFKA).
MCFG_UPD7220_VSYNC_CALLBACK(WRITELINE(rainbow_state, GDC_vblank_irq)) // "The vsync callback line needs to be below the 7220 DEVICE_ADD line."
@@ -3099,12 +3106,15 @@ MCFG_PALETTE_ADD("palette2", 32)
MCFG_SCREEN_ADD("screen2", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK | VIDEO_ALWAYS_UPDATE)
-MCFG_SCREEN_REFRESH_RATE(60)
-MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
-MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate
-MCFG_SCREEN_SIZE(800, 256) // should be 240
-MCFG_SCREEN_VISIBLE_AREA(0, 800-1, 0, 256-1) // should be 240
+// VR241 color monitor is specified for 20 MHz bandwidth ( 60 Hz / 15.72 kHz horizontal rate )
+// - sufficient for 800 x 240 non-interlaced at 60 Hz (non interlaced).
+//MCFG_SCREEN_RAW_PARAMS(31188000 / 2 , 992, 0, 800, 262, 0, 240)
+
+// Alternate configuration:
+MCFG_SCREEN_RAW_PARAMS(31188000 / 4 , 496, 0, 400, 262, 0, 240)
+
+MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
MCFG_FD1793_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz
MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":0", rainbow_floppies, "525qd0", rainbow_state::floppy_formats)
diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp
index f362fdf03b4..9c89fb54e73 100644
--- a/src/mame/drivers/tnzs.cpp
+++ b/src/mame/drivers/tnzs.cpp
@@ -1692,6 +1692,56 @@ static MACHINE_CONFIG_DERIVED_CLASS( jpopnics, tnzs_base, jpopnics_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3)
MACHINE_CONFIG_END
+/***************************************************************************
+
+ PCBs
+
+***************************************************************************/
+/* The TNZS/Seta hardware has a variety of somewhat different pcbs, all of
+ which have both Seta and Taito Part numbers.
+ All pcbs have Z80B processors and one 6264 mainram chip and an X1-001
+ and X1-002 video chip and an X1-004 I/O? Chip, and four PALs
+
+Seta# Taito#s CPUS RxM2 ROM1 MCU? Video ram PROMs SETA X1 GFXROMs QUADRATURE ESD. PROT Games Picture
+P0-022-A K1100245A J1100108A 2xZ80B 512/256 512/256 8042 4x6116 Yes, 2 03 23c1000 uPD4701AC 3x X2-003 arkanoid2, plumppop(A) http://www.classicarcaderesource.com/RevengeOfDoh3.jpg
+P0-025-A K1100241A J1100107A 2xZ80B 512/256 512/256 8042 4x6116 Yes, 2 03 23c1000 N/A 3x X2-003 drtoppel,extermatn,chukatai(B) http://arcade.ym2149.com/pcb/taito/drtoppel_pcb_partside.jpg
+P0-028-A K1100416A J1100332A 2xZ80B 512/256 512/256 8042 4x6116 No 05,06 23c1000 N/A 3x X2-004 chukatai(B) http://i.ebayimg.com/images/g/AhoAAOSw-FZXj5A5/s-l1600.jpg
+P0-038A M6100309A 3xZ80B 512/256 512/256 NONE 1x6164 No 05,06 23c1000 N/A 3x X2-003 kageki http://i.ebayimg.com/images/a/(KGrHqJ,!lwE6C8-G97lBOjOu9mwVw~~/s-l1600.jpg
+P0-041-1 CA403001A 2xZ80B 61256 27c1000 8742 1x6164 No 05,06 27c1000 N/A 5x X2-005 tnzsop(C) http://arcade.ym2149.com/pcb/taito/tnzs_pcb3_partside.jpg
+P0-041-A K1100356A J1100156A 2xZ80B 61256 27c1000 8042 1x6164 No 05,06 23c1000 N/A 5x X2-005 tnzs(j,u)o http://arcade.ym2149.com/pcb/taito/tnzs_pcb1_partside.jpg
+P0-043A M6100356A 3xZ80B* 61256 27512** NONE 1x6164 No 05,06 LH534000(C) N/A 4x X2-004 tnzs(j,u), kabukiz http://arcade.ym2149.com/pcb/taito/tnzs_pcb2_mainboard_partside.jpg
+P0-056A K1100476A J1100201A 3xZ80B EMPTY*3 27c1000 NONE 1x6164 No 05,06 LH534000 U43??? 5x X2-005 insectx(D) http://www.jammarcade.net/images/2014/04/InsectorX.jpg
+
+(A) It is very likely plumppop also uses this P0-022-A PCB, as the game reads
+ the quadratures the same way as arkanoid2 does.
+ arkanoid2 only has 1 x2-003 ESD protection resistor pack populated, but the
+ PCB can have 3, the other two (for more joysticks/buttons?) are not
+ populated. arkanoid2's second maincpu socket is also empty, but this is
+ clearly not the case for plumppop.
+(B) chukatai has one set which unlike its earlier sets uses the P0-025-A
+ PCB, but with a daughterboard which converts four of the 23c1000 gfx ROM
+ sockets into 8 27c1000 eprom sockets, and DOES use color PROMs!
+ The other pcb set uses P0-028-A pcb and 23c1000 mask roms and color RAM,
+ but has lower rom id numbers. The higher numbered set was likely created
+ by Taito to 'use up' a stock of older P0-025-A pcbs.
+(C) This is a development/prototype PCB, hence it has 32 pin sockets for the
+ gfx ROMs as 27c1000 eproms, instead of 28 pin sockets for 23c1000 mask
+ ROMs. It also uses an (unprotected?) 8742 MCU.
+ Another curious thing is the Taito ID number may have accidentally been
+ printed in backwards order, i.e should be C1100304A which fits the pattern
+ of the other boards.
+(D) InsectorX has a lot of rework on its PCB, two greenwires for each of the
+ two LH534000 mask ROMs, and four wires connected to the X1-004 I/O chip
+ pins 18, 19, 20, and 21, connecting it to 4 pins of a dip16 chip @ U43
+ with its markings sanded off. Is this chip at U43 a tiny MCU?
+* tnzs(j,u) uses a sub board with a z80b and 23c1000 mask ROMs on it for gfx,
+ plugged into the four LH534000 mask ROM sockets and the 2nd z80 socket.
+ Like Kageki's P0-038A mainboard, this mainboard has a third z80 on it which
+ acts in place of the 8x42 mcu used by the older tnzs sets.
+** This is a 28-pin 27512 in a 32-pin socket which alternately holds a 27c1000.
+*3 This is unpopulated, but the pcb can accept a 61256 SRAM here.
+*/
+
/***************************************************************************
@@ -1708,7 +1758,7 @@ ROM_START( plumppop )
ROM_LOAD( "a98-11.bin", 0x00000, 0x10000, CRC(bc56775c) SHA1(0c22c22c0e9d7ec0e34f8ab4bfe61068f65e8759) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Chip label is a guess, also unknown if it actually uses the same MCU as drtoppel/extrmatn, but it appears to work fine */
+ ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, BAD_DUMP CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Chip label and location is a guess, also unknown if it actually uses the same MCU as drtoppel/extrmatn, but it appears to work fine, marked as bad until verified that it uses same M-001 mcu */
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "a98-01.bin", 0x00000, 0x10000, CRC(f3033dca) SHA1(130744998f0531a82de2814231dddea3ad710f60) )
@@ -1731,6 +1781,12 @@ ROM_START( plumppop )
ROM_REGION( 0x0400, "proms", 0 ) /* color proms */
ROM_LOAD( "a98-13.bpr", 0x0000, 0x200, CRC(7cde2da5) SHA1(0cccfc35fb716ebb4cffa85c75681f33ca80a56e) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "a98-12.bpr", 0x0200, 0x200, CRC(90dc9da7) SHA1(f719dead7f4597e5ee6f1103599505b98cb58299) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* pals on plumppop are unknown, but very likely the same set as arkanoid2/extrmatn/drtoppel/chukataio/etc */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( jpopnics )
@@ -1771,6 +1827,12 @@ ROM_START( extrmatn )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b06-09.15f", 0x00000, 0x200, CRC(f388b361) SHA1(f00db6ad6994cfe9b7ad76e30b7049b11f8c16e4) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b06-08.17f", 0x00200, 0x200, CRC(10c9aac3) SHA1(09d6f791dea358e78099af7a370b00b8504ffc97) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with several other games on this hardware */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( extrmatnu )
@@ -1793,8 +1855,13 @@ ROM_START( extrmatnu )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b06-09.15f", 0x00000, 0x200, CRC(f388b361) SHA1(f00db6ad6994cfe9b7ad76e30b7049b11f8c16e4) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b06-08.17f", 0x00200, 0x200, CRC(10c9aac3) SHA1(09d6f791dea358e78099af7a370b00b8504ffc97) ) /* lo bytes, AM27S29 or compatible like MB7124 */
-ROM_END
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with several other games on this hardware */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
+ROM_END
ROM_START( extrmatnur )
ROM_REGION( 0x20000, "maincpu", 0 ) /* Region 0 - main cpu */
@@ -1816,6 +1883,12 @@ ROM_START( extrmatnur )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b06-09.15f", 0x00000, 0x200, CRC(f388b361) SHA1(f00db6ad6994cfe9b7ad76e30b7049b11f8c16e4) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b06-08.17f", 0x00200, 0x200, CRC(10c9aac3) SHA1(09d6f791dea358e78099af7a370b00b8504ffc97) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with several other games on this hardware */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( extrmatnj )
@@ -1838,18 +1911,32 @@ ROM_START( extrmatnj )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b06-09.15f", 0x00000, 0x200, CRC(f388b361) SHA1(f00db6ad6994cfe9b7ad76e30b7049b11f8c16e4) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b06-08.17f", 0x00200, 0x200, CRC(10c9aac3) SHA1(09d6f791dea358e78099af7a370b00b8504ffc97) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with several other games on this hardware */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
+/*
+PCB:
+Seta: P0-022-A
+Taito: K1100245A J1100108A
+
+The arknoid2 PCB has a sticker label which says "K1100245A // REVENGE OF DOH"
+*/
+
ROM_START( arknoid2 )
ROM_REGION( 0x20000, "maincpu", 0 ) /* Region 0 - main cpu */
- ROM_LOAD( "b08_05.11c", 0x00000, 0x10000, CRC(136edf9d) SHA1(f632321650897eee585511a84f451a205d1f7704) )
+ ROM_LOAD( "b08__05.11c", 0x00000, 0x10000, CRC(136edf9d) SHA1(f632321650897eee585511a84f451a205d1f7704) )
/* 0x10000 - 0x1ffff empty */
ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */
- ROM_LOAD( "b08_13.3e", 0x00000, 0x10000, CRC(e8035ef1) SHA1(9a54e952cff0036c4b6affd9ffb1097cdccbe255) )
+ ROM_LOAD( "b08__13.3e", 0x00000, 0x10000, CRC(e8035ef1) SHA1(9a54e952cff0036c4b6affd9ffb1097cdccbe255) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP )
+ ROM_LOAD( "b08__09.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B08 // 09 and under printed label "?Taito M-009?", is a mask 8042 */
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b08-01.13a", 0x00000, 0x20000, CRC(2ccc86b4) SHA1(eced1d7e687db0331507726946b6a19a690a7604) )
@@ -1860,18 +1947,24 @@ ROM_START( arknoid2 )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b08-08.15f", 0x00000, 0x200, CRC(a4f7ebd9) SHA1(094eb63c18898c6ee8d722492bdfd28091c61773) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b08-07.16f", 0x00200, 0x200, CRC(ea34d9f7) SHA1(9a46edc64f961bd96908419cabd92445d300fc19) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( arknoid2u )
ROM_REGION( 0x20000, "maincpu", 0 ) /* Region 0 - main cpu */
- ROM_LOAD( "b08_11.11c", 0x00000, 0x10000, CRC(99555231) SHA1(2798f3f5b3f1fa27598fe7a6e95c75d9142c8d34) )
+ ROM_LOAD( "b08__11.11c", 0x00000, 0x10000, CRC(99555231) SHA1(2798f3f5b3f1fa27598fe7a6e95c75d9142c8d34) )
/* 0x10000 - 0x1ffff empty */
ROM_REGION( 0x10000, "sub", 0 ) /* Region 2 - sound cpu */
- ROM_LOAD( "b08_12.3e", 0x00000, 0x10000, CRC(dc84e27d) SHA1(d549d8c9fbec0521517f0c5f5cee763e27d48633) )
+ ROM_LOAD( "b08__12.3e", 0x00000, 0x10000, CRC(dc84e27d) SHA1(d549d8c9fbec0521517f0c5f5cee763e27d48633) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP )
+ ROM_LOAD( "b08__09.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B08 // 09 and under printed label "?Taito M-009?", is a mask 8042 */
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b08-01.13a", 0x00000, 0x20000, CRC(2ccc86b4) SHA1(eced1d7e687db0331507726946b6a19a690a7604) )
@@ -1882,6 +1975,12 @@ ROM_START( arknoid2u )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b08-08.15f", 0x00000, 0x200, CRC(a4f7ebd9) SHA1(094eb63c18898c6ee8d722492bdfd28091c61773) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b08-07.16f", 0x00200, 0x200, CRC(ea34d9f7) SHA1(9a46edc64f961bd96908419cabd92445d300fc19) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( arknoid2j )
@@ -1893,7 +1992,7 @@ ROM_START( arknoid2j )
ROM_LOAD( "b08_06.3e", 0x00000, 0x10000, CRC(adfcd40c) SHA1(f91299407ed21e2dd244c9b1a315b27ed32f5514) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP )
+ ROM_LOAD( "b08__09.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B08 // 09 and under printed label "?Taito M-009?", is a mask 8042 */
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b08-01.13a", 0x00000, 0x20000, CRC(2ccc86b4) SHA1(eced1d7e687db0331507726946b6a19a690a7604) )
@@ -1904,6 +2003,12 @@ ROM_START( arknoid2j )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b08-08.15f", 0x00000, 0x200, CRC(a4f7ebd9) SHA1(094eb63c18898c6ee8d722492bdfd28091c61773) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b08-07.16f", 0x00200, 0x200, CRC(ea34d9f7) SHA1(9a46edc64f961bd96908419cabd92445d300fc19) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( arknoid2b )
@@ -1915,7 +2020,7 @@ ROM_START( arknoid2b )
ROM_LOAD( "b08_13.3e", 0x00000, 0x10000, CRC(e8035ef1) SHA1(9a54e952cff0036c4b6affd9ffb1097cdccbe255) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP )
+ ROM_LOAD( "ark28742.3g", 0x0000, 0x0800, NO_DUMP ) /* Labeled B08 // 09 and under printed label "?Taito M-009?", is a mask 8042... does the bootleg set even HAVE the mcu? */
ROM_REGION( 0x80000, "gfx1", 0 )
ROM_LOAD( "b08-01.13a", 0x00000, 0x20000, CRC(2ccc86b4) SHA1(eced1d7e687db0331507726946b6a19a690a7604) )
@@ -1926,88 +2031,119 @@ ROM_START( arknoid2b )
ROM_REGION( 0x0400, "proms", 0 )
ROM_LOAD( "b08-08.15f", 0x00000, 0x200, CRC(a4f7ebd9) SHA1(094eb63c18898c6ee8d722492bdfd28091c61773) ) /* hi bytes, AM27S29 or compatible like MB7124 */
ROM_LOAD( "b08-07.16f", 0x00200, 0x200, CRC(ea34d9f7) SHA1(9a46edc64f961bd96908419cabd92445d300fc19) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
+/*
+PCB:
+Seta: P0-025-A
+Taito: K1100241A J1100107A
+
+The drtoppelj PCB has a sticker label which says "K1100269A // DR. ドツペル タンケン" (DoTuPeRu TaNKeN)
+*/
ROM_START( drtoppel )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
- ROM_LOAD( "b19-09.11c", 0x00000, 0x10000, CRC(3e654f82) SHA1(d9e351d82546b08eb7887ea1d976fa97a259db6e) )
- ROM_LOAD( "b19-10.9c", 0x10000, 0x10000, CRC(7e72fd25) SHA1(6035e4db75e6dc57b13bb6e92217d1c2d0ffdfd2) )
+ ROM_LOAD( "b19__09.11c", 0x00000, 0x10000, CRC(3e654f82) SHA1(d9e351d82546b08eb7887ea1d976fa97a259db6e) )
+ ROM_LOAD( "b19__10.9c", 0x10000, 0x10000, CRC(7e72fd25) SHA1(6035e4db75e6dc57b13bb6e92217d1c2d0ffdfd2) )
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "b19-15.3e", 0x00000, 0x10000, CRC(37a0d3fb) SHA1(f65fb9382af5f5b09725c39b660c5138b3912f53) ) /* Hacked??, need correct Taito rom number */
+ ROM_LOAD( "b19__15.3e", 0x00000, 0x10000, BAD_DUMP CRC(37a0d3fb) SHA1(f65fb9382af5f5b09725c39b660c5138b3912f53) ) /* Region-Hacked??, need correct Taito rom number */
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */
+ ROM_LOAD( "b06__14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06 // 14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */
ROM_REGION( 0x100000, "gfx1", 0 )
- ROM_LOAD( "b19-01.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) )
- ROM_LOAD( "b19-02.12a", 0x20000, 0x20000, CRC(790ae654) SHA1(5fd6b89918e1539e00c918959b96d2a9394c8abe) )
- ROM_LOAD( "b19-03.10a", 0x40000, 0x20000, CRC(495c4c5a) SHA1(a23b512cda4c0c535df5508a52faebe401c1797d) )
- ROM_LOAD( "b19-04.8a", 0x60000, 0x20000, CRC(647007a0) SHA1(10ec35a15091967038bb26fb116c47d730f69edc) )
- ROM_LOAD( "b19-05.7a", 0x80000, 0x20000, CRC(49f2b1a5) SHA1(5e98bb421afaa02471ad02213ea6ca23ff2f0e27) )
- ROM_LOAD( "b19-06.5a", 0xa0000, 0x20000, CRC(2d39f1d0) SHA1(2aa89a5cc7f026c8db9922b183319ff66ac4a071) )
- ROM_LOAD( "b19-07.4a", 0xc0000, 0x20000, CRC(8bb06f41) SHA1(a0c182d473317f2cdb31bdf39a2593c032002305) )
- ROM_LOAD( "b19-08.2a", 0xe0000, 0x20000, CRC(3584b491) SHA1(d0aca90708be241bbd3a1097220a85083337a4bc) )
+ ROM_LOAD( "b19-01.23c1000.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) )
+ ROM_LOAD( "b19-02.23c1000.12a", 0x20000, 0x20000, CRC(790ae654) SHA1(5fd6b89918e1539e00c918959b96d2a9394c8abe) )
+ ROM_LOAD( "b19-03.23c1000.10a", 0x40000, 0x20000, CRC(495c4c5a) SHA1(a23b512cda4c0c535df5508a52faebe401c1797d) )
+ ROM_LOAD( "b19-04.23c1000.8a", 0x60000, 0x20000, CRC(647007a0) SHA1(10ec35a15091967038bb26fb116c47d730f69edc) )
+ ROM_LOAD( "b19-05.23c1000.7a", 0x80000, 0x20000, CRC(49f2b1a5) SHA1(5e98bb421afaa02471ad02213ea6ca23ff2f0e27) )
+ ROM_LOAD( "b19-06.23c1000.5a", 0xa0000, 0x20000, CRC(2d39f1d0) SHA1(2aa89a5cc7f026c8db9922b183319ff66ac4a071) )
+ ROM_LOAD( "b19-07.23c1000.4a", 0xc0000, 0x20000, CRC(8bb06f41) SHA1(a0c182d473317f2cdb31bdf39a2593c032002305) )
+ ROM_LOAD( "b19-08.23c1000.2a", 0xe0000, 0x20000, CRC(3584b491) SHA1(d0aca90708be241bbd3a1097220a85083337a4bc) )
ROM_REGION( 0x0400, "proms", 0 ) /* color proms */
- ROM_LOAD( "b19-13.15f", 0x0000, 0x200, CRC(6a547980) SHA1(c82f8dfad028565b4b4e5be1167f2f290c929090) ) /* hi bytes, AM27S29 or compatible like MB7124 */
- ROM_LOAD( "b19-12.16f", 0x0200, 0x200, CRC(5754e9d8) SHA1(8c7d29e22c90b1f72929b95675dc15e431aae044) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+ ROM_LOAD( "b19-13.am27s29.15f", 0x0000, 0x200, CRC(6a547980) SHA1(c82f8dfad028565b4b4e5be1167f2f290c929090) ) /* hi bytes, AM27S29 or compatible like MB7124 */
+ ROM_LOAD( "b19-12.am27s29.16f", 0x0200, 0x200, CRC(5754e9d8) SHA1(8c7d29e22c90b1f72929b95675dc15e431aae044) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( drtoppelu )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
- ROM_LOAD( "b19-09.11c", 0x00000, 0x10000, CRC(3e654f82) SHA1(d9e351d82546b08eb7887ea1d976fa97a259db6e) )
- ROM_LOAD( "b19-10.9c", 0x10000, 0x10000, CRC(7e72fd25) SHA1(6035e4db75e6dc57b13bb6e92217d1c2d0ffdfd2) )
+ ROM_LOAD( "b19__09.11c", 0x00000, 0x10000, CRC(3e654f82) SHA1(d9e351d82546b08eb7887ea1d976fa97a259db6e) )
+ ROM_LOAD( "b19__10.9c", 0x10000, 0x10000, CRC(7e72fd25) SHA1(6035e4db75e6dc57b13bb6e92217d1c2d0ffdfd2) )
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "b19-14.3e", 0x00000, 0x10000, CRC(05565b22) SHA1(d1aa47b438d3b44c5177337809e38b50f6445c36) ) /* Hacked??, need correct Taito rom number */
+ ROM_LOAD( "b19__14.3e", 0x00000, 0x10000, BAD_DUMP CRC(05565b22) SHA1(d1aa47b438d3b44c5177337809e38b50f6445c36) ) /* Region-Hacked??, need correct Taito rom number */
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */
+ ROM_LOAD( "b06__14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06 // 14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */
ROM_REGION( 0x100000, "gfx1", 0 )
- ROM_LOAD( "b19-01.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) )
- ROM_LOAD( "b19-02.12a", 0x20000, 0x20000, CRC(790ae654) SHA1(5fd6b89918e1539e00c918959b96d2a9394c8abe) )
- ROM_LOAD( "b19-03.10a", 0x40000, 0x20000, CRC(495c4c5a) SHA1(a23b512cda4c0c535df5508a52faebe401c1797d) )
- ROM_LOAD( "b19-04.8a", 0x60000, 0x20000, CRC(647007a0) SHA1(10ec35a15091967038bb26fb116c47d730f69edc) )
- ROM_LOAD( "b19-05.7a", 0x80000, 0x20000, CRC(49f2b1a5) SHA1(5e98bb421afaa02471ad02213ea6ca23ff2f0e27) )
- ROM_LOAD( "b19-06.5a", 0xa0000, 0x20000, CRC(2d39f1d0) SHA1(2aa89a5cc7f026c8db9922b183319ff66ac4a071) )
- ROM_LOAD( "b19-07.4a", 0xc0000, 0x20000, CRC(8bb06f41) SHA1(a0c182d473317f2cdb31bdf39a2593c032002305) )
- ROM_LOAD( "b19-08.2a", 0xe0000, 0x20000, CRC(3584b491) SHA1(d0aca90708be241bbd3a1097220a85083337a4bc) )
+ ROM_LOAD( "b19-01.23c1000.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) )
+ ROM_LOAD( "b19-02.23c1000.12a", 0x20000, 0x20000, CRC(790ae654) SHA1(5fd6b89918e1539e00c918959b96d2a9394c8abe) )
+ ROM_LOAD( "b19-03.23c1000.10a", 0x40000, 0x20000, CRC(495c4c5a) SHA1(a23b512cda4c0c535df5508a52faebe401c1797d) )
+ ROM_LOAD( "b19-04.23c1000.8a", 0x60000, 0x20000, CRC(647007a0) SHA1(10ec35a15091967038bb26fb116c47d730f69edc) )
+ ROM_LOAD( "b19-05.23c1000.7a", 0x80000, 0x20000, CRC(49f2b1a5) SHA1(5e98bb421afaa02471ad02213ea6ca23ff2f0e27) )
+ ROM_LOAD( "b19-06.23c1000.5a", 0xa0000, 0x20000, CRC(2d39f1d0) SHA1(2aa89a5cc7f026c8db9922b183319ff66ac4a071) )
+ ROM_LOAD( "b19-07.23c1000.4a", 0xc0000, 0x20000, CRC(8bb06f41) SHA1(a0c182d473317f2cdb31bdf39a2593c032002305) )
+ ROM_LOAD( "b19-08.23c1000.2a", 0xe0000, 0x20000, CRC(3584b491) SHA1(d0aca90708be241bbd3a1097220a85083337a4bc) )
ROM_REGION( 0x0400, "proms", 0 ) /* color proms */
- ROM_LOAD( "b19-13.15f", 0x0000, 0x200, CRC(6a547980) SHA1(c82f8dfad028565b4b4e5be1167f2f290c929090) ) /* hi bytes, AM27S29 or compatible like MB7124 */
- ROM_LOAD( "b19-12.16f", 0x0200, 0x200, CRC(5754e9d8) SHA1(8c7d29e22c90b1f72929b95675dc15e431aae044) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+ ROM_LOAD( "b19-13.am27s29.15f", 0x0000, 0x200, CRC(6a547980) SHA1(c82f8dfad028565b4b4e5be1167f2f290c929090) ) /* hi bytes, AM27S29 or compatible like MB7124 */
+ ROM_LOAD( "b19-12.am27s29.16f", 0x0200, 0x200, CRC(5754e9d8) SHA1(8c7d29e22c90b1f72929b95675dc15e431aae044) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( drtoppelj )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
- ROM_LOAD( "b19-09.11c", 0x00000, 0x10000, CRC(3e654f82) SHA1(d9e351d82546b08eb7887ea1d976fa97a259db6e) )
- ROM_LOAD( "b19-10.9c", 0x10000, 0x10000, CRC(7e72fd25) SHA1(6035e4db75e6dc57b13bb6e92217d1c2d0ffdfd2) )
+ ROM_LOAD( "b19__09.11c", 0x00000, 0x10000, CRC(3e654f82) SHA1(d9e351d82546b08eb7887ea1d976fa97a259db6e) )
+ ROM_LOAD( "b19__10.9c", 0x10000, 0x10000, CRC(7e72fd25) SHA1(6035e4db75e6dc57b13bb6e92217d1c2d0ffdfd2) )
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "b19-11.3e", 0x00000, 0x10000, CRC(524dc249) SHA1(158b2de0fcd17ad16ba72bb24888122bf704e216) )
+ ROM_LOAD( "b19__11.3e", 0x00000, 0x10000, CRC(524dc249) SHA1(158b2de0fcd17ad16ba72bb24888122bf704e216) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b06-14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06-14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */
+ ROM_LOAD( "b06__14.1g", 0x0000, 0x0800, CRC(28907072) SHA1(21c7017af8a8ceb8e43d7e798f48518b136fd45c) ) /* Labeled B06 // 14 and under printed label "Taito M-001, 128P, 720100", is a mask 8042 */
ROM_REGION( 0x100000, "gfx1", 0 )
- ROM_LOAD( "b19-01.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) )
- ROM_LOAD( "b19-02.12a", 0x20000, 0x20000, CRC(790ae654) SHA1(5fd6b89918e1539e00c918959b96d2a9394c8abe) )
- ROM_LOAD( "b19-03.10a", 0x40000, 0x20000, CRC(495c4c5a) SHA1(a23b512cda4c0c535df5508a52faebe401c1797d) )
- ROM_LOAD( "b19-04.8a", 0x60000, 0x20000, CRC(647007a0) SHA1(10ec35a15091967038bb26fb116c47d730f69edc) )
- ROM_LOAD( "b19-05.7a", 0x80000, 0x20000, CRC(49f2b1a5) SHA1(5e98bb421afaa02471ad02213ea6ca23ff2f0e27) )
- ROM_LOAD( "b19-06.5a", 0xa0000, 0x20000, CRC(2d39f1d0) SHA1(2aa89a5cc7f026c8db9922b183319ff66ac4a071) )
- ROM_LOAD( "b19-07.4a", 0xc0000, 0x20000, CRC(8bb06f41) SHA1(a0c182d473317f2cdb31bdf39a2593c032002305) )
- ROM_LOAD( "b19-08.2a", 0xe0000, 0x20000, CRC(3584b491) SHA1(d0aca90708be241bbd3a1097220a85083337a4bc) )
+ ROM_LOAD( "b19-01.23c1000.13a", 0x00000, 0x20000, CRC(a7e8a0c1) SHA1(a2f017ae5b6472d4202f126d0247b3fe4b1321d1) )
+ ROM_LOAD( "b19-02.23c1000.12a", 0x20000, 0x20000, CRC(790ae654) SHA1(5fd6b89918e1539e00c918959b96d2a9394c8abe) )
+ ROM_LOAD( "b19-03.23c1000.10a", 0x40000, 0x20000, CRC(495c4c5a) SHA1(a23b512cda4c0c535df5508a52faebe401c1797d) )
+ ROM_LOAD( "b19-04.23c1000.8a", 0x60000, 0x20000, CRC(647007a0) SHA1(10ec35a15091967038bb26fb116c47d730f69edc) )
+ ROM_LOAD( "b19-05.23c1000.7a", 0x80000, 0x20000, CRC(49f2b1a5) SHA1(5e98bb421afaa02471ad02213ea6ca23ff2f0e27) )
+ ROM_LOAD( "b19-06.23c1000.5a", 0xa0000, 0x20000, CRC(2d39f1d0) SHA1(2aa89a5cc7f026c8db9922b183319ff66ac4a071) )
+ ROM_LOAD( "b19-07.23c1000.4a", 0xc0000, 0x20000, CRC(8bb06f41) SHA1(a0c182d473317f2cdb31bdf39a2593c032002305) )
+ ROM_LOAD( "b19-08.23c1000.2a", 0xe0000, 0x20000, CRC(3584b491) SHA1(d0aca90708be241bbd3a1097220a85083337a4bc) )
ROM_REGION( 0x0400, "proms", 0 ) /* color proms */
- ROM_LOAD( "b19-13.15f", 0x0000, 0x200, CRC(6a547980) SHA1(c82f8dfad028565b4b4e5be1167f2f290c929090) ) /* hi bytes, AM27S29 or compatible like MB7124 */
- ROM_LOAD( "b19-12.16f", 0x0200, 0x200, CRC(5754e9d8) SHA1(8c7d29e22c90b1f72929b95675dc15e431aae044) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+ ROM_LOAD( "b19-13.am27s29.15f", 0x0000, 0x200, CRC(6a547980) SHA1(c82f8dfad028565b4b4e5be1167f2f290c929090) ) /* hi bytes, AM27S29 or compatible like MB7124 */
+ ROM_LOAD( "b19-12.am27s29.16f", 0x0200, 0x200, CRC(5754e9d8) SHA1(8c7d29e22c90b1f72929b95675dc15e431aae044) ) /* lo bytes, AM27S29 or compatible like MB7124 */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination */
+ ROM_LOAD( "b06-10.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
/* M6100309A PCB
- P0-0038A */
+ P0-038A */
ROM_START( kageki )
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "b35-16.11c", 0x00000, 0x10000, CRC(a4e6fd58) SHA1(7cfe5b3fa6c88cdab45719f5b58541270825ad30) ) /* US ver */
@@ -2017,17 +2153,23 @@ ROM_START( kageki )
ROM_LOAD( "b35-17.43e", 0x00000, 0x10000, CRC(fdd9c246) SHA1(ac7a59ed19d0d81748cabd8b77a6ba3937e3cc99) ) /* US ver */
ROM_REGION( 0x100000, "gfx1", 0 )
- ROM_LOAD( "b35-01.13a", 0x00000, 0x20000, CRC(01d83a69) SHA1(92a84329306b58a45f7bb443a8642eeaeb04d553) )
- ROM_LOAD( "b35-02.12a", 0x20000, 0x20000, CRC(d8af47ac) SHA1(2ef9ca991bf55ed6c12bf3a7dc4aa904d7749d5c) )
- ROM_LOAD( "b35-03.10a", 0x40000, 0x20000, CRC(3cb68797) SHA1(e7669b1a9a26dede560cc87695004d29510bc1f5) )
- ROM_LOAD( "b35-04.8a", 0x60000, 0x20000, CRC(71c03f91) SHA1(edce6e5a52b0c83c1c3c6bf9bc6b7957f7941521) )
- ROM_LOAD( "b35-05.7a", 0x80000, 0x20000, CRC(a4e20c08) SHA1(5d1d23d1410fea8650b18c595b0170a17e5d89a6) )
- ROM_LOAD( "b35-06.5a", 0xa0000, 0x20000, CRC(3f8ab658) SHA1(44de7ee2bdb89bc520ed9bc812c26789c3f31411) )
- ROM_LOAD( "b35-07.4a", 0xc0000, 0x20000, CRC(1b4af049) SHA1(09783816d5076219d241538e2711402eb8c4cd03) )
- ROM_LOAD( "b35-08.2a", 0xe0000, 0x20000, CRC(deb2268c) SHA1(318bf3da6cbe20758397d5f78caf3cda02f322d7) )
+ ROM_LOAD( "b35__01.13a", 0x00000, 0x20000, CRC(01d83a69) SHA1(92a84329306b58a45f7bb443a8642eeaeb04d553) )
+ ROM_LOAD( "b35__02.12a", 0x20000, 0x20000, CRC(d8af47ac) SHA1(2ef9ca991bf55ed6c12bf3a7dc4aa904d7749d5c) )
+ ROM_LOAD( "b35__03.10a", 0x40000, 0x20000, CRC(3cb68797) SHA1(e7669b1a9a26dede560cc87695004d29510bc1f5) )
+ ROM_LOAD( "b35__04.8a", 0x60000, 0x20000, CRC(71c03f91) SHA1(edce6e5a52b0c83c1c3c6bf9bc6b7957f7941521) )
+ ROM_LOAD( "b35__05.7a", 0x80000, 0x20000, CRC(a4e20c08) SHA1(5d1d23d1410fea8650b18c595b0170a17e5d89a6) )
+ ROM_LOAD( "b35__06.5a", 0xa0000, 0x20000, CRC(3f8ab658) SHA1(44de7ee2bdb89bc520ed9bc812c26789c3f31411) )
+ ROM_LOAD( "b35__07.4a", 0xc0000, 0x20000, CRC(1b4af049) SHA1(09783816d5076219d241538e2711402eb8c4cd03) )
+ ROM_LOAD( "b35__08.2a", 0xe0000, 0x20000, CRC(deb2268c) SHA1(318bf3da6cbe20758397d5f78caf3cda02f322d7) )
ROM_REGION( 0x10000, "samples", 0 ) /* samples */
ROM_LOAD( "b35-15.98g", 0x00000, 0x10000, CRC(e6212a0f) SHA1(43891f4fd141b00ed458be47a107a2550a0534c2) ) /* US ver */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination except d9 */
+ ROM_LOAD( "b06-101.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( kagekij )
@@ -2050,6 +2192,12 @@ ROM_START( kagekij )
ROM_REGION( 0x10000, "samples", 0 ) /* samples */
ROM_LOAD( "b35-12.98g", 0x00000, 0x10000, CRC(184409f1) SHA1(711bdd499670e86630ebb6820262b1d8d651c987) ) /* JP ver */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination except d9 */
+ ROM_LOAD( "b06-101.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
/* Board ID is M6100309A - program rom has been hacked to say 1992 :/
@@ -2076,6 +2224,12 @@ ROM_START( kagekih )
ROM_REGION( 0x10000, "samples", 0 ) /* samples */
ROM_LOAD( "b35-12.98g", 0x00000, 0x10000, CRC(184409f1) SHA1(711bdd499670e86630ebb6820262b1d8d651c987) ) /* JP ver */
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination except d9 */
+ ROM_LOAD( "b06-101.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
@@ -2083,7 +2237,22 @@ ROM_END
Chuka Taisen
Taito, 1988
-PCB Layout
+This PCB comes in two variations: one which is on the older, color prom based P0-025-A PCB as used on extrmatn, drtoppel
+and one which is a unique PCB sort of an 'older version of p0-051-a' which uses color ram like tnzs.
+The color prom version is not dumped yet.
+
+The chukatai (p0-025-a) PCB has a sticker label which says "????????? // CHUKATAISEN"
+The chukatai (p0-028-a) PCB has a sticker label which says "K1100??2A // CHUKATAISEN"
+
+PCB:
+Older(technically 'newer rom ids but used to get rid of old pcb stock') set is:
+Seta: P0-025-A
+Taito: K1100241A J1100107A
+
+The two newer sets are:
+Seta: P0-028-A
+Taito: K1100416A J1100332A
+which is described in the diagram below.
|--------------------------------------------------|
| SETA SETA 12MHz |
@@ -2116,6 +2285,13 @@ PCB Layout
Notes:
6264: 8K x8 SRAM
6116: 2K x8 SRAM
+
+The undumped Chuka Taisen set has a daughterboard which plugs into the
+GFX ROM sockets and allows use of 27c1000d eproms instead of 23c1000 mask roms.
+The undumped set, unlike the two here, runs on an older drtoppel/extrmatn pcb
+and uses color proms!
+
+
*/
ROM_START( chukatai )
@@ -2127,7 +2303,7 @@ ROM_START( chukatai )
ROM_LOAD( "b44-12w", 0x00000, 0x10000, CRC(e80ecdca) SHA1(cd96403ca97f18f630118dcb3dc2179c01147213) ) /* Hacked??, need correct Taito rom number */
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) )
+ ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) ) /* B44 // 09 is the label? what is the mask number under the label? maybe Taito M-011? last digit is definitely 1 */
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b44-01.a13", 0x00000, 0x20000, CRC(aae7b3d5) SHA1(52809ea22d98811ece2fb27e80db6ddf4fbacb07) )
@@ -2138,6 +2314,12 @@ ROM_START( chukatai )
ROM_LOAD( "b44-06.a05", 0xa0000, 0x20000, CRC(269978a8) SHA1(aef7b8d3d00dcc4201e0a1e28026f6f1bdafd0b7) )
ROM_LOAD( "b44-07.a04", 0xc0000, 0x20000, CRC(3e0e737e) SHA1(f8d62c7b69c79da9df7ef5ce454060d3645e5884) )
ROM_LOAD( "b44-08.a02", 0xe0000, 0x20000, CRC(6cb1e8fc) SHA1(4ab0c2cce1de2616044a9bfb9bf17f95a49baffd) )
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination except d9 */
+ ROM_LOAD( "b06-101.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( chukataiu )
@@ -2146,10 +2328,10 @@ ROM_START( chukataiu )
ROM_LOAD( "b44-11", 0x10000, 0x10000, CRC(32484094) SHA1(f320fea2910816b5085ca9aa37e30af665fb6be1) )
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "b44-12u", 0x00000, 0x10000, CRC(9f09fd5c) SHA1(ae92f2e893e1e666dcabbd793f1a778c5e3d7bab) ) /* Hacked??, need correct Taito rom number */
+ ROM_LOAD( "b44-12u", 0x00000, 0x10000, BAD_DUMP CRC(9f09fd5c) SHA1(ae92f2e893e1e666dcabbd793f1a778c5e3d7bab) ) /* Hacked??, need correct Taito rom number */
ROM_REGION( 0x1000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) )
+ ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) ) /* B44 // 09 is the label? what is the mask number under the label? maybe Taito M-011? last digit is definitely 1 */
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b44-01.a13", 0x00000, 0x20000, CRC(aae7b3d5) SHA1(52809ea22d98811ece2fb27e80db6ddf4fbacb07) )
@@ -2160,6 +2342,12 @@ ROM_START( chukataiu )
ROM_LOAD( "b44-06.a05", 0xa0000, 0x20000, CRC(269978a8) SHA1(aef7b8d3d00dcc4201e0a1e28026f6f1bdafd0b7) )
ROM_LOAD( "b44-07.a04", 0xc0000, 0x20000, CRC(3e0e737e) SHA1(f8d62c7b69c79da9df7ef5ce454060d3645e5884) )
ROM_LOAD( "b44-08.a02", 0xe0000, 0x20000, CRC(6cb1e8fc) SHA1(4ab0c2cce1de2616044a9bfb9bf17f95a49baffd) )
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination except d9 */
+ ROM_LOAD( "b06-101.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
ROM_START( chukataij )
@@ -2171,7 +2359,7 @@ ROM_START( chukataij )
ROM_LOAD( "b44-12", 0x00000, 0x10000, CRC(0600ace6) SHA1(3d5767b91ea63128bfbff3527ddcf90fcf43af2e) )
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) )
+ ROM_LOAD( "b44-8742.mcu", 0x0000, 0x0800, CRC(7dff3f9f) SHA1(bbf4e036d025fe8179b053d639f9b8ad401e6e68) ) /* B44 // 09 is the label? what is the mask number under the label? maybe Taito M-011? last digit is definitely 1 */
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b44-01.a13", 0x00000, 0x20000, CRC(aae7b3d5) SHA1(52809ea22d98811ece2fb27e80db6ddf4fbacb07) )
@@ -2182,17 +2370,27 @@ ROM_START( chukataij )
ROM_LOAD( "b44-06.a05", 0xa0000, 0x20000, CRC(269978a8) SHA1(aef7b8d3d00dcc4201e0a1e28026f6f1bdafd0b7) )
ROM_LOAD( "b44-07.a04", 0xc0000, 0x20000, CRC(3e0e737e) SHA1(f8d62c7b69c79da9df7ef5ce454060d3645e5884) )
ROM_LOAD( "b44-08.a02", 0xe0000, 0x20000, CRC(6cb1e8fc) SHA1(4ab0c2cce1de2616044a9bfb9bf17f95a49baffd) )
+
+ ROM_REGION( 0x10000, "pal", 0 ) /* these are shared with extermination except d9 */
+ ROM_LOAD( "b06-101.pal16l8a.d9.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-11.pal16l8a.d6.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-12.pal16l8a.c3.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.c2.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
+/*An undumped set of chuka taisen exists with all roms in the b44-14
+thru b44-25 number range and 27c1000d gfx roms, AND COLOR PROMS, using the older p0-025-a pcb
+This set, unlike the others, does use the b06-10.pal16l8a.d9.jed "older" pal rather than the 'newer' b06-101.pal16l8a.d9.jed pal.
+*/
+
/*
The New Zealand Story
Taito, 1988
-This PCB runs on Taito/Seta hardware.
-
PCB Layout ("New style PCB" with 3x z80 and no M-chip, and a daughterboard w/roms and z80)
----------
+The tnzs PCB has a sticker label which says "M6100409A // N.Z.LAND STORY"
M6100356A (on PCB)
P0-043A (Seta number; on PCB)
@@ -2258,7 +2456,6 @@ Notes:
*/
/* tnzs - new style PCB sets */
-
ROM_START( tnzs )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
ROM_LOAD( "b53-24.u1", 0x00000, 0x20000, CRC(d66824c6) SHA1(fd381ac0dc52ce670c3fde320ea60a209e288a52) )
@@ -2280,7 +2477,10 @@ ROM_START( tnzs )
ROM_LOAD( "b53-21.ic14", 0xe0000, 0x20000, CRC(9800c54d) SHA1(761647177d621ac2cdd8b009876eed35809f3c92) ) /* Also labeled as U46U */
ROM_REGION( 0x10000, "pal", 0 )
- ROM_LOAD( "b53-15.pal16l8a.subpcb.ic6.jed", 0x00000, 0x01000, NO_DUMP) // on sub pcb
+ /* these are shared with extermination except for the subpcb pal */
+ ROM_LOAD( "b06-13.pal16l8a.f2.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-101.pal16l8a.i2.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b53-15.pal16l8a.subpcb.ic6.jed", 0x03000, 0x01000, NO_DUMP) // on sub pcb
ROM_END
ROM_START( tnzsj )
@@ -2304,7 +2504,10 @@ ROM_START( tnzsj )
ROM_LOAD( "b53-21.ic14", 0xe0000, 0x20000, CRC(9800c54d) SHA1(761647177d621ac2cdd8b009876eed35809f3c92) ) /* Also labeled as U46U */
ROM_REGION( 0x10000, "pal", 0 )
- ROM_LOAD( "b53-15.pal16l8a.subpcb.ic6.jed", 0x00000, 0x01000, NO_DUMP) // on sub pcb
+ /* these are shared with extermination except for the subpcb pal */
+ ROM_LOAD( "b06-13.pal16l8a.f2.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-101.pal16l8a.i2.jed", 0x02000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b53-15.pal16l8a.subpcb.ic6.jed", 0x03000, 0x01000, NO_DUMP) // on sub pcb
ROM_END
/* tnzs - old style PCB sets
@@ -2316,9 +2519,10 @@ Taito ID: K1100356A
MAIN PCB
Seta ID: P0-041A
*/
-/* This pcb is similar but not identical to the Chuka Taisen pcb;
+/* This pcb is derived from the Chuka Taisen,DrToppel and Arkanoid 2 pcbs, replacing the two color proms with color ram;
There is an M-chip i8x42 (with Taito silkscreen) and no 3rd z80.
- There is no daughter-pcb like the later TNZS pcb has. */
+ There is no daughter-pcb like the later TNZS pcb has.
+ GFX Roms on the pcb are 28 pin 23C1000/TC531000 128K mask roms */
ROM_START( tnzsjo )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
ROM_LOAD( "b53-10.27c1001d.u32", 0x00000, 0x20000, CRC(a73745c6) SHA1(73eb38e75e08312d752332f988dc655084b4a86d) )
@@ -2374,7 +2578,7 @@ ROM_START( tnzsuo )
ROM_LOAD( "b06-101.pal16l8a.u36.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
-ROM_START( tnzso )
+ROM_START( tnzso ) // is this a legit set, or a hack, or a near-final (later than tnzsop below) prototype?
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
ROM_LOAD( "b53-unknown.27c1001d.u32", 0x00000, 0x20000, CRC(edf3b39e) SHA1(be221c99e50795d569611dba454c3954a259a859) ) // ROM LABEL FOR THIS SET IS UNKNOWN
@@ -2403,31 +2607,36 @@ ROM_START( tnzso )
ROM_LOAD( "b06-101.pal16l8a.u36.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
-ROM_START( tnzsop ) // prototype/location test version?
+/* This is a prototype CA403001A PCB (Seta: P0-041-1), and is ALMOST but not exactly the same as the K1100356A/J1100156A (Seta: P0-041A) 'tnzsuo/tnzsjo/arkanoid2/etc' pcb above:
+This pcb uses 32-pin 27c1000d eproms for the 8 gfx roms, and the final K1100356A/J1100156A pcb uses 28 pin 23c1000 mask roms instead. Some capacitors near the jamma connector were moved as well.
+No other obviously evident routing/wiring changes are present.
+This type of pcb might have been used for in-house testing of all the games on this hardware.
+*/
+ROM_START( tnzsop ) // prototype (location test?) version; has different rom labels, and the Seta X1-001 chip has prototype markings revealing it was fabbed by Yamaha, as 'YM3906'
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
- ROM_LOAD( "ns_c-11.27c1001d.u32", 0x00000, 0x20000, CRC(3c1dae7b) SHA1(0004fccc171714c80565326f8690f9662c5b75d9) )
+ ROM_LOAD( "c-11__6-24__1959h.d27c1000d-15.u32", 0x00000, 0x20000, CRC(3c1dae7b) SHA1(0004fccc171714c80565326f8690f9662c5b75d9) ) // Labeled as PCB location, date of 6/24 & checksum - NEC D271000d eprom
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "ns_e-3.27c512.u38", 0x00000, 0x10000, CRC(c7662e96) SHA1(be28298bfde4e3867cfe75633ffb0f8611dbbd8b) )
+ ROM_LOAD( "e-3__6-24__c4ach.tmm27512d-20.u38", 0x00000, 0x10000, CRC(c7662e96) SHA1(be28298bfde4e3867cfe75633ffb0f8611dbbd8b) ) // Labeled as PCB location, date of 6/24 & checksum - TMM27512D eprom
ROM_REGION( 0x10000, "mcu", 0 ) /* M-Chip (i8x42 internal ROM) */
- ROM_LOAD( "b53-09.u46", 0x0000, 0x0800, CRC(a4bfce19) SHA1(9340862d5bdc1ad4799dc92cae9bce1428b47478) )
+ ROM_LOAD( "b8042h__'88-6-22__0fcc.d8742.u46", 0x0000, 0x0800, CRC(a4bfce19) SHA1(9340862d5bdc1ad4799dc92cae9bce1428b47478) ) // Dated '88/6/22 with checksum - Intel D8742 MCU
ROM_REGION( 0x100000, "gfx1", 0 )
- ROM_LOAD( "ns_a13.rom.u8", 0x00000, 0x20000, CRC(7e0bd5bb) SHA1(95dfb00ec915778e02d8bfa996735ab817191adc) )
- ROM_LOAD( "ns_a12.rom.u7", 0x20000, 0x20000, CRC(95880726) SHA1(f4fdedd23e80a6ccf32f737ab4bc57f9fc0925be) )
- ROM_LOAD( "ns_a10.rom.u6", 0x40000, 0x20000, CRC(2bc4c053) SHA1(cd7668a7733e5e80c2c566d0cf63c4310e5743b4) )
- ROM_LOAD( "ns_a08.rom.u5", 0x60000, 0x20000, CRC(8ff8d88c) SHA1(31977e39ad048a077e9b5bd712ff66b14a466d27) )
- ROM_LOAD( "ns_a07.rom.u4", 0x80000, 0x20000, CRC(291bcaca) SHA1(4f659a0cd2ff6b4ec04ab95ee8a670222c402c2b) )
- ROM_LOAD( "ns_a05.rom.u3", 0xa0000, 0x20000, CRC(6e762e20) SHA1(66731fe4053b9c09bc9c95d10aba212db08b4636) )
- ROM_LOAD( "ns_a04.rom.u2", 0xc0000, 0x20000, CRC(e1fd1b9d) SHA1(6027491b927c2ab9c77fbf8895da1abcfbe32d62) )
- ROM_LOAD( "ns_a02.rom.u1", 0xe0000, 0x20000, CRC(2ab06bda) SHA1(2b208b564e55c258665e1f66b26fe14a6c68eb96) )
+ ROM_LOAD( "a13__03e8.d27c1000d-15.a13", 0x00000, 0x20000, CRC(7e0bd5bb) SHA1(95dfb00ec915778e02d8bfa996735ab817191adc) ) // labels contain the PCB location & checksum
+ ROM_LOAD( "a12__f4ec.d27c1000d-15.a12", 0x20000, 0x20000, CRC(95880726) SHA1(f4fdedd23e80a6ccf32f737ab4bc57f9fc0925be) ) // PCB CA403001A did NOT have silkscreened U1 - U8 labels
+ ROM_LOAD( "a10__f2b5.d27c1000d-15.a10", 0x40000, 0x20000, CRC(2bc4c053) SHA1(cd7668a7733e5e80c2c566d0cf63c4310e5743b4) ) // PCB also labeled as P0-041-1
+ ROM_LOAD( "a08__bd49.d27c1000d-15.a8", 0x60000, 0x20000, CRC(8ff8d88c) SHA1(31977e39ad048a077e9b5bd712ff66b14a466d27) )
+ ROM_LOAD( "a07__d5f3.d27c1000d-15.a7", 0x80000, 0x20000, CRC(291bcaca) SHA1(4f659a0cd2ff6b4ec04ab95ee8a670222c402c2b) )
+ ROM_LOAD( "a05__662a.d27c1000d-15.a5", 0xa0000, 0x20000, CRC(6e762e20) SHA1(66731fe4053b9c09bc9c95d10aba212db08b4636) )
+ ROM_LOAD( "a04__0c21.d27c1000d-15.a4", 0xc0000, 0x20000, CRC(e1fd1b9d) SHA1(6027491b927c2ab9c77fbf8895da1abcfbe32d62) )
+ ROM_LOAD( "a02__904f.d27c1000d-15.a2", 0xe0000, 0x20000, CRC(2ab06bda) SHA1(2b208b564e55c258665e1f66b26fe14a6c68eb96) )
- ROM_REGION( 0x10000, "pal", 0 ) /* PALS not directly observed on this board but assumed to exist */
+ ROM_REGION( 0x10000, "pal", 0 )
/* these are probably shared with extermination except for u35 */
- ROM_LOAD( "b06-12.pal16l8a.u26.jed", 0x00000, 0x01000, NO_DUMP)
- ROM_LOAD( "b06-13.pal16l8a.u25.jed", 0x01000, 0x01000, NO_DUMP)
- ROM_LOAD( "b53-12.pal16l8a.u35.jed", 0x02000, 0x01000, NO_DUMP) // likely has a different name on the proto pcb...
+ ROM_LOAD( "b06-12.pal16l8a.u26.jed", 0x00000, 0x01000, NO_DUMP)
+ ROM_LOAD( "b06-13.pal16l8a.u25.jed", 0x01000, 0x01000, NO_DUMP)
+ ROM_LOAD( "st-6.pal16l8a.u35.jed", 0x02000, 0x01000, NO_DUMP)
ROM_LOAD( "b06-101.pal16l8a.u36.jed", 0x03000, 0x01000, NO_DUMP)
ROM_END
@@ -2513,26 +2722,26 @@ ROM_END
ROM_START( insectx )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
- ROM_LOAD( "b97-03.u32", 0x00000, 0x20000, CRC(18eef387) SHA1(b22633930d39be1e72fbd5b080972122da3cb3ef) )
+ ROM_LOAD( "b97__03.u32", 0x00000, 0x20000, CRC(18eef387) SHA1(b22633930d39be1e72fbd5b080972122da3cb3ef) )
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "b97-07.u38", 0x00000, 0x10000, CRC(324b28c9) SHA1(db77a4ac60196d0f0f35dbc5c951ec29d6392463) ) /* Label is B97 07* with an astrix */
+ ROM_LOAD( "b97__07.u38", 0x00000, 0x10000, CRC(324b28c9) SHA1(db77a4ac60196d0f0f35dbc5c951ec29d6392463) ) /* Label is B97 07* with an asterisk */
ROM_REGION( 0x100000, "gfx1", 0 ) /* Mask roms */
- ROM_LOAD( "b97-01.u1", 0x00000, 0x80000, CRC(d00294b1) SHA1(f43a4f7d13193ddbbcdef71a5085c1db0fc062d4) )
- ROM_LOAD( "b97-02.u2", 0x80000, 0x80000, CRC(db5a7434) SHA1(71fac872b19a13a7ad25c8ad895c322ec9573fdc) )
+ ROM_LOAD( "b97__01.u1", 0x00000, 0x80000, CRC(d00294b1) SHA1(f43a4f7d13193ddbbcdef71a5085c1db0fc062d4) )
+ ROM_LOAD( "b97__02.u2", 0x80000, 0x80000, CRC(db5a7434) SHA1(71fac872b19a13a7ad25c8ad895c322ec9573fdc) )
ROM_END
ROM_START( insectxj )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k + bankswitch areas for the first CPU */
- ROM_LOAD( "b97-03.u32", 0x00000, 0x20000, CRC(18eef387) SHA1(b22633930d39be1e72fbd5b080972122da3cb3ef) )
+ ROM_LOAD( "b97__03.u32", 0x00000, 0x20000, CRC(18eef387) SHA1(b22633930d39be1e72fbd5b080972122da3cb3ef) )
ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */
- ROM_LOAD( "b97-04.u38", 0x00000, 0x10000, CRC(dc4549e5) SHA1(9920f7c12e047ee165418d33b3add51ea615df7e) ) /* Label is B97 04* with an astrix */
+ ROM_LOAD( "b97__04.u38", 0x00000, 0x10000, CRC(dc4549e5) SHA1(9920f7c12e047ee165418d33b3add51ea615df7e) ) /* Label is B97 04* with an asterisk */
ROM_REGION( 0x100000, "gfx1", 0 ) /* Mask roms */
- ROM_LOAD( "b97-01.u1", 0x00000, 0x80000, CRC(d00294b1) SHA1(f43a4f7d13193ddbbcdef71a5085c1db0fc062d4) )
- ROM_LOAD( "b97-02.u2", 0x80000, 0x80000, CRC(db5a7434) SHA1(71fac872b19a13a7ad25c8ad895c322ec9573fdc) )
+ ROM_LOAD( "b97__01.u1", 0x00000, 0x80000, CRC(d00294b1) SHA1(f43a4f7d13193ddbbcdef71a5085c1db0fc062d4) )
+ ROM_LOAD( "b97__02.u2", 0x80000, 0x80000, CRC(db5a7434) SHA1(71fac872b19a13a7ad25c8ad895c322ec9573fdc) )
ROM_END
@@ -2562,12 +2771,12 @@ GAME( 1988, chukatai, 0, tnzs, chukatai, driver_device, 0, ROT0, "
GAME( 1988, chukataiu, chukatai, tnzs, chukatau, driver_device, 0, ROT0, "Taito America Corporation", "Chuka Taisen (US)", MACHINE_SUPPORTS_SAVE ) /* Possible region hack */
GAME( 1988, chukataij, chukatai, tnzs, chukatau, driver_device, 0, ROT0, "Taito Corporation", "Chuka Taisen (Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, tnzs, 0, tnzsb, tnzs, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, driver_device, 0, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, driver_device, 0, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, tnzs, 0, tnzsb, tnzs, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, driver_device, 0, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, driver_device, 0, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, tnzsuo, tnzs, tnzs, tnzsjo, driver_device, 0, ROT0, "Taito America Corporation", "The NewZealand Story (US, old version) (older PCB)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, tnzso, tnzs, tnzs, tnzsop, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, old version) (older PCB)", MACHINE_SUPPORTS_SAVE )
-GAME( 1988, tnzsop, tnzs, tnzs, tnzsop, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype?) (older PCB)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, tnzso, tnzs, tnzs, tnzsop, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, old version) (older PCB)", MACHINE_SUPPORTS_SAVE )
+GAME( 1988, tnzsop, tnzs, tnzs, tnzsop, driver_device, 0, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype) (older PCB)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, kabukiz, 0, kabukiz, kabukiz, driver_device, 0, ROT0, "Kaneko / Taito Corporation Japan", "Kabuki-Z (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, kabukizj, kabukiz, kabukiz, kabukizj, driver_device, 0, ROT0, "Kaneko / Taito Corporation", "Kabuki-Z (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/dec0.h b/src/mame/includes/dec0.h
index 04fa13641fd..fd03153d4db 100644
--- a/src/mame/includes/dec0.h
+++ b/src/mame/includes/dec0.h
@@ -134,6 +134,7 @@ public:
uint16_t m_automat_scroll_regs[4];
DECLARE_WRITE16_MEMBER(automat_control_w);
+ DECLARE_WRITE16_MEMBER(secretab_sound_w);
DECLARE_READ16_MEMBER( automat_palette_r );
DECLARE_WRITE16_MEMBER( automat_palette_w );
DECLARE_WRITE16_MEMBER( automat_scroll_w )
diff --git a/src/mame/includes/fromance.h b/src/mame/includes/fromance.h
index 0960aff05bb..5e80e4d4c75 100644
--- a/src/mame/includes/fromance.h
+++ b/src/mame/includes/fromance.h
@@ -50,7 +50,7 @@ public:
uint8_t m_crtc_register;
uint8_t m_crtc_data[0x10];
emu_timer *m_crtc_timer;
-
+
/* misc */
uint8_t m_directionflag;
uint8_t m_commanddata;
@@ -98,7 +98,8 @@ public:
TIMER_CALLBACK_MEMBER(crtc_interrupt_gen);
inline void get_fromance_tile_info( tile_data &tileinfo, int tile_index, int layer );
inline void get_nekkyoku_tile_info( tile_data &tileinfo, int tile_index, int layer );
- void init_common( );
+ void init_common();
+ void crtc_refresh();
DECLARE_WRITE_LINE_MEMBER(fromance_adpcm_int);
required_device<cpu_device> m_maincpu;
optional_device<msm5205_device> m_msm;
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index d31e5eee52a..7cc2ddafdc1 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -10703,6 +10703,7 @@ lwar_a81 //
lwar_a83 //
lwar_e90 //
mnfb_c27 //
+mnfb_c29 //
play_a24 //
poto_a29 //
poto_a32 //
@@ -11991,6 +11992,7 @@ sd1 // 1990 SD-1
sd132 // 1991 SD-1 32
sq1 // 1990 SQ-1
sqrack // 1990 SQ-Rack
+sq2 // 1991 SQ-2
vfx // 1989 VFX
vfxsd // 1989 VFX-SD
diff --git a/src/mame/video/fromance.cpp b/src/mame/video/fromance.cpp
index a8ec021036c..d94982d4ca5 100644
--- a/src/mame/video/fromance.cpp
+++ b/src/mame/video/fromance.cpp
@@ -217,6 +217,7 @@ WRITE8_MEMBER(fromance_state::fromance_scroll_w)
}
else
{
+
switch (offset)
{
case 0:
@@ -250,15 +251,46 @@ TIMER_CALLBACK_MEMBER(fromance_state::crtc_interrupt_gen)
m_crtc_timer->adjust(m_screen->frame_period() / param, 0, m_screen->frame_period() / param);
}
-
+/*
+ 0 1 2 3 4 5
+57 63 69 71 1f 00 (all games)
+4f 62 69 71 1f 04 nekkyoku
+ 8 9 A B
+7a 7b 7d 7f (all games)
+79 7a 7d 7f nekkyoku (gameplay/title screen)
+77 79 7d 7e nekkyoku (gals display)
+ */
+// TODO: guesswork, looks fully programmable
+void fromance_state::crtc_refresh()
+{
+ if(m_crtc_data[0] == 0) // sanity check
+ return;
+
+ rectangle visarea;
+ attoseconds_t refresh;
+
+ visarea.min_x = 0;
+ visarea.min_y = 0;
+ visarea.max_x = ((m_crtc_data[0]+1)*4) - 1;
+ visarea.max_y = 240 - 1;
+
+ refresh = HZ_TO_ATTOSECONDS(60);
+
+ m_screen->configure(512, 256, visarea, refresh);
+}
+
WRITE8_MEMBER(fromance_state::fromance_crtc_data_w)
{
m_crtc_data[m_crtc_register] = data;
switch (m_crtc_register)
{
- /* only register we know about.... */
+ case 0x00:
+ crtc_refresh();
+ break;
+
case 0x0b:
+ // TODO: actually is never > 0x80?
m_crtc_timer->adjust(m_screen->time_until_vblank_start(), (data > 0x80) ? 2 : 1);
break;
@@ -271,13 +303,10 @@ WRITE8_MEMBER(fromance_state::fromance_crtc_data_w)
WRITE8_MEMBER(fromance_state::fromance_crtc_register_w)
{
- m_crtc_register = data;
+ m_crtc_register = data & 0x0f;
}
-
-
-
/*************************************
*
* Main screen refresh
diff --git a/src/mame/video/m58.cpp b/src/mame/video/m58.cpp
index 2120ee396d7..352f57c31c7 100644
--- a/src/mame/video/m58.cpp
+++ b/src/mame/video/m58.cpp
@@ -171,6 +171,7 @@ TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows)
void m58_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::tilemap_scan_rows),this), 8, 8, 64, 32);
+ m_bg_tilemap->set_scrolldy(32, 32);
m_screen->register_screen_bitmap(m_scroll_panel_bitmap);
save_item(NAME(m_scroll_panel_bitmap));
@@ -186,24 +187,8 @@ void m58_state::video_start()
WRITE8_MEMBER(m58_state::flipscreen_w)
{
- int width = m_screen->width();
- int height = m_screen->height();
- const rectangle &visarea = m_screen->visible_area();
-
/* screen flip is handled both by software and hardware */
- bool flipscreen = BIT(data, 0) ^ BIT(~ioport("DSW2")->read(), 0);
- flip_screen_set(flipscreen);
-
- if (flipscreen)
- {
- m_bg_tilemap->set_scrolldx(0, 0);
- m_bg_tilemap->set_scrolldy(0, 32);
- }
- else
- {
- m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1));
- m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1));
- }
+ flip_screen_set(BIT(data, 0) ^ BIT(~ioport("DSW2")->read(), 0));
machine().bookkeeping().coin_counter_w(0, data & 0x02);
machine().bookkeeping().coin_counter_w(1, data & 0x20);
diff --git a/src/mame/video/phoenix.cpp b/src/mame/video/phoenix.cpp
index 3d86eab1c26..5c7b365924c 100644
--- a/src/mame/video/phoenix.cpp
+++ b/src/mame/video/phoenix.cpp
@@ -243,21 +243,6 @@ WRITE8_MEMBER(phoenix_state::phoenix_videoreg_w)
m_cocktail_mode = m_videoram_pg_index && (ioport("CAB")->read() & 0x01);
- if (m_cocktail_mode)
- {
- m_fg_tilemap->set_scrolldx(0, 0);
- m_bg_tilemap->set_scrolldx(0, 0);
- m_fg_tilemap->set_scrolldy(0, 0);
- m_bg_tilemap->set_scrolldy(0, 0);
- }
- else
- {
- m_fg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART));
- m_bg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART));
- m_fg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART));
- m_bg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART));
- }
-
machine().tilemap().set_flip_all(m_cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
machine().tilemap().mark_all_dirty();
}
@@ -281,21 +266,6 @@ WRITE8_MEMBER(phoenix_state::pleiads_videoreg_w)
m_cocktail_mode = m_videoram_pg_index && (ioport("CAB")->read() & 0x01);
- if (m_cocktail_mode)
- {
- m_fg_tilemap->set_scrolldx(0, 0);
- m_bg_tilemap->set_scrolldx(0, 0);
- m_fg_tilemap->set_scrolldy(0, 0);
- m_bg_tilemap->set_scrolldy(0, 0);
- }
- else
- {
- m_fg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART));
- m_bg_tilemap->set_scrolldx(0, (HTOTAL - HBSTART));
- m_fg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART));
- m_bg_tilemap->set_scrolldy(0, (VTOTAL - VBSTART));
- }
-
machine().tilemap().set_flip_all(m_cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
machine().tilemap().mark_all_dirty();
}
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index dff6082745e..a6cfad8cae9 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -164,14 +164,15 @@ private:
shaders::shaders() :
d3dintf(nullptr), machine(nullptr), d3d(nullptr), post_fx_enable(false), oversampling_enable(false),
- num_screens(0), curr_screen(0), shadow_texture(nullptr), options(nullptr), black_surface(nullptr),
- black_texture(nullptr), recording_movie(false), render_snap(false), snap_copy_target(nullptr),
- snap_copy_texture(nullptr), snap_target(nullptr), snap_texture(nullptr), snap_width(0), snap_height(0),
- initialized(false), backbuffer(nullptr), curr_effect(nullptr), default_effect(nullptr),
- prescale_effect(nullptr), post_effect(nullptr), distortion_effect(nullptr), focus_effect(nullptr),
- phosphor_effect(nullptr), deconverge_effect(nullptr), color_effect(nullptr), ntsc_effect(nullptr),
- bloom_effect(nullptr), downsample_effect(nullptr), vector_effect(nullptr), curr_texture(nullptr),
- curr_render_target(nullptr), curr_poly(nullptr), d3dx_create_effect_from_file_ptr(nullptr)
+ num_screens(0), curr_screen(0), acc_t(0), delta_t(0), shadow_texture(nullptr), options(nullptr),
+ black_surface(nullptr), black_texture(nullptr), recording_movie(false), render_snap(false),
+ snap_copy_target(nullptr), snap_copy_texture(nullptr), snap_target(nullptr), snap_texture(nullptr),
+ snap_width(0), snap_height(0), initialized(false), backbuffer(nullptr), curr_effect(nullptr),
+ default_effect(nullptr), prescale_effect(nullptr), post_effect(nullptr), distortion_effect(nullptr),
+ focus_effect(nullptr), phosphor_effect(nullptr), deconverge_effect(nullptr), color_effect(nullptr),
+ ntsc_effect(nullptr), bloom_effect(nullptr), downsample_effect(nullptr), vector_effect(nullptr),
+ curr_texture(nullptr), curr_render_target(nullptr), curr_poly(nullptr),
+ d3dx_create_effect_from_file_ptr(nullptr)
{
}
@@ -819,6 +820,8 @@ int shaders::create_resources()
void shaders::begin_draw()
{
+ double t;
+
if (!enabled())
{
return;
@@ -826,6 +829,10 @@ void shaders::begin_draw()
curr_screen = 0;
curr_effect = default_effect;
+ // Update for delta_time
+ t = machine->time().as_double();
+ delta_t = t - acc_t;
+ acc_t = t;
default_effect->set_technique("ScreenTechnique");
post_effect->set_technique("DefaultTechnique");
@@ -900,7 +907,6 @@ void shaders::blit(
curr_effect->end();
}
-
//============================================================
// shaders::find_render_target
//============================================================
@@ -1069,11 +1075,13 @@ int shaders::phosphor_pass(d3d_render_target *rt, int source_index, poly_info *p
return next_index;
}
+ // Shader needs time between last update
curr_effect = phosphor_effect;
curr_effect->update_uniforms();
curr_effect->set_texture("Diffuse", rt->target_texture[next_index]);
curr_effect->set_texture("LastPass", rt->cache_texture);
curr_effect->set_bool("Passthrough", false);
+ curr_effect->set_float("DeltaTime", delta_time());
next_index = rt->next_index(next_index);
blit(rt->target_surface[next_index], false, D3DPT_TRIANGLELIST, 0, 2);
diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h
index a2c50cba492..ed25d2c52e8 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.h
+++ b/src/osd/modules/render/d3d/d3dhlsl.h
@@ -319,7 +319,8 @@ private:
void enumerate_screens();
void render_snapshot(IDirect3DSurface9 *surface);
-
+ // Time since last call, only updates once per render of all screens
+ double delta_time() { return delta_t; }
d3d_render_target* find_render_target(int source_width, int source_height, uint32_t screen_index);
rgb_t apply_color_convolution(rgb_t color);
@@ -349,6 +350,8 @@ private:
bool oversampling_enable; // oversampling enable flag
int num_screens; // number of emulated physical screens
int curr_screen; // current screen for render target operations
+ double acc_t; // accumulated machine time
+ double delta_t; // data for delta_time
bitmap_argb32 shadow_bitmap; // shadow mask bitmap for post-processing shader
texture_info * shadow_texture; // shadow mask texture for post-processing shader
hlsl_options * options; // current options