src/mess/drivers/socrates.c
| r5331 | r5332 | |
| 89 | 89 | UINT8 ram_bank; |
| 90 | 90 | UINT16 scroll_offset; |
| 91 | 91 | UINT8* videoram; |
| 92 | UINT8 kb_latch_low; |
| 93 | UINT8 kb_latch_high; |
| 94 | UINT8 kb_latch_mouse; |
| 92 | 95 | } socrates={ {0}}; |
| 93 | 96 | |
| 94 | 97 | static void socrates_set_rom_bank( running_machine *machine ) |
| r5331 | r5332 | |
| 108 | 111 | socrates_set_rom_bank( machine ); |
| 109 | 112 | socrates.ram_bank = 0; // the actual console sets it semi randomly on power up, and the bios cleans it up. |
| 110 | 113 | socrates_set_ram_bank( machine ); |
| 114 | socrates.kb_latch_low = 0; // this is really random on startup but its best to set it to the 'sane' 00 01 value |
| 115 | socrates.kb_latch_high = 1; // this is really random on startup but its best to set it to the 'sane' 00 01 value |
| 116 | socrates.kb_latch_mouse = 0; |
| 111 | 117 | } |
| 112 | 118 | |
| 113 | 119 | DRIVER_INIT( socrates ) |
| r5331 | r5332 | |
| 159 | 165 | |
| 160 | 166 | READ8_HANDLER( socrates_keyboard_50_r ) // keyboard code low |
| 161 | 167 | { |
| 162 | | return 0x00; // write me! |
| 168 | return socrates.kb_latch_low; |
| 163 | 169 | } |
| 164 | 170 | |
| 165 | 171 | READ8_HANDLER( socrates_keyboard_51_r ) // keyboard code high |
| 166 | 172 | { |
| 167 | | return 0x01; // write me! |
| 173 | return socrates.kb_latch_high; |
| 168 | 174 | } |
| 169 | 175 | |
| 170 | | WRITE8_HANDLER( socrates_keyboard_reset ) // keyboard latch reset |
| 176 | WRITE8_HANDLER( socrates_keyboard_clear ) // keyboard latch clear (or show mouse coords next if they have updated) |
| 171 | 177 | { |
| 172 | | //popmessage("kb latch reset!"); |
| 178 | if ((data&0x2) == 0x2) |
| 179 | { |
| 180 | if (socrates.kb_latch_mouse == 0) |
| 181 | { |
| 182 | socrates.kb_latch_low = 0; |
| 183 | socrates.kb_latch_high = 1; |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | socrates.kb_latch_low = socrates.kb_latch_mouse&0xFF; // y coord |
| 188 | socrates.kb_latch_high = (socrates.kb_latch_mouse&0xFF00)>>8; // x coord |
| 189 | socrates.kb_latch_mouse = 0; |
| 190 | } |
| 191 | } |
| 173 | 192 | } |
| 174 | 193 | |
| 175 | 194 | WRITE8_HANDLER( unknown_6x ) // writes to i/o 0x6x happens on startup once, with 0x01. no idea what it does. |
| r5331 | r5332 | |
| 204 | 223 | #define CHROMA_COL_2 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, 0.125125, 0.27525, 0.230225, 0.384875, |
| 205 | 224 | #define CHROMA_COL_5 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, 0.1235, 0.2695, 0.22625, 0.378, |
| 206 | 225 | // gamma: this needs to be messed with... may differ on different systems... attach to slider somehow? |
| 207 | | #define GAMMA 1.3 |
| 226 | #define GAMMA 1.5 |
| 208 | 227 | |
| 209 | 228 | static rgb_t socrates_create_color(UINT8 color) |
| 210 | 229 | { |
| r5331 | r5332 | |
| 386 | 405 | */ |
| 387 | 406 | AM_RANGE(0x30, 0x30) AM_READWRITE(read_f3, unknownlatch_30) AM_MIRROR (0xf) /* unknown, write only */ |
| 388 | 407 | //AM_RANGE(0x40, 0x40) AM_RAM AM_MIRROR(0xF)/* unknown, read and write low 4 bits plus bit 5, bit 7 seems to be fixed at 0, bit 6 and 4 are fixed at 1? is this some sort of control register for timers perhaps? gets a slew of data written to it a few times during startup, may be IR or timer related? */ |
| 389 | | AM_RANGE(0x50, 0x50) AM_READWRITE(socrates_keyboard_50_r, socrates_keyboard_reset) AM_MIRROR(0xE) /* Keyboard keycode low, latched on keypress, can only be unlatched by writing 00 here */ |
| 390 | | AM_RANGE(0x51, 0x51) AM_READ(socrates_keyboard_51_r) AM_MIRROR(0xE) /* Keyboard keycode high, latched as above */ |
| 408 | AM_RANGE(0x50, 0x50) AM_READWRITE(socrates_keyboard_50_r, socrates_keyboard_clear) AM_MIRROR(0xE) /* Keyboard keycode low, latched on keypress, can only be unlatched by writing 0F here */ |
| 409 | AM_RANGE(0x51, 0x51) AM_READWRITE(socrates_keyboard_51_r, socrates_keyboard_clear) AM_MIRROR(0xE) /* Keyboard keycode high, latched as above */ |
| 391 | 410 | AM_RANGE(0x60, 0x60) AM_READWRITE(read_f3, unknown_6x) AM_MIRROR(0xF) /* unknown, write only */ |
| 392 | 411 | AM_RANGE(0x70, 0xFF) AM_READ(read_f3) // nothing mapped here afaik |
| 393 | 412 | ADDRESS_MAP_END |
| r5331 | r5332 | |
| 397 | 416 | Input Ports |
| 398 | 417 | ******************************************************************************/ |
| 399 | 418 | |
| 419 | /* socrates keyboard codes: |
| 420 | keycode low |
| 421 | | keycode high |
| 422 | | | key name |
| 423 | 00 01 No key pressed |
| 424 | // pads on the sides of the kb; this acts like a giant bitfield, both dpads/buttons can send data at once |
| 425 | 00 81 left dpad right |
| 426 | 00 82 left dpad up |
| 427 | 00 84 left dpad down |
| 428 | 00 88 left dpad left |
| 429 | 01 80 right dpad down |
| 430 | 02 80 right dpad left |
| 431 | 04 80 right dpad up |
| 432 | 08 80 right dpad right |
| 433 | 10 80 left red button |
| 434 | 20 80 right red button |
| 435 | // top row (right to left) |
| 436 | 44 82 ENTER |
| 437 | 44 83 MENU |
| 438 | 44 84 ANSWER |
| 439 | 44 85 HELP |
| 440 | 44 86 ERASE |
| 441 | 44 87 divide_sign |
| 442 | 44 88 multiply_sign |
| 443 | 44 89 minus_sign |
| 444 | 44 80 plus_sign |
| 445 | //second row (right to left) |
| 446 | 43 81 0 |
| 447 | 43 82 9 |
| 448 | 43 83 8 |
| 449 | 43 84 7 |
| 450 | 43 85 6 |
| 451 | 43 86 5 |
| 452 | 43 87 4 |
| 453 | 43 88 3 |
| 454 | 43 89 2 |
| 455 | 43 80 1 |
| 456 | // third row (right to left) |
| 457 | 42 82 I/La |
| 458 | 42 83 H/So |
| 459 | 42 84 G/Fa |
| 460 | 42 85 F/Mi |
| 461 | 42 86 E/Re |
| 462 | 42 87 D/Do |
| 463 | 42 88 C/Ti. |
| 464 | 42 89 B/La. |
| 465 | 42 80 A/So. |
| 466 | 42 81 hyphen/period |
| 467 | // fourth row (right to left) |
| 468 | 41 81 S |
| 469 | 41 82 R |
| 470 | 41 83 Q/NEW |
| 471 | 41 84 P/PLAY |
| 472 | 41 85 O/PAUSE |
| 473 | 41 86 N/Fa` |
| 474 | 41 87 M/Mi` |
| 475 | 41 88 L/Re` |
| 476 | 41 89 K/Do` |
| 477 | 41 80 J/Ti |
| 478 | // fifth row (right to left) |
| 479 | 40 82 SPACE |
| 480 | 40 83 Z |
| 481 | 40 84 Y |
| 482 | 40 85 X |
| 483 | 40 86 W |
| 484 | 40 87 V |
| 485 | 40 88 U |
| 486 | 40 89 T |
| 487 | 50 80 SHIFT |
| 488 | // socrates mouse pad (separate from keyboard) |
| 489 | 8x 8y mouse movement |
| 490 | x: down = 1 (small) thru 7 (large), up = 8 (small) thru F (large) |
| 491 | y: right = 1 (small) thru 7 (large), left = 8 (small) thru F (large) |
| 492 | 90 80 right click |
| 493 | A0 80 left click |
| 494 | B0 80 both buttons click |
| 495 | 90 81 right click (mouse movement in queue, will be in regs after next latch clear) |
| 496 | A0 81 left click (mouse movement in queue, will be in regs after next latch clear) |
| 497 | B0 81 both buttons click (mouse movement in queue, will be in regs after next latch clear) |
| 498 | // socrates touch pad |
| 499 | // unknown yet, but probably uses the 60/70/c0/d0/e0/f0 low reg vals |
| 500 | */ |
| 400 | 501 | |
| 401 | | |
| 402 | 502 | /****************************************************************************** |
| 403 | 503 | Machine Drivers |
| 404 | 504 | ******************************************************************************/ |