src/mess/drivers/bw2.c
| r0 | r2211 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | drivers/bw2.c |
| 4 | |
| 5 | Bondwell BW 2 |
| 6 | |
| 7 | - Z80L CPU 4MHz |
| 8 | - 64KB RAM, expandable to 224KB RAM. |
| 9 | - 4KB System ROM |
| 10 | - MSM6255 LCD controller, 640x200 pixels |
| 11 | - 16KB Video RAM |
| 12 | - TMS2797 FDC controller |
| 13 | - 8251 USART serial interface |
| 14 | - 8253 PIT timer |
| 15 | - 8255 PPI |
| 16 | |
| 17 | http://www.thebattles.net/bondwell/ |
| 18 | |
| 19 | http://www.vintage-computer.com/bondwell2.shtml |
| 20 | |
| 21 | TODO: |
| 22 | - Add LCD controller |
| 23 | |
| 24 | http://www2.okisemi.com/site/productscatalog/displaydrivers/availabledocuments/Intro-7090.html |
| 25 | ***************************************************************************/ |
| 26 | |
| 27 | #include "driver.h" |
| 28 | #include "cpu/z80/z80.h" |
| 29 | #include "includes/serial.h" |
| 30 | #include "machine/8255ppi.h" |
| 31 | #include "machine/centroni.h" |
| 32 | #include "machine/msm8251.h" |
| 33 | #include "machine/wd17xx.h" |
| 34 | #include "machine/pit8253.h" |
| 35 | #include "devices/basicdsk.h" |
| 36 | #include "devices/printer.h" |
| 37 | |
| 38 | |
| 39 | /* Memory */ |
| 40 | |
| 41 | static void bw2_set_banks(UINT8 data) |
| 42 | { |
| 43 | /* |
| 44 | Y0 /RAM1 Memory bank 1 |
| 45 | Y1 /VRAM Video memory |
| 46 | Y2 /RAM2 Memory bank 2 |
| 47 | Y3 /RAM3 Memory bank 3 |
| 48 | Y4 /RAM4 Memory bank 4 |
| 49 | Y5 /RAM5 Memory bank 5 |
| 50 | Y6 /RAM6 Memory bank 6 |
| 51 | */ |
| 52 | |
| 53 | memory_set_bank(1, data); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | /* Serial */ |
| 58 | |
| 59 | static DEVICE_IMAGE_LOAD( bw2_serial ) |
| 60 | { |
| 61 | /* filename specified */ |
| 62 | if (serial_device_load(image) == INIT_PASS) |
| 63 | { |
| 64 | /* setup transmit parameters */ |
| 65 | serial_device_setup(image, 9600 >> readinputportbytag("BAUD"), 8, 1, SERIAL_PARITY_NONE); |
| 66 | |
| 67 | /* connect serial chip to serial device */ |
| 68 | msm8251_connect_to_serial_device(image); |
| 69 | |
| 70 | serial_device_set_protocol(image, SERIAL_PROTOCOL_NONE); |
| 71 | |
| 72 | /* and start transmit */ |
| 73 | serial_device_set_transmit_state(image, 1); |
| 74 | |
| 75 | return INIT_PASS; |
| 76 | } |
| 77 | |
| 78 | return INIT_FAIL; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | /* Floppy */ |
| 83 | |
| 84 | static DEVICE_IMAGE_LOAD( bw2_floppy ) |
| 85 | { |
| 86 | if (image_has_been_created(image)) { |
| 87 | return INIT_FAIL; |
| 88 | } |
| 89 | |
| 90 | if (image_length(image) == 80*1*18*256) |
| 91 | { |
| 92 | if (device_load_basicdsk_floppy(image) == INIT_PASS) |
| 93 | { |
| 94 | basicdsk_set_geometry(image, 80, 1, 18, 256, 1, 0, FALSE); |
| 95 | return INIT_PASS; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return INIT_FAIL; |
| 100 | } |
| 101 | |
| 102 | static void bw2_wd17xx_callback(running_machine *machine, wd17xx_state_t state, void *param) |
| 103 | { |
| 104 | switch(state) |
| 105 | { |
| 106 | case WD17XX_IRQ_CLR: |
| 107 | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 108 | break; |
| 109 | case WD17XX_IRQ_SET: |
| 110 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 111 | break; |
| 112 | case WD17XX_DRQ_CLR: |
| 113 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE); |
| 114 | break; |
| 115 | case WD17XX_DRQ_SET: |
| 116 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE); |
| 117 | break; |
| 118 | } |
| 119 | |
| 120 | } |
| 121 | |
| 122 | static READ8_HANDLER( bw2_wd2797_r ) |
| 123 | { |
| 124 | UINT8 result = 0xff; |
| 125 | |
| 126 | switch(offset & 0x03) |
| 127 | { |
| 128 | case 0: |
| 129 | result = wd17xx_status_r(machine, 0); |
| 130 | break; |
| 131 | case 1: |
| 132 | result = wd17xx_track_r(machine, 0); |
| 133 | break; |
| 134 | case 2: |
| 135 | result = wd17xx_sector_r(machine, 0); |
| 136 | break; |
| 137 | case 3: |
| 138 | result = wd17xx_data_r(machine, 0); |
| 139 | break; |
| 140 | } |
| 141 | |
| 142 | return result; |
| 143 | } |
| 144 | |
| 145 | static WRITE8_HANDLER( bw2_wd2797_w ) |
| 146 | { |
| 147 | switch(offset & 0x3) |
| 148 | { |
| 149 | case 0: |
| 150 | wd17xx_command_w(machine, 0, data); |
| 151 | |
| 152 | /* disk head is encoded in the command byte */ |
| 153 | wd17xx_set_side((data & 0x02) ? 1 : 0); |
| 154 | break; |
| 155 | case 1: |
| 156 | wd17xx_track_w(machine, 0, data); |
| 157 | break; |
| 158 | case 2: |
| 159 | wd17xx_sector_w(machine, 0, data); |
| 160 | break; |
| 161 | case 3: |
| 162 | wd17xx_data_w(machine, 0, data); |
| 163 | break; |
| 164 | }; |
| 165 | } |
| 166 | |
| 167 | |
| 168 | /* PPI */ |
| 169 | |
| 170 | static WRITE8_HANDLER( bw2_ppi8255_a_w ) |
| 171 | { |
| 172 | /* |
| 173 | PA0 KB0 Keyboard line select 0 |
| 174 | PA1 KB1 Keyboard line select 1 |
| 175 | PA2 KB2 Keyboard line select 2 |
| 176 | PA3 KB3 Keyboard line select 3 |
| 177 | PA4 /DS0 Drive select 0 |
| 178 | PA5 /DS1 Drive select 1 |
| 179 | PA6 Select RS232 connector |
| 180 | PA7 /STROBE to centronics printer |
| 181 | */ |
| 182 | |
| 183 | switch (~data & 0x30 << 4) |
| 184 | { |
| 185 | case 0: |
| 186 | wd17xx_set_drive(0); |
| 187 | break; |
| 188 | case 1: |
| 189 | wd17xx_set_drive(1); |
| 190 | break; |
| 191 | } |
| 192 | |
| 193 | /* assumption: select is tied low */ |
| 194 | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT | CENTRONICS_NO_RESET); |
| 195 | centronics_write_handshake(0, (data & 0x80) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE); |
| 196 | } |
| 197 | |
| 198 | static READ8_HANDLER( bw2_ppi8255_b_r ) |
| 199 | { |
| 200 | /* |
| 201 | PB0 Keyboard column status of selected line |
| 202 | PB1 Keyboard column status of selected line |
| 203 | PB2 Keyboard column status of selected line |
| 204 | PB3 Keyboard column status of selected line |
| 205 | PB4 Keyboard column status of selected line |
| 206 | PB5 Keyboard column status of selected line |
| 207 | PB6 Keyboard column status of selected line |
| 208 | PB7 Keyboard column status of selected line |
| 209 | */ |
| 210 | |
| 211 | UINT8 row; |
| 212 | |
| 213 | row = ppi8255_peek(0, 0) & 0x0f; |
| 214 | if (row <= 9) |
| 215 | { |
| 216 | return readinputport(row); |
| 217 | } |
| 218 | |
| 219 | return 0xff; |
| 220 | } |
| 221 | |
| 222 | static WRITE8_HANDLER( bw2_ppi8255_c_w ) |
| 223 | { |
| 224 | /* |
| 225 | PC0 Memory bank select |
| 226 | PC1 Memory bank select |
| 227 | PC2 Memory bank select |
| 228 | PC3 Not connected |
| 229 | */ |
| 230 | |
| 231 | bw2_set_banks(data & 0x07); |
| 232 | } |
| 233 | |
| 234 | static READ8_HANDLER( bw2_ppi8255_c_r ) |
| 235 | { |
| 236 | /* |
| 237 | PC4 BUSY from centronics printer |
| 238 | PC5 MTFDBK motor feedback |
| 239 | PC6 RLSD Carrier detect from RS232 |
| 240 | PC7 /PROT Write protected disk |
| 241 | */ |
| 242 | |
| 243 | UINT8 data; |
| 244 | |
| 245 | /* assumption: select is tied low */ |
| 246 | centronics_write_handshake(0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT | CENTRONICS_NO_RESET); |
| 247 | data = ((centronics_read_handshake(0) & CENTRONICS_NOT_BUSY) == 0) ? 0x10 : 0; |
| 248 | |
| 249 | return data; |
| 250 | } |
| 251 | |
| 252 | static const ppi8255_interface bw2_ppi8255_interface = |
| 253 | { |
| 254 | 1, |
| 255 | { NULL }, |
| 256 | { bw2_ppi8255_b_r }, |
| 257 | { bw2_ppi8255_c_r }, |
| 258 | { bw2_ppi8255_a_w }, |
| 259 | { NULL }, |
| 260 | { bw2_ppi8255_c_w }, |
| 261 | }; |
| 262 | |
| 263 | |
| 264 | /* PIT */ |
| 265 | |
| 266 | static void bw2_timer0_w(int state) |
| 267 | { |
| 268 | msm8251_transmit_clock(); |
| 269 | msm8251_receive_clock(); |
| 270 | } |
| 271 | |
| 272 | static void bw2_timer2_w(int state) |
| 273 | { |
| 274 | |
| 275 | } |
| 276 | |
| 277 | static const struct pit8253_config bw2_pit8253_interface = |
| 278 | { |
| 279 | TYPE8253, |
| 280 | { |
| 281 | { |
| 282 | XTAL_4MHz, /* 8251 USART TXC, RXC */ |
| 283 | bw2_timer0_w, |
| 284 | NULL |
| 285 | }, |
| 286 | { |
| 287 | 11000, /* LCD controller */ |
| 288 | NULL, |
| 289 | NULL |
| 290 | }, |
| 291 | { |
| 292 | 3, /* Floppy /MTRON */ |
| 293 | bw2_timer2_w, |
| 294 | NULL |
| 295 | } |
| 296 | } |
| 297 | }; |
| 298 | |
| 299 | |
| 300 | /* USART */ |
| 301 | |
| 302 | static const struct msm8251_interface bw2_msm8251_interface = |
| 303 | { |
| 304 | NULL, |
| 305 | NULL, |
| 306 | NULL |
| 307 | }; |
| 308 | |
| 309 | |
| 310 | /* Printer */ |
| 311 | |
| 312 | static const CENTRONICS_CONFIG bw2_centronics_config[1] = |
| 313 | { |
| 314 | { |
| 315 | PRINTER_IBM, |
| 316 | NULL |
| 317 | } |
| 318 | }; |
| 319 | |
| 320 | static WRITE8_HANDLER( bw2_centronics_data_w ) |
| 321 | { |
| 322 | centronics_write_data(0, data); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | /* Video */ |
| 327 | |
| 328 | static VIDEO_START( bw2 ) |
| 329 | { |
| 330 | } |
| 331 | |
| 332 | static VIDEO_UPDATE( bw2 ) |
| 333 | { |
| 334 | return 0; |
| 335 | } |
| 336 | |
| 337 | static WRITE8_HANDLER( bw2_msm6255_lcd_data_w ) |
| 338 | { |
| 339 | logerror("MSM6255 LCD - data write = %02x\n", data); |
| 340 | } |
| 341 | |
| 342 | static WRITE8_HANDLER( bw2_msm6255_lcd_instr_w ) |
| 343 | { |
| 344 | logerror("MSM6255 LCD - instr write = %02x\n", data); |
| 345 | } |
| 346 | |
| 347 | |
| 348 | /* Machine */ |
| 349 | |
| 350 | static DRIVER_INIT( bw2 ) |
| 351 | { |
| 352 | videoram_size = 0x4000; |
| 353 | videoram = auto_malloc(videoram_size); |
| 354 | } |
| 355 | |
| 356 | static MACHINE_RESET( bw2 ) |
| 357 | { |
| 358 | memory_set_bank(1, 0); |
| 359 | } |
| 360 | |
| 361 | static MACHINE_START( bw2 ) |
| 362 | { |
| 363 | centronics_config(0, bw2_centronics_config); |
| 364 | |
| 365 | msm8251_init(&bw2_msm8251_interface); |
| 366 | pit8253_init(0, &bw2_pit8253_interface); |
| 367 | |
| 368 | ppi8255_init(&bw2_ppi8255_interface); |
| 369 | |
| 370 | wd17xx_init(machine, WD_TYPE_2793, bw2_wd17xx_callback, NULL); |
| 371 | wd17xx_set_density(DEN_FM_HI); |
| 372 | |
| 373 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0); |
| 374 | memory_configure_bank(1, 1, 1, videoram, 0); |
| 375 | memory_configure_bank(1, 2, 6, mess_ram, 0); |
| 376 | } |
| 377 | |
| 378 | static ADDRESS_MAP_START( bw2_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 379 | ADDRESS_MAP_UNMAP_HIGH |
| 380 | AM_RANGE(0x0000, 0x7fff) AM_RAMBANK(1) |
| 381 | AM_RANGE(0x8000, 0xffff) AM_RAM |
| 382 | ADDRESS_MAP_END |
| 383 | |
| 384 | static ADDRESS_MAP_START( bw2_io, ADDRESS_SPACE_IO, 8 ) |
| 385 | ADDRESS_MAP_UNMAP_HIGH |
| 386 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 387 | AM_RANGE( 0x00, 0x03 ) AM_READWRITE( ppi8255_0_r, ppi8255_0_w ) |
| 388 | // AM_RANGE( 0x10, 0x13 ) AM_READWRITE( pit8253_0_r, pit8253_0_w ) |
| 389 | AM_RANGE( 0x20, 0x20 ) AM_WRITE( bw2_msm6255_lcd_data_w ) |
| 390 | AM_RANGE( 0x21, 0x21 ) AM_WRITE( bw2_msm6255_lcd_instr_w ) |
| 391 | AM_RANGE( 0x40, 0x40 ) AM_READWRITE( msm8251_data_r, msm8251_data_w ) |
| 392 | AM_RANGE( 0x41, 0x41 ) AM_READWRITE( msm8251_status_r, msm8251_control_w ) |
| 393 | AM_RANGE( 0x50, 0x50 ) AM_WRITE( bw2_centronics_data_w ) |
| 394 | AM_RANGE( 0x60, 0x63 ) AM_READWRITE( bw2_wd2797_r, bw2_wd2797_w ) |
| 395 | ADDRESS_MAP_END |
| 396 | |
| 397 | /* |
| 398 | Keyboard matrix |
| 399 | X0 X1 X2 X3 X4 X5 X6 X7 |
| 400 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 401 | Y9 |CAPS | | | | | | | | |
| 402 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 403 | Y8 |SHIFT| |SPACE| Z | A | Q | 2 " | F1 | |
| 404 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 405 | Y7 |CTRL | - = | \ | | X | S | W | 3 # | F2 | |
| 406 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 407 | Y6 | @ ` | P | UP | C | D | E | 4 $ | F3 | |
| 408 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 409 | Y5 | 1 ! | | | V | F | R | 5 % | F4 | |
| 410 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 411 | Y4 | ESC | | | B | G | T | 6 & | F5 | |
| 412 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 413 | Y3 | TAB | : * |ENTER| N | H | Y | 7 ´ | F6 | |
| 414 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 415 | Y2 |DOWN | ^ ~ | [ { | M | J | U | 8 ( | F7 | |
| 416 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 417 | Y1 |RIGHT| ; + | ] } | , < | K | I | 9 ) | F8 | |
| 418 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 419 | Y0 |LEFT | BS | / ? | . > | L | O | 0 _ | DEL | |
| 420 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 421 | */ |
| 422 | |
| 423 | static INPUT_PORTS_START( bw2 ) |
| 424 | PORT_START /* 0 */ |
| 425 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) |
| 426 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) |
| 427 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) |
| 428 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) |
| 429 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l L") PORT_CODE(KEYCODE_L) |
| 430 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o O") PORT_CODE(KEYCODE_O) |
| 431 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 _") PORT_CODE(KEYCODE_0) |
| 432 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) |
| 433 | PORT_START /* 1 */ |
| 434 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) |
| 435 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) |
| 436 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 437 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) |
| 438 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k K") PORT_CODE(KEYCODE_K) |
| 439 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i I") PORT_CODE(KEYCODE_I) |
| 440 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) |
| 441 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) |
| 442 | PORT_START /* 2 */ |
| 443 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) |
| 444 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^ ~") PORT_CODE(KEYCODE_TILDE) |
| 445 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) |
| 446 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m M") PORT_CODE(KEYCODE_M) |
| 447 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j J") PORT_CODE(KEYCODE_J) |
| 448 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u U") PORT_CODE(KEYCODE_U) |
| 449 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) |
| 450 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) |
| 451 | PORT_START /* 3 */ |
| 452 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) |
| 453 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_EQUALS) |
| 454 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) |
| 455 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n N") PORT_CODE(KEYCODE_N) |
| 456 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h H") PORT_CODE(KEYCODE_H) |
| 457 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y Y") PORT_CODE(KEYCODE_Y) |
| 458 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 '") PORT_CODE(KEYCODE_7) |
| 459 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) |
| 460 | PORT_START /* 4 */ |
| 461 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) |
| 462 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 463 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| 464 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b B") PORT_CODE(KEYCODE_B) |
| 465 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g G") PORT_CODE(KEYCODE_G) |
| 466 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t T") PORT_CODE(KEYCODE_T) |
| 467 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) |
| 468 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) |
| 469 | PORT_START /* 5 */ |
| 470 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) |
| 471 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 472 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| 473 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v V") PORT_CODE(KEYCODE_V) |
| 474 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f F") PORT_CODE(KEYCODE_F) |
| 475 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r R") PORT_CODE(KEYCODE_R) |
| 476 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) |
| 477 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) |
| 478 | PORT_START /* 6 */ |
| 479 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ `") PORT_CODE(KEYCODE_QUOTE) |
| 480 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p P") PORT_CODE(KEYCODE_P) |
| 481 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) |
| 482 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c C") PORT_CODE(KEYCODE_C) |
| 483 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d D") PORT_CODE(KEYCODE_D) |
| 484 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e E") PORT_CODE(KEYCODE_E) |
| 485 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) |
| 486 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) |
| 487 | PORT_START /* 7 */ |
| 488 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) |
| 489 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("- =") PORT_CODE(KEYCODE_MINUS) |
| 490 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\ |") PORT_CODE(KEYCODE_BACKSLASH) |
| 491 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x X") PORT_CODE(KEYCODE_X) |
| 492 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s S") PORT_CODE(KEYCODE_S) |
| 493 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w W") PORT_CODE(KEYCODE_W) |
| 494 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) |
| 495 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) |
| 496 | PORT_START /* 8 */ |
| 497 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) |
| 498 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 499 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) |
| 500 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z Z") PORT_CODE(KEYCODE_Z) |
| 501 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a A") PORT_CODE(KEYCODE_A) |
| 502 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q Q") PORT_CODE(KEYCODE_Q) |
| 503 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) |
| 504 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) |
| 505 | PORT_START /* 9 */ |
| 506 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) |
| 507 | PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 508 | PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| 509 | PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_UNUSED) |
| 510 | PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_UNUSED) |
| 511 | PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_UNUSED) |
| 512 | PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 513 | PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 514 | PORT_START_TAG("BAUD") |
| 515 | PORT_CONFNAME( 0x05, 0x05, "Baud rate") |
| 516 | PORT_CONFSETTING( 0x00, "9600 baud" ) |
| 517 | PORT_CONFSETTING( 0x01, "4800 baud" ) |
| 518 | PORT_CONFSETTING( 0x02, "2400 baud" ) |
| 519 | PORT_CONFSETTING( 0x03, "1200 baud" ) |
| 520 | PORT_CONFSETTING( 0x04, "600 baud" ) |
| 521 | PORT_CONFSETTING( 0x05, "300 baud" ) |
| 522 | INPUT_PORTS_END |
| 523 | |
| 524 | static MACHINE_DRIVER_START( bw2 ) |
| 525 | /* basic machine hardware */ |
| 526 | MDRV_CPU_ADD_TAG( "main", Z80, XTAL_16MHz/4 ) |
| 527 | MDRV_CPU_PROGRAM_MAP( bw2_mem, 0 ) |
| 528 | MDRV_CPU_IO_MAP( bw2_io, 0 ) |
| 529 | |
| 530 | MDRV_MACHINE_START( bw2 ) |
| 531 | MDRV_MACHINE_RESET( bw2 ) |
| 532 | |
| 533 | /* video hardware */ |
| 534 | MDRV_SCREEN_ADD( "main", LCD ) |
| 535 | MDRV_SCREEN_REFRESH_RATE( 60 ) |
| 536 | MDRV_SCREEN_FORMAT( BITMAP_FORMAT_INDEXED16 ) |
| 537 | MDRV_SCREEN_SIZE( 640, 200 ) |
| 538 | MDRV_SCREEN_VISIBLE_AREA( 0, 640-1, 0, 200-1 ) |
| 539 | |
| 540 | MDRV_PALETTE_LENGTH( 2 ) |
| 541 | MDRV_PALETTE_INIT( black_and_white ) |
| 542 | MDRV_VIDEO_START( bw2 ) |
| 543 | MDRV_VIDEO_UPDATE( bw2 ) |
| 544 | MACHINE_DRIVER_END |
| 545 | |
| 546 | /*************************************************************************** |
| 547 | |
| 548 | System driver(s) |
| 549 | |
| 550 | ***************************************************************************/ |
| 551 | |
| 552 | ROM_START( bw2 ) |
| 553 | ROM_REGION(0x1000, REGION_CPU1, 0) |
| 554 | ROM_SYSTEM_BIOS(0, "20", "BW 2 v2.0") |
| 555 | ROMX_LOAD("bw2-20.bin", 0x0000, 0x1000, CRC(86f36471) SHA1(a3e2ba4edd50ff8424bb0675bdbb3b9f13c04c9d), ROM_BIOS(1)) |
| 556 | ROM_SYSTEM_BIOS(1, "12", "BW 2 v1.2") |
| 557 | ROMX_LOAD("bw2-12.bin", 0x0000, 0x1000, CRC(0ab42d10) SHA1(430b232631eee9b715151b8d191b7eb9449ac513), ROM_BIOS(2)) |
| 558 | ROM_END |
| 559 | |
| 560 | static void bw2_printer_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 561 | { |
| 562 | /* printer */ |
| 563 | switch(state) |
| 564 | { |
| 565 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 566 | case MESS_DEVINFO_INT_COUNT: |
| 567 | info->i = 1; |
| 568 | break; |
| 569 | |
| 570 | default: |
| 571 | printer_device_getinfo(devclass, state, info); |
| 572 | break; |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | static void bw2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 577 | { |
| 578 | /* floppy */ |
| 579 | switch(state) |
| 580 | { |
| 581 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 582 | case MESS_DEVINFO_INT_COUNT: |
| 583 | info->i = 2; |
| 584 | break; |
| 585 | |
| 586 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 587 | case MESS_DEVINFO_PTR_LOAD: |
| 588 | info->load = device_load_bw2_floppy; |
| 589 | break; |
| 590 | |
| 591 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 592 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: |
| 593 | strcpy(info->s = device_temp_str(), "dsk"); |
| 594 | break; |
| 595 | |
| 596 | default: |
| 597 | legacybasicdsk_device_getinfo(devclass, state, info); |
| 598 | break; |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | static void bw2_serial_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 603 | { |
| 604 | /* serial */ |
| 605 | switch(state) |
| 606 | { |
| 607 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 608 | case MESS_DEVINFO_INT_TYPE: |
| 609 | info->i = IO_SERIAL; |
| 610 | break; |
| 611 | case MESS_DEVINFO_INT_READABLE: |
| 612 | info->i = 1; |
| 613 | break; |
| 614 | case MESS_DEVINFO_INT_WRITEABLE: |
| 615 | info->i = 0; |
| 616 | break; |
| 617 | case MESS_DEVINFO_INT_CREATABLE: |
| 618 | info->i = 0; |
| 619 | break; |
| 620 | case MESS_DEVINFO_INT_COUNT: |
| 621 | info->i = 1; |
| 622 | break; |
| 623 | |
| 624 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 625 | case MESS_DEVINFO_PTR_START: |
| 626 | info->start = DEVICE_START_NAME(serial_device); |
| 627 | break; |
| 628 | case MESS_DEVINFO_PTR_LOAD: |
| 629 | info->load = device_load_bw2_serial; |
| 630 | break; |
| 631 | case MESS_DEVINFO_PTR_UNLOAD: |
| 632 | info->unload = serial_device_unload; |
| 633 | break; |
| 634 | |
| 635 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 636 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: |
| 637 | strcpy(info->s = device_temp_str(), "txt"); |
| 638 | break; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | SYSTEM_CONFIG_START( bw2 ) |
| 643 | CONFIG_DEVICE( bw2_printer_getinfo ) |
| 644 | CONFIG_DEVICE( bw2_floppy_getinfo ) |
| 645 | CONFIG_DEVICE( bw2_serial_getinfo ) |
| 646 | CONFIG_RAM_DEFAULT( 64 * 1024 ) |
| 647 | CONFIG_RAM( 96 * 1024 ) |
| 648 | CONFIG_RAM( 128 * 1024 ) |
| 649 | CONFIG_RAM( 160 * 1024 ) |
| 650 | CONFIG_RAM( 192 * 1024 ) |
| 651 | CONFIG_RAM( 224 * 1024 ) |
| 652 | SYSTEM_CONFIG_END |
| 653 | |
| 654 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 655 | COMP( 1985, bw2, 0, 0, bw2, bw2, bw2, bw2, "Bondwell", "BW 2", GAME_NOT_WORKING ) |