Skip to content

Commit f673460

Browse files
committed
laser3k: Use more realistic timings for printer strobe
1 parent c78185c commit f673460

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/mame/vtech/laser3k.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ enum
8181

8282
class laser3k_state : public driver_device
8383
{
84+
// actual timing is determined by ASIC; these timings are typical of Apple II printer cards
85+
static constexpr attotime PRSTROBE_DELAY = attotime::from_nsec(500);
86+
static constexpr attotime PRSTROBE_WIDTH = attotime::from_usec(1);
87+
8488
public:
8589
laser3k_state(const machine_config &mconfig, device_type type, const char *tag)
8690
: driver_device(mconfig, type, tag)
@@ -121,6 +125,7 @@ class laser3k_state : public driver_device
121125
void prdata_w(uint8_t data);
122126
void prack_w(int state);
123127
void prbusy_w(int state);
128+
TIMER_CALLBACK_MEMBER(printer_strobe);
124129

125130
uint8_t printer_rom_r(offs_t offset);
126131
void printer_rombank_w(offs_t offset, uint8_t data);
@@ -181,6 +186,8 @@ class laser3k_state : public driver_device
181186
std::unique_ptr<uint16_t[]> m_dhires_artifact_map;
182187
bool m_prack;
183188
bool m_prbusy;
189+
bool m_prstrobe;
190+
emu_timer *m_prstrobe_timer;
184191
};
185192

186193
/***************************************************************************
@@ -278,6 +285,8 @@ void laser3k_state::machine_start()
278285

279286
m_prack = false;
280287
m_prbusy = false;
288+
289+
m_prstrobe_timer = timer_alloc(FUNC(laser3k_state::printer_strobe), this);
281290
}
282291

283292
void laser3k_state::machine_reset()
@@ -302,6 +311,7 @@ void laser3k_state::machine_reset()
302311
m_mix = false;
303312
m_gfxmode = TEXT;
304313

314+
m_prstrobe = false;
305315
m_printer->write_strobe(1);
306316
}
307317

@@ -611,10 +621,7 @@ uint8_t laser3k_state::io2_r(offs_t offset)
611621
void laser3k_state::prdata_w(uint8_t data)
612622
{
613623
m_platch->write(data);
614-
615-
// timing (determined by ASIC) is probably wrong for this
616-
m_printer->write_strobe(0);
617-
m_printer->write_strobe(1);
624+
m_prstrobe_timer->adjust(PRSTROBE_DELAY);
618625
}
619626

620627
void laser3k_state::prack_w(int state)
@@ -627,6 +634,14 @@ void laser3k_state::prbusy_w(int state)
627634
m_prbusy = state;
628635
}
629636

637+
TIMER_CALLBACK_MEMBER(laser3k_state::printer_strobe)
638+
{
639+
m_printer->write_strobe(m_prstrobe);
640+
m_prstrobe = !m_prstrobe;
641+
if (m_prstrobe)
642+
m_prstrobe_timer->adjust(PRSTROBE_WIDTH);
643+
}
644+
630645
uint8_t laser3k_state::printer_rom_r(offs_t offset)
631646
{
632647
if (!machine().side_effects_disabled())

0 commit comments

Comments
 (0)