Previous 15994 Revisions Next

r3379 Friday 3rd October, 2008 at 19:11:56 UTC by Wilbert Pol
[MPF1] Changed driver into a screenless driver.
[artwork]mpf1.zip
[src/mess/drivers]mpf1.c

src/mess/drivers/mpf1.c
r3378r3379
3131#include "machine/z80ctc.h"
3232#include "machine/z80pio.h"
3333#include "machine/z80sio.h"
34#include "mscommon.h"
3534#include "sound/dac.h"
3635
3736
r3378r3379
5049   }
5150}
5251
53static 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
9452
95static 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
11353static UINT32 leddigit[6];
11454static INT8 lednum;
11555static int led_tone;
r3378r3379
11858static UINT8 kbdlatch;
11959
12060
121
122/* video */
123
124static PALETTE_INIT( mpf1 )
61static TIMER_CALLBACK( check_halt_callback )
12562{
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
133static VIDEO_START( mpf1 )
134{
135    videoram_size = 6 * 2 + 24;
136    videoram = auto_malloc (videoram_size);
137}
138
139
140
141static 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
15463   // halt-LED; the red one, is turned on when the processor is halted
15564   // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix
15665   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);
15967}
16068
69
16170/* Memory Maps */
16271
16372static ADDRESS_MAP_START( mpf1_map, ADDRESS_SPACE_PROGRAM, 8 )
r3378r3379
203112//  The 16 I/O port combinations for the CTC (Zilog, Z0843004PSC, Z80 CTC, 8644)
204113//  AM_RANGE(0x40, 0x43) AM_WRITE(ctc_enable_w) AM_MIRROR(0x7C)
205114
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)
208117
209118ADDRESS_MAP_END
210119
r3378r3379
469378             ( (data & 0x02) << 5 ) |
470379             ( (data & 0x40) << 1 );
471380      leddigit[lednum] = data;
381      output_set_digit_value( lednum, data & 0x7f );
382      set_led_status( lednum + 2, data >> 7 );
472383   }
473384   verboselog( 1, "PPI port B (LED Data) write: %02x\n", data );
474385}
r3378r3379
519430
520431/* Machine Initialization */
521432
522static MACHINE_RESET( mpf1 )
433static TIMER_CALLBACK( irq0_callback )
523434{
524   // CTC
525/*  z80ctc_init(&ctc_intf);
526    z80ctc_reset(0);*/
435   irq0_line_hold( machine, 0 );
436}
527437
528   // leds
529   for (lednum = 0; lednum < 6; lednum++)
530      leddigit[lednum] = 0;
531
438static MACHINE_RESET( mpf1 )
439{
532440   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 );
533444}
534445
535446/* Machine Drivers */
r3378r3379
539450   MDRV_CPU_ADD("main", Z80, 3579500/2)   // 1.79 MHz
540451   MDRV_CPU_PROGRAM_MAP(mpf1_map, 0)
541452   MDRV_CPU_IO_MAP(mpf1_io_map, 0)
542   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
543453
544454   MDRV_MACHINE_RESET( mpf1 )
545455
r3378r3379
548458   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
549459   MDRV_DEVICE_CONFIG( ppi8255_intf )
550460
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
564461   // sound hardware
565462   MDRV_SPEAKER_STANDARD_MONO("mono")
566463   MDRV_SOUND_ADD("dac", DAC, 0)
artwork/mpf1.zip

Previous 15994 Revisions Next


© 1998-2018 The MESS Team