From 89f4f42e514ea65ead627ca182d1c82587c754a9 Mon Sep 17 00:00:00 2001 From: Tomasz Slanina Date: Sun, 13 Jan 2008 12:45:16 +0000 Subject: [PATCH] - removed tilemap, a bit more low level video hw emulation (with crt6845) - fake colors --- src/mame/drivers/ssingles.c | 138 +++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 50 deletions(-) diff --git a/src/mame/drivers/ssingles.c b/src/mame/drivers/ssingles.c index bff2c152e32..f49018fe915 100644 --- a/src/mame/drivers/ssingles.c +++ b/src/mame/drivers/ssingles.c @@ -2,13 +2,14 @@ 'Swinging Singles' by Ent. Ent. Ltd driver by Tomasz Slanina + Crap XXX game. Three roms contains text "BY YACHIYO" Upper half of 7.bin = upper half of 8.bin = intentional or bad dump ? TODO: - - colors (proms ? one of unk writes?) + - colors (missing prom(s) ?) - samples (at least two of unused roms contains samples (unkn. format , adpcm ?) - dips (one is tested in game (difficulty related?), another 2 are tested at start) @@ -17,54 +18,105 @@ - mem $c000, $c001 = protection device ? if tests fails, game crashes (problems with stack - skipped code with "pop af") - i/o port $8 = data read used for $e command arg for one of AY chips (volume? - could be a sample player (based on volume changes?) - i/o port $1a = 1 or 0, rarely accessed, related to crt writes + */ #include "driver.h" #include "sound/ay8910.h" #include "video/crtc6845.h" -static tilemap *ssingles_tilemap; -static UINT8 *ssingles_vram; +static UINT8 *ssingles_videoram; +static UINT8 *ssingles_colorram; static UINT8 prot_data; +#define NUM_PENS (4*8) +#define VMEM_SIZE 0x100 +static pen_t pens[NUM_PENS]; + +//fake palette +static const UINT8 ssingles_colors[NUM_PENS*3]= +{ + 0x00,0x00,0x00, 0xff,0xff,0xff, 0xff,0x00,0x00, 0x80,0x00,0x00, + 0x00,0x00,0x00, 0xf0,0xf0,0xf0, 0xff,0xff,0x00, 0x40,0x40,0x40, + 0x00,0x00,0x00, 0xff,0xff,0xff, 0xff,0x00,0x00, 0xff,0xff,0x00, + 0x00,0x00,0x00, 0xff,0xff,0x00, 0xd0,0x00,0x00, 0x80,0x00,0x00, + 0x00,0x00,0x00, 0xff,0x00,0x00, 0xff,0xff,0x00, 0x80,0x80,0x00, + 0x00,0x00,0x00, 0xff,0x00,0x00, 0x40,0x40,0x40, 0xd0,0xd0,0xd0, + 0x00,0x00,0x00, 0x00,0x00,0xff, 0x60,0x40,0x30, 0xff,0xff,0x00, + 0x00,0x00,0x00, 0xff,0x00,0xff, 0x80,0x00,0x80, 0x40,0x00,0x40 +}; + +static void update_row(mame_bitmap *bitmap, const rectangle *cliprect, + UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, void *param) +{ + int cx,x; + UINT32 tile_address; + UINT16 cell,palette; + UINT8 b0,b1; + + for(cx=0;cx>1)+(cx>>1))&0xff; + + cell=ssingles_videoram[address]+(ssingles_colorram[address]<<8); + + tile_address=((cell&0x3ff)<<4)+ra; + palette=(cell>>10)&0x1c; + + if(cx&1) + { + b0=memory_region(REGION_GFX1)[tile_address+0x0000]; /* 9.bin */ + b1=memory_region(REGION_GFX1)[tile_address+0x8000]; /* 11.bin */ + } + else + { + b0=memory_region(REGION_GFX1)[tile_address+0x4000]; /* 10.bin */ + b1=memory_region(REGION_GFX1)[tile_address+0xc000]; /* 12.bin */ + } + + for(x=7;x>=0;--x) + { + *BITMAP_ADDR32(bitmap, y, (cx<<3)|(x)) = pens[palette+((b1&1)|((b0&1)<<1))]; + b0>>=1; + b1>>=1; + } + } +} + static const crtc6845_interface crtc6845_intf = { 0, - 1000000, /* the clock of the chip - guess */ + 1000000, /* ? MHz */ 8, NULL, - NULL, + update_row, NULL, NULL }; -static TILE_GET_INFO( get_tile_info ) +static WRITE8_HANDLER(ssingles_videoram_w) { - int code = ssingles_vram[tile_index]+256*(ssingles_vram[tile_index+0x800]); - SET_TILE_INFO( - 0, - code, - 0, - 0); + ssingles_videoram[offset]=data; } -static WRITE8_HANDLER(ssingles_vram_w) +static WRITE8_HANDLER(ssingles_colorram_w) { - ssingles_vram[offset]=data; + ssingles_colorram[offset]=data; } static VIDEO_START(ssingles) { - ssingles_tilemap = tilemap_create( get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,18,113 ); //smaller than 113 crtc6845_config(0, &crtc6845_intf); + + { + int i; + for(i=0;i