Previous 15994 Revisions Next

r5532 Saturday 29th August, 2009 at 21:33:35 UTC by Angelo Salese
[X1]: Properly supported the Sub CPU OBF, needed by many games to boot them
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5531r5532
152152static UINT16 pcg_index[3];
153153static UINT8 pcg_reset;
154154static UINT16 crtc_start_addr;
155static UINT8 sub_obf;
155156static struct
156157{
157158   UINT8 gfx_bank;
158159   UINT8 pcg_mode;
159}ply_reg;
160}scrn_reg;
160161
161162static VIDEO_START( x1 )
162163{
r5531r5532
326327   return 0;
327328}
328329
330static UINT8 sub_cmd_length;
331
329332static READ8_HANDLER( sub_io_r )
330333{
334   if(sub_obf)
335      return 0xff;
336
331337   if(key_flag == 1)
332338   {
333339      key_flag = 0;
334340      return 0x82;
335341   }
336342
343   sub_cmd_length--;
344   sub_obf = (sub_cmd_length) ? 0x00 : 0x20;
345
337346   return sub_val;
338347}
339348
r5531r5532
348357
349358   switch(data)
350359   {
360      case 0xe3:
361         sub_cmd_length = 3;
362         break;
351363      case 0xe6:
352364         sub_val = check_keyboard_press(space->machine);
365         sub_cmd_length = 2;
353366         break;
354      case 0xe8: sub_val = sub_cmd; break;
367      case 0xe8:
368         sub_val = sub_cmd;
369         sub_cmd_length = 1;
370         break;
371      case 0xea:
372         sub_cmd_length = 1;
373         break;
374      case 0xeb:
375         sub_cmd_length = 1;
376         break;
377      case 0xed:
378         sub_cmd_length = 3;
379         break;
380      case 0xef:
381         sub_cmd_length = 3;
382         break;
355383      //case 0xeb: sub_val = test; break; //used on device select
356384      //case 0xed: sub_val = test; break;
357385      //case 0xef: sub_val = test; break; //used on timer select?
358386      #if 0
359387      default:
360388      {
361         if(data > 0xe0 && data <= 0xef)
389         if(data > 0xe3 && data <= 0xef)
362390            printf("%02x CMD\n",data);
363391      }
364392      #endif
365393   }
366394
367395   sub_cmd = data;
396
397   sub_obf = (sub_cmd_length) ? 0x00 : 0x20;
368398}
369399
370400static UINT8 rom_index[3];
r5531r5532
599629//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
600630   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
601631   else if(offset >= 0x3000 && offset <= 0x3fff)   { return videoram[offset-0x3000]; }
602   else if(offset >= 0x4000 && offset <= 0xffff)   { return gfx_bitmap_ram[offset-0x4000+(ply_reg.gfx_bank*0xc000)]; }
632   else if(offset >= 0x4000 && offset <= 0xffff)   { return gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)]; }
603633   else
604634   {
605635      logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(space->cpu),offset);
r5531r5532
613643//      fatalerror("Extended GFX RAM write %02x %04x",data,offset);
614644}
615645
646static WRITE8_HANDLER( x1_scrn_w )
647{
648   scrn_reg.pcg_mode = (data & 0x20)>>5;
649   scrn_reg.gfx_bank = (data & 0x10)>>4;
650}
651
616652static WRITE8_HANDLER( x1_ply_w )
617653{
618   ply_reg.pcg_mode = (data & 0x20)>>5;
619   ply_reg.gfx_bank = (data & 0x10)>>4;
620654}
621655
622656static WRITE8_HANDLER( x1_6845_w )
r5531r5532
664698//   else if(offset >= 0x1f90 && offset <= 0x1f93)   { x1_sio_w(space->machine,(offset-0x1f90) & 3),data; }
665699   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa3,data); }
666700   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); }
667//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space->machine,offset-0x1fd0,data); }
701   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
668702   else if(offset >= 0x2000 && offset <= 0x2fff)   { colorram[offset-0x2000] = data; }
669703   else if(offset >= 0x3000 && offset <= 0x3fff)   { videoram[offset-0x3000] = data; }
670   else if(offset >= 0x4000 && offset <= 0xffff)   { gfx_bitmap_ram[offset-0x4000+(ply_reg.gfx_bank*0xc000)] = data; }
704   else if(offset >= 0x4000 && offset <= 0xffff)   { gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)] = data; }
671705   else
672706   {
673707      logerror("(PC=%06x) Write %02x at i/o address %04x\n",cpu_get_pc(space->cpu),data,offset);
r5531r5532
840874/* this port is system related */
841875static READ8_DEVICE_HANDLER( x1_portb_r )
842876{
843   static UINT8 sub_obf;
844877   //printf("PPI Port B read\n");
845878   /*
846879   x--- ---- "v disp"
r5531r5532
852885   ---- --x- "cmt read"
853886   ---- ---x "cmt test" (active low)
854887   */
855   sub_obf^=0x20;
856888   return (input_port_read(device->machine, "SYSTEM") & ~0x60) | sub_obf;
857889}
858890
r5531r5532
10051037   PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
10061038   PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b lf
10071039   PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c vt
1008   PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0d ff
1040   PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27)
10091041   PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr
10101042   PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so
10111043
r5531r5532
10961128   PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_")
10971129
10981130   #if 0
1099   PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27)
11001131   PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
11011132   PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
11021133   PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')

Previous 15994 Revisions Next


© 1998-2018 The MESS Team