Ejemplo n.º 1
0
static READ8_HANDLER( no_key_r )
{
    popmessage("CPU #%d PC %08x: keychip read %04x\n",cpu_getactivecpu(),activecpu_get_pc(),offset);
    return 0;
}
Ejemplo n.º 2
0
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
{
	int offs,chain_pos;
	int x,y,curx,cury;
	int priority=0;
	UINT8 col,flipx,flipy,chain;
	UINT16 code;

	/* According to Raine, word in ioc_ram determines sprite/tile priority... */
	priority = (gcpinbal_ioc_ram[0x68/2] & 0x8800) ? 0 : 1;

	for (offs = spriteram_size/2-8;offs >= 0;offs -= 8)
	{
		code = ((spriteram16[offs+5])&0xff) + (((spriteram16[offs+6]) &0xff) << 8);
		code &= 0x3fff;

		if (!(spriteram16[offs+4] &0x80))	/* active sprite ? */
		{
			x = ((spriteram16[offs+0]) &0xff) + (((spriteram16[offs+1]) &0xff) << 8);
			y = ((spriteram16[offs+2]) &0xff) + (((spriteram16[offs+3]) &0xff) << 8);

			/* Treat coords as signed */
			if (x & 0x8000)  x -= 0x10000;
			if (y & 0x8000)  y -= 0x10000;

			col  =   ((spriteram16[offs+7]) &0x0f) | 0x60;
			chain =   (spriteram16[offs+4]) &0x07;
			flipy =   (spriteram16[offs+4]) &0x10;
			flipx = 0;

			curx = x;
			cury = y;

			if (((spriteram16[offs+4]) &0x08) && flipy)
				cury += (chain * 16);

			for (chain_pos = chain;chain_pos >= 0;chain_pos--)
			{
				pdrawgfx(bitmap, machine->gfx[0],
						code,
						col,
						flipx, flipy,
						curx,cury,
						cliprect,TRANSPARENCY_PEN,0,
						priority ? 0xfc : 0xf0);

				code++;

				if ((spriteram16[offs+4]) &0x08)	/* Y chain */
				{
					if (flipy)	cury -= 16;
					else cury += 16;
				}
				else	/* X chain */
				{
					curx += 16;
				}
			}
		}
	}
#if 0
	if (rotate)
	{
		char buf[80];
		sprintf(buf,"sprite rotate offs %04x ?",rotate);
		popmessage(buf);
	}
#endif
}
Ejemplo n.º 3
0
void a2bus_zipdrivebase_device::device_reset()
{
	popmessage("Zip Drive partition format unknown, contact MESSdev if you have the software or a drive dump!");
}
Ejemplo n.º 4
0
void excellent_spr_device::gcpinbal_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs, int priority )
{
	UINT8 *spriteram = m_ram.get();
	int offs, chain_pos;
	int x, y, curx, cury;
//  int priority = 0;
	UINT8 col, flipx, flipy, chain;
	UINT16 code;


	for (offs = 0x1000 - 8; offs >= 0; offs -= 8)
	{
		code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8);
		code &= 0x3fff;

		if (!(spriteram[offs + 4] &0x80))   /* active sprite ? */
		{
			x = ((spriteram[offs + 0]) & 0xff) + (((spriteram[offs + 1]) & 0xff) << 8);
			y = ((spriteram[offs + 2]) & 0xff) + (((spriteram[offs + 3]) & 0xff) << 8);

			/* Treat coords as signed */
			if (x & 0x8000)  x -= 0x10000;
			if (y & 0x8000)  y -= 0x10000;

			col  = ((spriteram[offs + 7]) & 0x0f) | 0x60;
			chain = (spriteram[offs + 4]) & 0x07;
			flipy = (spriteram[offs + 4]) & 0x10;
			flipx = 0;

			curx = x;
			cury = y;

			if (((spriteram[offs + 4]) & 0x08) && flipy)
				cury += (chain * 16);

			for (chain_pos = chain; chain_pos >= 0; chain_pos--)
			{
				gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect,
						code,
						col,
						flipx, flipy,
						curx,cury,
						screen.priority(),
						priority ? 0xfc : 0xf0,0);

				code++;

				if ((spriteram[offs + 4]) & 0x08)   /* Y chain */
				{
					if (flipy)  cury -= 16;
					else cury += 16;
				}
				else    /* X chain */
				{
					curx += 16;
				}
			}
		}
	}
#if 0
	if (rotate)
	{
		char buf[80];
		sprintf(buf, "sprite rotate offs %04x ?", rotate);
		popmessage(buf);
	}
