mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
- Reworked/refactored S2636 emulator
- Updated all S2636 users for the new interface - Removed color tables from all games
This commit is contained in:
parent
38ac9dbdcc
commit
4ba36433ee
@ -1,278 +1,317 @@
|
||||
/*************************************************************
|
||||
* *
|
||||
* Signetics 2636 video chip *
|
||||
* *
|
||||
*************************************************************
|
||||
/**********************************************************************
|
||||
|
||||
PVI REGISTER DESCRIPTION
|
||||
------------------------
|
||||
Signetics 2636 video chip
|
||||
|
||||
| bit |R/W| description
|
||||
byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
|
||||
| | |
|
||||
FC0 | size 4| size 3| size 2| size 1| W | size of the 4 objects(=sprites)
|
||||
| | |
|
||||
FC1 | |C1 |C2 |C3 |C1 |C2 |C3 | W | colours of the 4 objects
|
||||
| | colour 1 | colour 2 | |
|
||||
FC2 | |C1 |C2 |C3 |C1 |C2 |C3 | W |
|
||||
| | colour 3 | colour 4 | |
|
||||
| | |
|
||||
FC3 | |sh |pos| W | 1=shape 0=position
|
||||
| | | display format and position
|
||||
FC4 | (free) | |
|
||||
FC5 | (free) | |
|
||||
| | |
|
||||
FC6 | |C1 |C2 |C3 |BG |scrn colr | W | background lock and colour
|
||||
| |backg colr |enb|C1 |C2 |C3 | | 3="enable"
|
||||
| | |
|
||||
FC7 | sound | W | squarewave output
|
||||
| | |
|
||||
FC8 | N1 | N2 | W | range of the 4 display digits
|
||||
FC9 | N3 | N4 | W |
|
||||
| | |
|
||||
|obj/backgrnd |complete object| R |
|
||||
FCA | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | |
|
||||
| | |
|
||||
FCB | |VR-| object collisions | R | Composition of object and back-
|
||||
| |LE |1/2|1/3|1/3|1/4|2/4|3/4| | ground,collision detection and
|
||||
| | | object display as a state display
|
||||
| | | for the status register.Set VRLE.
|
||||
| | | wait for VRST.Read out or transmit
|
||||
| | | [copy?] all bits until reset by
|
||||
| | | VRST.
|
||||
| | |
|
||||
FCC | PORT1 | R | PORT1 and PORT2 for the range of
|
||||
FCD | PORT2 | | the A/D conversion.Cleared by VRST
|
||||
FCE | (free) | |
|
||||
FCF | (free) | |
|
||||
Copyright Nicola Salmoria and the MAME Team.
|
||||
Visit http://mamedev.org for licensing and usage restrictions.
|
||||
|
||||
|
||||
Size control by byte FC0
|
||||
PVI REGISTER DESCRIPTION
|
||||
------------------------
|
||||
|
||||
bit matrix
|
||||
|0|0| 8x10
|
||||
|0|1| 16x20
|
||||
|1|0| 32x40
|
||||
|1|1| 64x80
|
||||
|
||||
CE1 and not-CE2 are outputs from the PVI.$E80..$EFF also controls the
|
||||
analogue multiplexer.
|
||||
| bit |R/W| description
|
||||
byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
|
||||
| | |
|
||||
FC0 | size 4| size 3| size 2| size 1| W | size of the 4 objects(=sprites)
|
||||
| | |
|
||||
FC1 | |C1 |C2 |C3 |C1 |C2 |C3 | W | colors of the 4 objects
|
||||
| | color 1 | color 2 | |
|
||||
FC2 | |C1 |C2 |C3 |C1 |C2 |C3 | W |
|
||||
| | color 3 | color 4 | |
|
||||
| | |
|
||||
FC3 | |sh |pos| W | 1=shape 0=position
|
||||
| | | display format and position
|
||||
FC4 | (free) | |
|
||||
FC5 | (free) | |
|
||||
| | |
|
||||
FC6 | |C1 |C2 |C3 |BG |scrn colr | W | background lock and color
|
||||
| |backg colr |enb|C1 |C2 |C3 | | 3="enable"
|
||||
| | |
|
||||
FC7 | sound | W | squarewave output
|
||||
| | |
|
||||
FC8 | N1 | N2 | W | range of the 4 display digits
|
||||
FC9 | N3 | N4 | W |
|
||||
| | |
|
||||
|obj/backgrnd |complete object| R |
|
||||
FCA | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 | |
|
||||
| | |
|
||||
FCB | |VR-| object collisions | R | Composition of object and back-
|
||||
| |LE |1/2|1/3|1/3|1/4|2/4|3/4| | ground,collision detection and
|
||||
| | | object display as a state display
|
||||
| | | for the status register.Set VRLE.
|
||||
| | | wait for VRST.Read out or transmit
|
||||
| | | [copy?] all bits until reset by
|
||||
| | | VRST.
|
||||
| | |
|
||||
FCC | PORT1 | R | PORT1 and PORT2 for the range of
|
||||
FCD | PORT2 | | the A/D conversion.Cleared by VRST
|
||||
FCE | (free) | |
|
||||
FCF | (free) | |
|
||||
|
||||
|
||||
SPRITES
|
||||
-------
|
||||
Size control by byte FC0
|
||||
|
||||
each object field: (=sprite data structure)
|
||||
bit matrix
|
||||
|0|0| 8x10
|
||||
|0|1| 16x20
|
||||
|1|0| 32x40
|
||||
|1|1| 64x80
|
||||
|
||||
0 \ 10 bytes of bitmap (Each object is 8 pixels wide.)
|
||||
9 /
|
||||
A HC horizontal object coordinate
|
||||
B HCB horizontal dublicate coordinate
|
||||
C VC vertical object coordinate
|
||||
D VCB vertical dublicate coordinate
|
||||
CE1 and not-CE2 are outputs from the PVI.$E80..$EFF also controls the
|
||||
analog multiplexer.
|
||||
|
||||
*************************************************************/
|
||||
|
||||
SPRITES
|
||||
-------
|
||||
|
||||
each object field: (=sprite data structure)
|
||||
|
||||
0 \ 10 bytes of bitmap (Each object is 8 pixels wide.)
|
||||
9 /
|
||||
A HC horizontal object coordinate
|
||||
B HCB horizontal duplicate coordinate
|
||||
C VC vertical object coordinate
|
||||
D VCB vertical duplicate coordinate
|
||||
|
||||
*************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "s2636.h"
|
||||
|
||||
static const int sprite_offsets[4] = { 0x00, 0x10, 0x20, 0x40};
|
||||
|
||||
/* To adjust sprites against bitmap */
|
||||
|
||||
UINT8 *s2636_1_ram;
|
||||
UINT8 *s2636_2_ram;
|
||||
UINT8 *s2636_3_ram;
|
||||
/*************************************
|
||||
*
|
||||
* Constants
|
||||
*
|
||||
*************************************/
|
||||
|
||||
mame_bitmap *s2636_1_bitmap;
|
||||
mame_bitmap *s2636_2_bitmap;
|
||||
mame_bitmap *s2636_3_bitmap;
|
||||
#define SPRITE_WIDTH (8)
|
||||
#define SPRITE_HEIGHT (10)
|
||||
|
||||
int s2636_x_offset;
|
||||
int s2636_y_offset;
|
||||
static const int sprite_offsets[4] = { 0x00, 0x10, 0x20, 0x40 };
|
||||
|
||||
const gfx_layout s2636_gfx_layout =
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Internal S2636 data structure
|
||||
*
|
||||
*************************************/
|
||||
|
||||
struct _s2636_t
|
||||
{
|
||||
8,10,
|
||||
5,
|
||||
1,
|
||||
{ 0 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7 },
|
||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 },
|
||||
8*16
|
||||
UINT8 *work_ram;
|
||||
int y_offset;
|
||||
int x_offset;
|
||||
|
||||
mame_bitmap *bitmap;
|
||||
mame_bitmap *collision_bitmap;
|
||||
};
|
||||
|
||||
|
||||
/*****************************************/
|
||||
/* Check for Collision between 2 sprites */
|
||||
/*****************************************/
|
||||
|
||||
static int SpriteCheck(running_machine *machine, int first,int second,UINT8 *workram,int Graphics_Bank,mame_bitmap *collision_bitmap)
|
||||
/*************************************
|
||||
*
|
||||
* Configuration
|
||||
*
|
||||
*************************************/
|
||||
|
||||
s2636_t *s2636_config(UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset)
|
||||
{
|
||||
int Checksum=0;
|
||||
int x,y;
|
||||
s2636_t *s2636;
|
||||
|
||||
// Does not check shadow sprites yet
|
||||
/* allocate the object that holds the state */
|
||||
s2636 = auto_malloc(sizeof(*s2636));
|
||||
|
||||
if((workram[sprite_offsets[first] + 10] != 0xff) && (workram[sprite_offsets[second] + 10] != 0xff))
|
||||
{
|
||||
int fx1 = workram[sprite_offsets[first] + 10] + s2636_x_offset;
|
||||
int fy1 = workram[sprite_offsets[first] + 12] + s2636_y_offset;
|
||||
int fx2 = workram[sprite_offsets[second] + 10] + s2636_x_offset;
|
||||
int fy2 = workram[sprite_offsets[second] + 12] + s2636_y_offset;
|
||||
s2636->work_ram = work_ram;
|
||||
s2636->y_offset = y_offset;
|
||||
s2636->x_offset = x_offset;
|
||||
|
||||
if((fx1>=0) && (fy1>=0) && (fx2>=0) && (fy2>=0))
|
||||
{
|
||||
int expand1 = 1 << (16+((workram[0xC0]>>(first<<1)) & 3));
|
||||
int expand2 = 1 << (16+((workram[0xC0]>>(second<<1)) & 3));
|
||||
s2636->bitmap = auto_bitmap_alloc(screen_width, screen_height, BITMAP_FORMAT_INDEXED8);
|
||||
s2636->collision_bitmap = auto_bitmap_alloc(screen_width, screen_height, BITMAP_FORMAT_INDEXED8);
|
||||
|
||||
int char1 = sprite_offsets[first]>>4;
|
||||
int char2 = sprite_offsets[second]>>4;
|
||||
|
||||
/* Draw first sprite */
|
||||
|
||||
drawgfxzoom(collision_bitmap,machine->gfx[Graphics_Bank],
|
||||
char1,
|
||||
1,
|
||||
0,0,
|
||||
fx1,fy1,
|
||||
&machine->screen[0].visarea, TRANSPARENCY_PEN, 0,
|
||||
expand1,expand1);
|
||||
|
||||
/* Get fingerprint */
|
||||
|
||||
for (x = fx1; x < fx1 + machine->gfx[Graphics_Bank]->width; x++)
|
||||
{
|
||||
for (y = fy1; y < fy1 + machine->gfx[Graphics_Bank]->height; y++)
|
||||
{
|
||||
if ((x < machine->screen[0].visarea.min_x) ||
|
||||
(x > machine->screen[0].visarea.max_x) ||
|
||||
(y < machine->screen[0].visarea.min_y) ||
|
||||
(y > machine->screen[0].visarea.max_y))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Checksum += *BITMAP_ADDR8(collision_bitmap, y, x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Blackout second sprite */
|
||||
|
||||
drawgfxzoom(collision_bitmap,machine->gfx[Graphics_Bank],
|
||||
char2,
|
||||
0,
|
||||
0,0,
|
||||
fx2,fy2,
|
||||
&machine->screen[0].visarea, TRANSPARENCY_PEN, 0,
|
||||
expand2,expand2);
|
||||
|
||||
/* Remove fingerprint */
|
||||
|
||||
for (x = fx1; x < fx1 + machine->gfx[Graphics_Bank]->width; x++)
|
||||
{
|
||||
for (y = fy1; y < fy1 + machine->gfx[Graphics_Bank]->height; y++)
|
||||
{
|
||||
if ((x < machine->screen[0].visarea.min_x) ||
|
||||
(x > machine->screen[0].visarea.max_x) ||
|
||||
(y < machine->screen[0].visarea.min_y) ||
|
||||
(y > machine->screen[0].visarea.max_y))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Checksum -= *BITMAP_ADDR8(collision_bitmap, y, x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Zero bitmap */
|
||||
|
||||
drawgfxzoom(collision_bitmap,machine->gfx[Graphics_Bank],
|
||||
char1,
|
||||
0,
|
||||
0,0,
|
||||
fx1,fy1,
|
||||
&machine->screen[0].visarea, TRANSPARENCY_PEN, 0,
|
||||
expand1,expand1);
|
||||
}
|
||||
}
|
||||
|
||||
return Checksum;
|
||||
return s2636;
|
||||
}
|
||||
|
||||
void s2636_update_bitmap(running_machine *machine,mame_bitmap *bitmap,UINT8 *workram,int Graphics_Bank,mame_bitmap *collision_bitmap)
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Draw a sprite
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void draw_sprite(UINT8 *gfx, int color, int y, int x, int expand,
|
||||
int or_mode, mame_bitmap *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
int CollisionSprite = 0;
|
||||
int spriteno;
|
||||
int offs;
|
||||
int sy;
|
||||
|
||||
for(spriteno=0;spriteno<4;spriteno++)
|
||||
{
|
||||
offs = sprite_offsets[spriteno];
|
||||
/* for each row */
|
||||
for (sy = 0; sy < SPRITE_HEIGHT; sy++)
|
||||
{
|
||||
int sx;
|
||||
|
||||
if(workram[offs+10]!=0xFF)
|
||||
/* for each pixel on the row */
|
||||
for (sx = 0; sx < SPRITE_WIDTH; sx++)
|
||||
{
|
||||
int charno = offs>>4;
|
||||
int expand = 1 << (16+((workram[0xC0]>>(spriteno<<1)) & 3));
|
||||
int bx = workram[offs+10] + s2636_x_offset;
|
||||
int by = workram[offs+12] + s2636_y_offset;
|
||||
int ey;
|
||||
|
||||
if((bx >= 0) && (by >= 0))
|
||||
{
|
||||
/* Get colour and mask correct bits */
|
||||
/* each pixel can be expanded */
|
||||
for (ey = 0; ey <= expand; ey++)
|
||||
{
|
||||
int ex;
|
||||
|
||||
int colour = workram[0xC1 + (spriteno >> 1)];
|
||||
for (ex = 0; ex <= expand; ex++)
|
||||
{
|
||||
/* compute effective destination pixel */
|
||||
int ty = y + sy * (expand + 1) + ey;
|
||||
int tx = x + sx * (expand + 1) + ex;
|
||||
|
||||
if((spriteno & 1)==0) colour >>= 3;
|
||||
/* get out if outside the drawing region */
|
||||
if ((tx < cliprect->min_x) ||
|
||||
(tx > cliprect->max_x) ||
|
||||
(ty < cliprect->min_y) ||
|
||||
(ty > cliprect->max_y))
|
||||
continue;
|
||||
|
||||
colour = (colour & 7) + 7;
|
||||
/* get out if current image bit is transparent */
|
||||
if (((gfx[sy] << sx) & 0x80) == 0x00)
|
||||
continue;
|
||||
|
||||
decodechar(machine->gfx[Graphics_Bank],charno,workram);
|
||||
|
||||
drawgfxzoom(bitmap,machine->gfx[Graphics_Bank],
|
||||
charno,
|
||||
colour,
|
||||
0,0,
|
||||
bx,by,
|
||||
&machine->screen[0].visarea,
|
||||
TRANSPARENCY_BLEND_RAW, 0,
|
||||
expand,expand);
|
||||
|
||||
/* Shadow Sprites */
|
||||
|
||||
if((workram[offs+11]!=0xff) && (workram[offs+13]!=0xfe))
|
||||
{
|
||||
bx=workram[offs+11] + s2636_x_offset;
|
||||
|
||||
if(bx >= 0)
|
||||
{
|
||||
for(;by < 255;)
|
||||
{
|
||||
by=by+10+workram[offs+13];
|
||||
|
||||
drawgfxzoom(bitmap,machine->gfx[Graphics_Bank],
|
||||
charno,
|
||||
colour,
|
||||
0,0,
|
||||
bx,by,
|
||||
&machine->screen[0].visarea,
|
||||
TRANSPARENCY_BLEND_RAW, 0,
|
||||
expand,expand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Sprite->Sprite collision detection */
|
||||
|
||||
if(SpriteCheck(machine,0,1,workram,Graphics_Bank,collision_bitmap)) CollisionSprite |= 0x20;
|
||||
if(SpriteCheck(machine,0,2,workram,Graphics_Bank,collision_bitmap)) CollisionSprite |= 0x10;
|
||||
if(SpriteCheck(machine,0,3,workram,Graphics_Bank,collision_bitmap)) CollisionSprite |= 0x08;
|
||||
if(SpriteCheck(machine,1,2,workram,Graphics_Bank,collision_bitmap)) CollisionSprite |= 0x04;
|
||||
if(SpriteCheck(machine,1,3,workram,Graphics_Bank,collision_bitmap)) CollisionSprite |= 0x02;
|
||||
if(SpriteCheck(machine,2,3,workram,Graphics_Bank,collision_bitmap)) CollisionSprite |= 0x01;
|
||||
|
||||
workram[0xCB] = CollisionSprite;
|
||||
if (or_mode)
|
||||
*BITMAP_ADDR8(bitmap, ty, tx) = 0x08 | *BITMAP_ADDR8(bitmap, ty, tx) | color;
|
||||
else
|
||||
*BITMAP_ADDR8(bitmap, ty, tx) = 0x08 | color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Collision detection
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static int check_collision(s2636_t *s2636, int spriteno1, int spriteno2, const rectangle *cliprect)
|
||||
{
|
||||
int checksum = 0;
|
||||
|
||||
UINT8* attr1 = &s2636->work_ram[sprite_offsets[spriteno1]];
|
||||
UINT8* attr2 = &s2636->work_ram[sprite_offsets[spriteno2]];
|
||||
|
||||
/* TODO: does not check shadow sprites yet */
|
||||
|
||||
fillbitmap(s2636->collision_bitmap, 0, cliprect);
|
||||
|
||||
if ((attr1[0x0a] != 0xff) && (attr2[0x0a] != 0xff))
|
||||
{
|
||||
int x, y;
|
||||
|
||||
int x1 = attr1[0x0a] + s2636->x_offset;
|
||||
int y1 = attr1[0x0c] + s2636->y_offset;
|
||||
int x2 = attr2[0x0a] + s2636->x_offset;
|
||||
int y2 = attr2[0x0c] + s2636->y_offset;
|
||||
|
||||
int expand1 = (s2636->work_ram[0xc0] >> (spriteno1 << 1)) & 0x03;
|
||||
int expand2 = (s2636->work_ram[0xc0] >> (spriteno2 << 1)) & 0x03;
|
||||
|
||||
/* draw first sprite */
|
||||
draw_sprite(attr1, 1, y1, x1, expand1, FALSE, s2636->collision_bitmap, cliprect);
|
||||
|
||||
/* get fingerprint */
|
||||
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
|
||||
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
|
||||
{
|
||||
if ((x < cliprect->min_x) ||
|
||||
(x > cliprect->max_x) ||
|
||||
(y < cliprect->min_y) ||
|
||||
(y > cliprect->max_y))
|
||||
continue;
|
||||
|
||||
checksum = checksum + *BITMAP_ADDR8(s2636->collision_bitmap, y, x);
|
||||
}
|
||||
|
||||
/* black out second sprite */
|
||||
draw_sprite(attr2, 0, y2, x2, expand2, FALSE, s2636->collision_bitmap, cliprect);
|
||||
|
||||
/* remove fingerprint */
|
||||
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
|
||||
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
|
||||
{
|
||||
if ((x < cliprect->min_x) ||
|
||||
(x > cliprect->max_x) ||
|
||||
(y < cliprect->min_y) ||
|
||||
(y > cliprect->max_y))
|
||||
continue;
|
||||
|
||||
checksum = checksum - *BITMAP_ADDR8(s2636->collision_bitmap, y, x);
|
||||
}
|
||||
}
|
||||
|
||||
return (checksum != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Main drawing
|
||||
*
|
||||
*************************************/
|
||||
|
||||
mame_bitmap *s2636_update(s2636_t *s2636, const rectangle *cliprect)
|
||||
{
|
||||
UINT8 collision = 0;
|
||||
int spriteno;
|
||||
|
||||
fillbitmap(s2636->bitmap, 0, cliprect);
|
||||
|
||||
for (spriteno = 0; spriteno < 4; spriteno++)
|
||||
{
|
||||
int color, expand, x, y;
|
||||
|
||||
UINT8* attr = &s2636->work_ram[sprite_offsets[spriteno]];
|
||||
|
||||
/* get out if sprite is turned off */
|
||||
if (attr[0x0a] == 0xff)
|
||||
continue;
|
||||
|
||||
x = attr[0x0a] + s2636->x_offset;
|
||||
y = attr[0x0c] + s2636->y_offset;
|
||||
|
||||
color = (s2636->work_ram[0xc1 + (spriteno >> 1)] >> ((spriteno & 1) ? 0 : 3)) & 0x07;
|
||||
expand = (s2636->work_ram[0xc0] >> (spriteno << 1)) & 0x03;
|
||||
|
||||
draw_sprite(attr, color, y, x, expand, TRUE, s2636->bitmap, cliprect);
|
||||
|
||||
/* bail if no shadow sprites */
|
||||
if ((attr[0x0b] == 0xff) || (attr[0x0d] == 0xfe))
|
||||
continue;
|
||||
|
||||
x = attr[0x0b] + s2636->x_offset;
|
||||
|
||||
while (y < 0xff)
|
||||
{
|
||||
y = y + SPRITE_HEIGHT + attr[0x0d];
|
||||
|
||||
draw_sprite(attr, color, y, x, expand, TRUE, s2636->bitmap, cliprect);
|
||||
}
|
||||
}
|
||||
|
||||
/* collision detection */
|
||||
if (check_collision(s2636, 0, 1, cliprect)) collision |= 0x20;
|
||||
if (check_collision(s2636, 0, 2, cliprect)) collision |= 0x10;
|
||||
if (check_collision(s2636, 0, 3, cliprect)) collision |= 0x08;
|
||||
if (check_collision(s2636, 1, 2, cliprect)) collision |= 0x04;
|
||||
if (check_collision(s2636, 1, 3, cliprect)) collision |= 0x02;
|
||||
if (check_collision(s2636, 2, 3, cliprect)) collision |= 0x01;
|
||||
|
||||
s2636->work_ram[0xcb] = collision;
|
||||
|
||||
return s2636->bitmap;
|
||||
}
|
||||
|
@ -1,15 +1,24 @@
|
||||
extern UINT8 *s2636_1_ram;
|
||||
extern UINT8 *s2636_2_ram;
|
||||
extern UINT8 *s2636_3_ram;
|
||||
/**********************************************************************
|
||||
|
||||
extern mame_bitmap *s2636_1_bitmap;
|
||||
extern mame_bitmap *s2636_2_bitmap;
|
||||
extern mame_bitmap *s2636_3_bitmap;
|
||||
Signetics 2636 video chip
|
||||
|
||||
extern int s2636_x_offset;
|
||||
extern int s2636_y_offset;
|
||||
**********************************************************************/
|
||||
|
||||
extern const gfx_layout s2636_gfx_layout;
|
||||
#ifndef S2636
|
||||
#define S2636
|
||||
|
||||
void s2636_update_bitmap(running_machine *machine,mame_bitmap *bitmap,UINT8 *workram,int Graphics_Bank,mame_bitmap *collision_bitmap);
|
||||
|
||||
typedef struct _s2636_t s2636_t;
|
||||
|
||||
/* helpful macros to parse the bitmap returned by s2636_update */
|
||||
#define S2636_IS_PIXEL_DRAWN(p) (((p) & 0x08) ? TRUE : FALSE)
|
||||
#define S2636_PIXEL_COLOR(p) ((p) & 0x07)
|
||||
|
||||
s2636_t *s2636_config(UINT8 *work_ram, int screen_height, int screen_width, int y_offset, int x_offset);
|
||||
|
||||
/* returns a BITMAP_FORMAT_INDEXED8 bitmap the size of the screen
|
||||
D0-D2 of each pixel is the pixel color
|
||||
D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn */
|
||||
mame_bitmap *s2636_update(s2636_t *s2636, const rectangle *cliprect);
|
||||
|
||||
#endif
|
||||
|
@ -585,7 +585,6 @@ static MACHINE_DRIVER_START( csk227it )
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1)
|
||||
MDRV_GFXDECODE(csk)
|
||||
MDRV_PALETTE_LENGTH(2048)
|
||||
MDRV_COLORTABLE_LENGTH(2048)
|
||||
|
||||
MDRV_VIDEO_START(cska)
|
||||
MDRV_VIDEO_UPDATE(cska)
|
||||
|
@ -121,6 +121,9 @@ UINT8 *cvs_video_ram;
|
||||
UINT8 *cvs_bullet_ram;
|
||||
UINT8 *cvs_palette_ram;
|
||||
UINT8 *cvs_character_ram;
|
||||
UINT8 *cvs_s2636_0_ram;
|
||||
UINT8 *cvs_s2636_1_ram;
|
||||
UINT8 *cvs_s2636_2_ram;
|
||||
|
||||
static UINT8 *cvs_4_bit_dac_data;
|
||||
static UINT8 *cvs_tms5110_ctl_data;
|
||||
@ -178,54 +181,54 @@ WRITE8_HANDLER( cvs_bullet_ram_or_palette_w )
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_1_or_character_ram_r )
|
||||
READ8_HANDLER( cvs_s2636_0_or_character_ram_r )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
return cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
else
|
||||
return s2636_1_ram[offset];
|
||||
return cvs_s2636_0_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset] = data;
|
||||
else
|
||||
cvs_s2636_0_ram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_1_or_character_ram_r )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
return cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
else
|
||||
return cvs_s2636_1_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
cvs_character_ram[(0 * 0x800) | 0x400 | character_ram_page_start | offset] = data;
|
||||
cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset] = data;
|
||||
else
|
||||
s2636_1_ram[offset] = data;
|
||||
cvs_s2636_1_ram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_2_or_character_ram_r )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
return cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
return cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
else
|
||||
return s2636_2_ram[offset];
|
||||
return cvs_s2636_2_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
cvs_character_ram[(1 * 0x800) | 0x400 | character_ram_page_start | offset] = data;
|
||||
else
|
||||
s2636_2_ram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( cvs_s2636_3_or_character_ram_r )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
return cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset];
|
||||
else
|
||||
return s2636_3_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cvs_s2636_3_or_character_ram_w )
|
||||
{
|
||||
if (activecpu_get_reg(S2650_FO))
|
||||
cvs_character_ram[(2 * 0x800) | 0x400 | character_ram_page_start | offset] = data;
|
||||
else
|
||||
s2636_3_ram[offset] = data;
|
||||
cvs_s2636_2_ram[offset] = data;
|
||||
}
|
||||
|
||||
|
||||
@ -480,6 +483,9 @@ MACHINE_START( cvs )
|
||||
by allocating twice the amount,
|
||||
we can use the same gfx_layout */
|
||||
/* register state save */
|
||||
state_save_register_global_pointer(cvs_color_ram, 0x400);
|
||||
state_save_register_global_pointer(cvs_palette_ram, 0x10);
|
||||
state_save_register_global_pointer(cvs_character_ram, 3 * 0x800);
|
||||
state_save_register_global(character_banking_mode);
|
||||
state_save_register_global(character_ram_page_start);
|
||||
state_save_register_global(speech_rom_bit_address);
|
||||
@ -497,9 +503,9 @@ static ADDRESS_MAP_START( cvs_main_cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_FLAGS( AMEF_ABITS(15) )
|
||||
AM_RANGE(0x0000, 0x13ff) AM_ROM
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, cvs_bullet_ram_or_palette_w) AM_BASE(&cvs_bullet_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_3_or_character_ram_r, cvs_s2636_3_or_character_ram_w) AM_BASE(&s2636_3_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) AM_BASE(&s2636_2_ram)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) AM_BASE(&s2636_1_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) AM_BASE(&cvs_s2636_2_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) AM_BASE(&cvs_s2636_1_ram)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) AM_BASE(&cvs_s2636_0_ram)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, cvs_video_or_color_ram_w) AM_BASE(&cvs_video_ram)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
|
||||
AM_RANGE(0x2000, 0x33ff) AM_ROM
|
||||
@ -649,10 +655,7 @@ static const gfx_layout charlayout =
|
||||
};
|
||||
|
||||
static GFXDECODE_START( cvs )
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 256+3 ) /* chars */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2636_gfx_layout, (256+3)*8, 8 ) /* s2636 #1 */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2636_gfx_layout, (256+3)*8, 8 ) /* s2636 #2 */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2636_gfx_layout, (256+3)*8, 8 ) /* s2636 #3 */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 256+4 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
@ -687,8 +690,7 @@ static MACHINE_DRIVER_START( cvs )
|
||||
MDRV_VIDEO_UPDATE(cvs)
|
||||
|
||||
MDRV_GFXDECODE(cvs)
|
||||
MDRV_PALETTE_LENGTH(16)
|
||||
MDRV_COLORTABLE_LENGTH((256+3)*8+(8*2))
|
||||
MDRV_PALETTE_LENGTH((256+4)*8+8+1)
|
||||
MDRV_PALETTE_INIT(cvs)
|
||||
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||
|
@ -31,6 +31,10 @@ extern WRITE8_HANDLER( laserbat_csound2_w );
|
||||
static tilemap *bg_tilemap;
|
||||
static int laserbat_video_page = 0;
|
||||
static int laserbat_input_mux = 0;
|
||||
static s2636_t *s2636_0, *s2636_1, *s2636_2;
|
||||
static UINT8 *s2636_0_ram;
|
||||
static UINT8 *s2636_1_ram;
|
||||
static UINT8 *s2636_2_ram;
|
||||
|
||||
static mame_bitmap *collision_bitmap;
|
||||
|
||||
@ -182,9 +186,9 @@ static ADDRESS_MAP_START( laserbat_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x7800, 0x7bff) AM_ROM
|
||||
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_WRITENOP // always 0 (bullet ram in Quasar)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_1_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_2_ram)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_3_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_0_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_1_ram)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_RAM AM_BASE(&s2636_2_ram)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(laserbat_videoram_w)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
@ -489,9 +493,6 @@ static const gfx_layout sprites_layout =
|
||||
|
||||
static GFXDECODE_START( laserbat )
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 256 ) /* Rom chars */
|
||||
GFXDECODE_ENTRY( REGION_CPU1, 0x1500, s2636_gfx_layout, 0, 8 ) /* s2636 #1 */
|
||||
GFXDECODE_ENTRY( REGION_CPU1, 0x1600, s2636_gfx_layout, 0, 8 ) /* s2636 #2 */
|
||||
GFXDECODE_ENTRY( REGION_CPU1, 0x1700, s2636_gfx_layout, 0, 8 ) /* s2636 #3 */
|
||||
GFXDECODE_ENTRY( REGION_GFX2, 0x0000, sprites_layout, 0, 8 ) /* Sprites */
|
||||
GFXDECODE_END
|
||||
|
||||
@ -510,24 +511,56 @@ static VIDEO_START( laserbat )
|
||||
|
||||
collision_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,BITMAP_FORMAT_INDEXED8);
|
||||
|
||||
s2636_x_offset = -19;
|
||||
/* configure the S2636 chips */
|
||||
s2636_0 = s2636_config(s2636_0_ram, machine->screen[0].height, machine->screen[0].width, 0, -19);
|
||||
s2636_1 = s2636_config(s2636_1_ram, machine->screen[0].height, machine->screen[0].width, 0, -19);
|
||||
s2636_2 = s2636_config(s2636_2_ram, machine->screen[0].height, machine->screen[0].width, 0, -19);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( laserbat )
|
||||
{
|
||||
int y;
|
||||
mame_bitmap *s2636_0_bitmap;
|
||||
mame_bitmap *s2636_1_bitmap;
|
||||
mame_bitmap *s2636_2_bitmap;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
|
||||
s2636_update_bitmap(machine,bitmap,s2636_1_ram,1,collision_bitmap);
|
||||
s2636_update_bitmap(machine,bitmap,s2636_2_ram,2,collision_bitmap);
|
||||
s2636_update_bitmap(machine,bitmap,s2636_3_ram,3,collision_bitmap);
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(s2636_2, cliprect);
|
||||
|
||||
/* copy the S2636 images into the main bitmap */
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
int x;
|
||||
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
int pixel0 = *BITMAP_ADDR8(s2636_0_bitmap, y, x);
|
||||
int pixel1 = *BITMAP_ADDR8(s2636_1_bitmap, y, x);
|
||||
int pixel2 = *BITMAP_ADDR8(s2636_2_bitmap, y, x);
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0))
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel0)];
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1))
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel1)];
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2))
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel2)];
|
||||
}
|
||||
}
|
||||
|
||||
if(sprite_info.enable)
|
||||
drawgfx(bitmap,machine->gfx[4],
|
||||
drawgfx(bitmap,machine->gfx[1],
|
||||
sprite_info.code,
|
||||
sprite_info.color,
|
||||
0,0,
|
||||
sprite_info.x - 6,sprite_info.y,
|
||||
cliprect,TRANSPARENCY_PEN,0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -677,7 +710,6 @@ static MACHINE_DRIVER_START( laserbat )
|
||||
|
||||
MDRV_GFXDECODE(laserbat)
|
||||
MDRV_PALETTE_LENGTH(1024)
|
||||
MDRV_COLORTABLE_LENGTH(4096)
|
||||
|
||||
MDRV_VIDEO_START(laserbat)
|
||||
MDRV_VIDEO_UPDATE(laserbat)
|
||||
|
@ -49,6 +49,8 @@ extern int malzak_x;
|
||||
extern int malzak_y;
|
||||
|
||||
extern UINT8* saa5050_vidram; /* Video RAM for SAA 5050 */
|
||||
extern UINT8 *malzak_s2636_0_ram;
|
||||
extern UINT8 *malzak_s2636_1_ram;
|
||||
|
||||
// in video/malzak.c
|
||||
VIDEO_START( malzak );
|
||||
@ -68,7 +70,7 @@ static WRITE8_HANDLER( saa5050_w )
|
||||
|
||||
static READ8_HANDLER( fake_VRLE_r )
|
||||
{
|
||||
return (s2636_1_ram[0xcb] & 0x3f) + (video_screen_get_vblank(0)*0x40);
|
||||
return (malzak_s2636_0_ram[0xcb] & 0x3f) + (video_screen_get_vblank(0)*0x40);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( ram_mirror_r )
|
||||
@ -144,8 +146,8 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x1100, 0x11ff) AM_WRITE(MWA8_RAM)
|
||||
AM_RANGE(0x1200, 0x12ff) AM_WRITE(MWA8_RAM)
|
||||
AM_RANGE(0x1300, 0x13ff) AM_WRITE(MWA8_RAM)
|
||||
AM_RANGE(0x1400, 0x14ff) AM_WRITE(MWA8_RAM) AM_BASE(&s2636_1_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_WRITE(MWA8_RAM) AM_BASE(&s2636_2_ram)
|
||||
AM_RANGE(0x1400, 0x14ff) AM_WRITE(MWA8_RAM) AM_BASE(&malzak_s2636_0_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_WRITE(MWA8_RAM) AM_BASE(&malzak_s2636_1_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_WRITE(playfield_w)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_WRITE(MWA8_RAM)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_WRITE(MWA8_RAM)
|
||||
@ -360,11 +362,9 @@ static const gfx_layout saa5050_lolayout =
|
||||
8 * 10
|
||||
};
|
||||
|
||||
//add s2636 decodes here (i.e. from zac2650) and maybe re-arrange them
|
||||
|
||||
static GFXDECODE_START( malzak )
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 16 )
|
||||
GFXDECODE_ENTRY( REGION_CPU1, 0x0000, s2636_gfx_layout, 0, 8 ) /* s2636 #1 */
|
||||
GFXDECODE_ENTRY( REGION_CPU1, 0x0000, s2636_gfx_layout, 0, 8 ) /* s2636 #2 */
|
||||
GFXDECODE_ENTRY( REGION_GFX2, 0x0000, saa5050_charlayout, 0, 128 )
|
||||
GFXDECODE_ENTRY( REGION_GFX2, 0x0000, saa5050_hilayout, 0, 128 )
|
||||
GFXDECODE_ENTRY( REGION_GFX2, 0x0000, saa5050_lolayout, 0, 128 )
|
||||
|
@ -71,10 +71,10 @@ VIDEO_START( quasar );
|
||||
|
||||
|
||||
extern UINT8 *quasar_effectram;
|
||||
extern int quasar_effectcontrol;
|
||||
extern UINT8 quasar_effectcontrol;
|
||||
|
||||
static int page = 0;
|
||||
static int IOpage = 8;
|
||||
static UINT8 page = 0;
|
||||
static UINT8 IOpage = 8;
|
||||
|
||||
|
||||
/************************************************************************
|
||||
@ -87,44 +87,14 @@ static int IOpage = 8;
|
||||
|
||||
************************************************************************/
|
||||
|
||||
static WRITE8_HANDLER( page_0_w )
|
||||
static WRITE8_HANDLER( video_page_select_w )
|
||||
{
|
||||
page = 0;
|
||||
page = offset & 0x03;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_1_w )
|
||||
static WRITE8_HANDLER( io_page_select_w )
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_2_w )
|
||||
{
|
||||
page = 2;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_3_w )
|
||||
{
|
||||
page = 3;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_8_w )
|
||||
{
|
||||
IOpage = 8;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_9_w )
|
||||
{
|
||||
IOpage = 9;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_A_w )
|
||||
{
|
||||
IOpage = 10;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( page_B_w )
|
||||
{
|
||||
IOpage = 11;
|
||||
IOpage = offset & 0x03;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( quasar_video_w )
|
||||
@ -140,12 +110,12 @@ static WRITE8_HANDLER( quasar_video_w )
|
||||
|
||||
static READ8_HANDLER( quasar_IO_r )
|
||||
{
|
||||
UINT32 ans = 0;
|
||||
UINT8 ans = 0;
|
||||
|
||||
if (IOpage == 8) ans = input_port_0_r(0);
|
||||
if (IOpage == 9) ans = input_port_1_r(0);
|
||||
if (IOpage == 10) ans = input_port_2_r(0);
|
||||
if (IOpage == 11) ans = input_port_3_r(0);
|
||||
if (IOpage == 0) ans = input_port_0_r(0);
|
||||
if (IOpage == 1) ans = input_port_1_r(0);
|
||||
if (IOpage == 2) ans = input_port_2_r(0);
|
||||
if (IOpage == 3) ans = input_port_3_r(0);
|
||||
|
||||
return ans;
|
||||
}
|
||||
@ -198,9 +168,9 @@ static WRITE8_HANDLER( Quasar_DAC_w )
|
||||
static ADDRESS_MAP_START( quasar, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x13ff) AM_ROM
|
||||
AM_RANGE(0x1400, 0x14ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_bullet_ram_or_palette_r, quasar_bullet_w) AM_BASE(&cvs_bullet_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) AM_BASE(&s2636_1_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) AM_BASE(&s2636_2_ram)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_3_or_character_ram_r, cvs_s2636_3_or_character_ram_w) AM_BASE(&s2636_3_ram)
|
||||
AM_RANGE(0x1500, 0x15ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_0_or_character_ram_r, cvs_s2636_0_or_character_ram_w) AM_BASE(&cvs_s2636_0_ram)
|
||||
AM_RANGE(0x1600, 0x16ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_1_or_character_ram_r, cvs_s2636_1_or_character_ram_w) AM_BASE(&cvs_s2636_1_ram)
|
||||
AM_RANGE(0x1700, 0x17ff) AM_MIRROR(0x6000) AM_READWRITE(cvs_s2636_2_or_character_ram_r, cvs_s2636_2_or_character_ram_w) AM_BASE(&cvs_s2636_2_ram)
|
||||
AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_READWRITE(cvs_video_or_color_ram_r, quasar_video_w) AM_BASE(&cvs_video_ram)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM
|
||||
AM_RANGE(0x2000, 0x33ff) AM_ROM
|
||||
@ -209,14 +179,8 @@ static ADDRESS_MAP_START( quasar, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( quasar_io, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(0x00, 0x00) AM_READWRITE(quasar_IO_r, page_0_w)
|
||||
AM_RANGE(0x01, 0x01) AM_WRITE(page_1_w)
|
||||
AM_RANGE(0x02, 0x02) AM_WRITE(page_2_w)
|
||||
AM_RANGE(0x03, 0x03) AM_WRITE(page_3_w)
|
||||
AM_RANGE(0x08, 0x08) AM_WRITE(page_8_w)
|
||||
AM_RANGE(0x09, 0x09) AM_WRITE(page_9_w)
|
||||
AM_RANGE(0x0A, 0x0A) AM_WRITE(page_A_w)
|
||||
AM_RANGE(0x0B, 0x0B) AM_WRITE(page_B_w)
|
||||
AM_RANGE(0x00, 0x03) AM_READWRITE(quasar_IO_r, video_page_select_w)
|
||||
AM_RANGE(0x08, 0x0b) AM_WRITE(io_page_select_w)
|
||||
AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READWRITE(cvs_collision_clear, quasar_sh_command_w)
|
||||
AM_RANGE(S2650_CTRL_PORT, S2650_CTRL_PORT) AM_READWRITE(cvs_collision_r, MWA8_NOP)
|
||||
AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(input_port_4_r)
|
||||
@ -364,10 +328,7 @@ static const gfx_layout charlayout =
|
||||
/* S2636 Mappings */
|
||||
|
||||
static GFXDECODE_START( quasar )
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 256 ) /* Rom chars */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2636_gfx_layout, 2072, 8 ) /* s2636 #1 */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2636_gfx_layout, 2072, 8 ) /* s2636 #2 */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2636_gfx_layout, 2072, 8 ) /* s2636 #3 */
|
||||
GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 64+1 ) /* ROM chars */
|
||||
GFXDECODE_END
|
||||
|
||||
static INTERRUPT_GEN( quasar_interrupt )
|
||||
@ -404,8 +365,7 @@ static MACHINE_DRIVER_START( quasar )
|
||||
MDRV_SCREEN_VISIBLE_AREA(1*8+1, 29*8-1, 2*8, 32*8-1)
|
||||
|
||||
MDRV_GFXDECODE(quasar)
|
||||
MDRV_PALETTE_LENGTH(1024)
|
||||
MDRV_COLORTABLE_LENGTH(4096)
|
||||
MDRV_PALETTE_LENGTH((64+1)*8+(4*256))
|
||||
|
||||
MDRV_PALETTE_INIT(quasar)
|
||||
MDRV_VIDEO_START(quasar)
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "tinv2650.lh"
|
||||
|
||||
extern UINT8 *zac2650_s2636_0_ram;
|
||||
WRITE8_HANDLER( tinvader_videoram_w );
|
||||
static WRITE8_HANDLER( tinvader_sound_w );
|
||||
READ8_HANDLER( zac_s2636_r );
|
||||
@ -43,7 +44,7 @@ static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x1d00, 0x1dff) AM_WRITE(MWA8_RAM)
|
||||
AM_RANGE(0x1e80, 0x1e80) AM_WRITE(tinvader_sound_w)
|
||||
AM_RANGE(0x1e86, 0x1e86) AM_WRITE(MWA8_NOP) /* Dodgem Only */
|
||||
AM_RANGE(0x1f00, 0x1fff) AM_WRITE(MWA8_RAM) AM_BASE(&s2636_1_ram)
|
||||
AM_RANGE(0x1f00, 0x1fff) AM_WRITE(MWA8_RAM) AM_BASE(&zac2650_s2636_0_ram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
|
||||
@ -236,12 +237,10 @@ INPUT_PORTS_END
|
||||
|
||||
static PALETTE_INIT( zac2650 )
|
||||
{
|
||||
palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
|
||||
palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
|
||||
colortable[0] = 0;
|
||||
colortable[1] = 1;
|
||||
colortable[2] = 0;
|
||||
colortable[3] = 0;
|
||||
palette_set_color(machine,0,RGB_BLACK);
|
||||
palette_set_color(machine,1,RGB_WHITE);
|
||||
palette_set_color(machine,2,RGB_BLACK);
|
||||
palette_set_color(machine,3,RGB_BLACK);
|
||||
}
|
||||
|
||||
/************************************************************************************************
|
||||
@ -333,8 +332,7 @@ static MACHINE_DRIVER_START( tinvader )
|
||||
MDRV_SCREEN_SIZE(30*24, 32*24)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0, 719, 0, 767)
|
||||
MDRV_GFXDECODE(tinvader)
|
||||
MDRV_PALETTE_LENGTH(2)
|
||||
MDRV_COLORTABLE_LENGTH(4)
|
||||
MDRV_PALETTE_LENGTH(4)
|
||||
|
||||
MDRV_PALETTE_INIT(zac2650)
|
||||
MDRV_VIDEO_START(tinvader)
|
||||
|
@ -4,6 +4,11 @@
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#define CVS_S2636_Y_OFFSET (3)
|
||||
#define CVS_S2636_X_OFFSET (-26)
|
||||
|
||||
|
||||
/*----------- defined in driver/cvs.c -----------*/
|
||||
|
||||
extern UINT8 *cvs_color_ram;
|
||||
@ -11,6 +16,9 @@ extern UINT8 *cvs_video_ram;
|
||||
extern UINT8 *cvs_bullet_ram;
|
||||
extern UINT8 *cvs_palette_ram;
|
||||
extern UINT8 *cvs_character_ram;
|
||||
extern UINT8 *cvs_s2636_0_ram;
|
||||
extern UINT8 *cvs_s2636_1_ram;
|
||||
extern UINT8 *cvs_s2636_2_ram;
|
||||
|
||||
MACHINE_START( cvs );
|
||||
|
||||
@ -20,19 +28,18 @@ WRITE8_HANDLER( cvs_video_or_color_ram_w );
|
||||
READ8_HANDLER( cvs_bullet_ram_or_palette_r );
|
||||
WRITE8_HANDLER( cvs_bullet_ram_or_palette_w );
|
||||
|
||||
READ8_HANDLER( cvs_s2636_0_or_character_ram_r );
|
||||
WRITE8_HANDLER( cvs_s2636_0_or_character_ram_w );
|
||||
READ8_HANDLER( cvs_s2636_1_or_character_ram_r );
|
||||
WRITE8_HANDLER( cvs_s2636_1_or_character_ram_w );
|
||||
READ8_HANDLER( cvs_s2636_2_or_character_ram_r );
|
||||
WRITE8_HANDLER( cvs_s2636_2_or_character_ram_w );
|
||||
READ8_HANDLER( cvs_s2636_3_or_character_ram_r );
|
||||
WRITE8_HANDLER( cvs_s2636_3_or_character_ram_w );
|
||||
|
||||
UINT8 cvs_get_character_banking_mode(void);
|
||||
|
||||
|
||||
/*----------- defined in video/cvs.c -----------*/
|
||||
|
||||
extern mame_bitmap *cvs_collision_bitmap;
|
||||
extern mame_bitmap *cvs_collision_background;
|
||||
extern int cvs_collision_register;
|
||||
|
||||
@ -47,4 +54,3 @@ READ8_HANDLER( cvs_collision_r );
|
||||
READ8_HANDLER( cvs_collision_clear );
|
||||
|
||||
void cvs_scroll_stars(void);
|
||||
|
||||
|
@ -12,26 +12,19 @@
|
||||
#include "cvs.h"
|
||||
|
||||
|
||||
#define MAX_STARS 250
|
||||
#define STARS_COLOR_BASE 16
|
||||
#define SPRITE_PEN_BASE (0x820)
|
||||
#define BULLET_STAR_PEN (0x828)
|
||||
|
||||
#define MAX_STARS 250
|
||||
#define STARS_COLOR_BASE 16
|
||||
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
#define BL0 0
|
||||
#define BL1 1
|
||||
#define BL2 2
|
||||
#define BL3 3
|
||||
#define WL0 0
|
||||
#define WL1 1
|
||||
#else
|
||||
#define BL0 3
|
||||
#define BL1 2
|
||||
#define BL2 1
|
||||
#define BL3 0
|
||||
#define WL0 1
|
||||
#define WL1 0
|
||||
#endif
|
||||
static s2636_t *s2636_0, *s2636_1, *s2636_2;
|
||||
static mame_bitmap *background_bitmap;
|
||||
mame_bitmap *cvs_collision_background;
|
||||
static mame_bitmap *scrolled_collision_background;
|
||||
|
||||
int cvs_collision_register;
|
||||
|
||||
struct star
|
||||
{
|
||||
@ -45,13 +38,6 @@ static int stars_on;
|
||||
static UINT8 scroll_reg;
|
||||
static int stars_scroll;
|
||||
|
||||
static mame_bitmap *background_bitmap;
|
||||
mame_bitmap *cvs_collision_bitmap;
|
||||
mame_bitmap *cvs_collision_background;
|
||||
static mame_bitmap *scrolled_background;
|
||||
|
||||
int cvs_collision_register;
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Convert Colour prom to format for Mame Colour Map *
|
||||
@ -64,47 +50,59 @@ int cvs_collision_register;
|
||||
|
||||
PALETTE_INIT( cvs )
|
||||
{
|
||||
int attr,col,map;
|
||||
int i, attr;
|
||||
|
||||
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x10);
|
||||
|
||||
/* Colour Mapping Prom */
|
||||
|
||||
for(attr = 0;attr < 256; attr++)
|
||||
/* color mapping PROM */
|
||||
for (attr = 0; attr < 0x100; attr++)
|
||||
{
|
||||
for(col = 0; col < 8; col++)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
map = color_prom[(col * 256) + attr];
|
||||
UINT8 ctabentry = color_prom[(i << 8) | attr] & 0x07;
|
||||
|
||||
/* bits 0 and 2 are swapped */
|
||||
ctabentry = BITSWAP8(ctabentry,7,6,5,4,3,0,1,2);
|
||||
|
||||
COLOR(0,attr*8 + col) = ((map & 1) << 2) + (map & 2) + ((map & 4) >> 2);
|
||||
colortable_entry_set_value(machine->colortable, (attr << 3) | i, ctabentry);
|
||||
}
|
||||
}
|
||||
|
||||
/* Background Collision Map */
|
||||
|
||||
for(map=0;map<8;map++)
|
||||
/* background collision map */
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
COLOR(0,2048+map) = (map & 4) >> 2;
|
||||
COLOR(0,2056+map) = (map & 2) >> 1;
|
||||
COLOR(0,2064+map) = ((map & 2) >> 1) || ((map & 4) >> 2);
|
||||
colortable_entry_set_value(machine->colortable, 0x800 + i, 0);
|
||||
colortable_entry_set_value(machine->colortable, 0x808 + i, i & 0x04);
|
||||
colortable_entry_set_value(machine->colortable, 0x810 + i, i & 0x02);
|
||||
colortable_entry_set_value(machine->colortable, 0x818 + i, i & 0x06);
|
||||
}
|
||||
|
||||
/* Sprites */
|
||||
/* sprites */
|
||||
for (i = 0; i < 8; i++)
|
||||
colortable_entry_set_value(machine->colortable, SPRITE_PEN_BASE + i, i | 0x08);
|
||||
|
||||
for(map=0;map<8;map++)
|
||||
{
|
||||
COLOR(1,map*2+0) = 0;
|
||||
COLOR(1,map*2+1) = 8 + map;
|
||||
}
|
||||
|
||||
/* set the sprite chip offsets */
|
||||
s2636_x_offset = -26;
|
||||
s2636_y_offset = 3;
|
||||
/* bullet */
|
||||
colortable_entry_set_value(machine->colortable, BULLET_STAR_PEN, 7);
|
||||
}
|
||||
|
||||
|
||||
static void set_pens(running_machine *machine)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x10; i++)
|
||||
{
|
||||
int r = pal2bit(~cvs_palette_ram[i] >> 0);
|
||||
int g = pal3bit(~cvs_palette_ram[i] >> 2);
|
||||
int b = pal3bit(~cvs_palette_ram[i] >> 5);
|
||||
|
||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
WRITE8_HANDLER( cvs_video_fx_w )
|
||||
{
|
||||
if (data & 0xce)
|
||||
@ -185,18 +183,15 @@ VIDEO_START( cvs )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* create the bitmaps for the S2636 chips */
|
||||
s2636_1_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED8);
|
||||
s2636_2_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED8);
|
||||
s2636_3_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED8);
|
||||
|
||||
/* configure the S2636 chips */
|
||||
s2636_0 = s2636_config(cvs_s2636_0_ram, machine->screen[0].height, machine->screen[0].width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
s2636_1 = s2636_config(cvs_s2636_1_ram, machine->screen[0].height, machine->screen[0].width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
s2636_2 = s2636_config(cvs_s2636_2_ram, machine->screen[0].height, machine->screen[0].width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
|
||||
/* create helper bitmaps */
|
||||
background_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
|
||||
cvs_collision_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED8);
|
||||
cvs_collision_background = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED8);
|
||||
scrolled_background = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED8);
|
||||
cvs_collision_background = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
|
||||
scrolled_collision_background = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
|
||||
}
|
||||
|
||||
|
||||
@ -215,16 +210,11 @@ VIDEO_UPDATE( cvs )
|
||||
offs_t offs;
|
||||
int scroll[8];
|
||||
UINT8 character_banking_mode;
|
||||
mame_bitmap *s2636_0_bitmap;
|
||||
mame_bitmap *s2636_1_bitmap;
|
||||
mame_bitmap *s2636_2_bitmap;
|
||||
|
||||
|
||||
/* set the palette */
|
||||
for (offs = 0; offs < 0x10; offs++)
|
||||
{
|
||||
UINT8 data = cvs_palette_ram[offs];
|
||||
|
||||
palette_set_color_rgb(machine, offs, pal2bit(~data >> 0), pal3bit(~data >> 2), pal3bit(~data >> 5));
|
||||
}
|
||||
|
||||
set_pens(machine);
|
||||
|
||||
/* create our background character set, which is a software
|
||||
selectable mixture of RAM and ROM based tiles */
|
||||
@ -239,11 +229,10 @@ VIDEO_UPDATE( cvs )
|
||||
for (; code < 0x100; code++)
|
||||
decodechar(machine->gfx[0], code, cvs_character_ram);
|
||||
|
||||
|
||||
/* draw the background */
|
||||
for (offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
int collision_color = 0;
|
||||
int collision_color = 0x100;
|
||||
|
||||
UINT8 code = cvs_video_ram[offs];
|
||||
UINT8 color = cvs_color_ram[offs];
|
||||
@ -259,21 +248,20 @@ VIDEO_UPDATE( cvs )
|
||||
|
||||
/* foreground for collision detection */
|
||||
if (color & 0x80)
|
||||
collision_color = 258;
|
||||
collision_color = 0x103;
|
||||
else
|
||||
{
|
||||
if ((color & 0x03) == 3)
|
||||
collision_color = 256;
|
||||
else if((color & 0x01) == 0)
|
||||
collision_color = 257;
|
||||
if ((color & 0x03) == 0x03)
|
||||
collision_color = 0x101;
|
||||
else if ((color & 0x01) == 0)
|
||||
collision_color = 0x102;
|
||||
}
|
||||
|
||||
if (collision_color)
|
||||
drawgfx(cvs_collision_background, machine->gfx[0],
|
||||
code, collision_color,
|
||||
0, 0,
|
||||
x, y,
|
||||
0, TRANSPARENCY_NONE, 0);
|
||||
drawgfx(cvs_collision_background, machine->gfx[0],
|
||||
code, collision_color,
|
||||
0, 0,
|
||||
x, y,
|
||||
0, TRANSPARENCY_NONE, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -288,22 +276,15 @@ VIDEO_UPDATE( cvs )
|
||||
scroll[6] = 0;
|
||||
scroll[7] = 0;
|
||||
|
||||
copyscrollbitmap(bitmap,background_bitmap,0,0,8,scroll,&machine->screen[0].visarea);
|
||||
copyscrollbitmap(scrolled_background,cvs_collision_background,0,0,8,scroll,&machine->screen[0].visarea);
|
||||
copyscrollbitmap(bitmap, background_bitmap, 0, 0, 8, scroll, cliprect);
|
||||
copyscrollbitmap(scrolled_collision_background, cvs_collision_background, 0, 0, 8, scroll, cliprect);
|
||||
|
||||
/* 2636's */
|
||||
|
||||
fillbitmap(s2636_1_bitmap,0,0);
|
||||
s2636_update_bitmap(machine,s2636_1_bitmap,s2636_1_ram,1,cvs_collision_bitmap);
|
||||
|
||||
fillbitmap(s2636_2_bitmap,0,0);
|
||||
s2636_update_bitmap(machine,s2636_2_bitmap,s2636_2_ram,2,cvs_collision_bitmap);
|
||||
|
||||
fillbitmap(s2636_3_bitmap,0,0);
|
||||
s2636_update_bitmap(machine,s2636_3_bitmap,s2636_3_ram,3,cvs_collision_bitmap);
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(s2636_2, cliprect);
|
||||
|
||||
/* Bullet Hardware */
|
||||
|
||||
for (offs = 8; offs < 256; offs++ )
|
||||
{
|
||||
if (cvs_bullet_ram[offs] != 0)
|
||||
@ -314,72 +295,54 @@ VIDEO_UPDATE( cvs )
|
||||
int bx=255-7-cvs_bullet_ram[offs]-ct;
|
||||
|
||||
/* Bullet/Object Collision */
|
||||
if ((*BITMAP_ADDR8(s2636_1_bitmap, offs, bx) != 0) ||
|
||||
(*BITMAP_ADDR8(s2636_2_bitmap, offs, bx) != 0) ||
|
||||
(*BITMAP_ADDR8(s2636_3_bitmap, offs, bx) != 0))
|
||||
cvs_collision_register |= 8;
|
||||
if ((*BITMAP_ADDR8(s2636_0_bitmap, offs, bx) != 0) ||
|
||||
(*BITMAP_ADDR8(s2636_1_bitmap, offs, bx) != 0) ||
|
||||
(*BITMAP_ADDR8(s2636_2_bitmap, offs, bx) != 0))
|
||||
cvs_collision_register |= 0x08;
|
||||
|
||||
/* Bullet/Background Collision */
|
||||
if (*BITMAP_ADDR8(scrolled_background, offs, bx) != machine->pens[0])
|
||||
if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(scrolled_collision_background, offs, bx)))
|
||||
cvs_collision_register |= 0x80;
|
||||
|
||||
*BITMAP_ADDR16(bitmap, offs, bx) = machine->pens[7];
|
||||
*BITMAP_ADDR16(bitmap, offs, bx) = machine->pens[BULLET_STAR_PEN];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update 2636 images */
|
||||
|
||||
/* mix and copy the S2636 images into the main bitmap, also check for collision */
|
||||
{
|
||||
int x;
|
||||
UINT32 S1,S2,S3,SB,pen;
|
||||
int y;
|
||||
|
||||
for(x=255;x>7;x--)
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
UINT32 *sp1 = (UINT32 *)BITMAP_ADDR8(s2636_1_bitmap, x, 0);
|
||||
UINT32 *sp2 = (UINT32 *)BITMAP_ADDR8(s2636_2_bitmap, x, 0);
|
||||
UINT32 *sp3 = (UINT32 *)BITMAP_ADDR8(s2636_3_bitmap, x, 0);
|
||||
UINT64 *dst = (UINT64 *)BITMAP_ADDR16(bitmap, x, 0);
|
||||
UINT8 *spb = (UINT8 *)BITMAP_ADDR8(scrolled_background, x, 0);
|
||||
int x;
|
||||
|
||||
for(offs=0;offs<62;offs++)
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
S1 = (*sp1++);
|
||||
S2 = (*sp2++);
|
||||
S3 = (*sp3++);
|
||||
int pixel0 = *BITMAP_ADDR8(s2636_0_bitmap, y, x);
|
||||
int pixel1 = *BITMAP_ADDR8(s2636_1_bitmap, y, x);
|
||||
int pixel2 = *BITMAP_ADDR8(s2636_2_bitmap, y, x);
|
||||
|
||||
pen = S1 | S2 | S3;
|
||||
int pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if(pen)
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
UINT16 *address = (UINT16 *)dst;
|
||||
if (pen & 0xff000000) address[BL3] = machine->pens[(pen >> 24) & 15];
|
||||
if (pen & 0x00ff0000) address[BL2] = machine->pens[(pen >> 16) & 15];
|
||||
if (pen & 0x0000ff00) address[BL1] = machine->pens[(pen >> 8) & 15];
|
||||
if (pen & 0x000000ff) address[BL0] = machine->pens[(pen & 15)];
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel)];
|
||||
|
||||
/* Collision Detection */
|
||||
/* S2636 vs. S2636 collision detection */
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) cvs_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x04;
|
||||
|
||||
SB = 0;
|
||||
if (spb[BL3] != machine->pens[0]) SB = 0x08000000;
|
||||
if (spb[BL2] != machine->pens[0]) SB |= 0x00080000;
|
||||
if (spb[BL1] != machine->pens[0]) SB |= 0x00000800;
|
||||
if (spb[BL0] != machine->pens[0]) SB |= 0x00000008;
|
||||
|
||||
if (S1 & S2) cvs_collision_register |= 1;
|
||||
if (S2 & S3) cvs_collision_register |= 2;
|
||||
if (S1 & S3) cvs_collision_register |= 4;
|
||||
|
||||
if (SB)
|
||||
/* S2636 vs. background collision detection */
|
||||
if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(scrolled_collision_background, y, x)))
|
||||
{
|
||||
if (S1 & SB) cvs_collision_register |= 16;
|
||||
if (S2 & SB) cvs_collision_register |= 32;
|
||||
if (S3 & SB) cvs_collision_register |= 64;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) cvs_collision_register |= 0x10;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1)) cvs_collision_register |= 0x20;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
dst++;
|
||||
spb+=4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -405,15 +368,12 @@ VIDEO_UPDATE( cvs )
|
||||
if (flip_screen_y)
|
||||
y = ~y;
|
||||
|
||||
if (*BITMAP_ADDR16(bitmap, y, x) == machine->pens[0])
|
||||
{
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[7];
|
||||
}
|
||||
if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(bitmap, y, x)) == 0)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[BULLET_STAR_PEN];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ static struct
|
||||
UINT8* saa5050_vidram; /* Video RAM for SAA 5050 */
|
||||
|
||||
static mame_bitmap* collision_bitmap;
|
||||
static s2636_t *s2636_0, *s2636_1;
|
||||
UINT8 *malzak_s2636_0_ram;
|
||||
UINT8 *malzak_s2636_1_ram;
|
||||
|
||||
int malzak_x;
|
||||
int malzak_y;
|
||||
@ -57,6 +60,12 @@ VIDEO_START( malzak )
|
||||
collision_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,BITMAP_FORMAT_INDEXED8);
|
||||
|
||||
saa5050_vidram = auto_malloc(0x800);
|
||||
|
||||
/* configure the S2636 chips */
|
||||
// s2636_0 = s2636_config(malzak_s2636_0_ram, machine->screen[0].height, machine->screen[0].width, -8, -16);
|
||||
// s2636_1 = s2636_config(malzak_s2636_1_ram, machine->screen[0].height, machine->screen[0].width, -9, -16);
|
||||
s2636_0 = s2636_config(malzak_s2636_0_ram, machine->screen[0].height, machine->screen[0].width, 0, -16);
|
||||
s2636_1 = s2636_config(malzak_s2636_1_ram, machine->screen[0].height, machine->screen[0].width, 0, -16);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( malzak )
|
||||
@ -64,6 +73,8 @@ VIDEO_UPDATE( malzak )
|
||||
int code, colour;
|
||||
int sx, sy;
|
||||
int x,y;
|
||||
mame_bitmap *s2636_0_bitmap;
|
||||
mame_bitmap *s2636_1_bitmap;
|
||||
|
||||
fillbitmap(bitmap,0,0);
|
||||
|
||||
@ -169,14 +180,14 @@ VIDEO_UPDATE( malzak )
|
||||
{
|
||||
if (saa5050_state.saa5050_flags & SAA5050_DBLHI)
|
||||
{
|
||||
drawgfx (bitmap, machine->gfx[4], code, colour, 0, 0,
|
||||
drawgfx (bitmap, machine->gfx[2], code, colour, 0, 0,
|
||||
sx * 6, sy * 10, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0);
|
||||
drawgfx (bitmap, machine->gfx[5], code, colour, 0, 0,
|
||||
drawgfx (bitmap, machine->gfx[3], code, colour, 0, 0,
|
||||
sx * 6, (sy + 1) * 10, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawgfx (bitmap, machine->gfx[3], code, colour, 0, 0,
|
||||
drawgfx (bitmap, machine->gfx[1], code, colour, 0, 0,
|
||||
sx * 6, sy * 10, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0);
|
||||
}
|
||||
}
|
||||
@ -208,13 +219,32 @@ VIDEO_UPDATE( malzak )
|
||||
sx, sy, &machine->screen[0].visarea, TRANSPARENCY_PEN, 0);
|
||||
}
|
||||
|
||||
// S2636 - Sprites / Collision detection (x2)
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(s2636_1, cliprect);
|
||||
|
||||
s2636_x_offset = -16;
|
||||
// s2636_y_offset = -8;
|
||||
/* copy the S2636 images into the main bitmap */
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
int x;
|
||||
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
int pixel0 = *BITMAP_ADDR8(s2636_0_bitmap, y, x);
|
||||
int pixel1 = *BITMAP_ADDR8(s2636_1_bitmap, y, x);
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0))
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel0)];
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1))
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel1)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s2636_update_bitmap(machine,bitmap,s2636_1_ram,1,collision_bitmap);
|
||||
s2636_update_bitmap(machine,bitmap,s2636_2_ram,2,collision_bitmap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,152 +19,129 @@
|
||||
#include "video/s2636.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
#define BL0 0
|
||||
#define BL1 1
|
||||
#define BL2 2
|
||||
#define BL3 3
|
||||
#define WL0 0
|
||||
#define WL1 1
|
||||
#else
|
||||
#define BL0 3
|
||||
#define BL1 2
|
||||
#define BL2 1
|
||||
#define BL3 0
|
||||
#define WL0 1
|
||||
#define WL1 0
|
||||
#endif
|
||||
|
||||
|
||||
// Used here
|
||||
//static int scroll[8];
|
||||
//static int scroll_reg = 0;
|
||||
|
||||
UINT8 *quasar_effectram;
|
||||
int quasar_effectcontrol;
|
||||
UINT8 quasar_effectcontrol;
|
||||
|
||||
static mame_bitmap *effect_bitmap;
|
||||
static mame_bitmap *background_bitmap;
|
||||
static s2636_t *s2636_0, *s2636_1, *s2636_2;
|
||||
|
||||
PALETTE_INIT( quasar )
|
||||
{
|
||||
int i,col,map;
|
||||
int i;
|
||||
|
||||
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
|
||||
/* allocate the colortable */
|
||||
machine->colortable = colortable_alloc(machine, 0x500);
|
||||
|
||||
// Standard 1 bit per colour palette (background and sprites)
|
||||
|
||||
for(col = 0;col < 8; col++)
|
||||
/* standard 1 bit per color palette (background and sprites) */
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
palette_set_color_rgb(machine,col,pal1bit(col >> 0),pal1bit(col >> 1),pal1bit(col >> 2));
|
||||
rgb_t color = MAKE_RGB(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
|
||||
colortable_palette_set_color(machine->colortable, i, color);
|
||||
}
|
||||
|
||||
/* effects color map */
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
rgb_t color;
|
||||
int bit0, bit1, bit2;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = BIT(i, 0);
|
||||
bit1 = BIT(i, 1);
|
||||
bit2 = BIT(i, 2);
|
||||
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
/* green component */
|
||||
bit0 = BIT(i, 3);
|
||||
bit1 = BIT(i, 4);
|
||||
bit2 = BIT(i, 5);
|
||||
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
/* blue component */
|
||||
bit0 = BIT(i, 6);
|
||||
bit1 = BIT(i, 7);
|
||||
b = 0x4f * bit0 + 0xa8 * bit1;
|
||||
|
||||
/* intensity 0 */
|
||||
colortable_palette_set_color(machine->colortable, 0x100 + i, RGB_BLACK);
|
||||
|
||||
/* intensity 1 */
|
||||
color = MAKE_RGB(r >> 2, g >> 2, b >> 2);
|
||||
colortable_palette_set_color(machine->colortable, 0x200 + i, color);
|
||||
|
||||
/* intensity 2 */
|
||||
color = MAKE_RGB((r >> 2) + (r >> 3), (g >> 2) + (g >> 3), (b >> 2) + (b >> 2));
|
||||
colortable_palette_set_color(machine->colortable, 0x300 + i, color);
|
||||
|
||||
/* intensity 3 */
|
||||
color = MAKE_RGB(r >> 1, g >> 1, b >> 1);
|
||||
colortable_palette_set_color(machine->colortable, 0x400 + i, color);
|
||||
}
|
||||
|
||||
// Address 0-2 from graphic rom
|
||||
// 3-5 from colour ram
|
||||
// 3-5 from color ram
|
||||
// 6-8 from sprite chips (Used for priority)
|
||||
for (i = 0; i < 0x200; i++)
|
||||
colortable_entry_set_value(machine->colortable, i, color_prom[i] & 0x07);
|
||||
|
||||
for(col = 0; col < 512; col++)
|
||||
{
|
||||
COLOR(0,col) = color_prom[col] & 7;
|
||||
}
|
||||
/* background for collision */
|
||||
for (i = 1; i < 8; i++)
|
||||
colortable_entry_set_value(machine->colortable, 0x200 + i, 7);
|
||||
colortable_entry_set_value(machine->colortable, 0x200, 0);
|
||||
|
||||
/* Background for collision */
|
||||
|
||||
COLOR(0,512) = 0; // Black
|
||||
for(col=1;col<8;col++) // White
|
||||
COLOR(0,512+col) = 7;
|
||||
|
||||
/* Effects Colour Map */
|
||||
|
||||
for (i = 0;i < 256;i++)
|
||||
{
|
||||
int bit0,bit1,bit2,r,g,b;
|
||||
|
||||
/* red component */
|
||||
bit0 = BIT(i,0);
|
||||
bit1 = BIT(i,1);
|
||||
bit2 = BIT(i,2);
|
||||
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
/* green component */
|
||||
bit0 = BIT(i,3);
|
||||
bit1 = BIT(i,4);
|
||||
bit2 = BIT(i,5);
|
||||
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
/* blue component */
|
||||
bit0 = BIT(i,6);
|
||||
bit1 = BIT(i,7);
|
||||
b = 0x4f * bit0 + 0xa8 * bit1;
|
||||
|
||||
// Intensity 1
|
||||
palette_set_color_rgb(machine,256+i,r>>2,g>>2,b>>2);
|
||||
|
||||
// Intensity 2
|
||||
palette_set_color_rgb(machine,512+i,(r>>2)+(r>>3),(g>>2)+(g>>3),(b>>2)+(b>>2));
|
||||
|
||||
// Intensity 3
|
||||
palette_set_color_rgb(machine,768+i,r>>1,g>>1,b>>1);
|
||||
}
|
||||
|
||||
/* Sprites */
|
||||
|
||||
for(map=0;map<8;map++)
|
||||
{
|
||||
COLOR(0,map*2 + 2072) = 0;
|
||||
COLOR(0,map*2 + 2073) = 8 + map;
|
||||
}
|
||||
|
||||
/* Set Sprite chip offsets */
|
||||
|
||||
s2636_x_offset = -26;
|
||||
s2636_y_offset = 3;
|
||||
/* effects */
|
||||
for (i = 0; i < 0x400; i++)
|
||||
colortable_entry_set_value(machine->colortable, 0x208 + i, 0x100 + i);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( quasar )
|
||||
{
|
||||
quasar_effectram = auto_malloc(0x400);
|
||||
quasar_effectram = auto_malloc(0x400);
|
||||
|
||||
effect_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
|
||||
background_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
|
||||
/* configure the S2636 chips */
|
||||
s2636_0 = s2636_config(cvs_s2636_0_ram, machine->screen[0].height, machine->screen[0].width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
s2636_1 = s2636_config(cvs_s2636_1_ram, machine->screen[0].height, machine->screen[0].width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
s2636_2 = s2636_config(cvs_s2636_2_ram, machine->screen[0].height, machine->screen[0].width, CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
|
||||
VIDEO_START_CALL(cvs);
|
||||
/* create helper bitmaps */
|
||||
cvs_collision_background = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( quasar )
|
||||
{
|
||||
int offs,character;
|
||||
int sx,sy, ox, oy;
|
||||
int forecolor;
|
||||
|
||||
/* for every character in the Video RAM, check if it has been modified */
|
||||
/* since last time and update it accordingly. */
|
||||
int offs;
|
||||
mame_bitmap *s2636_0_bitmap;
|
||||
mame_bitmap *s2636_1_bitmap;
|
||||
mame_bitmap *s2636_2_bitmap;
|
||||
|
||||
/* for every character in the video RAM */
|
||||
for (offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
character = cvs_video_ram[offs];
|
||||
int ox, oy;
|
||||
UINT8 code = cvs_video_ram[offs];
|
||||
|
||||
sx = (offs % 32) * 8;
|
||||
sy = (offs / 32) * 8;
|
||||
UINT8 x = (offs & 0x1f) << 3;
|
||||
UINT8 y = (offs >> 5) << 3;
|
||||
|
||||
// While we have the current character code, draw the effects layer
|
||||
// intensity / on and off controlled by latch
|
||||
|
||||
if (quasar_effectcontrol == 0x30)
|
||||
forecolor = 0;
|
||||
else
|
||||
forecolor = quasar_effectram[offs] + (256 * (((quasar_effectcontrol >> 4) ^ 3) & 3));
|
||||
int forecolor = 0x208 + quasar_effectram[offs] + (256 * (((quasar_effectcontrol >> 4) ^ 3) & 3));
|
||||
|
||||
for(ox=0;ox<8;ox++)
|
||||
for(oy=0;oy<8;oy++)
|
||||
*BITMAP_ADDR16(effect_bitmap, sy+oy, sx+ox) = forecolor;
|
||||
*BITMAP_ADDR16(bitmap, y+oy, x+ox) = forecolor;
|
||||
|
||||
/* Main Screen */
|
||||
|
||||
drawgfx(background_bitmap,machine->gfx[0],
|
||||
character,
|
||||
cvs_color_ram[offs],
|
||||
drawgfx(bitmap,machine->gfx[0],
|
||||
code,
|
||||
cvs_color_ram[offs] & 0x3f,
|
||||
0,0,
|
||||
sx,sy,
|
||||
0,TRANSPARENCY_NONE,0);
|
||||
x,y,
|
||||
cliprect,TRANSPARENCY_PEN,0);
|
||||
|
||||
|
||||
/* background for Collision Detection (it can only hit certain items) */
|
||||
@ -172,32 +149,20 @@ VIDEO_UPDATE( quasar )
|
||||
if((cvs_color_ram[offs] & 7) == 0)
|
||||
{
|
||||
drawgfx(cvs_collision_background,machine->gfx[0],
|
||||
character,
|
||||
code,
|
||||
64,
|
||||
0,0,
|
||||
sx,sy,
|
||||
0,TRANSPARENCY_NONE,0);
|
||||
x,y,
|
||||
cliprect,TRANSPARENCY_NONE,0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Update screen */
|
||||
|
||||
copybitmap (bitmap,effect_bitmap, 0,0,0,0,cliprect);
|
||||
copybitmap_trans(bitmap,background_bitmap,0,0,0,0,cliprect,0);
|
||||
|
||||
/* 2636's */
|
||||
|
||||
fillbitmap(s2636_1_bitmap,0,0);
|
||||
s2636_update_bitmap(machine,s2636_1_bitmap,s2636_1_ram,1,cvs_collision_bitmap);
|
||||
|
||||
fillbitmap(s2636_2_bitmap,0,0);
|
||||
s2636_update_bitmap(machine,s2636_2_bitmap,s2636_2_ram,2,cvs_collision_bitmap);
|
||||
|
||||
fillbitmap(s2636_3_bitmap,0,0);
|
||||
s2636_update_bitmap(machine,s2636_3_bitmap,s2636_3_ram,3,cvs_collision_bitmap);
|
||||
/* update the S2636 chips */
|
||||
s2636_0_bitmap = s2636_update(s2636_0, cliprect);
|
||||
s2636_1_bitmap = s2636_update(s2636_1, cliprect);
|
||||
s2636_2_bitmap = s2636_update(s2636_2, cliprect);
|
||||
|
||||
/* Bullet Hardware */
|
||||
|
||||
for (offs = 8; offs < 256; offs++ )
|
||||
{
|
||||
if(cvs_bullet_ram[offs] != 0)
|
||||
@ -207,64 +172,46 @@ VIDEO_UPDATE( quasar )
|
||||
{
|
||||
int bx=255-9-cvs_bullet_ram[offs]-ct;
|
||||
|
||||
/* Bullet/Object Collision */
|
||||
|
||||
if (*BITMAP_ADDR8(s2636_1_bitmap, offs, bx) != 0) cvs_collision_register |= 4;
|
||||
if (*BITMAP_ADDR8(s2636_3_bitmap, offs, bx) != 0) cvs_collision_register |= 8;
|
||||
/* bullet/object Collision */
|
||||
if (*BITMAP_ADDR8(s2636_0_bitmap, offs, bx) != 0) cvs_collision_register |= 0x04;
|
||||
if (*BITMAP_ADDR8(s2636_2_bitmap, offs, bx) != 0) cvs_collision_register |= 0x08;
|
||||
|
||||
*BITMAP_ADDR16(bitmap, offs, bx) = machine->pens[7];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update 2636 images */
|
||||
|
||||
{
|
||||
UINT32 S1,S2,S3,SB,pen;
|
||||
/* mix and copy the S2636 images into the main bitmap, also check for collision */
|
||||
{
|
||||
int y;
|
||||
|
||||
for(sx=255;sx>7;sx--)
|
||||
{
|
||||
UINT32 *sp1 = (UINT32 *)BITMAP_ADDR8(s2636_1_bitmap, sx, 0);
|
||||
UINT32 *sp2 = (UINT32 *)BITMAP_ADDR8(s2636_2_bitmap, sx, 0);
|
||||
UINT32 *sp3 = (UINT32 *)BITMAP_ADDR8(s2636_3_bitmap, sx, 0);
|
||||
UINT64 *dst = (UINT64 *)BITMAP_ADDR16(bitmap, sx, 0);
|
||||
UINT8 *spb = (UINT8 *)BITMAP_ADDR8(cvs_collision_background, sx, 0);
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(offs=0;offs<62;offs++)
|
||||
{
|
||||
S1 = (*sp1++);
|
||||
S2 = (*sp2++);
|
||||
S3 = (*sp3++);
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
int pixel0 = *BITMAP_ADDR8(s2636_0_bitmap, y, x);
|
||||
int pixel1 = *BITMAP_ADDR8(s2636_1_bitmap, y, x);
|
||||
int pixel2 = *BITMAP_ADDR8(s2636_2_bitmap, y, x);
|
||||
|
||||
pen = S1 | S2 | S3;
|
||||
int pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if(pen)
|
||||
{
|
||||
UINT16 *address = (UINT16 *)dst;
|
||||
if (pen & 0xff000000) address[BL3] = machine->pens[(pen >> 24) & 15];
|
||||
if (pen & 0x00ff0000) address[BL2] = machine->pens[(pen >> 16) & 15];
|
||||
if (pen & 0x0000ff00) address[BL1] = machine->pens[(pen >> 8) & 15];
|
||||
if (pen & 0x000000ff) address[BL0] = machine->pens[(pen & 15)];
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
*BITMAP_ADDR16(bitmap, y, x) = machine->pens[S2636_PIXEL_COLOR(pixel)];
|
||||
|
||||
/* Collision Detection */
|
||||
/* S2636 vs. background collision detection */
|
||||
if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(cvs_collision_background, y, x)))
|
||||
{
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) cvs_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) cvs_collision_register |= 0x02;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SB = 0;
|
||||
if (spb[BL3] != machine->pens[0]) SB = 0x08000000;
|
||||
if (spb[BL2] != machine->pens[0]) SB |= 0x00080000;
|
||||
if (spb[BL1] != machine->pens[0]) SB |= 0x00000800;
|
||||
if (spb[BL0] != machine->pens[0]) SB |= 0x00000008;
|
||||
|
||||
if (SB)
|
||||
{
|
||||
if (S1 & SB) cvs_collision_register |= 1;
|
||||
if (S3 & SB) cvs_collision_register |= 2;
|
||||
}
|
||||
}
|
||||
|
||||
dst++;
|
||||
spb+=4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "driver.h"
|
||||
#include "video/s2636.h"
|
||||
|
||||
|
||||
UINT8 *zac2650_s2636_0_ram;
|
||||
static mame_bitmap *spritebitmap;
|
||||
|
||||
static int CollisionBackground;
|
||||
@ -29,7 +31,7 @@ WRITE8_HANDLER( tinvader_videoram_w )
|
||||
|
||||
READ8_HANDLER( zac_s2636_r )
|
||||
{
|
||||
if(offset!=0xCB) return s2636_1_ram[offset];
|
||||
if(offset!=0xCB) return zac2650_s2636_0_ram[offset];
|
||||
else return CollisionSprite;
|
||||
}
|
||||
|
||||
@ -47,10 +49,10 @@ static int SpriteCollision(running_machine *machine, int first,int second)
|
||||
int Checksum=0;
|
||||
int x,y;
|
||||
|
||||
if((s2636_1_ram[first * 0x10 + 10] < 0xf0) && (s2636_1_ram[second * 0x10 + 10] < 0xf0))
|
||||
if((zac2650_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (zac2650_s2636_0_ram[second * 0x10 + 10] < 0xf0))
|
||||
{
|
||||
int fx = (s2636_1_ram[first * 0x10 + 10] * 4)-22;
|
||||
int fy = (s2636_1_ram[first * 0x10 + 12] * 3)+3;
|
||||
int fx = (zac2650_s2636_0_ram[first * 0x10 + 10] * 4)-22;
|
||||
int fy = (zac2650_s2636_0_ram[first * 0x10 + 12] * 3)+3;
|
||||
int expand = (first==1) ? 2 : 1;
|
||||
|
||||
/* Draw first sprite */
|
||||
@ -86,7 +88,7 @@ static int SpriteCollision(running_machine *machine, int first,int second)
|
||||
second * 2,
|
||||
1,
|
||||
0,0,
|
||||
(s2636_1_ram[second * 0x10 + 10] * 4)-22,(s2636_1_ram[second * 0x10 + 12] * 3) + 3,
|
||||
(zac2650_s2636_0_ram[second * 0x10 + 10] * 4)-22,(zac2650_s2636_0_ram[second * 0x10 + 12] * 3) + 3,
|
||||
0, TRANSPARENCY_PEN, 0);
|
||||
|
||||
/* Remove fingerprint */
|
||||
@ -158,19 +160,19 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap)
|
||||
|
||||
for(offs=0;offs<0x50;offs+=0x10)
|
||||
{
|
||||
if((s2636_1_ram[offs+10]<0xF0) && (offs!=0x30))
|
||||
if((zac2650_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30))
|
||||
{
|
||||
int spriteno = (offs / 8);
|
||||
int expand = ((s2636_1_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1;
|
||||
int bx = (s2636_1_ram[offs+10] * 4) - 22;
|
||||
int by = (s2636_1_ram[offs+12] * 3) + 3;
|
||||
int expand = ((zac2650_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1;
|
||||
int bx = (zac2650_s2636_0_ram[offs+10] * 4) - 22;
|
||||
int by = (zac2650_s2636_0_ram[offs+12] * 3) + 3;
|
||||
int x,y;
|
||||
|
||||
/* 16x8 version */
|
||||
decodechar(machine->gfx[1],spriteno,s2636_1_ram);
|
||||
decodechar(machine->gfx[1],spriteno,zac2650_s2636_0_ram);
|
||||
|
||||
/* 16x16 version */
|
||||
decodechar(machine->gfx[2],spriteno,s2636_1_ram);
|
||||
decodechar(machine->gfx[2],spriteno,zac2650_s2636_0_ram);
|
||||
|
||||
/* Sprite->Background collision detection */
|
||||
drawgfx(bitmap,machine->gfx[expand],
|
||||
|
Loading…
Reference in New Issue
Block a user