Ejemplo n.º 1
0
void mov_8greg_ib(){
     unsigned char tmp;
     unsigned char tmp2;
     //tmp=*iptr;
     MemRead8(CS,ip,&tmp);
     tmp=tmp&0x0F; //isolate register bits
     ip++;
     MemRead8(CS,ip,&tmp2);
     *gregs8[tmp]=tmp2; //mov the byte
}
Ejemplo n.º 2
0
void jmp_rel8(){
     signed char ptr;
     ip++;
     MemRead8(CS,ip,&ptr);
     ip=(unsigned)ip+(signed)ptr;
     //no wories on advancing ip because we set ip in this
}
Ejemplo n.º 3
0
void mov_al_mem8(){
	unsigned short tmp;
	ip++;
	MemRead16(CS,ip,&tmp);
	ip++;
	MemRead8(CurrentSegment,tmp,gregs8[AL]);
}
Ejemplo n.º 4
0
/**Loop instructions**/
void loop_rel8(){
    signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    gregs16[CX]--;
    if(gregs16[CX]!=0){ip=(unsigned)ip+(signed)blah;}
}
Ejemplo n.º 5
0
UINT32 opTASI(void)
{
	UINT8 appb;
	modAdd=PC + 1;
	modDim=0;

	/* Load the address of the operand */
	amLength1=ReadAMAddress();

	/* Load UINT8 from the address */
	if (amFlag)
		appb=(UINT8)v60.reg[amOut&0x1F];
	else
		appb=MemRead8(amOut);

	/* Set the flags for SUB appb,FF */
	SUBB(appb, 0xff);

	/* Write FF in the operand */
	if (amFlag)
		SETREG8(v60.reg[amOut&0x1F], 0xFF);
	else
		MemWrite8(amOut,0xFF);

	return amLength1 + 1;
}
Ejemplo n.º 6
0
void pop_r16(){
     unsigned char reg;
     unsigned char tmp;
     MemRead8(CS,ip,&tmp);
     reg=tmp&0x0F;
     reg=reg-8;
     gregs16[reg]=pop();
}
Ejemplo n.º 7
0
void jns_rel8(){ //is  positive
     signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->sf==0){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 8
0
void jl_rel8(){ //is also jnge
     signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->sf!=flags->of){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 9
0
void jno_rel8(){
     signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->of==0){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 10
0
void js_rel8(){ //is negative
     signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->sf==1){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 11
0
void jnc_rel8(){ //is also jae and jnb
    signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->cf==0){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 12
0
void jbe_rel8(){ //is also jna
     signed char blah;
     ip++;
    MemRead8(CS,ip,&blah);
    if(flags->cf==1 || flags->zf==1){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 13
0
void push_imm8(){
    unsigned char tmp;
     ip++;
     MemRead8(CS,ip,&tmp);
     if(push((unsigned char)tmp)!=0){
         panic("no faulting!!");
     }
}
Ejemplo n.º 14
0
void jc_rel8(){ //is also jb and jnae
     signed char blah;
     ip++;
    MemRead8(CS,ip,&blah);
    if(flags->cf==1){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 15
0
void jnz_rel8(){ //is also jne
     signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->zf==0){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 16
0
void jp_rel8(){ //also jpe
     signed char blah;
    ip++;
    MemRead8(CS,ip,&blah);
    if(flags->pf==1){
        ip=(unsigned)ip+(signed)blah;
    }
}
Ejemplo n.º 17
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
}
Ejemplo n.º 18
0
static uint16 MDFN_FASTCALL MemPeek8(v810_timestamp_t timestamp, uint32 A)
{
 uint8 ret;

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

 return(ret);
}
Ejemplo n.º 19
0
void push_r16(){
    unsigned char reg,tmp;
    MemRead8(CS,ip,&tmp);
    reg=tmp&(0x0F); //isolate the bottom nibble
    if(reg==SP){ //the 80286 and above do this...
         if(push(gregs16[SP]+2)!=0){
             panic("no faulting!!");
         }
         return;
    }
    if(push(gregs16[reg])!=0){
        panic("no faulting!!");
    }
} //wow done already!!
Ejemplo n.º 20
0
void mov_m8_imm8(){ //This is only memory, no register!
    unsigned char *ptr;
    unsigned char *ptr2;
   // unsigned short pip,pip2;
    unsigned int tmp;
    mod_rm rm[1];
    ip++;
    MemRead8(CS,ip,rm); //store rm because we need 'extra'
    tmp=GetModRM_write8(&ptr);
    if(tmp==0){ //is normal and ptr contains the memory address
        ptr=(unsigned long)ptr+(unsigned long)core;
       // printf("ptr: 0x%x rm: 0x%x",*ptr, gregs16[rm[0].extra]);
        MemRead8(CS,ip,ptr); //don't let this decieve you!
                             //this will read the immediant byte into the ptr we got from modrm
        return;
    }
    if(tmp==OPCODE_SPECIFIC){
        //gregs16[rm[0].rm]=sregs[rm[0].extra];
        panic("no faulting!! --undefined opcode\n");
        return;
    }
    panic("errors not yet handled!!");
}
Ejemplo n.º 21
0
void mov_rm8_imm8(){ //NOTE! only memory! no register
    unsigned char *ptr;
    unsigned int tmp;
    unsigned char tmp2;
    mod_rm rm[1];
    ip++;
    MemRead8(CS,ip,rm); //store rm because we need 'extra'
    tmp=GetModRM_write8(&ptr);
    if(tmp==0){ //is normal and ptr contains the memory address
        ptr=ptr+(unsigned long)core;
        //*ptr is the destination, *gregs8[rm[0].extra] is the source/operand
        ip++;
        MemRead8(CS,ip,&tmp2);
        *ptr=tmp2;
        return;
    }
    if(tmp==OPCODE_SPECIFIC){
        //*gregs8[rm[0].rm] is the destination, *gregs8[rm[0].extra] is the source/operand
        panic("Attempting to do something opcode specific on something undefined!\nOPCODE_SPECIFIC in mov rm8,imm8\n");
        return;
    }
    panic("errors not yet handled!!");
}
Ejemplo n.º 22
0
uint32 VBDBG_MemPeek(uint32 A, unsigned int bsize, bool hl, bool logical)
{
 uint32 ret = 0;
 int32 ws = 0;

 for(unsigned int i = 0; i < bsize; i++)
 {
  A &= 0xFFFFFFFF;
  //ret |= mem_peekbyte(A, ws) << (i * 8);
  ret |= MemRead8(ws, A) << (i * 8);
  A++;
 }

 return(ret);
}
Ejemplo n.º 23
0
void mov_rm8_greg8(){ //greg8 is stored in rm->extra!
    unsigned char *ptr;
    unsigned char *ptr2;
    unsigned short pip,pip2;
    unsigned int tmp;
    mod_rm rm[1];
    ip++;
    MemRead8(CS,ip,rm); //store rm because we need 'extra'
    tmp=GetModRM_write8(&ptr);
    if(tmp==0){ //is normal and ptr contains the memory address
        ptr=ptr+(unsigned long)core;
        *ptr=*gregs8[rm[0].extra];
        return;
    }
    if(tmp==OPCODE_SPECIFIC){
        *gregs8[rm[0].rm]=*gregs8[rm[0].extra];
        return;
    }
    panic("errors not yet handled!!");
}
Ejemplo n.º 24
0
void mov_sreg_rm16(){ //greg16 is stored in rm->extra!
    unsigned short *ptr;
    unsigned char *ptr2;
    unsigned short pip,pip2;
    unsigned int tmp;
    mod_rm rm[1];
    ip++;
    MemRead8(CS,ip,rm); //store rm because we need 'extra'
    tmp=GetModRM_read16(&ptr);
    if(tmp==0){ //is normal and ptr contains the memory address
        ptr=(unsigned long)ptr+(unsigned long)core;
       // printf("ptr: 0x%x rm: 0x%x",*ptr, gregs16[rm[0].extra]);
        sregs[rm[0].extra]=*ptr;
        return;
    }
    if(tmp==OPCODE_SPECIFIC){
        sregs[rm[0].extra]=gregs16[rm[0].rm];
        return;
    }
    panic("errors not yet handled!!");
}
Ejemplo n.º 25
0
UINT32 opDECB(void) /* TRUSTED */
{
	UINT8 appb;
	modAdd=PC+1;
	modDim=0;

	amLength1=ReadAMAddress();

	if (amFlag)
		appb=(UINT8)v60.reg[amOut];
	else
		appb=MemRead8(amOut);

	SUBB(appb, 1);

	if (amFlag)
		SETREG8(v60.reg[amOut], appb);
	else
		MemWrite8(amOut, appb);

	return amLength1+1;
}
Ejemplo n.º 26
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!!");
}
Ejemplo n.º 27
0
void int_normal(){ //This is the actual int opcode
    unsigned char tmp;
    ip++;
    MemRead8(CS,ip,&tmp);
    CallInt(tmp);
}
Ejemplo n.º 28
0
void out_imm8_al(){
    unsigned char tmp;
    ip++;
    MemRead8(CS,ip,&tmp);
    OutPort8(tmp,*gregs8[AL]);
}
Ejemplo n.º 29
0
void out_imm8_ax(){
    unsigned char tmp;
    ip++;
    MemRead8(CS,ip,&tmp);
    OutPort16(tmp,gregs16[AX]);
}
Ejemplo n.º 30
0
void int_normal(){
    unsigned char tmp;
    ip++;
    MemRead8(CS,ip,&tmp);
    CallInt(tmp);
}