#endif
}
Ejemplo n.º 5
0
static READ32_HANDLER( a_bus_ctrl_r )
{
	UINT32 *ROM = (UINT32 *)memory_region(REGION_USER1);

	if(a_bus[0] & 0x00010000)//protection calculation is activated
	{
		if(offset == 3)
		{
			logerror("A-Bus control protection read at %06x with data = %08x\n",activecpu_get_pc(),a_bus[3]);
			#ifdef MAME_DEBUG
			popmessage("Prot read at %06x with data = %08x",activecpu_get_pc(),a_bus[3]);
			#endif
			switch(a_bus[3])
			{
				case 0x01230000://astrass,char data in test mode PC=60118f2
				/*
                TODO: the chars that are used are 8x8x4,but we need to convert them to
                16x16x4 format.
                [01] NULL
                [02] NULL
                [03] NULL
                [04] NULL
                [05] NULL
                [06] NULL
                [07] NULL
                [08] NULL
                [09] data 1
                [10] data 2
                [11] data 3
                [12] data 4
                [13] data 5
                [14] data 6
                [15] data 7
                [16] data 8

                2b5 = A (up-left)
                2b6 = A (up-right)
                2d1 = A (down-left)
                2d0 = A (down-right)
                2f2 = S (up-left)
                2f3 = S (up-right)
                311 = S (down-left)
                310 = S (down-right)
                2f4 = T (up-left)
                2f5 = T (up-right)
                2b7 = E (up-left) (not 2bc,maybe because the up-left corner of E is equal of B?)
                2bd = E (up-right)
                */
					internal_counter++;
					if(char_offset == 0)
					{
						if(internal_counter > ((8*0x234)-1))
						{
							internal_counter = 0;
							char_offset = 1;
						}

						return 0;
					}
					else
					{
						if(internal_counter > 8)
						{
							if(internal_counter > 15)
							{
								ctrl_index-=8;
								internal_counter = 0;
							}

							ctrl_index++;
							return ROM[ctrl_index];
						}
						else
						{
							ctrl_index++;
							return ROM[ctrl_index];
						}
					}
				case 0x10da0000://ffreveng, boot vectors at $6080000,test mode
					ctrl_index++;
					if(ctrl_index > 2)
						return 0x234;
					else
						return vector_prot[ctrl_index-1];
				case 0x10d70000://ffreveng, boot vectors at $6080000,attract mode
					ctrl_index++;
					return ROM[ctrl_index];
				case 0x2c5b0000://sss
				case 0x47f10000:
				case 0xfcda0000:
				case 0xb5e60000:
				case 0x392c0000:
				case 0x77c30000:
				case 0x8a620000:
					ctrl_index++;
					return ROM[ctrl_index];
				case 0x77770000: {//rsgun
					UINT32 val =
						((ctrl_index & 0xff)<<24) |
						(((ctrl_index+1) & 0xff)<<16) |
						(((ctrl_index+2) & 0xff)<<8) |
						((ctrl_index+3) & 0xff);
					if(ctrl_index & 0x100)
						val &= 0x0f0f0f0f;
					else
						val &= 0xf0f0f0f0;

					ctrl_index += 4;
					return val;
				}
				case 0xff7f0000://elandore
					if(a_bus[2] == 0xe69000f9)
					{
						ctrl_index++;
						return ROM[ctrl_index];
					}
					else return 0x12345678;
				case 0xffbf0000:
					ctrl_index++;
					return ROM[ctrl_index];
			}
		}
		return a_bus[offset];
	}
	else
	{
		if(a_bus[offset] != 0) return a_bus[offset];
		else return ROM[(0x02fffff0/4)+offset];
	}
}
Ejemplo n.º 6
0
static void nbmj8900_gfxdraw(running_machine &machine)
{
	nbmj8900_state *state = machine.driver_data<nbmj8900_state>();
	unsigned char *GFX = state->memregion("gfx")->base();

	int x, y;
	int dx1, dx2, dy1, dy2;
	int startx, starty;
	int sizex, sizey;
	int skipx, skipy;
	int ctrx, ctry;
	unsigned char color, color1, color2;
	int gfxaddr;

	nb1413m3_busyctr = 0;

	startx = state->m_blitter_destx + state->m_blitter_sizex;
	starty = state->m_blitter_desty + state->m_blitter_sizey;

	if (state->m_blitter_direction_x)
	{
		sizex = state->m_blitter_sizex ^ 0xff;
		skipx = 1;
	}
	else
	{
		sizex = state->m_blitter_sizex;
		skipx = -1;
	}

	if (state->m_blitter_direction_y)
	{
		sizey = state->m_blitter_sizey ^ 0xff;
		skipy = 1;
	}
	else
	{
		sizey = state->m_blitter_sizey;
		skipy = -1;
	}

	gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);

	for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
	{
		for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
		{
			if ((gfxaddr > (machine.root_device().memregion("gfx")->bytes() - 1)))
			{
#ifdef MAME_DEBUG
				popmessage("GFXROM ADDRESS OVER!!");
#endif
				gfxaddr &= (machine.root_device().memregion("gfx")->bytes() - 1);
			}

			color = GFX[gfxaddr++];

			// for hanamomo
			if ((nb1413m3_type == NB1413M3_HANAMOMO) && ((gfxaddr >= 0x20000) && (gfxaddr < 0x28000)))
			{
				color |= ((color & 0x0f) << 4);
			}

			dx1 = (2 * x + 0) & 0x1ff;
			dx2 = (2 * x + 1) & 0x1ff;

			if (state->m_gfxdraw_mode)
			{
				// 2 layer type
				dy1 = y & 0xff;
				dy2 = (y + state->m_scrolly) & 0xff;
			}
			else
			{
				// 1 layer type
				dy1 = (y + state->m_scrolly) & 0xff;
				dy2 = 0;
			}

			if (!state->m_flipscreen)
			{
				dx1 ^= 0x1ff;
				dx2 ^= 0x1ff;
				dy1 ^= 0xff;
				dy2 ^= 0xff;
			}

			if (state->m_blitter_direction_x)
			{
				// flip
				color1 = (color & 0x0f) >> 0;
				color2 = (color & 0xf0) >> 4;
			}
			else
			{
				// normal
				color1 = (color & 0xf0) >> 4;
				color2 = (color & 0x0f) >> 0;
			}

			color1 = state->m_clut[((state->m_clutsel & 0x7f) << 4) + color1];
			color2 = state->m_clut[((state->m_clutsel & 0x7f) << 4) + color2];

			if ((!state->m_gfxdraw_mode) || (state->m_vram & 0x01))
			{
				// layer 1
				if (color1 != 0xff)
				{
					state->m_videoram0[(dy1 * state->m_screen_width) + dx1] = color1;
					update_pixel0(machine, dx1, dy1);
				}
				if (color2 != 0xff)
				{
					state->m_videoram0[(dy1 * state->m_screen_width) + dx2] = color2;
					update_pixel0(machine, dx2, dy1);
				}
			}
			if (state->m_gfxdraw_mode && (state->m_vram & 0x02))
			{
				// layer 2
				if (state->m_vram & 0x08)
				{
					// transparent enable
					if (color1 != 0xff)
					{
						state->m_videoram1[(dy2 * state->m_screen_width) + dx1] = color1;
						update_pixel1(machine, dx1, dy2);
					}
					if (color2 != 0xff)
					{
						state->m_videoram1[(dy2 * state->m_screen_width) + dx2] = color2;
						update_pixel1(machine, dx2, dy2);
					}
				}
				else
				{
					// transparent disable
					state->m_videoram1[(dy2 * state->m_screen_width) + dx1] = color1;
					update_pixel1(machine, dx1, dy2);
					state->m_videoram1[(dy2 * state->m_screen_width) + dx2] = color2;
					update_pixel1(machine, dx2, dy2);
				}
			}

			nb1413m3_busyctr++;
		}
Ejemplo n.º 7
0
bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args)
{
    UINT32 open_plan[4];
    int i;
	bool softload = FALSE;
	m_from_swlist = FALSE;

	// if the path contains no period, we are using softlists, so we won't create an image
	astring pathstr(path);
	bool filename_has_period = (pathstr.rchr(0, '.') != -1) ? TRUE : FALSE;

    /* first unload the image */
    unload();

    /* clear any possible error messages */
    clear_error();

    /* we are now loading */
    m_is_loading = TRUE;

    /* record the filename */
    m_err = set_image_filename(path);

    if (m_err)
        goto done;

	/* Check if there's a software list defined for this device and use that if we're not creating an image */
	if (!filename_has_period)
	{
		softload = load_software_part( device().machine().options(), this, path, &m_software_info_ptr, &m_software_part_ptr, &m_full_software_name );
		// if we had launched from softlist with a specified part, e.g. "shortname:part"
		// we would have recorded the wrong name, so record it again based on software_info
		if (m_software_info_ptr && m_software_info_ptr->shortname)
			m_err = set_image_filename(m_software_info_ptr->shortname);

		m_from_swlist = TRUE;
	}

	if (is_create || filename_has_period)
	{
		/* determine open plan */
		determine_open_plan(is_create, open_plan);

		/* attempt to open the file in various ways */
		for (i = 0; !m_file && open_plan[i]; i++)
		{
			/* open the file */
			m_err = load_image_by_path(open_plan[i], path);
			if (m_err && (m_err != IMAGE_ERROR_FILENOTFOUND))
				goto done;
		}
	}

	/* Copy some image information when we have been loaded through a software list */
	if ( m_software_info_ptr )
	{
		m_longname = m_software_info_ptr->longname;
		m_manufacturer = m_software_info_ptr->publisher;
		m_year = m_software_info_ptr->year;
		//m_playable = m_software_info_ptr->supported;
	}

	/* did we fail to find the file? */
	if (!is_loaded() && !softload)
	{
		m_err = IMAGE_ERROR_FILENOTFOUND;
		goto done;
	}

	/* call device load or create */
	m_create_format = create_format;
	m_create_args = create_args;

	if (m_init_phase==FALSE) {
		m_err = (image_error_t)finish_load();
		if (m_err)
			goto done;
	}
    /* success! */

done:
    if (m_err!=0) {
		if (!m_init_phase)
		{
			if (device().machine().phase() == MACHINE_PHASE_RUNNING)
				popmessage("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error());
			else
				mame_printf_error("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error());
		}
		clear();
	}
	else {
		/* do we need to reset the CPU? only schedule it if load/create is successful */
		if (device().machine().time() > attotime::zero && is_reset_on_load())
			device().machine().schedule_hard_reset();
		else
		{
			if (!m_init_phase)
			{
				if (device().machine().phase() == MACHINE_PHASE_RUNNING)
					popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded");
				else
					mame_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded");
			}
		}
	}
	return m_err ? IMAGE_INIT_FAIL : IMAGE_INIT_PASS;
}
Ejemplo n.º 8
0
UINT32 topspeed_state::screen_update_topspeed(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	UINT8 layer[4];

#ifdef MAME_DEBUG
	if (machine().input().code_pressed_once (KEYCODE_V))
	{
		m_dislayer[0] ^= 1;
		popmessage("bg: %01x", m_dislayer[0]);
	}

	if (machine().input().code_pressed_once (KEYCODE_B))
	{
		m_dislayer[1] ^= 1;
		popmessage("fg: %01x", m_dislayer[1]);
	}

	if (machine().input().code_pressed_once (KEYCODE_N))
	{
		m_dislayer[2] ^= 1;
		popmessage("bg2: %01x", m_dislayer[2]);
	}

	if (machine().input().code_pressed_once (KEYCODE_M))
	{
		m_dislayer[3] ^= 1;
		popmessage("fg2: %01x", m_dislayer[3]);
	}

	if (machine().input().code_pressed_once (KEYCODE_C))
	{
		m_dislayer[4] ^= 1;
		popmessage("sprites: %01x", m_dislayer[4]);
	}
#endif

	pc080sn_tilemap_update(m_pc080sn_1);
	pc080sn_tilemap_update(m_pc080sn_2);

	/* Tilemap layer priority seems hardwired (the order is odd, too) */
	layer[0] = 1;
	layer[1] = 0;
	layer[2] = 1;
	layer[3] = 0;

	machine().priority_bitmap.fill(0, cliprect);
	bitmap.fill(0, cliprect);

#ifdef MAME_DEBUG
	if (m_dislayer[3] == 0)
#endif
	pc080sn_tilemap_draw(m_pc080sn_2, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);

#ifdef MAME_DEBUG
	if (m_dislayer[2] == 0)
#endif
	pc080sn_tilemap_draw_special(m_pc080sn_2, bitmap, cliprect, layer[1], 0, 2, m_raster_ctrl);

#ifdef MAME_DEBUG
	if (m_dislayer[1] == 0)
#endif
	pc080sn_tilemap_draw_special(m_pc080sn_1, bitmap, cliprect, layer[2], 0, 4, m_raster_ctrl + 0x100);

#ifdef MAME_DEBUG
	if (m_dislayer[0] == 0)
#endif
	pc080sn_tilemap_draw(m_pc080sn_1, bitmap, cliprect, layer[3], 0, 8);

#ifdef MAME_DEBUG
	if (m_dislayer[4] == 0)
#endif

	draw_sprites(machine(), bitmap,cliprect);
	return 0;
}
Ejemplo n.º 9
0
UINT32 timetrv_state::screen_update_timetrv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	popmessage("%s%s",reinterpret_cast<char *>(m_led_vram_lo.target()),reinterpret_cast<char *>(m_led_vram_hi.target()));
	return 0;
}
Ejemplo n.º 10
0
static void show_out(void)
{
#ifdef MAME_DEBUG
	popmessage("%02x %02x %02x", out[0], out[1], out[2]);
#endif
}
Ejemplo n.º 11
0
UINT32 destiny_state::screen_update_destiny(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	popmessage("%s",m_led_array);
	return 0;
}
Ejemplo n.º 12
0
void pce220_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
    if (id == TIMER_SEND && m_enabled)
    {
        //send data
        if (m_bytes_count <= length())
        {
            switch(m_state)
            {
            case SIO_WAIT:
                m_ack = 1;  //data send request
                //waits until is ready to receive
                if(!m_busy)
                    return;
                break;
            case SIO_SEND_START:
                //send start bit
                m_xin = 1;
                break;
            case SIO_SEND_BIT0:
            case SIO_SEND_BIT1:
            case SIO_SEND_BIT2:
            case SIO_SEND_BIT3:
            case SIO_SEND_BIT4:
            case SIO_SEND_BIT5:
            case SIO_SEND_BIT6:
            case SIO_SEND_BIT7:
                m_xin = BIT(~m_current_byte, m_state - SIO_SEND_BIT0);
                break;
            case SIO_SEND_PARITY:
                m_xin = calc_parity(m_current_byte);
                break;
            case SIO_SEND_STOP1:
            case SIO_SEND_STOP2:
                //stop bit
                m_xin = m_ack = 0;
                break;
            }

            if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT))
            {
                //next byte
                m_bytes_count++;
                popmessage("Send %d/%d bytes\n", m_bytes_count , (UINT32)length());
                m_state = SIO_WAIT;
                if (m_bytes_count < length())
                    fread(&m_current_byte, 1);
                else
                    m_current_byte = SIO_EOT_BYTE;
            }
            else
            {
                m_state = get_next_state();
            }

        }
        else
        {
            m_din = m_xin = m_ack = 0;
        }
    }
    else if (id == TIMER_RECEIVE && m_enabled)
    {
        //receive data
        switch(m_state)
        {
        case SIO_WAIT:
            //wait send request
            if(m_busy)
                return;
            m_ack = 1; //acknowledge
            break;
        case SIO_SEND_START:
            //wait for the start bit
            if (!m_xout)
                return;
            break;
        case SIO_SEND_BIT0:
        case SIO_SEND_BIT1:
        case SIO_SEND_BIT2:
        case SIO_SEND_BIT3:
        case SIO_SEND_BIT4:
        case SIO_SEND_BIT5:
        case SIO_SEND_BIT6:
        case SIO_SEND_BIT7:
            m_current_byte |= ((~m_xout)&1) << (m_state - SIO_SEND_BIT0);
            break;
        case SIO_SEND_PARITY:
            if (m_xout != calc_parity(m_current_byte))
                logerror("SIO %s: byte %d has wrong parity!\n", tag(), m_bytes_count);
            break;
        case SIO_SEND_STOP1:
        case SIO_SEND_STOP2:
            //receive stop bit
            m_ack = 0;
            break;
        }

        if (m_state == (SIO_SEND_PARITY + SIO_STOP_BIT))
        {
            //next byte
            m_bytes_count++;
            popmessage("Received %d bytes\n", m_bytes_count);
            m_state = SIO_WAIT;
            if (m_current_byte != SIO_EOT_BYTE)
                fwrite(&m_current_byte, 1);
            m_current_byte = 0;
        }
        else
        {
            m_state = get_next_state();
        }
    }
    else
    {
        m_din = m_xin = m_ack = 0;
    }
}
Ejemplo n.º 13
0
UINT32 undrfire_state::screen_update_undrfire(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	address_space &space = machine().driver_data()->generic_space();
	UINT8 layer[5];
	UINT8 pivlayer[3];
	UINT16 priority;

#ifdef MAME_DEBUG
	if (machine().input().code_pressed_once (KEYCODE_X))
	{
		m_dislayer[5] ^= 1;
		popmessage("piv text: %01x",m_dislayer[5]);
	}
	if (machine().input().code_pressed_once (KEYCODE_C))
	{
		m_dislayer[0] ^= 1;
		popmessage("bg0: %01x",m_dislayer[0]);
	}

	if (machine().input().code_pressed_once (KEYCODE_V))
	{
		m_dislayer[1] ^= 1;
		popmessage("bg1: %01x",m_dislayer[1]);
	}

	if (machine().input().code_pressed_once (KEYCODE_B))
	{
		m_dislayer[2] ^= 1;
		popmessage("bg2: %01x",m_dislayer[2]);
	}

	if (machine().input().code_pressed_once (KEYCODE_N))
	{
		m_dislayer[3] ^= 1;
		popmessage("bg3: %01x",m_dislayer[3]);
	}

	if (machine().input().code_pressed_once (KEYCODE_M))
	{
		m_dislayer[4] ^= 1;
		popmessage("sprites: %01x",m_dislayer[4]);
	}
#endif

	m_tc0100scn->tilemap_update();
	m_tc0480scp->tilemap_update();

	priority = m_tc0480scp->get_bg_priority();

	layer[0] = (priority & 0xf000) >> 12;   /* tells us which bg layer is bottom */
	layer[1] = (priority & 0x0f00) >>  8;
	layer[2] = (priority & 0x00f0) >>  4;
	layer[3] = (priority & 0x000f) >>  0;   /* tells us which is top */
	layer[4] = 4;   /* text layer always over bg layers */

	pivlayer[0] = m_tc0100scn->bottomlayer();
	pivlayer[1] = pivlayer[0] ^ 1;
	pivlayer[2] = 2;

	screen.priority().fill(0, cliprect);
	bitmap.fill(0, cliprect);   /* wrong color? */


/* The "PIV" chip seems to be a renamed TC0100SCN. It has a
   bottom layer usually full of bright garish colors that
   vaguely mimic the structure of the layers on top. Seems
   pointless - it's always hidden by other layers. Does it
   serve some blending pupose ? */

	m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, pivlayer[0], TILEMAP_DRAW_OPAQUE, 0);
	m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, pivlayer[1], 0, 0);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[0]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[0], 0, 1);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[1]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[2]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[3]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);

