Ejemplo n.º 1
0
static void TMS9928A_start (running_machine *machine, const TMS9928a_interface *intf)
{
    assert_always(((intf->vram == 0x1000) || (intf->vram == 0x2000) || (intf->vram == 0x4000)), "4, 8 or 16 kB vram please");

    tms.model = intf->model;

	tms.top_border = TMS_50HZ ? TOP_BORDER_50HZ : TOP_BORDER_60HZ;
	tms.bottom_border = TMS_50HZ ? BOTTOM_BORDER_50HZ : BOTTOM_BORDER_60HZ;

	tms.INTCallback = intf->int_callback;

	/* determine the visible area */
	tms.visarea.min_x = LEFT_BORDER - MIN(intf->borderx, LEFT_BORDER);
	tms.visarea.max_x = LEFT_BORDER + 32*8 - 1 + MIN(intf->borderx, RIGHT_BORDER);
	tms.visarea.min_y = tms.top_border - MIN(intf->bordery, tms.top_border);
	tms.visarea.max_y = tms.top_border + 24*8 - 1 + MIN(intf->bordery, tms.bottom_border);

	/* configure the screen if we weren't overridden */
	if (video_screen_get_width(machine->primary_screen) == LEFT_BORDER+32*8+RIGHT_BORDER &&
	    video_screen_get_height(machine->primary_screen) == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ)
		video_screen_configure(machine->primary_screen, LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, &tms.visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds);

    /* Video RAM */
    tms.vramsize = intf->vram;
    tms.vMem = auto_alloc_array_clear(machine, UINT8, intf->vram);

    /* Sprite back buffer */
    tms.dBackMem = auto_alloc_array(machine, UINT8, IMAGE_SIZE);

    /* back bitmap */
    tms.tmpbmp = auto_bitmap_alloc (machine, 256, 192, video_screen_get_format(machine->primary_screen));

    TMS9928A_reset ();
    tms.LimitSprites = 1;

	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[0]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[1]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[2]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[3]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[4]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[5]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[6]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[7]);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.StatusReg);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.ReadAhead);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.FirstByte);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.latch);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.Addr);
	state_save_register_item(machine, "tms9928a", NULL, 0, tms.INT);
	state_save_register_item_pointer(machine, "tms9928a", NULL, 0, tms.vMem, intf->vram);
}
Ejemplo n.º 2
0
static MACHINE_RESET( forte2 )
{
	TMS9928A_reset();
}
Ejemplo n.º 3
0
static int TMS9928A_start (const TMS9928a_interface *intf)
{
    /* 4, 8 or 16 kB vram please */
    if (! ((intf->vram == 0x1000) || (intf->vram == 0x2000) || (intf->vram == 0x4000)) )
        return 1;

    tms.model = intf->model;

	tms.top_border = TMS_50HZ ? TOP_BORDER_50HZ : TOP_BORDER_60HZ;
	tms.bottom_border = TMS_50HZ ? BOTTOM_BORDER_50HZ : BOTTOM_BORDER_60HZ;

	tms.INTCallback = intf->int_callback;

	/* determine the visible area */
	tms.visarea.min_x = LEFT_BORDER - MIN(intf->borderx, LEFT_BORDER);
	tms.visarea.max_x = LEFT_BORDER + 32*8 - 1 + MIN(intf->borderx, RIGHT_BORDER);
	tms.visarea.min_y = tms.top_border - MIN(intf->bordery, tms.top_border);
	tms.visarea.max_y = tms.top_border + 24*8 - 1 + MIN(intf->bordery, tms.bottom_border);

	/* configure the screen if we weren't overridden */
	if (Machine->screen[0].width == LEFT_BORDER+32*8+RIGHT_BORDER && Machine->screen[0].height == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ)
		video_screen_configure(0, LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, &tms.visarea, Machine->screen[0].refresh);

    /* Video RAM */
    tms.vramsize = intf->vram;
    tms.vMem = (UINT8*) auto_malloc (intf->vram);
    memset (tms.vMem, 0, intf->vram);

    /* Sprite back buffer */
    tms.dBackMem = (UINT8*)auto_malloc (IMAGE_SIZE);

    /* dirty buffers */
    tms.DirtyName = (char*)auto_malloc (MAX_DIRTY_NAME);

    tms.DirtyPattern = (char*)auto_malloc (MAX_DIRTY_PATTERN);

    tms.DirtyColour = (char*)auto_malloc (MAX_DIRTY_COLOUR);

    /* back bitmap */
    tms.tmpbmp = auto_bitmap_alloc (256, 192);

    TMS9928A_reset ();
    tms.LimitSprites = 1;

	state_save_register_item("tms9928a", 0, tms.Regs[0]);
	state_save_register_item("tms9928a", 0, tms.Regs[1]);
	state_save_register_item("tms9928a", 0, tms.Regs[2]);
	state_save_register_item("tms9928a", 0, tms.Regs[3]);
	state_save_register_item("tms9928a", 0, tms.Regs[4]);
	state_save_register_item("tms9928a", 0, tms.Regs[5]);
	state_save_register_item("tms9928a", 0, tms.Regs[6]);
	state_save_register_item("tms9928a", 0, tms.Regs[7]);
	state_save_register_item("tms9928a", 0, tms.StatusReg);
	state_save_register_item("tms9928a", 0, tms.ReadAhead);
	state_save_register_item("tms9928a", 0, tms.FirstByte);
	state_save_register_item("tms9928a", 0, tms.latch);
	state_save_register_item("tms9928a", 0, tms.Addr);
	state_save_register_item("tms9928a", 0, tms.INT);
	state_save_register_item_pointer("tms9928a", 0, tms.vMem, intf->vram);

    return 0;
}
Ejemplo n.º 4
0
void m5_state::machine_reset()
{
	TMS9928A_reset();
}
Ejemplo n.º 5
0
static int TMS9928A_start (const TMS9928a_interface *intf) {
    /* 4, 8 or 16 kB vram please */
    if (! ((intf->vram == 0x1000) || (intf->vram == 0x2000) || (intf->vram == 0x4000)) )
        return 1;

    tms.model = intf->model;

	tms.top_border = TMS_50HZ ? TOP_BORDER_50HZ : TOP_BORDER_60HZ;
	tms.bottom_border = TMS_50HZ ? BOTTOM_BORDER_50HZ : BOTTOM_BORDER_60HZ;

	tms.INTCallback = intf->int_callback;

    /* Video RAM */
    tms.vramsize = intf->vram;
    tms.vMem = (UINT8*) auto_malloc (intf->vram);
    if (!tms.vMem)
		return 1;
    memset (tms.vMem, 0, intf->vram);

    /* Sprite back buffer */
    tms.dBackMem = (UINT8*)auto_malloc (IMAGE_SIZE);
    if (!tms.dBackMem)
        return 1;

    /* dirty buffers */
    tms.DirtyName = (char*)auto_malloc (MAX_DIRTY_NAME);
    if (!tms.DirtyName)
        return 1;

    tms.DirtyPattern = (char*)auto_malloc (MAX_DIRTY_PATTERN);
    if (!tms.DirtyPattern)
        return 1;

    tms.DirtyColour = (char*)auto_malloc (MAX_DIRTY_COLOUR);
    if (!tms.DirtyColour)
        return 1;

    /* back bitmap */
    tms.tmpbmp = auto_bitmap_alloc (256, 192);
    if (!tms.tmpbmp)
        return 1;

    TMS9928A_reset ();
    tms.LimitSprites = 1;

	state_save_register_UINT8 ("tms9928a", 0, "R0", &tms.Regs[0], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R1", &tms.Regs[1], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R2", &tms.Regs[2], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R3", &tms.Regs[3], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R4", &tms.Regs[4], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R5", &tms.Regs[5], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R6", &tms.Regs[6], 1);
	state_save_register_UINT8 ("tms9928a", 0, "R7", &tms.Regs[7], 1);
	state_save_register_UINT8 ("tms9928a", 0, "S", &tms.StatusReg, 1);
	state_save_register_UINT8 ("tms9928a", 0, "read_ahead", &tms.ReadAhead, 1);
	state_save_register_UINT8 ("tms9928a", 0, "first_byte", &tms.FirstByte, 1);
	state_save_register_UINT8 ("tms9928a", 0, "latch", &tms.latch, 1);
	state_save_register_UINT16 ("tms9928a", 0, "vram_latch", (UINT16*)&tms.Addr, 1);
	state_save_register_UINT8 ("tms9928a", 0, "interrupt_line", &tms.INT, 1);
	state_save_register_UINT8 ("tms9928a", 0, "VRAM", tms.vMem, intf->vram);

    return 0;
}
Ejemplo n.º 6
0
int TMS9928A_start(int which, int model, unsigned int vram) {
	/* 4 or 16 kB vram please */
	if (! ((vram == 0x1000) || (vram == 0x4000) || (vram == 0x2000)) )
		return 1;

	tms[which].model = model;

	/* Video RAM */
	tms[which].vramsize = vram;
	tms[which].vMem = (UINT8*) malloc (vram);
	if (!tms[which].vMem) return (1);
	memset (tms[which].vMem, 0, vram);

	/* Sprite back buffer */
	tms[which].dBackMem = (UINT8*)malloc (IMAGE_SIZE);
	if (!tms[which].dBackMem) {
		free (tms[which].vMem);
		return 1;
	}

	/* dirty buffers */
	tms[which].DirtyName = (char*)malloc (MAX_DIRTY_NAME);
	if (!tms[which].DirtyName) {
		free (tms[which].vMem);
		free (tms[which].dBackMem);
		return 1;
	}

	tms[which].DirtyPattern = (char*)malloc (MAX_DIRTY_PATTERN);
	if (!tms[which].DirtyPattern) {
		free (tms[which].vMem);
		free (tms[which].DirtyName);
		free (tms[which].dBackMem);
		return 1;
	}

	tms[which].DirtyColour = (char*)malloc (MAX_DIRTY_COLOUR);
	if (!tms[which].DirtyColour) {
		free (tms[which].vMem);
		free (tms[which].DirtyName);
		free (tms[which].DirtyPattern);
		free (tms[which].dBackMem);
		return 1;
	}

	/* back bitmap */
	tms[which].tmpbmp = bitmap_alloc (256, 192);
	if (!tms[which].tmpbmp) {
		free (tms[which].vMem);
		free (tms[which].dBackMem);
		free (tms[which].DirtyName);
		free (tms[which].DirtyPattern);
		free (tms[which].DirtyColour);
		return 1;
	}

	/* sprite bitmap */
	tms[which].tmpsbmp = bitmap_alloc (256, 192);
	if (!tms[which].tmpsbmp) {
		free (tms[which].vMem);
		free (tms[which].dBackMem);
		free (tms[which].DirtyName);
		free (tms[which].DirtyPattern);
		free (tms[which].DirtyColour);
		return 1;
	}

	TMS9928A_reset (which);
	tms[which].LimitSprites = 1;

	state_save_register_UINT8 ("tms9928a", which, "R0", &tms[which].Regs[0], 1);
	state_save_register_UINT8 ("tms9928a", which, "R1", &tms[which].Regs[1], 1);
	state_save_register_UINT8 ("tms9928a", which, "R2", &tms[which].Regs[2], 1);
	state_save_register_UINT8 ("tms9928a", which, "R3", &tms[which].Regs[3], 1);
	state_save_register_UINT8 ("tms9928a", which, "R4", &tms[which].Regs[4], 1);
	state_save_register_UINT8 ("tms9928a", which, "R5", &tms[which].Regs[5], 1);
	state_save_register_UINT8 ("tms9928a", which, "R6", &tms[which].Regs[6], 1);
	state_save_register_UINT8 ("tms9928a", which, "R7", &tms[which].Regs[7], 1);
	state_save_register_UINT8 ("tms9928a", which, "S", &tms[which].StatusReg, 1);
	state_save_register_UINT8 ("tms9928a", which, "read_ahead", &tms[which].ReadAhead, 1);
	state_save_register_UINT8 ("tms9928a", which, "first_byte", &tms[which].FirstByte, 1);
	state_save_register_UINT8 ("tms9928a", which, "latch", &tms[which].latch, 1);
	state_save_register_UINT16 ("tms9928a", which, "vram_latch", (UINT16*)&tms[which].Addr, 1);
	state_save_register_UINT8 ("tms9928a", which, "interrupt_line", &tms[which].INT, 1);
	state_save_register_UINT8 ("tms9928a", which, "VRAM", tms[which].vMem, vram);
	return 0;
}