Previous 15994 Revisions Next

r1251 Saturday 10th November, 2007 at 00:25:59 UTC by Stefano Priore
[CPC] Input ports cleanup
[src/mess/drivers]amstrad.c

src/mess/drivers/amstrad.c
r1250r1251
1818   Kevin Thacker [MESS driver]
1919
2020  May-June 2004 - Yoann Courtois (aka Papagayo/ex GMC/ex PARADOX) - rewritting some code with hardware documentation from http://andercheran.aiind.upv.es/~amstrad
21 
21
2222  June 2006  - Very preliminary CPC+ support.  CPR cart image handling, secondary ROM register, ASIC unlock detection
23               Supported: 
24            12-bit palette,
23               Supported:
24            12-bit palette,
2525            12-bit hardware sprites (largely works from what I've seen, some games have display issues),
26            Programmable Raster Interrupt (seems to work),
26            Programmable Raster Interrupt (seems to work),
2727            Split screen registers,
2828            Soft scroll registers (only byte-by-byre horizontally for now),
2929            Analogue controls (may well be completely wrong, I have no idea on how these should work),
r1250r1251
115115int amstrad_plus_scroll_border;  // soft scroll - extend border, any program that uses soft scrolling should enable this
116116int amstrad_plus_dma_status;
117117int amstrad_plus_dma_0_addr;   // DMA channel address
118int amstrad_plus_dma_1_addr;
119int amstrad_plus_dma_2_addr;
118int amstrad_plus_dma_1_addr;
119int amstrad_plus_dma_2_addr;
120120int amstrad_plus_dma_prescaler[3];  // DMA channel prescaler
121121int amstrad_plus_dma_clear;  // set if DMA interrupts are to be cleared automatically
122122
r1250r1251
151151  ------------------*/
152152/* current selected upper rom */
153153static unsigned char *Amstrad_UpperRom;
154/* There are 8 different ram configurations which work on the currently selected 64k logical block.
154/* There are 8 different ram configurations which work on the currently selected 64k logical block.
155155   The following tables show the possible ram configurations :*/
156156static int RamConfigurations[8 * 4] =
157157{
r1250r1251
185185static int multiface_hardware_enabled(void);
186186static void multiface_reset(void);
187187/* ---------------------------------------
188   - 27.05.2004 - PSG function selection -
188   - 27.05.2004 - PSG function selection -
189189   ---------------------------------------
190190The databus of the PSG is connected to PPI Port A.
191Data is read from/written to the PSG through this port.
191Data is read from/written to the PSG through this port.
192192
193The PSG function, defined by the BC1,BC2 and BDIR signals, is controlled by bit 7 and bit 6 of PPI Port C.
193The PSG function, defined by the BC1,BC2 and BDIR signals, is controlled by bit 7 and bit 6 of PPI Port C.
194194
195195PSG function selection:
196196-----------------------
197Function         
197Function
198198
199199BDIR = PPI Port C Bit 7 and BC1 = PPI Port C Bit 6
200200
201PPI Port C Bit | PSG Function
202BDIR BC1       |
2030    0         | Inactive
201PPI Port C Bit | PSG Function
202BDIR BC1       |
2030    0         | Inactive
2042040    1         | Read from selected PSG register. When function is set, the PSG will make the register data available to PPI Port A
2052051    0         | Write to selected PSG register. When set, the PSG will take the data at PPI Port A and write it into the selected PSG register
2062061    1         | Select PSG register. When set, the PSG will take the data at PPI Port A and select a register
r1250r1251
234234   update_psg();
235235  return ppi_port_inputs[amstrad_ppi_PortA];
236236}
237   
237
238238static WRITE8_HANDLER ( amstrad_ppi_porta_w )
239239{
240240     ppi_port_outputs[amstrad_ppi_PortA] = data;
241241    update_psg();
242242}
243243
244/* - Read PPI Port B -
244/* - Read PPI Port B -
245245   -------------------
246246Bit Description
2472477   Cassette read data
2482486   Parallel/Printer port ready signal ("1" = not ready, "0" = Ready)
2495   /EXP signal on expansion port (note 6) 
2504   50/60hz (link on PCB. For this MESS driver I have used the dipswitch feature) (note 5)
2513   | PCB links to define manufacturer name. For this MESS driver I have used the dipswitch feature. (note 1) (note 4)
2522   | (note 2)
2531   | (note 3)
2540   VSYNC State from 6845. "1" = VSYNC active, "0" = VSYNC inactive
2495   /EXP signal on expansion port (note 6)
2504   50/60hz (link on PCB. For this MESS driver I have used the dipswitch feature) (note 5)
2513   | PCB links to define manufacturer name. For this MESS driver I have used the dipswitch feature. (note 1) (note 4)
2522   | (note 2)
2531   | (note 3)
2540   VSYNC State from 6845. "1" = VSYNC active, "0" = VSYNC inactive
255255
256Note:
256Note:
257257
2581 On CPC464,CPC664,CPC6128 and GX4000 this is LK3 on the PCB. On the CPC464+ and CPC6128+ this is LK103 on the PCB. On the KC compact this is "1".
2592 On CPC464,CPC664,CPC6128 and GX4000 this is LK2 on the PCB. On the CPC464+ and CPC6128+ this is LK102 on the PCB. On the KC compact this is "0".
2603 On CPC464,CPC664,CPC6128 and GX4000 this is LK1 on the PCB. On the CPC464+ and CPC6128+ this is LK101 on the PCB. On the KC compact this is /TEST signal from the expansion port.
2614 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bits 3,2 and 1 define the manufacturer name. See below to see the options available. The manufacturer name is defined on the PCB and cannot be changed through software.
2625 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bit 4 defines the Screen refresh frequency. "1" = 50Hz, "0" = 60Hz. This is defined on the PCB and cannot be changed with software. On the KC compact bit 4 is "1"
2636 This bit is connected to /EXP signal on the expansion port.
264  On the KC Compact this bit is used to define bit 7 of the printer data.
265  On the CPC, it is possible to use this bit to define bit 7 of the printer data, so a 8-bit printer port is made, with a hardware modification,
266  On the CPC this can be used by a expansion device to report it's presence. "1" = device connected, "0" = device not connected. This is not always used by all expansion devices.
2581 On CPC464,CPC664,CPC6128 and GX4000 this is LK3 on the PCB. On the CPC464+ and CPC6128+ this is LK103 on the PCB. On the KC compact this is "1".
2592 On CPC464,CPC664,CPC6128 and GX4000 this is LK2 on the PCB. On the CPC464+ and CPC6128+ this is LK102 on the PCB. On the KC compact this is "0".
2603 On CPC464,CPC664,CPC6128 and GX4000 this is LK1 on the PCB. On the CPC464+ and CPC6128+ this is LK101 on the PCB. On the KC compact this is /TEST signal from the expansion port.
2614 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bits 3,2 and 1 define the manufacturer name. See below to see the options available. The manufacturer name is defined on the PCB and cannot be changed through software.
2625 On the CPC464,CPC664,CPC6128,CPC464+,CPC6128+ and GX4000 bit 4 defines the Screen refresh frequency. "1" = 50Hz, "0" = 60Hz. This is defined on the PCB and cannot be changed with software. On the KC compact bit 4 is "1"
2636 This bit is connected to /EXP signal on the expansion port.
264  On the KC Compact this bit is used to define bit 7 of the printer data.
265  On the CPC, it is possible to use this bit to define bit 7 of the printer data, so a 8-bit printer port is made, with a hardware modification,
266  On the CPC this can be used by a expansion device to report it's presence. "1" = device connected, "0" = device not connected. This is not always used by all expansion devices.
267267*/
268268
269269static READ8_HANDLER (amstrad_ppi_portb_r)
r1250r1251
288288
289289/* 26-May-2005 - PPI Port C
290290   -----------------------
291Bit Description  Usage
2927   PSG BDIR     | PSG function selection
291Bit Description  Usage
2927   PSG BDIR     | PSG function selection
2932936   PSG BC1      |
2945                Cassette Write data   
2954                Cassette Motor Control set bit to "1" for motor on, or "0" for motor off
2963                | Keyboard line Select keyboard line to be scanned (0-15)
2945                Cassette Write data
2954                Cassette Motor Control set bit to "1" for motor on, or "0" for motor off
2963                | Keyboard line Select keyboard line to be scanned (0-15)
2972972                |
2982981                |
2992990                |*/
r1250r1251
308308   previous_ppi_portc_w = ppi_port_outputs[amstrad_ppi_PortC];
309309/* Write the data to Port C */
310310   changed_data = previous_ppi_portc_w^data;
311   
311
312312   ppi_port_outputs[amstrad_ppi_PortC] = data;
313313
314314/* get b7 and b6 (PSG Function Selected */
r1250r1251
316316
317317/* Perform PSG function */
318318   update_psg();
319   
319
320320/* b5 Cassette Write data */
321321   if ((changed_data & 0x20) != 0) {
322322      cassette_output(image_from_devtype_and_index(IO_CASSETTE, 0),
323323         ((data & 0x20) ? -1.0 : +1.0));
324324   }
325   
325
326326/* b4 Cassette Motor Control */
327327   if ((changed_data & 0x10) != 0) {
328328      cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0),
r1250r1251
364364
365365/*--------------------------
366366  - Ram and Rom management -
367  --------------------------*/
367  --------------------------*/
368368/*-----------------
369369  - Set Lower Rom -
370  -----------------*/
370  -----------------*/
371371void amstrad_setLowerRom(void)
372372{
373373   unsigned char *BankBase;
374374   int banknum;
375/* b2 : "1" Lower rom area disable or "0" Lower rom area enable */
375/* b2 : "1" Lower rom area disable or "0" Lower rom area enable */
376376   if(amstrad_system_type == SYSTEM_CPC)
377377   {
378378      if ((amstrad_GateArray_ModeAndRomConfiguration & (1<<2)) == 0) {
r1250r1251
437437         }
438438      }
439439   }
440}     
440}
441441/*-----------------
442442  - Set Upper Rom -
443  -----------------*/
443  -----------------*/
444444void amstrad_setUpperRom(void)
445445{
446446   unsigned char *BankBase;
r1250r1251
456456      memory_set_bankptr(7, BankBase);
457457      memory_set_bankptr(8, BankBase+0x2000);
458458   }
459}     
459}
460460
461461void AmstradCPC_SetLowerRom(int Data)
462462{
r1250r1251
759759
760760/*------------------
761761  - Rethink Memory -
762  ------------------*/
762  ------------------*/
763763void amstrad_rethinkMemory(void)
764764{
765765   /* the following is used for banked memory read/writes and for setting up
r1250r1251
779779      amstrad_setLowerRom();
780780/* bank 3 - 0x0c000..0x0ffff */
781781    amstrad_setUpperRom();
782/* other banks */   
782/* other banks */
783783      memory_set_bankptr(9, AmstradCPC_RamBanks[0]);
784784      memory_set_bankptr(10, AmstradCPC_RamBanks[0]+0x2000);
785785      memory_set_bankptr(11, AmstradCPC_RamBanks[1]);
r1250r1251
796796}
797797/* simplified ram configuration - e.g. only correct for 128k machines
798798
799RAM Expansion Bits
800                             7 6 5 4  3  2  1  0
801CPC6128                      1 1 - -  -  s2 s1 s0
802Dk'tronics 256K Silicon Disk 1 1 1 b1 b0 b2 -  -
799RAM Expansion Bits
800                             7 6 5 4  3  2  1  0
801CPC6128                      1 1 - -  -  s2 s1 s0
802Dk'tronics 256K Silicon Disk 1 1 1 b1 b0 b2 -  -
803803
804"-" - this bit is ignored. The value of this bit is not important.
805"0" - this bit must be set to "0"
806"1" - this bit must be set to "1"
807"b0,b1,b2" - this bit is used to define the logical 64k block that the ram configuration uses
808"s0,s1,s2" - this bit is used to define the ram configuration
804"-" - this bit is ignored. The value of this bit is not important.
805"0" - this bit must be set to "0"
806"1" - this bit must be set to "1"
807"b0,b1,b2" - this bit is used to define the logical 64k block that the ram configuration uses
808"s0,s1,s2" - this bit is used to define the ram configuration
809809
810The CPC6128 has a 64k ram expansion built-in, giving 128K of RAM in this system.
811In the CPC464,CPC664 and KC compact if a ram expansion is not present, then writing to this port has no effect and the ram will be in the same arrangement as if configuration 0 had been selected.
810The CPC6128 has a 64k ram expansion built-in, giving 128K of RAM in this system.
811In the CPC464,CPC664 and KC compact if a ram expansion is not present, then writing to this port has no effect and the ram will be in the same arrangement as if configuration 0 had been selected.
812812*/
813813static void AmstradCPC_GA_SetRamConfiguration(void)
814814{
r1250r1251
823823       AmstradCPC_RamBanks[i] = BankAddr;
824824    }
825825  } else {/* Need to add the ram expansion configuration here ! */
826  }
826  }
827827  amstrad_rethinkMemory();
828828}
829829/* -------------------
830830   -  the Gate Array -
831831   -------------------
832The gate array is controlled by I/O. The recommended I/O port address is &7Fxx.
832The gate array is controlled by I/O. The recommended I/O port address is &7Fxx.
833833The gate array is selected when bit 15 of the I/O port address is set to "0" and bit 14 of the I/O port address is set to "1".
834834The values of the other bits are ignored.
835However, to avoid conflict with other devices in the system, these bits should be set to "1".
835However, to avoid conflict with other devices in the system, these bits should be set to "1".
836836
837837The function to be performed is selected by writing data to the Gate-Array, bit 7 and 6 of the data define the function selected (see table below).
838It is not possible to read from the Gate-Array.
838It is not possible to read from the Gate-Array.
839839
840Bit 7 Bit 6 Function
8410     0     Select pen
8420     1     Select colour for selected pen
8431     0     Select screen mode, rom configuration and interrupt control
8441     1     Ram Memory Management (note 1)
840Bit 7 Bit 6 Function
8410     0     Select pen
8420     1     Select colour for selected pen
8431     0     Select screen mode, rom configuration and interrupt control
8441     1     Ram Memory Management (note 1)
845845
846846Note 1 : This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location. In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available. In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion. In the 464+ and 6128+ this function is performed by the ASIC or a memory expansion. Please read the document on Ram Management for more information.*/
847847
r1250r1251
852852/* Pen selection
853853   -------------
854854Bit Value Function        Bit Value Function
8555   x     not used        5   x     not used
8564   1     Select border   4   0     Select pen
8573   x     | ignored       3   x     | Pen Number
8555   x     not used        5   x     not used
8564   1     Select border   4   0     Select pen
8573   x     | ignored       3   x     | Pen Number
8588582   x     |               2   x      |
8598591   x     |               1   x     |
8608600   x     |               0   x     |
r1250r1251
870870/* Colour selection
871871   ----------------
872872Even though there is provision for 32 colours, only 27 are possible.
873The remaining colours are duplicates of those already in the colour palette.
873The remaining colours are duplicates of those already in the colour palette.
874874
875Bit Value Function
8765   x     not used
8774   x     | Colour number
875Bit Value Function
8765   x     not used
8774   x     | Colour number
8788783   x     |
8798792   x     |
8808801   x     |
r1250r1251
888888    } break;
889889/* Select screen mode and rom configuration
890890   ----------------------------------------
891Bit Value Function
8925   x     not used
8934   x     Interrupt generation control
8943   1     Upper rom area disable or 0 Upper rom area enable
8952   1     Lower rom area disable or 0 Lower rom area enable
8961   x     | Mode selection
891Bit Value Function
8925   x     not used
8934   x     Interrupt generation control
8943   1     Upper rom area disable or 0 Upper rom area enable
8952   1     Lower rom area disable or 0 Lower rom area enable
8961   x     | Mode selection
8978970   x     |
898   
899Screen mode selection : The settings for bits 1 and 0 and the corresponding screen mode are given in the table below.
898
899Screen mode selection : The settings for bits 1 and 0 and the corresponding screen mode are given in the table below.
900900-----------------------
901b1 b0 Screen mode
9020  0  Mode 0, 160x200 resolution, 16 colours
9030  1  Mode 1, 320x200 resolution, 4 colours
9041  0  Mode 2, 640x200 resolution, 2 colours
9051  1  Mode 3, 160x200 resolution, 4 colours (note 1)
901b1 b0 Screen mode
9020  0  Mode 0, 160x200 resolution, 16 colours
9030  1  Mode 1, 320x200 resolution, 4 colours
9041  0  Mode 2, 640x200 resolution, 2 colours
9051  1  Mode 3, 160x200 resolution, 4 colours (note 1)
906906
907This mode is not official. From the combinations possible, we can see that 4 modes can be defined, although the Amstrad only has 3. Mode 3 is similar to mode 0, because it has the same resolution, but it is limited to only 4 colours.
908Mode changing is synchronised with HSYNC. If the mode is changed, it will take effect from the next HSYNC.
907This mode is not official. From the combinations possible, we can see that 4 modes can be defined, although the Amstrad only has 3. Mode 3 is similar to mode 0, because it has the same resolution, but it is limited to only 4 colours.
908Mode changing is synchronised with HSYNC. If the mode is changed, it will take effect from the next HSYNC.
909909
910910Rom configuration selection :
911911-----------------------------
912Bit 2 is used to enable or disable the lower rom area. The lower rom area occupies memory addressess &0000-&3fff and is used to access the operating system rom. When the lower rom area is is enabled, reading from &0000-&3FFF will return data in the rom. When a value is written to &0000-&3FFF, it will be written to the ram underneath the rom. When it is disabled, data read from &0000-&3FFF will return the data in the ram.
913Similarly, bit 3 controls enabling or disabling of the upper rom area. The upper rom area occupies memory addressess &C000-&FFFF and is BASIC or any expansion roms which may be plugged into a rom board/box. See the document on upper rom selection for more details. When the upper rom area enabled, reading from &c000-&ffff, will return data in the rom. When data is written to &c000-&FFFF, it will be written to the ram at the same address as the rom. When the upper rom area is disabled, and data is read from &c000-&ffff the data returned will be the data in the ram.
912Bit 2 is used to enable or disable the lower rom area. The lower rom area occupies memory addressess &0000-&3fff and is used to access the operating system rom. When the lower rom area is is enabled, reading from &0000-&3FFF will return data in the rom. When a value is written to &0000-&3FFF, it will be written to the ram underneath the rom. When it is disabled, data read from &0000-&3FFF will return the data in the ram.
913Similarly, bit 3 controls enabling or disabling of the upper rom area. The upper rom area occupies memory addressess &C000-&FFFF and is BASIC or any expansion roms which may be plugged into a rom board/box. See the document on upper rom selection for more details. When the upper rom area enabled, reading from &c000-&ffff, will return data in the rom. When data is written to &c000-&FFFF, it will be written to the ram at the same address as the rom. When the upper rom area is disabled, and data is read from &c000-&ffff the data returned will be the data in the ram.
914914
915915Bit 4 controls the interrupt generation. It can be used to delay interrupts.*/
916916     case 0x02: {
917917      int Previous_GateArray_ModeAndRomConfiguration = amstrad_GateArray_ModeAndRomConfiguration;
918918      /* If bit 5 is enabled on a CPC Plus/GX4000 when the ASIC is unlocked, sets the lower ROM position and cart bank
919         b5 = 1, b4b3 = RAM position for lower ROM area and if the ASIC registers are visible at &4000,
919         b5 = 1, b4b3 = RAM position for lower ROM area and if the ASIC registers are visible at &4000,
920920         b2b1b0 = cartridge bank to read from lower ROM area (0-7 only) */
921921      if(amstrad_system_type == SYSTEM_PLUS && amstrad_plus_asic_enabled != 0)
922922      {
r1250r1251
937937         amstrad_GateArray_ModeAndRomConfiguration = dataToGateArray;
938938      }
939939
940/* If bit 4 of the "Select screen mode and rom configuration" register of the Gate-Array is set to "1"
940/* If bit 4 of the "Select screen mode and rom configuration" register of the Gate-Array is set to "1"
941941 then the interrupt request is cleared and the 6-bit counter is reset to "0".  */
942942           if ((amstrad_GateArray_ModeAndRomConfiguration & (1<<4)) != 0) {
943943            amstrad_CRTC_HS_Counter = 0;
r1250r1251
956956#else
957957              amstrad_vh_update_mode(amstrad_GateArray_ModeAndRomConfiguration & 0x03);
958958#endif
959           }
959           }
960960      }  break;
961961/* Ram Memory Management
962    ---------------------   
962    ---------------------
963963This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location.
964964In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available.
965965In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion.
r1250r1251
968968     case 0x03: {
969969           amstrad_GateArray_RamConfiguration = dataToGateArray;
970970     } break;
971 
971
972972    default: {
973973    } break;
974974  }
r1250r1251
985985
986986/* CRTC Differences
987987   ----------------
988The following tables list the functions that can be accessed for each type:
988The following tables list the functions that can be accessed for each type:
989989
990990Type 0
991b1 b0 Function Read/Write
9920  0  Select internal 6845 register Write Only
9930  1  Write to selected internal 6845 register Write Only
9941  0  - -
9951  1  Read from selected internal 6845 register Read only
991b1 b0 Function Read/Write
9920  0  Select internal 6845 register Write Only
9930  1  Write to selected internal 6845 register Write Only
9941  0  - -
9951  1  Read from selected internal 6845 register Read only
996996
997997Type 1
998b1 b0 Function Read/Write
9990  0  Select internal 6845 register Write Only
10000  1  Write to selected internal 6845 register Write Only
10011  0  Read Status Register Read Only
10021  1  Read from selected internal 6845 register Read only
998b1 b0 Function Read/Write
9990  0  Select internal 6845 register Write Only
10000  1  Write to selected internal 6845 register Write Only
10011  0  Read Status Register Read Only
10021  1  Read from selected internal 6845 register Read only
10031003
10041004Type 2
1005b1 b0 Function Read/Write
10060  0  Select internal 6845 register Write Only
10070  1  Write to selected internal 6845 register Write Only
10081  0  - -
10091  1  Read from selected internal 6845 register Read only
1005b1 b0 Function Read/Write
10060  0  Select internal 6845 register Write Only
10070  1  Write to selected internal 6845 register Write Only
10081  0  - -
10091  1  Read from selected internal 6845 register Read only
10101010
10111011Type 3 and 4
1012b1 b0 Function Read/Write
10130  0  Select internal 6845 register Write Only
10140  1  Write to selected internal 6845 register Write Only
10151  0  Read from selected internal 6845 register Read Only
10161  1  Read from selected internal 6845 register Read only
1012b1 b0 Function Read/Write
10130  0  Select internal 6845 register Write Only
10140  1  Write to selected internal 6845 register Write Only
10151  0  Read from selected internal 6845 register Read Only
10161  1  Read from selected internal 6845 register Read only
10171017*/
10181018
10191019/* I/O port allocation
10201020   -------------------
10211021
1022Many thanks to Mark Rison for providing the original information. Thankyou to Richard Wilson for his discoveries concerning RAM management I/O decoding.
1022Many thanks to Mark Rison for providing the original information. Thankyou to Richard Wilson for his discoveries concerning RAM management I/O decoding.
10231023
1024This document will explain the decoding of the I/O ports. The port address is not decoded fully which means a hardware device can be accessed through more than one address, in addition, using some addressess can access more than one element of the hardware at the same time. The CPC IN/OUT design differs from the norm in that port numbers are defined using 16 bits, as opposed to the traditional 8 bits.
1024This document will explain the decoding of the I/O ports. The port address is not decoded fully which means a hardware device can be accessed through more than one address, in addition, using some addressess can access more than one element of the hardware at the same time. The CPC IN/OUT design differs from the norm in that port numbers are defined using 16 bits, as opposed to the traditional 8 bits.
10251025
1026IN r,(C)/OUT (C),r instructions: Bits b15-b8 come from the B register, bits b7-b0 come from "r"
1027IN A,(n)/OUT (n),A instructions: Bits b15-b8 come from the A register, bits b7-b0 come from "n"
1028Listed below are the internal hardware devices and the bit fields to which they respond. In the table:
1026IN r,(C)/OUT (C),r instructions: Bits b15-b8 come from the B register, bits b7-b0 come from "r"
1027IN A,(n)/OUT (n),A instructions: Bits b15-b8 come from the A register, bits b7-b0 come from "n"
1028Listed below are the internal hardware devices and the bit fields to which they respond. In the table:
10291029
1030"-" means this bit is ignored,
1031"0" means the bit must be set to "0" for the hardware device to respond,
1032"1" means the bit must be set to "1" for the hardware device to respond.
1033"r1" and "r0" mean a bit used to define a register
1030"-" means this bit is ignored,
1031"0" means the bit must be set to "0" for the hardware device to respond,
1032"1" means the bit must be set to "1" for the hardware device to respond.
1033"r1" and "r0" mean a bit used to define a register
10341034
1035Hardware device       Read/Write Port bits
1036                                 b15 b14 b13 b12 b11 b10 b9  b8  b7  b6  b5  b4  b3  b2  b1  b0
1037Gate-Array            Write Only 0   1   -   -   -   -   -   -   -   -   -   -   -   -   -   -
1038RAM Configuration     Write Only 0   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
1039CRTC                  Read/Write -   0   -   -   -   -   r1  r0  -   -   -   -   -   -   -   -
1040ROM select            Write only -   -   0   -   -   -   -   -   -   -   -   -   -   -   -   -
1041Printer port          Write only -   -   -   0   -   -   -   -   -   -   -   -   -   -   -   -
10428255 PPI              Read/Write -   -   -   -   0   -   r1  r0  -   -   -   -   -   -   -   -
1043Expansion Peripherals Read/Write -   -   -   -   -   0   -   -   -   -   -   -   -   -   -   -
1035Hardware device       Read/Write Port bits
1036                                 b15 b14 b13 b12 b11 b10 b9  b8  b7  b6  b5  b4  b3  b2  b1  b0
1037Gate-Array            Write Only 0   1   -   -   -   -   -   -   -   -   -   -   -   -   -   -
1038RAM Configuration     Write Only 0   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
1039CRTC                  Read/Write -   0   -   -   -   -   r1  r0  -   -   -   -   -   -   -   -
1040ROM select            Write only -   -   0   -   -   -   -   -   -   -   -   -   -   -   -   -
1041Printer port          Write only -   -   -   0   -   -   -   -   -   -   -   -   -   -   -   -
10428255 PPI              Read/Write -   -   -   -   0   -   r1  r0  -   -   -   -   -   -   -   -
1043Expansion Peripherals Read/Write -   -   -   -   -   0   -   -   -   -   -   -   -   -   -   -
10441044
10451045*/
10461046
r1250r1251
10791079      }
10801080   }
10811081
1082/* if b11 = 0 : 8255 PPI Read selected - bits 9 and 8 then define the PPI function access as shown below:
1082/* if b11 = 0 : 8255 PPI Read selected - bits 9 and 8 then define the PPI function access as shown below:
10831083
1084b9 b8 | PPI Function Read/Write status
10850  0  | Port A data  Read/Write
10860  1  | Port B data  Read/Write
10871  0  | Port C data  Read/Write
1084b9 b8 | PPI Function Read/Write status
10850  0  | Port A data  Read/Write
10860  1  | Port B data  Read/Write
10871  0  | Port C data  Read/Write
108810881  1  | Control      Write Only
1089*/   
1089*/
10901090   if ((offset & (1<<11)) == 0)
10911091   {
10921092      if (r1r0 < 0x03 )
r1250r1251
10951095/* if b10 = 0 : Expansion Peripherals Read selected
10961096
10971097bits b7-b5 are used to select an expansion peripheral. Again, this is done by resetting the peripheral's bit:
1098Bit | Device
1099b7  | FDC
1100b6  | Reserved (was it ever used?)
1101b5  | Serial port
1098Bit | Device
1099b7  | FDC
1100b6  | Reserved (was it ever used?)
1101b5  | Serial port
11021102
11031103In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation; all the other bits (b9,b4-b1) are ignored:
1104b8 b0 Function Read/Write state
11050 0 FDD motor control Write Only
11060 1 not used N/A
11071 0 Main Status register of FDC (MSR) Read Only
1104b8 b0 Function Read/Write state
11050 0 FDD motor control Write Only
11060 1 not used N/A
11071 0 Main Status register of FDC (MSR) Read Only
110811081 1 Data register of FDC Read/Write
11091109
11101110If b10 is reset but none of b7-b5 are reset, user expansion peripherals are selected.
1111The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset.
1111The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset.
11121112 */
11131113    if ((offset & (1<<10)) == 0)   {
11141114      if ((offset & (1<<10)) == 0) {
r1250r1251
11671167/* b13 = 0 : ROM select Write Selected*/
11681168   if ((offset & (1<<13)) == 0)
11691169   {
1170      if (previous_amstrad_UpperRom_data != (data & 0xff))
1170      if (previous_amstrad_UpperRom_data != (data & 0xff))
11711171      {
11721172         AmstradCPC_SetUpperRom(data);
11731173      }
r1250r1251
11891189      }
11901190      previous_printer_data_byte = data;
11911191   }
1192/* if b11 = 0 : 8255 PPI Write selected - bits 9 and 8 then define the PPI function access as shown below:
1193b9 b8 | PPI Function Read/Write status
11940  0  | Port A data  Read/Write
11950  1  | Port B data  Read/Write
11961  0  | Port C data  Read/Write
1192/* if b11 = 0 : 8255 PPI Write selected - bits 9 and 8 then define the PPI function access as shown below:
1193b9 b8 | PPI Function Read/Write status
11940  0  | Port A data  Read/Write
11950  1  | Port B data  Read/Write
11961  0  | Port C data  Read/Write
119711971  1  | Control      Write Only
1198*/   
1198*/
11991199   if ((offset & (1<<11)) == 0) {
12001200      unsigned int Index = ((offset & 0x0300) >> 8);
12011201      ppi8255_w(0, Index, data);
r1250r1251
12031203/* if b10 = 0 : Expansion Peripherals Write selected */
12041204   if ((offset & (1<<10)) == 0) {
12051205/* bits b7-b5 are used to select an expansion peripheral. This is done by resetting the peripheral's bit:
1206Bit | Device
1207b7  | FDC
1208b6  | Reserved (was it ever used?)
1209b5  | Serial port
1206Bit | Device
1207b7  | FDC
1208b6  | Reserved (was it ever used?)
1209b5  | Serial port
12101210
1211In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation;
1211In the case of the FDC, bits b8 and b0 are used to select the specific mode of operation;
12121212all the other bits (b9,b4-b1) are ignored:
1213b8 b0 Function Read/Write state
12140 0 FDD motor control Write Only
12150 1 not used N/A
12161 0 Main Status register of FDC (MSR) Read Only
12171 1 Data register of FDC Read/Write
1213b8 b0 Function Read/Write state
12140 0 FDD motor control Write Only
12150 1 not used N/A
12161 0 Main Status register of FDC (MSR) Read Only
12171 1 Data register of FDC Read/Write
12181218
12191219If b10 is reset but none of b7-b5 are reset, user expansion peripherals are selected.
1220The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset.
1220The exception is the case where none of b7-b0 are reset (i.e. port &FBFF), which causes the expansion peripherals to reset.
12211221*/
12221222    if ((offset & (1<<7)) == 0) {
12231223         unsigned int b8b0 = ((offset & 0x0100) >> (8 - 1)) | (offset & 0x01);
12241224
12251225         switch (b8b0) {
12261226         case 0x00:
1227        /* FDC Motor Control - Bit 0 defines the state of the FDD motor:
1228         * "1" the FDD motor will be active.
1227        /* FDC Motor Control - Bit 0 defines the state of the FDD motor:
1228         * "1" the FDD motor will be active.
12291229         * "0" the FDD motor will be in-active.*/
12301230            floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), (data & 0x01));
12311231            floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1), (data & 0x01));
r1250r1251
15961596   amstrad_GateArray_write(0x0c0);
15971597
15981598  // Get manufacturer name and TV refresh rate from PCB link (dipswitch for mess emulation)
1599   ppi_port_inputs[amstrad_ppi_PortB] = (((readinputport(10)&MANUFACTURER_NAME)<<1) | (readinputport(10)&TV_REFRESH_RATE));
1599   ppi_port_inputs[amstrad_ppi_PortB] = (((readinputportbytag("solder_links")&MANUFACTURER_NAME)<<1) | (readinputportbytag("solder_links")&TV_REFRESH_RATE));
16001600
16011601   if(amstrad_system_type == SYSTEM_PLUS)
16021602      memset(amstrad_plus_asic_ram,0,16384);  // clear ASIC RAM
r1250r1251
17311731static void amstrad_update_video_1(int dummy)
17321732{
17331733   amstrad_vh_execute_crtc_cycles(2);
1734}
1734}
17351735#endif
17361736
17371737static TIMER_CALLBACK(amstrad_vh_execute_crtc_cycles_callback)
r1250r1251
17931793   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0),  FLOPPY_DRIVE_SS_40);
17941794   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1),  FLOPPY_DRIVE_SS_40);
17951795
1796/* Every microsecond:
1796/* Every microsecond:
17971797
1798The CRTC generates a memory address using it's MA and RA signal outputs
1798The CRTC generates a memory address using it's MA and RA signal outputs
17991799The Gate-Array fetches two bytes for each address*/
18001800
18011801//   mame_timer_pulse(MAME_TIME_IN_USEC(AMSTRAD_US_PER_SCANLINE), 0, amstrad_vh_execute_crtc_cycles);
r1250r1251
18321832   {
18331833      Amstrad_ROM_Table[i] = &memory_region(REGION_CPU1)[0x014000];
18341834   }
1835   
1835
18361836   Amstrad_ROM_Table[7] = &memory_region(REGION_CPU1)[0x018000];
18371837   amstrad_common_init();
18381838   amstrad_reset_machine();
18391839
18401840   multiface_init();
1841   
1841
18421842}
18431843
18441844static MACHINE_RESET( plus )
18451845{
18461846   int i;
1847   
1847
18481848   amstrad_system_type = SYSTEM_PLUS;
18491849
18501850   for (i=0; i<128; i++)  // fill ROM table
r1250r1251
19381938/* Additional notes for the AY-3-8912 in the CPC design
19391939Port A of the AY-3-8912 is connected to the keyboard.
19401940The data for a selected keyboard line can be read through Port A, as long as it is defined as input.
1941The operating system and I believe all programs assume this port has been defined as input. (NWC has found a bug in the Multiface 2 software. The Multiface does not reprogram the input/output state of the AY-3-8912's registers, therefore if port A is programmed as output, the keyboard will be unresponsive and it will not be possible to use the Multiface functions.)
1942When port B is defined as input (bit 7 of register 7 is set to "0"), a read of this port will return &FF.
1941The operating system and I believe all programs assume this port has been defined as input. (NWC has found a bug in the Multiface 2 software. The Multiface does not reprogram the input/output state of the AY-3-8912's registers, therefore if port A is programmed as output, the keyboard will be unresponsive and it will not be possible to use the Multiface functions.)
1942When port B is defined as input (bit 7 of register 7 is set to "0"), a read of this port will return &FF.
19431943*/
19441944
19451945/* read PSG port A */
19461946static READ8_HANDLER ( amstrad_psg_porta_read )
1947{   
1947{
19481948/* Read CPC Keyboard
19491949   If keyboard matrix line 11-14 are selected, the byte is always &ff.
19501950   After testing on a real CPC, it is found that these never change, they always return &FF. */
r1250r1251
19601960
19611961static INPUT_PORTS_START( amstrad_keyboard )
19621962   /* keyboard row 0 */
1963   PORT_START
1964   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
1965   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
1966   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
1967   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
1968   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
1969   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
1970   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad Enter") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
1971   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
1963   PORT_START_TAG("keyboard_row_0")
1964   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x87\xA7")          PORT_CODE(KEYCODE_UP)         PORT_CHAR(UCHAR_MAMEKEY(UP))
1965   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x87\xA8")          PORT_CODE(KEYCODE_RIGHT)      PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
1966   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x87\xA9")          PORT_CODE(KEYCODE_DOWN)       PORT_CHAR(UCHAR_MAMEKEY(DOWN))
1967   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 9")              PORT_CODE(KEYCODE_9_PAD)      PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
1968   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 6")              PORT_CODE(KEYCODE_6_PAD)      PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
1969   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 3")              PORT_CODE(KEYCODE_3_PAD)      PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
1970   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad Enter")          PORT_CODE(KEYCODE_ENTER_PAD)  PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
1971   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad .")              PORT_CODE(KEYCODE_DEL_PAD)    PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
19721972
19731973   /* keyboard line 1 */
1974   PORT_START
1975   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
1976   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy") PORT_CODE(KEYCODE_LALT)
1977   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
1978   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
1979   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
1980   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
1981   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
1982   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
1974   PORT_START_TAG("keyboard_row_1")
1975   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x87\xA6")          PORT_CODE(KEYCODE_LEFT)       PORT_CHAR(UCHAR_MAMEKEY(LEFT))
1976   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Copy")                  PORT_CODE(KEYCODE_HOME)       PORT_CHAR(UCHAR_MAMEKEY(END))
1977   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 7")              PORT_CODE(KEYCODE_7_PAD)      PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
1978   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 8")              PORT_CODE(KEYCODE_8_PAD)      PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
1979   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 5")              PORT_CODE(KEYCODE_5_PAD)      PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
1980   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 1")              PORT_CODE(KEYCODE_1_PAD)      PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
1981   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 2")              PORT_CODE(KEYCODE_2_PAD)      PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
1982   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 0")              PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
19831983
19841984   /* keyboard row 2 */
1985   PORT_START
1986   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
1987   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@') PORT_CHAR('|')
1988   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
1989   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']')
1990   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
1991   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
1992   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
1993   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')
1994   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
1985   PORT_START_TAG("keyboard_row_2")
1986   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Clr")                   PORT_CODE(KEYCODE_BACKSPACE)  PORT_CHAR(UCHAR_MAMEKEY(HOME))
1987   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[")                     PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') PORT_CHAR('{')
1988   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter")                 PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
1989   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]")                     PORT_CODE(KEYCODE_BACKSLASH)  PORT_CHAR(']') PORT_CHAR('}')
1990   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad 4")              PORT_CODE(KEYCODE_4_PAD)      PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
1991   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift")            PORT_CODE(KEYCODE_LSHIFT)     PORT_CHAR(UCHAR_SHIFT_1)
1992   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift")           PORT_CODE(KEYCODE_RSHIFT)     PORT_CHAR(UCHAR_SHIFT_1)
1993   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\")                    PORT_CODE(KEYCODE_RCONTROL)   PORT_CHAR('\\') PORT_CHAR('`')
1994   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl")                  PORT_CODE(KEYCODE_RALT)       PORT_CHAR(UCHAR_SHIFT_2)
19951995
19961996   /* keyboard row 3 */
1997   PORT_START
1998   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ \xC2\xA3") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('^') PORT_CHAR('\xa3')
1999   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
2000   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')
2001   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
2002   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+')
2003   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
2004   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
2005   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
1997   PORT_START_TAG("keyboard_row_3")
1998   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 \xC2\xA3") PORT_CODE(KEYCODE_EQUALS)     PORT_CHAR('^') PORT_CHAR('\xa3')
1999   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_MINUS)      PORT_CHAR('-') PORT_CHAR('=')
2000   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR('@') PORT_CHAR('|')
2001   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_P)          PORT_CHAR('p') PORT_CHAR('P')
2002   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_QUOTE)      PORT_CHAR(';') PORT_CHAR('+')
2003   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_COLON)      PORT_CHAR(':') PORT_CHAR('*')
2004   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('/') PORT_CHAR('?')
2005   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR('>')
20062006
20072007   /* keyboard line 4 */
2008   PORT_START
2009   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_')
2010   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
2011   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
2012   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
2013   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
2014   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
2015   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
2016   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CODE(',') PORT_CHAR('<')
2008   PORT_START_TAG("keyboard_row_4")
2009   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR('_')
2010   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR(')')
2011   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')
2012   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_I)          PORT_CHAR('i') PORT_CHAR('I')
2013   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_L)          PORT_CHAR('l') PORT_CHAR('L')
2014   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_K)          PORT_CHAR('k') PORT_CHAR('K')
2015   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_M)          PORT_CHAR('m') PORT_CHAR('M')
2016   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_COMMA)      PORT_CHAR(',') PORT_CHAR('<')
20172017
20182018   /* keyboard line 5 */
2019   PORT_START
2020   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
2021   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
2022   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
2023   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
2024   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
2025   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
2026   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
2027   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
2019   PORT_START_TAG("keyboard_row_5")
2020   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('(')
2021   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_7)          PORT_CHAR('7') PORT_CHAR('\'')
2022   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')
2023   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')
2024   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_H)          PORT_CHAR('h') PORT_CHAR('H')
2025   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_J)          PORT_CHAR('j') PORT_CHAR('J')
2026   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_N)          PORT_CHAR('n') PORT_CHAR('N')
2027   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space")                 PORT_CODE(KEYCODE_SPACE)      PORT_CHAR(32)
20282028
20292029   /* keyboard line 6 */
2030   PORT_START
2031   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
2032   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
2033   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
2034   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
2035   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
2036   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
2037   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
2038   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
2030   PORT_START_TAG("keyboard_row_6")
2031   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('&')
2032   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
2033   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')
2034   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_T)          PORT_CHAR('t') PORT_CHAR('T')
2035   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_G)          PORT_CHAR('g') PORT_CHAR('G')
2036   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_F)          PORT_CHAR('f') PORT_CHAR('F')
2037   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_B)          PORT_CHAR('b') PORT_CHAR('B')
2038   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_V)          PORT_CHAR('v') PORT_CHAR('V')
20392039
20402040   /* keyboard line 7 */
2041   PORT_START
2042   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
2043   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
2044   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
2045   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
2046   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
2047   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
2048   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
2049   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
2041   PORT_START_TAG("keyboard_row_7")
2042   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
2043   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
2044   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')
2045   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_W)          PORT_CHAR('w') PORT_CHAR('W')
2046   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_S)          PORT_CHAR('s') PORT_CHAR('S')
2047   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_D)          PORT_CHAR('d') PORT_CHAR('D')
2048   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_C)          PORT_CHAR('c') PORT_CHAR('C')
2049   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_X)          PORT_CHAR('x') PORT_CHAR('X')
20502050
20512051   /* keyboard line 8 */
2052   PORT_START
2053   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
2054   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"')
2055   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(26)
2056   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
2057   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
2058   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
2059   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK)
2060   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
2052   PORT_START_TAG("keyboard_row_8")
2053   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_1)          PORT_CHAR('1') PORT_CHAR('!')
2054   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_2)          PORT_CHAR('2') PORT_CHAR('\"') PORT_CHAR('~')
2055   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc")                   PORT_CODE(KEYCODE_TILDE)      PORT_CHAR(27)
2056   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_Q)          PORT_CHAR('q') PORT_CHAR('Q')
2057   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab")                   PORT_CODE(KEYCODE_TAB)        PORT_CHAR(9)
2058   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_A)          PORT_CHAR('a') PORT_CHAR('A')
2059   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock")             PORT_CODE(KEYCODE_CAPSLOCK)   PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE
2060   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)                                    PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')
20612061
20622062   /* keyboard line 9 */
2063   PORT_START
2064   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1)
2065   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1)
2066   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1)
2067   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1)
2068   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1)
2069   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1)
2070   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1)
2071   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
2063   PORT_START_TAG("keyboard_row_9")
2064   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)    PORT_PLAYER(1) PORT_8WAY
2065   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN)  PORT_PLAYER(1) PORT_8WAY
2066   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT)  PORT_PLAYER(1) PORT_8WAY
2067   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY
2068   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1)        PORT_PLAYER(1)
2069   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2)        PORT_PLAYER(1)
2070   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON3)        PORT_PLAYER(1)
2071   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del")                   PORT_CODE(KEYCODE_INSERT)     PORT_CHAR(8)
2072
2073/* Second joystick port need to be defined: the second joystick is daisy-chained on the back of the first one */
2074
20722075INPUT_PORTS_END
20732076
20742077
20752078/* Steph 2000-10-27   I remapped the 'Machine Name' Dip Switches (easier to understand) */
20762079
2077static INPUT_PORTS_START(amstrad)
2080static INPUT_PORTS_START( crtc_links )
20782081
2079   PORT_INCLUDE( amstrad_keyboard )
2080
20812082/* the following are defined as dipswitches, but are in fact solder links on the
20822083 * curcuit board. The links are open or closed when the PCB is made, and are set depending on which country
2083 * the Amstrad system was to go to
2084 * the Amstrad system was to go to (reference: http://amstrad.cpc.free.fr/article.php?sid=26)
20842085
2085b3 b2 b1 Manufacturer Name (CPC and CPC+ only):
20860  0  0  Isp
20870  0  1  Triumph
20880  1  0  Saisho
20890  1  1  Solavox
20901  0  0  Awa
20911  0  1  Schneider
20921  1  0  Orion
20931  1  1  Amstrad*/
2094PORT_START
2095   PORT_DIPNAME( 0x07, 0x07, "Manufacturer Name" )
2096   PORT_DIPSETTING(    0x00, "Isp" )
2097   PORT_DIPSETTING(    0x01, "Triumph" )
2098   PORT_DIPSETTING(    0x02, "Saisho" )
2099   PORT_DIPSETTING(    0x03, "Solavox" )
2100   PORT_DIPSETTING(    0x04, "Awa" )
2101   PORT_DIPSETTING(    0x05, "Schneider" )
2102   PORT_DIPSETTING(    0x06, "Orion" )
2103   PORT_DIPSETTING(    0x07, "Amstrad" )
2086lk1 lk2 lk3 Manufacturer Name (CPC and CPC+ only):
21042087
2105   PORT_DIPNAME(    0x10, 0x10, "TV Refresh Rate" )
2106   PORT_DIPSETTING(    0x00, "60 Hz" )
2107   PORT_DIPSETTING(    0x10, "50 Hz" )
20880   0   0   Isp
20890   0   1   Triumph (UK?)
20900   1   0   Saisho (UK: Saisho is Dixons brand name for their electronic goods)
20910   1   1   Solavox
20921   0   0   Awa (Australia)
20931   0   1   Schneider (Germany)
20941   1   0   Orion (Japan?)
20951   1   1   Amstrad (UK)
21082096
2097lk4     Frequency
20980       60 Hz
20991       50 Hz
2100*/
2101PORT_START_TAG("solder_links")
2102   PORT_DIPNAME(0x07, 0x07, "Manufacturer Name")
2103   PORT_DIPLOCATION("LK:3,2,1")
2104   PORT_DIPSETTING(0x00, "Isp")
2105   PORT_DIPSETTING(0x01, "Triumph")
2106   PORT_DIPSETTING(0x02, "Saisho")
2107   PORT_DIPSETTING(0x03, "Solavox")
2108   PORT_DIPSETTING(0x04, "Awa")
2109   PORT_DIPSETTING(0x05, "Schneider")
2110   PORT_DIPSETTING(0x06, "Orion")
2111   PORT_DIPSETTING(0x07, "Amstrad")
2112
2113   PORT_DIPNAME(0x10, 0x10, "TV Refresh Rate")
2114   PORT_DIPLOCATION("LK:4")
2115   PORT_DIPSETTING(0x00, "60 Hz")
2116   PORT_DIPSETTING(0x10, "50 Hz")
2117
21092118/* Part number Manufacturer Type number
2110   UM6845      UMC          0
2111   HD6845S     Hitachi      0
2112   UM6845R     UMC          1
2113   MC6845      Motorola     2
2119   UM6845      UMC          0
2120   HD6845S     Hitachi      0
2121   UM6845R     UMC          1
2122   MC6845      Motorola     2
21142123   AMS40489    Amstrad      3
21152124   Pre-ASIC??? Amstrad?     4 In the "cost-down" CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the "Pre-ASIC" because it preceeded the CPC+ ASIC
2116As far as I know, the KC compact used HD6845S only.
2125As far as I know, the KC compact used HD6845S only.
21172126*/
21182127   PORT_START_TAG("crtc")
2119   PORT_DIPNAME( 0xFF, M6845_PERSONALITY_UM6845R, "CRTC Type" )
2120   PORT_DIPSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845" )
2121   PORT_DIPSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S" )
2122   PORT_DIPSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R" )
2123   PORT_DIPSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845" )
2124   PORT_DIPSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489" )
2125   PORT_DIPSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC???" )
2128   PORT_CONFNAME( 0xFF, M6845_PERSONALITY_UM6845R, "CRTC Type")
2129   PORT_CONFSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845")
2130   PORT_CONFSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S")
2131   PORT_CONFSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R")
2132   PORT_CONFSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845")
2133   PORT_CONFSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489")
2134   PORT_CONFSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC")
21262135
21272136   PORT_START_TAG("multiface")
2128   PORT_CONFNAME(0x01, 0x00, "Multiface Hardware" )
2137   PORT_CONFNAME(0x01, 0x00, "Multiface Two" )
21292138   PORT_CONFSETTING(0x00, DEF_STR( Off) )
21302139   PORT_CONFSETTING(0x01, DEF_STR( On) )
2131   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Multiface Stop") PORT_CODE(KEYCODE_F1)
2140   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Multiface Two's Stop Button") PORT_CODE(KEYCODE_F1)
2141//   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Multiface Two's Reset Button") PORT_CODE(KEYCODE_F3)  Not implemented
21322142
21332143   PORT_START_TAG("green_display")
2134   PORT_CONFNAME( 0x01, 0x00, "Color/Green Display" )
2135   PORT_CONFSETTING(0x00, "Color Display" )
2136   PORT_CONFSETTING(0x01, "Green Display" )
2144   PORT_CONFNAME( 0x01, 0x00, "Monitor" )
2145   PORT_CONFSETTING(0x00, "CTM640 Colour Monitor" )
2146   PORT_CONFSETTING(0x01, "GT64 Green Monitor" )
21372147
21382148INPUT_PORTS_END
21392149
2150static INPUT_PORTS_START(amstrad)
2151
2152   PORT_INCLUDE( amstrad_keyboard )
2153   PORT_INCLUDE( crtc_links )
2154
2155INPUT_PORTS_END
2156
21402157static INPUT_PORTS_START(kccomp)
21412158   PORT_INCLUDE( amstrad_keyboard )
21422159INPUT_PORTS_END
21432160
21442161static INPUT_PORTS_START(plus)
21452162   PORT_INCLUDE( amstrad_keyboard )
2163   PORT_INCLUDE( crtc_links )
21462164
2147   PORT_START
2148   PORT_DIPNAME( 0x07, 0x07, "Manufacturer Name" )
2149   PORT_DIPSETTING(    0x00, "Isp" )
2150   PORT_DIPSETTING(    0x01, "Triumph" )
2151   PORT_DIPSETTING(    0x02, "Saisho" )
2152   PORT_DIPSETTING(    0x03, "Solavox" )
2153   PORT_DIPSETTING(    0x04, "Awa" )
2154   PORT_DIPSETTING(    0x05, "Schneider" )
2155   PORT_DIPSETTING(    0x06, "Orion" )
2156   PORT_DIPSETTING(    0x07, "Amstrad" )
2165   /* The CPC+ and GX4000 adds support for analogue controllers.
2166      Up to two joysticks or four paddles can be used, although the ASIC supports twice that.
2167      Read at &6808-&680f in ASIC RAM
2168      I am unsure if these are even close to correct */
21572169
2158   PORT_DIPNAME(    0x10, 0x10, "TV Refresh Rate" )
2159   PORT_DIPSETTING(    0x00, "60 Hz" )
2160   PORT_DIPSETTING(    0x10, "50 Hz" )
2170   PORT_START_TAG("analog1")
2171   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
2172   PORT_SENSITIVITY(100)
2173   PORT_KEYDELTA(10)
2174   PORT_PLAYER(1)
21612175
2162   /* The CPC+ and GX4000 use the ASIC CRTC functionality */
2163   PORT_START_TAG("crtc")
2164   PORT_DIPNAME( 0xFF, M6845_PERSONALITY_AMS40489, "CRTC Type" )
2165   PORT_DIPSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845" )
2166   PORT_DIPSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S" )
2167   PORT_DIPSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R" )
2168   PORT_DIPSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845" )
2169   PORT_DIPSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489" )
2170   PORT_DIPSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC???" )
2176   PORT_START_TAG("analog2")
2177   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
2178   PORT_SENSITIVITY(100)
2179   PORT_KEYDELTA(10)
2180   PORT_PLAYER(1)
21712181
2172   /* The CPC+ and GX4000 adds support for analogue controllers.
2173      Up to two joysticks or four paddles can be used, although the ASIC supports twice that.
2174      Read at &6808-&680f in ASIC RAM
2175      I am unsure if these are even close to correct */
2182   PORT_START_TAG("analog3")
2183   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
2184   PORT_SENSITIVITY(100)
2185   PORT_KEYDELTA(10)
2186   PORT_PLAYER(2)
21762187
2177   PORT_START_TAG("analog1")
2178   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_PLAYER(1)
2179   PORT_START_TAG("analog2")
2180   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_PLAYER(1)
2181   PORT_START_TAG("analog3")
2182   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_PLAYER(2)
2183   PORT_START_TAG("analog4")
2184   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_PLAYER(2)
2185   // Not used, but are here for completeness
2186   PORT_START_TAG("analog5")
2187   PORT_BIT(0x3f , 0, IPT_PADDLE) PORT_SENSITIVITY(100)
2188   PORT_START_TAG("analog6")
2189   PORT_BIT(0x3f , 0, IPT_PADDLE) PORT_SENSITIVITY(100)
2190   PORT_START_TAG("analog7")
2191   PORT_BIT(0x3f , 0, IPT_PADDLE) PORT_SENSITIVITY(100)
2192   PORT_START_TAG("analog8")
2193   PORT_BIT(0x3f , 0, IPT_PADDLE) PORT_SENSITIVITY(100)
2188   PORT_START_TAG("analog4")
2189   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
2190   PORT_SENSITIVITY(100)
2191   PORT_KEYDELTA(10)
2192   PORT_PLAYER(2)
2193
2194// Not used, but are here for completeness
2195   PORT_START_TAG("analog5")
2196   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
2197   PORT_SENSITIVITY(100)
2198   PORT_KEYDELTA(10)
2199   PORT_PLAYER(3)
2200
2201   PORT_START_TAG("analog6")
2202   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
2203   PORT_SENSITIVITY(100)
2204   PORT_KEYDELTA(10)
2205   PORT_PLAYER(3)
2206
2207   PORT_START_TAG("analog7")
2208   PORT_BIT(0x3f , 0, IPT_TRACKBALL_X)
2209   PORT_SENSITIVITY(100)
2210   PORT_KEYDELTA(10)
2211   PORT_PLAYER(4)
2212
2213   PORT_START_TAG("analog8")
2214   PORT_BIT(0x3f , 0, IPT_TRACKBALL_Y)
2215   PORT_SENSITIVITY(100)
2216   PORT_KEYDELTA(10)
2217   PORT_PLAYER(4)
2218
21942219INPUT_PORTS_END
21952220/* --------------------
21962221   - AY8910_interface -
r1250r1251
22542279    /* video hardware */
22552280   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
22562281   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
2257   MDRV_SCREEN_SIZE(800, 312)
2282   MDRV_SCREEN_SIZE(800, 312)
22582283   /* Amstrad Monitor Visible AREA : 768x272 */
22592284   MDRV_SCREEN_VISIBLE_AREA(0, ((AMSTRAD_SCREEN_WIDTH-32) - 1), 0, ((AMSTRAD_SCREEN_HEIGHT-40) - 1))
22602285   MDRV_PALETTE_LENGTH(32)
r1250r1251
22712296   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
22722297   MDRV_SOUND_ADD(AY8910, 1000000)
22732298   MDRV_SOUND_CONFIG(ay8912_interface)
2274   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
2299   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
22752300MACHINE_DRIVER_END
22762301
22772302
r1250r1251
24692494ROM_END
24702495
24712496/*      YEAR  NAME    PARENT   COMPAT  MACHINE    INPUT    INIT    CONFIG,  COMPANY               FULLNAME */
2472COMP( 1984, cpc464,   0,      0,      amstrad,  amstrad,   0,      cpc6128, "Amstrad plc", "Amstrad/Schneider CPC464", 0)
2473COMP( 1985, cpc664,   cpc464,   0,      amstrad,  amstrad,   0,       cpc6128, "Amstrad plc", "Amstrad/Schneider CPC664", 0)
2474COMP( 1985, cpc6128,  cpc464,   0,      amstrad,  amstrad,   0,       cpc6128, "Amstrad plc", "Amstrad/Schneider CPC6128", 0)
2475COMP( 1985, cpc6128f, cpc464,   0,      amstrad,  amstrad, 0, cpc6128, "Amstrad plc", "Amstrad/Schneider CPC6128 Azerty French Keyboard", 0)
2497COMP( 1984, cpc464,   0,      0,      amstrad,  amstrad,   0,      cpc6128, "Amstrad plc", "Amstrad CPC464", 0)
2498COMP( 1985, cpc664,   cpc464,   0,      amstrad,  amstrad,   0,       cpc6128, "Amstrad plc", "Amstrad CPC664", 0)
2499COMP( 1985, cpc6128,  cpc464,   0,      amstrad,  amstrad,   0,       cpc6128, "Amstrad plc", "Amstrad CPC6128", 0)
2500COMP( 1985, cpc6128f, cpc464,   0,      amstrad,  amstrad, 0, cpc6128, "Amstrad plc", "Amstrad CPC6128 Azerty French Keyboard", 0)
24762501COMP( 1990, cpc464p,  0,      0,      cpcplus,  plus,   0,       cpcplus, "Amstrad plc", "Amstrad CPC464+", 0)
24772502COMP( 1990, cpc6128p, 0,      0,      cpcplus,  plus,   0,       cpcplus, "Amstrad plc", "Amstrad CPC6128+", 0)
24782503COMP( 1989, kccomp,   cpc464,   0,      kccomp,   kccomp,   0,       cpc6128, "VEB Mikroelektronik", "KC Compact", 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team