Previous 15994 Revisions Next

r6532 Friday 4th December, 2009 at 21:04:01 UTC by Curt Coder
[MPF1] Implemented MONI/INTR keys, and monitor BREAK logic. Removed bogus IRQ0 timer.
[src/mess/drivers]mpf1.c

src/mess/drivers/mpf1.c
r6531r6532
1212
1313/*
1414
15    Artwork picture downloaded from:
16
17    http://members.lycos.co.uk/leeedavison/z80/mpf1/
18
19*/
20
21/*
22
2315   TODO:
2416
17   - mpf1b doesn't use artwork for some reason
18   - remove halt callback
2519   - crt board
2620   - speech board
2721   - printers
28   - intr key
29   - moni key
30   -
22   - clickable artwork
3123
3224*/
3325
r6531r6532
8678
8779/* Input Ports */
8880
81static INPUT_CHANGED( trigger_nmi )
82{
83   cputag_set_input_line(field->port->machine, Z80_TAG, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
84}
85
86static INPUT_CHANGED( trigger_irq )
87{
88   cputag_set_input_line(field->port->machine, Z80_TAG, INPUT_LINE_IRQ0, newval ? CLEAR_LINE : ASSERT_LINE);
89}
90
8991static INPUT_PORTS_START( mpf1 )
9092   PORT_START("PC0")
9193   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3)
r6531r6532
137139   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MOVE") PORT_CODE(KEYCODE_QUOTE)
138140   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
139141
140   PORT_START("user")
141   PORT_BIT(0x3f, IP_ACTIVE_LOW, IPT_UNUSED)
142   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U)
143   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
144
145   PORT_START("extra")   // interrupt keys
146   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M)   // causes NMI ?
147   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I)   // causes INT
142   PORT_START("SPECIAL")
143   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U)
144   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M) PORT_CHANGED(trigger_nmi, 0)
145   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I) PORT_CHANGED(trigger_irq, 0)
148146INPUT_PORTS_END
149147
150148static INPUT_PORTS_START( mpf1b )
r6531r6532
198196   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL/left") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_LEFT)
199197   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
200198
201   PORT_START("user")
202   PORT_BIT(0x3f, IP_ACTIVE_LOW, IPT_UNUSED)
203   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
204   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
205
206   PORT_START("extra")   // interrupt keys
207   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M)   // causes NMI ?
208   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I)   // causes INT
199   PORT_START("SPECIAL")
200   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U)
201   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M) PORT_CHANGED(trigger_nmi, 0)
202   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I) PORT_CHANGED(trigger_irq, 0)
209203INPUT_PORTS_END
210204
211205/* Intel 8255A Interface */
r6531r6532
236230   if (!BIT(state->lednum, 5)) data &= input_port_read(device->machine, "PC5");
237231
238232   /* bit 6, user key */
239   data &= input_port_read(device->machine, "user");
233   data &= BIT(input_port_read(device->machine, "SPECIAL"), 0) << 6;
240234
241235   /* bit 7, tape input */
242236   data |= (cassette_input(state->cassette) > 0 ? 1 : 0) << 7;
r6531r6532
264258   timer_adjust_oneshot(state->led_refresh_timer, attotime_never, 0);
265259
266260   /* bit 6, monitor break control */
261   state->_break = BIT(data, 6);
267262
263   if (state->_break)
264   {
265      state->m1 = 0;
266      cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, CLEAR_LINE);
267   }
268
268269   /* bit 7, tape output, tone and led */
269270   set_led_status(device->machine, 0, !BIT(data, 7));
270271   speaker_level_w(state->speaker, BIT(data, 7));
r6531r6532
345346   set_led_status(machine, 1, led_halt);
346347}
347348
348static TIMER_CALLBACK( irq0_callback )
349{
350   irq0_line_hold( cputag_get_cpu(machine, Z80_TAG) );
351}
352
353349static MACHINE_START( mpf1 )
354350{
355351   mpf1_state *state = machine->driver_data;
r6531r6532
361357   state->led_refresh_timer = timer_alloc(machine, led_refresh, 0);
362358
363359   /* register for state saving */
360   state_save_register_global(machine, state->_break);
361   state_save_register_global(machine, state->m1);
364362   state_save_register_global(machine, state->lednum);
365363}
366364
r6531r6532
370368
371369   state->lednum = 0;
372370
373   timer_pulse(machine,  ATTOTIME_IN_HZ(1), NULL, 0, check_halt_callback );
374   timer_pulse(machine,  ATTOTIME_IN_HZ(60), NULL, 0, irq0_callback );
371   timer_pulse(machine,  ATTOTIME_IN_HZ(1), NULL, 0, check_halt_callback);
375372}
376373
377374/* Machine Drivers */
r6531r6532
484481
485482/* System Drivers */
486483
487COMP( 1979, mpf1,  0,    0, mpf1, mpf1,  0, 0, "Multitech", "Micro Professor 1", 0)
488COMP( 1979, mpf1b, mpf1, 0, mpf1b,mpf1b, 0, 0, "Multitech", "Micro Professor 1B", 0)
489COMP( 1982, mpf1p, mpf1, 0, mpf1p,mpf1b, 0, 0, "Multitech", "Micro Professor 1 Plus", GAME_NOT_WORKING)
484static DIRECT_UPDATE_HANDLER( mpf1_direct_update_handler )
485{
486   mpf1_state *state = space->machine->driver_data;
487
488   if (!state->_break)
489   {
490      state->m1++;
491
492      if (state->m1 == 5)
493      {
494         cputag_set_input_line(space->machine, Z80_TAG, INPUT_LINE_NMI, ASSERT_LINE);
495      }
496   }
497
498   return 0;
499}
500
501static DRIVER_INIT( mpf1 )
502{
503   memory_set_direct_update_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), mpf1_direct_update_handler);
504}
505
506COMP( 1979, mpf1,  0,    0, mpf1, mpf1,  mpf1, 0, "Multitech", "Micro Professor 1", 0)
507COMP( 1979, mpf1b, mpf1, 0, mpf1b,mpf1b, mpf1, 0, "Multitech", "Micro Professor 1B", 0)
508COMP( 1982, mpf1p, mpf1, 0, mpf1p,mpf1b, mpf1, 0, "Multitech", "Micro Professor 1 Plus", GAME_NOT_WORKING)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team