Previous 15994 Revisions Next

r5338 Sunday 2nd August, 2009 at 15:47:27 UTC by Jonathan Gevaryahu
[socrates] hooked up keypads and buttons, super painter is now usable. some keyboard glitches remain, i.e. letter entry in super painter is broken
[src/mess/drivers]socrates.c

src/mess/drivers/socrates.c
r5337r5338
66* 
77*  (driver structure copied from vtech1.c)
88TODO:
9   fix glitches with keyboard input (can't spell "igloo" in scramble due to problem with double keys, letter entry in super painter doesn't work)
10   hook up mouse
911   add waitstates for ram access (lack of this causes the system to run way too fast)
1012   hook up cartridges using the bios system
1113   hook up sound regs
12   find and hook up keyboard/mouse IR input
1314   find and hook up any timers/interrupt controls
1415   find and document ports for speech synthesizer
1516   
r5337r5338
8990UINT8 ram_bank;
9091UINT16 scroll_offset;
9192UINT8* videoram;
93//UINT8 kb_latch_low_old;
94//UINT8 kb_latch_high_old;
9295UINT8 kb_latch_low;
9396UINT8 kb_latch_high;
9497UINT8 kb_latch_mouse;
r5337r5338
112115   int shift = 0;
113116   // first check that the kb latch is clear; if it isn't, don't touch it!
114117   if ((socrates.kb_latch_low != 0) || (socrates.kb_latch_high != 1)) return;
118   // next check for joypad buttons
119   keyvalue = input_port_read(machine, "keyboard_jp");
120   if (keyvalue != 0)
121   {
122      socrates.kb_latch_low = (keyvalue & 0xFF0)>>4;
123      socrates.kb_latch_high = 0x80 | (keyvalue & 0xF);
124      return; // get out of this function; due to the way key priorities work, we're done here.
125   }
115126   // next check for mouse movement.
116127   // this isn't written yet, so write me please!
117128   // next check if shift is down
118129   shift = input_port_read(machine, "keyboard_50");
119   // find key low and high byte
130   // find key low and high byte ok keyboard section
120131   for (row = 4; row>=0; row--)
121132   {
122133      keyvalue = input_port_read(machine, rownames[row]);
r5337r5338
128139            {
129140               socrates.kb_latch_low = (shift?0x50:0x40)+row;
130141               socrates.kb_latch_high = (0x80 | powerof2);
131               return; // get out of the for loop. due to the way key priorities work, we're done here.
142               return; // get out of the for loop; due to the way key priorities work, we're done here.
132143            }
133144         }
134145      }
r5337r5338
143154
144155MACHINE_RESET( socrates )
145156{
146 socrates.rom_bank = 0; // actually set semi-randomly on real console but we need to initialize it somewhere...
157 socrates.rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere...
147158 socrates_set_rom_bank( machine );
148159 socrates.ram_bank = 0;  // the actual console sets it semi randomly on power up, and the bios cleans it up.
149160 socrates_set_ram_bank( machine );
150 socrates.kb_latch_low = 0; // this is really random on startup but its best to set it to the 'sane' 00 01 value
151 socrates.kb_latch_high = 1; // this is really random on startup but its best to set it to the 'sane' 00 01 value
161 //socrates.kb_latch_low_old = 0xFF;
162 //socrates.kb_latch_high_old = 0x8F;
163 socrates.kb_latch_low = 0xFF;
164 socrates.kb_latch_high = 0x8F;
152165 socrates.kb_latch_mouse = 0;
153166}
154167
r5337r5338
202215READ8_HANDLER( read_40 ) // read 0x4x, some sort of status reg
203216{
204217// bit 7 - unknown, never seems to be set
205// bit 6 - unknown, sometimes set sometimes clear
206// bit 5 - timer expired? status, sometimes set sometimes clear
207// bit 4 - vblank? status, sometimes set sometimes clear
218// bit 6 - unknown, usually set but occasionally clear
219// bit 5 - vblank? status, sometimes set sometimes clear
220// bit 4 - hblank? status, sometimes set sometimes clear
208221// bit 3 - unknown, sometimes set sometimes clear
209222// bit 2 - unknown, sometimes set sometimes clear
210223// bit 1 - unknown, sometimes set sometimes clear
r5337r5338
220233READ8_HANDLER( socrates_keyboard_low_r ) // keyboard code low
221234{
222235 socrates_update_kb( space->machine );
236 //return socrates.kb_latch_low_old;
223237 return socrates.kb_latch_low;
224238}
225239
226240READ8_HANDLER( socrates_keyboard_high_r ) // keyboard code high
227241{
228242 socrates_update_kb( space->machine );
243 //return socrates.kb_latch_high_old;
229244 return socrates.kb_latch_high;
230245}
231246
r5337r5338
233248{
234249   if (socrates.kb_latch_mouse == 0)
235250   {
251      //socrates.kb_latch_low_old = socrates.kb_latch_low;
252      //socrates.kb_latch_high_old = socrates.kb_latch_high;
236253      socrates.kb_latch_low = 0;
237254      socrates.kb_latch_high = 1;
238255   }
239256   else
240257   {
258      //socrates.kb_latch_low_old = socrates.kb_latch_mouse&0xFF; // y coord
259      //socrates.kb_latch_high_old = (socrates.kb_latch_mouse&0xFF00)>>8; // x coord
260      //socrates.kb_latch_low = 0;
261      //socrates.kb_latch_high = 1;
241262      socrates.kb_latch_low = socrates.kb_latch_mouse&0xFF; // y coord
242263      socrates.kb_latch_high = (socrates.kb_latch_mouse&0xFF00)>>8; // x coord
243264      socrates.kb_latch_mouse = 0;
r5337r5338
489510// pads on the sides of the kb; this acts like a giant bitfield, both dpads/buttons can send data at once
49051100   81   left dpad right
49151200   82   left dpad up
49200   84   left dpad down
49300   88   left dpad left
51300   84   left dpad left
51400   88   left dpad down
49451501   80   right dpad down
49551602   80   right dpad left
49651704   80   right dpad up
r5337r5338
565586*/
566587static INPUT_PORTS_START( socrates )
567588
589   PORT_START("keyboard_jp") // joypad keys
590   PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_NAME("Left D-pad Right") // 00 81
591   PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_NAME("Left D-pad Up") // 00 82
592   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_NAME("Left D-pad Left") // 00 84
593   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_NAME("Left D-pad Down") // 00 88
594   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("Right D-pad Down") // 01 80
595   PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("Right D-pad Left") // 02 80
596   PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("Right D-pad Up") // 04 80
597   PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("Right D-pad Right") // 08 80
598   PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_NAME("Left D-pad Button") // 10 80
599   PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Right D-pad Button") // 20 80
600   PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED)
601   /* alt w/left and right keypad keys swapped
602   PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("Left D-pad Right") // 00 81
603   PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_NAME("Left D-pad Up") // 00 82
604   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("Left D-pad Left") // 00 84
605   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("Left D-pad Down") // 00 88
606   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_NAME("Right D-pad Down") // 01 80
607   PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_NAME("Right D-pad Left") // 02 80
608   PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_NAME("Right D-pad Up") // 04 80
609   PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_NAME("Right D-pad Right") // 08 80
610   PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) PORT_NAME("Left D-pad Button") // 10 80
611   PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_NAME("Right D-pad Button") // 20 80
612   PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED)
613   */
614
568615   PORT_START("keyboard_50") // lowest 'row' (technically the shift key is on the 5th row but it has its own keycode)
569616   PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_NAME("SHIFT") // 5x xx
570617   PORT_BIT(0xfffffffe, IP_ACTIVE_HIGH, IPT_UNUSED)
r5337r5338
707754    /* Socrates SAITOUT (French Canadian) NTSC */
708755    ROM_LOAD("socratfc.u1", 0x00000, 0x40000, CRC(042d9d21) SHA1(9ffc67b2721683b2536727d0592798fbc4d061cb)) /* fix label/name */
709756    ROM_FILL(0x40000, 0x40000, 0xf3) /* fill empty space with 0xf3 */
757    ROM_LOAD_OPTIONAL("cartridge.bin", 0x40000, 0x20000, NO_DUMP)
710758
711759    ROM_REGION(0x10000, "vram", 0)
712760    ROM_FILL(0x0000, 0xffff, 0xff) /* fill with ff, driver_init changes this to the 'correct' startup pattern */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team