1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
|
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol, hap
// thanks-to:Kevin Horton
/***************************************************************************
Intel 8244 (NTSC)/8245 (PAL) Graphics and sound chip
Exclusively used in Odyssey 2 series. See driver file for known problems.
***************************************************************************/
#include "emu.h"
#include "i8244.h"
#include "screen.h"
// device type definition
DEFINE_DEVICE_TYPE(I8244, i8244_device, "i8244", "Intel 8244")
DEFINE_DEVICE_TYPE(I8245, i8245_device, "i8245", "Intel 8245")
//-------------------------------------------------
// i8244_device - constructor
//-------------------------------------------------
i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: i8244_device(mconfig, I8244, tag, owner, clock)
{
}
i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, m_irq_func(*this)
, m_charset(*this, "cgrom")
{
}
i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: i8244_device(mconfig, I8245, tag, owner, clock)
{
}
void i8244_device::set_default_params()
{
m_htotal = 455;
m_vtotal = 263;
m_vblank_start = 242;
m_vblank_end = 0;
m_hblank_start = 366;
m_hblank_end = 453;
m_bgate_start = 413;
}
void i8245_device::set_default_params()
{
// this timing is partially derived externally, 8245 on the PAL console is set to slave mode in vblank (M/S pin)
m_htotal = 456;
m_vtotal = 313;
m_vblank_start = 242;
m_vblank_end = 312;
m_hblank_start = 366;
m_hblank_end = 454;
m_bgate_start = 414;
}
i8244_device &i8244_device::set_screen_size(int width, int height, int cropx, int cropy)
{
m_width = width;
m_height = height;
m_cropx = cropx;
m_cropy = cropy;
set_default_params();
return *this;
}
//-------------------------------------------------
// internal character set rom
//-------------------------------------------------
ROM_START( i8244 )
ROM_REGION( 0x200, "cgrom", 0 )
ROM_LOAD( "charset_i8244.bin", 0x0000, 0x0200, CRC(b46a3f31) SHA1(415382715455b47b69401b3d60bd8f0036dd7fef) )
ROM_END
const tiny_rom_entry *i8244_device::device_rom_region() const
{
return ROM_NAME( i8244 );
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void i8244_device::device_config_complete()
{
if (!has_screen())
return;
if (!screen().refresh_attoseconds())
screen().set_raw(clock()*2, m_htotal, m_cropx, m_cropx + m_width, m_vtotal, m_cropy, m_cropy + m_height);
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void i8244_device::device_start()
{
m_irq_func.resolve_safe();
// allocate timers
m_vblank_timer = timer_alloc(TIMER_VBLANK_START);
m_vblank_timer->adjust(screen().time_until_pos(m_vblank_start, m_hblank_start - 1), 0, screen().frame_period());
m_hblank_timer = timer_alloc(TIMER_HBLANK_START);
m_hblank_timer->adjust(screen().time_until_pos(0, m_hblank_start), 0, screen().scan_period());
// allocate a stream
m_stream = stream_alloc(0, 1, clock());
// register our state
memset(m_vdc.reg, 0, 0x100);
save_pointer(NAME(m_vdc.reg), 0x100);
memset( m_collision_map, 0, sizeof( m_collision_map ) );
save_item(NAME(m_collision_map));
save_item(NAME(m_x_beam_pos));
save_item(NAME(m_y_beam_pos));
save_item(NAME(m_control_status));
save_item(NAME(m_collision_status));
save_item(NAME(m_sh_written));
save_item(NAME(m_sh_pending));
save_item(NAME(m_sh_prescaler));
save_item(NAME(m_sh_count));
save_item(NAME(m_sh_output));
save_item(NAME(m_sh_duty));
}
void i8244_device::i8244_palette(palette_device &palette) const
{
// RGB output, before any NTSC/PAL RF encoder
static constexpr rgb_t i8244_colors[16] =
{
{ 0x00, 0x00, 0x00 }, // i r g b
{ 0xb6, 0x00, 0x00 }, // i R g b
{ 0x00, 0xb6, 0x00 }, // i r G b
{ 0xb6, 0xb6, 0x00 }, // i R G b
{ 0x00, 0x00, 0xb6 }, // i r g B
{ 0xb6, 0x00, 0xb6 }, // i R g B
{ 0x00, 0xb6, 0xb6 }, // i r G B
{ 0xb6, 0xb6, 0xb6 }, // i R G B
{ 0x49, 0x49, 0x49 }, // I r g b
{ 0xff, 0x49, 0x49 }, // I R g b
{ 0x49, 0xff, 0x49 }, // I r G b
{ 0xff, 0xff, 0x49 }, // I R G b
{ 0x49, 0x49, 0xff }, // I r g B
{ 0xff, 0x49, 0xff }, // I R g B
{ 0x49, 0xff, 0xff }, // I r G B
{ 0xff, 0xff, 0xff } // I R G B
};
palette.set_pen_colors( 0, i8244_colors );
}
void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch ( id )
{
case TIMER_HBLANK_START:
// hblank starts (updates sound shift register)
sound_update();
break;
case TIMER_VBLANK_START:
// vblank starts
m_control_status |= 0x08;
m_irq_func(ASSERT_LINE);
break;
default:
break;
}
}
offs_t i8244_device::fix_register_mirrors( offs_t offset )
{
// quad x/y registers are mirrored for each quad
if ( ( offset & 0xC2 ) == 0x40 )
{
offset &= ~0x0C;
}
// registers $A0-$AF are mirrored at $B0-$BF
if ( ( offset & 0xE0 ) == 0xA0 )
{
offset &= ~0x10;
}
return offset & 0xFF;
}
bool i8244_device::invalid_register( offs_t offset, bool rw )
{
// object x/y/attr registers are not accessible when display is enabled
// (sprite shape registers still are)
if (offset < 0x80 && m_vdc.s.control & 0x20)
return true;
// grid registers are not accessible when grid is enabled
if (offset >= 0xc0 && m_vdc.s.control & 0x08)
return true;
bool invalid = false;
u8 n = offset & 0xf;
// these registers are always inaccessible
switch (offset & 0xf0)
{
case 0x00:
invalid = ((n & 0x3) == 0x3);
// write-only
if (!invalid && rw)
invalid = ((n & 0x3) == 0x2);
break;
case 0xa0:
invalid = (n == 0x6 || n >= 0xb);
if (!invalid)
{
// write-only
if (rw)
invalid = (n == 0x3 || n == 0x7 || n == 0x8 || n == 0x9);
// read-only
else
invalid = (n == 0x1 || n == 0x4 || n == 0x5);
}
break;
case 0xc0: case 0xd0:
invalid = (n >= 0x9);
break;
case 0xe0:
invalid = (n >= 0xa);
break;
case 0xf0:
invalid = true;
break;
default:
break;
}
return invalid;
}
uint8_t i8244_device::read(offs_t offset)
{
uint8_t data;
offset = fix_register_mirrors(offset);
if (machine().side_effects_disabled())
return m_vdc.reg[offset];
if (invalid_register(offset, true))
return 0;
// update screen before accessing video status registers
if (offset == 0xa1 || offset == 0xa2)
screen().update_now();
switch (offset)
{
case 0xa1:
{
data = m_control_status;
// hstatus (not same as hblank), goes high at falling edge of X=0x70
int h = screen().hpos();
data |= (h >= 225 && h < m_bgate_start && get_y_beam() <= m_vblank_start) ? 1 : 0;
// position strobe status
data |= m_vdc.s.control & 0x02;
m_irq_func(CLEAR_LINE);
m_control_status &= ~0xcc;
break;
}
case 0xa2:
data = m_collision_status;
m_collision_status = 0;
break;
case 0xa4:
data = (m_vdc.s.control & 0x02) ? get_y_beam() : m_y_beam_pos;
break;
case 0xa5:
data = (m_vdc.s.control & 0x02) ? get_x_beam() : m_x_beam_pos;
break;
default:
data = m_vdc.reg[offset];
break;
}
return data;
}
void i8244_device::write(offs_t offset, uint8_t data)
{
offset = fix_register_mirrors(offset);
if (invalid_register(offset, false))
return;
// update screen before accessing video registers
if (offset >= 0x80 && offset < 0xa4)
screen().update_now();
// color registers d4-d7 are not connected
if ((offset & 0x83) == 0x03)
data &= 0x0f;
// major systems Y CAM d0 is not connected!
if (offset >= 0x10 && (offset & 0x83) == 0x00)
data &= ~0x01;
// horizontal grid high byte only d0 is connected
if ((offset & 0xf0) == 0xd0)
data &= 0x01;
switch (offset)
{
case 0xa0:
if ((m_vdc.s.control & 0x02) && !(data & 0x02))
{
// toggling strobe bit, tuck away values
m_x_beam_pos = get_x_beam();
m_y_beam_pos = get_y_beam();
}
break;
case 0xa7: case 0xa8: case 0xa9:
m_sh_written = true;
break;
case 0xaa:
// update the sound
m_stream->update();
data &= ~0x40;
break;
default:
break;
}
m_vdc.reg[offset] = data;
}
int i8244_device::get_y_beam()
{
int h = screen().hpos();
int v = screen().vpos();
// Y resets before hblank on the first scanline
if (v == 0 && h < m_hblank_start)
v = m_vtotal;
// Y increments on BG sync
if (h >= m_bgate_start)
v++;
return (v > 263) ? 263 : v;
}
int i8244_device::get_x_beam()
{
return screen().hpos() >> 1;
}
int i8244_device::vblank()
{
int h = screen().hpos();
int v = screen().vpos();
int start = m_vblank_start;
int end = m_vblank_end;
if ((v == start && h >= (m_hblank_start - 1)) || (v == end && h <= (m_hblank_start - 1)))
return 1;
if (end < start)
return (v > start || v < end) ? 1 : 0;
else
return (v > start && v < end) ? 1 : 0;
}
int i8244_device::hblank()
{
int h = screen().hpos();
int start = m_hblank_start;
int end = m_hblank_end;
if (end < start)
return (h >= start || h < end) ? 1 : 0;
else
return (h >= start && h < end) ? 1 : 0;
}
void i8244_device::write_cx(int x, bool cx)
{
if (cx)
{
u8 colx = m_collision_map[x] & 0x3f;
// Check if we collide with an already drawn source object
if (colx)
{
// external overlap interrupt
if (m_vdc.s.control & 0x10)
{
m_irq_func(ASSERT_LINE);
m_control_status |= 0x40;
}
if (colx & m_vdc.s.collision)
m_collision_status |= 0x40;
}
// Check if an already drawn object would collide with us
if (m_vdc.s.collision & 0x40)
{
m_collision_status |= colx;
}
}
}
uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* Draw background color */
bitmap.fill(bitswap<3>(m_vdc.s.color,3,4,5), cliprect);
for (int scanline = cliprect.min_y; scanline <= cliprect.max_y; scanline++)
{
/* Clear collision map */
memset( m_collision_map, 0, sizeof( m_collision_map ) );
/* Display grid if enabled */
if ( m_vdc.s.control & 0x08 )
{
uint16_t color = bitswap<4>(m_vdc.s.color,6,0,1,2);
int x_grid_offset = 13;
int y_grid_offset = 24;
int width = 16;
int height = 24;
int w = ( m_vdc.s.control & 0x80 ) ? width : 2;
/* Draw horizontal part of the grid */
for ( int y = 0; y < 9; y++ )
{
if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3 )
{
for ( int i = 0; i < 9; i++ )
{
if ( BIT(m_vdc.s.hgrid[1][i] << 8 | m_vdc.s.hgrid[0][i], y) )
{
for ( int k = 0; k < width + 2; k++ )
{
int x = (x_grid_offset + i * width + k) * 2;
for (int px = x; px < x + 2; px++)
{
if (cliprect.contains(px, scanline))
{
m_collision_map[ px ] |= 0x20;
bitmap.pix16( scanline, px ) = color;
}
}
}
}
}
}
}
/* Draw dots part of the grid */
if ( m_vdc.s.control & 0x40 )
{
for ( int y = 0; y < 9; y++ )
{
if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3 )
{
for ( int i = 0; i < 10; i++ )
{
for ( int k = 0; k < 2; k++ )
{
int x = (x_grid_offset + i * width + k) * 2;
for (int px = x; px < x + 2; px++)
{
if (cliprect.contains(px, scanline))
{
m_collision_map[ px ] |= 0x20;
bitmap.pix16( scanline, px ) = color;
}
}
}
}
}
}
}
/* Draw vertical part of the grid */
for( int j = 1, y = 0; y < 8; y++, j <<= 1 )
{
if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + ( y + 1 ) * height )
{
for ( int i = 0; i < 10; i++ )
{
if ( m_vdc.s.vgrid[i] & j )
{
for ( int k = 0; k < w; k++ )
{
int x = (x_grid_offset + i * width + k) * 2;
for (int px = x; px < x + 2; px++)
{
if (cliprect.contains(px, scanline))
{
m_collision_map[ px ] |= 0x10;
bitmap.pix16( scanline, px ) = color;
}
}
}
}
}
}
}
}
/* Display objects if enabled */
if ( m_vdc.s.control & 0x20 && scanline <= 242 )
{
/* Quad objects */
for ( int i = ARRAY_LENGTH( m_vdc.s.quad ) - 1; i >= 0; i-- )
{
int y = m_vdc.s.quad[i].single[0].y;
// Character height is always determined by the height of the 4th character
int height = 8 - ( ( ( y >> 1 ) + m_vdc.s.quad[i].single[3].ptr ) & 7 );
if (height == 1) height = 8;
if ( y <= scanline && scanline < y + height * 2 )
{
int x = (m_vdc.s.quad[i].single[0].x + 5) * 2;
for ( int j = 0; j < ARRAY_LENGTH( m_vdc.s.quad[0].single ); j++, x += 16 )
{
uint16_t color = 8 + ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 );
int offset = ( m_vdc.s.quad[i].single[j].ptr | ( ( m_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 );
uint8_t chr = m_charset[ offset & 0x1FF ];
for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 )
{
if ( chr & m )
{
for (int px = x; px < x + 2; px++)
{
if (cliprect.contains(px, scanline))
{
// Check collision with self
u8 colx = m_collision_map[ px ];
if (colx & 0x80)
{
colx &= ~0x80;
m_control_status |= 0x80;
}
// Check if we collide with an already drawn source object
if (m_vdc.s.collision & colx)
m_collision_status |= 0x80;
// Check if an already drawn object would collide with us
if (m_vdc.s.collision & 0x80)
m_collision_status |= colx;
m_collision_map[ px ] |= 0x80;
bitmap.pix16( scanline, px ) = color;
}
}
}
}
}
}
}
/* Regular foreground objects */
for ( int i = ARRAY_LENGTH( m_vdc.s.foreground ) - 1; i >= 0; i-- )
{
int y = m_vdc.s.foreground[i].y;
int height = 8 - ( ( ( y >> 1 ) + m_vdc.s.foreground[i].ptr ) & 7 );
if (height == 1) height = 8;
if ( y <= scanline && scanline < y + height * 2 )
{
uint16_t color = 8 + ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 );
int offset = ( m_vdc.s.foreground[i].ptr | ( ( m_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 );
uint8_t chr = m_charset[ offset & 0x1FF ];
int x = (m_vdc.s.foreground[i].x + 5) * 2;
for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 )
{
if ( chr & m )
{
for (int px = x; px < x + 2; px++)
{
if (cliprect.contains(px, scanline))
{
// Check collision with self
u8 colx = m_collision_map[ px ];
if (colx & 0x80)
{
colx &= ~0x80;
m_control_status |= 0x80;
}
// Check if we collide with an already drawn source object
if (m_vdc.s.collision & colx)
m_collision_status |= 0x80;
// Check if an already drawn object would collide with us
if (m_vdc.s.collision & 0x80)
m_collision_status |= colx;
m_collision_map[ px ] |= 0x80;
bitmap.pix16( scanline, px ) = color;
}
}
}
}
}
}
/* Sprites */
for ( int i = ARRAY_LENGTH( m_vdc.s.sprites ) - 1; i >= 0; i-- )
{
int y = m_vdc.s.sprites[i].y;
int height = 8;
bool zoom_enable = bool(m_vdc.s.sprites[i].color & 4);
int zoom_px = zoom_enable ? 4 : 2;
if ( y <= scanline && scanline < y + height * zoom_px )
{
uint16_t color = 8 + ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 );
uint8_t chr = m_vdc.s.shape[i][ ( ( scanline - y ) / zoom_px ) ];
int x = (m_vdc.s.sprites[i].x + 5) * 2;
int x_shift = 0;
switch ( m_vdc.s.sprites[i].color & 0x03 )
{
case 1: // Xg attribute set
x_shift = 1;
break;
case 2: // S attribute set
x_shift = ( ( ( scanline - y ) / zoom_px ) & 0x01 ) ^ 0x01;
break;
case 3: // Xg and S attributes set
x_shift = ( ( scanline - y ) / zoom_px ) & 0x01;
break;
default:
break;
}
x += x_shift * (zoom_px / 2);
for ( uint8_t m = 0x01; m > 0; m <<= 1, x += zoom_px )
{
if ( chr & m )
{
for (int px = x; px < x + zoom_px; px++)
{
if (cliprect.contains(px, scanline))
{
u8 mask = 1 << i;
// Check if we collide with an already drawn source object
if (m_vdc.s.collision & m_collision_map[ px ])
m_collision_status |= mask;
// Check if an already drawn object would collide with us
if (m_vdc.s.collision & mask)
m_collision_status |= m_collision_map[ px ];
m_collision_map[ px ] |= mask;
bitmap.pix16( scanline, px ) = color;
}
}
}
}
}
}
}
}
return 0;
}
void i8244_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
u8 volume = m_vdc.s.sound & 0xf;
stream_buffer::sample_t sample_on = (m_sh_output & m_vdc.s.sound >> 7) * 0.5;
for (int i = 0; i < outputs[0].samples(); i++)
{
// clock duty cycle
m_sh_duty = (m_sh_duty + 1) & 0xf;
outputs[0].put(i, (m_sh_duty < volume) ? sample_on : 0.0);
}
}
void i8244_device::sound_update()
{
// clock prescaler
m_sh_prescaler++;
u8 prescaler_mask = (m_vdc.s.sound & 0x20) ? 3 : 0xf;
if ((m_sh_prescaler & prescaler_mask) == 0)
m_sh_pending = true;
// clock shift registers
if (m_sh_pending && !m_sh_written)
{
m_stream->update();
m_sh_pending = false;
u32 signal = m_vdc.s.shift3 | (m_vdc.s.shift2 << 8) | (m_vdc.s.shift1 << 16);
m_sh_output = signal & 1;
int feedback = m_sh_output;
signal >>= 1;
// noise tap is on bits 0 and 5 and fed back to bit 15
if (m_vdc.s.sound & 0x10)
{
feedback ^= signal >> 4 & 1; // pre-shift bit 5
signal = (signal & ~0x8000) | (feedback << 15);
}
// loop sound
signal |= feedback << 23;
m_vdc.s.shift3 = signal & 0xFF;
m_vdc.s.shift2 = ( signal >> 8 ) & 0xFF;
m_vdc.s.shift1 = ( signal >> 16 ) & 0xFF;
// sound interrupt
if (++m_sh_count == 24)
{
m_sh_count = 0;
if (m_vdc.s.control & 0x04)
{
m_control_status |= 0x04;
m_irq_func(ASSERT_LINE);
}
}
}
else if (m_sh_written)
{
m_sh_count = 0;
m_sh_written = false;
}
}
|