Пример #1
0
// LRI $D, #I
// 0000 0000 100d dddd
// iiii iiii iiii iiii
// Load immediate value I to register $D.
//
// DSPSpy discovery: This, and possibly other instructions that load a
// register, has a different behaviour in S40 mode if loaded to AC0.M: The
// value gets sign extended to the whole accumulator! This does not happen in
// S16 mode.
void lri(const UDSPInstruction opc)
{
	u8 reg  = opc & DSP_REG_MASK;
	u16 imm = dsp_fetch_code();
	dsp_op_write_reg(reg, imm);
	dsp_conditional_extend_accum(reg);
}
Пример #2
0
void Step()
{
    DSPCore_CheckExceptions();

    g_dsp.step_counter++;

#if PROFILE
    g_dsp.err_pc = g_dsp.pc;

    ProfilerAddDelta(g_dsp.err_pc, 1);
    if (g_dsp.step_counter == 1)
    {
        ProfilerInit();
    }

    if ((g_dsp.step_counter & 0xFFFFF) == 0)
    {
        ProfilerDump(g_dsp.step_counter);
    }
#endif

    u16 opc = dsp_fetch_code();
    ExecuteInstruction(UDSPInstruction(opc));

    if (DSPAnalyzer::code_flags[g_dsp.pc - 1] & DSPAnalyzer::CODE_LOOP_END)
        HandleLoop();
}
Пример #3
0
// LR $D, @M
// 0000 0000 110d dddd
// mmmm mmmm mmmm mmmm
// Move value from data memory pointed by address M to register $D.
void lr(const UDSPInstruction opc)
{
	u8 reg = opc & DSP_REG_MASK;
	u16 addr = dsp_fetch_code();
	u16 val = dsp_dmem_read(addr);
	dsp_op_write_reg(reg, val);
	dsp_conditional_extend_accum(reg);
}
Пример #4
0
// Generic jmp implementation
// Jcc addressA
// 0000 0010 1001 cccc
// aaaa aaaa aaaa aaaa
// Jump to addressA if condition cc has been met. Set program counter to
// address represented by value that follows this "jmp" instruction.
void jcc(const UDSPInstruction opc)
{
	u16 dest = dsp_fetch_code();
	if (CheckCondition(opc & 0xf))
	{
		g_dsp.pc = dest;
	}
}
Пример #5
0
// SR @M, $S
// 0000 0000 111s ssss
// mmmm mmmm mmmm mmmm
// Store value from register $S to a memory pointed by address M.
void sr(const UDSPInstruction opc)
{
	u8 reg = opc & DSP_REG_MASK;
	u16 addr = dsp_fetch_code();

	if (reg >= DSP_REG_ACM0)
		dsp_dmem_write(addr, dsp_op_read_reg_and_saturate(reg - DSP_REG_ACM0));
	else
		dsp_dmem_write(addr, dsp_op_read_reg(reg));
}
Пример #6
0
// SI @M, #I
// 0001 0110 mmmm mmmm
// iiii iiii iiii iiii
// Store 16-bit immediate value I to a memory location pointed by address
// M (M is 8-bit value sign extended).
void si(const UDSPInstruction opc)
{
	u16 addr = (s8)opc;
	u16 imm = dsp_fetch_code();
	dsp_dmem_write(addr, imm);
}