Previous 199869 Revisions Next

r32321 Tuesday 23rd September, 2014 at 18:01:33 UTC by Fabio Priuli
(MESS) amstrad.c: converted cpc+ and gx4000 to use generic
cart slot, added correct keyboard to cpc+ machines (with Fn keys
in place of the keypad number keys), added cpc+ system carts to
the softlist and converted driver to use io_port array for keyboard
input reads. nw.
[hash]gx4000.xml
[src/mess/drivers]amstrad.c
[src/mess/includes]amstrad.h
[src/mess/machine]amstrad.c

trunk/hash/gx4000.xml
r32320r32321
11<?xml version="1.0"?>
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
3<softwarelist name="gx4000" description="Amstrad GX4000 cartridges">
3<softwarelist name="gx4000" description="Amstrad CPC Plus &amp; GX4000 cartridges">
44   <software name="barb2">
55      <description>Barbarian II</description>
66      <year>1989</year>
r32320r32321
289289      </part>
290290   </software>
291291
292
293<!-- CPC+ System Carts -->
294   <software name="sysuk">
295      <description>Burnin' Rubber + Locomotive BASIC</description>
296      <year>1990</year>
297      <publisher>Amstrad</publisher>
298      <part name="cart" interface="gx4000_cart">
299         <dataarea name="rom" size="131072">
300            <rom name="plus_en.bin" size="131072" crc="91d35678" sha1="e73416091449a9e9b3bce19263a54d0bb62235f7" offset="00000" />
301         </dataarea>
302      </part>
303   </software>
304
305   <software name="sysukpd" cloneof="sysuk">
306      <description>Locomotive BASIC + ParaDOS</description>
307      <year>1990</year>
308      <publisher>&lt;homebrew&gt;</publisher>
309      <part name="cart" interface="gx4000_cart">
310         <dataarea name="rom" size="131072">
311            <rom name="engpados.bin" size="131072" crc="e9c5e30e" sha1="596bf4d4dedafca71fadffb6e5fa8634c3cd843f" offset="00000" />
312         </dataarea>
313      </part>
314   </software>
315
316   <!-- These need French keyboard to fully work -->
317   <software name="sysfr" supported="partial">
318      <description>Burnin' Rubber + Locomotive BASIC (Fra)</description>
319      <year>1990</year>
320      <publisher>Amstrad</publisher>
321      <part name="cart" interface="gx4000_cart">
322         <dataarea name="rom" size="131072">
323            <rom name="plus_fr.bin" size="131072" crc="26ebc1fe" sha1="8f8031e24440d2f1174d21faabb3b0134266daf2" offset="00000" />
324         </dataarea>
325      </part>
326   </software>
327
328   <!-- This was released in France  to address the Plus range incompatibilities with some software designed for the classic CPC range. -->
329   <software name="sysfrv3" cloneof="sysfr" supported="partial">
330      <description>BASIC Cartouche (Fra, with OS v3)</description>
331      <year>1990</year>
332      <publisher>Amstrad</publisher>
333      <part name="cart" interface="gx4000_cart">
334         <dataarea name="rom" size="65536">
335            <rom name="basic (f) (white label).bin" size="65536" crc="37e17647" sha1="c977841fdf09151394b49035a53ee5d049b38891" offset="00000" />
336         </dataarea>
337      </part>
338   </software>
339
340   <software name="sysfrpd" cloneof="sysfr" supported="partial">
341      <description>Locomotive BASIC + ParaDOS (Fra)</description>
342      <year>1990</year>
343      <publisher>&lt;homebrew&gt;</publisher>
344      <part name="cart" interface="gx4000_cart">
345         <dataarea name="rom" size="131072">
346            <rom name="frpados.bin" size="131072" crc="5efd7488" sha1="d618e925f326c03be4b1b018f2cc218384eb88c7" offset="00000" />
347         </dataarea>
348      </part>
349   </software>
350
351   <!-- These need Spanish keyboard to fully work -->
352   <software name="syses" supported="partial">
353      <description>Burnin' Rubber + Locomotive BASIC (Spa)</description>
354      <year>1990</year>
355      <publisher>Amstrad</publisher>
356      <part name="cart" interface="gx4000_cart">
357         <dataarea name="rom" size="131072">
358            <rom name="plus_es.bin" size="131072" crc="5d336a70" sha1="d9f93ed0f4790a078317f7bde8ec6bf838c965e1" offset="00000" />
359         </dataarea>
360      </part>
361   </software>
362
363   <software name="sysespd" cloneof="syses" supported="partial">
364      <description>Locomotive BASIC + ParaDOS (Spa)</description>
365      <year>1990</year>
366      <publisher>&lt;homebrew&gt;</publisher>
367      <part name="cart" interface="gx4000_cart">
368         <dataarea name="rom" size="131072">
369            <rom name="spapados.bin" size="131072" crc="57ecd6ed" sha1="2a68079bf90dbacf9e921b54874ad3e5408a75bd" offset="00000" />
370         </dataarea>
371      </part>
372   </software>
373
292374</softwarelist>
trunk/src/mess/drivers/amstrad.c
r32320r32321
102102
103103/* Devices */
104104#include "imagedev/snapquik.h"
105#include "imagedev/cartslot.h"
106105#include "imagedev/cassette.h"
107106#include "formats/tzx_cas.h"
108107#include "formats/dsk_dsk.h"
r32320r32321
148147 *************************************/
149148
150149static INPUT_PORTS_START( amstrad_keyboard )
151   /* keyboard row 0 */
152   PORT_START("keyboard_row_0")
150   PORT_START("kbrow.0")
153151   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_UP)          PORT_CODE(KEYCODE_UP)         PORT_CHAR(UCHAR_MAMEKEY(UP))
154152   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_RIGHT)          PORT_CODE(KEYCODE_RIGHT)      PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
155153   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_DOWN)          PORT_CODE(KEYCODE_DOWN)       PORT_CHAR(UCHAR_MAMEKEY(DOWN))
r32320r32321
159157   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad Enter")          PORT_CODE(KEYCODE_ENTER_PAD)  PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
160158   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .")              PORT_CODE(KEYCODE_DEL_PAD)    PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
161159
162   /* keyboard line 1 */
163   PORT_START("keyboard_row_1")
160   PORT_START("kbrow.1")
164161   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(UTF8_LEFT)          PORT_CODE(KEYCODE_LEFT)       PORT_CHAR(UCHAR_MAMEKEY(LEFT))
165162   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy")                  PORT_CODE(KEYCODE_END)        PORT_CHAR(UCHAR_MAMEKEY(END))
166163   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7")              PORT_CODE(KEYCODE_7_PAD)      PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
r32320r32321
170167   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2")              PORT_CODE(KEYCODE_2_PAD)      PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
171168   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0")              PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
172169
173   /* keyboard row 2 */
174   PORT_START("keyboard_row_2")
170   PORT_START("kbrow.2")
175171   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr")                   PORT_CODE(KEYCODE_BACKSPACE)  PORT_CHAR(UCHAR_MAMEKEY(HOME))
176172   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[")                     PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
177173   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter")                 PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
r32320r32321
181177   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\")                    PORT_CODE(KEYCODE_RCONTROL)   PORT_CHAR('\\') PORT_CHAR('`')
182178   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl")                  PORT_CODE(KEYCODE_RALT)       PORT_CHAR(UCHAR_SHIFT_2)
183179
184   /* keyboard row 3 */
185   PORT_START("keyboard_row_3")
180   PORT_START("kbrow.3")
186181   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3") PORT_CODE(KEYCODE_EQUALS)     PORT_CHAR('^') PORT_CHAR(0xa3)
187182   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_MINUS)      PORT_CHAR('-') PORT_CHAR('=')
188183   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ \xC2\xA6")            PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR('@') PORT_CHAR('|')
r32320r32321
192187   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('/') PORT_CHAR('?')
193188   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR('>')
194189
195   /* keyboard line 4 */
196   PORT_START("keyboard_row_4")
190   PORT_START("kbrow.4")
197191   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR('_')
198192   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR(')')
199193   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')
r32320r32321
203197   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_M)          PORT_CHAR('m') PORT_CHAR('M')
204198   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_COMMA)      PORT_CHAR(',') PORT_CHAR('<')
205199
206   /* keyboard line 5 */
207   PORT_START("keyboard_row_5")
200   PORT_START("kbrow.5")
208201   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('(')
209202   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_7)          PORT_CHAR('7') PORT_CHAR('\'')
210203   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')
r32320r32321
214207   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_N)          PORT_CHAR('n') PORT_CHAR('N')
215208   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space")                 PORT_CODE(KEYCODE_SPACE)      PORT_CHAR(32)
216209
217   /* keyboard line 6 */
218   PORT_START("keyboard_row_6")
210   PORT_START("kbrow.6")
219211   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('&')
220212   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
221213   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')
r32320r32321
225217   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_B)          PORT_CHAR('b') PORT_CHAR('B')
226218   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_V)          PORT_CHAR('v') PORT_CHAR('V')
227219
228   /* keyboard line 7 */
229   PORT_START("keyboard_row_7")
220   PORT_START("kbrow.7")
230221   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
231222   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
232223   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')
r32320r32321
236227   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_C)          PORT_CHAR('c') PORT_CHAR('C')
237228   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_X)          PORT_CHAR('x') PORT_CHAR('X')
238229
239   /* keyboard line 8 */
240   PORT_START("keyboard_row_8")
230   PORT_START("kbrow.8")
241231   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_1)          PORT_CHAR('1') PORT_CHAR('!')
242232   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_2)          PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('~')
243233   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc")                   PORT_CODE(KEYCODE_TILDE)      PORT_CHAR(27)
r32320r32321
247237   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock")             PORT_CODE(KEYCODE_CAPSLOCK)   PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE
248238   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')
249239
250   /* keyboard line 9 */
251   PORT_START("keyboard_row_9")
240   PORT_START("kbrow.9")
252241   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)    PORT_PLAYER(1) PORT_8WAY
253242   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN)  PORT_PLAYER(1) PORT_8WAY
254243   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT)  PORT_PLAYER(1) PORT_8WAY
r32320r32321
375364static INPUT_PORTS_START( cpc664 )
376365   PORT_INCLUDE(amstrad_keyboard)
377366
378   PORT_MODIFY("keyboard_row_0")
367   PORT_MODIFY("kbrow.0")
379368   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f9")             PORT_CODE(KEYCODE_9_PAD)      PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
380369   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f6")             PORT_CODE(KEYCODE_6_PAD)      PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
381370   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f3")             PORT_CODE(KEYCODE_3_PAD)      PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
382371
383   PORT_MODIFY("keyboard_row_1")
372   PORT_MODIFY("kbrow.1")
384373   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f7")             PORT_CODE(KEYCODE_7_PAD)      PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
385374   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f8")             PORT_CODE(KEYCODE_8_PAD)      PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
386375   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f5")             PORT_CODE(KEYCODE_5_PAD)      PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
r32320r32321
388377   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f2")             PORT_CODE(KEYCODE_2_PAD)      PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
389378   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f0")             PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
390379
391   PORT_MODIFY("keyboard_row_2")
380   PORT_MODIFY("kbrow.2")
392381   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
393382   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_BACKSLASH)  PORT_CHAR(']') PORT_CHAR('}')
394383   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad f4")             PORT_CODE(KEYCODE_4_PAD)      PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
r32320r32321
401390static INPUT_PORTS_START( cpc6128 )
402391   PORT_INCLUDE(amstrad_keyboard)
403392
404   PORT_MODIFY("keyboard_row_0")
393   PORT_MODIFY("kbrow.0")
405394   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f9")                    PORT_CODE(KEYCODE_9_PAD)      PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
406395   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f6")                    PORT_CODE(KEYCODE_6_PAD)      PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
407396   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3")                    PORT_CODE(KEYCODE_3_PAD)      PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
408397   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter")                 PORT_CODE(KEYCODE_RALT)       PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
409398   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".")                     PORT_CODE(KEYCODE_DEL_PAD)    PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
410399
411   PORT_MODIFY("keyboard_row_1")
400   PORT_MODIFY("kbrow.1")
412401   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy")                  PORT_CODE(KEYCODE_LALT)       PORT_CHAR(UCHAR_MAMEKEY(END))
413402   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f7")                    PORT_CODE(KEYCODE_7_PAD)      PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
414403   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f8")                    PORT_CODE(KEYCODE_8_PAD)      PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
r32320r32321
417406   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2")                    PORT_CODE(KEYCODE_2_PAD)      PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
418407   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0")                    PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
419408
420   PORT_MODIFY("keyboard_row_2")
409   PORT_MODIFY("kbrow.2")
421410   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
422411   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return")                PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
423412   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_BACKSLASH)  PORT_CHAR(']') PORT_CHAR('}')
r32320r32321
434423static INPUT_PORTS_START( cpc6128f )
435424   PORT_INCLUDE(amstrad_keyboard)
436425
437   PORT_MODIFY("keyboard_row_0")
426   PORT_MODIFY("kbrow.0")
438427   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f9")                    PORT_CODE(KEYCODE_9_PAD)      PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
439428   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f6")                    PORT_CODE(KEYCODE_6_PAD)      PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
440429   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3")                    PORT_CODE(KEYCODE_3_PAD)      PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
441430   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter")                 PORT_CODE(KEYCODE_RALT)       PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
442431   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".")                     PORT_CODE(KEYCODE_DEL_PAD)    PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
443432
444   PORT_MODIFY("keyboard_row_1")
433   PORT_MODIFY("kbrow.1")
445434   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy")                  PORT_CODE(KEYCODE_LALT)       PORT_CHAR(UCHAR_MAMEKEY(END))
446435   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f7")                    PORT_CODE(KEYCODE_7_PAD)      PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
447436   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f8")                    PORT_CODE(KEYCODE_8_PAD)      PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
r32320r32321
450439   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2")                    PORT_CODE(KEYCODE_2_PAD)      PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
451440   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0")                    PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
452441
453   PORT_MODIFY("keyboard_row_2")
442   PORT_MODIFY("kbrow.2")
454443   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('<')
455444   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return")                PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
456445   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_BACKSLASH)  PORT_CHAR('#') PORT_CHAR('>')
r32320r32321
458447   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_RCONTROL)   PORT_CHAR('$') PORT_CHAR('@') PORT_CHAR('\\')
459448   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control")               PORT_CODE(KEYCODE_LCONTROL)   PORT_CHAR(UCHAR_SHIFT_2)
460449
461   PORT_MODIFY("keyboard_row_3")
450   PORT_MODIFY("kbrow.3")
462451   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_EQUALS)     PORT_CHAR('-') PORT_CHAR('_')
463452   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_MINUS)      PORT_CHAR(')') PORT_CHAR('[')
464453   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^   \xC2\xA6")          PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR('^') PORT_CHAR('|')
r32320r32321
467456   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('=') PORT_CHAR('+')
468457   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_STOP)       PORT_CHAR(':') PORT_CHAR('/')
469458
470   PORT_MODIFY("keyboard_row_4")
459   PORT_MODIFY("kbrow.4")
471460   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA0   0")          PORT_CODE(KEYCODE_0)          PORT_CHAR(0xE0) PORT_CHAR('0')
472461   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA7   9")          PORT_CODE(KEYCODE_9)          PORT_CHAR(0xE7) PORT_CHAR('9')
473462   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_M)          PORT_CHAR(',') PORT_CHAR('?')
474463   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_COMMA)      PORT_CHAR(';') PORT_CHAR('.')
475464
476   PORT_MODIFY("keyboard_row_5")
465   PORT_MODIFY("kbrow.5")
477466   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_8)          PORT_CHAR('!') PORT_CHAR('8')
478467   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA9   7")          PORT_CODE(KEYCODE_7)          PORT_CHAR(0xE8) PORT_CHAR('7')
479468
480   PORT_MODIFY("keyboard_row_6")
469   PORT_MODIFY("kbrow.6")
481470   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_6)          PORT_CHAR(']') PORT_CHAR('6')
482471   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_5)          PORT_CHAR('(') PORT_CHAR('5')
483472
484   PORT_MODIFY("keyboard_row_7")
473   PORT_MODIFY("kbrow.7")
485474   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_4)          PORT_CHAR('\'') PORT_CHAR('4')
486475   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_3)          PORT_CHAR('\"') PORT_CHAR('3')
487476   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_W)          PORT_CHAR('z') PORT_CHAR('Z')
488477
489   PORT_MODIFY("keyboard_row_8")
478   PORT_MODIFY("kbrow.8")
490479   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_1)          PORT_CHAR('&') PORT_CHAR('1')
491480   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\xA9   2   ~")      PORT_CODE(KEYCODE_2)          PORT_CHAR(0xE9) PORT_CHAR('2') PORT_CHAR('~')
492481   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_Q)          PORT_CHAR('a') PORT_CHAR('A')
r32320r32321
500489static INPUT_PORTS_START( cpc6128s )
501490   PORT_INCLUDE(cpc6128)
502491
503   PORT_MODIFY("keyboard_row_2")
492   PORT_MODIFY("kbrow.2")
504493   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x9C")              PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0x00DC)
505494   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x89")              PORT_CODE(KEYCODE_BACKSLASH)  PORT_CHAR(0x00E9)
506495   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_RCONTROL)   PORT_CHAR('/') PORT_CHAR('?')
507496
508   PORT_MODIFY("keyboard_row_3")
497   PORT_MODIFY("kbrow.3")
509498   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_EQUALS)     PORT_CHAR('+') PORT_CHAR('*')
510499   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_MINUS)      PORT_CHAR('-') PORT_CHAR('=')
511500   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x85")              PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR(0x00C5)
r32320r32321
514503   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('<') PORT_CHAR('>')
515504   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR(':')
516505
517   PORT_MODIFY("keyboard_row_4")
506   PORT_MODIFY("kbrow.4")
518507   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_COMMA)      PORT_CHAR(',') PORT_CHAR(';')
519508INPUT_PORTS_END
520509
r32320r32321
527516static INPUT_PORTS_START( kccomp )
528517   PORT_INCLUDE(amstrad_keyboard)
529518
530   PORT_MODIFY("keyboard_row_0")
519   PORT_MODIFY("kbrow.0")
531520   PORT_BIT(0x08, 0x08, IPT_UNUSED)
532521   PORT_BIT(0x10, 0x10, IPT_UNUSED)
533522   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f3")                    PORT_CODE(KEYCODE_3_PAD)      PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
534523   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter")                 PORT_CODE(KEYCODE_LCONTROL)   PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
535524   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".")                     PORT_CODE(KEYCODE_DEL_PAD)    PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
536525
537   PORT_MODIFY("keyboard_row_1")
526   PORT_MODIFY("kbrow.1")
538527   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy")                  PORT_CODE(KEYCODE_RALT)       PORT_CHAR(UCHAR_MAMEKEY(END))
539528   PORT_BIT(0x04, 0x04, IPT_UNUSED)
540529   PORT_BIT(0x08, 0x08, IPT_UNUSED)
r32320r32321
543532   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f2")                    PORT_CODE(KEYCODE_2_PAD)      PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
544533   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f0")                    PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
545534
546   PORT_MODIFY("keyboard_row_2")
535   PORT_MODIFY("kbrow.2")
547536   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
548537   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return")                PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
549538   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_BACKSLASH)  PORT_CHAR(']') PORT_CHAR('}')
r32320r32321
557546
558547
559548static INPUT_PORTS_START( plus )
560   PORT_INCLUDE(amstrad_keyboard)
561   PORT_INCLUDE(crtc_links)
562   PORT_INCLUDE(amx_mouse)
549   PORT_INCLUDE(cpc664)
563550
564551   /* The CPC+ and GX4000 adds support for analogue controllers.
565552      Up to two joysticks or four paddles can be used, although the ASIC supports twice that.
r32320r32321
574561
575562   The connectors' description for both CPCs and CPC+'s can be found at http://www.hardwarebook.info/Category:Computer */
576563
577   PORT_START("analog1")
564   PORT_START("analog.0")
578565   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
579566   PORT_SENSITIVITY(100)
580567   PORT_KEYDELTA(10)
581568   PORT_PLAYER(1)
582569
583   PORT_START("analog2")
570   PORT_START("analog.1")
584571   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
585572   PORT_SENSITIVITY(100)
586573   PORT_KEYDELTA(10)
587574   PORT_PLAYER(1)
588575
589   PORT_START("analog3")
576   PORT_START("analog.2")
590577   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
591578   PORT_SENSITIVITY(100)
592579   PORT_KEYDELTA(10)
593580   PORT_PLAYER(2)
594581
595   PORT_START("analog4")
582   PORT_START("analog.3")
596583   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
597584   PORT_SENSITIVITY(100)
598585   PORT_KEYDELTA(10)
599586   PORT_PLAYER(2)
600587
601588// Not used, but are here for completeness
602   PORT_START("analog5")
589   PORT_START("analog.4")
603590   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
604591   PORT_SENSITIVITY(100)
605592   PORT_KEYDELTA(10)
606593   PORT_PLAYER(3)
607594
608   PORT_START("analog6")
595   PORT_START("analog.5")
609596   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
610597   PORT_SENSITIVITY(100)
611598   PORT_KEYDELTA(10)
612599   PORT_PLAYER(3)
613600
614   PORT_START("analog7")
601   PORT_START("analog.6")
615602   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
616603   PORT_SENSITIVITY(100)
617604   PORT_KEYDELTA(10)
618605   PORT_PLAYER(4)
619606
620   PORT_START("analog8")
607   PORT_START("analog.7")
621608   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
622609   PORT_SENSITIVITY(100)
623610   PORT_KEYDELTA(10)
r32320r32321
628615static INPUT_PORTS_START( gx4000 )
629616
630617   // The GX4000 is a console, so no keyboard access other than the joysticks.
631   PORT_START("keyboard_row_0")
618   PORT_START("kbrow.0")
632619   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
633620
634   PORT_START("keyboard_row_1")
621   PORT_START("kbrow.1")
635622   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
636623
637   PORT_START("keyboard_row_2")
624   PORT_START("kbrow.2")
638625   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
639626
640   PORT_START("keyboard_row_3")
627   PORT_START("kbrow.3")
641628   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
642629
643   PORT_START("keyboard_row_4")
630   PORT_START("kbrow.4")
644631   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
645632
646   PORT_START("keyboard_row_5")
633   PORT_START("kbrow.5")
647634   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
648635
649   PORT_START("keyboard_row_6")  // Joystick 2
636   PORT_START("kbrow.6")  // Joystick 2
650637   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)    PORT_PLAYER(2) PORT_8WAY
651638   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN)  PORT_PLAYER(2) PORT_8WAY
652639   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT)  PORT_PLAYER(2) PORT_8WAY
r32320r32321
655642   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2)        PORT_PLAYER(2)
656643   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
657644
658   PORT_START("keyboard_row_7")
645   PORT_START("kbrow.7")
659646   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
660647
661   PORT_START("keyboard_row_8")
648   PORT_START("kbrow.8")
662649   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
663650
664   PORT_START("keyboard_row_9")  // Joystick 1
651   PORT_START("kbrow.9")  // Joystick 1
665652   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)    PORT_PLAYER(1) PORT_8WAY
666653   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN)  PORT_PLAYER(1) PORT_8WAY
667654   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT)  PORT_PLAYER(1) PORT_8WAY
r32320r32321
672659
673660   PORT_INCLUDE(crtc_links)  // included to keep the driver happy
674661
675   PORT_START("analog1")
662   PORT_START("analog.0")
676663   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
677664   PORT_SENSITIVITY(100)
678665   PORT_KEYDELTA(10)
679666   PORT_PLAYER(1)
680667
681   PORT_START("analog2")
668   PORT_START("analog.1")
682669   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
683670   PORT_SENSITIVITY(100)
684671   PORT_KEYDELTA(10)
685672   PORT_PLAYER(1)
686673
687   PORT_START("analog3")
674   PORT_START("analog.2")
688675   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
689676   PORT_SENSITIVITY(100)
690677   PORT_KEYDELTA(10)
691678   PORT_PLAYER(2)
692679
693   PORT_START("analog4")
680   PORT_START("analog.3")
694681   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
695682   PORT_SENSITIVITY(100)
696683   PORT_KEYDELTA(10)
697684   PORT_PLAYER(2)
698685
699686// Not used, but are here for completeness
700   PORT_START("analog5")
687   PORT_START("analog.4")
701688   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
702689   PORT_SENSITIVITY(100)
703690   PORT_KEYDELTA(10)
704691   PORT_PLAYER(3)
705692
706   PORT_START("analog6")
693   PORT_START("analog.5")
707694   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
708695   PORT_SENSITIVITY(100)
709696   PORT_KEYDELTA(10)
710697   PORT_PLAYER(3)
711698
712   PORT_START("analog7")
699   PORT_START("analog.6")
713700   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
714701   PORT_SENSITIVITY(100)
715702   PORT_KEYDELTA(10)
716703   PORT_PLAYER(4)
717704
718   PORT_START("analog8")
705   PORT_START("analog.7")
719706   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
720707   PORT_SENSITIVITY(100)
721708   PORT_KEYDELTA(10)
r32320r32321
726713static INPUT_PORTS_START( aleste )
727714   PORT_INCLUDE(amstrad_keyboard)
728715
729   PORT_MODIFY( "keyboard_row_9" )
716   PORT_MODIFY( "kbrow.9" )
730717   /* Documentation marks this input as "R/L", it's purpose is unknown - I can't even find it on the keyboard */
731718   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R  L")       PORT_CODE(KEYCODE_PGUP)
732719
733   PORT_START( "keyboard_row_10" )
720   PORT_START( "kbrow.10" )
734721   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)  PORT_NAME("F1  F6")    PORT_CODE(KEYCODE_F1)
735722   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)  PORT_NAME("F2  F7")    PORT_CODE(KEYCODE_F2)
736723   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)  PORT_NAME("F3  F8")    PORT_CODE(KEYCODE_F3)
r32320r32321
799786SLOT_INTERFACE_END
800787
801788static MACHINE_CONFIG_FRAGMENT( cpcplus_cartslot )
802   MCFG_CARTSLOT_ADD("cart")
803   MCFG_CARTSLOT_EXTENSION_LIST("cpr,bin")
804   MCFG_CARTSLOT_MANDATORY
805   MCFG_CARTSLOT_INTERFACE("gx4000_cart")
806   MCFG_CARTSLOT_LOAD(amstrad_state,amstrad_plus_cartridge)
807   MCFG_SOFTWARE_LIST_ADD("cart_list","gx4000")
789   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gx4000_cart")
790   MCFG_GENERIC_EXTENSIONS("bin,cpr")
791   MCFG_GENERIC_MANDATORY
792   MCFG_GENERIC_LOAD(amstrad_state, amstrad_plus_cartridge)
793
794   MCFG_SOFTWARE_LIST_ADD("cart_list", "gx4000")
808795MACHINE_CONFIG_END
809796
810797SLOT_INTERFACE_START(cpc_exp_cards)
trunk/src/mess/machine/amstrad.c
r32320r32321
11731173         if ( m_asic.enabled )
11741174         {
11751175//              logerror("L-ROM: Lower ROM enabled, cart bank %i\n", m_asic.rmr2 & 0x07 );
1176            bank_base = &m_region_maincpu->base()[0x4000 * ( m_asic.rmr2 & 0x07 )];
1176            bank_base = &m_region_cart->base()[0x4000 * (m_asic.rmr2 & 0x07)];
11771177            switch( m_asic.rmr2 & 0x18 )
11781178            {
11791179            case 0x00:
r32320r32321
12001200         }
12011201         else
12021202         {
1203            m_bank1->set_base( m_region_maincpu->base() );
1204            m_bank2->set_base( m_region_maincpu->base() + 0x2000 );
1203            m_bank1->set_base(m_region_cart->base());
1204            m_bank2->set_base(m_region_cart->base() + 0x2000);
12051205         }
12061206      }
12071207   }
r32320r32321
14951495   if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 )
14961496   {
14971497      // Analogue ports
1498      if(offset == 0x0808)
1498      if(offset >= 0x0808 && offset < 0x080c)
14991499      {
1500         return (m_io_analog1->read() & 0x3f);
1500         return (m_io_analog[offset & 3]->read() & 0x3f);
15011501      }
1502      if(offset == 0x0809)
1503      {
1504         return (m_io_analog2->read() & 0x3f);
1505      }
1506      if(offset == 0x080a)
1507      {
1508         return (m_io_analog3->read() & 0x3f);
1509      }
1510      if(offset == 0x080b)
1511      {
1512         return (m_io_analog4->read() & 0x3f);
1513      }
15141502      if(offset == 0x080c || offset == 0x080e)
15151503      {
15161504         return 0x3f;
r32320r32321
26342622   If keyboard matrix line 11-15 are selected, the byte is always &ff.
26352623   After testing on a real CPC, it is found that these never change, they always return &FF. */
26362624
2637   ioport_port *keyrow[] = {
2638      m_io_keyboard_row_0, m_io_keyboard_row_1, m_io_keyboard_row_2, m_io_keyboard_row_3, m_io_keyboard_row_4,
2639      m_io_keyboard_row_5, m_io_keyboard_row_6, m_io_keyboard_row_7, m_io_keyboard_row_8, m_io_keyboard_row_9,
2640      m_io_keyboard_row_10
2641   };
2642
26432625   if ( ( m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) > 10)
26442626   {
26452627      return 0xFF;
r32320r32321
26492631      if(m_aleste_mode == 0x08 && ( m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) == 10)
26502632         return 0xff;
26512633
2652      if (keyrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F])
2634      if (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F])
26532635      {
26542636         if(m_system_type != SYSTEM_GX4000)
26552637         {
r32320r32321
26592641            }
26602642            if((m_io_ctrltype->read_safe(0) == 2) && (m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F) == 9)
26612643            {
2662               return (keyrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0x80) | 0x7f;
2644               return (m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0x80) | 0x7f;
26632645            }
26642646         }
26652647
2666         return keyrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0xFF;
2648         return m_io_kbrow[m_ppi_port_outputs[amstrad_ppi_PortC] & 0x0F]->read_safe(0) & 0xFF;
26672649      }
26682650      return 0xFF;
26692651   }
r32320r32321
27192701            prev_x = data_x;
27202702            prev_y = data_y;
27212703
2722            m_amx_mouse_data |= (m_io_keyboard_row_9->read_safe(0) & 0x80);  // DEL key
2704            m_amx_mouse_data |= (m_io_kbrow[9]->read_safe(0) & 0x80);  // DEL key
27232705         }
27242706      }
27252707   return 0xFF;
r32320r32321
28622844
28632845   if(m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000)
28642846   {
2847      UINT8 *crt = m_region_cart->base();
2848      int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1;
2849
28652850      /* ROMs are stored on the inserted cartridge in the Plus/GX4000 */
28662851      for(i=0; i<128; i++)  // fill ROM table
2867         m_Amstrad_ROM_Table[i] = &rom[0x4000];
2852         m_Amstrad_ROM_Table[i] = &crt[0x4000];
28682853      for(i=128;i<160;i++)
2869         m_Amstrad_ROM_Table[i] = &rom[(i-128)*0x4000];
2870      m_Amstrad_ROM_Table[7] = &rom[0xc000];
2854         m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000];
2855      m_Amstrad_ROM_Table[7] = &crt[0xc000];
28712856      slot7 = true;
28722857   }
28732858   else
r32320r32321
30463031   m_asic.ram = m_region_user1->base();  // 16kB RAM for ASIC, memory-mapped registers.
30473032   m_system_type = SYSTEM_PLUS;
30483033   m_centronics->write_data7(0);
3034   
3035   astring region_tag;
3036   m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
30493037}
30503038
30513039
r32320r32321
30853073{
30863074   m_asic.ram = m_region_user1->base();  // 16kB RAM for ASIC, memory-mapped registers.
30873075   m_system_type = SYSTEM_GX4000;
3076   
3077   astring region_tag;
3078   m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
30883079}
30893080
30903081MACHINE_RESET_MEMBER(amstrad_state,gx4000)
r32320r32321
31883179
31893180DEVICE_IMAGE_LOAD_MEMBER(amstrad_state, amstrad_plus_cartridge)
31903181{
3191   // load CPC Plus / GX4000 cartridge image
3192   // Format is RIFF: RIFF header chunk contains "AMS!"
3193   // Chunks should be 16k, but may vary
3194   // Chunks labeled 'cb00' represent Cartridge block 0, and is loaded to &0000-&3fff
3195   //                'cb01' represent Cartridge block 1, and is loaded to &4000-&7fff
3196   //                ... and so on.
3182   UINT32 size = m_cart->common_get_size("rom");
3183   unsigned char header[12];
3184   bool is_cpr = FALSE;
3185   logerror("IMG: loading CPC+ cartridge file\n");
31973186
3198   UINT32 size, offset = 0;
3199   dynamic_buffer temp_copy;
3200   unsigned char header[12];     // RIFF chunk
3201   char chunkid[4];              // chunk ID (4 character code - cb00, cb01, cb02... upto cb31 (max 512kB), other chunks are ignored)
3202   char chunklen[4];             // chunk length (always little-endian)
3203   int chunksize;                // chunk length, calcaulated from the above
3204   int ramblock;                 // 16k RAM block chunk is to be loaded in to
3205   unsigned int bytes_to_read;   // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it.
3206   unsigned char* mem = m_region_maincpu->base();
3207
3187   // check for .CPR header
32083188   if (image.software_entry() == NULL)
32093189   {
3210      size = image.length();
3211      temp_copy.resize(size);
3212      if (image.fread(temp_copy, size) != size)
3190      image.fread(header, 12);   
3191      if (strncmp((char *)header, "RIFF", 4) != 0)
32133192      {
3214         logerror("IMG: failed to read from cart image\n");
3215         return IMAGE_INIT_FAIL;
3193         // not a CPR file, so rewind the image at start
3194         image.fseek(0, SEEK_SET);
32163195      }
3196      else
3197      {
3198         is_cpr = TRUE;
3199         size -= 12;
3200      }
32173201   }
3218   else
3219   {
3220      size= image.get_software_region_length("rom");
3221      temp_copy.resize(size);
3222      memcpy(temp_copy, image.get_software_region("rom"), size);
3223   }
32243202
3225   logerror("IMG: loading CPC+ cartridge file\n");
3226   // load RIFF chunk
3227   memcpy(header, temp_copy, 12);
3228   offset += 12;
3203   // alloc ROM
3204   m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
32293205
3230   if (strncmp((char *)header, "RIFF", 4) != 0)
3206   // actually load the cart into ROM
3207   if (image.software_entry() != NULL)
32313208   {
3232      logerror("IMG: raw CPC+ cartridge file\n");
3233      offset -= 12;   // no header, so we go back to the start of the file
3234
3209      logerror("IMG: raw CPC+ cartridge from softlist\n");
3210      memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size);
3211   }
3212   else if (!is_cpr)
3213   {
32353214      // not an RIFF format file, assume raw binary (*.bin)
3236      while (offset < size)
3215      logerror("IMG: raw CPC+ cartridge file\n");
3216      if (size % 0x4000)
32373217      {
3238         memcpy(mem + offset, temp_copy + offset, 0x4000);
3239
3240         if ((size - offset) < 0x4000)
3241         {
3242            logerror("BIN: block %i loaded is smaller than 16kB in size\n", offset / 0x4000);
3243            return IMAGE_INIT_FAIL;
3244         }
3245         offset += 0x4000;
3218         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Attempt to load a raw binary with some block smaller than 16kB in size");
3219         return IMAGE_INIT_FAIL;
32463220      }
3221      else
3222         image.fread(m_cart->get_rom_base(), size);   
32473223   }
3248   else if (image.software_entry() == NULL)    // we have no CPR carts in our gx4000 softlist
3224   else
32493225   {
3226      // load CPC Plus / GX4000 cartridge image
3227      // Format is RIFF: RIFF header chunk contains "AMS!"
3228      // Chunks should be 16k, but may vary
3229      // Chunks labeled 'cb00' represent Cartridge block 0, and is loaded to &0000-&3fff
3230      //                'cb01' represent Cartridge block 1, and is loaded to &4000-&7fff
3231      //                ... and so on.
3232     
3233      UINT32 offset = 0;
3234      UINT8 *crt = m_cart->get_rom_base();
3235      dynamic_buffer temp_copy;
3236      temp_copy.resize(size);
3237      image.fread(temp_copy, size);
3238
3239      // RIFF chunk bits
3240      char chunkid[4];              // chunk ID (4 character code - cb00, cb01, cb02... upto cb31 (max 512kB), other chunks are ignored)
3241      char chunklen[4];             // chunk length (always little-endian)
3242      int chunksize;                // chunk length, calcaulated from the above
3243      int ramblock;                 // 16k RAM block chunk is to be loaded into
3244      unsigned int bytes_to_read;   // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it.     
3245
32503246      // Is RIFF format (*.cpr)
32513247      if (strncmp((char*)(header + 8), "AMS!", 4) != 0)
32523248      {
3253         logerror("CPR: not an Amstrad CPC cartridge image\n");
3249         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Not an Amstrad CPC cartridge image (despite RIFF header)");
32543250         return IMAGE_INIT_FAIL;
32553251      }
32563252
r32320r32321
32793275            ramblock += chunkid[3] - 0x30;
32803276            logerror("CPR: Loading chunk into RAM block %i ['%4s']\n", ramblock, chunkid);
32813277
3282            if(ramblock >= 0 && ramblock < 32)
3278            // load block into ROM area (max 512K)
3279            if (ramblock >= 0 && ramblock < 32)
32833280            {
3284               // clear RAM block
3285               memset(mem + 0x4000 * ramblock, 0, 0x4000);
3281               if (chunksize > 0x4000)
3282                  chunksize = 0x4000;
32863283
3287               // load block into ROM area
3288               if (chunksize > 16384)
3289                  chunksize = 16384;
3290
3291               memcpy(mem + 0x4000 * ramblock, temp_copy + offset, chunksize);
3284               memcpy(crt + 0x4000 * ramblock, temp_copy + offset, chunksize);
32923285               bytes_to_read -= chunksize;
32933286               offset += chunksize;
32943287               logerror("CPR: Loaded %i-byte chunk into RAM block %i\n", chunksize, ramblock);
r32320r32321
33053298         }
33063299      }
33073300   }
3308   else    // CPR carts in our softlist
3309   {
3310      logerror("Gamelist cart in RIFF format\n");
3311      return IMAGE_INIT_FAIL;
3312   }
33133301
33143302   return IMAGE_INIT_PASS;
33153303}
trunk/src/mess/includes/amstrad.h
r32320r32321
3030#include "bus/centronics/epson_lx800.h"
3131#include "bus/centronics/printer.h"
3232#include "bus/centronics/digiblst.h"
33#include "bus/generic/slot.h"
34#include "bus/generic/carts.h"
3335
3436
3537/****************************
r32320r32321
119121      m_ppi(*this, "ppi8255"),
120122      m_centronics(*this, "centronics"),
121123      m_cassette(*this, "cassette"),
124      m_cart(*this, "cartslot"),
122125      m_ram(*this, RAM_TAG),
123126      m_exp(*this, "exp"),
124127      m_rtc(*this, "rtc"),
r32320r32321
140143      m_bank14(*this, "bank14"),
141144      m_bank15(*this, "bank15"),
142145      m_bank16(*this, "bank16"),
143      m_io_keyboard_row_0(*this, "keyboard_row_0"),
144      m_io_keyboard_row_1(*this, "keyboard_row_1"),
145      m_io_keyboard_row_2(*this, "keyboard_row_2"),
146      m_io_keyboard_row_3(*this, "keyboard_row_3"),
147      m_io_keyboard_row_4(*this, "keyboard_row_4"),
148      m_io_keyboard_row_5(*this, "keyboard_row_5"),
149      m_io_keyboard_row_6(*this, "keyboard_row_6"),
150      m_io_keyboard_row_7(*this, "keyboard_row_7"),
151      m_io_keyboard_row_8(*this, "keyboard_row_8"),
152      m_io_keyboard_row_9(*this, "keyboard_row_9"),
153      m_io_keyboard_row_10(*this, "keyboard_row_10"),
154      m_io_solder_links(*this, "solder_links"),
155      m_io_green_display(*this, "green_display"),
156      m_io_ctrltype(*this,"controller_type"),
146      m_io_kbrow(*this, "kbrow"),
147      m_io_analog(*this, "analog"),
157148      m_io_mouse1(*this,"mouse_input1"),
158149      m_io_mouse2(*this,"mouse_input2"),
159150      m_io_mouse3(*this,"mouse_input3"),
160      m_io_analog1(*this, "analog1"),
161      m_io_analog2(*this, "analog2"),
162      m_io_analog3(*this, "analog3"),
163      m_io_analog4(*this, "analog4"),
151      m_io_solder_links(*this, "solder_links"),
152      m_io_green_display(*this, "green_display"),
153      m_io_ctrltype(*this,"controller_type"),
164154      m_screen(*this, "screen"),
165155      m_palette(*this, "palette") { }
166156
r32320r32321
171161   required_device<i8255_device> m_ppi;
172162   optional_device<centronics_device> m_centronics;  // not on a GX4000
173163   optional_device<cassette_image_device> m_cassette; // not on a GX4000, (or technically, the 6128+)
164   optional_device<generic_slot_device> m_cart;  // only on 664+, 6128+ and GX4000
174165   required_device<ram_device> m_ram;
175166   optional_device<cpc_expansion_slot_device> m_exp; // not on a GX4000
176167   optional_device<mc146818_device> m_rtc;  // Aleste 520EX only
r32320r32321
274265   required_memory_bank m_bank14;
275266   required_memory_bank m_bank15;
276267   required_memory_bank m_bank16;
277   required_ioport m_io_keyboard_row_0;
278   required_ioport m_io_keyboard_row_1;
279   required_ioport m_io_keyboard_row_2;
280   required_ioport m_io_keyboard_row_3;
281   required_ioport m_io_keyboard_row_4;
282   required_ioport m_io_keyboard_row_5;
283   required_ioport m_io_keyboard_row_6;
284   required_ioport m_io_keyboard_row_7;
285   required_ioport m_io_keyboard_row_8;
286   required_ioport m_io_keyboard_row_9;
287   optional_ioport m_io_keyboard_row_10;
288   required_ioport m_io_solder_links;
289   required_ioport m_io_green_display;
290   optional_ioport m_io_ctrltype;
268   optional_ioport_array<11> m_io_kbrow;
269   optional_ioport_array<4> m_io_analog;
291270   optional_ioport m_io_mouse1;
292271   optional_ioport m_io_mouse2;
293272   optional_ioport m_io_mouse3;
294   optional_ioport m_io_analog1;
295   optional_ioport m_io_analog2;
296   optional_ioport m_io_analog3;
297   optional_ioport m_io_analog4;
273   required_ioport m_io_solder_links;
274   required_ioport m_io_green_display;
275   optional_ioport m_io_ctrltype;
298276   required_device<screen_device> m_screen;
299277   required_device<palette_device> m_palette;
300278
279   memory_region *m_region_cart;
280
301281   void amstrad_init_lookups();
302282   void amstrad_vh_update_mode();
303283   void amstrad_plus_dma_parse(int channel);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team