#ifdef MAME_DEBUG
	if (m_dislayer[4]==0)
#endif
	/* Sprites have variable priority (we kludge this on road levels) */
	{
		if ((m_tc0480scp->pri_reg_r(space, 0) & 0x3) == 3)  /* on road levels kludge sprites up 1 priority */
		{
			static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0};
			draw_sprites(screen, bitmap, cliprect, primasks, 44, -574);
		}
		else
		{
			static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
			draw_sprites(screen, bitmap, cliprect, primasks, 44, -574);
		}
	}

#ifdef MAME_DEBUG
	if (m_dislayer[5]==0)
#endif
	m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, pivlayer[2], 0, 0); /* piv text layer */

	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[4], 0, 0);    /* TC0480SCP text layer */

	/* See if we should draw artificial gun targets */
	/* (not yet implemented...) */

	if (ioport("FAKE")->read() & 0x1)   /* Fake DSW */
	{
		popmessage("Gunsights on");
	}

/* Enable this to see rotation (?) control words */
#if 0
	{
		char buf[80];
		int i;

		for (i = 0; i < 8; i += 1)
		{
			sprintf (buf, "%02x: %04x", i, m_rotate_ctrl[i]);
			ui_draw_text (buf, 0, i*8);
		}
	}
#endif
	return 0;
}
Ejemplo n.º 14
0
static WRITE8_HANDLER( no_key_w )
{
    popmessage("CPU #%d PC %08x: keychip write %04x=%02x\n",cpu_getactivecpu(),activecpu_get_pc(),offset,data);
}
Ejemplo n.º 15
0
uint32_t undrfire_state::screen_update_cbombers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	address_space &space = machine().dummy_space();
	uint8_t layer[5];
	uint8_t scclayer[3];
	uint16_t priority;

