Beispiel #1
0
SPEED_UP void CallInt(unsigned char num){
    unsigned short seg,off;
    unsigned short *ptr;
    if(push(flagreg)!=0){ //pushf
        panic("no faulting!!\n");
    }
    flags->tf=0;
    flags->_if=0;
    //far call
    sregs[IS]=0;
    MemRead16(IS,(num*4),&seg);
    if(push(sregs[CS])!=0){
        panic("no faulting!!\n");
    }
    MemRead16(IS,(num*4)+2,&off);
    if(push(ip)!=0){
        panic("no faulting!!\n");
    }
    sregs[CS]=seg;
    ip=off;
    printf("num: %i,seg: 0x%x, off: 0x%x\n",num,seg,off);
    //ip--;
//    doeip;doiptr; //just in case..
    //nop();
}
Beispiel #2
0
void mov_ax_mem16(){
	unsigned short tmp;
	ip++;
	MemRead16(CS,ip,&tmp);
	ip++;
	MemRead16(CurrentSegment,tmp,&gregs16[AX]);
}
Beispiel #3
0
void jmp_ptr16seg16(){ //yay working
     unsigned short off,seg;
     ip++;
     MemRead16(CS,ip,&off);
     ip++;
     ip++;
     MemRead16(CS,ip,&seg);
     ip=(unsigned)ip+(signed)off;
     sregs[CS]=(unsigned)sregs[CS]+(signed)seg;
}
Beispiel #4
0
void call_far_ptr16(){//this is actually a call seg:offset
     unsigned short off;
     unsigned short seg;
     ip++;
     MemRead16(CS,ip,&seg);
     ip++;ip++;
     MemRead16(CS,ip,&off);
     //*seg--;
     far_call(seg,off); //oops set them backwards... ohwell
    // panic("debug #1\n");
}
Beispiel #5
0
void call_rel16(){
     signed short tmp;
     ip++;
     MemRead16(CS,ip,&tmp);
     ip++;ip++;
     near_call((signed short)ip+tmp);
}
Beispiel #6
0
void mov_al_mem8(){
	unsigned short tmp;
	ip++;
	MemRead16(CS,ip,&tmp);
	ip++;
	MemRead8(CurrentSegment,tmp,gregs8[AL]);
}
Beispiel #7
0
UINT32 opPOPM(void)
{
	int i;

	modAdd=PC+1;
	modDim=2;

	/* Read the bit register list */
	amLength1=ReadAM();

	for (i=0;i<31;i++)
		if (amOut & (1<<i))
		{
			v60.reg[i] = MemRead32(SP);
			SP += 4;
		}

	if (amOut & (1<<31))
	{
		v60WritePSW((v60ReadPSW() & 0xffff0000) | MemRead16(SP));
		SP += 4;
	}

	return amLength1 + 1;
}
Beispiel #8
0
void jmp_rel16(){
     signed short tmp;
     ip++;
     MemRead16(CS,ip,&tmp);
     ip=(unsigned)ip+(signed)tmp;
     ip++;
     //no wories on advancing ip because we set ip in this
}
Beispiel #9
0
void push_imm16(){
     unsigned short imm;
     ip++;
     MemRead16(CS,ip,&imm);
     if(push(imm)!=0){
         panic("no faulting!!");
     }
     ip++;
     //doeip;doiptr;  --don't need this with our new system
}
Beispiel #10
0
void mov_16greg_iw(){
     unsigned char tmp;unsigned short tmp2;
     MemRead8(CS,ip,&tmp);
     tmp=tmp&0x0F;
     tmp=tmp-8; //because we don't use greater than 7 and it adds 7 automatically
     ip++;
     MemRead16(CS,ip,&tmp2);
     gregs16[tmp]=tmp2;
     ip++; //we have an extra byte unaccounted for since this is a word
}
Beispiel #11
0
static uint16 MDFN_FASTCALL MemPeek16(v810_timestamp_t timestamp, uint32 A)
{
 uint16 ret;

 // TODO: VB_InDebugPeek(implement elsewhere)
 VB_InDebugPeek++;
 ret = MemRead16(timestamp, A);
 VB_InDebugPeek--;

 return(ret);
}
Beispiel #12
0
UINT32 opDECH(void) /* TRUSTED */
{
	UINT16 apph;
	modAdd=PC+1;
	modDim=1;

	amLength1=ReadAMAddress();

	if (amFlag)
		apph=(UINT16)v60.reg[amOut];
	else
		apph=MemRead16(amOut);

	SUBW(apph, 1);

	if (amFlag)
		SETREG16(v60.reg[amOut], apph);
	else
		MemWrite16(amOut, apph);

	return amLength1+1;
}
Beispiel #13
0
void mov_rm16_imm16(){
    unsigned short *ptr;
    unsigned int tmp;
    unsigned short tmp2;
    mod_rm rm[1];
    ip++;
    MemRead8(CS,ip,rm); //store rm because we need 'extra'
    tmp=GetModRM_write16(&ptr);
    if(tmp==0){ //is normal and ptr contains the memory address
        ptr=(unsigned long)ptr+(unsigned long)core;
        ip++;
        MemRead16(CS,ip,&tmp2);
        *ptr=tmp2;
        ip++;
        //*ptr is the destination, gregs16[rm[0].extra] is the source/operand
        return;
    }
    if(tmp==OPCODE_SPECIFIC){
    	panic("Attempting to do something opcode specific on something undefined!\nOPCODE_SPECIFIC in mov rm8,imm8\n");
        //gregs16[rm[0].rm] is the destination, gregs16[rm[0].extra] is the source/operand
        return;
    }
    panic("errors not yet handled!!");
}
Beispiel #14
0
SPEED_UP unsigned short pop(){
    unsigned short tmp;
    MemRead16(SS,gregs16[SP],&tmp);
    gregs16[SP]++;gregs16[SP]++;
    return tmp;
}