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; }
static UINT32 opTASI(v60_state *cpustate) { UINT8 appb; cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 0; // Load the address of the operand cpustate->amlength1 = ReadAMAddress(cpustate); // Load UINT8 from the address if (cpustate->amflag) appb = (UINT8)cpustate->reg[cpustate->amout & 0x1F]; else appb = cpustate->program->read_byte(cpustate->amout); // Set the flags for SUB appb, FF SUBB(appb, 0xff); // Write FF in the operand if (cpustate->amflag) SETREG8(cpustate->reg[cpustate->amout & 0x1F], 0xFF); else cpustate->program->write_byte(cpustate->amout, 0xFF); return cpustate->amlength1 + 1; }
static UINT32 opJMP(v60_state *cpustate) /* TRUSTED */ { cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 0; // Read the address of the operand ReadAMAddress(cpustate); // It cannot be a register!! assert(cpustate->amflag == 0); // Jump there cpustate->PC = cpustate->amout; return 0; }
UINT32 opJMP(void) /* TRUSTED */ { modAdd=PC+1; modDim=0; /* Read the address of the operand */ ReadAMAddress(); /* It cannot be a register!! */ assert(amFlag==0); /* Jump there */ PC=amOut; ChangePC(PC); return 0; }
static UINT32 opJSR(v60_state *cpustate) /* TRUSTED */ { cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 0; // Read the address of the operand cpustate->amlength1 = ReadAMAddress(cpustate); // It cannot be a register!! assert(cpustate->amflag == 0); // Save NextPC into the stack cpustate->SP -= 4; cpustate->program->write_dword_unaligned(cpustate->SP, cpustate->PC + cpustate->amlength1 + 1); // Jump there cpustate->PC = cpustate->amout; return 0; }
UINT32 opJSR(void) /* TRUSTED */ { modAdd=PC + 1; modDim=0; /* Read the address of the operand */ amLength1=ReadAMAddress(); /* It cannot be a register!! */ assert(amFlag==0); /* Save NextPC into the stack */ SP -= 4; MemWrite32(SP, PC + amLength1 + 1); /* Jump there */ PC=amOut; ChangePC(PC); return 0; }
static UINT32 opDECH(v60_state *cpustate) /* TRUSTED */ { UINT16 apph; cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 1; cpustate->amlength1 = ReadAMAddress(cpustate); if (cpustate->amflag) apph = (UINT16)cpustate->reg[cpustate->amout]; else apph = cpustate->program->read_word_unaligned(cpustate->amout); SUBW(apph, 1); if (cpustate->amflag) SETREG16(cpustate->reg[cpustate->amout], apph); else cpustate->program->write_word_unaligned(cpustate->amout, apph); return cpustate->amlength1 + 1; }
static UINT32 opDECB(v60_state *cpustate) /* TRUSTED */ { UINT8 appb; cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 0; cpustate->amlength1 = ReadAMAddress(cpustate); if (cpustate->amflag) appb = (UINT8)cpustate->reg[cpustate->amout]; else appb = cpustate->program->read_byte(cpustate->amout); SUBB(appb, 1); if (cpustate->amflag) SETREG8(cpustate->reg[cpustate->amout], appb); else cpustate->program->write_byte(cpustate->amout, appb); return cpustate->amlength1 + 1; }
static UINT32 opINCW(v60_state *cpustate) /* TRUSTED */ { UINT32 appw; cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 2; cpustate->amlength1 = ReadAMAddress(cpustate); if (cpustate->amflag) appw = cpustate->reg[cpustate->amout]; else appw = cpustate->program->read_dword_unaligned(cpustate->amout); ADDL(appw, 1); if (cpustate->amflag) cpustate->reg[cpustate->amout] = appw; else cpustate->program->write_dword_unaligned(cpustate->amout, appw); return cpustate->amlength1 + 1; }
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; }
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; }
UINT32 opINCW(void) /* TRUSTED */ { UINT32 appw; modAdd=PC+1; modDim=2; amLength1=ReadAMAddress(); if (amFlag) appw=v60.reg[amOut]; else appw=MemRead32(amOut); ADDL(appw, 1); if (amFlag) v60.reg[amOut]=appw; else MemWrite32(amOut,appw); return amLength1+1; }