#ifdef MAME_DEBUG
	if (machine().input().code_pressed_once (KEYCODE_X))
	{
		m_dislayer[5] ^= 1;
		popmessage("scc text: %01x",m_dislayer[5]);
	}
	if (machine().input().code_pressed_once (KEYCODE_C))
	{
		m_dislayer[0] ^= 1;
		popmessage("bg0: %01x",m_dislayer[0]);
	}

	if (machine().input().code_pressed_once (KEYCODE_V))
	{
		m_dislayer[1] ^= 1;
		popmessage("bg1: %01x",m_dislayer[1]);
	}

	if (machine().input().code_pressed_once (KEYCODE_B))
	{
		m_dislayer[2] ^= 1;
		popmessage("bg2: %01x",m_dislayer[2]);
	}

	if (machine().input().code_pressed_once (KEYCODE_N))
	{
		m_dislayer[3] ^= 1;
		popmessage("bg3: %01x",m_dislayer[3]);
	}

	if (machine().input().code_pressed_once (KEYCODE_M))
	{
		m_dislayer[4] ^= 1;
		popmessage("sprites: %01x",m_dislayer[4]);
	}
#endif

	m_tc0100scn->tilemap_update();
	m_tc0480scp->tilemap_update();

	priority = m_tc0480scp->get_bg_priority();

	layer[0] = (priority & 0xf000) >> 12;   /* tells us which bg layer is bottom */
	layer[1] = (priority & 0x0f00) >>  8;
	layer[2] = (priority & 0x00f0) >>  4;
	layer[3] = (priority & 0x000f) >>  0;   /* tells us which is top */
	layer[4] = 4;   /* text layer always over bg layers */

	scclayer[0] = m_tc0100scn->bottomlayer();
	scclayer[1] = scclayer[0] ^ 1;
	scclayer[2] = 2;

	screen.priority().fill(0, cliprect);
	bitmap.fill(0, cliprect);   /* wrong color? */


/* The "SCC" chip seems to be a 6bpp TC0100SCN. It has a
   bottom layer usually full of bright garish colors that
   vaguely mimic the structure of the layers on top. Seems
   pointless - it's always hidden by other layers. Does it
   serve some blending pupose ? */

	m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, scclayer[0], TILEMAP_DRAW_OPAQUE, 0);
	m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, scclayer[1], 0, 0);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[0]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[0], 0, 1);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[1]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[2]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[3]]==0)
#endif
	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);

#ifdef MAME_DEBUG
	if (m_dislayer[4]==0)
#endif
	/* Sprites have variable priority (we kludge this on road levels) */
	{
		if ((m_tc0480scp->pri_reg_r(space, 0) & 0x3) == 3)  /* on road levels kludge sprites up 1 priority */
		{
			static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0};
			draw_sprites_cbombers(screen, bitmap, cliprect, primasks, 80, -208);
		}
		else
		{
			static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
			draw_sprites_cbombers(screen, bitmap, cliprect, primasks, 80, -208);
		}
	}

#ifdef MAME_DEBUG
	if (m_dislayer[5]==0)
#endif
	m_tc0100scn->tilemap_draw(screen, bitmap, cliprect, scclayer[2], 0, 0); /* TC0620SCC text layer */

	m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[4], 0, 0);    /* TC0480SCP text layer */

/* Enable this to see rotation (?) control words */
#if 0
	{
		char buf[80];
		int i;

		for (i = 0; i < 8; i += 1)
		{
			sprintf (buf, "%02x: %04x", i, m_rotate_ctrl[i]);
			ui_draw_text (buf, 0, i*8);
		}
	}
