src/mess/drivers/mpf1.c
| r3378 | r3379 | |
| 31 | 31 | #include "machine/z80ctc.h" |
| 32 | 32 | #include "machine/z80pio.h" |
| 33 | 33 | #include "machine/z80sio.h" |
| 34 | | #include "mscommon.h" |
| 35 | 34 | #include "sound/dac.h" |
| 36 | 35 | |
| 37 | 36 | |
| r3378 | r3379 | |
| 50 | 49 | } |
| 51 | 50 | } |
| 52 | 51 | |
| 53 | | static const char leddisplay[] = |
| 54 | | { |
| 55 | | " aaaaaaaaaaaaaaaaa \r" |
| 56 | | " aaaaaaaaaaaaaaaaaaa \r" |
| 57 | | " aaaaaaaaaaaaaaaaaa \r" |
| 58 | | " ff aaaaaaaaaaaaaaaa bb \r" |
| 59 | | " fff bbb \r" |
| 60 | | " ffff bbbb \r" |
| 61 | | " ffff bbbb \r" |
| 62 | | " ffff bbbbb \r" |
| 63 | | " ffff bbbb \r" |
| 64 | | " fffff bbbb \r" |
| 65 | | " ffff bbbb \r" |
| 66 | | " ffff bbbb \r" |
| 67 | | " ffff bbb \r" |
| 68 | | " ffff bbbb \r" |
| 69 | | " ffff bbbb \r" |
| 70 | | " fffff bbbb \r" |
| 71 | | " ffff bbbb \r" |
| 72 | | " ff ggggggggggggggg bb \r" |
| 73 | | " ggggggggggggggggg \r" |
| 74 | | " gggggggggggggggg \r" |
| 75 | | " e gggggggggggggg cc \r" |
| 76 | | " eee cccc \r" |
| 77 | | " eeee ccccc \r" |
| 78 | | " eeee ccccc \r" |
| 79 | | " eeee ccccc \r" |
| 80 | | " eeee ccccc \r" |
| 81 | | " eeee cccc \r" |
| 82 | | " eeee cccc \r" |
| 83 | | " eeee ccccc \r" |
| 84 | | " eeee ccccc \r" |
| 85 | | "eeeee cccc \r" |
| 86 | | "eeee cccc \r" |
| 87 | | "eeee cccc hh \r" |
| 88 | | "eee cccc hhhh \r" |
| 89 | | "ee dddddddddddddddd cc hhhh \r" |
| 90 | | " dddddddddddddddddd hhhh \r" |
| 91 | | " dddddddddddddddddd hh \r" |
| 92 | | " dddddddddddddddd \r" |
| 93 | | }; // h is originally represented by p in original schematics |
| 94 | 52 | |
| 95 | | static const char radius_7_led[] = { |
| 96 | | " 11111\r" |
| 97 | | " 111111111\r" |
| 98 | | " 11111111111\r" |
| 99 | | " 1111111111111\r" |
| 100 | | "11111111111111\r" |
| 101 | | "111111111111111\r" |
| 102 | | "111111111111111\r" |
| 103 | | "111111111111111\r" |
| 104 | | "111111111111111\r" |
| 105 | | "111111111111111\r" |
| 106 | | "111111111111111\r" |
| 107 | | " 1111111111111\r" |
| 108 | | " 11111111111\r" |
| 109 | | " 111111111\r" |
| 110 | | " 111111\r" |
| 111 | | }; |
| 112 | | |
| 113 | 53 | static UINT32 leddigit[6]; |
| 114 | 54 | static INT8 lednum; |
| 115 | 55 | static int led_tone; |
| r3378 | r3379 | |
| 118 | 58 | static UINT8 kbdlatch; |
| 119 | 59 | |
| 120 | 60 | |
| 121 | | |
| 122 | | /* video */ |
| 123 | | |
| 124 | | static PALETTE_INIT( mpf1 ) |
| 61 | static TIMER_CALLBACK( check_halt_callback ) |
| 125 | 62 | { |
| 126 | | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); |
| 127 | | palette_set_color_rgb(machine, 1, 0xff, 0x00, 0x00); |
| 128 | | palette_set_color_rgb(machine, 2, 0x00, 0xff, 0x00); |
| 129 | | } |
| 130 | | |
| 131 | | |
| 132 | | |
| 133 | | static VIDEO_START( mpf1 ) |
| 134 | | { |
| 135 | | videoram_size = 6 * 2 + 24; |
| 136 | | videoram = auto_malloc (videoram_size); |
| 137 | | } |
| 138 | | |
| 139 | | |
| 140 | | |
| 141 | | static VIDEO_UPDATE( mpf1 ) |
| 142 | | { |
| 143 | | int x; |
| 144 | | static const UINT8 xpositions[] = { 20, 59, 97, 135, 185, 223 }; |
| 145 | | |
| 146 | | //fillbitmap(bitmap, get_black_pen(), NULL); |
| 147 | | |
| 148 | | for(x = 0; x < 6; x++) |
| 149 | | draw_led(screen->machine, bitmap, leddisplay, leddigit[x], xpositions[x], 377); |
| 150 | | |
| 151 | | // tone-LED; the green one |
| 152 | | draw_led(screen->machine, bitmap, radius_7_led, led_tone * 2, 277, 375); |
| 153 | | |
| 154 | 63 | // halt-LED; the red one, is turned on when the processor is halted |
| 155 | 64 | // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix |
| 156 | 65 | led_halt = (UINT8) cpunum_get_info_int(0, CPUINFO_INT_REGISTER + Z80_HALT); |
| 157 | | draw_led(screen->machine, bitmap, radius_7_led, led_halt, 277, 394); |
| 158 | | return 0; |
| 66 | set_led_status(1, led_tone); |
| 159 | 67 | } |
| 160 | 68 | |
| 69 | |
| 161 | 70 | /* Memory Maps */ |
| 162 | 71 | |
| 163 | 72 | static ADDRESS_MAP_START( mpf1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r3378 | r3379 | |
| 203 | 112 | // The 16 I/O port combinations for the CTC (Zilog, Z0843004PSC, Z80 CTC, 8644) |
| 204 | 113 | // AM_RANGE(0x40, 0x43) AM_WRITE(ctc_enable_w) AM_MIRROR(0x7C) |
| 205 | 114 | |
| 206 | | // The 16 I/O port combinations for the PIO (Zilog, Z0842004PSC, Z80 PIO, 8735) |
| 207 | | // AM_RANGE(0x80, 0x83) AM_READWRITE(pio_r, pio_w) AM_MIRROR(0xBF) |
| 115 | /* The 16 I/O port combinations for the PIO (Zilog, Z0842004PSC, Z80 PIO, 8735) */ |
| 116 | AM_RANGE(0x80, 0x83) AM_DEVREADWRITE(Z80PIO, "z80pio", z80pio_r, z80pio_w) AM_MIRROR(0xBF) |
| 208 | 117 | |
| 209 | 118 | ADDRESS_MAP_END |
| 210 | 119 | |
| r3378 | r3379 | |
| 469 | 378 | ( (data & 0x02) << 5 ) | |
| 470 | 379 | ( (data & 0x40) << 1 ); |
| 471 | 380 | leddigit[lednum] = data; |
| 381 | output_set_digit_value( lednum, data & 0x7f ); |
| 382 | set_led_status( lednum + 2, data >> 7 ); |
| 472 | 383 | } |
| 473 | 384 | verboselog( 1, "PPI port B (LED Data) write: %02x\n", data ); |
| 474 | 385 | } |
| r3378 | r3379 | |
| 519 | 430 | |
| 520 | 431 | /* Machine Initialization */ |
| 521 | 432 | |
| 522 | | static MACHINE_RESET( mpf1 ) |
| 433 | static TIMER_CALLBACK( irq0_callback ) |
| 523 | 434 | { |
| 524 | | // CTC |
| 525 | | /* z80ctc_init(&ctc_intf); |
| 526 | | z80ctc_reset(0);*/ |
| 435 | irq0_line_hold( machine, 0 ); |
| 436 | } |
| 527 | 437 | |
| 528 | | // leds |
| 529 | | for (lednum = 0; lednum < 6; lednum++) |
| 530 | | leddigit[lednum] = 0; |
| 531 | | |
| 438 | static MACHINE_RESET( mpf1 ) |
| 439 | { |
| 532 | 440 | lednum = 0; |
| 441 | |
| 442 | timer_pulse( ATTOTIME_IN_HZ(1), NULL, 0, check_halt_callback ); |
| 443 | timer_pulse( ATTOTIME_IN_HZ(60), NULL, 0, irq0_callback ); |
| 533 | 444 | } |
| 534 | 445 | |
| 535 | 446 | /* Machine Drivers */ |
| r3378 | r3379 | |
| 539 | 450 | MDRV_CPU_ADD("main", Z80, 3579500/2) // 1.79 MHz |
| 540 | 451 | MDRV_CPU_PROGRAM_MAP(mpf1_map, 0) |
| 541 | 452 | MDRV_CPU_IO_MAP(mpf1_io_map, 0) |
| 542 | | MDRV_CPU_VBLANK_INT("main", irq0_line_hold) |
| 543 | 453 | |
| 544 | 454 | MDRV_MACHINE_RESET( mpf1 ) |
| 545 | 455 | |
| r3378 | r3379 | |
| 548 | 458 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 549 | 459 | MDRV_DEVICE_CONFIG( ppi8255_intf ) |
| 550 | 460 | |
| 551 | | // video hardware |
| 552 | | MDRV_SCREEN_ADD("main", RASTER) |
| 553 | | MDRV_SCREEN_REFRESH_RATE(60) |
| 554 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 555 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 556 | | MDRV_SCREEN_SIZE(462, 661) |
| 557 | | MDRV_SCREEN_VISIBLE_AREA(0, 461, 0, 660) |
| 558 | | MDRV_PALETTE_LENGTH(3) |
| 559 | | |
| 560 | | MDRV_PALETTE_INIT( mpf1 ) |
| 561 | | MDRV_VIDEO_START(mpf1) |
| 562 | | MDRV_VIDEO_UPDATE(mpf1) |
| 563 | | |
| 564 | 461 | // sound hardware |
| 565 | 462 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 566 | 463 | MDRV_SOUND_ADD("dac", DAC, 0) |