src/mess/drivers/ptcsol.c
| r10175 | r10176 | |
| 105 | 105 | UINT8 m_sol20_fa; |
| 106 | 106 | UINT8 m_sol20_fc; |
| 107 | 107 | UINT8 m_sol20_fe; |
| 108 | UINT8 m_s4; |
| 108 | 109 | const UINT8 *FNT; |
| 109 | 110 | const UINT8 *m_videoram; |
| 110 | 111 | UINT8 m_framecnt; |
| r10175 | r10176 | |
| 321 | 322 | PORT_DIPSETTING( 0x30, DEF_STR(None)) |
| 322 | 323 | |
| 323 | 324 | PORT_START("S2") // Sense Switches |
| 324 | | PORT_DIPNAME( 0x01, 0x00, "FF bit 0") |
| 325 | PORT_DIPNAME( 0x01, 0x01, "FF bit 0") |
| 325 | 326 | PORT_DIPSETTING( 0x01, DEF_STR(Off)) |
| 326 | 327 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 327 | | PORT_DIPNAME( 0x02, 0x00, "FF bit 1") |
| 328 | PORT_DIPNAME( 0x02, 0x02, "FF bit 1") |
| 328 | 329 | PORT_DIPSETTING( 0x02, DEF_STR(Off)) |
| 329 | 330 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 330 | | PORT_DIPNAME( 0x04, 0x00, "FF bit 2") |
| 331 | PORT_DIPNAME( 0x04, 0x04, "FF bit 2") |
| 331 | 332 | PORT_DIPSETTING( 0x04, DEF_STR(Off)) |
| 332 | 333 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 333 | | PORT_DIPNAME( 0x08, 0x00, "FF bit 3") |
| 334 | PORT_DIPNAME( 0x08, 0x08, "FF bit 3") |
| 334 | 335 | PORT_DIPSETTING( 0x08, DEF_STR(Off)) |
| 335 | 336 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 336 | | PORT_DIPNAME( 0x10, 0x00, "FF bit 4") |
| 337 | PORT_DIPNAME( 0x10, 0x10, "FF bit 4") |
| 337 | 338 | PORT_DIPSETTING( 0x10, DEF_STR(Off)) |
| 338 | 339 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 339 | | PORT_DIPNAME( 0x20, 0x00, "FF bit 5") |
| 340 | PORT_DIPNAME( 0x20, 0x20, "FF bit 5") |
| 340 | 341 | PORT_DIPSETTING( 0x20, DEF_STR(Off)) |
| 341 | 342 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 342 | | PORT_DIPNAME( 0x40, 0x00, "FF bit 6") |
| 343 | PORT_DIPNAME( 0x40, 0x40, "FF bit 6") |
| 343 | 344 | PORT_DIPSETTING( 0x40, DEF_STR(Off)) |
| 344 | 345 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 345 | | PORT_DIPNAME( 0x80, 0x00, "FF bit 7") |
| 346 | PORT_DIPNAME( 0x80, 0x80, "FF bit 7") |
| 346 | 347 | PORT_DIPSETTING( 0x80, DEF_STR(Off)) |
| 347 | 348 | PORT_DIPSETTING( 0x00, DEF_STR(On)) |
| 348 | 349 | |
| 349 | 350 | PORT_START("S3") |
| 350 | 351 | PORT_DIPNAME( 0xff, 0x08, "Baud Rate") |
| 351 | | PORT_DIPSETTING( 0x01, "110") |
| 352 | | PORT_DIPSETTING( 0x02, "150") |
| 352 | PORT_DIPSETTING( 0x01, "75") |
| 353 | PORT_DIPSETTING( 0x02, "110") |
| 353 | 354 | PORT_DIPSETTING( 0x04, "180") |
| 354 | 355 | PORT_DIPSETTING( 0x08, "300") |
| 355 | 356 | PORT_DIPSETTING( 0x10, "600") |
| r10175 | r10176 | |
| 362 | 363 | PORT_DIPSETTING( 0x00, DEF_STR(None)) |
| 363 | 364 | PORT_DIPSETTING( 0x10, "Odd") |
| 364 | 365 | PORT_DIPSETTING( 0x11, "Even") |
| 365 | | PORT_DIPNAME( 0x06, 0x00, "Data Bits") |
| 366 | PORT_DIPNAME( 0x06, 0x06, "Data Bits") |
| 366 | 367 | PORT_DIPSETTING( 0x00, "5") |
| 367 | 368 | PORT_DIPSETTING( 0x02, "6") |
| 368 | 369 | PORT_DIPSETTING( 0x04, "7") |
| 369 | 370 | PORT_DIPSETTING( 0x06, "8") |
| 370 | | PORT_DIPNAME( 0x08, 0x00, "Stop Bits") |
| 371 | PORT_DIPNAME( 0x08, 0x08, "Stop Bits") |
| 371 | 372 | PORT_DIPSETTING( 0x00, "1") |
| 372 | 373 | PORT_DIPSETTING( 0x08, "2") |
| 373 | 374 | PORT_DIPNAME( 0x20, 0x00, "Duplex") |
| r10175 | r10176 | |
| 416 | 417 | static MACHINE_RESET( sol20 ) |
| 417 | 418 | { |
| 418 | 419 | sol20_state *state = machine->driver_data<sol20_state>(); |
| 420 | UINT8 data = 0, s_count = 0; |
| 421 | int s_clock; |
| 422 | const UINT16 s_bauds[8]={ 75, 110, 180, 300, 600, 1200, 2400, 4800 }; |
| 419 | 423 | state->m_sol20_fe=0; |
| 420 | 424 | state->m_sol20_fa=1; |
| 425 | |
| 421 | 426 | // set hard-wired uart pins |
| 422 | 427 | ay31015_set_input_pin( state->m_uart, AY31015_CS, 0 ); |
| 423 | 428 | ay31015_set_input_pin( state->m_uart, AY31015_NB1, 1); |
| r10175 | r10176 | |
| 426 | 431 | ay31015_set_input_pin( state->m_uart, AY31015_EPS, 1); |
| 427 | 432 | ay31015_set_input_pin( state->m_uart, AY31015_NP, 1); |
| 428 | 433 | ay31015_set_input_pin( state->m_uart, AY31015_CS, 1 ); |
| 434 | |
| 435 | // set switched uart pins |
| 436 | data = input_port_read(machine, "S4"); |
| 437 | ay31015_set_input_pin( state->m_uart_s, AY31015_CS, 0 ); |
| 438 | ay31015_set_input_pin( state->m_uart_s, AY31015_NB1, BIT(data, 1) ? 1 : 0); |
| 439 | ay31015_set_input_pin( state->m_uart_s, AY31015_NB2, BIT(data, 2) ? 1 : 0); |
| 440 | ay31015_set_input_pin( state->m_uart_s, AY31015_TSB, BIT(data, 3) ? 1 : 0); |
| 441 | ay31015_set_input_pin( state->m_uart_s, AY31015_EPS, BIT(data, 0) ? 1 : 0); |
| 442 | ay31015_set_input_pin( state->m_uart_s, AY31015_NP, BIT(data, 4) ? 1 : 0); |
| 443 | ay31015_set_input_pin( state->m_uart_s, AY31015_CS, 1 ); |
| 444 | |
| 445 | // set rs232 baud rate |
| 446 | data = input_port_read(machine, "S3"); |
| 447 | |
| 448 | if (data > 1) |
| 449 | do |
| 450 | { |
| 451 | s_count++; |
| 452 | data >>= 1; |
| 453 | } |
| 454 | while (!(data & 1) && (s_count < 7)); // find which switch is used |
| 455 | |
| 456 | if ((s_count == 7) && (input_port_read(machine, "CONFIG"))) // if highest, look at jumper |
| 457 | s_clock = 9600 << 4; |
| 458 | else |
| 459 | s_clock = s_bauds[s_count] << 4; |
| 460 | |
| 461 | // these lines could be commented out for now if you want better performance |
| 462 | ay31015_set_receiver_clock( state->m_uart_s, s_clock); |
| 463 | ay31015_set_transmitter_clock( state->m_uart_s, s_clock); |
| 464 | |
| 465 | // video dips |
| 466 | state->m_s4 = input_port_read(machine, "S1"); |
| 467 | |
| 429 | 468 | // boot-bank |
| 430 | 469 | memory_set_bank(machine, "boot", 1); |
| 431 | 470 | timer_set(machine, ATTOTIME_IN_USEC(9), NULL, 0, sol20_boot); |
| r10175 | r10176 | |
| 449 | 488 | /* visible screen is 64 x 16, with start position controlled by scroll register */ |
| 450 | 489 | UINT8 y,ra,chr,gfx; |
| 451 | 490 | UINT16 sy=0,ma,x,inv; |
| 491 | UINT8 ctrl_off = state->m_s4 & 4; |
| 492 | UINT8 polarity = (state->m_s4 & 8) ? 0xff : 0; |
| 452 | 493 | |
| 453 | 494 | state->m_framecnt++; |
| 454 | 495 | |
| r10175 | r10176 | |
| 462 | 503 | |
| 463 | 504 | for (x = ma; x < ma + 64; x++) |
| 464 | 505 | { |
| 506 | inv = polarity; |
| 465 | 507 | chr = state->m_videoram[x & 0x3ff]; |
| 466 | | inv = 0; |
| 467 | 508 | |
| 468 | 509 | /* Take care of flashing characters */ |
| 469 | 510 | //if ((chr & 0x80) && (state->m_framecnt & 0x08)) |
| r10175 | r10176 | |
| 472 | 513 | |
| 473 | 514 | chr &= 0x7f; |
| 474 | 515 | |
| 475 | | if (ra == 0) |
| 476 | | gfx = 0; |
| 516 | if ((ra == 0) || ((ctrl_off) && (chr < 0x20))) |
| 517 | gfx = inv; |
| 477 | 518 | else |
| 478 | 519 | if (ra < 10) |
| 479 | 520 | gfx = state->FNT[(chr<<4) | (ra-1) ] ^ inv; |