#endif
	return 0;
}
Ejemplo n.º 16
0
static WRITE16_DEVICE_HANDLER( sslam_snd_w )
{
	if (ACCESSING_BITS_0_7)
	{
		logerror("%s Writing %04x to Sound CPU\n",cpuexec_describe_context(device->machine),data);
		if (data >= 0x40) {
			if (data == 0xfe) {
				/* This should reset the sound MCU and stop audio playback, but here, it */
				/* chops the first coin insert. So let's only stop any playing melodies. */
				sslam_play(device, 1, (0x80 | 0x40));		/* Stop playing the melody */
			}
			else {
				logerror("Unknown command (%02x) sent to the Sound controller\n",data);
				popmessage("Unknown command (%02x) sent to the Sound controller",data);
			}
		}
		else if (data == 0) {
			sslam_bar = 0;		/* Complete any current bars then stop sequencing */
			sslam_melody = 0;
		}
		else {
			sslam_sound = sslam_snd_cmd[data];

			if (sslam_sound == 0xff) {
				popmessage("Unmapped sound command %02x on Bank %02x",data,sslam_snd_bank);
			}
			else if (sslam_sound >= 0x70) {
				/* These vocals are in bank 1, but a bug in the actual MCU doesn't set the bank */
//              if (sslam_snd_bank != 1)
//                  okim6295_set_bank_base(device, (1 * 0x40000));
//              sslam_snd_bank = 1;
				sslam_play(device, 0, sslam_sound);
			}
			else if (sslam_sound >= 0x69) {
				if (sslam_snd_bank != 2)
					okim6295_set_bank_base(device, (2 * 0x40000));
				sslam_snd_bank = 2;
				switch (sslam_sound)
				{
					case 0x69:	sslam_melody = 5; break;
					case 0x6b:	sslam_melody = 6; break;
					case 0x6c:	sslam_melody = 7; break;
					default:	sslam_melody = 0; sslam_bar = 0; break;	/* Invalid */
				}
				sslam_play(device, sslam_melody, sslam_sound);
			}
			else if (sslam_sound >= 0x65) {
				if (sslam_snd_bank != 1)
					okim6295_set_bank_base(device, (1 * 0x40000));
				sslam_snd_bank = 1;
				sslam_melody = 4;
				sslam_play(device, sslam_melody, sslam_sound);
			}
			else if (sslam_sound >= 0x60) {
				if (sslam_snd_bank != 0)
					okim6295_set_bank_base(device, (0 * 0x40000));
				sslam_snd_bank = 0;
				switch (sslam_sound)
				{
					case 0x60:	sslam_melody = 1; break;
					case 0x63:	sslam_melody = 2; break;
					case 0x64:	sslam_melody = 3; break;
					default:	sslam_melody = 0; sslam_bar = 0; break;	/* Invalid */
				}
				sslam_play(device, sslam_melody, sslam_sound);
			}
			else {
				sslam_play(device, 0, sslam_sound);
			}
		}
	}
}
Ejemplo n.º 17
0
void igs009_state::show_out()
{
#ifdef MAME_DEBUG
	popmessage("%02x %02x %02x", m_out[0], m_out[1], m_out[2]);
#endif
}
Ejemplo n.º 18
0
/* gcpinbal.c modified */
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int y_offs )
{
	aquarium_state *state = machine.driver_data<aquarium_state>();
	int offs, chain_pos;
	int x, y, curx, cury;
	UINT8 col, flipx, flipy, chain;
	UINT16 code;

	for (offs = 0; offs < state->m_spriteram_size / 2; offs += 8)
	{
		code = ((state->m_spriteram[offs + 5]) & 0xff) + (((state->m_spriteram[offs + 6]) & 0xff) << 8);
		code &= 0x3fff;

		if (!(state->m_spriteram[offs + 4] &0x80))	/* active sprite ? */
		{
			x = ((state->m_spriteram[offs + 0]) &0xff) + (((state->m_spriteram[offs + 1]) & 0xff) << 8);
			y = ((state->m_spriteram[offs + 2]) &0xff) + (((state->m_spriteram[offs + 3]) & 0xff) << 8);

			/* Treat coords as signed */
			if (x & 0x8000)  x -= 0x10000;
			if (y & 0x8000)  y -= 0x10000;

			col = ((state->m_spriteram[offs + 7]) & 0x0f);
			chain = (state->m_spriteram[offs + 4]) & 0x07;
			flipy = (state->m_spriteram[offs + 4]) & 0x10;
			flipx = (state->m_spriteram[offs + 4]) & 0x20;

			curx = x;
			cury = y;

			if (((state->m_spriteram[offs + 4]) & 0x08) && flipy)
				cury += (chain * 16);

			if (!(((state->m_spriteram[offs + 4]) & 0x08)) && flipx)
				curx += (chain * 16);


			for (chain_pos = chain; chain_pos >= 0; chain_pos--)
			{
				drawgfx_transpen(bitmap, cliprect,machine.gfx[0],
						code,
						col,
						flipx, flipy,
						curx,cury,0);

				/* wrap around y */
				drawgfx_transpen(bitmap, cliprect,machine.gfx[0],
						code,
						col,
						flipx, flipy,
						curx,cury + 256,0);

				code++;

				if ((state->m_spriteram[offs + 4]) &0x08)	/* Y chain */
				{
					if (flipy)
						cury -= 16;
					else
						cury += 16;
				}
				else	/* X chain */
				{
					if (flipx)
						curx -= 16;
					else
						curx += 16;
				}
			}
		}
	}
#if 0
	if (rotate)
	{
		char buf[80];
		sprintf(buf, "sprite rotate offs %04x ?", rotate);
		popmessage(buf);
	}
#endif
}
Ejemplo n.º 19
0
MACHINE_CONFIG_END

WRITE8_MEMBER(maygay1b_state::m1ab_no_oki_w)
{
	popmessage("write to OKI, but no OKI rom");
}
Ejemplo n.º 20
0
void gcpinbal_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
{
	UINT16 *spriteram = m_spriteram;
	int offs, chain_pos;
	int x, y, curx, cury;
	int priority = 0;
	UINT8 col, flipx, flipy, chain;
	UINT16 code;

	/* According to Raine, word in ioc_ram determines sprite/tile priority... */
	priority = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1;

	for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
	{
		code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8);
		code &= 0x3fff;

		if (!(spriteram[offs + 4] &0x80))   /* active sprite ? */
		{
			x = ((spriteram[offs + 0]) & 0xff) + (((spriteram[offs + 1]) & 0xff) << 8);
			y = ((spriteram[offs + 2]) & 0xff) + (((spriteram[offs + 3]) & 0xff) << 8);

			/* Treat coords as signed */
			if (x & 0x8000)  x -= 0x10000;
			if (y & 0x8000)  y -= 0x10000;

			col  = ((spriteram[offs + 7]) & 0x0f) | 0x60;
			chain = (spriteram[offs + 4]) & 0x07;
			flipy = (spriteram[offs + 4]) & 0x10;
			flipx = 0;

			curx = x;
			cury = y;

			if (((spriteram[offs + 4]) & 0x08) && flipy)
				cury += (chain * 16);

			for (chain_pos = chain; chain_pos >= 0; chain_pos--)
			{
				pdrawgfx_transpen(bitmap, cliprect,machine().gfx[0],
						code,
						col,
						flipx, flipy,
						curx,cury,
						machine().priority_bitmap,
						priority ? 0xfc : 0xf0,0);

				code++;

				if ((spriteram[offs + 4]) & 0x08)   /* Y chain */
				{
					if (flipy)  cury -= 16;
					else cury += 16;
				}
				else    /* X chain */
				{
					curx += 16;
				}
			}
		}
	}
