示例#1
0
void TMS9928APostLoad()
{
	for (int i = 0; i < 8; i++)
		change_register(i, tms.Regs[i]);

	if (tms.INTCallback) tms.INTCallback(tms.INT);
}
示例#2
0
void TMS9928A_post_load (running_machine &machine) {
	int i;

	/* all registers need to be re-written, so tables are recalculated */
	for (i=0;i<8;i++)
		change_register (machine, i, tms.Regs[i]);

	/* make sure the interrupt request is set properly */
	if (tms.INTCallback) tms.INTCallback (machine, tms.INT);
}
示例#3
0
unsigned char TMS9928AReadRegs()
{
	int b = tms.StatusReg;
	tms.StatusReg = 0x1f;
	if (tms.INT) {
		tms.INT = 0;
		if (tms.INTCallback) tms.INTCallback (tms.INT);
	}
	tms.latch = 0;
	return b;
}
示例#4
0
void TMS9928A_post_load (void) {
	int i;

	/* mark the screen as dirty */
	_TMS9928A_set_dirty (1);

	/* all registers need to be re-written, so tables are recalculated */
	for (i=0;i<8;i++)
		_TMS9928A_change_register (i, tms.Regs[i]);

	/* make sure the back ground colour is reset */
	tms.BackColour = -1;

	/* make sure the interrupt request is set properly */
	if (tms.INTCallback) tms.INTCallback (tms.INT);
}
示例#5
0
int TMS9928A_interrupt(running_machine &machine) {
    int b;

    /* when skipping frames, calculate sprite collision */
    if (machine.video().skip_this_frame()) {
		if (TMS_SPRITES_ENABLED) {
			draw_sprites (machine.primary_screen, NULL, NULL);
		}
    }

    tms.StatusReg |= 0x80;
    b = (tms.Regs[1] & 0x20) != 0;
    if (b != tms.INT) {
        tms.INT = b;
        if (tms.INTCallback) tms.INTCallback (machine, tms.INT);
    }

    return b;
}
示例#6
0
static void change_register(int reg, unsigned char val)
{
	static const unsigned char Mask[8] = { 0x03, 0xfb, 0x0f, 0xff, 0x07, 0x7f, 0x07, 0xff };

	val &= Mask[reg];

	if(tms.Regs[reg] != val)
	{
		tms.Regs[reg] = val;

		switch (reg)
		{
			case 0:
			{
				if (val & 2) {
					tms.colour = ((tms.Regs[3] & 0x80) * 64) & (tms.vramsize - 1);
					tms.colourmask = (tms.Regs[3] & 0x7f) * 8 | 7;
					tms.pattern = ((tms.Regs[4] & 4) * 2048) & (tms.vramsize - 1);
					tms.patternmask = (tms.Regs[4] & 3) * 256 | (tms.colourmask & 255);

				} else {
					tms.colour = (tms.Regs[3] * 64) & (tms.vramsize - 1);
					tms.pattern = (tms.Regs[4] * 2048) & (tms.vramsize - 1);
				}
			}
			break;

			case 1:
			{
					int b = (val & 0x20) && (tms.StatusReg & 0x80);
					if (b != tms.INT) {
						tms.INT = b;
						if (tms.INTCallback) tms.INTCallback (tms.INT);
					}
			}
			break;

			case 2:
				tms.nametbl = (val * 1024) & (tms.vramsize - 1);
								
			break;

			case 3:
			{
				if (tms.Regs[0] & 2) {
					tms.colour = ((val & 0x80) * 64) & (tms.vramsize - 1);
					tms.colourmask = (val & 0x7f) * 8 | 7;
				} else {
					tms.colour = (val * 64) & (tms.vramsize - 1);
				}
				tms.patternmask = (tms.Regs[4] & 3) * 256 | (tms.colourmask & 255);
			}
			break;

			case 4:
			{
				if (tms.Regs[0] & 2) {
					tms.pattern = ((val & 4) * 2048) & (tms.vramsize - 1);
					tms.patternmask = (val & 3) * 256 | 255;
				} else {
					tms.pattern = (val * 2048) & (tms.vramsize - 1);
				}
			}
			break;

			case 5:
				tms.spriteattribute = (val * 128) & (tms.vramsize - 1);
			break;

			case 6:
				tms.spritepattern = (val * 2048) & (tms.vramsize - 1);
			break;

			case 7:
				/* The backdrop is updated at TMS9928A_refresh() */
			break;
		}
	}
}
示例#7
0
static void change_register (running_machine &machine, int reg, UINT8 val) {
    static const UINT8 Mask[8] =
        { 0x03, 0xfb, 0x0f, 0xff, 0x07, 0x7f, 0x07, 0xff };
    static const char *const modes[] = {
        "Mode 0 (GRAPHIC 1)", "Mode 1 (TEXT 1)", "Mode 2 (GRAPHIC 2)",
        "Mode 1+2 (TEXT 1 variation)", "Mode 3 (MULTICOLOR)",
        "Mode 1+3 (BOGUS)", "Mode 2+3 (MULTICOLOR variation)",
        "Mode 1+2+3 (BOGUS)"
    };
    UINT8 b;

    val &= Mask[reg];
    tms.Regs[reg] = val;

    logerror("TMS9928A: Reg %d = %02xh\n", reg, (int)val);
    switch (reg) {
    case 0:
		/* re-calculate masks and pattern generator & colour */
		if (val & 2) {
			tms.colour = ((tms.Regs[3] & 0x80) * 64) & (tms.vramsize - 1);
			tms.colourmask = (tms.Regs[3] & 0x7f) * 8 | 7;
			tms.pattern = ((tms.Regs[4] & 4) * 2048) & (tms.vramsize - 1);
			tms.patternmask = (tms.Regs[4] & 3) * 256 |
				(tms.colourmask & 255);
		} else {
			tms.colour = (tms.Regs[3] * 64) & (tms.vramsize - 1);
			tms.pattern = (tms.Regs[4] * 2048) & (tms.vramsize - 1);
		}
        logerror("TMS9928A: %s\n", modes[TMS_MODE]);
        break;
    case 1:
        /* check for changes in the INT line */
        b = (val & 0x20) && (tms.StatusReg & 0x80) ;
        if (b != tms.INT) {
            tms.INT = b;
            if (tms.INTCallback) tms.INTCallback (machine, tms.INT);
        }
        logerror("TMS9928A: %s\n", modes[TMS_MODE]);
        break;
    case 2:
        tms.nametbl = (val * 1024) & (tms.vramsize - 1);
        break;
    case 3:
        if (tms.Regs[0] & 2) {
            tms.colour = ((val & 0x80) * 64) & (tms.vramsize - 1);
            tms.colourmask = (val & 0x7f) * 8 | 7;
        } else {
            tms.colour = (val * 64) & (tms.vramsize - 1);
        }
		tms.patternmask = (tms.Regs[4] & 3) * 256 | (tms.colourmask & 255);
        break;
    case 4:
        if (tms.Regs[0] & 2) {
            tms.pattern = ((val & 4) * 2048) & (tms.vramsize - 1);
            tms.patternmask = (val & 3) * 256 | 255;
        } else {
            tms.pattern = (val * 2048) & (tms.vramsize - 1);
        }
        break;
    case 5:
        tms.spriteattribute = (val * 128) & (tms.vramsize - 1);
        break;
    case 6:
        tms.spritepattern = (val * 2048) & (tms.vramsize - 1);
        break;
    case 7:
        /* The backdrop is updated at TMS9928A_refresh() */
        break;
    }
}