Previous 15994 Revisions Next

r5332 Friday 31st July, 2009 at 18:14:44 UTC by Jonathan Gevaryahu
[socrates] document all keycodes and mouse keycodes, change palette gamma to 1.5, begin keyboard and mouse hookup
[src/mess/drivers]socrates.c

src/mess/drivers/socrates.c
r5331r5332
8989UINT8 ram_bank;
9090UINT16 scroll_offset;
9191UINT8* videoram;
92UINT8 kb_latch_low;
93UINT8 kb_latch_high;
94UINT8 kb_latch_mouse;
9295} socrates={ {0}};
9396
9497static void socrates_set_rom_bank( running_machine *machine )
r5331r5332
108111 socrates_set_rom_bank( machine );
109112 socrates.ram_bank = 0;  // the actual console sets it semi randomly on power up, and the bios cleans it up.
110113 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;
111117}
112118
113119DRIVER_INIT( socrates )
r5331r5332
159165
160166READ8_HANDLER( socrates_keyboard_50_r ) // keyboard code low
161167{
162 return 0x00; // write me!
168 return socrates.kb_latch_low;
163169}
164170
165171READ8_HANDLER( socrates_keyboard_51_r ) // keyboard code high
166172{
167 return 0x01; // write me!
173 return socrates.kb_latch_high;
168174}
169175
170WRITE8_HANDLER( socrates_keyboard_reset ) // keyboard latch reset
176WRITE8_HANDLER( socrates_keyboard_clear ) // keyboard latch clear (or show mouse coords next if they have updated)
171177{
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   }
173192}
174193
175194WRITE8_HANDLER( unknown_6x ) // writes to i/o 0x6x happens on startup once, with 0x01. no idea what it does.
r5331r5332
204223#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,
205224#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,
206225// 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
208227
209228static rgb_t socrates_create_color(UINT8 color)
210229{
r5331r5332
386405   */
387406   AM_RANGE(0x30, 0x30) AM_READWRITE(read_f3, unknownlatch_30) AM_MIRROR (0xf) /* unknown, write only */
388407   //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 */
391410   AM_RANGE(0x60, 0x60) AM_READWRITE(read_f3, unknown_6x) AM_MIRROR(0xF) /* unknown, write only  */
392411   AM_RANGE(0x70, 0xFF) AM_READ(read_f3) // nothing mapped here afaik
393412ADDRESS_MAP_END
r5331r5332
397416 Input Ports
398417******************************************************************************/
399418
419/* socrates keyboard codes:
420keycode low
421|   keycode high
422|   |   key name
42300   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
42500   81   left dpad right
42600   82   left dpad up
42700   84   left dpad down
42800   88   left dpad left
42901   80   right dpad down
43002   80   right dpad left
43104   80   right dpad up
43208   80   right dpad right
43310   80   left red button
43420   80   right red button
435// top row (right to left)
43644   82   ENTER
43744   83   MENU
43844   84   ANSWER
43944   85   HELP
44044   86   ERASE
44144   87   divide_sign
44244   88   multiply_sign
44344   89   minus_sign
44444   80   plus_sign
445//second row (right to left)
44643   81   0
44743   82   9
44843   83   8
44943   84   7
45043   85   6
45143   86   5
45243   87   4
45343   88   3
45443   89   2
45543   80   1
456// third row (right to left)
45742   82   I/La
45842   83   H/So
45942   84   G/Fa
46042   85   F/Mi
46142   86   E/Re
46242   87   D/Do
46342   88   C/Ti.
46442   89   B/La.
46542   80   A/So.
46642   81   hyphen/period
467// fourth row (right to left)
46841   81   S
46941   82   R
47041   83   Q/NEW
47141   84   P/PLAY
47241   85   O/PAUSE
47341   86   N/Fa`
47441   87   M/Mi`
47541   88   L/Re`
47641   89   K/Do`
47741   80   J/Ti
478// fifth row (right to left)
47940   82   SPACE
48040   83   Z
48140   84   Y
48240   85   X
48340   86   W
48440   87   V
48540   88   U
48640   89   T
48750   80   SHIFT
488// socrates mouse pad (separate from keyboard)
4898x   8y   mouse movement
490x: down = 1 (small) thru 7 (large), up = 8 (small) thru F (large)
491y: right = 1 (small) thru 7 (large), left = 8 (small) thru F (large)
49290   80   right click
493A0   80   left click
494B0   80   both buttons click
49590   81   right click (mouse movement in queue, will be in regs after next latch clear)
496A0   81   left click (mouse movement in queue, will be in regs after next latch clear)
497B0   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*/
400501
401
402502/******************************************************************************
403503 Machine Drivers
404504******************************************************************************/

Previous 15994 Revisions Next


© 1998-2018 The MESS Team