#if 0
	if (rotate)
	{
		char buf[80];
		sprintf(buf, "sprite rotate offs %04x ?", rotate);
		popmessage(buf);
	}
#endif
}
Ejemplo n.º 21
0
/* from machine/wrally.c */
DRIVER_INIT( wrally );
WRITE16_HANDLER( OKIM6295_bankswitch_w );
WRITE16_HANDLER( wrally_coin_counter_w );
WRITE16_HANDLER( wrally_coin_lockout_w );



static ADDRESS_MAP_START( wrally_readmem, ADDRESS_SPACE_PROGRAM, 16 )
	AM_RANGE(0x000000, 0x0fffff) AM_READ(MRA16_ROM)			/* ROM */
	AM_RANGE(0x100000, 0x103fff) AM_READ(MRA16_RAM)			/* encrypted Video RAM */
	AM_RANGE(0x200000, 0x203fff) AM_READ(MRA16_RAM)			/* Palette */
	AM_RANGE(0x440000, 0x440fff) AM_READ(MRA16_RAM)			/* Sprite RAM */
	AM_RANGE(0x700000, 0x700001) AM_READ(input_port_0_word_r)/* DSW #1 & #2 */
	AM_RANGE(0x700002, 0x700003) AM_READ(input_port_1_word_r)/* INPUT 1P & 2P, COINSW, STARTSW */
	AM_RANGE(0x700004, 0x700005) AM_READ(input_port_2_word_r)/* Wheel */
	AM_RANGE(0x700008, 0x700009) AM_READ(input_port_3_word_r)/* TESTSW & SERVICESW */
	AM_RANGE(0x70000e, 0x70000f) AM_READ(OKIM6295_status_0_lsb_r)/* OKI6295 status register */
	AM_RANGE(0xfe0000, 0xfeffff) AM_READ(MRA16_RAM)			/* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END

static WRITE16_HANDLER( unknown_w )
{
	popmessage("write %04x to %04x", data, offset*2 + 0x6a);
}
Ejemplo n.º 22
0
UINT32 gcpinbal_state::screen_update_gcpinbal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int i;
	UINT16 tile_sets = 0;
	UINT8 layer[3];

#ifdef MAME_DEBUG
	if (machine().input().code_pressed_once(KEYCODE_V))
	{
		m_dislayer[0] ^= 1;
		popmessage("bg0: %01x", m_dislayer[0]);
	}

	if (machine().input().code_pressed_once(KEYCODE_B))
	{
		m_dislayer[1] ^= 1;
		popmessage("bg1: %01x", m_dislayer[1]);
	}

	if (machine().input().code_pressed_once(KEYCODE_N))
	{
		m_dislayer[2] ^= 1;
		popmessage("fg: %01x", m_dislayer[2]);
	}
#endif

	m_scrollx[0] =  m_ioc_ram[0x14 / 2];
	m_scrolly[0] =  m_ioc_ram[0x16 / 2];
	m_scrollx[1] =  m_ioc_ram[0x18 / 2];
	m_scrolly[1] =  m_ioc_ram[0x1a / 2];
	m_scrollx[2] =  m_ioc_ram[0x1c / 2];
	m_scrolly[2] =  m_ioc_ram[0x1e / 2];

	tile_sets = m_ioc_ram[0x88 / 2];
	m_bg0_gfxset = (tile_sets & 0x400) ? 0x1000 : 0;
	m_bg1_gfxset = (tile_sets & 0x800) ? 0x1000 : 0;

	for (i = 0; i < 3; i++)
	{
		m_tilemap[i]->set_scrollx(0, m_scrollx[i]);
		m_tilemap[i]->set_scrolly(0, m_scrolly[i]);
	}

	machine().priority_bitmap.fill(0, cliprect);
	bitmap.fill(0, cliprect);

	layer[0] = 0;
	layer[1] = 1;
	layer[2] = 2;


#ifdef MAME_DEBUG
	if (m_dislayer[layer[0]] == 0)
#endif
	m_tilemap[layer[0]]->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 1);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[1]] == 0)
#endif
	m_tilemap[layer[1]]->draw(bitmap, cliprect, 0, 2);

#ifdef MAME_DEBUG
	if (m_dislayer[layer[2]] == 0)
#endif
	m_tilemap[layer[2]]->draw(bitmap, cliprect, 0, 4);


	draw_sprites(bitmap, cliprect, 16);

#if 0
	{
//      char buf[80];
		sprintf(buf,"bg0_gfx: %04x bg1_gfx: %04x ", m_bg0_gfxset, m_bg1_gfxset);
		popmessage(buf);
	}
#endif

	return 0;
}
Ejemplo n.º 23
0
void excellent_spr_device::aquarium_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs )
{
	int offs, chain_pos;
	int x, y, curx, cury;
	UINT8 col, flipx, flipy, chain;
	UINT16 code;

	for (offs = 0; offs < 0x1000; offs += 8)
	{
		code = ((m_ram[offs + 5]) & 0xff) + (((m_ram[offs + 6]) & 0xff) << 8);
		code &= 0x3fff;

		if (!(m_ram[offs + 4] &0x80))  /* active sprite ? */
		{
			x = ((m_ram[offs + 0]) &0xff) + (((m_ram[offs + 1]) & 0xff) << 8);
			y = ((m_ram[offs + 2]) &0xff) + (((m_ram[offs + 3]) & 0xff) << 8);

			/* Treat coords as signed */
			if (x & 0x8000)  x -= 0x10000;
			if (y & 0x8000)  y -= 0x10000;

			col = ((m_ram[offs + 7]) & 0x0f);
			chain = (m_ram[offs + 4]) & 0x07;
			flipy = (m_ram[offs + 4]) & 0x10;
			flipx = (m_ram[offs + 4]) & 0x20;

			curx = x;
			cury = y;

			if (((m_ram[offs + 4]) & 0x08) && flipy)
				cury += (chain * 16);

			if (!(((m_ram[offs + 4]) & 0x08)) && flipx)
				curx += (chain * 16);


			for (chain_pos = chain; chain_pos >= 0; chain_pos--)
			{
				gfxdecode->gfx(0)->transpen(bitmap,cliprect,
						code,
						col,
						flipx, flipy,
						curx,cury,0);

				/* wrap around y */
				gfxdecode->gfx(0)->transpen(bitmap,cliprect,
						code,
						col,
						flipx, flipy,
						curx,cury + 256,0);

				code++;

				if ((m_ram[offs + 4]) &0x08)   /* Y chain */
				{
					if (flipy)
						cury -= 16;
					else
						cury += 16;
				}
				else    /* X chain */
				{
					if (flipx)
						curx -= 16;
					else
						curx += 16;
				}
			}
		}
	}

#if 0
	if (rotate)
	{
		char buf[80];
		sprintf(buf, "sprite rotate offs %04x ?", rotate);
		popmessage(buf);
	}
