mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
added lcd bs pin
This commit is contained in:
parent
cac42537c5
commit
cf435ac3c8
@ -13,6 +13,7 @@
|
||||
TODO:
|
||||
- proper support for LFSR program counter in debugger
|
||||
- callback for lcd screen as MAME bitmap (when needed)
|
||||
- LCD bs pin blink mode via Y register
|
||||
|
||||
*/
|
||||
|
||||
@ -46,6 +47,7 @@ void sm510_base_device::device_start()
|
||||
|
||||
m_write_sega.resolve_safe();
|
||||
m_write_segb.resolve_safe();
|
||||
m_write_segbs.resolve_safe();
|
||||
m_write_segc.resolve_safe();
|
||||
|
||||
// zerofill
|
||||
@ -64,6 +66,8 @@ void sm510_base_device::device_start()
|
||||
m_div = 0;
|
||||
m_1s = false;
|
||||
m_k_active = false;
|
||||
m_l = 0;
|
||||
m_y = 0;
|
||||
m_bp = false;
|
||||
m_bc = false;
|
||||
m_halt = false;
|
||||
@ -84,6 +88,8 @@ void sm510_base_device::device_start()
|
||||
save_item(NAME(m_div));
|
||||
save_item(NAME(m_1s));
|
||||
save_item(NAME(m_k_active));
|
||||
save_item(NAME(m_l));
|
||||
save_item(NAME(m_y));
|
||||
save_item(NAME(m_bp));
|
||||
save_item(NAME(m_bc));
|
||||
save_item(NAME(m_halt));
|
||||
@ -119,12 +125,12 @@ void sm510_base_device::device_reset()
|
||||
do_branch(3, 7, 0);
|
||||
m_prev_pc = m_pc;
|
||||
|
||||
// lcd is on (Bp on, BC off)
|
||||
// lcd is on (Bp on, BC off, bs(y) off)
|
||||
m_bp = true;
|
||||
m_bc = false;
|
||||
m_y = 0;
|
||||
|
||||
m_write_r(0, 0, 0xff);
|
||||
// y=0(bs), r=0
|
||||
}
|
||||
|
||||
|
||||
@ -148,12 +154,17 @@ inline UINT16 sm510_base_device::get_lcd_row(int column, UINT8* ram)
|
||||
|
||||
TIMER_CALLBACK_MEMBER(sm510_base_device::lcd_timer_cb)
|
||||
{
|
||||
// 4 columns, 16 segments per row
|
||||
// 4 columns
|
||||
for (int h = 0; h < 4; h++)
|
||||
{
|
||||
// 16 segments per row from upper part of RAM
|
||||
m_write_sega(h | SM510_PORT_SEGA, get_lcd_row(h, m_lcd_ram_a), 0xffff);
|
||||
m_write_segb(h | SM510_PORT_SEGB, get_lcd_row(h, m_lcd_ram_b), 0xffff);
|
||||
m_write_segc(h | SM510_PORT_SEGC, get_lcd_row(h, m_lcd_ram_c), 0xffff);
|
||||
|
||||
// bs output from L and Y regs
|
||||
UINT8 bs = m_l >> h & 1;
|
||||
m_write_segbs(h | SM510_PORT_SEGBS, (m_bc || !m_bp) ? 0 : bs, 0xffff);
|
||||
}
|
||||
|
||||
// schedule next timeout
|
||||
@ -172,19 +183,21 @@ void sm510_base_device::init_lcd_driver()
|
||||
// interrupt/timer
|
||||
//-------------------------------------------------
|
||||
|
||||
void sm510_base_device::wake_me_up()
|
||||
bool sm510_base_device::wake_me_up()
|
||||
{
|
||||
// in halt mode, wake up after 1S signal or K input
|
||||
if (m_halt)
|
||||
if (m_k_active || m_1s)
|
||||
{
|
||||
// note: official doc warns that Bl/Bm and the stack are undefined
|
||||
// after waking up, but we leave it unchanged
|
||||
m_halt = false;
|
||||
do_branch(1, 0, 0);
|
||||
|
||||
standard_irq_callback(0);
|
||||
|
||||
// note: official doc warns that Bl/Bm and the stack are undefined
|
||||
// after waking up, but we leave it unchanged
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void sm510_base_device::execute_set_input(int line, int state)
|
||||
@ -204,10 +217,7 @@ TIMER_CALLBACK_MEMBER(sm510_base_device::div_timer_cb)
|
||||
|
||||
// 1S signal on overflow(falling edge of f1)
|
||||
if (m_div == 0)
|
||||
{
|
||||
m_1s = true;
|
||||
wake_me_up();
|
||||
}
|
||||
|
||||
// schedule next timeout
|
||||
m_div_timer->adjust(attotime::from_ticks(0x800, unscaled_clock()));
|
||||
@ -243,17 +253,13 @@ void sm510_base_device::execute_run()
|
||||
{
|
||||
while (m_icount > 0)
|
||||
{
|
||||
if (m_halt)
|
||||
m_icount--;
|
||||
|
||||
if (m_halt && !wake_me_up())
|
||||
{
|
||||
// wake up from K input (note: 1S signal is handled above)
|
||||
if (m_k_active)
|
||||
wake_me_up();
|
||||
else
|
||||
{
|
||||
// got nothing to do
|
||||
m_icount = 0;
|
||||
return;
|
||||
}
|
||||
// got nothing to do
|
||||
m_icount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// remember previous state
|
||||
@ -262,7 +268,6 @@ void sm510_base_device::execute_run()
|
||||
|
||||
// fetch next opcode
|
||||
debugger_instruction_hook(this, m_pc);
|
||||
m_icount--;
|
||||
m_op = m_program->read_byte(m_pc);
|
||||
increment_pc();
|
||||
get_opcode_param();
|
||||
|
@ -45,11 +45,16 @@
|
||||
#define MCFG_SM510_WRITE_SEGC_CB(_devcb) \
|
||||
sm510_base_device::set_write_segc_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
// LCD bs output: same as above, but only data d0 used
|
||||
#define MCFG_SM510_WRITE_SEGBS_CB(_devcb) \
|
||||
sm510_base_device::set_write_segbs_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
enum
|
||||
{
|
||||
SM510_PORT_SEGA = 0,
|
||||
SM510_PORT_SEGB = 4,
|
||||
SM510_PORT_SEGC = 8
|
||||
SM510_PORT_SEGA = 0x00,
|
||||
SM510_PORT_SEGB = 0x04,
|
||||
SM510_PORT_SEGBS = 0x08,
|
||||
SM510_PORT_SEGC = 0x0c
|
||||
};
|
||||
|
||||
|
||||
@ -71,7 +76,7 @@ public:
|
||||
, m_datawidth(datawidth)
|
||||
, m_stack_levels(stack_levels)
|
||||
, m_lcd_ram_a(*this, "lcd_ram_a"), m_lcd_ram_b(*this, "lcd_ram_b"), m_lcd_ram_c(*this, "lcd_ram_c")
|
||||
, m_write_sega(*this), m_write_segb(*this), m_write_segc(*this)
|
||||
, m_write_sega(*this), m_write_segb(*this), m_write_segc(*this), m_write_segbs(*this)
|
||||
, m_read_k(*this)
|
||||
, m_read_ba(*this), m_read_b(*this)
|
||||
, m_write_s(*this)
|
||||
@ -88,6 +93,7 @@ public:
|
||||
template<class _Object> static devcb_base &set_write_sega_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_sega.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_write_segb_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_segb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_write_segc_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_segc.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_write_segbs_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_segbs.set_callback(object); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -139,8 +145,10 @@ protected:
|
||||
|
||||
// lcd driver
|
||||
optional_shared_ptr<UINT8> m_lcd_ram_a, m_lcd_ram_b, m_lcd_ram_c;
|
||||
devcb_write16 m_write_sega, m_write_segb, m_write_segc;
|
||||
devcb_write16 m_write_sega, m_write_segb, m_write_segc, m_write_segbs;
|
||||
emu_timer *m_lcd_timer;
|
||||
UINT8 m_l;
|
||||
UINT8 m_y;
|
||||
bool m_bp;
|
||||
bool m_bc;
|
||||
|
||||
@ -154,7 +162,7 @@ protected:
|
||||
bool m_1s;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(div_timer_cb);
|
||||
void wake_me_up();
|
||||
bool wake_me_up();
|
||||
virtual void reset_divider();
|
||||
void init_divider();
|
||||
|
||||
|
@ -224,13 +224,13 @@ void sm510_base_device::op_atbp()
|
||||
void sm510_base_device::op_atl()
|
||||
{
|
||||
// ATL: output ACC to L
|
||||
op_illegal();
|
||||
m_l = m_acc;
|
||||
}
|
||||
|
||||
void sm510_base_device::op_atfc()
|
||||
{
|
||||
// ATFC: output ACC to Y
|
||||
op_illegal();
|
||||
m_y = m_acc;
|
||||
}
|
||||
|
||||
void sm510_base_device::op_atr()
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
// misc common
|
||||
UINT16 m_inp_mux; // multiplexed inputs mask
|
||||
int m_inp_lines; // number of input mux columns
|
||||
UINT8 m_lcd_output_cache[3*4*0x10];
|
||||
UINT8 m_lcd_output_cache[0x100];
|
||||
|
||||
UINT8 read_inputs(int columns);
|
||||
|
||||
@ -89,7 +89,7 @@ WRITE16_MEMBER(hh_sm510_state::lcd_segment_w)
|
||||
|
||||
if (state != m_lcd_output_cache[index])
|
||||
{
|
||||
// output to x.y, where x = row a/b/c*4 + H1-4, y = seg1-16
|
||||
// output to x.y, where x = row a/b/bs/c*4 + H1-4, y = seg1-16
|
||||
char buf[0x10];
|
||||
sprintf(buf, "%d.%d", offset, seg);
|
||||
output_set_value(buf, state);
|
||||
@ -198,6 +198,7 @@ static MACHINE_CONFIG_START( ktopgun, ktopgun_state )
|
||||
MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz)
|
||||
MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w))
|
||||
MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w))
|
||||
MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w))
|
||||
MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r))
|
||||
MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w))
|
||||
MCFG_SM510_WRITE_R_CB(WRITE8(ktopgun_state, speaker_w))
|
||||
@ -266,6 +267,7 @@ static MACHINE_CONFIG_START( gnwmndon, gnwmndon_state )
|
||||
MCFG_CPU_ADD("maincpu", SM510, XTAL_32_768kHz)
|
||||
MCFG_SM510_WRITE_SEGA_CB(WRITE16(hh_sm510_state, lcd_segment_w))
|
||||
MCFG_SM510_WRITE_SEGB_CB(WRITE16(hh_sm510_state, lcd_segment_w))
|
||||
MCFG_SM510_WRITE_SEGBS_CB(WRITE16(hh_sm510_state, lcd_segment_w))
|
||||
MCFG_SM510_READ_K_CB(READ8(hh_sm510_state, input_r))
|
||||
MCFG_SM510_WRITE_S_CB(WRITE8(hh_sm510_state, input_w))
|
||||
MCFG_SM510_WRITE_R_CB(WRITE8(gnwmndon_state, speaker_w))
|
||||
|
@ -22,7 +22,7 @@
|
||||
<bounds left="0" right="64" top="0" bottom="64" />
|
||||
</bezel>
|
||||
|
||||
<!-- max 12*16 matrix -->
|
||||
<!-- max 16*16 matrix -->
|
||||
|
||||
<bezel name="0.0" element="led"><bounds x="0" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="0.1" element="led"><bounds x="0" y="2" width="1" height="1" /></bezel>
|
||||
@ -228,6 +228,74 @@
|
||||
<bezel name="11.14" element="led"><bounds x="22" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="11.15" element="led"><bounds x="22" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="12.0" element="led"><bounds x="24" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="12.1" element="led"><bounds x="24" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="12.2" element="led"><bounds x="24" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="12.3" element="led"><bounds x="24" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="12.4" element="led"><bounds x="24" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="12.5" element="led"><bounds x="24" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="12.6" element="led"><bounds x="24" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="12.7" element="led"><bounds x="24" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="12.8" element="led"><bounds x="24" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="12.9" element="led"><bounds x="24" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="12.10" element="led"><bounds x="24" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="12.11" element="led"><bounds x="24" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="12.12" element="led"><bounds x="24" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="12.13" element="led"><bounds x="24" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="12.14" element="led"><bounds x="24" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="12.15" element="led"><bounds x="24" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="13.0" element="led"><bounds x="26" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="13.1" element="led"><bounds x="26" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="13.2" element="led"><bounds x="26" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="13.3" element="led"><bounds x="26" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="13.4" element="led"><bounds x="26" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="13.5" element="led"><bounds x="26" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="13.6" element="led"><bounds x="26" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="13.7" element="led"><bounds x="26" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="13.8" element="led"><bounds x="26" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="13.9" element="led"><bounds x="26" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="13.10" element="led"><bounds x="26" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="13.11" element="led"><bounds x="26" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="13.12" element="led"><bounds x="26" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="13.13" element="led"><bounds x="26" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="13.14" element="led"><bounds x="26" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="13.15" element="led"><bounds x="26" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="14.0" element="led"><bounds x="28" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="14.1" element="led"><bounds x="28" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="14.2" element="led"><bounds x="28" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="14.3" element="led"><bounds x="28" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="14.4" element="led"><bounds x="28" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="14.5" element="led"><bounds x="28" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="14.6" element="led"><bounds x="28" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="14.7" element="led"><bounds x="28" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="14.8" element="led"><bounds x="28" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="14.9" element="led"><bounds x="28" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="14.10" element="led"><bounds x="28" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="14.11" element="led"><bounds x="28" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="14.12" element="led"><bounds x="28" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="14.13" element="led"><bounds x="28" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="14.14" element="led"><bounds x="28" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="14.15" element="led"><bounds x="28" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
<bezel name="15.0" element="led"><bounds x="30" y="0" width="1" height="1" /></bezel>
|
||||
<bezel name="15.1" element="led"><bounds x="30" y="2" width="1" height="1" /></bezel>
|
||||
<bezel name="15.2" element="led"><bounds x="30" y="4" width="1" height="1" /></bezel>
|
||||
<bezel name="15.3" element="led"><bounds x="30" y="6" width="1" height="1" /></bezel>
|
||||
<bezel name="15.4" element="led"><bounds x="30" y="8" width="1" height="1" /></bezel>
|
||||
<bezel name="15.5" element="led"><bounds x="30" y="10" width="1" height="1" /></bezel>
|
||||
<bezel name="15.6" element="led"><bounds x="30" y="12" width="1" height="1" /></bezel>
|
||||
<bezel name="15.7" element="led"><bounds x="30" y="14" width="1" height="1" /></bezel>
|
||||
<bezel name="15.8" element="led"><bounds x="30" y="16" width="1" height="1" /></bezel>
|
||||
<bezel name="15.9" element="led"><bounds x="30" y="18" width="1" height="1" /></bezel>
|
||||
<bezel name="15.10" element="led"><bounds x="30" y="20" width="1" height="1" /></bezel>
|
||||
<bezel name="15.11" element="led"><bounds x="30" y="22" width="1" height="1" /></bezel>
|
||||
<bezel name="15.12" element="led"><bounds x="30" y="24" width="1" height="1" /></bezel>
|
||||
<bezel name="15.13" element="led"><bounds x="30" y="26" width="1" height="1" /></bezel>
|
||||
<bezel name="15.14" element="led"><bounds x="30" y="28" width="1" height="1" /></bezel>
|
||||
<bezel name="15.15" element="led"><bounds x="30" y="30" width="1" height="1" /></bezel>
|
||||
|
||||
|
||||
</view>
|
||||
</mamelayout>
|
||||
|
Loading…
Reference in New Issue
Block a user