Example #1
0
/***************************************************************************

  Draw the game screen in the given osd_bitmap.
  Do NOT call osd_update_display() from this function, it will be called by
  the main emulation engine.

***************************************************************************/
void venture_vh_screenrefresh(struct osd_bitmap *bitmap)
{
	int offs,i;
	extern struct GfxLayout venture_charlayout;


	for(offs = 0;offs < 256;offs++)
	{
			if (dirtycharacter[offs] == 1)
			{
				decodechar(Machine->gfx[1],offs,venture_characterram,&venture_charlayout);
				dirtycharacter[offs] = 2;
			}
	}

	/* for every character in the Video RAM, check if it has been modified */
	/* since last time and update it accordingly. */
	for (offs = 0;offs < VIDEO_RAM_SIZE;offs++)
	{
		int charcode;


		charcode = videoram[offs];

		if (dirtybuffer[offs] || dirtycharacter[charcode])
		{
			int sx,sy;


		/* decode modified characters */
			if (dirtycharacter[charcode] == 1)
			{
				decodechar(Machine->gfx[1],charcode,venture_characterram,&venture_charlayout);
				dirtycharacter[charcode] = 2;
			}


			dirtybuffer[offs] = 0;

			sx = 8 * (offs % 32);
			sy = 8 * (offs / 32);

			drawgfx(tmpbitmap,Machine->gfx[1],
					charcode,(charcode>>6)+1,
					0,0,sx,sy,
					&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
		}
	}
Example #2
0
static void update_background(void)
{
	int x, y, offs;

	/* update the background and any dirty characters in it */
	for (y = offs = 0; y < 32; y++)
		for (x = 0; x < 32; x++, offs++)
		{
			int code = videoram[offs];

			/* see if the character is dirty */
			if (chardirty[code] == 1)
			{
				decodechar(Machine->gfx[0], code, exidy_characterram, Machine->drv->gfxdecodeinfo[0].gfxlayout);
				chardirty[code] = 2;
			}

			/* see if the bitmap is dirty */
			if (dirtybuffer[offs] || chardirty[code])
			{
				int color = code >> 6;
				drawgfx(tmpbitmap, Machine->gfx[0], code, color, 0, 0, x * 8, y * 8, NULL, TRANSPARENCY_NONE, 0);
				dirtybuffer[offs] = 0;
			}
		}
Example #3
0
static WRITE8_HANDLER( trvmadns_gfxram_w )
{
	trvmadns_gfxram[offset] = data;
	decodechar(machine->gfx[0], offset/16, trvmadns_gfxram);

	tilemap_mark_all_tiles_dirty(bg_tilemap);
}
Example #4
0
//
//	Just as a gadget, I implemented tone decoding by taking the
//	fft of the last rxsymbol samples. Cannot say that it was
//	better, so it was deleted after all.
void	throb::throb_rx (DSPCOMPLEX in) {
DSPCOMPLEX rxword [MAX_TONES];
int16_t i, tone1, tone2, maxtone;
static	int cnt	= 0;

	symbol [symptr] = in;
	if (rxcntr > 0.0)
	   return;

// correlate against the predefined tones
	for (i = 0; i < tonesformode (throbMode); i++)
	   rxword [i] = cmac (rxtone[i], symbol, symptr + 1, rxsymlen);
//
//	and find the strongest tones
	maxtone = findtones(rxword, &tone1, &tone2);
// decode
	if (!throbReverse)
	   decodechar (tone1, tone2);
	else
	   decodechar (tonesformode (throbMode) - 1 - tone2,
	               tonesformode (throbMode) - 1 - tone1);

	if (afcOn && (metrics >= thresHold)) {
	   DSPCOMPLEX z1, z2;
	   float f;
//
//	for error correction, we compute the freq difference
//	between the current maxtone and the previous one
//	Note that correction basically works for only half
//	the distance of two subsequent tones.
	   z1	= rxword [maxtone];
	   z2	= cmac (rxtone [maxtone], symbol, symptr + 2, rxsymlen);
	   f	= arg (conj (z2) * z1) /
	                       ((2 * downRate * M_PI) / sampleRate);
	   f	+= freqs [maxtone];
	   throbIF	-= f / (tonesformode (throbMode) - 1);
	}

//	done with this symbol, start over 
	rxcntr 		= rxsymlen;
	waitsync 	= 1;
	if (++cnt > 10) {
	   cnt = 0;
	   showS2N (s2n);
	   showMetrics (metrics);
	}
}
Example #5
0
static void get_bg2_tile_info(int tile_index)
{
	int code = tiamc1_tileram[tile_index + 1024];

	decodechar(Machine->gfx[0], code, tiamc1_charram,
		   Machine->drv->gfxdecodeinfo[0].gfxlayout);

	SET_TILE_INFO(0, code, 0, 0)
}
Example #6
0
static TILE_GET_INFO( satansat_get_fg_tile_info )
{
	int code = rockola_videoram2[tile_index];
	int color = colorram[tile_index] & 0x03;

	decodechar(machine->gfx[0], code, rockola_charram,
		machine->drv->gfxdecodeinfo[0].gfxlayout);

	SET_TILE_INFO(0, code, color, 0);
}
Example #7
0
static void get_fg_tile_info(int tile_index)
{
    int code = rockola_videoram2[tile_index];
    int color = colorram[tile_index] & 0x07;

    decodechar(Machine->gfx[0], code, rockola_charram,
               Machine->drv->gfxdecodeinfo[0].gfxlayout);

    SET_TILE_INFO(0, code, color, 0)
}
Example #8
0
static void updateChars(running_machine *machine)
{
	int i;
	for(i=0;i<ML_CHARS;i++)
	{
		if(dirtychar[i])
		{
			dirtychar[i]=0;
			decodechar(machine->gfx[0], i,(UINT8 *) ml_tileram, machine->drv->gfxdecodeinfo[0].gfxlayout);
		}
	}
}
Example #9
0
/***************************************************************************

  Draw the game screen in the given osd_bitmap.
  Do NOT call osd_update_display() from this function, it will be called by
  the main emulation engine.

***************************************************************************/
void gottlieb_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
    int offs;


	/* update palette */
	if (palette_recalc())
		memset(dirtybuffer, 1, videoram_size);

    /* recompute character graphics */
    for (offs = 0;offs < Machine->drv->gfxdecodeinfo[0].gfxlayout->total;offs++)
	{
		if (dirtycharacter[offs])
			decodechar(Machine->gfx[0],offs,gottlieb_characterram,Machine->drv->gfxdecodeinfo[0].gfxlayout);
	}


    /* for every character in the Video RAM, check if it has been modified */
    /* since last time and update it accordingly. */
    for (offs = videoram_size - 1;offs >= 0;offs--)
	{
		if (dirtybuffer[offs] || dirtycharacter[videoram[offs]])
		{
			int sx,sy;


			dirtybuffer[offs] = 0;

			sx = offs % 32;
			sy = offs / 32;
			if (hflip) sx = 31 - sx;
			if (vflip) sy = 29 - sy;

			drawgfx(tmpbitmap,Machine->gfx[0],
					videoram[offs],
					0,
					hflip,vflip,
					8*sx,8*sy,
					&Machine->visible_area,TRANSPARENCY_NONE,0);
		}
    }

	memset(dirtycharacter,0,MAX_CHARS);


	/* copy the character mapped graphics */
	if (background_priority)
		fillbitmap(bitmap,Machine->pens[0],&Machine->visible_area);
	else
		copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->visible_area,TRANSPARENCY_NONE,0);


	/* Draw the sprites. Note that it is important to draw them exactly in this */
	/* order, to have the correct priorities. */
    for (offs = 0;offs < spriteram_size - 8;offs += 4)     /* it seems there's something strange with sprites #62 and #63 */
	{
	    int sx,sy;


		/* coordinates hand tuned to make the position correct in Q*Bert Qubes start */
		/* of level animation. */
		sx = (spriteram[offs + 1]) - 4;
		if (hflip) sx = 233 - sx;
		sy = (spriteram[offs]) - 13;
		if (vflip) sy = 228 - sy;

		if (spriteram[offs] || spriteram[offs + 1])	/* needed to avoid garbage on screen */
			drawgfx(bitmap,Machine->gfx[1],
					(255 ^ spriteram[offs + 2]) + 256 * spritebank,
					0,
					hflip,vflip,
					sx,sy,
					&Machine->visible_area,TRANSPARENCY_PEN,0);
	}


	if (background_priority)
		copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->visible_area,TRANSPARENCY_COLOR,0);
}
Example #10
0
/***************************************************************************

  Draw the game screen in the given osd_bitmap.
  Do NOT call osd_update_display() from this function, it will be called by
  the main emulation engine.

***************************************************************************/
void redalert_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
	int offs,i;

	/* for every character in the Video RAM, check if it has been modified */
	/* since last time and update it accordingly. */
	for (offs = videoram_size - 1;offs >= 0;offs--)
	{
		int charcode;
		int stat_transparent;


		charcode = videoram[offs];

		if (dirtybuffer[offs] || redalert_dirtycharacter[charcode])
		{
			int sx,sy,color;


			/* decode modified background */
			if (redalert_dirtyback[offs] == 1)
			{
				decodechar(Machine->gfx[0],offs,redalert_backram,
							Machine->drv->gfxdecodeinfo[0].gfxlayout);
				redalert_dirtyback[offs] = 2;
			}

			/* decode modified characters */
			if (redalert_dirtycharacter[charcode] == 1)
			{
				if (charcode < 0x80)
					decodechar(Machine->gfx[1],charcode,redalert_characterram,
								Machine->drv->gfxdecodeinfo[1].gfxlayout);
				else
					decodechar(Machine->gfx[2],charcode-0x80,redalert_spriteram1,
								Machine->drv->gfxdecodeinfo[2].gfxlayout);
				redalert_dirtycharacter[charcode] = 2;
			}


			dirtybuffer[offs] = 0;

			sx = 31 - offs / 32;
			sy = offs % 32;

			stat_transparent = TRANSPARENCY_NONE;

			/* First layer of color */
			if (charcode >= 0xC0)
			{
				stat_transparent = TRANSPARENCY_COLOR;

				color = color_lookup[charcode];

				drawgfx(tmpbitmap,Machine->gfx[2],
						charcode-0x80,
						color,
						0,0,
						8*sx,8*sy,
						&Machine->visible_area,TRANSPARENCY_NONE,0);
			}

			/* Second layer - background */
			color = redalert_backcolor[offs];
			drawgfx(tmpbitmap,Machine->gfx[0],
					offs,
					color,
					0,0,
					8*sx,8*sy,
					&Machine->visible_area,stat_transparent,0);

			/* Third layer - alphanumerics & sprites */
			if (charcode < 0x80)
			{
				color = color_lookup[charcode];
				drawgfx(tmpbitmap,Machine->gfx[1],
						charcode,
						color,
						0,0,
						8*sx,8*sy,
						&Machine->visible_area,TRANSPARENCY_COLOR,0);
			}
			else if (charcode < 0xC0)
			{
				color = color_lookup[charcode];
				drawgfx(tmpbitmap,Machine->gfx[2],
						charcode-0x80,
						color,
						0,0,
						8*sx,8*sy,
						&Machine->visible_area,TRANSPARENCY_COLOR,0);
			}

		}
	}

	for (i = 0;i < 256;i++)
	{
		if (redalert_dirtycharacter[i] == 2)
			redalert_dirtycharacter[i] = 0;
	}

	for (i = 0;i < 0x400;i++)
	{
		if (redalert_dirtyback[i] == 2)
			redalert_dirtyback[i] = 0;
	}

	/* copy the character mapped graphics */
	copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->visible_area,TRANSPARENCY_NONE,0);

}
Example #11
0
static void screenrefresh(struct osd_bitmap *bitmap,const struct rectangle *clip)
{
	int offs,code,scrollx,scrolly,mx,my;

	/* Recalculate palette if needed */
	palette_init_used_colors();

	for (offs=0; offs<256; offs++)
		if (!(offs%16))
			palette_used_colors[offs] = PALETTE_COLOR_TRANSPARENT;
		else
			palette_used_colors[offs] = PALETTE_COLOR_USED;

	for (offs=256; offs<512; offs++)
			palette_used_colors[offs] = PALETTE_COLOR_USED;

	if (palette_recalc())
		memset(vram_dirty,1,0x1000);

	/* Dynamically decode chars if dirty */
	for (code = 0x0000;code < 0x1000;code++)
		if (tile_dirty[code])
			decodechar(Machine->gfx[0],code,HuC6270_vram,Machine->drv->gfxdecodeinfo[0].gfxlayout);

	/* Dynamically decode sprites if dirty */
	for (code = 0x0000;code < 0x400;code++)
		if (sprite_dirty[code])
			decodechar(Machine->gfx[1],code,HuC6270_vram,Machine->drv->gfxdecodeinfo[1].gfxlayout);

	/* NB: If first 0x1000 byte is always tilemap, no need to decode the first batch of tiles/sprites */

	mx=-1;
	my=0;
	for (offs = 0x0000;offs < 0x2000;offs += 2)
	{
		mx++;
		if (mx==64) {mx=0; my++;}
		code=HuC6270_vram[offs+1] + ((HuC6270_vram[offs] & 0x0f) << 8);

		/* If this tile was changed OR tilemap was changed, redraw */
		if (tile_dirty[code] || vram_dirty[offs/2]) {
			vram_dirty[offs/2]=0;
	        drawgfx(tile_bitmap,Machine->gfx[0],
					code,
					HuC6270_vram[offs] >> 4,
					0,0,
					8*mx,8*my,
					0,TRANSPARENCY_NONE,0);
			drawgfx(front_bitmap,Machine->gfx[2],
					0,
					0,
					0,0,
					8*mx,8*my,
					0,TRANSPARENCY_NONE,0);
	        drawgfx(front_bitmap,Machine->gfx[0],
					code,
					HuC6270_vram[offs] >> 4,
					0,0,
					8*mx,8*my,
					0,TRANSPARENCY_PENS,0x1);
			}
	}
Example #12
0
void polyplay_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
	int offs;


	if (full_refresh)
	{
		memset(dirtybuffer,1,videoram_size);
	}

	/* for every character in the Video RAM, check if it has been modified */
	/* since last time and update it accordingly. */
	for (offs = videoram_size - 1;offs >= 0;offs--)
	{
		int charcode;


		charcode = videoram[offs];

		if (dirtybuffer[offs] || dirtycharacter[charcode])
		{
			int sx,sy;


			/* index=0 -> 1 bit chr; index=1 -> 3 bit chr */
			if (charcode < 0x80) {

				/* ROM chr, no need for decoding */

				dirtybuffer[offs] = 0;

				sx = offs % 64;
				sy = offs / 64;

				drawgfx(bitmap,Machine->gfx[0],
						charcode,
						0x0,
						0,0,
						8*sx,8*sy,
						&Machine->visible_area,TRANSPARENCY_NONE,0);

			}
			else {
				/* decode modified characters */
				if (dirtycharacter[charcode] == 1)
				{
					decodechar(Machine->gfx[1],charcode-0x80,polyplay_characterram,Machine->drv->gfxdecodeinfo[1].gfxlayout);
					dirtycharacter[charcode] = 2;
				}


				dirtybuffer[offs] = 0;

				sx = offs % 64;
				sy = offs / 64;

				drawgfx(bitmap,Machine->gfx[1],
						charcode,
						0x0,
						0,0,
						8*sx,8*sy,
						&Machine->visible_area,TRANSPARENCY_NONE,0);

			}
		}
	}


	for (offs = 0;offs < 256;offs++)
	{
		if (dirtycharacter[offs] == 2) dirtycharacter[offs] = 0;
	}
}