7
7
#include " emu.h"
8
8
#include " m5074x.h"
9
9
10
+ #define LOG_ADC (1U << 1 )
11
+ #define LOG_PORTS (1U << 2 )
12
+ #define LOG_TIMER (1U << 3 )
13
+
14
+ #define VERBOSE (0 )
15
+ #include " logmacro.h"
16
+
10
17
// **************************************************************************
11
18
// MACROS / CONSTANTS
12
19
// **************************************************************************
@@ -147,7 +154,7 @@ TIMER_CALLBACK_MEMBER(m5074x_device::timerx_tick)
147
154
{
148
155
m_tmrx--;
149
156
150
- if (m_tmrx < = 0 )
157
+ if (m_tmrx = = 0 )
151
158
{
152
159
m_tmrctrl |= TMRC_TMRXREQ;
153
160
m_tmrx = m_tmrxlatch;
@@ -230,12 +237,14 @@ void m5074x_device::recalc_timer(int timer)
230
237
case 0 :
231
238
hz = clock () / 16 ;
232
239
hz /= (m_tmr12pre + 2 );
240
+ LOGMASKED (LOG_TIMER, " %s: timer 1, prescale %02x, fire at %d Hz\n " , machine ().describe_context (), m_tmr12pre, hz);
233
241
m_timers[TIMER_1]->adjust (attotime::from_hz (hz), 0 , attotime::from_hz (hz));
234
242
break ;
235
243
236
244
case 1 :
237
245
hz = clock () / 16 ;
238
246
hz /= (m_tmr12pre + 2 );
247
+ LOGMASKED (LOG_TIMER, " %s: timer 2, prescale %02x, fire at %d Hz\n " , machine ().describe_context (), m_tmr12pre, hz);
239
248
m_timers[TIMER_2]->adjust (attotime::from_hz (hz), 0 , attotime::from_hz (hz));
240
249
break ;
241
250
@@ -247,12 +256,14 @@ void m5074x_device::recalc_timer(int timer)
247
256
// stop bit?
248
257
if (m_tmrctrl & TMRC_TMRXHLT)
249
258
{
259
+ LOGMASKED (LOG_TIMER, " %s: timer X halted\n " , machine ().describe_context ());
250
260
m_timers[TIMER_X]->adjust (attotime::never, 0 , attotime::never);
251
261
}
252
262
else
253
263
{
254
264
hz = clock () / 16 ;
255
265
hz /= (m_tmrxpre + 2 );
266
+ LOGMASKED (LOG_TIMER, " %s: timer X, prescale %02x, fire at %d Hz\n " , machine ().describe_context (), m_tmrxpre, hz);
256
267
m_timers[TIMER_X]->adjust (attotime::from_hz (hz), 0 , attotime::from_hz (hz));
257
268
}
258
269
}
@@ -266,6 +277,9 @@ void m5074x_device::recalc_timer(int timer)
266
277
267
278
void m5074x_device::send_port (uint8_t offset, uint8_t data)
268
279
{
280
+ LOGMASKED (LOG_PORTS, " %s: Write port %d, data %02x DDR %02x pull-ups %02x\n " , machine ().describe_context (), offset,
281
+ data, m_ddrs[offset], m_pullups[offset]);
282
+
269
283
m_write_p[offset](data);
270
284
}
271
285
@@ -278,6 +292,9 @@ uint8_t m5074x_device::read_port(uint8_t offset)
278
292
// OR in ddr-masked version of port writes
279
293
incoming |= (m_ports[offset] & m_ddrs[offset]);
280
294
295
+ LOGMASKED (LOG_PORTS, " %s: Read port %d, incoming %02x DDR %02x output latch %02x\n " , machine ().describe_context (), offset,
296
+ m_read_p[offset](), m_ddrs[offset], m_ports[offset]);
297
+
281
298
return incoming;
282
299
}
283
300
@@ -406,31 +423,34 @@ uint8_t m5074x_device::tmrirq_r(offs_t offset)
406
423
407
424
void m5074x_device::tmrirq_w (offs_t offset, uint8_t data)
408
425
{
409
- // printf("%02x to tmrirq @ %d\n", data, offset);
410
-
411
426
switch (offset)
412
427
{
413
428
case 0 :
414
429
m_tmr12pre = data;
430
+ LOGMASKED (LOG_TIMER, " %s: timer 1/2 prescale %02x\n " , machine ().describe_context (), data);
415
431
recalc_timer (0 );
416
432
recalc_timer (1 );
417
433
break ;
418
434
419
435
case 1 :
420
436
m_tmr1 = m_tmr1latch = data;
437
+ LOGMASKED (LOG_TIMER, " %s: timer 1 latch %02x\n " , machine ().describe_context (), data);
421
438
break ;
422
439
423
440
case 2 :
424
441
m_tmr2 = m_tmr2latch = data;
442
+ LOGMASKED (LOG_TIMER, " %s: timer 2 latch %02x\n " , machine ().describe_context (), data);
425
443
break ;
426
444
427
445
case 3 :
428
- m_tmrxpre = m_tmrxlatch = data;
446
+ m_tmrxpre = data;
447
+ LOGMASKED (LOG_TIMER, " %s: timer X prescale %02x\n " , machine ().describe_context (), data);
429
448
recalc_timer (2 );
430
449
break ;
431
450
432
451
case 4 :
433
- m_tmrx = data;
452
+ m_tmrx = m_tmrxlatch = data;
453
+ LOGMASKED (LOG_TIMER, " %s: timer X latch %02x\n " , machine ().describe_context (), data);
434
454
break ;
435
455
436
456
case 5 :
@@ -548,7 +568,7 @@ uint8_t m50753_device::ad_r()
548
568
549
569
void m50753_device::ad_start_w (uint8_t data)
550
570
{
551
- logerror ( " %s: A-D start (IN%d)\n " , machine ().describe_context (), m_ad_control & 0x07 );
571
+ LOGMASKED (LOG_ADC, " %s: A-D start (IN%d)\n " , machine ().describe_context (), m_ad_control & 0x07 );
552
572
553
573
// starting a conversion. M50753 documentation says conversion time is 72 microseconds.
554
574
m_timers[TIMER_ADC]->adjust (attotime::from_usec (72 ));
@@ -561,6 +581,7 @@ uint8_t m50753_device::ad_control_r()
561
581
562
582
void m50753_device::ad_control_w (uint8_t data)
563
583
{
584
+ LOGMASKED (LOG_ADC, " %s: %02x to A-D control\n " , machine ().describe_context (), data);
564
585
m_ad_control = data & 0x0f ;
565
586
}
566
587
0 commit comments