Previous 15994 Revisions Next

r5907 Monday 28th September, 2009 at 22:05:01 UTC by Dirk Best
[MPF1] Cleaned up, changed DAC to speaker, added cassette support.
[docs]messnew.txt
[src/mess/drivers]mpf1.c

src/mess/drivers/mpf1.c
r5906r5907
1010*   Sound: Speaker                               *
1111*                                                *
1212* TODO:                                          *
13*    Cassette storage emulation                  *
14*    Sound                                       *
13*    CRT board                                   *
14*    Speech board                                *
1515*    I/O board                                   *
1616*    MONI/INTR key interrupts                    *
1717*    PIO/CTC + interrupt daisy chain             *
r5906r5907
2626*/
2727
2828#include "driver.h"
29#include "machine/i8255a.h"
3029#include "cpu/z80/z80.h"
30#include "machine/i8255a.h"
3131#include "machine/z80ctc.h"
3232#include "machine/z80pio.h"
3333#include "machine/z80sio.h"
34#include "sound/dac.h"
34#include "sound/speaker.h"
35#include "devices/cassette.h"
3536#include "mpf1.lh"
3637
3738
38#define VERBOSE_LEVEL ( 0 )
39/***************************************************************************
40    GLOBAL VARIABLES
41***************************************************************************/
3942
40INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... )
41{
42   if( VERBOSE_LEVEL >= n_level )
43   {
44      va_list v;
45      char buf[ 32768 ];
46      va_start( v, s_fmt );
47      vsprintf( buf, s_fmt, v );
48      va_end( v );
49//      logerror( "%08x: %s", cpu_get_pc(space->cpu), buf );
50   }
51}
52
53
5443static emu_timer *led_refresh_timer;
55static INT8 lednum;
56static int led_tone;
57static int led_halt;
58static INT8 keycol;
59static UINT8 kbdlatch;
44static UINT8 lednum;
6045
6146
62static TIMER_CALLBACK( check_halt_callback )
63{
64   // halt-LED; the red one, is turned on when the processor is halted
65   // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix
66   led_halt = (UINT8) devtag_get_info_int(machine, "maincpu", CPUINFO_INT_REGISTER + Z80_HALT);
67   set_led_status(1, led_tone);
68}
47/***************************************************************************
48    ADDRESS MAPS
49***************************************************************************/
6950
70
71/* Memory Maps */
72
7351static ADDRESS_MAP_START( mpf1_map, ADDRESS_SPACE_PROGRAM, 8 )
7452   AM_RANGE(0x0000, 0x0fff) AM_ROM
7553   AM_RANGE(0x1000, 0x1fff) AM_RAM
r5906r5907
8866   AM_RANGE(0x80, 0x83) AM_MIRROR(0x3c) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w)
8967ADDRESS_MAP_END
9068
91/* Input Ports */
9269
93#define KEY_UNUSED( bit ) \
94   PORT_BIT( bit, IP_ACTIVE_LOW, IPT_UNUSED )
70/***************************************************************************
71    INPUT PORTS
72***************************************************************************/
9573
9674static INPUT_PORTS_START( mpf1 )
97   PORT_START("LINE0")   // column 0
98   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3)
99   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 HL'") PORT_CODE(KEYCODE_7)
100   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B I*IF") PORT_CODE(KEYCODE_B)
101   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F *PNC'") PORT_CODE(KEYCODE_F)
102   KEY_UNUSED( 0x10 )
103   KEY_UNUSED( 0x20 )
104   KEY_UNUSED( 0x40 )
105   KEY_UNUSED( 0x80 )
75   PORT_START("row_0")
76   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 HL") PORT_CODE(KEYCODE_3)
77   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 HL'") PORT_CODE(KEYCODE_7)
78   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B I*IF") PORT_CODE(KEYCODE_B)
79   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F *PNC'") PORT_CODE(KEYCODE_F)
80   PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
10681
107   PORT_START("LINE1")   // column 1
108   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 DE") PORT_CODE(KEYCODE_2)
109   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 DE'") PORT_CODE(KEYCODE_6)
110   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A SP") PORT_CODE(KEYCODE_A)
111   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SZ*H'") PORT_CODE(KEYCODE_E)
112   KEY_UNUSED( 0x10 )
113   KEY_UNUSED( 0x20 )
114   KEY_UNUSED( 0x40 )
115   KEY_UNUSED( 0x80 )
82   PORT_START("row_1")
83   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 DE") PORT_CODE(KEYCODE_2)
84   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 DE'") PORT_CODE(KEYCODE_6)
85   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A SP") PORT_CODE(KEYCODE_A)
86   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E SZ*H'") PORT_CODE(KEYCODE_E)
87   PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
11688
117   PORT_START("LINE2")   // column 2
118   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 BC") PORT_CODE(KEYCODE_1)
119   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 BC'") PORT_CODE(KEYCODE_5)
120   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 IY") PORT_CODE(KEYCODE_9)
121   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D *PNC") PORT_CODE(KEYCODE_D)
122   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_F1)
123   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE RD") PORT_CODE(KEYCODE_F5)
124   KEY_UNUSED( 0x40 )
125   KEY_UNUSED( 0x80 )
89   PORT_START("row_2")
90   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 BC") PORT_CODE(KEYCODE_1)
91   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 BC'") PORT_CODE(KEYCODE_5)
92   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 IY") PORT_CODE(KEYCODE_9)
93   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D *PNC") PORT_CODE(KEYCODE_D)
94   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STEP") PORT_CODE(KEYCODE_F1)
95   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE RD") PORT_CODE(KEYCODE_F5)
96   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
12697
127   PORT_START("LINE3")   // column 3
128   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 AF") PORT_CODE(KEYCODE_0)
129   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 AF'") PORT_CODE(KEYCODE_4)
130   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IX") PORT_CODE(KEYCODE_8)
131   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C SZ*H") PORT_CODE(KEYCODE_C)
132   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_F2)
133   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE WR") PORT_CODE(KEYCODE_F6)
134   KEY_UNUSED( 0x40 )
135   KEY_UNUSED( 0x80 )
98   PORT_START("row_3")
99   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 AF") PORT_CODE(KEYCODE_0)
100   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 AF'") PORT_CODE(KEYCODE_4)
101   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IX") PORT_CODE(KEYCODE_8)
102   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C SZ*H") PORT_CODE(KEYCODE_C)
103   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_F2)
104   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE WR") PORT_CODE(KEYCODE_F6)
105   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
136106
137   PORT_START("LINE4")   // column 4
138   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CBR") PORT_CODE(KEYCODE_N)
139   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PC") PORT_CODE(KEYCODE_M)
140   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_COMMA)
141   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADR") PORT_CODE(KEYCODE_STOP)
142   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_SLASH)
143   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RELA") PORT_CODE(KEYCODE_RCONTROL)
144   KEY_UNUSED( 0x40 )
145   KEY_UNUSED( 0x80 )
107   PORT_START("row_4")
108   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CBR") PORT_CODE(KEYCODE_N)
109   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PC") PORT_CODE(KEYCODE_M)
110   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_COMMA)
111   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ADR") PORT_CODE(KEYCODE_STOP)
112   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_SLASH)
113   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RELA") PORT_CODE(KEYCODE_RCONTROL)
114   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
146115
147   PORT_START("LINE5")   // column 5
148   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SBR") PORT_CODE(KEYCODE_H)
149   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_J)
150   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DATA") PORT_CODE(KEYCODE_K)
151   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_L)
152   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_COLON)
153   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MOVE") PORT_CODE(KEYCODE_QUOTE)
154   KEY_UNUSED( 0x40 )
155   KEY_UNUSED( 0x80 )
116   PORT_START("row_5")
117   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SBR") PORT_CODE(KEYCODE_H)
118   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_J)
119   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DATA") PORT_CODE(KEYCODE_K)
120   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_L)
121   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_COLON)
122   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MOVE") PORT_CODE(KEYCODE_QUOTE)
123   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
156124
157   PORT_START("LINE6")   // column 6
158   KEY_UNUSED( 0x01 )
159   KEY_UNUSED( 0x02 )
160   KEY_UNUSED( 0x04 )
161   KEY_UNUSED( 0x08 )
162   KEY_UNUSED( 0x10 )
163   KEY_UNUSED( 0x20 )
164   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U)
165   KEY_UNUSED( 0x80 )
125   PORT_START("user")
126   PORT_BIT(0x3f, IP_ACTIVE_LOW, IPT_UNUSED)
127   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("USER KEY") PORT_CODE(KEYCODE_U)
128   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
166129
167   PORT_START("EXTRA")   // interrupt keys
168   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M)   // causes NMI ?
169   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I)   // causes INT
130   PORT_START("extra")   // interrupt keys
131   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M)   // causes NMI ?
132   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I)   // causes INT
170133INPUT_PORTS_END
171134
172135static INPUT_PORTS_START( mpf1b )
173   PORT_START("LINE0")   // column 0
174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3)
175   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 >") PORT_CODE(KEYCODE_7)
176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B STOP") PORT_CODE(KEYCODE_B)
177   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F LET") PORT_CODE(KEYCODE_F)
178   KEY_UNUSED( 0x10 )
179   KEY_UNUSED( 0x20 )
180   KEY_UNUSED( 0x40 )
181   KEY_UNUSED( 0x80 )
136   PORT_START("row_0")
137   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3)
138   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 >") PORT_CODE(KEYCODE_7)
139   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B STOP") PORT_CODE(KEYCODE_B)
140   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F LET") PORT_CODE(KEYCODE_F)
141   PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
182142
183   PORT_START("LINE1")   // column 1
184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 *") PORT_CODE(KEYCODE_2)
185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 <") PORT_CODE(KEYCODE_6)
186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A CALL") PORT_CODE(KEYCODE_A)
187   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E INPUT") PORT_CODE(KEYCODE_E)
188   KEY_UNUSED( 0x10 )
189   KEY_UNUSED( 0x20 )
190   KEY_UNUSED( 0x40 )
191   KEY_UNUSED( 0x80 )
143   PORT_START("row_1")
144   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 *") PORT_CODE(KEYCODE_2)
145   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 <") PORT_CODE(KEYCODE_6)
146   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A CALL") PORT_CODE(KEYCODE_A)
147   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E INPUT") PORT_CODE(KEYCODE_E)
148   PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
192149
193   PORT_START("LINE2")   // column 2
194   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 -") PORT_CODE(KEYCODE_1)
195   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 =") PORT_CODE(KEYCODE_5)
196   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 P") PORT_CODE(KEYCODE_9)
197   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D PRINT") PORT_CODE(KEYCODE_D)
198   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONT") PORT_CODE(KEYCODE_F1)
199   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOAD") PORT_CODE(KEYCODE_F5)
200   KEY_UNUSED( 0x40 )
201   KEY_UNUSED( 0x80 )
150   PORT_START("row_2")
151   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 -") PORT_CODE(KEYCODE_1)
152   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 =") PORT_CODE(KEYCODE_5)
153   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 P") PORT_CODE(KEYCODE_9)
154   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D PRINT") PORT_CODE(KEYCODE_D)
155   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONT") PORT_CODE(KEYCODE_F1)
156   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOAD") PORT_CODE(KEYCODE_F5)
157   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
202158
203   PORT_START("LINE3")   // column 3
204   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 +") PORT_CODE(KEYCODE_0)
205   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 * *") PORT_CODE(KEYCODE_4)
206   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 M") PORT_CODE(KEYCODE_8)
207   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C NEXT") PORT_CODE(KEYCODE_C)
208   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_F2)
209   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SAVE") PORT_CODE(KEYCODE_F6)
210   KEY_UNUSED( 0x40 )
211   KEY_UNUSED( 0x80 )
159   PORT_START("row_3")
160   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 +") PORT_CODE(KEYCODE_0)
161   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 * *") PORT_CODE(KEYCODE_4)
162   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 M") PORT_CODE(KEYCODE_8)
163   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C NEXT") PORT_CODE(KEYCODE_C)
164   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RUN") PORT_CODE(KEYCODE_F2)
165   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SAVE") PORT_CODE(KEYCODE_F6)
166   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
212167
213   PORT_START("LINE4")   // column 4
214   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IF/pgup") PORT_CODE(KEYCODE_PGUP)
215   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TO/down") PORT_CODE(KEYCODE_T) PORT_CODE(KEYCODE_DOWN)
216   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("THEN/pgdn") PORT_CODE(KEYCODE_PGDN)
217   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GOTO") PORT_CODE(KEYCODE_G)
218   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RET/~") PORT_CODE(KEYCODE_R)
219   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GOSUB") PORT_CODE(KEYCODE_O)
220   KEY_UNUSED( 0x40 )
221   KEY_UNUSED( 0x80 )
168   PORT_START("row_4")
169   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("IF/pgup") PORT_CODE(KEYCODE_PGUP)
170   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TO/down") PORT_CODE(KEYCODE_T) PORT_CODE(KEYCODE_DOWN)
171   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("THEN/pgdn") PORT_CODE(KEYCODE_PGDN)
172   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GOTO") PORT_CODE(KEYCODE_G)
173   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RET/~") PORT_CODE(KEYCODE_R)
174   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GOSUB") PORT_CODE(KEYCODE_O)
175   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
222176
223   PORT_START("LINE5")   // column 5
224   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FOR/up") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_UP)
225   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LIST") PORT_CODE(KEYCODE_L)
226   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEW") PORT_CODE(KEYCODE_N)
227   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER)
228   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLR/right") PORT_CODE(KEYCODE_INSERT) PORT_CODE(KEYCODE_RIGHT)
229   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL/left") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_LEFT)
230   KEY_UNUSED( 0x40 )
231   KEY_UNUSED( 0x80 )
177   PORT_START("row_5")
178   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FOR/up") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_UP)
179   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LIST") PORT_CODE(KEYCODE_L)
180   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEW") PORT_CODE(KEYCODE_N)
181   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER)
182   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLR/right") PORT_CODE(KEYCODE_INSERT) PORT_CODE(KEYCODE_RIGHT)
183   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL/left") PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_LEFT)
184   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
232185
233   PORT_START("LINE6")   // column 6
234   KEY_UNUSED( 0x01 )
235   KEY_UNUSED( 0x02 )
236   KEY_UNUSED( 0x04 )
237   KEY_UNUSED( 0x08 )
238   KEY_UNUSED( 0x10 )
239   KEY_UNUSED( 0x20 )
240   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
241   KEY_UNUSED( 0x80 )
186   PORT_START("user")
187   PORT_BIT(0x3f, IP_ACTIVE_LOW, IPT_UNUSED)
188   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
189   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
242190
243   PORT_START("EXTRA")   // interrupt keys
244   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M)   // causes NMI ?
245   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I)   // causes INT
191   PORT_START("extra")   // interrupt keys
192   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MONI") PORT_CODE(KEYCODE_M)   // causes NMI ?
193   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_I)   // causes INT
246194INPUT_PORTS_END
247195
248/* Z80 PIO Interface */
249196
197/***************************************************************************
198    Z80 PIO
199***************************************************************************/
200
250201static void mpf1_pio_interrupt(const device_config *device, int state)
251202{
252203   logerror("pio irq state: %02x\n",state);
253204}
254205
255static const z80pio_interface mpf1_pio_intf =
256{
257   DEVCB_LINE(mpf1_pio_interrupt),
258   DEVCB_NULL,
259   DEVCB_NULL,
260   DEVCB_NULL,
261   DEVCB_NULL,
262   DEVCB_NULL,
263   DEVCB_NULL
264};
265206
266/* Z80 CTC Interface */
207/***************************************************************************
208    8255 PPI
209***************************************************************************/
267210
268/* PPI8255 Interface */
269
270//  PA7 = tape EAR = INPUT, meant to be connected to the earphone jacket of a taperecorder
271// ~PC7 = tape MIC = OUTPUT, meant to be connected to the microphone jacket of a taperecorder
272
273211static READ8_DEVICE_HANDLER( mpf1_porta_r )
274212{
275   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5" };
213   const device_config *cassette = devtag_get_device(device->machine, "cassette");
214   UINT8 result = 0x7f;
276215
277   UINT8 retval;
278   for(keycol = 0; keycol < 6; keycol++)
279   {
280      if( kbdlatch & 0x01 ) break;
281      kbdlatch >>= 1;
282   }
283   verboselog( 0, "Key column for kbd read: %02x\n", keycol );
284   if( keycol != 6 )
285   {
286      retval = input_port_read(device->machine, keynames[keycol]);
287   }
288   else
289   {
290      retval = 0;
291   }
292   verboselog( 0, "PPI port A read: %02x\n", retval );
293   return retval;
294}
216   /* bit 0 to 5, keyboard rows 0 to 5 */
217   if (!BIT(lednum, 0)) result &= input_port_read(device->machine, "row_0");
218   if (!BIT(lednum, 1)) result &= input_port_read(device->machine, "row_1");
219   if (!BIT(lednum, 2)) result &= input_port_read(device->machine, "row_2");
220   if (!BIT(lednum, 3)) result &= input_port_read(device->machine, "row_3");
221   if (!BIT(lednum, 4)) result &= input_port_read(device->machine, "row_4");
222   if (!BIT(lednum, 5)) result &= input_port_read(device->machine, "row_5");
295223
224   /* bit 6, user key */
225   result &= input_port_read(device->machine, "user");
296226
227   /* bit 7, tape input */
228   result |= (cassette_input(cassette) > 0 ? 1 : 0) << 7;
229
230   return result;
231}
232
297233static TIMER_CALLBACK( led_refresh )
298234{
299235   if (BIT(lednum, 5)) output_set_digit_value(0, param);
r5906r5907
311247
312248   /* timer to update segments */
313249   timer_adjust_oneshot(led_refresh_timer, ATTOTIME_IN_USEC(70), led_data);
314
315   verboselog(1, "PPI port B (LED Data) write: %02x\n", data);
316250}
317251
318
319252static WRITE8_DEVICE_HANDLER( mpf1_portc_w )
320253{
321   const device_config *dac_device = devtag_get_device(device->machine, "dac");
254   const device_config *speaker = devtag_get_device(device->machine, "speaker");
255   const device_config *cassette = devtag_get_device(device->machine, "cassette");
322256
323   kbdlatch = ~data;
324
325   /* bits 0-5, led select */
257   /* bits 0-5, led select and keyboard latch */
326258   lednum = data & 0x3f;
327259   timer_adjust_oneshot(led_refresh_timer, attotime_never, 0);
328260
329   data = ~kbdlatch;
261   /* bit 6, monitor break control */
330262
331   // watchdog reset
332   watchdog_reset(device->machine);
333
334   // TONE led & speaker
335   led_tone = (~data & 0x80) >> 7;
336   set_led_status(0, led_tone);
337
338   // speaker
339   dac_data_w(dac_device, 0xFF * led_tone);
340
341   verboselog( 1, "PPI port C (LED/Kbd Col select) write: %02x\n", data );
263   /* bit 7, tape output, tone and led */
264   set_led_status(0, !BIT(data, 7));
265   speaker_level_w(speaker, BIT(data, 7));
266   cassette_output(cassette, BIT(data, 7));
342267}
343268
344269
270/***************************************************************************
271    MACHINE INITIALIZATION
272***************************************************************************/
345273
346static I8255A_INTERFACE( ppi8255_intf )
274static TIMER_CALLBACK( check_halt_callback )
347275{
348   DEVCB_HANDLER(mpf1_porta_r),   /* Port A read */
349   DEVCB_NULL,   /* Port B read */
350   DEVCB_NULL,   /* Port C read */
351   DEVCB_NULL,   /* Port A write */
352   DEVCB_HANDLER(mpf1_portb_w),   /* Port B write */
353   DEVCB_HANDLER(mpf1_portc_w),   /* Port C write */
354};
276   // halt-LED; the red one, is turned on when the processor is halted
277   // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix
278   INT64 led_halt = devtag_get_info_int(machine, "maincpu", CPUINFO_INT_REGISTER + Z80_HALT);
279   set_led_status(1, led_halt);
280}
355281
356/* Machine Initialization */
357
358282static TIMER_CALLBACK( irq0_callback )
359283{
360284   irq0_line_hold( cputag_get_cpu(machine, "maincpu") );
r5906r5907
373297   timer_pulse(machine,  ATTOTIME_IN_HZ(60), NULL, 0, irq0_callback );
374298}
375299
376/* Machine Drivers */
377300
301/***************************************************************************
302    MACHINE DRIVERS
303***************************************************************************/
304
305static const cassette_config mpf1_cassette_config =
306{
307   cassette_default_formats,
308   NULL,
309   CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED
310};
311
312static I8255A_INTERFACE( ppi8255_intf )
313{
314   DEVCB_HANDLER(mpf1_porta_r),
315   DEVCB_NULL,
316   DEVCB_NULL,
317   DEVCB_NULL,
318   DEVCB_HANDLER(mpf1_portb_w),
319   DEVCB_HANDLER(mpf1_portc_w),
320};
321
378322static const z80ctc_interface mpf1_ctc_intf =
379323{
380324   0,
r5906r5907
384328   0
385329};
386330
331static const z80pio_interface mpf1_pio_intf =
332{
333   DEVCB_LINE(mpf1_pio_interrupt),
334   DEVCB_NULL,
335   DEVCB_NULL,
336   DEVCB_NULL,
337   DEVCB_NULL,
338   DEVCB_NULL,
339   DEVCB_NULL
340};
341
387342static MACHINE_DRIVER_START( mpf1 )
388   // basic machine hardware
389   MDRV_CPU_ADD("maincpu", Z80, 3579500/2)   // 1.79 MHz
343   /* basic machine hardware */
344   MDRV_CPU_ADD("maincpu", Z80, XTAL_3_579545MHz / 2)
390345   MDRV_CPU_PROGRAM_MAP(mpf1_map)
391346   MDRV_CPU_IO_MAP(mpf1_io_map)
392347
393348   MDRV_MACHINE_START( mpf1 )
394349   MDRV_MACHINE_RESET( mpf1 )
395350
396   MDRV_Z80PIO_ADD("z80pio", mpf1_pio_intf)
397   MDRV_Z80CTC_ADD("z80ctc", 3579500/2, mpf1_ctc_intf)
398   MDRV_I8255A_ADD("ppi8255", ppi8255_intf)
351   /* video hardware */
352   MDRV_DEFAULT_LAYOUT(layout_mpf1)
399353
400   // sound hardware
354   /* sound hardware */
401355   MDRV_SPEAKER_STANDARD_MONO("mono")
402   MDRV_SOUND_ADD("dac", DAC, 0)
356   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
403357   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
404358
405   MDRV_DEFAULT_LAYOUT( layout_mpf1 )
359   /* internal devices */
360   MDRV_Z80PIO_ADD("z80pio", mpf1_pio_intf)
361   MDRV_Z80CTC_ADD("z80ctc", XTAL_3_579545MHz / 2, mpf1_ctc_intf)
362   MDRV_I8255A_ADD("ppi8255", ppi8255_intf)
363
364   MDRV_CASSETTE_ADD("cassette", mpf1_cassette_config)
406365MACHINE_DRIVER_END
407366
408367static MACHINE_DRIVER_START( mpf1p )
409   // basic machine hardware
368   /* basic machine hardware */
410369   MDRV_CPU_ADD("maincpu", Z80, 2500000)
411370   MDRV_CPU_PROGRAM_MAP(mpf1p_map)
412371   MDRV_CPU_IO_MAP(mpf1_io_map)
413372
414373   MDRV_MACHINE_RESET( mpf1 )
415374
375   /* video hardware */
376   MDRV_DEFAULT_LAYOUT(layout_mpf1)
377
378   /* internal devices */
416379   MDRV_Z80PIO_ADD("z80pio", mpf1_pio_intf)
417380   MDRV_Z80CTC_ADD("z80ctc", 3579500/2, mpf1_ctc_intf)
418381   MDRV_I8255A_ADD("ppi8255", ppi8255_intf)
419382
420   // sound hardware
383   /* sound hardware */
421384   MDRV_SPEAKER_STANDARD_MONO("mono")
422   MDRV_SOUND_ADD("dac", DAC, 0)
385   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
423386   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
424387
425   MDRV_DEFAULT_LAYOUT( layout_mpf1 )
388   MDRV_CASSETTE_ADD("cassette", mpf1_cassette_config)
426389MACHINE_DRIVER_END
427390
428/* ROMs */
429391
392/***************************************************************************
393    ROM DEFINITIONS
394***************************************************************************/
395
430396ROM_START( mpf1 )
431    ROM_REGION( 0x10000, "maincpu", 0 )
432    ROM_LOAD( "mpf.u6", 0x0000, 0x1000, CRC(b60249ce) SHA1(78e0e8874d1497fabfdd6378266d041175e3797f) )
397    ROM_REGION(0x10000, "maincpu", 0)
398    ROM_LOAD("mpf.u6", 0x0000, 0x1000, CRC(b60249ce) SHA1(78e0e8874d1497fabfdd6378266d041175e3797f))
433399ROM_END
434400
435401ROM_START( mpf1b )
436    ROM_REGION( 0x10000, "maincpu", 0 )
437    ROM_LOAD( "c55167.u6", 0x0000, 0x1000, CRC(28b06dac) SHA1(99cfbab739d71a914c39302d384d77bddc4b705b) )
438    ROM_LOAD( "basic.u7",  0x2000, 0x1000, CRC(d276ed6b) SHA1(a45fb98961be5e5396988498c6ed589a35398dcf) )
402    ROM_REGION(0x10000, "maincpu", 0)
403    ROM_LOAD("c55167.u6", 0x0000, 0x1000, CRC(28b06dac) SHA1(99cfbab739d71a914c39302d384d77bddc4b705b))
404    ROM_LOAD("basic.u7", 0x2000, 0x1000, CRC(d276ed6b) SHA1(a45fb98961be5e5396988498c6ed589a35398dcf))
439405ROM_END
440406
441407ROM_START( mpf1p )
442    ROM_REGION( 0x10000, "maincpu", 0 )
443   ROM_LOAD( "mpf1pmon.bin", 0x0000, 0x2000, CRC(91ace7d3) SHA1(22e3c16a81ac09f37741ad1b526a4456b2ba9493))
408    ROM_REGION(0x10000, "maincpu", 0)
409   ROM_LOAD("mpf1pmon.bin", 0x0000, 0x2000, CRC(91ace7d3) SHA1(22e3c16a81ac09f37741ad1b526a4456b2ba9493))
444410ROM_END
445/* System Configuration */
446411
447static SYSTEM_CONFIG_START(mpf1)
448   CONFIG_RAM_DEFAULT(4 * 1024)
449SYSTEM_CONFIG_END
450412
451/* System Drivers */
413/***************************************************************************
414    GAME DRIVERS
415***************************************************************************/
452416
453COMP( 1979, mpf1,  0,    0, mpf1, mpf1,  0, mpf1, "Multitech", "Micro Professor 1" , 0)
454COMP( 1979, mpf1b, mpf1, 0, mpf1, mpf1b, 0, mpf1, "Multitech", "Micro Professor 1B" , 0)
455COMP( 1982, mpf1p, mpf1, 0, mpf1p,mpf1b, 0, mpf1, "Multitech", "Micro Professor 1 Plus" , GAME_NOT_WORKING)
417COMP( 1979, mpf1,  0,    0, mpf1, mpf1,  0, 0, "Multitech", "Micro Professor 1", 0)
418COMP( 1979, mpf1b, mpf1, 0, mpf1, mpf1b, 0, 0, "Multitech", "Micro Professor 1B", 0)
419COMP( 1982, mpf1p, mpf1, 0, mpf1p,mpf1b, 0, 0, "Multitech", "Micro Professor 1 Plus", GAME_NOT_WORKING)
docs/messnew.txt
r5906r5907
2323
2424- [GBCOLOR] Added BIOS.  [Wilbert Pol]
2525
26- [MPF1] Cleaned app, added cassette support.  [Dirk Best]
27
2628- [NES] Fixed crash of MMC3 games with no CHR-ROM (bug
2729  #1860) [Fabio Priuli, Rob Bohms]
2830

Previous 15994 Revisions Next


© 1998-2018 The MESS Team