Previous 15994 Revisions Next

r14315 Thursday 2nd February, 2012 at 11:49:01 UTC by Robbbert
More x1
[src/mess/drivers]x1.c x1twin.c
[src/mess/includes]x1.h

src/mess/includes/x1.h
r14314r14315
7878   m_x1_cpu(*this,"x1_cpu"),
7979   m_cass(*this, CASSETTE_TAG),
8080   m_fdc(*this, "fdc"),
81   m_crtc(*this, "crtc")
81   m_crtc(*this, "crtc"),
82   m_ctc(*this, "ctc")
8283   { }
8384
8485   DECLARE_READ8_MEMBER(x1_mem_r);
r14314r14315
179180   UINT8 m_is_turbo;
180181   UINT8 m_ex_bank;
181182   UINT8 m_ram_bank;
183   void set_current_palette();
184   UINT16 get_pcg_addr(UINT16 width, UINT8 y_char_size);
185   UINT16 check_chr_addr();
186   UINT16 check_pcg_addr();
187   UINT8 get_game_key(UINT8 port);
188   UINT8 check_keyboard_shift();
189   UINT16 check_keyboard_press();
182190
183191   required_device<cpu_device> m_x1_cpu;
184192   required_device<cassette_image_device> m_cass;
185193   required_device<device_t> m_fdc;
186194   required_device<mc6845_device> m_crtc;
195   required_device<z80ctc_device> m_ctc;
187196};
188197
189198
src/mess/drivers/x1.c
r14314r14315
233233   state->m_pal_4096 = auto_alloc_array_clear(machine, UINT8, 0x1000*3);
234234}
235235
236static void x1_draw_pixel(running_machine &machine, bitmap_rgb32 &bitmap,int y,int x,UINT16   pen,UINT8 width,UINT8 height)
236static void x1_draw_pixel(running_machine &machine, bitmap_rgb32 &bitmap,int y,int x,UINT16 pen,UINT8 width,UINT8 height)
237237{
238238   if(!machine.primary_screen->visible_area().contains(x, y))
239239      return;
r14314r14315
565565 *************************************/
566566
567567
568static UINT16 check_keyboard_press(running_machine &machine)
568UINT16 x1_state::check_keyboard_press()
569569{
570570   static const char *const portnames[3] = { "key1","key2","key3" };
571571   int i,port_i,scancode;
572   UINT8 keymod = input_port_read(machine,"key_modifiers") & 0x1f;
573   UINT32 pad = input_port_read(machine,"tenkey");
574   UINT32 f_key = input_port_read(machine, "f_keys");
572   UINT8 keymod = input_port_read(machine(),"key_modifiers") & 0x1f;
573   UINT32 pad = input_port_read(machine(),"tenkey");
574   UINT32 f_key = input_port_read(machine(), "f_keys");
575575   scancode = 0;
576576
577577   for(port_i=0;port_i<3;port_i++)
578578   {
579579      for(i=0;i<32;i++)
580580      {
581         if((input_port_read(machine,portnames[port_i])>>i) & 1)
581         if((input_port_read(machine(), portnames[port_i])>>i) & 1)
582582         {
583583            //key_flag = 1;
584584            if(keymod & 0x02)  // shift not pressed
r14314r14315
629629   return 0;
630630}
631631
632static UINT8 check_keyboard_shift(running_machine &machine)
632UINT8 x1_state::check_keyboard_shift()
633633{
634634   UINT8 val = 0xe0;
635635   /*
r14314r14315
644644    ---- ---x CTRL ON
645645    */
646646
647   val |= input_port_read(machine,"key_modifiers") & 0x1f;
647   val |= input_port_read(machine(), "key_modifiers") & 0x1f;
648648
649   if(check_keyboard_press(machine) != 0)
649   if(check_keyboard_press() != 0)
650650      val &= ~0x40;
651651
652   if(check_keyboard_press(machine) & 0x100) //function keys
652   if(check_keyboard_press() & 0x100) //function keys
653653      val &= ~0x80;
654654
655655   return val;
656656}
657657
658static UINT8 get_game_key(running_machine &machine, int port)
658UINT8 x1_state::get_game_key(UINT8 port)
659659{
660660   // key status returned by sub CPU function 0xE3.
661661   // in order from bit 7 to 0:
r14314r14315
664664   // port 2: ESC,1,[-],[+],[*],TAB,SPC,RET ([] = numpad)
665665   // bits are active high
666666   UINT8 ret = 0;
667   UINT32 key1 = input_port_read(machine,"key1");
668   UINT32 key2 = input_port_read(machine,"key2");
669   UINT32 key3 = input_port_read(machine,"key3");
670   UINT32 pad = input_port_read(machine,"tenkey");
671667
672   switch(port)
668   if (port == 0)
673669   {
674      case 0:
675         if(key3 & 0x00020000) ret |= 0x80;  // Q
676         if(key3 & 0x00800000) ret |= 0x40;  // W
677         if(key3 & 0x00000020) ret |= 0x20;  // E
678         if(key3 & 0x00000002) ret |= 0x10;  // A
679         if(key3 & 0x00000010) ret |= 0x08;  // D
680         if(key3 & 0x04000000) ret |= 0x04;  // Z
681         if(key3 & 0x01000000) ret |= 0x02;  // X
682         if(key3 & 0x00000008) ret |= 0x01;  // C
683         break;
684      case 1:
685         if(pad & 0x00000080) ret |= 0x80;  // Tenkey 7
686         if(pad & 0x00000010) ret |= 0x40;  // Tenkey 4
687         if(pad & 0x00000002) ret |= 0x20;  // Tenkey 1
688         if(pad & 0x00000100) ret |= 0x10;  // Tenkey 8
689         if(pad & 0x00000004) ret |= 0x08;  // Tenkey 2
690         if(pad & 0x00000200) ret |= 0x04;  // Tenkey 9
691         if(pad & 0x00000040) ret |= 0x02;  // Tenkey 6
692         if(pad & 0x00000008) ret |= 0x01;  // Tenkey 3
693         break;
694      case 2:
695         if(key1 & 0x08000000) ret |= 0x80;  // ESC
696         if(key2 & 0x00020000) ret |= 0x40;  // 1
697         if(pad & 0x00000400) ret |= 0x20;  // Tenkey -
698         if(pad & 0x00000800) ret |= 0x10;  // Tenkey +
699         if(pad & 0x00001000) ret |= 0x08;  // Tenkey *
700         if(key1 & 0x00000200) ret |= 0x04;  // TAB
701         if(key2 & 0x00000001) ret |= 0x02;  // SPC
702         if(key1 & 0x00002000) ret |= 0x01;  // RET
703         break;
670      UINT32 key3 = input_port_read(machine(), "key3");
671      if(key3 & 0x00020000) ret |= 0x80;  // Q
672      if(key3 & 0x00800000) ret |= 0x40;  // W
673      if(key3 & 0x00000020) ret |= 0x20;  // E
674      if(key3 & 0x00000002) ret |= 0x10;  // A
675      if(key3 & 0x00000010) ret |= 0x08;  // D
676      if(key3 & 0x04000000) ret |= 0x04;  // Z
677      if(key3 & 0x01000000) ret |= 0x02;  // X
678      if(key3 & 0x00000008) ret |= 0x01;  // C
704679   }
680   else
681   if (port == 1)
682   {
683      UINT32 pad = input_port_read(machine(), "tenkey");
684      if(pad & 0x00000080) ret |= 0x80;  // Tenkey 7
685      if(pad & 0x00000010) ret |= 0x40;  // Tenkey 4
686      if(pad & 0x00000002) ret |= 0x20;  // Tenkey 1
687      if(pad & 0x00000100) ret |= 0x10;  // Tenkey 8
688      if(pad & 0x00000004) ret |= 0x08;  // Tenkey 2
689      if(pad & 0x00000200) ret |= 0x04;  // Tenkey 9
690      if(pad & 0x00000040) ret |= 0x02;  // Tenkey 6
691      if(pad & 0x00000008) ret |= 0x01;  // Tenkey 3
692   }
693   else
694   if (port == 2)
695   {
696      UINT32 key1 = input_port_read(machine(), "key1");
697      UINT32 key2 = input_port_read(machine(), "key2");
698      UINT32 pad = input_port_read(machine(), "tenkey");
699      if(key1 & 0x08000000) ret |= 0x80;  // ESC
700      if(key2 & 0x00020000) ret |= 0x40;  // 1
701      if(pad & 0x00000400) ret |= 0x20;  // Tenkey -
702      if(pad & 0x00000800) ret |= 0x10;  // Tenkey +
703      if(pad & 0x00001000) ret |= 0x08;  // Tenkey *
704      if(key1 & 0x00000200) ret |= 0x04;  // TAB
705      if(key2 & 0x00000001) ret |= 0x02;  // SPC
706      if(key1 & 0x00002000) ret |= 0x01;  // RET
707   }
705708
706709   return ret;
707710}
r14314r14315
716719      bus_res = m_sub_val[m_key_i];
717720      /* FIXME: likely to be different here. */
718721      m_key_i++;
719      if(m_key_i >= 2) { m_key_i = 0; }
722      if(m_key_i >= 2)
723         m_key_i = 0;
720724
721725      return bus_res;
722726   }
r14314r14315
891895   {
892896      case 0xe3: //game key obtaining
893897         m_sub_cmd_length = 3;
894         m_sub_val[0] = get_game_key(machine(),0);
895         m_sub_val[1] = get_game_key(machine(),1);
896         m_sub_val[2] = get_game_key(machine(),2);
898         m_sub_val[0] = get_game_key(0);
899         m_sub_val[1] = get_game_key(1);
900         m_sub_val[2] = get_game_key(2);
897901         break;
898902      case 0xe4: //irq vector setting
899903         break;
900904      //case 0xe5: //timer irq clear
901905      //  break;
902906      case 0xe6: //key data readout
903         m_sub_val[0] = check_keyboard_shift(machine()) & 0xff;
904         m_sub_val[1] = check_keyboard_press(machine()) & 0xff;
907         m_sub_val[0] = check_keyboard_shift() & 0xff;
908         m_sub_val[1] = check_keyboard_press() & 0xff;
905909         m_sub_cmd_length = 2;
906910         break;
907911//      case 0xe7: // TV Control
r14314r14315
990994 *
991995 *************************************/
992996
993//static UINT8 fdc_irq_flag;
994//static UINT8 fdc_drq_flag;
995//static UINT8 fdc_side;
996//static UINT8 fdc_drive;
997
998997READ8_MEMBER( x1_state::x1_fdc_r )
999998{
1000999   //UINT8 ret = 0;
r14314r14315
10831082 *
10841083 *************************************/
10851084
1086static UINT16 check_pcg_addr(running_machine &machine)
1085UINT16 x1_state::check_pcg_addr()
10871086{
1088   x1_state *state = machine.driver_data<x1_state>();
1089   if(state->m_avram[0x7ff] & 0x20) return 0x7ff;
1090   if(state->m_avram[0x3ff] & 0x20) return 0x3ff;
1091   if(state->m_avram[0x5ff] & 0x20) return 0x5ff;
1092   if(state->m_avram[0x1ff] & 0x20) return 0x1ff;
1087   if(m_avram[0x7ff] & 0x20) return 0x7ff;
1088   if(m_avram[0x3ff] & 0x20) return 0x3ff;
1089   if(m_avram[0x5ff] & 0x20) return 0x5ff;
1090   if(m_avram[0x1ff] & 0x20) return 0x1ff;
10931091
10941092   return 0x3ff;
10951093}
10961094
1097static UINT16 check_chr_addr(running_machine &machine)
1095UINT16 x1_state::check_chr_addr()
10981096{
1099   x1_state *state = machine.driver_data<x1_state>();
1100   if(!(state->m_avram[0x7ff] & 0x20)) return 0x7ff;
1101   if(!(state->m_avram[0x3ff] & 0x20)) return 0x3ff;
1102   if(!(state->m_avram[0x5ff] & 0x20)) return 0x5ff;
1103   if(!(state->m_avram[0x1ff] & 0x20)) return 0x1ff;
1097   if(!(m_avram[0x7ff] & 0x20)) return 0x7ff;
1098   if(!(m_avram[0x3ff] & 0x20)) return 0x3ff;
1099   if(!(m_avram[0x5ff] & 0x20)) return 0x5ff;
1100   if(!(m_avram[0x1ff] & 0x20)) return 0x1ff;
11041101
11051102   return 0x3ff;
11061103}
11071104
1108static UINT16 get_pcg_addr(running_machine &machine,UINT16 width,UINT8 y_char_size)
1105UINT16 x1_state::get_pcg_addr( UINT16 width, UINT8 y_char_size )
11091106{
1110   x1_state *state = machine.driver_data<x1_state>();
1111   int hbeam = machine.primary_screen->hpos() >> 3;
1112   int vbeam = machine.primary_screen->vpos() / y_char_size;
1113   UINT16 pcg_offset = ((hbeam + vbeam*width) + mc6845_start_addr) & 0x7ff;
1107   int hbeam = machine().primary_screen->hpos() >> 3;
1108   int vbeam = machine().primary_screen->vpos() / y_char_size;
1109   UINT16 pcg_offset = ((hbeam + vbeam*width) + (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff))) & 0x7ff;
11141110
11151111   //printf("%08x %d %d %d %d\n",(hbeam+vbeam*width),hbeam,vbeam,machine.primary_screen->vpos() & 7,width);
11161112
r14314r14315
11291125   if(addr == 0 && m_scrn_reg.pcg_mode) // Kanji ROM read, X1Turbo only
11301126   {
11311127      gfx_data = machine().region("kanji")->base();
1132      pcg_offset = (m_tvram[check_chr_addr(machine())]+(m_kvram[check_chr_addr(machine())]<<8)) & 0xfff;
1128      pcg_offset = (m_tvram[check_chr_addr()]+(m_kvram[check_chr_addr()]<<8)) & 0xfff;
11331129      pcg_offset*=0x20;
11341130      pcg_offset+=(offset & 0x0f);
1135      pcg_offset+=(m_kvram[check_chr_addr(machine())] & 0x40) >> 2; //left-right check
1131      pcg_offset+=(m_kvram[check_chr_addr()] & 0x40) >> 2; //left-right check
11361132
11371133      res = gfx_data[pcg_offset];
11381134   }
r14314r14315
11441140      gfx_data = machine().region((addr == 0) ? "cgrom" : "pcg")->base();
11451141      y_char_size = ((m_crtc_vreg[9]+1) > 8) ? 8 : m_crtc_vreg[9]+1;
11461142      if(y_char_size == 0) { y_char_size = 1; }
1147      pcg_offset = m_tvram[get_pcg_addr(machine(),m_crtc_vreg[1],y_char_size)]*8;
1143      pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8;
11481144      pcg_offset+= machine().primary_screen->vpos() & (y_char_size-1);
11491145      if(addr) { pcg_offset+= ((addr-1)*0x800); }
11501146      res = gfx_data[pcg_offset];
r14314r14315
11691165   {
11701166      if(m_scrn_reg.pcg_mode) // Hi-Speed Mode, X1Turbo only
11711167      {
1172         pcg_offset = m_tvram[check_pcg_addr(machine())]*8;
1168         pcg_offset = m_tvram[check_pcg_addr()]*8;
11731169         pcg_offset+= (offset & 0xe) >> 1;
11741170         pcg_offset+=((addr-1)*0x800);
11751171         PCG_RAM[pcg_offset] = data;
r14314r14315
11851181         /* TODO: Brain Breaker doesn't work with this arrangement in high resolution mode, check out why */
11861182         y_char_size = (m_crtc_vreg[9]+1) > 8 ? (m_crtc_vreg[9]+1)-8 : m_crtc_vreg[9]+1;
11871183         if(y_char_size == 0) { y_char_size = 1; }
1188         pcg_offset = m_tvram[get_pcg_addr(machine(),m_crtc_vreg[1],y_char_size)]*8;
1184         pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8;
11891185         pcg_offset+= machine().primary_screen->vpos() & (y_char_size-1);
11901186         pcg_offset+= ((addr-1)*0x800);
11911187
r14314r14315
12051201 *************************************/
12061202
12071203/* for bitmap mode */
1208static void set_current_palette(running_machine &machine)
1204void x1_state::set_current_palette()
12091205{
1210   x1_state *state = machine.driver_data<x1_state>();
12111206   UINT8 addr,r,g,b;
12121207
12131208   for(addr=0;addr<8;addr++)
12141209   {
1215      r = ((state->m_x_r)>>(addr)) & 1;
1216      g = ((state->m_x_g)>>(addr)) & 1;
1217      b = ((state->m_x_b)>>(addr)) & 1;
1210      r = ((m_x_r)>>(addr)) & 1;
1211      g = ((m_x_g)>>(addr)) & 1;
1212      b = ((m_x_b)>>(addr)) & 1;
12181213
1219      palette_set_color_rgb(machine, addr|8, pal1bit(r), pal1bit(g), pal1bit(b));
1214      palette_set_color_rgb(machine(), addr|8, pal1bit(r), pal1bit(g), pal1bit(b));
12201215   }
12211216}
12221217
r14314r14315
12481243   else //compatible mode
12491244   {
12501245      m_x_r = data;
1251      set_current_palette(machine());
1246      set_current_palette();
12521247      //if(m_old_vpos != machine().primary_screen->vpos())
12531248      //{
12541249      //  machine().primary_screen->update_partial(machine().primary_screen->vpos());
r14314r14315
12671262   else
12681263   {
12691264      m_x_g = data;
1270      set_current_palette(machine());
1265      set_current_palette();
12711266      //if(m_old_vpos != machine().primary_screen->vpos())
12721267      //{
12731268         machine().primary_screen->update_partial(machine().primary_screen->vpos());
r14314r14315
12861281   else
12871282   {
12881283      m_x_b = data;
1289      set_current_palette(machine());
1284      set_current_palette();
12901285      //if(m_old_vpos != machine().primary_screen->vpos())
12911286      //{
12921287      //  machine().primary_screen->update_partial(machine().primary_screen->vpos());
r14314r14315
16201615   if(offset == 0x0e03)                          { return x1_rom_r(space, 0); }
16211616   // TODO: user could install ym2151 on plain X1 too
16221617   //0x700, 0x701
1623   //if(offset >= 0x0704 && offset <= 0x0707)      { return z80ctc_r(machine().device("ctc"), offset-0x0704); }
1618   //if(offset >= 0x0704 && offset <= 0x0707)      { return z80ctc_r(m_ctc, offset-0x0704); }
16241619   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
16251620   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
16261621   else if(offset >= 0x1900 && offset <= 0x19ff)   { return x1_sub_io_r(space, 0); }
r14314r14315
16291624//  else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(machine().device("dma"), 0); }
16301625//  else if(offset >= 0x1f90 && offset <= 0x1f91)   { return z80sio_c_r(machine().device("sio"), (offset-0x1f90) & 1); }
16311626//  else if(offset >= 0x1f92 && offset <= 0x1f93)   { return z80sio_d_r(machine().device("sio"), (offset-0x1f92) & 1); }
1632   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(machine().device("ctc"), offset-0x1fa0); }
1633   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(machine().device("ctc"), offset-0x1fa8); }
1627   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(m_ctc, offset-0x1fa0); }
1628   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(m_ctc, offset-0x1fa8); }
16341629//  else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
16351630//  else if(offset == 0x1fe0)                       { return x1turboz_blackclip_r(space,0); }
16361631   else if(offset >= 0x2000 && offset <= 0x2fff)   { return m_avram[offset & 0x7ff]; }
r14314r14315
16481643   if(m_io_bank_mode == 1)                     { x1_ex_gfxram_w(space, offset, data); }
16491644   // TODO: user could install ym2151 on plain X1 too
16501645   //0x700, 0x701
1651//  else if(offset >= 0x0704 && offset <= 0x0707)   { z80ctc_w(machine().device("ctc"), offset-0x0704,data); }
1646//  else if(offset >= 0x0704 && offset <= 0x0707)   { z80ctc_w(m_ctc, offset-0x0704,data); }
16521647//  else if(offset >= 0x0c00 && offset <= 0x0cff)   { x1_rs232c_w(machine(), 0, data); }
16531648   else if(offset >= 0x0e00 && offset <= 0x0e02)   { x1_rom_w(space, offset-0xe00,data); }
16541649//  else if(offset >= 0x0e80 && offset <= 0x0e82)   { x1_kanji_w(machine(), offset-0xe80,data); }
r14314r14315
16681663//  else if(offset >= 0x1f80 && offset <= 0x1f8f)   { z80dma_w(machine().device("dma"), 0,data); }
16691664//  else if(offset >= 0x1f90 && offset <= 0x1f91)   { z80sio_c_w(machine().device("sio"), (offset-0x1f90) & 1,data); }
16701665//  else if(offset >= 0x1f92 && offset <= 0x1f93)   { z80sio_d_w(machine().device("sio"), (offset-0x1f92) & 1,data); }
1671   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(machine().device("ctc"), offset-0x1fa0,data); }
1672   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(machine().device("ctc"), offset-0x1fa8,data); }
1666   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(m_ctc, offset-0x1fa0,data); }
1667   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(m_ctc, offset-0x1fa8,data); }
16731668//  else if(offset == 0x1fb0)                       { x1turbo_pal_w(space,0,data); }
16741669//  else if(offset >= 0x1fb9 && offset <= 0x1fbf)   { x1turbo_txpal_w(space,offset-0x1fb9,data); }
16751670//  else if(offset == 0x1fc0)                       { x1turbo_txdisp_w(space,0,data); }
r14314r14315
16941689   if(offset == 0x0700)                     { return (ym2151_r(machine().device("ym"), offset-0x0700) & 0x7f) | (input_port_read(machine(), "SOUND_SW") & 0x80); }
16951690   else if(offset == 0x0701)                      { return ym2151_r(machine().device("ym"), offset-0x0700); }
16961691   //0x704 is FM sound detection port on X1 turboZ
1697   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(machine().device("ctc"), offset-0x0704); }
1692   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(m_ctc, offset-0x0704); }
16981693   else if(offset == 0x0801)                  { printf("Color image board read\n"); return 0xff; } // *
16991694   else if(offset == 0x0803)                  { printf("Color image board 2 read\n"); return 0xff; } // *
17001695   else if(offset >= 0x0a00 && offset <= 0x0a07)   { printf("Stereoscopic board read %04x\n",offset); return 0xff; } // *
r14314r14315
17131708   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(machine().device("dma"), 0); }
17141709   else if(offset >= 0x1f90 && offset <= 0x1f93)   { return z80dart_ba_cd_r(machine().device("sio"), (offset-0x1f90) & 3); }
17151710   else if(offset >= 0x1f98 && offset <= 0x1f9f)   { printf("Extended SIO/CTC read %04x\n",offset); return 0xff; }
1716   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(machine().device("ctc"), offset-0x1fa0); }
1717   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(machine().device("ctc"), offset-0x1fa8); }
1711   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(m_ctc, offset-0x1fa0); }
1712   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(m_ctc, offset-0x1fa8); }
17181713   else if(offset == 0x1fb0)                  { return x1turbo_pal_r(space,0); } // Z only!
17191714   else if(offset >= 0x1fb8 && offset <= 0x1fbf)   { return x1turbo_txpal_r(space,offset-0x1fb8); } //Z only!
17201715   else if(offset == 0x1fc0)                  { return x1turbo_txdisp_r(space,0); } // Z only!
r14314r14315
17391734   if(m_io_bank_mode == 1)                    { x1_ex_gfxram_w(space, offset, data); }
17401735   else if(offset == 0x0700 || offset == 0x0701)   { ym2151_w(machine().device("ym"), offset-0x0700,data); }
17411736   //0x704 is FM sound detection port on X1 turboZ
1742   else if(offset >= 0x0704 && offset <= 0x0707)   { z80ctc_w(machine().device("ctc"), offset-0x0704,data); }
1737   else if(offset >= 0x0704 && offset <= 0x0707)   { z80ctc_w(m_ctc, offset-0x0704,data); }
17431738   else if(offset == 0x0800)                  { printf("Color image board write %02x\n",data); } // *
17441739   else if(offset == 0x0802)                  { printf("Color image board 2 write %02x\n",data); } // *
17451740   else if(offset >= 0x0a00 && offset <= 0x0a07)   { printf("Stereoscopic board write %04x %02x\n",offset,data); } // *
r14314r14315
17661761   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { z80dma_w(machine().device("dma"), 0,data); }
17671762   else if(offset >= 0x1f90 && offset <= 0x1f93)   { z80dart_ba_cd_w(machine().device("sio"), (offset-0x1f90) & 3,data); }
17681763   else if(offset >= 0x1f98 && offset <= 0x1f9f)   { printf("Extended SIO/CTC write %04x %02x\n",offset,data); }
1769   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(machine().device("ctc"), offset-0x1fa0,data); }
1770   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(machine().device("ctc"), offset-0x1fa8,data); }
1764   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(m_ctc, offset-0x1fa0,data); }
1765   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(m_ctc, offset-0x1fa8,data); }
17711766   else if(offset == 0x1fb0)                  { x1turbo_pal_w(space,0,data); } // Z only!
17721767   else if(offset >= 0x1fb8 && offset <= 0x1fbf)   { x1turbo_txpal_w(space,offset-0x1fb8,data); } //Z only!
17731768   else if(offset == 0x1fc0)                  { x1turbo_txdisp_w(space,0,data); } //Z only!
r14314r14315
21522147   PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
21532148   PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT)
21542149
2155   #if 0
2150#if 0
21562151   PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
21572152   PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
21582153   PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')
r14314r14315
21942189   PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9)
21952190   PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10)
21962191
2197   #endif
2192#endif
21982193INPUT_PORTS_END
21992194
22002195INPUT_PORTS_START( x1turbo )
r14314r14315
23362331
23372332static const z80_daisy_config x1_daisy[] =
23382333{
2339    { "x1kb" },
2334   { "x1kb" },
23402335   { "ctc" },
23412336   { NULL }
23422337};
23432338
23442339static const z80_daisy_config x1turbo_daisy[] =
23452340{
2346    { "x1kb" },
2341   { "x1kb" },
23472342   { "ctc" },
23482343   { "dma" },
23492344   { "sio" },
r14314r14315
25852580   MCFG_CPU_IO_MAP(x1_io)
25862581   MCFG_CPU_CONFIG(x1_daisy)
25872582
2588   MCFG_Z80CTC_ADD( "ctc", MAIN_CLOCK/4 , ctc_intf )
2583   MCFG_Z80CTC_ADD( "ctc", MAIN_CLOCK/4, ctc_intf )
25892584
25902585   MCFG_DEVICE_ADD("x1kb", X1_KEYBOARD, 0)
25912586
src/mess/drivers/x1twin.c
r14314r14315
1717
1818#include "includes/pce.h"
1919#include "video/vdc.h"
20#include "cpu/h6280/h6280.h"
21#include "sound/c6280.h"
20//#include "cpu/h6280/h6280.h"
21//#include "sound/c6280.h"
2222#include "machine/pcecommn.h"
2323
2424#include "rendlay.h"
r14314r14315
2828   public:
2929      x1twin_state(const machine_config &mconfig, device_type type, const char *tag)
3030      : x1_state(mconfig, type, tag)
31      { }
31   { }
3232};
3333
3434
r14314r14315
3636#define VDP_CLOCK  XTAL_42_9545MHz
3737#define MCU_CLOCK  XTAL_6MHz
3838
39static SCREEN_UPDATE_RGB32( x1twin )
39static SCREEN_UPDATE_RGB32( x1pce )
4040{
41   device_t *left_screen  = screen.machine().device("x1_screen");
42   //device_t *right_screen = screen.machine().device("pce_screen");
43
44   if (&screen==left_screen)
45      SCREEN_UPDATE16_CALL( x1 );
46
4741   return 0;
4842}
4943
r14314r14315
5246   AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_mem_r,x1_mem_w)
5347ADDRESS_MAP_END
5448
55static ADDRESS_MAP_START( x1_io , AS_IO, 8, x1twin_state )
49static ADDRESS_MAP_START( x1_io, AS_IO, 8, x1twin_state )
5650   ADDRESS_MAP_UNMAP_HIGH
5751   AM_RANGE(0x0000, 0xffff) AM_READWRITE(x1_io_r, x1_io_w)
5852ADDRESS_MAP_END
5953
6054#if 0
61static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8)
55static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, x1twin_state )
6256   AM_RANGE( 0x000000, 0x09FFFF) AM_ROM
6357   AM_RANGE( 0x1F0000, 0x1F1FFF) AM_RAM AM_MIRROR(0x6000) AM_BASE( &pce_user_ram )
6458   AM_RANGE( 0x1FE000, 0x1FE3FF) AM_READWRITE( vdc_0_r, vdc_0_w )
r14314r14315
6963   AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE( h6280_irq_status_r, h6280_irq_status_w )
7064ADDRESS_MAP_END
7165
72static ADDRESS_MAP_START( pce_io , AS_IO, 8)
66static ADDRESS_MAP_START( pce_io, AS_IO, 8, x1twin_state )
7367   AM_RANGE( 0x00, 0x03) AM_READWRITE( vdc_0_r, vdc_0_w )
7468ADDRESS_MAP_END
7569#endif
r14314r14315
321315   PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
322316   PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT)
323317
324   #if 0
318#if 0
325319   PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
326320   PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
327321   PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')
r14314r14315
363357   PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9)
364358   PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10)
365359
366   #endif
360#endif
367361INPUT_PORTS_END
368362
369363
r14314r14315
471465
472466static const z80_daisy_config x1_daisy[] =
473467{
474    { "x1kb" },
468   { "x1kb" },
475469   { "ctc" },
476470   { NULL }
477471};
r14314r14315
555549   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
556550   MCFG_SCREEN_SIZE(640, 480)
557551   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
558   MCFG_SCREEN_UPDATE_STATIC(x1twin)
552   MCFG_SCREEN_UPDATE_STATIC(x1)
559553
560554   MCFG_SCREEN_ADD("pce_screen", RASTER)
561555   MCFG_SCREEN_REFRESH_RATE(60)
562556   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
563557   MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK/2, VDC_WPF, 70, 70 + 512 + 32, VDC_LPF, 14, 14+242)
564   MCFG_SCREEN_UPDATE_STATIC(x1twin)
558   MCFG_SCREEN_UPDATE_STATIC(x1pce)
565559
566560   MCFG_MC6845_ADD("crtc", H46505, (VDP_CLOCK/48), mc6845_intf) //unknown divider
567561   MCFG_PALETTE_LENGTH(0x10+0x1000)
r14314r14315
601595   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface)
602596   MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop")
603597
604   #if 0
598#if 0
605599   MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
606600//  MCFG_SOUND_CONFIG(c6280_config)
607601   MCFG_SOUND_ROUTE(0, "pce_l", 0.5)
608602   MCFG_SOUND_ROUTE(1, "pce_r", 0.5)
609   #endif
603#endif
610604
611605   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", x1_keyboard_callback, attotime::from_hz(250))
612606   MCFG_TIMER_ADD_PERIODIC("cmt_wind_timer", x1_cmt_wind_timer, attotime::from_hz(16))

Previous 15994 Revisions Next


© 1998-2018 The MESS Team