#endif
}
Ejemplo n.º 24
0
static void show_out(cabaret_state *state)
{
#ifdef MAME_DEBUG
	popmessage("%02x %02x %02x", state->m_out[0], state->m_out[1], state->m_out[2]);
#endif
}
Ejemplo n.º 25
0
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
{
	int i, offs;

	for (offs = spriteram_size - 0x20;offs >= 0;offs -= 0x20)
	{
		i = 0;
		while (i < 0x20 && spriteram[offs + i] != 0)
			i += 4;

		while (i > 0)
		{
			i -= 4;

			if (spriteram[offs + i] & 0x80)
			{
				int color = spriteram[offs + i + 2] & 0x0f;
				int sx = spriteram[offs + i + 3];
				int sy = offs / 4 + (spriteram[offs + i] & 0x07);


				switch ((spriteram[offs + i] & 0x18) >> 3)
				{
					case 3:	/* 24x24 */
					{
						int code = ((spriteram[offs + i + 1] & 0xf0) >> 4) + ((gfxbank & 1) << 4);

						drawgfx_transpen(bitmap,cliprect,machine->gfx[3],
								code,
								color,
								0,0,
								sx,sy - 16,0);
						/* wraparound */
						drawgfx_transpen(bitmap,cliprect,machine->gfx[3],
								code,
								color,
								0,0,
								sx - 256,sy - 16,0);
						break;
					}

					case 2:	/* 16x16 */
						if (spriteram[offs + i] & 0x20)	/* zero hour spaceships */
						{
							int code = ((spriteram[offs + i + 1] & 0xf8) >> 3) + ((gfxbank & 1) << 5);
							int bank = (spriteram[offs + i + 1] & 0x02) >> 1;

							drawgfx_transpen(bitmap,cliprect,machine->gfx[4+bank],
									code,
									color,
									0,0,
									sx,sy - 16,0);
						}
						else
						{
							int code = ((spriteram[offs + i + 1] & 0xf0) >> 4) + ((gfxbank & 1) << 4);

							drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
									code,
									color,
									0,0,
									sx,sy - 16,0);
						}
						break;

					case 1:	/* 8x8 */
						drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
								spriteram[offs + i + 1],// + 4 * (spriteram[offs + i + 2] & 0x10),
								color,
								0,0,
								sx,sy - 16,0);
						break;

					case 0:
popmessage("unknown sprite size 0");
						break;
				}
			}
Ejemplo n.º 26
0
static void nbmj8891_gfxdraw(void)
{
	UINT8 *GFX = memory_region(REGION_GFX1);

	int x, y;
	int dx1, dx2, dy1, dy2;
	int startx, starty;
	int sizex, sizey;
	int skipx, skipy;
	int ctrx, ctry;
	UINT8 color, color1, color2;
	int gfxaddr;

	nb1413m3_busyctr = 0;

	startx = blitter_destx + blitter_sizex;
	starty = blitter_desty + blitter_sizey;

	if (blitter_direction_x)
	{
		sizex = blitter_sizex ^ 0xff;
		skipx = 1;
	}
	else
	{
		sizex = blitter_sizex;
		skipx = -1;
	}

	if (blitter_direction_y)
	{
		sizey = blitter_sizey ^ 0xff;
		skipy = 1;
	}
	else
	{
		sizey = blitter_sizey;
		skipy = -1;
	}

	gfxaddr = (nbmj8891_gfxrom << 17) + (blitter_src_addr << 1);

	for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
	{
		for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
		{
			if ((gfxaddr > (memory_region_length(REGION_GFX1) - 1)))
			{
#ifdef MAME_DEBUG
				popmessage("GFXROM ADDRESS OVER!!");
#endif
				gfxaddr &= (memory_region_length(REGION_GFX1) - 1);
			}

			color = GFX[gfxaddr++];

			// for hanamomo
			if ((nb1413m3_type == NB1413M3_HANAMOMO) && ((gfxaddr >= 0x20000) && (gfxaddr < 0x28000)))
			{
				color |= ((color & 0x0f) << 4);
			}

			dx1 = (2 * x + 0) & 0x1ff;
			dx2 = (2 * x + 1) & 0x1ff;

			if (gfxdraw_mode)
			{
				// 2 layer type
				dy1 = y & 0xff;
				dy2 = (y + nbmj8891_scrolly) & 0xff;
			}
			else
			{
				// 1 layer type
				dy1 = (y + nbmj8891_scrolly) & 0xff;
				dy2 = 0;
			}

			if (!nbmj8891_flipscreen)
			{
				dx1 ^= 0x1ff;
				dx2 ^= 0x1ff;
				dy1 ^= 0xff;
				dy2 ^= 0xff;
			}

			if (blitter_direction_x)
			{
				// flip
				color1 = (color & 0x0f) >> 0;
				color2 = (color & 0xf0) >> 4;
			}
			else
			{
				// normal
				color1 = (color & 0xf0) >> 4;
				color2 = (color & 0x0f) >> 0;
			}

			color1 = nbmj8891_clut[((nbmj8891_clutsel & 0x7f) << 4) + color1];
			color2 = nbmj8891_clut[((nbmj8891_clutsel & 0x7f) << 4) + color2];

			if ((!gfxdraw_mode) || (nbmj8891_vram & 0x01))
			{
				// layer 1
				if (color1 != 0xff)
				{
					nbmj8891_videoram0[(dy1 * Machine->screen[0].width) + dx1] = color1;
					update_pixel0(dx1, dy1);
				}
				if (color2 != 0xff)
				{
					nbmj8891_videoram0[(dy1 * Machine->screen[0].width) + dx2] = color2;
					update_pixel0(dx2, dy1);
				}
			}
			if (gfxdraw_mode && (nbmj8891_vram & 0x02))
			{
				// layer 2
				if (nbmj8891_vram & 0x08)
				{
					// transparent enable
					if (color1 != 0xff)
					{
						nbmj8891_videoram1[(dy2 * Machine->screen[0].width) + dx1] = color1;
						update_pixel1(dx1, dy2);
					}
					if (color2 != 0xff)
					{
						nbmj8891_videoram1[(dy2 * Machine->screen[0].width) + dx2] = color2;
						update_pixel1(dx2, dy2);
					}
				}
				else
				{
					// transparent disable
					nbmj8891_videoram1[(dy2 * Machine->screen[0].width) + dx1] = color1;
					update_pixel1(dx1, dy2);
					nbmj8891_videoram1[(dy2 * Machine->screen[0].width) + dx2] = color2;
					update_pixel1(dx2, dy2);
				}
			}

			nb1413m3_busyctr++;
		}
	}
Ejemplo n.º 27
0
void nbmj8991_state::nbmj8991_gfxdraw()
{
	UINT8 *GFX = memregion("gfx1")->base();
	int width = m_screen->width();

	int x, y;
	int dx1, dx2, dy;
	int startx, starty;
	int sizex, sizey;
	int skipx, skipy;
	int ctrx, ctry;
	UINT8 color, color1, color2;
	int gfxaddr, gfxlen;

	m_nb1413m3->m_busyctr = 0;

	if (m_blitter_direction_x)
	{
		startx = m_blitter_destx;
		sizex = m_blitter_sizex ^ 0xff;
		skipx = 1;
	}
	else
	{
		startx = m_blitter_destx + m_blitter_sizex;
		sizex = m_blitter_sizex;
		skipx = -1;
	}

	if (m_blitter_direction_y)
	{
		starty = m_blitter_desty;
		sizey = m_blitter_sizey ^ 0xff;
		skipy = 1;
	}
	else
	{
		starty = m_blitter_desty + m_blitter_sizey;
		sizey = m_blitter_sizey;
		skipy = -1;
	}

	gfxlen = memregion("gfx1")->bytes();
	gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);

	for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
	{
		for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
		{
			if ((gfxaddr > (gfxlen - 1)))
			{
#ifdef MAME_DEBUG
				popmessage("GFXROM ADDRESS OVER!!");
#endif
				gfxaddr &= (gfxlen - 1);
			}

			color = GFX[gfxaddr++];

			dx1 = (2 * x + 0) & 0x3ff;
			dx2 = (2 * x + 1) & 0x3ff;
			dy = y & 0x1ff;

			if (!m_flipscreen)
			{
				dx1 ^= 0x1ff;
				dx2 ^= 0x1ff;
				dy ^= 0x1ff;
			}

			if (m_blitter_direction_x)
			{
				// flip
				color1 = (color & 0x0f) >> 0;
				color2 = (color & 0xf0) >> 4;
			}
			else
			{
				// normal
				color1 = (color & 0xf0) >> 4;
				color2 = (color & 0x0f) >> 0;
			}

			color1 = m_clut[((m_clutsel & 0x7f) * 0x10) + color1];
			color2 = m_clut[((m_clutsel & 0x7f) * 0x10) + color2];

			if (color1 != 0xff)
			{
				m_videoram[(dy * width) + dx1] = color1;
				update_pixel(dx1, dy);
			}
			if (color2 != 0xff)
			{
				m_videoram[(dy * width) + dx2] = color2;
				update_pixel(dx2, dy);
			}

			m_nb1413m3->m_busyctr++;
		}
	}
Ejemplo n.º 28
0
static VIDEO_UPDATE( timetrv )
{
	popmessage("%s%s",led_vram_lo,led_vram_hi);
	return 0;
}
Ejemplo n.º 29
0
void hng64_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
	gfx_element *gfx;
	UINT32 *source = m_spriteram;
	UINT32 *finish = m_spriteram + 0xc000/4;

	// global offsets in sprite regs
	int spriteoffsx = (m_spriteregs[1]>>0)&0xffff;
	int spriteoffsy = (m_spriteregs[1]>>16)&0xffff;

#if 0
	for (int iii = 0; iii < 0x0f; iii++)
		osd_printf_debug("%.8x ", m_videoregs[iii]);
	osd_printf_debug("\n");
#endif

	while( source<finish )
	{
		int tileno,chainx,chainy,xflip;
		int pal,xinc,yinc,yflip;
		UINT16 xpos, ypos;
		int xdrw,ydrw;
		int chaini;
		int zbuf;
		UINT32 zoomx,zoomy;
		float foomX, foomY;
		int blend;
		int disable;



		ypos = (source[0]&0xffff0000)>>16;
		xpos = (source[0]&0x0000ffff)>>0;
		xpos += (spriteoffsx);
		ypos += (spriteoffsy);

		tileno= (source[4]&0x0007ffff);
		blend=  (source[4]&0x00800000);
		yflip=  (source[4]&0x01000000)>>24;
		xflip=  (source[4]&0x02000000)>>25;
		disable=(source[4]&0x04000000)>>26; // ss64 rankings?

		pal =(source[3]&0x00ff0000)>>16;

		chainy=(source[2]&0x0000000f);
		chainx=(source[2]&0x000000f0)>>4;
		chaini=(source[2]&0x00000100);
		zbuf = (source[2]&0x07ff0000)>>16; //?

		zoomy = (source[1]&0xffff0000)>>16;
		zoomx = (source[1]&0x0000ffff)>>0;

		#if 1
		if(zbuf == 0x7ff) //temp kludge to avoid garbage on screen
		{
			source+=8;
			continue;
		}
		#endif
		if(disable)
		{
			source+=8;
			continue;
		}

#if 0
		if (!(source[4] == 0x00000000 || source[4] == 0x000000aa))
			osd_printf_debug("unknown : %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x \n", source[0], source[1], source[2], source[3],
				source[4], source[5], source[6], source[7]);
#endif

		/* Calculate the zoom */
		{
			int zoom_factor;

			/* FIXME: regular zoom mode has precision bugs, can be easily seen in Samurai Shodown 64 intro */
			zoom_factor = (m_spriteregs[0] & 0x08000000) ? 0x1000 : 0x100;
			if(!zoomx) zoomx=zoom_factor;
			if(!zoomy) zoomy=zoom_factor;

			/* First, prevent any possible divide by zero errors */
			foomX = (float)(zoom_factor) / (float)zoomx;
			foomY = (float)(zoom_factor) / (float)zoomy;

			zoomx = ((int)foomX) << 16;
			zoomy = ((int)foomY) << 16;

			zoomx += (int)((foomX - floor(foomX)) * (float)0x10000);
			zoomy += (int)((foomY - floor(foomY)) * (float)0x10000);
		}

		if (m_spriteregs[0] & 0x00800000) //bpp switch
		{
			gfx= m_gfxdecode->gfx(4);
		}
		else
		{
			gfx= m_gfxdecode->gfx(5);
			tileno>>=1;
			pal&=0xf;
		}

		// Accommodate for chaining and flipping
		if(xflip)
		{
			xinc=-(int)(16.0f*foomX);
			xpos-=xinc*chainx;
		}
		else
		{
			xinc=(int)(16.0f*foomX);
		}

		if(yflip)
		{
			yinc=-(int)(16.0f*foomY);
			ypos-=yinc*chainy;
		}
		else
		{
			yinc=(int)(16.0f*foomY);
		}

#if 0
		if (((source[2) & 0xffff0000) >> 16) == 0x0001)
		{
			popmessage("T %.8x %.8x %.8x %.8x %.8x", source[0], source[1], source[2], source[3], source[4]);
			//popmessage("T %.8x %.8x %.8x %.8x %.8x", source[0], source[1], source[2], source[3], source[4]);
		}
#endif

		for(ydrw=0;ydrw<=chainy;ydrw++)
		{
			for(xdrw=0;xdrw<=chainx;xdrw++)
			{
				INT16 drawx = xpos+(xinc*xdrw);
				INT16 drawy = ypos+(yinc*ydrw);

				// 0x3ff (0x200 sign bit) based on sams64_2 char select
				drawx &= 0x3ff;
				drawy &= 0x3ff;

				if (drawx&0x0200)drawx-=0x400;
				if (drawy&0x0200)drawy-=0x400;

				if (!chaini)
				{
					if (!blend) gfx->prio_zoom_transpen(bitmap,cliprect,tileno,pal,xflip,yflip,drawx,drawy,zoomx,zoomy/*0x10000*/,screen.priority(), 0,0);
					else gfx->prio_zoom_transpen_additive(bitmap,cliprect,tileno,pal,xflip,yflip,drawx,drawy,zoomx,zoomy/*0x10000*/,screen.priority(), 0,0);
					tileno++;
				}
				else // inline chain mode, used by ss64
				{
					tileno=(source[4]&0x0007ffff);
					pal =(source[3]&0x00ff0000)>>16;

					if (m_spriteregs[0] & 0x00800000) //bpp switch
					{
						gfx= m_gfxdecode->gfx(4);
					}
					else
					{
						gfx= m_gfxdecode->gfx(5);
						tileno>>=1;
						pal&=0xf;
					}

					if (!blend) gfx->prio_zoom_transpen(bitmap,cliprect,tileno,pal,xflip,yflip,drawx,drawy,zoomx,zoomy/*0x10000*/,screen.priority(), 0,0);
					else gfx->prio_zoom_transpen_additive(bitmap,cliprect,tileno,pal,xflip,yflip,drawx,drawy,zoomx,zoomy/*0x10000*/,screen.priority(), 0,0);
					source +=8;
				}

			}
		}

		if (!chaini) source +=8;
	}
}
Ejemplo n.º 30
0
static WRITE8_HANDLER( namcos1_3dcs_w )
{
    if (offset & 1)	popmessage("LEFT");
    else			popmessage("RIGHT");
}