d_atarig1: hydra/pitfighter. hook up analogs for hydra, add states for rle
This commit is contained in:
parent
a2786847e1
commit
f7faa73ce8
|
@ -221,11 +221,11 @@ static UINT8 atarijsa_read(UINT16 address)
|
|||
case 0x2804:
|
||||
case 0x280c:
|
||||
{
|
||||
UINT8 result = atarijsa_input_port;
|
||||
UINT8 result = (atarijsa_input_port) | 0x10;
|
||||
if (!(atarijsa_test_port & atarijsa_test_mask)) result ^= 0x80;
|
||||
if (atarigen_cpu_to_sound_ready) result ^= 0x40;
|
||||
if (atarigen_sound_to_cpu_ready) result ^= 0x20;
|
||||
if (has_tms5220 && tms5220_ready()) result ^= 0x10;
|
||||
if (has_tms5220 && tms5220_ready() == 0) result ^= 0x10;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -786,33 +786,6 @@ void AtariMoRender(INT32 map)
|
|||
atarimo_render(map, &cliprect, &rectlist);
|
||||
}
|
||||
|
||||
static void DrawCustomMaskTile_MO(UINT16 *pDestDraw, INT32 nWidth, INT32 nHeight, INT32 nTileNumber, INT32 StartX, INT32 StartY, INT32 FlipX, INT32 FlipY, INT32 nTilePalette, INT32 nColourDepth, INT32 nMaskColour, INT32 nPaletteOffset, UINT8 *pTile)
|
||||
{
|
||||
if (FlipY)
|
||||
{
|
||||
if (FlipX)
|
||||
{
|
||||
RenderCustomTile_Mask_FlipXY_Clip(pDestDraw, nWidth, nHeight, nTileNumber, StartX, StartY, nTilePalette, nColourDepth, nMaskColour, nPaletteOffset, pTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderCustomTile_Mask_FlipY_Clip(pDestDraw, nWidth, nHeight, nTileNumber, StartX, StartY, nTilePalette, nColourDepth, nMaskColour, nPaletteOffset, pTile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FlipX)
|
||||
{
|
||||
RenderCustomTile_Mask_FlipX_Clip(pDestDraw, nWidth, nHeight, nTileNumber, StartX, StartY, nTilePalette, nColourDepth, nMaskColour, nPaletteOffset, pTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderCustomTile_Mask_Clip(pDestDraw, nWidth, nHeight, nTileNumber, StartX, StartY, nTilePalette, nColourDepth, nMaskColour, nPaletteOffset, pTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
mo_render_object: Internal processing callback that
|
||||
renders to the backing bitmap and then copies the result
|
||||
|
@ -937,7 +910,7 @@ if ((temp & 0xff00) == 0xc800)
|
|||
// 1. set clipping to this sprite's bandclip:
|
||||
GenericTilesSetClip(cliprect->min_x, cliprect->max_x, cliprect->min_y, (cliprect->max_y+1 > nScreenHeight) ? nScreenHeight : cliprect->max_y+1);
|
||||
// 2: draw sprite:
|
||||
DrawCustomMaskTile_MO(bitmap, gfx->width, gfx->height, code, sx, sy, hflip, vflip, color, 0, mo->transpen, 0, gfx->gfxbase);
|
||||
DrawCustomMaskTile(bitmap, gfx->width, gfx->height, code, sx, sy, hflip, vflip, color, 0, mo->transpen, 0, gfx->gfxbase);
|
||||
// 3: set clipping back to cached value @ AtariMoRender()
|
||||
GenericTilesSetClip(mainclippy.min_x, mainclippy.max_x, mainclippy.min_y, mainclippy.max_y);
|
||||
rendered = 1;
|
||||
|
@ -977,7 +950,7 @@ if ((temp & 0xff00) == 0xc800)
|
|||
|
||||
/* draw the sprite */
|
||||
GenericTilesSetClip(cliprect->min_x, cliprect->max_x, cliprect->min_y, (cliprect->max_y+1 > nScreenHeight) ? nScreenHeight : cliprect->max_y+1);
|
||||
DrawCustomMaskTile_MO(bitmap, gfx->width, gfx->height, code, sx, sy, hflip, vflip, color, 0, mo->transpen, 0, gfx->gfxbase);
|
||||
DrawCustomMaskTile(bitmap, gfx->width, gfx->height, code, sx, sy, hflip, vflip, color, 0, mo->transpen, 0, gfx->gfxbase);
|
||||
GenericTilesSetClip(mainclippy.min_x, mainclippy.max_x, mainclippy.min_y, mainclippy.max_y);
|
||||
rendered = 1;
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ static struct atarirle_data atarirle[ATARIRLE_MAX];
|
|||
|
||||
static UINT8 rle_bpp[8];
|
||||
static UINT16 *rle_table[8];
|
||||
static UINT16 *rle_table_base;
|
||||
|
||||
|
||||
|
||||
|
@ -330,23 +331,23 @@ int atarirle_init(int map, const struct atarirle_desc *desc, UINT8 *rombase, INT
|
|||
}
|
||||
|
||||
/* allocate the object info */
|
||||
mo->info = (atarirle_info*)BurnMalloc(sizeof(mo->info[0]) * mo->objectcount);
|
||||
mo->info = (atarirle_info*)BurnMalloc(sizeof(atarirle_info) * mo->objectcount);
|
||||
|
||||
/* fill in the data */
|
||||
memset(mo->info, 0, sizeof(mo->info[0]) * mo->objectcount);
|
||||
memset(mo->info, 0, sizeof(atarirle_info) * mo->objectcount);
|
||||
for (i = 0; i < mo->objectcount; i++)
|
||||
prescan_rle(mo, i);
|
||||
|
||||
/* allocate the spriteram */
|
||||
mo->spriteram = (atarirle_entry*)BurnMalloc(sizeof(mo->spriteram[0]) * mo->spriteramsize);
|
||||
mo->spriteram = (atarirle_entry*)BurnMalloc(sizeof(atarirle_entry) * mo->spriteramsize);
|
||||
|
||||
/* clear it to zero */
|
||||
memset(mo->spriteram, 0, sizeof(mo->spriteram[0]) * mo->spriteramsize);
|
||||
memset(mo->spriteram, 0, sizeof(atarirle_entry) * mo->spriteramsize);
|
||||
|
||||
BurnBitmapAllocate(1, nScreenWidth, nScreenHeight, 0);
|
||||
BurnBitmapAllocate(2, nScreenWidth, nScreenHeight, 0);
|
||||
BurnBitmapAllocate(3, nScreenWidth, nScreenHeight, 0);
|
||||
BurnBitmapAllocate(4, nScreenWidth, nScreenHeight, 0);
|
||||
BurnBitmapAllocate(1, nScreenWidth, nScreenHeight+4, 0); // +4 because rle sometimes likes to ignore clipping and go out of bounds..
|
||||
BurnBitmapAllocate(2, nScreenWidth, nScreenHeight+4, 0);
|
||||
BurnBitmapAllocate(3, nScreenWidth, nScreenHeight+4, 0);
|
||||
BurnBitmapAllocate(4, nScreenWidth, nScreenHeight+4, 0);
|
||||
|
||||
/* allocate bitmaps */
|
||||
mo->vram[0][0] = BurnBitmapGetBitmap(1);
|
||||
|
@ -371,7 +372,38 @@ int atarirle_init(int map, const struct atarirle_desc *desc, UINT8 *rombase, INT
|
|||
return 1;
|
||||
}
|
||||
|
||||
void atarirle_exit()
|
||||
{
|
||||
BurnFree(rle_table_base);
|
||||
|
||||
for (INT32 i = 0; i < ATARIRLE_MAX; i++) {
|
||||
struct atarirle_data *mo = &atarirle[i];
|
||||
|
||||
BurnFree(mo->info);
|
||||
BurnFree(mo->spriteram);
|
||||
}
|
||||
}
|
||||
|
||||
INT32 atarirle_scan(INT32 nAction, INT32 *pnMin)
|
||||
{
|
||||
if (nAction & ACB_VOLATILE)
|
||||
{
|
||||
for (INT32 i = 0; i < ATARIRLE_MAX; i++)
|
||||
{
|
||||
atarirle_data *mo = &atarirle[i];
|
||||
|
||||
if (mo->spriteram)
|
||||
{
|
||||
ScanVar(mo->spriteram, sizeof(atarirle_entry) * mo->spriteramsize, "AtariRLE RAM");
|
||||
|
||||
SCAN_VAR(mo->control_bits);
|
||||
SCAN_VAR(mo->command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
atarirle_control_w: Write handler for MO control bits.
|
||||
|
@ -546,7 +578,6 @@ UINT16 *atarirle_get_vram(int map, int idx)
|
|||
|
||||
static int build_rle_tables(void)
|
||||
{
|
||||
UINT16 *base;
|
||||
int i;
|
||||
|
||||
/* if we've already done it, don't bother */
|
||||
|
@ -554,14 +585,14 @@ static int build_rle_tables(void)
|
|||
// return 0;
|
||||
|
||||
/* allocate all 5 tables */
|
||||
base = (UINT16*)BurnMalloc(0x500 * sizeof(UINT16));
|
||||
rle_table_base = (UINT16*)BurnMalloc(0x500 * sizeof(UINT16));
|
||||
|
||||
/* assign the tables */
|
||||
rle_table[0] = &base[0x000];
|
||||
rle_table[1] = &base[0x100];
|
||||
rle_table[2] = rle_table[3] = &base[0x200];
|
||||
rle_table[4] = rle_table[6] = &base[0x300];
|
||||
rle_table[5] = rle_table[7] = &base[0x400];
|
||||
rle_table[0] = &rle_table_base[0x000];
|
||||
rle_table[1] = &rle_table_base[0x100];
|
||||
rle_table[2] = rle_table[3] = &rle_table_base[0x200];
|
||||
rle_table[4] = rle_table[6] = &rle_table_base[0x300];
|
||||
rle_table[5] = rle_table[7] = &rle_table_base[0x400];
|
||||
|
||||
/* set the bpps */
|
||||
rle_bpp[0] = 4;
|
||||
|
@ -624,7 +655,7 @@ int count_objects(const UINT16 *base, int length)
|
|||
lowest_address = offset;
|
||||
}
|
||||
|
||||
bprintf (0, _T("Lowest: %x\n"), lowest_address/4);
|
||||
//bprintf (0, _T("Lowest: %x\n"), lowest_address/4);
|
||||
|
||||
/* that determines how many objects */
|
||||
return lowest_address / 4;
|
||||
|
@ -661,7 +692,7 @@ static void prescan_rle(const struct atarirle_data *mo, int which)
|
|||
/* make sure it's valid */
|
||||
if (offset < which * 4 || offset >= mo->romlength)
|
||||
{
|
||||
memset(rledata, 0, sizeof(*rledata));
|
||||
memset(rledata, 0, sizeof(atarirle_info));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -757,8 +788,8 @@ static void sort_and_render(struct atarirle_data *mo)
|
|||
struct mo_sort_entry *current;
|
||||
int i;
|
||||
|
||||
struct atarirle_entry *hilite = NULL;
|
||||
int count = 0;
|
||||
struct atarirle_entry *hilite = NULL;
|
||||
int count = 0;
|
||||
|
||||
/* sort the motion objects into their proper priorities */
|
||||
memset(list_head, 0, sizeof(list_head));
|
||||
|
@ -785,7 +816,7 @@ int count = 0;
|
|||
/* make sure they are in range */
|
||||
if (scale > 0 && code < mo->objectcount)
|
||||
{
|
||||
bprintf (0, _T("draw: %x, %x, %x\n"), scale, code, mo->objectcount);
|
||||
//bprintf (0, _T("draw: %x, %x, %x\n"), scale, code, mo->objectcount);
|
||||
|
||||
int hflip = EXTRACT_DATA(obj, mo->hflipmask);
|
||||
int color = EXTRACT_DATA(obj, mo->colormask);
|
||||
|
@ -815,110 +846,110 @@ int count = 0;
|
|||
}
|
||||
}
|
||||
|
||||
if (hilite)
|
||||
{
|
||||
int scale, code, which;
|
||||
|
||||
/* extract scale and code */
|
||||
obj = hilite;
|
||||
scale = EXTRACT_DATA(obj, mo->scalemask);
|
||||
code = EXTRACT_DATA(obj, mo->codemask);
|
||||
which = EXTRACT_DATA(obj, mo->vrammask);
|
||||
|
||||
/* make sure they are in range */
|
||||
if (scale > 0 && code < mo->objectcount)
|
||||
if (hilite)
|
||||
{
|
||||
int hflip = EXTRACT_DATA(obj, mo->hflipmask);
|
||||
int color = EXTRACT_DATA(obj, mo->colormask);
|
||||
int priority = EXTRACT_DATA(obj, mo->prioritymask);
|
||||
int x = EXTRACT_DATA(obj, mo->xposmask);
|
||||
int y = EXTRACT_DATA(obj, mo->yposmask);
|
||||
int scaled_xoffs, scaled_yoffs;
|
||||
const struct atarirle_info *info;
|
||||
int scale, code, which;
|
||||
|
||||
if (x & ((mo->xposmask.mask + 1) >> 1))
|
||||
x = (INT16)(x | ~mo->xposmask.mask);
|
||||
if (y & ((mo->yposmask.mask + 1) >> 1))
|
||||
y = (INT16)(y | ~mo->yposmask.mask);
|
||||
x += 0; //mo->cliprect.nMinx;
|
||||
/* extract scale and code */
|
||||
obj = hilite;
|
||||
scale = EXTRACT_DATA(obj, mo->scalemask);
|
||||
code = EXTRACT_DATA(obj, mo->codemask);
|
||||
which = EXTRACT_DATA(obj, mo->vrammask);
|
||||
|
||||
/* merge priority and color */
|
||||
color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
|
||||
|
||||
info = &mo->info[code];
|
||||
scaled_xoffs = (scale * info->xoffs) >> 12;
|
||||
scaled_yoffs = (scale * info->yoffs) >> 12;
|
||||
|
||||
/* we're hflipped, account for it */
|
||||
if (hflip)
|
||||
scaled_xoffs = ((scale * info->width) >> 12) - scaled_xoffs;
|
||||
|
||||
/* adjust for the x and y offsets */
|
||||
x -= scaled_xoffs;
|
||||
y -= scaled_yoffs;
|
||||
|
||||
do
|
||||
/* make sure they are in range */
|
||||
if (scale > 0 && code < mo->objectcount)
|
||||
{
|
||||
int scaled_width = (scale * info->width + 0x7fff) >> 12;
|
||||
int scaled_height = (scale * info->height + 0x7fff) >> 12;
|
||||
int dx, dy, ex, ey, sx = x, sy = y, tx, ty;
|
||||
int hflip = EXTRACT_DATA(obj, mo->hflipmask);
|
||||
int color = EXTRACT_DATA(obj, mo->colormask);
|
||||
int priority = EXTRACT_DATA(obj, mo->prioritymask);
|
||||
int x = EXTRACT_DATA(obj, mo->xposmask);
|
||||
int y = EXTRACT_DATA(obj, mo->yposmask);
|
||||
int scaled_xoffs, scaled_yoffs;
|
||||
const struct atarirle_info *info;
|
||||
|
||||
/* make sure we didn't end up with 0 */
|
||||
if (scaled_width == 0) scaled_width = 1;
|
||||
if (scaled_height == 0) scaled_height = 1;
|
||||
if (x & ((mo->xposmask.mask + 1) >> 1))
|
||||
x = (INT16)(x | ~mo->xposmask.mask);
|
||||
if (y & ((mo->yposmask.mask + 1) >> 1))
|
||||
y = (INT16)(y | ~mo->yposmask.mask);
|
||||
x += 0; //mo->cliprect.nMinx;
|
||||
|
||||
/* compute the remaining parameters */
|
||||
dx = (info->width << 12) / scaled_width;
|
||||
dy = (info->height << 12) / scaled_height;
|
||||
ex = sx + scaled_width - 1;
|
||||
ey = sy + scaled_height - 1;
|
||||
/* merge priority and color */
|
||||
color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
|
||||
|
||||
/* left edge clip */
|
||||
if (sx < 0)
|
||||
sx = 0;
|
||||
if (sx >= nScreenWidth)
|
||||
break;
|
||||
info = &mo->info[code];
|
||||
scaled_xoffs = (scale * info->xoffs) >> 12;
|
||||
scaled_yoffs = (scale * info->yoffs) >> 12;
|
||||
|
||||
/* right edge clip */
|
||||
if (ex >= nScreenWidth)
|
||||
ex = nScreenWidth - 1; // right?? iq_132
|
||||
else if (ex < 0)
|
||||
break;
|
||||
/* we're hflipped, account for it */
|
||||
if (hflip)
|
||||
scaled_xoffs = ((scale * info->width) >> 12) - scaled_xoffs;
|
||||
|
||||
/* top edge clip */
|
||||
if (sy < 0)
|
||||
sy = 0;
|
||||
else if (sy >= nScreenHeight)
|
||||
break;
|
||||
/* adjust for the x and y offsets */
|
||||
x -= scaled_xoffs;
|
||||
y -= scaled_yoffs;
|
||||
|
||||
/* bottom edge clip */
|
||||
if (ey >= nScreenHeight)
|
||||
ey = nScreenHeight-1; // right?? iq_132
|
||||
else if (ey < 0)
|
||||
break;
|
||||
|
||||
for (ty = sy; ty <= ey; ty++)
|
||||
do
|
||||
{
|
||||
bitmap1[(ty * nScreenWidth) + sx] = rand() & 0xff;
|
||||
bitmap1[(ty * nScreenWidth) + ex] = rand() & 0xff;
|
||||
// plot_pixel(bitmap1, sx, ty, rand() & 0xff);
|
||||
// plot_pixel(bitmap1, ex, ty, rand() & 0xff);
|
||||
}
|
||||
for (tx = sx; tx <= ex; tx++)
|
||||
{
|
||||
bitmap1[(sy * nScreenWidth) + tx] = rand() & 0xff;
|
||||
bitmap1[(ey * nScreenWidth) + tx] = rand() & 0xff;
|
||||
// plot_pixel(bitmap1, tx, sy, rand() & 0xff);
|
||||
// plot_pixel(bitmap1, tx, ey, rand() & 0xff);
|
||||
}
|
||||
} while (0);
|
||||
fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
|
||||
code, color, hflip,
|
||||
x, -scaled_xoffs, (scale * info->width) >> 12,
|
||||
y, -scaled_yoffs, (scale * info->height) >> 12, scale);
|
||||
int scaled_width = (scale * info->width + 0x7fff) >> 12;
|
||||
int scaled_height = (scale * info->height + 0x7fff) >> 12;
|
||||
int dx, dy, ex, ey, sx = x, sy = y, tx, ty;
|
||||
|
||||
/* make sure we didn't end up with 0 */
|
||||
if (scaled_width == 0) scaled_width = 1;
|
||||
if (scaled_height == 0) scaled_height = 1;
|
||||
|
||||
/* compute the remaining parameters */
|
||||
dx = (info->width << 12) / scaled_width;
|
||||
dy = (info->height << 12) / scaled_height;
|
||||
ex = sx + scaled_width - 1;
|
||||
ey = sy + scaled_height - 1;
|
||||
|
||||
/* left edge clip */
|
||||
if (sx < 0)
|
||||
sx = 0;
|
||||
if (sx >= nScreenWidth)
|
||||
break;
|
||||
|
||||
/* right edge clip */
|
||||
if (ex >= nScreenWidth)
|
||||
ex = nScreenWidth - 1; // right?? iq_132
|
||||
else if (ex < 0)
|
||||
break;
|
||||
|
||||
/* top edge clip */
|
||||
if (sy < 0)
|
||||
sy = 0;
|
||||
else if (sy >= nScreenHeight)
|
||||
break;
|
||||
|
||||
/* bottom edge clip */
|
||||
if (ey >= nScreenHeight)
|
||||
ey = nScreenHeight-1; // right?? iq_132
|
||||
else if (ey < 0)
|
||||
break;
|
||||
|
||||
for (ty = sy; ty <= ey; ty++)
|
||||
{
|
||||
bitmap1[(ty * nScreenWidth) + sx] = rand() & 0xff;
|
||||
bitmap1[(ty * nScreenWidth) + ex] = rand() & 0xff;
|
||||
// plot_pixel(bitmap1, sx, ty, rand() & 0xff);
|
||||
// plot_pixel(bitmap1, ex, ty, rand() & 0xff);
|
||||
}
|
||||
for (tx = sx; tx <= ex; tx++)
|
||||
{
|
||||
bitmap1[(sy * nScreenWidth) + tx] = rand() & 0xff;
|
||||
bitmap1[(ey * nScreenWidth) + tx] = rand() & 0xff;
|
||||
// plot_pixel(bitmap1, tx, sy, rand() & 0xff);
|
||||
// plot_pixel(bitmap1, tx, ey, rand() & 0xff);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
/*fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
|
||||
code, color, hflip,
|
||||
x, -scaled_xoffs, (scale * info->width) >> 12,
|
||||
y, -scaled_yoffs, (scale * info->height) >> 12, scale); */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1011,14 +1042,12 @@ void draw_rle_zoom(UINT16 *bitmap, const struct atarirle_info *gfx,
|
|||
if (sx >= nScreenWidth) //clip->nMaxx)
|
||||
return;
|
||||
|
||||
//bprintf (0, _T("REC\n"));
|
||||
/* right edge clip */
|
||||
if (ex >= nScreenWidth) //clip->nMaxx)
|
||||
ex = /*clip->nMaxx*/nScreenWidth-1, xclipped = 1;
|
||||
else if (ex < 0)//clip->nMinx)
|
||||
return;
|
||||
|
||||
//bprintf (0, _T("TEC\n"));
|
||||
/* top edge clip */
|
||||
if (sy < 0)//clip->nMiny)
|
||||
{
|
||||
|
@ -1028,14 +1057,12 @@ void draw_rle_zoom(UINT16 *bitmap, const struct atarirle_info *gfx,
|
|||
else if (sy >= nScreenHeight) //clip->nMaxy)
|
||||
return;
|
||||
|
||||
bprintf (0, _T("BEC\n"));
|
||||
/* bottom edge clip */
|
||||
if (ey >= nScreenHeight) //clip->nMaxy)
|
||||
ey = nScreenHeight-1; //clip->nMaxy;
|
||||
ey = (nScreenHeight-1); //clip->nMaxy;
|
||||
else if (ey < 0) //clip->nMiny)
|
||||
return;
|
||||
|
||||
//bprintf (0, _T("LOOP\n"));
|
||||
/* loop top to bottom */
|
||||
for (y = sy; y <= ey; y++, sourcey += dy)
|
||||
{
|
||||
|
|
|
@ -72,6 +72,8 @@ struct atarirle_desc
|
|||
|
||||
/* setup/shutdown */
|
||||
int atarirle_init(int map, const struct atarirle_desc *desc, UINT8 *rombase, INT32 romsize);
|
||||
void atarirle_exit();
|
||||
INT32 atarirle_scan(INT32 nAction, INT32 *pnMin);
|
||||
|
||||
/* control handlers */
|
||||
void atarirle_control_w(int map, UINT8 bits, INT32 scanline);
|
||||
|
|
|
@ -10,6 +10,7 @@ xybots: good.
|
|||
toobin: good
|
||||
eprom: good. (sometimes scratchy/corrupted tms5220 voice synth noise?)
|
||||
klax: good
|
||||
atarig1: good-ish, see notes for atarirle below.
|
||||
|
||||
- WIP drivers -
|
||||
all of the rest!
|
||||
|
@ -20,4 +21,4 @@ atarijsa: changed "if (has_tms5220 && tms5220_ready() == 0) result ^= 0x10;" to
|
|||
atarimo: add states, gfxdata -> GenericGfxData, FIXED CLIPPY BUG (damnit!!) nov.20.2018
|
||||
atarivad: add states + palette re-sync
|
||||
tiles_generic.*,tilemap_generic.*: gfxdata -> GenericGfxData ('cuz Barry says so!)
|
||||
|
||||
atarirle: this is a nightmare. proper clipping needs to be added, bitmap fills do not respect clipping. atarig1 should only be displaying the first vram bitmap, but instead its displaying butmap 0 and 1, which basically mixes the previous frame's sprites with the current sprites. (reason for hydra roz looking funny as it zooms)...
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
// FB Alpha Atari G1 system driver module
|
||||
// Based on MAME driver by Aaron Giles
|
||||
|
||||
// needs analog inputs for hydra
|
||||
// save states for rle
|
||||
// reset routine for rle
|
||||
|
||||
#include "tiles_generic.h"
|
||||
#include "m68000_intf.h"
|
||||
#include "m6502_intf.h"
|
||||
|
@ -47,24 +43,28 @@ static UINT16 DrvInputs[5];
|
|||
static UINT8 DrvDips[1];
|
||||
static UINT8 DrvReset;
|
||||
|
||||
static INT16 DrvAnalogPort0 = 0;
|
||||
static INT16 DrvAnalogPort1 = 0;
|
||||
static INT16 DrvAnalogPort2 = 0;
|
||||
|
||||
#define A(a, b, c, d) {a, b, (UINT8*)(c), d}
|
||||
static struct BurnInputInfo HydraInputList[] = {
|
||||
{"Coin 1", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin" },
|
||||
{"Coin 2", BIT_DIGITAL, DrvJoy3 + 0, "p2 coin" },
|
||||
{"Coin 3", BIT_DIGITAL, DrvJoy3 + 0, "p3 coin" },
|
||||
{"Coin 2", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin" },
|
||||
{"Coin 3", BIT_DIGITAL, DrvJoy3 + 2, "p3 coin" },
|
||||
A("P1 Stick X", BIT_ANALOG_REL, &DrvAnalogPort0,"p1 x-axis"),
|
||||
A("P1 Stick Y", BIT_ANALOG_REL, &DrvAnalogPort1,"p1 y-axis"),
|
||||
A("P1 Accelerator", BIT_ANALOG_REL, &DrvAnalogPort2,"p1 fire 1"),
|
||||
{"P1 Right Trigger",BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2" },
|
||||
{"P1 Right Thumb", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 3" },
|
||||
{"P1 Left Trigger", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 5" },
|
||||
{"P1 Left Thumb", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 6" },
|
||||
{"P1 Boost", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 4" },
|
||||
|
||||
// placeholder
|
||||
{"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 15, "p2 fire 1" },
|
||||
{"P2 Button 2", BIT_DIGITAL, DrvJoy1 + 15, "p2 fire 2" },
|
||||
{"P2 Button 3", BIT_DIGITAL, DrvJoy1 + 15, "p2 fire 3" },
|
||||
|
||||
{"Reset", BIT_DIGITAL, &DrvReset, "reset" },
|
||||
{"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
|
||||
};
|
||||
#undef A
|
||||
|
||||
STDINPUTINFO(Hydra)
|
||||
|
||||
|
@ -242,6 +242,19 @@ static inline UINT16 special_read()
|
|||
return ret;
|
||||
}
|
||||
|
||||
static UINT8 read_analog(INT32 port)
|
||||
{
|
||||
UINT8 ret = 0;
|
||||
|
||||
switch (port) {
|
||||
case 0: ret = ProcessAnalog(DrvAnalogPort0, 0, INPUT_DEADZONE, 0x00, 0xfe); break;
|
||||
case 1: ret = ProcessAnalog(DrvAnalogPort1, 0, INPUT_DEADZONE, 0x00, 0xfe); break;
|
||||
case 2: ret = ProcessAnalog(DrvAnalogPort2, 0, INPUT_DEADZONE | INPUT_LINEAR | INPUT_MIGHTBEDIGITAL, 0x00, 0xff); break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static UINT16 __fastcall atarig1_main_read_word(UINT32 address)
|
||||
{
|
||||
switch (address)
|
||||
|
@ -254,7 +267,7 @@ static UINT16 __fastcall atarig1_main_read_word(UINT32 address)
|
|||
case 0xfc8004:
|
||||
case 0xfc8006:
|
||||
if (pitfight) return DrvInputs[1];
|
||||
return DrvInputs[1 + a2d_select];
|
||||
return read_analog(a2d_select) << 8;
|
||||
|
||||
case 0xfd0000:
|
||||
return 0xff | (AtariJSARead() << 8);
|
||||
|
@ -280,7 +293,7 @@ static UINT8 __fastcall atarig1_main_read_byte(UINT32 address)
|
|||
case 0xfc8006:
|
||||
case 0xfc8007:
|
||||
if (pitfight) return (DrvInputs[1] >> ((~address & 1) * 8));
|
||||
return (DrvInputs[1 + a2d_select] >> ((~address & 1) * 8));
|
||||
return ((read_analog(a2d_select) << 8) >> ((~address & 1) * 8));
|
||||
|
||||
case 0xfd0000:
|
||||
case 0xfd0001:
|
||||
|
@ -356,7 +369,7 @@ static INT32 MemIndex()
|
|||
DrvGfxROM1 = Next; Next += 0x040000;
|
||||
DrvGfxROM2 = Next; Next += 0x200000;
|
||||
|
||||
DrvSndROM = Next; Next += 0x040000;
|
||||
DrvSndROM = Next; Next += 0x080000;
|
||||
|
||||
DrvPalette = (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
|
||||
|
||||
|
@ -518,7 +531,7 @@ static INT32 DrvInit(INT32 game, INT32 slapstic)
|
|||
|
||||
if (BurnLoadRom(DrvSndROM + 0x000000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x010000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x020000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x060000, k++, 1)) return 1;
|
||||
|
||||
DrvGfxDecode();
|
||||
}
|
||||
|
@ -560,8 +573,8 @@ static INT32 DrvInit(INT32 game, INT32 slapstic)
|
|||
|
||||
if (BurnLoadRom(DrvSndROM + 0x000000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x010000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x020000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x030000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x060000, k++, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x070000, k++, 1)) return 1;
|
||||
|
||||
DrvGfxDecode();
|
||||
}
|
||||
|
@ -633,6 +646,8 @@ static INT32 DrvExit()
|
|||
|
||||
SekExit();
|
||||
|
||||
atarirle_exit();
|
||||
|
||||
AtariJSAExit();
|
||||
AtariSlapsticExit();
|
||||
AtariEEPROMExit();
|
||||
|
@ -710,14 +725,9 @@ static INT32 DrvDraw()
|
|||
DrvRecalc = 1; // force!!
|
||||
}
|
||||
|
||||
if (nBurnLayer & 1)
|
||||
{
|
||||
draw_background();
|
||||
}
|
||||
else
|
||||
{
|
||||
BurnTransferClear();
|
||||
}
|
||||
BurnTransferClear();
|
||||
|
||||
if (nBurnLayer & 1) draw_background();
|
||||
|
||||
copy_sprites();
|
||||
|
||||
|
@ -759,7 +769,8 @@ static INT32 DrvFrame()
|
|||
|
||||
INT32 nSoundBufferPos = 0;
|
||||
INT32 nInterleave = 262;
|
||||
// INT32 nCyclesTotal[2] = { (INT32)(14318180 / 59.92), (INT32)(1789773 / 59.92) };
|
||||
INT32 nCyclesTotal[2] = { (INT32)(14318180 / 59.92), (INT32)(1789773 / 59.92) };
|
||||
INT32 nCyclesDone[2] = { 0, 0 };
|
||||
|
||||
SekOpen(0);
|
||||
M6502Open(0);
|
||||
|
@ -770,18 +781,12 @@ static INT32 DrvFrame()
|
|||
{
|
||||
scanline = i;
|
||||
|
||||
// beam active
|
||||
SekRun(320);
|
||||
M6502Run((SekTotalCycles()/8) - M6502TotalCycles());
|
||||
SekRun(320);
|
||||
M6502Run((SekTotalCycles()/8) - M6502TotalCycles());
|
||||
|
||||
// hblank
|
||||
SekRun(272);
|
||||
M6502Run((SekTotalCycles()/8) - M6502TotalCycles());
|
||||
nCyclesDone[0] += SekRun(((i + 1) * nCyclesTotal[0] / nInterleave) - nCyclesDone[0]);
|
||||
nCyclesDone[1] += M6502Run(((i + 1) * nCyclesTotal[1] / nInterleave) - nCyclesDone[1]);
|
||||
|
||||
if (i == 239) {
|
||||
vblank = 1;
|
||||
|
||||
video_int_state = 1;
|
||||
update_interrupts();
|
||||
|
||||
|
@ -792,8 +797,8 @@ static INT32 DrvFrame()
|
|||
|
||||
AtariJSAInterruptUpdate(nInterleave);
|
||||
|
||||
if (pBurnSoundOut) {
|
||||
INT32 nSegment = nBurnSoundLen / nInterleave;
|
||||
if (pBurnSoundOut && i&1) {
|
||||
INT32 nSegment = nBurnSoundLen / (nInterleave / 2);
|
||||
AtariJSAUpdate(pBurnSoundOut + (nSoundBufferPos << 1), nSegment);
|
||||
nSoundBufferPos += nSegment;
|
||||
}
|
||||
|
@ -830,6 +835,7 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
|||
|
||||
SekScan(nAction);
|
||||
|
||||
atarirle_scan(nAction, pnMin);
|
||||
AtariJSAScan(nAction, pnMin);
|
||||
AtariSlapsticScan(nAction, pnMin);
|
||||
AtariEEPROMScan(nAction, pnMin);
|
||||
|
|
|
@ -625,7 +625,7 @@ static INT32 DrvFrame()
|
|||
|
||||
if (pBurnSoundOut) {
|
||||
INT32 nSegment = nBurnSoundLen - nSoundBufferPos;
|
||||
if (nSegment >= 0) {
|
||||
if (nSegment > 0) {
|
||||
AtariJSAUpdate(pBurnSoundOut + (nSoundBufferPos << 1), nSegment);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue