src/mess/layout/sc1.lay
| r13851 | r13852 | |
| 1 | 1 | <?xml version="1.0"?>
|
| 2 | 2 | <mamelayout version="2">
|
| 3 | | <element name="g_led" defstate="0">
|
| 4 | | <disk>
|
| 5 | | <color red="0.0" green="0.75" blue="0.0" />
|
| 6 | | </disk>
|
| 7 | | </element>
|
| 8 | | <element name="g_digit" defstate="0">
|
| 3 | <element name="digit" defstate="0">
|
| 9 | 4 | <led7seg>
|
| 10 | | <color red="0.75" green="0.5" blue="0.0" />
|
| 5 | <color red="0.75" green="0.75" blue="0.0" />
|
| 11 | 6 | </led7seg>
|
| 12 | 7 | </element>
|
| 13 | | <element name="r_digit" defstate="0">
|
| 14 | | <led7seg>
|
| 15 | | <color red="0.75" green="0.0" blue="0.0" />
|
| 16 | | </led7seg>
|
| 8 | <element name="led" defstate="0">
|
| 9 | <disk state="1">
|
| 10 | <color red="0.8" green="0.8" blue="0.0" />
|
| 11 | </disk>
|
| 12 | <disk state="0">
|
| 13 | <color red="0.2" green="0.2" blue="0.0" />
|
| 14 | </disk>
|
| 17 | 15 | </element>
|
| 16 | <element name="schach">
|
| 17 | <text string="SCHACH">
|
| 18 | <color red="1.0" green="1.0" blue="1.0" /></text>
|
| 19 | </element>
|
| 20 | <element name="matt">
|
| 21 | <text string="MATT">
|
| 22 | <color red="1.0" green="1.0" blue="1.0" /></text>
|
| 23 | </element>
|
| 18 | 24 | <element name="background">
|
| 19 | 25 | <rect>
|
| 20 | 26 | <bounds left="0" top="0" right="1" bottom="1" />
|
| r13851 | r13852 | |
| 25 | 31 | <view name="Default Layout">
|
| 26 | 32 | <!-- Black background -->
|
| 27 | 33 | <bezel element="background">
|
| 28 | | <bounds left="64" top="95" right="453" bottom="195" />
|
| 34 | <bounds left="00" top="00" right="240" bottom="95" />
|
| 29 | 35 | </bezel>
|
| 30 | | <bezel name="busy_led" element="g_led">
|
| 31 | | <bounds left="76" right="96" top="130" bottom="150" />
|
| 32 | | </bezel>
|
| 33 | 36 | |
| 34 | | <bezel name="digit0" element="r_digit">
|
| 35 | | <bounds left="107" top="105" right="155" bottom="185" />
|
| 37 | <bezel name="digit0" element="digit">
|
| 38 | <bounds x="10" y="10" width="50" height="80" />
|
| 36 | 39 | </bezel>
|
| 37 | | <bezel name="digit6" element="r_digit">
|
| 38 | | <bounds left="155" top="105" right="203" bottom="185" />
|
| 40 | <bezel name="digit1" element="digit">
|
| 41 | <bounds x="70" y="10" width="50" height="80" />
|
| 39 | 42 | </bezel>
|
| 40 | | <bezel name="digit5" element="r_digit">
|
| 41 | | <bounds left="203" top="105" right="251" bottom="185" />
|
| 43 | <bezel name="digit2" element="digit">
|
| 44 | <bounds x="130" y="10" width="50" height="80" />
|
| 42 | 45 | </bezel>
|
| 43 | | <bezel name="digit4" element="r_digit">
|
| 44 | | <bounds left="251" top="105" right="299" bottom="185" />
|
| 46 | <bezel name="digit3" element="digit">
|
| 47 | <bounds x="190" y="10" width="50" height="80" />
|
| 45 | 48 | </bezel>
|
| 46 | | <bezel name="digit3" element="g_digit">
|
| 47 | | <bounds left="347" top="105" right="395" bottom="185" />
|
| 49 | <bezel name="led0" element="led">
|
| 50 | <bounds x="10" y="95" width="10" height="10" />
|
| 48 | 51 | </bezel>
|
| 49 | | <bezel name="digit1" element="g_digit">
|
| 50 | | <bounds left="395" top="105" right="443" bottom="185" />
|
| 52 | <bezel name="led1" element="led">
|
| 53 | <bounds x="220" y="95" width="10" height="10" />
|
| 51 | 54 | </bezel>
|
| 55 | <bezel name="schach_str" element="schach">
|
| 56 | <bounds x="20" y="95" width="40" height="10" />
|
| 57 | </bezel>
|
| 58 | <bezel name="matt_str" element="matt">
|
| 59 | <bounds x="185" y="95" width="40" height="10" />
|
| 60 | </bezel>
|
| 52 | 61 | </view>
|
| 53 | 62 | </mamelayout>
|
src/mess/drivers/sc1.c
| r13851 | r13852 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | 7 | ToDo: |
| 8 | | - Everything I/O related (ROM & RAM are correct) |
| 9 | | - Display |
| 10 | | - Inputs |
| 11 | | - Layout (was copied from slc1; needs to be made suitable for sc1) |
| 8 | - speaker |
| 9 | - LEDs |
| 10 | - 7seg sometimes flashes |
| 12 | 11 | |
| 13 | 12 | Port 80-83 could be a device |
| 14 | 13 | |
| r13851 | r13852 | |
| 39 | 38 | #include "emu.h" |
| 40 | 39 | #include "cpu/z80/z80.h" |
| 41 | 40 | #include "sound/speaker.h" |
| 41 | #include "machine/z80pio.h" |
| 42 | 42 | #include "sc1.lh" |
| 43 | 43 | |
| 44 | 44 | |
| r13851 | r13852 | |
| 53 | 53 | |
| 54 | 54 | required_device<cpu_device> m_maincpu; |
| 55 | 55 | required_device<device_t> m_speaker; |
| 56 | |
| 57 | DECLARE_WRITE8_MEMBER( matrix_w ); |
| 58 | DECLARE_WRITE8_MEMBER( pio_port_a_w ); |
| 59 | DECLARE_READ8_MEMBER( pio_port_b_r ); |
| 60 | |
| 61 | UINT8 m_matrix; |
| 56 | 62 | }; |
| 57 | 63 | |
| 58 | 64 | /*************************************************************************** |
| r13851 | r13852 | |
| 61 | 67 | |
| 62 | 68 | ***************************************************************************/ |
| 63 | 69 | |
| 70 | WRITE8_MEMBER( sc1_state::pio_port_a_w ) |
| 71 | { |
| 72 | UINT8 digit = BITSWAP8( data,3,4,6,0,1,2,7,5 ); |
| 64 | 73 | |
| 74 | if (m_matrix & 0x04) |
| 75 | output_set_digit_value(3, digit & 0x7f); |
| 76 | if (m_matrix & 0x08) |
| 77 | output_set_digit_value(2, digit & 0x7f); |
| 78 | if (m_matrix & 0x10) |
| 79 | output_set_digit_value(1, digit & 0x7f); |
| 80 | if (m_matrix & 0x20) |
| 81 | output_set_digit_value(0, digit & 0x7f); |
| 82 | } |
| 65 | 83 | |
| 66 | 84 | |
| 67 | 85 | /*************************************************************************** |
| r13851 | r13852 | |
| 70 | 88 | |
| 71 | 89 | ***************************************************************************/ |
| 72 | 90 | |
| 91 | WRITE8_MEMBER( sc1_state::matrix_w ) |
| 92 | { |
| 93 | m_matrix = data; |
| 94 | } |
| 73 | 95 | |
| 96 | READ8_MEMBER( sc1_state::pio_port_b_r ) |
| 97 | { |
| 98 | UINT8 data = 0; |
| 99 | |
| 100 | if (m_matrix & 0x01) |
| 101 | data |= input_port_read(machine(), "LINE1"); |
| 102 | if (m_matrix & 0x02) |
| 103 | data |= input_port_read(machine(), "LINE2"); |
| 104 | if (m_matrix & 0x04) |
| 105 | data |= input_port_read(machine(), "LINE3"); |
| 106 | if (m_matrix & 0x08) |
| 107 | data |= input_port_read(machine(), "LINE4"); |
| 108 | if (m_matrix & 0x10) |
| 109 | data |= input_port_read(machine(), "LINE5"); |
| 110 | if (m_matrix & 0x20) |
| 111 | data |= input_port_read(machine(), "LINE6"); |
| 112 | if (m_matrix & 0x40) |
| 113 | data |= input_port_read(machine(), "LINE7"); |
| 114 | if (m_matrix & 0x80) |
| 115 | data |= input_port_read(machine(), "LINE8"); |
| 116 | |
| 117 | return data; |
| 118 | } |
| 119 | |
| 120 | |
| 74 | 121 | static ADDRESS_MAP_START(sc1_mem, AS_PROGRAM, 8, sc1_state) |
| 75 | 122 | ADDRESS_MAP_UNMAP_HIGH |
| 76 | 123 | AM_RANGE( 0x0000, 0x0fff ) AM_ROM |
| r13851 | r13852 | |
| 80 | 127 | static ADDRESS_MAP_START(sc1_io, AS_IO, 8, sc1_state) |
| 81 | 128 | ADDRESS_MAP_UNMAP_HIGH |
| 82 | 129 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 130 | AM_RANGE(0x80, 0x83) AM_DEVREADWRITE_LEGACY("z80pio", z80pio_ba_cd_r, z80pio_ba_cd_w) |
| 131 | AM_RANGE(0xfc, 0xfc) AM_WRITE(matrix_w) |
| 83 | 132 | ADDRESS_MAP_END |
| 84 | 133 | |
| 85 | 134 | /* Input ports */ |
| 86 | 135 | static INPUT_PORTS_START( sc1 ) |
| 136 | PORT_START("LINE1") |
| 137 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_UNUSED |
| 138 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D4") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_D) |
| 139 | |
| 140 | PORT_START("LINE2") |
| 141 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B2") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_B) |
| 142 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F6") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_F) |
| 143 | |
| 144 | PORT_START("LINE3") |
| 145 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C3") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_C) |
| 146 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_G) |
| 147 | |
| 148 | PORT_START("LINE4") |
| 149 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A1") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_A) |
| 150 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E5") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_E) |
| 151 | |
| 152 | PORT_START("LINE5") |
| 153 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_H) |
| 154 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE") PORT_CODE(KEYCODE_DEL) |
| 155 | |
| 156 | PORT_START("LINE6") |
| 157 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 158 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER) |
| 159 | |
| 160 | PORT_START("LINE7") |
| 161 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("P") PORT_CODE(KEYCODE_O) |
| 162 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("W/S") PORT_CODE(KEYCODE_W) |
| 163 | |
| 164 | PORT_START("LINE8") |
| 165 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| 166 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C") PORT_CODE(KEYCODE_M) |
| 87 | 167 | INPUT_PORTS_END |
| 88 | 168 | |
| 89 | 169 | |
| 90 | | static MACHINE_RESET(sc1) |
| 170 | static Z80PIO_INTERFACE( pio_intf ) |
| 91 | 171 | { |
| 92 | | } |
| 172 | DEVCB_NULL, /* callback when change interrupt status */ |
| 173 | DEVCB_NULL, /* port A read callback */ |
| 174 | DEVCB_DRIVER_MEMBER(sc1_state, pio_port_a_w), /* port A write callback */ |
| 175 | DEVCB_NULL, /* portA ready active callback */ |
| 176 | DEVCB_DRIVER_MEMBER(sc1_state, pio_port_b_r), /* port B read callback */ |
| 177 | DEVCB_NULL, /* port B write callback */ |
| 178 | DEVCB_NULL /* portB ready active callback */ |
| 179 | }; |
| 93 | 180 | |
| 181 | |
| 94 | 182 | static MACHINE_CONFIG_START( sc1, sc1_state ) |
| 95 | 183 | /* basic machine hardware */ |
| 96 | 184 | MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 97 | 185 | MCFG_CPU_PROGRAM_MAP(sc1_mem) |
| 98 | 186 | MCFG_CPU_IO_MAP(sc1_io) |
| 99 | 187 | |
| 100 | | MCFG_MACHINE_RESET(sc1) |
| 101 | | |
| 102 | 188 | /* video hardware */ |
| 103 | 189 | MCFG_DEFAULT_LAYOUT(layout_sc1) |
| 104 | 190 | |
| 191 | /* devices */ |
| 192 | MCFG_Z80PIO_ADD("z80pio", XTAL_4MHz, pio_intf) |
| 193 | |
| 105 | 194 | /* sound hardware */ |
| 106 | 195 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 107 | 196 | MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) |