Previous 15994 Revisions Next

r5507 Thursday 27th August, 2009 at 12:42:22 UTC by Angelo Salese
[X1]: Added preliminary bitmap support
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5506r5507
1010   - Video part is bare minimum, chances are that's probably a tilemap/bitmap nightmare;
1111   - Sort out / redump the gfx roms;
1212
13   per-game specific TODO:
14   - 177 / Dragon Buster: check why it does a tight loop (patching it makes the game go further)
15   - Dragon Buster: uses PCG + sets bitmap in a weird way;
16   - Shanghai: tests the ay8910 read regs, mouse/joystick perhaps?
17   - Gaia: Hits a FDC drive assert;
18
1319=================================================================================================
1420
1521   X1 (CZ-800C) - November, 1982
r5506r5507
121127#include "devices/basicdsk.h"
122128
123129static UINT8 hres_320,io_switch;
124static UINT8 *bitmapa_ram,*bitmapb_ram;
130static UINT8 *gfx_bitmap_ram;
125131
126132static VIDEO_START( x1 )
127133{
r5506r5507
133139
134140   w = (hres_320 & 0x40) ? 1 : 2;
135141
142   bitmap_fill(bitmap, cliprect, 0);
143
144   {
145      int count,xi,yi;
146      int pen_r,pen_g,pen_b,color;
147
148      count = 0;
149      for(yi=0;yi<8;yi++)
150      {
151         for(y=0;y<200;y+=8)
152         {
153            for(x=0;x<640;x+=8)
154            {
155               for(xi=0;xi<8;xi++)
156               {
157                  pen_r = (gfx_bitmap_ram[count+0x4000]>>(7-xi)) & 1;
158                  pen_g = (gfx_bitmap_ram[count+0x8000]>>(7-xi)) & 1;
159                  pen_b = (gfx_bitmap_ram[count+0x0000]>>(7-xi)) & 1;
160
161                  color = pen_r<<2 | pen_g<<1 | pen_b<<0;
162
163                  if((x+xi)<=video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
164                     *BITMAP_ADDR16(bitmap, y+yi, x+xi) = screen->machine->pens[color+0x80];
165
166               }
167               count++;
168            }
169         }
170         count+=48;
171      }
172   }
173
136174   for (y=0;y<25;y++)
137175   {
138176      for (x=0;x<40*w;x++)
r5506r5507
141179         int color = colorram[x+(y*40*w)] & 0x3f;
142180         int width = (colorram[x+(y*40*w)] & 0x80)>>7;
143181
144         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[width],tile,color,0,0,(x/(width+1))*8*(width+1),y*8);
182         if(tile == 0) continue; //<- correct?
183
184         if(color & 0x38)
185            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[width],tile,color,0,0,(x/(width+1))*8*(width+1),y*8);
186         else
187            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[width],tile,color,0,0,(x/(width+1))*8*(width+1),y*8,0);
145188      }
146189   }
147190
r5506r5507
326369   NULL
327370};
328371
372/* for bitmap mode */
373static UINT8 x_b,x_g,x_r;
374
375static void set_current_palette(running_machine *machine)
376{
377   UINT8 addr,r,g,b;
378
379   for(addr=0;addr<8;addr++)
380   {
381      r = ((x_r)>>(7-addr)) & 1;
382      g = ((x_g)>>(7-addr)) & 1;
383      b = ((x_b)>>(7-addr)) & 1;
384
385      palette_set_color_rgb(machine, addr+0x100, pal1bit(r), pal1bit(g), pal1bit(b));
386   }
387}
388
389static WRITE8_HANDLER( x1_pal_r_w ) { x_r = data; set_current_palette(space->machine); }
390static WRITE8_HANDLER( x1_pal_g_w ) { x_g = data; set_current_palette(space->machine); }
391static WRITE8_HANDLER( x1_pal_b_w ) { x_b = data; set_current_palette(space->machine); }
392
393
329394static ADDRESS_MAP_START( x1_mem, ADDRESS_SPACE_PROGRAM, 8 )
330395   ADDRESS_MAP_UNMAP_HIGH
331396   AM_RANGE(0x0000, 0x7fff) AM_ROMBANK(1) AM_WRITE(rom_data_w)
r5506r5507
336401   ADDRESS_MAP_UNMAP_HIGH
337402//   AM_RANGE(0x0700, 0x0701) AM_WRITENOP //YM-2151 reg/data
338403//   AM_RANGE(0x0704, 0x0707) AM_NOP //ctc regs
404//   0x0c00 rs232c port
339405   AM_RANGE(0x0e00, 0x0e02) AM_WRITE(x1_rom_w)
340406   AM_RANGE(0x0e03, 0x0e03) AM_READ(x1_rom_r)
341407//   AM_RANGE(0x0e80, 0x0e82) AM_WRITENOP //kanji registers?
342408   AM_RANGE(0x0ff8, 0x0fff) AM_READWRITE(x1_fdc_r,x1_fdc_w) //fdc registers
343//   AM_RANGE(0x1000, 0x12ff) AM_RAM //paletteram
409   AM_RANGE(0x1000, 0x10ff) AM_WRITE(x1_pal_b_w) //paletteram
410   AM_RANGE(0x1100, 0x11ff) AM_WRITE(x1_pal_r_w) //paletteram
411   AM_RANGE(0x1200, 0x12ff) AM_WRITE(x1_pal_g_w) //paletteram
344412//   AM_RANGE(0x1300, 0x13ff) AM_WRITENOP //ply port, mirrored
345//   AM_RANGE(0x1400, 0x17ff) AM_RAM //pcg?
413//   AM_RANGE(0x1400, 0x17ff) AM_RAM //PCG = Programmable Character Generator
346414   AM_RANGE(0x1800, 0x1800) AM_DEVWRITE("crtc", mc6845_address_w)
347415   AM_RANGE(0x1801, 0x1801) AM_DEVWRITE("crtc", mc6845_register_w)
348416   AM_RANGE(0x1900, 0x19ff) AM_READWRITE(sub_io_r,sub_io_w) //sub port comms, mirrored
349417   AM_RANGE(0x1a00, 0x1a03) AM_MIRROR(0xfc) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) //8255, mirrored
418//   AM_RANGE(0x1b00, 0x1bff) AM_DEVREADWRITE("ay", ay8910_r, ay8910_data_w) //PSG / ay-3-8910 data port
350419   AM_RANGE(0x1b00, 0x1bff) AM_DEVWRITE("ay", ay8910_data_w) //PSG / ay-3-8910 data port
351420   AM_RANGE(0x1c00, 0x1cff) AM_DEVWRITE("ay", ay8910_address_w) //PSG / ay-3-8910 reg port
352421   AM_RANGE(0x1d00, 0x1dff) AM_WRITE(rom_bank_1_w) //ROM bankswitch = 1
r5506r5507
358427//   AM_RANGE(0x1fd0, 0x1fdf) AM_RAM //scrn?
359428   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(&colorram)//txt mode RAM
360429   AM_RANGE(0x3000, 0x3fff) AM_RAM AM_BASE(&videoram)//txt mode RAM
361   AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(&bitmapa_ram)//gfx mode bank 1 RAM
362   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_BASE(&bitmapb_ram)//gfx mode bank 2 RAM
430   AM_RANGE(0x4000, 0xffff) AM_RAM AM_BASE(&gfx_bitmap_ram)//gfx mode bank b/r/g RAM
363431ADDRESS_MAP_END
364432
365433static const gfx_layout x1_chars_8x8 =
r5506r5507
418486
419487   //bitmap mode,TODO
420488   for(i=0;i<8;i++)
421      palette_set_color_rgb(machine, 0x200+i, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
489      palette_set_color_rgb(machine, 0x80+i, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
422490}
423491
424492static READ8_DEVICE_HANDLER( x1_porta_r )
r5506r5507
523591   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
524592   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
525593   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
526   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
527   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
528   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
594   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
529595
530596   PORT_START("IOSYS")
531597   PORT_DIPNAME( 0x01, 0x01, "IOSYS" )
r5506r5507
559625   UINT8 *ROM = memory_region(machine, "maincpu");
560626
561627   memory_set_bankptr(machine, 1, &ROM[0x00000]);
628
629   memset(gfx_bitmap_ram,0x00,0xc000);
562630}
563631
564632

Previous 15994 Revisions Next


© 1998-2018 The MESS Team