-//////////////////////////////////////////////////////////////////////////////
//
-//////////////////////////////////////////////////////////////////////////////
+// DSP core
//
+// by cal2
+// GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
+// Cleanups by James L. Hammons
//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
-#include "include/dsp.h"
+#include "dsp.h"
#define CINT0FLAG 0x00200
#define CINT1FLAG 0x00400
static uint16 *mirror_table;
static uint8 *dsp_ram_8;
-
static uint32 dsp_pc;
static uint32 dsp_acc;
static uint32 dsp_remain;
uint8 *dsp_branch_condition_table=0;
#define branch_condition(x) dsp_branch_condition_table[(x) + ((jaguar_flags & 7) << 5)]
-static uint32 dsp_in_exec=0;
-static uint32 dsp_releaseTimeSlice_flag=0;
+static uint32 dsp_in_exec = 0;
+static uint32 dsp_releaseTimeSlice_flag = 0;
+
+FILE * dsp_fp;
-FILE *dsp_fp;
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
void dsp_reset_stats(void)
{
- for (uint32 i=0;i<64;i++)
- dsp_opcode_use[i]=0;
+ for (uint32 i=0; i<64; i++)
+ dsp_opcode_use[i] = 0;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
void dsp_releaseTimeslice(void)
{
- dsp_releaseTimeSlice_flag=1;
+ dsp_releaseTimeSlice_flag = 1;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
void dsp_build_branch_condition_table(void)
{
int i,j;
}
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
unsigned dsp_byte_read(unsigned int offset)
{
// battlemorph
}
return(jaguar_byte_read(offset));
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
unsigned dsp_word_read(unsigned int offset)
{
offset&=0xFFFFFFFE;
}
return(jaguar_word_read(offset));
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
unsigned dsp_long_read(unsigned int offset)
{
offset&=0xFFFFFFFC;
data|=jaguar_word_read(offset+2);
return(data);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_byte_write(unsigned offset, unsigned data)
{
if ((offset >= dsp_work_ram_base) && (offset < dsp_work_ram_base+0x2000))
// fprintf(log_get(),"dsp: writing %.2x at 0x%.8x\n",data,offset);
jaguar_byte_write(offset, data);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_word_write(unsigned offset, unsigned data)
{
offset &= 0xFFFFFFFE;
}
jaguar_word_write(offset, data);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_long_write(unsigned offset, unsigned data)
{
offset &= 0xFFFFFFFC;
jaguar_word_write(offset, (data>>16) & 0xFFFF);
jaguar_word_write(offset+2, data & 0xFFFF);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
uint8 * jaguar_rom_load(char * path, uint32 * romSize);
void dsp_load_bin_at(char * path, uint32 offset)
{
for(uint32 i=0; i<romSize; i++)
jaguar_byte_write(offset+i, rom[i]);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static int go = 0;
void dsp_update_register_banks(void)
{
}
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_check_if_i2s_interrupt_needed(void)
{
static uint32 count=8;
dsp_set_irq_line(1,1);
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_check_irqs(void)
{
int bits, mask, which = 0;
dsp_pc += which * 0x10;
dsp_reg[30]=dsp_pc;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_set_irq_line(int irqline, int state)
{
int mask = 0x40 << irqline;
dsp_check_irqs();
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_init(void)
{
- memory_malloc_secure((void**)&dsp_ram_8,0x2000,"dsp work ram");
- memory_malloc_secure((void**)&dsp_reg,32*sizeof(int32),"dsp bank 0 regs");
- memory_malloc_secure((void**)&dsp_alternate_reg,32*sizeof(int32),"dsp bank 1 regs");
+ memory_malloc_secure((void **)&dsp_ram_8, 0x2000, "dsp work ram");
+ memory_malloc_secure((void **)&dsp_reg, 32*sizeof(int32), "dsp bank 0 regs");
+ memory_malloc_secure((void **)&dsp_alternate_reg, 32*sizeof(int32), "dsp bank 1 regs");
dsp_build_branch_condition_table();
-
dsp_reset();
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_reset(void)
{
dsp_pc = 0x00f1b000;
dsp_div_control = 0x00000000;
dsp_in_exec = 0;
- for (int i=0;i<32;i++)
+ for(int i=0; i<32; i++)
{
dsp_reg[i] = 0x00000000;
dsp_alternate_reg[i] = 0x00000000;
reset_flag_n();
reset_flag_c();
- dsp_alternate_flag_z=0;
- dsp_alternate_flag_n=0;
- dsp_alternate_flag_c=0;
+ dsp_alternate_flag_z = 0;
+ dsp_alternate_flag_n = 0;
+ dsp_alternate_flag_c = 0;
dsp_reset_stats();
-
- memset(dsp_ram_8, 0xff, 0x2000);
+ memset(dsp_ram_8, 0xFF, 0x2000);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
void dsp_done(void)
{
int i, j;
memory_free(dsp_ram_8);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
void dsp_exec(int32 cycles)
{
if ((cycles!=1)&&(jaguar_mainRom_crc32==0xba74c3ed))
}
dsp_in_exec--;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_jump(void)
{
uint32 delayed_pc = Rm;
dsp_pc=delayed_pc;
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_jr(void)
{
int32 offset=(imm_1&0x10) ? (0xFFFFFFF0|imm_1) : imm_1;
dsp_pc=delayed_pc;
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_add(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_addc(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_addq(void)
{
uint32 _Rn=Rn;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sub(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_subc(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_subq(void)
{
uint32 _Rm=dsp_convert_zero[imm_1];
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_cmp(void)
{
uint32 _Rm=Rm;
};
#endif
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_cmpq(void)
{
static int32 sqtable[32] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1};
};
#endif
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_and(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_or(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_xor(void)
{
uint32 _Rm=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_not(void)
{
uint32 _Rn=Rn;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_move_pc(void)
{
Rn = dsp_pc-2;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sat8(void)
{
int32 _Rn=(int32)Rn;
set_flag_z(res);
reset_flag_n();
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sat16(void)
{
uint32 _Rn=Rn;
set_flag_z(res);
reset_flag_n();
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sat24(void)
{
uint32 _Rn=Rn;
set_flag_z(res);
reset_flag_n();
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_store_r14_indexed(void)
{
dsp_long_write( dsp_reg[14] + (dsp_convert_zero[imm_1] << 2),Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_store_r15_indexed(void)
{
dsp_long_write( dsp_reg[15] + (dsp_convert_zero[imm_1] << 2),Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_load_r14_ri(void)
{
Rn=dsp_long_read(dsp_reg[14] + Rm);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_load_r15_ri(void)
{
Rn=dsp_long_read(dsp_reg[15] + Rm);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_store_r14_ri(void)
{
dsp_long_write(dsp_reg[14] + Rm,Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_store_r15_ri(void)
{
dsp_long_write(dsp_reg[15] + Rm,Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_nop(void)
{
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_pack(void)
{
uint32 _Rn=Rn;
set_flag_z(Rn);
set_flag_n(Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_storeb(void)
{
if ((Rm >= dsp_work_ram_base) && (Rm < (dsp_work_ram_base+0x2000)))
else
jaguar_byte_write(Rm,Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_storew(void)
{
if ((Rm >= dsp_work_ram_base) && (Rm < (dsp_work_ram_base+0x2000)))
else
jaguar_word_write(Rm,Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_store(void)
{
dsp_long_write(Rm,Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_loadb(void)
{
if ((Rm >= dsp_work_ram_base) && (Rm < (dsp_work_ram_base+0x2000)))
else
Rn=jaguar_byte_read(Rm);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_loadw(void)
{
if ((Rm >= dsp_work_ram_base) && (Rm < (dsp_work_ram_base+0x2000)))
else
Rn=jaguar_word_read(Rm);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_load(void)
{
Rn = dsp_long_read(Rm);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_load_r14_indexed(void)
{
Rn = dsp_long_read( dsp_reg[14] + (dsp_convert_zero[imm_1] << 2));
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_load_r15_indexed(void)
{
Rn = dsp_long_read( dsp_reg[15] + (dsp_convert_zero[imm_1] << 2));
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_movei(void)
{
Rn = ((uint32)dsp_word_read(dsp_pc)) + (((uint32)dsp_word_read(dsp_pc+2))<<16);
dsp_pc+=4;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_moveta(void)
{
alternate_Rn = Rm;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_movefa(void)
{
Rn = alternate_Rm;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_move(void)
{
Rn = Rm;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_moveq(void)
{
Rn = imm_1;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_resmac(void)
{
Rn = dsp_acc;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_imult(void)
{
uint32 res=Rn=((int16)Rn)*((int16)Rm);
set_flag_z(res);
set_flag_n(res);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_mult(void)
{
uint32 res=Rn = ((uint16)Rm) * ((uint16)Rn);
set_flag_z(res);
set_flag_n(res);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_bclr(void)
{
uint32 _Rm=imm_1;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_btst(void)
{
uint32 _Rm=imm_1;
};
#endif
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_bset(void)
{
uint32 _Rm=imm_1;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_subqt(void)
{
Rn -= dsp_convert_zero[imm_1];
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_addqt(void)
{
Rn += dsp_convert_zero[imm_1];
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_imacn(void)
{
uint32 res=((int16)Rm) * ((int16)(Rn));
dsp_acc += res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_mtoi(void)
{
uint32 _Rm=Rm;
set_flag_z(res);
set_flag_n(res);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_normi(void)
{
uint32 _Rm = Rm;
set_flag_z(res);
set_flag_n(res);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_mmult(void)
{
int count = dsp_matrix_control&0x0f;
set_flag_z(res);
set_flag_n(res);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_abs(void)
{
uint32 _Rn=Rn;
set_flag_z(res);
}
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_div(void)
{
uint32 _Rm=Rm;
else
Rn=0xffffffff;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_imultn(void)
{
uint32 res=(int32)(((int16)Rn)*((int16)Rm));
set_flag_z(res);
set_flag_n(res);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_neg(void)
{
uint32 _Rn=Rn;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_shlq(void)
{
uint32 shift=(32-dsp_convert_zero[imm_1]);
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_shrq(void)
{
uint32 shift=dsp_convert_zero[imm_1];
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_ror(void)
{
uint32 shift=Rm;
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_rorq(void)
{
uint32 shift=dsp_convert_zero[imm_1&0x1f];
#endif
Rn=res;
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sha(void)
{
int32 sRm=(int32)Rm;
set_flag_z(_Rn);
set_flag_n(_Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sharq(void)
{
uint32 shift=dsp_convert_zero[imm_1];
set_flag_z(_Rn);
set_flag_n(_Rn);
}
-//////////////////////////////////////////////////////////////////////////////
-//
-//////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-//
-//
-//
-//////////////////////////////////////////////////////////////////////////////
+
static void dsp_opcode_sh(void)
{
int32 sRm=(int32)Rm;