示例#1
0
文件: lh5801.c 项目: Synapseware/coco
void lh5801_reset(void *param)
{
	if (param) {
		lh5801.config=(LH5801_CONFIG *)param;
	}
	P=(cpu_readmem17(0xfffe)<<8)|cpu_readmem17(0xffff);

	change_pc17(P);

	lh5801.idle=0;
}
示例#2
0
unsigned lh5801_dasm(char *dst, unsigned oldpc)
{
	int pc;
	int oper;
	UINT16 absolut;
	const Entry *entry;
	int temp;

	oldpc&=0xffff;
	pc=oldpc;
	oper=cpu_readmem17(pc++);
	entry=table+oper;

	if (table[oper].ins==PREFD) {
		oper=cpu_readmem17(pc++);
		entry=table_fd+oper;
	}
	switch (entry->ins) {
	case ILL:
		sprintf(dst,"%s %.2x", InsNames[entry->ins], oper);break;
	case ILL2:
		sprintf(dst,"%s fd%.2x", InsNames[entry->ins], oper);break;
	default:
		switch(entry->adr) {			
		case Imp:
			sprintf(dst,"%s", InsNames[entry->ins]);break;
		case Reg:
			sprintf(dst,"%s %s", InsNames[entry->ins],RegNames[entry->reg]);break;
		case RegImm:
			sprintf(dst,"%s %s,%.2x", InsNames[entry->ins],
					RegNames[entry->reg], cpu_readmem17(pc++));
			break;
		case RegImm16:
			absolut=cpu_readmem17(pc++)<<8;
			absolut|=cpu_readmem17(pc++);
			sprintf(dst,"%s %s,%.4x", InsNames[entry->ins],RegNames[entry->reg],absolut );
			break;
		case Vec:
			sprintf(dst,"%s (ff%.2x)", InsNames[entry->ins],cpu_readmem17(pc++));break;
		case Vej:
			sprintf(dst,"%s (ff%.2x)", InsNames[entry->ins], oper);break;		
		case Imm:
			sprintf(dst,"%s %.2x", InsNames[entry->ins],cpu_readmem17(pc++));break;
		case Imm16:
			absolut=cpu_readmem17(pc++)<<8;
			absolut|=cpu_readmem17(pc++);
			sprintf(dst,"%s %.4x", InsNames[entry->ins],absolut );break;
		case RelP:
			temp=cpu_readmem17(pc++);
			sprintf(dst,"%s %.4x", InsNames[entry->ins],pc+temp );break;
		case RelM:
			temp=cpu_readmem17(pc++);
			sprintf(dst,"%s %.4x", InsNames[entry->ins],pc-temp );break;
		case Abs:
			absolut=cpu_readmem17(pc++)<<8;
			absolut|=cpu_readmem17(pc++);
			sprintf(dst,"%s (%.4x)", InsNames[entry->ins],absolut );break;
		case ME1Abs:
			absolut=cpu_readmem17(pc++)<<8;
			absolut|=cpu_readmem17(pc++);
			sprintf(dst,"%s #(%.4x)", InsNames[entry->ins],absolut );break;
		case AbsImm:
			absolut=cpu_readmem17(pc++)<<8;
			absolut|=cpu_readmem17(pc++);
			sprintf(dst,"%s (%.4x),%.2x", InsNames[entry->ins],absolut, 
					cpu_readmem17(pc++));break;
		case ME1AbsImm:
			absolut=cpu_readmem17(pc++)<<8;
			absolut|=cpu_readmem17(pc++);
			sprintf(dst,"%s #(%.4x),%.2x", InsNames[entry->ins],absolut, 
					cpu_readmem17(pc++));break;
		case ME0:
			sprintf(dst,"%s (%s)", InsNames[entry->ins],RegNames[entry->reg] );break;		
		case ME0Imm:
			sprintf(dst,"%s (%s),%.2x", InsNames[entry->ins],RegNames[entry->reg],cpu_readmem17(pc++) );
			break;		
		case ME1:
			sprintf(dst,"%s #(%s)", InsNames[entry->ins],RegNames[entry->reg] );break;
		case ME1Imm:
			sprintf(dst,"%s #(%s),%.2x", InsNames[entry->ins],RegNames[entry->reg],cpu_readmem17(pc++) );
			break;		
		}		
	}

	return pc-oldpc;
}