1
159
160
161 #define CLOCK_A XTAL_30MHz
162 #define CLOCK_B XTAL_8MHz
163 #define CLOCK_C XTAL_19_6608MHz
164
165 #include "emu.h"
166 #include "cpu/m68000/m68000.h"
167 #include "sound/2413intf.h"
168
169
170 class magicard_state : public driver_device
171 {
172 public:
173 magicard_state(const machine_config &mconfig, device_type type, const char *tag)
174 : driver_device(mconfig, type, tag) ,
175 m_magicram(*this, "magicram"),
176 m_pcab_vregs(*this, "pcab_vregs"),
177 m_scc68070_ext_irqc_regs(*this, "scc_xirqc_regs"),
178 m_scc68070_iic_regs(*this, "scc_iic_regs"),
179 m_scc68070_uart_regs(*this, "scc_uart_regs"),
180 m_scc68070_timer_regs(*this, "scc_timer_regs"),
181 m_scc68070_int_irqc_regs(*this, "scc_iirqc_regs"),
182 m_scc68070_dma_ch1_regs(*this, "scc_dma1_regs"),
183 m_scc68070_dma_ch2_regs(*this, "scc_dma2_regs"),
184 m_scc68070_mmu_regs(*this, "scc_mmu_regs"){ }
185
186 required_shared_ptr<UINT16> m_magicram;
187 required_shared_ptr<UINT16> m_pcab_vregs;
188 required_shared_ptr<UINT16> m_scc68070_ext_irqc_regs;
189 required_shared_ptr<UINT16> m_scc68070_iic_regs;
190 required_shared_ptr<UINT16> m_scc68070_uart_regs;
191 required_shared_ptr<UINT16> m_scc68070_timer_regs;
192 required_shared_ptr<UINT16> m_scc68070_int_irqc_regs;
193 required_shared_ptr<UINT16> m_scc68070_dma_ch1_regs;
194 required_shared_ptr<UINT16> m_scc68070_dma_ch2_regs;
195 required_shared_ptr<UINT16> m_scc68070_mmu_regs;
196 struct { int r,g,b,offs,offs_internal; } m_pal;
197 DECLARE_READ16_MEMBER(test_r);
198 DECLARE_WRITE16_MEMBER(paletteram_io_w);
199 DECLARE_READ16_MEMBER(philips_66470_r);
200 DECLARE_WRITE16_MEMBER(philips_66470_w);
201 DECLARE_READ16_MEMBER(scc68070_ext_irqc_r);
202 DECLARE_WRITE16_MEMBER(scc68070_ext_irqc_w);
203 DECLARE_READ16_MEMBER(scc68070_iic_r);
204 DECLARE_WRITE16_MEMBER(scc68070_iic_w);
205 DECLARE_READ16_MEMBER(scc68070_uart_r);
206 DECLARE_WRITE16_MEMBER(scc68070_uart_w);
207 DECLARE_READ16_MEMBER(scc68070_timer_r);
208 DECLARE_WRITE16_MEMBER(scc68070_timer_w);
209 DECLARE_READ16_MEMBER(scc68070_int_irqc_r);
210 DECLARE_WRITE16_MEMBER(scc68070_int_irqc_w);
211 DECLARE_READ16_MEMBER(scc68070_dma_ch1_r);
212 DECLARE_WRITE16_MEMBER(scc68070_dma_ch1_w);
213 DECLARE_READ16_MEMBER(scc68070_dma_ch2_r);
214 DECLARE_WRITE16_MEMBER(scc68070_dma_ch2_w);
215 DECLARE_READ16_MEMBER(scc68070_mmu_r);
216 DECLARE_WRITE16_MEMBER(scc68070_mmu_w);
217 DECLARE_DRIVER_INIT(magicard);
218 virtual void machine_reset();
219 virtual void video_start();
220 UINT32 screen_update_magicard(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
221 INTERRUPT_GEN_MEMBER(magicard_irq);
222 };
223
224
225
228
229
234
254
255
256 #define SCC_CSR_VREG (state->m_pcab_vregs[0x00/2] & 0xffff)
257 #define SCC_CG_VREG ((SCC_CSR_VREG & 0x10)>>4)
258
259
281
282 #define SCC_DCR_VREG (state->m_pcab_vregs[0x02/2] & 0xffff)
283 #define SCC_DE_VREG ((SCC_DCR_VREG & 0x8000)>>15)
284 #define SCC_FG_VREG ((SCC_DCR_VREG & 0x0080)>>7)
285 #define SCC_VSR_VREG_H ((SCC_DCR_VREG & 0xf)>>0)
286
287
291
292 #define SCC_VSR_VREG_L (state->m_pcab_vregs[0x04/2] & 0xffff)
293 #define SCC_VSR_VREG ((SCC_VSR_VREG_H)<<16) | (SCC_VSR_VREG_L)
294
295
300
311 #define SCC_DCR2_VREG (state->m_pcab_vregs[0x08/2] & 0xffff)
312
313
319
320
324
328
332 #define SCC_SRCA_VREG (state->m_pcab_vregs[0x10/2] & 0xffff)
333
334
338
339 #define SCC_DSTB_VREG (state->m_pcab_vregs[0x12/2] & 0xffff)
340
341
385
386 #define SCC_PCR_VREG (state->m_pcab_vregs[0x14/2] & 0xffff)
387
388
392
396
401
406
410
411
412 void magicard_state::video_start()
413 {
414 }
415
416 UINT32 magicard_state::screen_update_magicard(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
417 {
418 magicard_state *state = machine().driver_data<magicard_state>();
419 int x,y;
420 UINT32 count;
421
422 bitmap.fill(get_black_pen(machine()), cliprect);
423
424 if(!(SCC_DE_VREG))
425 return 0;
426
427 count = ((SCC_VSR_VREG)/2);
428
429 if(SCC_FG_VREG)
430 {
431 for(y=0;y<300;y++)
432 {
433 for(x=0;x<84;x++)
434 {
435 UINT32 color;
436
437 color = ((m_magicram[count]) & 0x000f)>>0;
438
439 if(cliprect.contains((x*4)+3, y))
440 bitmap.pix32(y, (x*4)+3) = machine().pens[color];
441
442 color = ((m_magicram[count]) & 0x00f0)>>4;
443
444 if(cliprect.contains((x*4)+2, y))
445 bitmap.pix32(y, (x*4)+2) = machine().pens[color];
446
447 color = ((m_magicram[count]) & 0x0f00)>>8;
448
449 if(cliprect.contains((x*4)+1, y))
450 bitmap.pix32(y, (x*4)+1) = machine().pens[color];
451
452 color = ((m_magicram[count]) & 0xf000)>>12;
453
454 if(cliprect.contains((x*4)+0, y))
455 bitmap.pix32(y, (x*4)+0) = machine().pens[color];
456
457 count++;
458 }
459 }
460 }
461 else
462 {
463 for(y=0;y<300;y++)
464 {
465 for(x=0;x<168;x++)
466 {
467 UINT32 color;
468
469 color = ((m_magicram[count]) & 0x00ff)>>0;
470
471 if(cliprect.contains((x*2)+1, y))
472 bitmap.pix32(y, (x*2)+1) = machine().pens[color];
473
474 color = ((m_magicram[count]) & 0xff00)>>8;
475
476 if(cliprect.contains((x*2)+0, y))
477 bitmap.pix32(y, (x*2)+0) = machine().pens[color];
478
479 count++;
480 }
481 }
482 }
483
484 return 0;
485 }
486
487
488
491
492 READ16_MEMBER(magicard_state::test_r)
493 {
494 return machine().rand();
495 }
496
497 WRITE16_MEMBER(magicard_state::paletteram_io_w)
498 {
499 switch(offset*2)
500 {
501 case 0:
502 m_pal.offs = data;
503 m_pal.offs_internal = 0;
504 break;
505 case 4:
506 break;
507 case 2:
508 switch(m_pal.offs_internal)
509 {
510 case 0:
511 m_pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
512 m_pal.offs_internal++;
513 break;
514 case 1:
515 m_pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
516 m_pal.offs_internal++;
517 break;
518 case 2:
519 m_pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
520 palette_set_color(machine(), m_pal.offs, MAKE_RGB(m_pal.r, m_pal.g, m_pal.b));
521 m_pal.offs_internal = 0;
522 m_pal.offs++;
523 break;
524 }
525
526 break;
527 }
528 }
529
530 READ16_MEMBER(magicard_state::philips_66470_r)
531 {
532 switch(offset)
533 {
534
535
536 }
537
538
539
540
541 return m_pcab_vregs[offset];
542 }
543
544 WRITE16_MEMBER(magicard_state::philips_66470_w)
545 {
546 COMBINE_DATA(&m_pcab_vregs[offset]);
547
548
549
550
551
552
553 }
554
555
556
557 READ16_MEMBER(magicard_state::scc68070_ext_irqc_r)
558 {
559 return m_scc68070_ext_irqc_regs[offset];
560 }
561
562 WRITE16_MEMBER(magicard_state::scc68070_ext_irqc_w)
563 {
564 m_scc68070_ext_irqc_regs[offset] = data;
565 }
566
567 READ16_MEMBER(magicard_state::scc68070_iic_r)
568 {
569
570
571 switch(offset)
572 {
573 case 0x04/2: return m_scc68070_iic_regs[offset] & 0xef;
574 }
575
576 return m_scc68070_iic_regs[offset];
577 }
578
579 WRITE16_MEMBER(magicard_state::scc68070_iic_w)
580 {
581 m_scc68070_iic_regs[offset] = data;
582 }
583
584 READ16_MEMBER(magicard_state::scc68070_uart_r)
585 {
586
587
588 switch(offset)
589 {
590 case 0x02/2: return machine().rand();
591 }
592
593 return m_scc68070_uart_regs[offset];
594 }
595
596 WRITE16_MEMBER(magicard_state::scc68070_uart_w)
597 {
598 m_scc68070_uart_regs[offset] = data;
599 }
600
601 READ16_MEMBER(magicard_state::scc68070_timer_r)
602 {
603 return m_scc68070_timer_regs[offset];
604 }
605
606 WRITE16_MEMBER(magicard_state::scc68070_timer_w)
607 {
608 m_scc68070_timer_regs[offset] = data;
609 }
610
611 READ16_MEMBER(magicard_state::scc68070_int_irqc_r)
612 {
613 return m_scc68070_int_irqc_regs[offset];
614 }
615
616 WRITE16_MEMBER(magicard_state::scc68070_int_irqc_w)
617 {
618 m_scc68070_int_irqc_regs[offset] = data;
619 }
620
621 READ16_MEMBER(magicard_state::scc68070_dma_ch1_r)
622 {
623 return m_scc68070_dma_ch1_regs[offset];
624 }
625
626 WRITE16_MEMBER(magicard_state::scc68070_dma_ch1_w)
627 {
628 m_scc68070_dma_ch1_regs[offset] = data;
629 }
630
631 READ16_MEMBER(magicard_state::scc68070_dma_ch2_r)
632 {
633 return m_scc68070_dma_ch2_regs[offset];
634 }
635
636 WRITE16_MEMBER(magicard_state::scc68070_dma_ch2_w)
637 {
638 m_scc68070_dma_ch2_regs[offset] = data;
639 }
640
641 READ16_MEMBER(magicard_state::scc68070_mmu_r)
642 {
643 return m_scc68070_mmu_regs[offset];
644 }
645
646 WRITE16_MEMBER(magicard_state::scc68070_mmu_w)
647 {
648 m_scc68070_mmu_regs[offset] = data;
649
650 switch(offset)
651 {
652 case 0x0000/2:
653 if(data & 0x80)
654 fatalerror("SCC68070: MMU enable bit active\n");
655 break;
656 }
657 }
658
659
660
663
664 static ADDRESS_MAP_START( magicard_mem, AS_PROGRAM, 16, magicard_state )
665
666 AM_RANGE(0x00000000, 0x0017ffff) AM_MIRROR(0x7fe00000) AM_RAM AM_SHARE("magicram")
667 AM_RANGE(0x00180000, 0x001ffbff) AM_MIRROR(0x7fe00000) AM_RAM AM_REGION("maincpu", 0)
668
669 AM_RANGE(0x001ffc00, 0x001ffc01) AM_MIRROR(0x7fe00000) AM_READ(test_r)
670 AM_RANGE(0x001ffc40, 0x001ffc41) AM_MIRROR(0x7fe00000) AM_READ(test_r)
671 AM_RANGE(0x001ffd00, 0x001ffd05) AM_MIRROR(0x7fe00000) AM_WRITE(paletteram_io_w)
672
673 AM_RANGE(0x001ffd40, 0x001ffd43) AM_MIRROR(0x7fe00000) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
674 AM_RANGE(0x001ffd80, 0x001ffd81) AM_MIRROR(0x7fe00000) AM_READ(test_r)
675 AM_RANGE(0x001ffd80, 0x001ffd81) AM_MIRROR(0x7fe00000) AM_WRITENOP
676 AM_RANGE(0x001fff80, 0x001fffbf) AM_MIRROR(0x7fe00000) AM_RAM
677 AM_RANGE(0x001fffe0, 0x001fffff) AM_MIRROR(0x7fe00000) AM_READWRITE(philips_66470_r,philips_66470_w) AM_SHARE("pcab_vregs")
678 AM_RANGE(0x80001000, 0x8000100f) AM_READWRITE(scc68070_ext_irqc_r,scc68070_ext_irqc_w) AM_SHARE("scc_xirqc_regs")
679 AM_RANGE(0x80002000, 0x8000200f) AM_READWRITE(scc68070_iic_r,scc68070_iic_w) AM_SHARE("scc_iic_regs")
680 AM_RANGE(0x80002010, 0x8000201f) AM_READWRITE(scc68070_uart_r,scc68070_uart_w) AM_SHARE("scc_uart_regs")
681 AM_RANGE(0x80002020, 0x8000202f) AM_READWRITE(scc68070_timer_r,scc68070_timer_w) AM_SHARE("scc_timer_regs")
682 AM_RANGE(0x80002040, 0x8000204f) AM_READWRITE(scc68070_int_irqc_r,scc68070_int_irqc_w) AM_SHARE("scc_iirqc_regs")
683 AM_RANGE(0x80004000, 0x8000403f) AM_READWRITE(scc68070_dma_ch1_r,scc68070_dma_ch1_w) AM_SHARE("scc_dma1_regs")
684 AM_RANGE(0x80004040, 0x8000407f) AM_READWRITE(scc68070_dma_ch2_r,scc68070_dma_ch2_w) AM_SHARE("scc_dma2_regs")
685 AM_RANGE(0x80008000, 0x8000807f) AM_READWRITE(scc68070_mmu_r,scc68070_mmu_w) AM_SHARE("scc_mmu_regs")
686 ADDRESS_MAP_END
687
688
689
692
693 static INPUT_PORTS_START( magicard )
694 INPUT_PORTS_END
695
696
697 void magicard_state::machine_reset()
698 {
699 UINT16 *src = (UINT16*)memregion("maincpu" )->base();
700 UINT16 *dst = m_magicram;
701 memcpy (dst, src, 0x80000);
702 machine().device("maincpu")->reset();
703 }
704
705
706
709
710
711 INTERRUPT_GEN_MEMBER(magicard_state::magicard_irq)
712 {
713 if(machine().input().code_pressed(KEYCODE_Z))
714 device.execute().set_input_line_and_vector(1, HOLD_LINE,0xe4/4);
715 if(machine().input().code_pressed(KEYCODE_X))
716 device.execute().set_input_line_and_vector(1, HOLD_LINE,0xf0/4);
717 }
718
719 static MACHINE_CONFIG_START( magicard, magicard_state )
720 MCFG_CPU_ADD("maincpu", SCC68070, CLOCK_A/2)
721 MCFG_CPU_PROGRAM_MAP(magicard_mem)
722 MCFG_CPU_VBLANK_INT_DRIVER("screen", magicard_state, magicard_irq)
723
724 MCFG_SCREEN_ADD("screen", RASTER)
725 MCFG_SCREEN_REFRESH_RATE(60)
726 MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
727 MCFG_SCREEN_SIZE(400, 300)
728 MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-1)
729 MCFG_SCREEN_UPDATE_DRIVER(magicard_state, screen_update_magicard)
730
731 MCFG_PALETTE_LENGTH(0x100)
732
733
734
735 MCFG_SPEAKER_STANDARD_MONO("mono")
736 MCFG_SOUND_ADD("ymsnd", YM2413, CLOCK_A/12)
737 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
738 MACHINE_CONFIG_END
739
740
741
744
745 ROM_START( magicard )
746 ROM_REGION( 0x80000, "maincpu", 0 )
747 ROM_LOAD16_WORD_SWAP( "magicorg.bin", 0x000000, 0x80000, CRC(810edf9f) SHA1(0f1638a789a4be7413aa019b4e198353ba9c12d9) )
748
749 ROM_REGION( 0x0100, "sereeprom", 0 )
750 ROM_LOAD16_WORD_SWAP("mgorigee.bin", 0x0000, 0x0100, CRC(73522889) SHA1(3e10d6c1585c3a63cff717a0b950528d5373c781) )
751 ROM_END
752
753 ROM_START( magicarda )
754 ROM_REGION( 0x80000, "maincpu", 0 )
755 ROM_LOAD16_WORD_SWAP( "mcorigg2.bin", 0x00000, 0x20000, CRC(48546aa9) SHA1(23099a5e4c9f2c3386496f6d7f5bb7d435a6fb16) )
756 ROM_RELOAD( 0x40000, 0x20000 )
757 ROM_LOAD16_WORD_SWAP( "mcorigg1.bin", 0x20000, 0x20000, CRC(c9e4a38d) SHA1(812e5826b27c7ad98142a0f52fbdb6b61a2e31d7) )
758 ROM_RELOAD( 0x40001, 0x20000 )
759
760 ROM_REGION( 0x0100, "sereeprom", 0 )
761 ROM_LOAD("mgorigee.bin", 0x0000, 0x0100, CRC(73522889) SHA1(3e10d6c1585c3a63cff717a0b950528d5373c781) )
762 ROM_END
763
764 ROM_START( magicardb )
765 ROM_REGION( 0x80000, "maincpu", 0 )
766 ROM_LOAD16_WORD_SWAP( "mg_8.bin", 0x00000, 0x80000, CRC(f5499765) SHA1(63bcf40b91b43b218c1f9ec1d126a856f35d0844) )
767
768
769 ROM_REGION( 0x20000, "other", 0 )
770 ROM_LOAD16_WORD_SWAP("mg_u3.bin", 0x00000, 0x20000, CRC(2116de31) SHA1(fb9c21ca936532e7c342db4bcaaac31c478b1a35) )
771 ROM_END
772
773 ROM_START( magicardj )
774 ROM_REGION( 0x80000, "maincpu", 0 )
775 ROM_LOAD16_WORD_SWAP( "27c4002(__magicardj).ic21", 0x00000, 0x80000, CRC(ab2ed583) SHA1(a2d7148b785a8dfce8cff3b15ada293d65561c98) )
776
777 ROM_REGION( 0x0100, "pic16f84", 0 )
778 ROM_LOAD("pic16f84.ic29", 0x0000, 0x0100, BAD_DUMP CRC(0d968558) SHA1(b376885ac8452b6cbf9ced81b1080bfd570d9b91) )
779
780 ROM_REGION( 0x200000, "other", 0 )
781 ROM_LOAD("29f1610mc.ic30", 0x000000, 0x200000, NO_DUMP )
782
783 ROM_REGION( 0x0100, "sereeprom", 0 )
784 ROM_LOAD("24c02c.ic26", 0x0000, 0x0100, CRC(b5c86862) SHA1(0debc0f7e7c506e5a4e2cae152548d80ad72fc2e) )
785 ROM_END
786
787
806
807 ROM_START( magicarde )
808 ROM_REGION( 0x80000, "maincpu", 0 )
809 ROM_LOAD16_WORD_SWAP( "27c4002.ic21", 0x00000, 0x80000, CRC(b5f24412) SHA1(73ff05c19132932a419fef0d5dc985440ce70e83) )
810
811 ROM_REGION( 0x0200, "pic16c54", 0 )
812 ROM_LOAD("pic16c54.ic29", 0x0000, 0x0200, BAD_DUMP CRC(73224200) SHA1(c9a1038146647430759d570bb5626047a476a05b) )
813
814 ROM_REGION( 0x0100, "sereeprom", 0 )
815 ROM_LOAD("st24c02.ic26", 0x0000, 0x0100, CRC(98287c67) SHA1(ad34e55c1ce4f77c27049dac88050ed3c94af1a0) )
816 ROM_END
817
818 ROM_START( magicle )
819 ROM_REGION( 0x80000, "maincpu", 0 )
820 ROM_LOAD16_WORD_SWAP( "27c4002.ic21", 0x00000, 0x80000, CRC(73328346) SHA1(fca5f8a93f25377e659c2b291674d706ca37400e) )
821
822 ROM_REGION( 0x0100, "pic16f84", 0 )
823 ROM_LOAD("pic16f84.ic29", 0x0000, 0x0100, BAD_DUMP CRC(0d968558) SHA1(b376885ac8452b6cbf9ced81b1080bfd570d9b91) )
824
825 ROM_REGION( 0x200000, "other", 0 )
826 ROM_LOAD("29f1610mc.ic30", 0x000000, 0x200000, NO_DUMP )
827
828 ROM_REGION( 0x0200, "sereeprom", 0 )
829 ROM_LOAD("24c04a.ic26", 0x0000, 0x0200, CRC(48c4f473) SHA1(5355313cc96f655096e13bfae78be3ba2dfe8a2d) )
830 ROM_END
831
832
833
836
837 DRIVER_INIT_MEMBER(magicard_state,magicard)
838 {
839
840 }
841
842
843
846
847
848
849 GAME( 199?, magicard, 0, magicard, magicard, magicard_state, magicard, ROT0, "Impera", "Magic Card (set 1)", GAME_NO_SOUND | GAME_NOT_WORKING )
850 GAME( 199?, magicarda, magicard, magicard, magicard, magicard_state, magicard, ROT0, "Impera", "Magic Card (set 2)", GAME_NO_SOUND | GAME_NOT_WORKING )
851 GAME( 199?, magicardb, magicard, magicard, magicard, magicard_state, magicard, ROT0, "Impera", "Magic Card (set 3)", GAME_NO_SOUND | GAME_NOT_WORKING )
852 GAME( 1994, magicarde, magicard, magicard, magicard, magicard_state, magicard, ROT0, "Impera", "Magic Card Export 94", GAME_NO_SOUND | GAME_NOT_WORKING )
853 GAME( 1998, magicardj, magicard, magicard, magicard, magicard_state, magicard, ROT0, "Impera", "Magic Card Jackpot (4.01)", GAME_NO_SOUND | GAME_NOT_WORKING )
854 GAME( 2001, magicle, 0, magicard, magicard, magicard_state, magicard, ROT0, "Impera", "Magic Lotto Export (5.03)", GAME_NO_SOUND | GAME_NOT_WORKING )