src/mess/layout/chessmst.lay
| r0 | r11642 | |
| 1 | <?xml version="1.0"?> |
| 2 | <mamelayout version="2"> |
| 3 | <element name="led" defstate="1"> |
| 4 | <disk state="0"> |
| 5 | <color red="0.75" green="0.0" blue="0.0" /> |
| 6 | </disk> |
| 7 | <disk state="1"> |
| 8 | <color red="0.20" green="0.0" blue="0.0" /> |
| 9 | </disk> |
| 10 | </element> |
| 11 | |
| 12 | <element name="str_your"> <text string="YOUR"/> </element> |
| 13 | <element name="str_cm"> <text string="CM"/> </element> |
| 14 | <element name="str_check"> <text string="CHECK"/> </element> |
| 15 | <element name="str_c1"> <text string="C1"/> </element> |
| 16 | <element name="str_c2"> <text string="C2"/> </element> |
| 17 | <element name="str_c3"> <text string="C3"/> </element> |
| 18 | <element name="str_pawn"> <text string="Pawn"/> </element> |
| 19 | <element name="str_rook"> <text string="Rook"/> </element> |
| 20 | <element name="str_knight"> <text string="Knight"/> </element> |
| 21 | <element name="str_bishop"> <text string="Bishop"/> </element> |
| 22 | <element name="str_queen"> <text string="Queen"/> </element> |
| 23 | <element name="str_king"> <text string="King"/> </element> |
| 24 | <element name="str_white"> <text string="White"/> </element> |
| 25 | <element name="str_black"> <text string="Black"/> </element> |
| 26 | <element name="str_changeb"> <text string="CHANGE BOARD"/> </element> |
| 27 | |
| 28 | <element name="background"> |
| 29 | <rect> |
| 30 | <bounds left="0" top="0" right="1" bottom="1" /> |
| 31 | <color red="0.0" green="0.0" blue="0.0" /> |
| 32 | </rect> |
| 33 | </element> |
| 34 | |
| 35 | <view name="Simple Display/LEDs"> |
| 36 | <!-- background --> |
| 37 | <bezel element="background"> |
| 38 | <bounds left="00" top="00" right="100" bottom="80" /> |
| 39 | </bezel> |
| 40 | |
| 41 | <!-- Column A --> |
| 42 | <bezel name="led_a1" element="led" inputtag="COL_A" inputmask="0x80"> |
| 43 | <bounds x="5" y="5" width="2" height="2" /> |
| 44 | </bezel> |
| 45 | <bezel name="led_a2" element="led" inputtag="COL_A" inputmask="0x40"> |
| 46 | <bounds x="5" y="15" width="2" height="2" /> |
| 47 | </bezel> |
| 48 | <bezel name="led_a3" element="led" inputtag="COL_A" inputmask="0x20"> |
| 49 | <bounds x="5" y="25" width="2" height="2" /> |
| 50 | </bezel> |
| 51 | <bezel name="led_a4" element="led" inputtag="COL_A" inputmask="0x10"> |
| 52 | <bounds x="5" y="35" width="2" height="2" /> |
| 53 | </bezel> |
| 54 | <bezel name="led_a5" element="led" inputtag="COL_A" inputmask="0x08"> |
| 55 | <bounds x="5" y="45" width="2" height="2" /> |
| 56 | </bezel> |
| 57 | <bezel name="led_a6" element="led" inputtag="COL_A" inputmask="0x04"> |
| 58 | <bounds x="5" y="55" width="2" height="2" /> |
| 59 | </bezel> |
| 60 | <bezel name="led_a7" element="led" inputtag="COL_A" inputmask="0x02"> |
| 61 | <bounds x="5" y="65" width="2" height="2" /> |
| 62 | </bezel> |
| 63 | <bezel name="led_a8" element="led" inputtag="COL_A" inputmask="0x01"> |
| 64 | <bounds x="5" y="75" width="2" height="2" /> |
| 65 | </bezel> |
| 66 | |
| 67 | <!-- Column B --> |
| 68 | <bezel name="led_b1" element="led" inputtag="COL_B" inputmask="0x80"> |
| 69 | <bounds x="15" y="5" width="2" height="2" /> |
| 70 | </bezel> |
| 71 | <bezel name="led_b2" element="led" inputtag="COL_B" inputmask="0x40"> |
| 72 | <bounds x="15" y="15" width="2" height="2" /> |
| 73 | </bezel> |
| 74 | <bezel name="led_b3" element="led" inputtag="COL_B" inputmask="0x20"> |
| 75 | <bounds x="15" y="25" width="2" height="2" /> |
| 76 | </bezel> |
| 77 | <bezel name="led_b4" element="led" inputtag="COL_B" inputmask="0x10"> |
| 78 | <bounds x="15" y="35" width="2" height="2" /> |
| 79 | </bezel> |
| 80 | <bezel name="led_b5" element="led" inputtag="COL_B" inputmask="0x08"> |
| 81 | <bounds x="15" y="45" width="2" height="2" /> |
| 82 | </bezel> |
| 83 | <bezel name="led_b6" element="led" inputtag="COL_B" inputmask="0x04"> |
| 84 | <bounds x="15" y="55" width="2" height="2" /> |
| 85 | </bezel> |
| 86 | <bezel name="led_b7" element="led" inputtag="COL_B" inputmask="0x02"> |
| 87 | <bounds x="15" y="65" width="2" height="2" /> |
| 88 | </bezel> |
| 89 | <bezel name="led_b8" element="led" inputtag="COL_B" inputmask="0x01"> |
| 90 | <bounds x="15" y="75" width="2" height="2" /> |
| 91 | </bezel> |
| 92 | |
| 93 | <!-- Column C --> |
| 94 | <bezel name="led_c1" element="led" inputtag="COL_C" inputmask="0x80"> |
| 95 | <bounds x="25" y="5" width="2" height="2" /> |
| 96 | </bezel> |
| 97 | <bezel name="led_c2" element="led" inputtag="COL_C" inputmask="0x40"> |
| 98 | <bounds x="25" y="15" width="2" height="2" /> |
| 99 | </bezel> |
| 100 | <bezel name="led_c3" element="led" inputtag="COL_C" inputmask="0x20"> |
| 101 | <bounds x="25" y="25" width="2" height="2" /> |
| 102 | </bezel> |
| 103 | <bezel name="led_c4" element="led" inputtag="COL_C" inputmask="0x10"> |
| 104 | <bounds x="25" y="35" width="2" height="2" /> |
| 105 | </bezel> |
| 106 | <bezel name="led_c5" element="led" inputtag="COL_C" inputmask="0x08"> |
| 107 | <bounds x="25" y="45" width="2" height="2" /> |
| 108 | </bezel> |
| 109 | <bezel name="led_c6" element="led" inputtag="COL_C" inputmask="0x04"> |
| 110 | <bounds x="25" y="55" width="2" height="2" /> |
| 111 | </bezel> |
| 112 | <bezel name="led_c7" element="led" inputtag="COL_C" inputmask="0x02"> |
| 113 | <bounds x="25" y="65" width="2" height="2" /> |
| 114 | </bezel> |
| 115 | <bezel name="led_c8" element="led" inputtag="COL_C" inputmask="0x01"> |
| 116 | <bounds x="25" y="75" width="2" height="2" /> |
| 117 | </bezel> |
| 118 | |
| 119 | <!-- Column D --> |
| 120 | <bezel name="led_d1" element="led" inputtag="COL_D" inputmask="0x80"> |
| 121 | <bounds x="35" y="5" width="2" height="2" /> |
| 122 | </bezel> |
| 123 | <bezel name="led_d2" element="led" inputtag="COL_D" inputmask="0x40"> |
| 124 | <bounds x="35" y="15" width="2" height="2" /> |
| 125 | </bezel> |
| 126 | <bezel name="led_d3" element="led" inputtag="COL_D" inputmask="0x20"> |
| 127 | <bounds x="35" y="25" width="2" height="2" /> |
| 128 | </bezel> |
| 129 | <bezel name="led_d4" element="led" inputtag="COL_D" inputmask="0x10"> |
| 130 | <bounds x="35" y="35" width="2" height="2" /> |
| 131 | </bezel> |
| 132 | <bezel name="led_d5" element="led" inputtag="COL_D" inputmask="0x08"> |
| 133 | <bounds x="35" y="45" width="2" height="2" /> |
| 134 | </bezel> |
| 135 | <bezel name="led_d6" element="led" inputtag="COL_D" inputmask="0x04"> |
| 136 | <bounds x="35" y="55" width="2" height="2" /> |
| 137 | </bezel> |
| 138 | <bezel name="led_d7" element="led" inputtag="COL_D" inputmask="0x02"> |
| 139 | <bounds x="35" y="65" width="2" height="2" /> |
| 140 | </bezel> |
| 141 | <bezel name="led_d8" element="led" inputtag="COL_D" inputmask="0x01"> |
| 142 | <bounds x="35" y="75" width="2" height="2" /> |
| 143 | </bezel> |
| 144 | |
| 145 | <!-- Column E --> |
| 146 | <bezel name="led_e1" element="led" inputtag="COL_E" inputmask="0x80"> |
| 147 | <bounds x="45" y="5" width="2" height="2" /> |
| 148 | </bezel> |
| 149 | <bezel name="led_e2" element="led" inputtag="COL_E" inputmask="0x40"> |
| 150 | <bounds x="45" y="15" width="2" height="2" /> |
| 151 | </bezel> |
| 152 | <bezel name="led_e3" element="led" inputtag="COL_E" inputmask="0x20"> |
| 153 | <bounds x="45" y="25" width="2" height="2" /> |
| 154 | </bezel> |
| 155 | <bezel name="led_e4" element="led" inputtag="COL_E" inputmask="0x10"> |
| 156 | <bounds x="45" y="35" width="2" height="2" /> |
| 157 | </bezel> |
| 158 | <bezel name="led_e5" element="led" inputtag="COL_E" inputmask="0x08"> |
| 159 | <bounds x="45" y="45" width="2" height="2" /> |
| 160 | </bezel> |
| 161 | <bezel name="led_e6" element="led" inputtag="COL_E" inputmask="0x04"> |
| 162 | <bounds x="45" y="55" width="2" height="2" /> |
| 163 | </bezel> |
| 164 | <bezel name="led_e7" element="led" inputtag="COL_E" inputmask="0x02"> |
| 165 | <bounds x="45" y="65" width="2" height="2" /> |
| 166 | </bezel> |
| 167 | <bezel name="led_e8" element="led" inputtag="COL_E" inputmask="0x01"> |
| 168 | <bounds x="45" y="75" width="2" height="2" /> |
| 169 | </bezel> |
| 170 | |
| 171 | <!-- Column F --> |
| 172 | <bezel name="led_f1" element="led" inputtag="COL_F" inputmask="0x80"> |
| 173 | <bounds x="55" y="5" width="2" height="2" /> |
| 174 | </bezel> |
| 175 | <bezel name="led_f2" element="led" inputtag="COL_F" inputmask="0x40"> |
| 176 | <bounds x="55" y="15" width="2" height="2" /> |
| 177 | </bezel> |
| 178 | <bezel name="led_f3" element="led" inputtag="COL_F" inputmask="0x20"> |
| 179 | <bounds x="55" y="25" width="2" height="2" /> |
| 180 | </bezel> |
| 181 | <bezel name="led_f4" element="led" inputtag="COL_F" inputmask="0x10"> |
| 182 | <bounds x="55" y="35" width="2" height="2" /> |
| 183 | </bezel> |
| 184 | <bezel name="led_f5" element="led" inputtag="COL_F" inputmask="0x08"> |
| 185 | <bounds x="55" y="45" width="2" height="2" /> |
| 186 | </bezel> |
| 187 | <bezel name="led_f6" element="led" inputtag="COL_F" inputmask="0x04"> |
| 188 | <bounds x="55" y="55" width="2" height="2" /> |
| 189 | </bezel> |
| 190 | <bezel name="led_f7" element="led" inputtag="COL_F" inputmask="0x02"> |
| 191 | <bounds x="55" y="65" width="2" height="2" /> |
| 192 | </bezel> |
| 193 | <bezel name="led_f8" element="led" inputtag="COL_F" inputmask="0x01"> |
| 194 | <bounds x="55" y="75" width="2" height="2" /> |
| 195 | </bezel> |
| 196 | |
| 197 | <!-- Column G --> |
| 198 | <bezel name="led_g1" element="led" inputtag="COL_G" inputmask="0x80"> |
| 199 | <bounds x="65" y="5" width="2" height="2" /> |
| 200 | </bezel> |
| 201 | <bezel name="led_g2" element="led" inputtag="COL_G" inputmask="0x40"> |
| 202 | <bounds x="65" y="15" width="2" height="2" /> |
| 203 | </bezel> |
| 204 | <bezel name="led_g3" element="led" inputtag="COL_G" inputmask="0x20"> |
| 205 | <bounds x="65" y="25" width="2" height="2" /> |
| 206 | </bezel> |
| 207 | <bezel name="led_g4" element="led" inputtag="COL_G" inputmask="0x10"> |
| 208 | <bounds x="65" y="35" width="2" height="2" /> |
| 209 | </bezel> |
| 210 | <bezel name="led_g5" element="led" inputtag="COL_G" inputmask="0x08"> |
| 211 | <bounds x="65" y="45" width="2" height="2" /> |
| 212 | </bezel> |
| 213 | <bezel name="led_g6" element="led" inputtag="COL_G" inputmask="0x04"> |
| 214 | <bounds x="65" y="55" width="2" height="2" /> |
| 215 | </bezel> |
| 216 | <bezel name="led_g7" element="led" inputtag="COL_G" inputmask="0x02"> |
| 217 | <bounds x="65" y="65" width="2" height="2" /> |
| 218 | </bezel> |
| 219 | <bezel name="led_g8" element="led" inputtag="COL_G" inputmask="0x01"> |
| 220 | <bounds x="65" y="75" width="2" height="2" /> |
| 221 | </bezel> |
| 222 | |
| 223 | <!-- Column H --> |
| 224 | <bezel name="led_h1" element="led" inputtag="COL_H" inputmask="0x80"> |
| 225 | <bounds x="75" y="5" width="2" height="2" /> |
| 226 | </bezel> |
| 227 | <bezel name="led_h2" element="led" inputtag="COL_H" inputmask="0x40"> |
| 228 | <bounds x="75" y="15" width="2" height="2" /> |
| 229 | </bezel> |
| 230 | <bezel name="led_h3" element="led" inputtag="COL_H" inputmask="0x20"> |
| 231 | <bounds x="75" y="25" width="2" height="2" /> |
| 232 | </bezel> |
| 233 | <bezel name="led_h4" element="led" inputtag="COL_H" inputmask="0x10"> |
| 234 | <bounds x="75" y="35" width="2" height="2" /> |
| 235 | </bezel> |
| 236 | <bezel name="led_h5" element="led" inputtag="COL_H" inputmask="0x08"> |
| 237 | <bounds x="75" y="45" width="2" height="2" /> |
| 238 | </bezel> |
| 239 | <bezel name="led_h6" element="led" inputtag="COL_H" inputmask="0x04"> |
| 240 | <bounds x="75" y="55" width="2" height="2" /> |
| 241 | </bezel> |
| 242 | <bezel name="led_h7" element="led" inputtag="COL_H" inputmask="0x02"> |
| 243 | <bounds x="75" y="65" width="2" height="2" /> |
| 244 | </bezel> |
| 245 | <bezel name="led_h8" element="led" inputtag="COL_H" inputmask="0x01"> |
| 246 | <bounds x="75" y="75" width="2" height="2" /> |
| 247 | </bezel> |
| 248 | |
| 249 | <!-- game status LEDs --> |
| 250 | <bezel name="led_j5" element="led"> |
| 251 | <bounds x="85" y="8" width="2" height="2" /> |
| 252 | </bezel> |
| 253 | <bezel name="led_j6" element="led"> |
| 254 | <bounds x="90" y="8" width="2" height="2" /> |
| 255 | </bezel> |
| 256 | <bezel name="led_j7" element="led"> |
| 257 | <bounds x="95" y="8" width="2" height="2" /> |
| 258 | </bezel> |
| 259 | |
| 260 | <bezel name="lbl_your" element="str_your"> |
| 261 | <bounds x="84" y="5" width="4" height="2" /> |
| 262 | </bezel> |
| 263 | <bezel name="lbl_cm" element="str_cm"> |
| 264 | <bounds x="90" y="5" width="2" height="2" /> |
| 265 | </bezel> |
| 266 | <bezel name="lbl_check" element="str_check"> |
| 267 | <bounds x="94" y="5" width="5" height="2" /> |
| 268 | </bezel> |
| 269 | |
| 270 | <!-- command mode LEDs --> |
| 271 | <bezel name="led_j2" element="led"> |
| 272 | <bounds x="85" y="15" width="2" height="2" /> |
| 273 | </bezel> |
| 274 | <bezel name="led_j3" element="led"> |
| 275 | <bounds x="90" y="15" width="2" height="2" /> |
| 276 | </bezel> |
| 277 | <bezel name="led_j4" element="led"> |
| 278 | <bounds x="95" y="15" width="2" height="2" /> |
| 279 | </bezel> |
| 280 | |
| 281 | <bezel name="lbl_c1" element="str_c1"> |
| 282 | <bounds x="85" y="12" width="2" height="2" /> |
| 283 | </bezel> |
| 284 | <bezel name="lbl_c2" element="str_c2"> |
| 285 | <bounds x="90" y="12" width="2" height="2" /> |
| 286 | </bezel> |
| 287 | <bezel name="lbl_c3" element="str_c3"> |
| 288 | <bounds x="95" y="12" width="2" height="2" /> |
| 289 | </bezel> |
| 290 | |
| 291 | <!-- type LEDs --> |
| 292 | <bezel name="led_i1" element="led"> |
| 293 | <bounds x="85" y="20" width="2" height="2" /> |
| 294 | </bezel> |
| 295 | <bezel name="led_i2" element="led"> |
| 296 | <bounds x="85" y="26" width="2" height="2" /> |
| 297 | </bezel> |
| 298 | <bezel name="led_i3" element="led"> |
| 299 | <bounds x="85" y="32" width="2" height="2" /> |
| 300 | </bezel> |
| 301 | <bezel name="led_i4" element="led"> |
| 302 | <bounds x="85" y="38" width="2" height="2" /> |
| 303 | </bezel> |
| 304 | <bezel name="led_i5" element="led"> |
| 305 | <bounds x="85" y="44" width="2" height="2" /> |
| 306 | </bezel> |
| 307 | <bezel name="led_i6" element="led"> |
| 308 | <bounds x="85" y="50" width="2" height="2" /> |
| 309 | </bezel> |
| 310 | <bezel name="led_i7" element="led"> |
| 311 | <bounds x="85" y="56" width="2" height="2" /> |
| 312 | </bezel> |
| 313 | <bezel name="led_i8" element="led"> |
| 314 | <bounds x="85" y="62" width="2" height="2" /> |
| 315 | </bezel> |
| 316 | |
| 317 | <bezel name="lbl_pawn" element="str_pawn"> |
| 318 | <bounds x="88" y="20" width="4" height="2" /> |
| 319 | </bezel> |
| 320 | <bezel name="lbl_knight" element="str_knight"> |
| 321 | <bounds x="88" y="26" width="5" height="2" /> |
| 322 | </bezel> |
| 323 | <bezel name="lbl_bishop" element="str_bishop"> |
| 324 | <bounds x="88" y="32" width="5" height="2" /> |
| 325 | </bezel> |
| 326 | <bezel name="lbl_rook" element="str_rook"> |
| 327 | <bounds x="88" y="38" width="4" height="2" /> |
| 328 | </bezel> |
| 329 | <bezel name="lbl_queen" element="str_queen"> |
| 330 | <bounds x="88" y="44" width="5" height="2" /> |
| 331 | </bezel> |
| 332 | <bezel name="lbl_king" element="str_king"> |
| 333 | <bounds x="88" y="50" width="4" height="2" /> |
| 334 | </bezel> |
| 335 | <bezel name="lbl_white" element="str_white"> |
| 336 | <bounds x="88" y="56" width="5" height="2" /> |
| 337 | </bezel> |
| 338 | <bezel name="lbl_black" element="str_black"> |
| 339 | <bounds x="88" y="62" width="4" height="2" /> |
| 340 | </bezel> |
| 341 | |
| 342 | <!-- change board LED --> |
| 343 | <bezel name="led_j8" element="led"> |
| 344 | <bounds x="89" y="70" width="2" height="2" /> |
| 345 | </bezel> |
| 346 | |
| 347 | <bezel name="lbl_cb" element="str_changeb"> |
| 348 | <bounds x="85" y="67" width="10" height="2" /> |
| 349 | </bezel> |
| 350 | </view> |
| 351 | </mamelayout> |
src/mess/drivers/chessmst.c
| r11641 | r11642 | |
| 2 | 2 | |
| 3 | 3 | Chess-Master |
| 4 | 4 | |
| 5 | | 12/05/2009 Skeleton driver. |
| 5 | TODO: |
| 6 | - add Reset and Halt buttons |
| 7 | - a better artwork |
| 6 | 8 | |
| 7 | 9 | ****************************************************************************/ |
| 8 | 10 | |
| 11 | #define ADDRESS_MAP_MODERN |
| 12 | |
| 9 | 13 | #include "emu.h" |
| 10 | 14 | #include "cpu/z80/z80.h" |
| 15 | #include "machine/z80pio.h" |
| 16 | #include "sound/speaker.h" |
| 17 | #include "chessmst.lh" |
| 11 | 18 | |
| 12 | 19 | |
| 13 | 20 | class chessmst_state : public driver_device |
| 14 | 21 | { |
| 15 | 22 | public: |
| 16 | 23 | chessmst_state(const machine_config &mconfig, device_type type, const char *tag) |
| 17 | | : driver_device(mconfig, type, tag) { } |
| 24 | : driver_device(mconfig, type, tag), |
| 25 | m_speaker(*this, "speaker") |
| 26 | { } |
| 18 | 27 | |
| 28 | required_device<device_t> m_speaker; |
| 29 | |
| 30 | UINT16 m_matrix; |
| 31 | UINT16 m_led_sel; |
| 32 | UINT8 m_sensor[64]; |
| 33 | |
| 34 | virtual void machine_reset(); |
| 35 | |
| 36 | DECLARE_WRITE8_MEMBER( pio1_port_a_w ); |
| 37 | DECLARE_WRITE8_MEMBER( pio1_port_b_w ); |
| 38 | DECLARE_READ8_MEMBER( pio2_port_a_r ); |
| 39 | DECLARE_WRITE8_MEMBER( pio2_port_b_w ); |
| 19 | 40 | }; |
| 20 | 41 | |
| 21 | 42 | |
| 22 | | static ADDRESS_MAP_START(chessmst_mem, AS_PROGRAM, 8) |
| 43 | static ADDRESS_MAP_START(chessmst_mem, AS_PROGRAM, 8, chessmst_state) |
| 23 | 44 | ADDRESS_MAP_UNMAP_HIGH |
| 45 | ADDRESS_MAP_GLOBAL_MASK(0x7fff) // A15 not connected |
| 24 | 46 | AM_RANGE( 0x0000, 0x27ff ) AM_ROM |
| 25 | | AM_RANGE( 0x2800, 0x3fff ) AM_RAM |
| 47 | AM_RANGE( 0x3400, 0x3bff ) AM_RAM |
| 26 | 48 | ADDRESS_MAP_END |
| 27 | 49 | |
| 28 | | static ADDRESS_MAP_START( chessmst_io , AS_IO, 8) |
| 50 | static ADDRESS_MAP_START( chessmst_io , AS_IO, 8, chessmst_state) |
| 29 | 51 | ADDRESS_MAP_UNMAP_HIGH |
| 52 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 53 | //AM_RANGE(0x00, 0x03) AM_MIRROR(0xf0) read/write in both, not used by the software |
| 54 | AM_RANGE(0x04, 0x07) AM_MIRROR(0xf0) AM_DEVREADWRITE_LEGACY("z80pio1", z80pio_cd_ba_r, z80pio_cd_ba_w) |
| 55 | AM_RANGE(0x08, 0x0b) AM_MIRROR(0xf0) AM_DEVREADWRITE_LEGACY("z80pio2", z80pio_cd_ba_r, z80pio_cd_ba_w) |
| 30 | 56 | ADDRESS_MAP_END |
| 31 | 57 | |
| 58 | static INPUT_CHANGED( chessmst_sensor ) |
| 59 | { |
| 60 | chessmst_state *state = field.machine().driver_data<chessmst_state>(); |
| 61 | UINT8 pos = (UINT8)(FPTR)param; |
| 62 | |
| 63 | if (newval) |
| 64 | { |
| 65 | state->m_sensor[pos] = !state->m_sensor[pos]; |
| 66 | } |
| 67 | } |
| 68 | |
| 32 | 69 | /* Input ports */ |
| 33 | 70 | static INPUT_PORTS_START( chessmst ) |
| 71 | PORT_START("COL_A") |
| 72 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 0) |
| 73 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 1) |
| 74 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 2) |
| 75 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 3) |
| 76 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 4) |
| 77 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 5) |
| 78 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 6) |
| 79 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 7) |
| 80 | PORT_START("COL_B") |
| 81 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 8) |
| 82 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 9) |
| 83 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 10) |
| 84 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 11) |
| 85 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 12) |
| 86 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 13) |
| 87 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 14) |
| 88 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 15) |
| 89 | PORT_START("COL_C") |
| 90 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 16) |
| 91 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 17) |
| 92 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 18) |
| 93 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 19) |
| 94 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 20) |
| 95 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 21) |
| 96 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 22) |
| 97 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 23) |
| 98 | PORT_START("COL_D") |
| 99 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 24) |
| 100 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 25) |
| 101 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 26) |
| 102 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 27) |
| 103 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 28) |
| 104 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 29) |
| 105 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 30) |
| 106 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 31) |
| 107 | PORT_START("COL_E") |
| 108 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 32) |
| 109 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 33) |
| 110 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 34) |
| 111 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 35) |
| 112 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 36) |
| 113 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 37) |
| 114 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 38) |
| 115 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 39) |
| 116 | PORT_START("COL_F") |
| 117 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 40) |
| 118 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 41) |
| 119 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 42) |
| 120 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 43) |
| 121 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 44) |
| 122 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 45) |
| 123 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 46) |
| 124 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 47) |
| 125 | PORT_START("COL_G") |
| 126 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 48) |
| 127 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 49) |
| 128 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 50) |
| 129 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 51) |
| 130 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 52) |
| 131 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 53) |
| 132 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 54) |
| 133 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 55) |
| 134 | PORT_START("COL_H") |
| 135 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 56) |
| 136 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 57) |
| 137 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 58) |
| 138 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 59) |
| 139 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 60) |
| 140 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 61) |
| 141 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 62) |
| 142 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CHANGED(chessmst_sensor, 63) |
| 143 | |
| 144 | PORT_START("BUTTONS") |
| 145 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hint [7]") PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_H) |
| 146 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Random [6]") PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_R) |
| 147 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Referee [5]") PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_F) |
| 148 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Selfplay [4]") PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_S) |
| 149 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Board [3]") PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_B) |
| 150 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Color [2]") PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_C) |
| 151 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Level [1]") PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_L) |
| 152 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("New Game [0]") PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_ENTER) |
| 34 | 153 | INPUT_PORTS_END |
| 35 | 154 | |
| 155 | void chessmst_state::machine_reset() |
| 156 | { |
| 157 | //reset all sensors |
| 158 | memset(m_sensor, 1, sizeof(m_sensor)); |
| 36 | 159 | |
| 37 | | static MACHINE_RESET(chessmst) |
| 160 | //positioning the pieces for start next game |
| 161 | for (int i=0; i<64; i+=8) |
| 162 | m_sensor[i+0] = m_sensor[i+1] = m_sensor[i+6] = m_sensor[i+7] = 0; |
| 163 | } |
| 164 | |
| 165 | WRITE8_MEMBER( chessmst_state::pio1_port_a_w ) |
| 38 | 166 | { |
| 167 | for (int row=1; row<=8; row++) |
| 168 | { |
| 169 | if (m_led_sel & 0x01) |
| 170 | output_set_indexed_value("led_a", row, BIT(data, 8-row)); |
| 171 | if (m_led_sel & 0x02) |
| 172 | output_set_indexed_value("led_b", row, BIT(data, 8-row)); |
| 173 | if (m_led_sel & 0x04) |
| 174 | output_set_indexed_value("led_c", row, BIT(data, 8-row)); |
| 175 | if (m_led_sel & 0x08) |
| 176 | output_set_indexed_value("led_d", row, BIT(data, 8-row)); |
| 177 | if (m_led_sel & 0x10) |
| 178 | output_set_indexed_value("led_e", row, BIT(data, 8-row)); |
| 179 | if (m_led_sel & 0x20) |
| 180 | output_set_indexed_value("led_f", row, BIT(data, 8-row)); |
| 181 | if (m_led_sel & 0x40) |
| 182 | output_set_indexed_value("led_g", row, BIT(data, 8-row)); |
| 183 | if (m_led_sel & 0x80) |
| 184 | output_set_indexed_value("led_h", row, BIT(data, 8-row)); |
| 185 | if (m_led_sel & 0x100) |
| 186 | output_set_indexed_value("led_i", row, BIT(data, 8-row)); |
| 187 | if (m_led_sel & 0x200) |
| 188 | output_set_indexed_value("led_j", row, BIT(data, 8-row)); |
| 189 | } |
| 190 | |
| 191 | m_led_sel = 0; |
| 39 | 192 | } |
| 40 | 193 | |
| 41 | | static VIDEO_START( chessmst ) |
| 194 | WRITE8_MEMBER( chessmst_state::pio1_port_b_w ) |
| 42 | 195 | { |
| 196 | m_matrix = (m_matrix & 0xff) | ((data & 0x01)<<8); |
| 197 | m_led_sel = (m_led_sel & 0xff) | ((data & 0x03)<<8); |
| 198 | |
| 199 | speaker_level_w(m_speaker, BIT(data, 6)); |
| 200 | }; |
| 201 | |
| 202 | READ8_MEMBER( chessmst_state::pio2_port_a_r ) |
| 203 | { |
| 204 | UINT8 data = 0x00; |
| 205 | |
| 206 | // The pieces position on the chessboard is identified by 64 Hall |
| 207 | // sensors, which are in a 8x8 matrix with the corresponding LEDs. |
| 208 | for (int i=0; i<8; i++) |
| 209 | { |
| 210 | if (m_matrix & 0x01) |
| 211 | data |= (m_sensor[0+i] ? (1<<i) : 0); |
| 212 | if (m_matrix & 0x02) |
| 213 | data |= (m_sensor[8+i] ? (1<<i) : 0); |
| 214 | if (m_matrix & 0x04) |
| 215 | data |= (m_sensor[16+i] ? (1<<i) : 0); |
| 216 | if (m_matrix & 0x08) |
| 217 | data |= (m_sensor[24+i] ? (1<<i) : 0); |
| 218 | if (m_matrix & 0x10) |
| 219 | data |= (m_sensor[32+i] ? (1<<i) : 0); |
| 220 | if (m_matrix & 0x20) |
| 221 | data |= (m_sensor[40+i] ? (1<<i) : 0); |
| 222 | if (m_matrix & 0x40) |
| 223 | data |= (m_sensor[48+i] ? (1<<i) : 0); |
| 224 | if (m_matrix & 0x80) |
| 225 | data |= (m_sensor[56+i] ? (1<<i) : 0); |
| 226 | } |
| 227 | |
| 228 | if (m_matrix & 0x100) |
| 229 | data |= input_port_read(machine(), "BUTTONS"); |
| 230 | |
| 231 | return data; |
| 43 | 232 | } |
| 44 | 233 | |
| 45 | | static SCREEN_UPDATE( chessmst ) |
| 234 | WRITE8_MEMBER( chessmst_state::pio2_port_b_w ) |
| 46 | 235 | { |
| 47 | | return 0; |
| 236 | m_matrix = (data & 0xff) | (m_matrix & 0x100); |
| 237 | m_led_sel = (data & 0xff) | (m_led_sel & 0x300); |
| 48 | 238 | } |
| 49 | 239 | |
| 240 | static Z80PIO_INTERFACE( pio1_intf ) |
| 241 | { |
| 242 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), // callback when change interrupt status |
| 243 | DEVCB_NULL, // port A read callback |
| 244 | DEVCB_DRIVER_MEMBER(chessmst_state, pio1_port_a_w), // port A write callback |
| 245 | DEVCB_NULL, // portA ready active callback |
| 246 | DEVCB_NULL, // port B read callback |
| 247 | DEVCB_DRIVER_MEMBER(chessmst_state, pio1_port_b_w), // port B write callback |
| 248 | DEVCB_NULL // portB ready active callback |
| 249 | }; |
| 250 | |
| 251 | static Z80PIO_INTERFACE( pio2_intf ) |
| 252 | { |
| 253 | DEVCB_NULL, // callback when change interrupt status |
| 254 | DEVCB_DRIVER_MEMBER(chessmst_state, pio2_port_a_r), // port A read callback |
| 255 | DEVCB_NULL, // port A write callback |
| 256 | DEVCB_NULL, // portA ready active callback |
| 257 | DEVCB_NULL, // port B read callback |
| 258 | DEVCB_DRIVER_MEMBER(chessmst_state, pio2_port_b_w), // port B write callback |
| 259 | DEVCB_NULL // portB ready active callback |
| 260 | }; |
| 261 | |
| 50 | 262 | static MACHINE_CONFIG_START( chessmst, chessmst_state ) |
| 51 | 263 | /* basic machine hardware */ |
| 52 | 264 | MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 53 | 265 | MCFG_CPU_PROGRAM_MAP(chessmst_mem) |
| 54 | 266 | MCFG_CPU_IO_MAP(chessmst_io) |
| 55 | 267 | |
| 56 | | MCFG_MACHINE_RESET(chessmst) |
| 57 | | |
| 58 | 268 | /* video hardware */ |
| 59 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 60 | | MCFG_SCREEN_REFRESH_RATE(50) |
| 61 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 62 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 63 | | MCFG_SCREEN_SIZE(640, 480) |
| 64 | | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 65 | | MCFG_SCREEN_UPDATE(chessmst) |
| 269 | MCFG_DEFAULT_LAYOUT(layout_chessmst) |
| 66 | 270 | |
| 67 | | MCFG_PALETTE_LENGTH(2) |
| 68 | | MCFG_PALETTE_INIT(black_and_white) |
| 271 | /* sound hardware */ |
| 272 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 273 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 274 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 69 | 275 | |
| 70 | | MCFG_VIDEO_START(chessmst) |
| 276 | /* Devices */ |
| 277 | MCFG_Z80PIO_ADD("z80pio1", XTAL_4MHz, pio1_intf) |
| 278 | MCFG_Z80PIO_ADD("z80pio2", XTAL_4MHz, pio2_intf) |
| 71 | 279 | MACHINE_CONFIG_END |
| 72 | 280 | |
| 73 | 281 | /* ROM definition */ |
| r11641 | r11642 | |
| 83 | 291 | ROM_LOAD( "063.bin", 0x1c00, 0x0400, CRC(86be4cdb) SHA1(741f984c15c6841e227a8722ba30cf9e6b86d878)) |
| 84 | 292 | ROM_LOAD( "064.bin", 0x2000, 0x0400, CRC(e82f5480) SHA1(38a939158052f5e6484ee3725b86e522541fe4aa)) |
| 85 | 293 | ROM_LOAD( "065.bin", 0x2400, 0x0400, CRC(4ec0e92c) SHA1(0b748231a50777391b04c1778750fbb46c21bee8)) |
| 86 | | |
| 87 | 294 | ROM_END |
| 88 | 295 | |
| 89 | 296 | /* Driver */ |
| 90 | 297 | |
| 91 | 298 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 92 | | COMP( 1984, chessmst, 0, 0, chessmst, chessmst, 0, "VEB Mikroelektronik Erfurt", "Chess-Master", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 299 | COMP( 1984, chessmst, 0, 0, chessmst, chessmst, 0, "VEB Mikroelektronik Erfurt", "Chess-Master", GAME_NOT_WORKING ) |
| 93 | 300 | |