Previous 15994 Revisions Next

r5514 Friday 28th August, 2009 at 17:53:14 UTC by Angelo Salese
[X1]: Hopefully fixed the colors minus one small bug
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5513r5514
66
77   TODO:
88   - Understand how keyboard works and decap/dump the keyboard MCU if possible;
9   - Hook-up image formats;
10   - Video part is bare minimum, chances are that's probably a tilemap/bitmap nightmare;
11   - Sort out / redump the gfx roms;
9   - Hook-up .d88 and .tap image formats (.rom too?);
10   - Sort out / redump the BIOS gfx roms;
1211   - Fix the interrupts (uses IM 2)
12   - Add multiple FDC drive support;
13   - clean-ups!
14   - There are various unclear video things, these are:
15      - how layer clearance works? Dragon Buster relies on it
16      - fg tilemap colors are wrong, the Shanghai "hit any key" msg must be blue with white
17        background;
18      - I bet there's a PCG reset address tied to some bit, find it;
19      - Add the extended gfx hookup;
20      - (anything else?)
1321
1422   per-game specific TODO:
15   - 177 / Dragon Buster: fix the keyboard flags otherwise these doesn't boot;
16   - Dragon Buster: Maybe the pcg tilemap uses scrolling and priorities are wrong;
23   - 177 / Dragon Buster / (many others): fix the keyboard obf flag otherwise these doesn't boot;
1724   - Shanghai: tests the ay8910 read regs, mouse/joystick perhaps?
1825   - Gaia/Space Harrier: Hits the FDC drive assert, the latter boots but has heavy emulation
1926     video/logic problems;
27   - "alpha": Apparently does use the DMA feature (writes z80 code?), investigate;
2028
2129   Notes:
2230   - An interesting feature of the Sharp X-1 is the extended i/o bank. When the ppi port c bit 5
r5513r5514
137145static UINT8 hres_320,io_switch,io_sys;
138146static UINT8 io_bank_mode;
139147static UINT8 *gfx_bitmap_ram;
148static UINT16 pcg_index[3];
140149
141150
142151static VIDEO_START( x1 )
r5513r5514
154163
155164   bitmap_fill(bitmap, cliprect, 0);
156165
166   for (y=0;y<25;y++)
157167   {
168      for (x=0;x<40*w;x++)
169      {
170         int tile = videoram[x+(y*40*w)];
171         int color = colorram[x+(y*40*w)] & 0x1f;
172         int width = (colorram[x+(y*40*w)] & 0x80)>>7;
173         int height = (colorram[x+(y*40*w)] & 0x40)>>6;
174         int pcg_bank = (colorram[x+(y*40*w)] & 0x20)>>4;
175         int region = (width+(height<<1)) & 3;
176
177         if(pcg_bank) { region+= 4; }
178
179         if(color & 0x8) continue;
180
181         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1));
182      }
183   }
184
185   {
158186      int count,xi,yi;
159187      int pen_r,pen_g,pen_b,color;
160188      int yi_size;
r5513r5514
175203                  pen_g = (gfx_bitmap_ram[count+0x8000]>>(7-xi)) & 1;
176204                  pen_b = (gfx_bitmap_ram[count+0x0000]>>(7-xi)) & 1;
177205
178                  color = pen_r<<2 | pen_g<<1 | pen_b<<0;
206                  color = pen_r<<1 | pen_g<<2 | pen_b<<0;
179207
208                  if(color == 0)
209                     continue;
210
180211                  if(w == 1)
181212                  {
182213                     if(yi & 1)
r5513r5514
210241         int region = (width+(height<<1)) & 3;
211242
212243         if(pcg_bank) { region+= 4; }
213         else if(tile == 0) continue; //<- correct?
214244
215         if(color & 0x38)
216            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1));
217         else
218            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1),0);
245         if(!(color & 0x8)) continue;
246
247         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,0,0,(x/(width+1))*8*(width+1),(y/(height+1))*8*(height+1));
219248      }
220249   }
221
222250   return 0;
223251}
224252
r5513r5514
452480
453481static WRITE8_HANDLER( x1_dma_w )
454482{
455   if(data)
456      fatalerror("Data written to the DMA space");
483   printf("%02x %02x\n",offset,data);
484   //if(data)
485   //   fatalerror("Data written to the DMA space");
457486}
458487
459488static WRITE8_HANDLER( x1_pcg_w )
460489{
461490   int addr,pcg_offset;
462   static int pcg_index[3];
463491   UINT8 *PCG_RAM = memory_region(space->machine, "pcg");
464492
465493   addr = (offset & 0x300) >> 8;
r5513r5514
527555//   else if(offset >= 0x0e80 && offset <= 0x0e82)   { x1_kanji_w(space->machine, offset-0xe80,data); }
528556   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { x1_fdc_w(space, offset-0xff8,data); }
529557   else if(offset >= 0x1000 && offset <= 0x10ff)   { x1_pal_b_w(space, 0,data); }
530   else if(offset >= 0x1100 && offset <= 0x11ff)   { x1_pal_g_w(space, 0,data); }
531   else if(offset >= 0x1200 && offset <= 0x12ff)   { x1_pal_r_w(space, 0,data); }
558   else if(offset >= 0x1100 && offset <= 0x11ff)   { x1_pal_r_w(space, 0,data); }
559   else if(offset >= 0x1200 && offset <= 0x12ff)   { x1_pal_g_w(space, 0,data); }
532560//   else if(offset >= 0x1300 && offset <= 0x13ff)   { x1_ply_w(space->machine, 0,data; }
533561   else if(offset >= 0x1400 && offset <= 0x17ff)   { x1_pcg_w(space, offset-0x1400,data); }
534562   else if(offset == 0x1800                    )   { mc6845_address_w(devtag_get_device(space->machine, "crtc"), 0,data); }
r5513r5514
613641   8,8,
614642   RGN_FRAC(1,3),
615643   3,
616   { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) },
644   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
617645   { 0, 1, 2, 3, 4, 5, 6, 7 },
618646   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
619647   8*8
r5513r5514
624652   16,8,
625653   RGN_FRAC(1,3),
626654   3,
627   { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) },
655   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
628656   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
629657   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
630658   8*8
r5513r5514
635663   8,16,
636664   RGN_FRAC(1,3),
637665   3,
638   { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) },
666   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
639667   { 0, 1, 2, 3, 4, 5, 6, 7 },
640668   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
641669   8*8
r5513r5514
646674   16,16,
647675   RGN_FRAC(1,3),
648676   3,
649   { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) },
677   { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) },
650678   { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 },
651679   { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 },
652680   8*8
r5513r5514
669697   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8,   0, 0x40 )
670698   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8w,   0, 0x40 )
671699   GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8w,  0, 0x40 )
672   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8,      0x80, 1 )
673   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8,     0x80, 1 )
674   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8w,     0x80, 1 )
675   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8w,    0x80, 1 )
700   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8,      0x100, 1 )
701   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8,     0x100, 1 )
702   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8x8w,     0x100, 1 )
703   GFXDECODE_ENTRY( "pcg",   0x00000, x1_pcg_8wx8w,    0x100, 1 )
676704   GFXDECODE_ENTRY( "cgrom", 0x01800, x1_chars_16x16,  0, 0x40 ) //only x1turboz uses this so far
677705   GFXDECODE_ENTRY( "kanji", 0x27000, x1_chars_16x16,  0, 0x40 ) //needs to be checked when the ROM will be redumped
678706GFXDECODE_END
r5513r5514
684712   for(i=0;i<0x300;i++)
685713      palette_set_color(machine, i,MAKE_RGB(0x00,0x00,0x00));
686714
687   for (i = 0; i < 64; i++) //text mode colors
715   for (i = 0; i < 0x20; i++)
688716   {
689      palette_set_color_rgb(machine, 2*i+1, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
690      palette_set_color_rgb(machine, 2*i+0, pal1bit(i >> 5), pal1bit(i >> 4), pal1bit(i >> 3));
717      rgb_t color;
718
719      if (i & 0x01)
720         color = MAKE_RGB(pal1bit(i >> 3), pal1bit(i >> 2), pal1bit(i >> 1));
721      else
722         color = (i & 0x10) ? RGB_WHITE : RGB_BLACK;
723
724      palette_set_color(machine, i, color);
691725   }
692726
693727   /* TODO: fix this */
694728   for(i=0;i<8;i++)
695      palette_set_color_rgb(machine, i+0x80, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
729      palette_set_color_rgb(machine, i+0x100, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
696730}
697731
698732static READ8_DEVICE_HANDLER( x1_porta_r )
699733{
700   //printf("PPI Port A read\n");
734   printf("PPI Port A read\n");
701735   return 0xff;
702736}
703737
r5513r5514
10411075   }
10421076
10431077   io_bank_mode = 0;
1078   pcg_index[0] = pcg_index[1] = pcg_index[2] = 0;
10441079}
10451080
10461081static void ctc0_interrupt(const device_config *device, int state)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team