Example #1
0
ULONG ParseIntOp(PUCHAR inString,
                 PUCHAR *outString,
                 POPTBLENTRY pEntry,
                 PULONG poffset)
{
    ULONG instruction;
    ULONG Ra, Rb, Rc;
    ULONG lit;
    ULONG Format;	// Whether there is a literal or 3rd reg

    instruction = OPCODE(pEntry->opCode) +
                  OP_FNC(pEntry->funcCode);

    Ra = GetIntReg(inString, &inString);

    if (!TestCharacter(inString, &inString, ','))
 	error(OPERAND);

    if (TestCharacter(inString, &inString, '#')) {

        //
        // User is giving us a literal value

        lit = GetValue(inString, &inString, TRUE, WIDTH_LIT);
        Format = RBV_LITERAL_FORMAT;

    } else {

        //
        // using a third register value

        Rb = GetIntReg(inString, &inString);
        Format = RBV_REGISTER_FORMAT;
    }

    if (!TestCharacter(inString, &inString, ','))
 	error(OPERAND);

    Rc = GetIntReg(inString, &inString);

    if (!TestCharacter(inString, &inString, '\0'))
 	error(EXTRACHARS);

    instruction = instruction +
                  REG_A(Ra) +
                  RBV_TYPE(Format) +
                  REG_C(Rc);

    if (Format == RBV_REGISTER_FORMAT) {
        instruction = instruction + REG_B(Rb);
    } else {
        instruction = instruction + LIT(lit);
    }

    return(instruction);
}
Example #2
0
ULONG ParseJump(PUCHAR inString,
                PUCHAR *outString,
                POPTBLENTRY pEntry,
                PULONG poffset)
{
    ULONG instruction;
    ULONG Ra;
    ULONG Rb;
    ULONG hint;

    Ra = GetIntReg(inString, &inString);

    if (!TestCharacter(inString, &inString, ','))
	error(OPERAND);

    if (!TestCharacter(inString, &inString, '('))
	error(OPERAND);

    Rb = GetIntReg(inString, &inString);

    if (!TestCharacter(inString, &inString, ')'))
	error(OPERAND);

    if (TestCharacter(inString, &inString, ',')) {
        //
        // User is giving us a hint
        //
        hint = GetValue(inString, &inString, TRUE, WIDTH_HINT);
    } else {
        hint = 0;
    }

    if (!TestCharacter(inString, &inString, '\0'))
	error(EXTRACHARS);

    instruction = OPCODE(pEntry->opCode) +
                  JMP_FNC(pEntry->funcCode) +
		  REG_A(Ra) +
		  REG_B(Rb) +
		  HINT(hint);

    return(instruction);
}
Example #3
0
ULONG ParsePal(PUCHAR inString,
               PUCHAR *outString,
               POPTBLENTRY pEntry,
               PULONG poffset)
{
    if (!TestCharacter(inString, &inString, '\0'))
	error(EXTRACHARS);

    return(OPCODE(pEntry->opCode) +
           PAL_FNC(pEntry->funcCode));
}
void test_member_data_value_function()
  {
  
  p_member_data_value_class tcl;
  
  TestCharacter(tcl);
  TestInt(tcl);
  TestDouble(tcl);
  TestBool(tcl);
  TestPointer(tcl);
  TestEnum(tcl);
  TestPod(tcl);
  
  }
Example #5
0
/*** ParseFltBranch - parse floating point branch instruction
*
*   Purpose:
*	Given the users input, create the memory instruction.
*
*   Input:
*	*inString - present input position
*	pEntry - pointer into the asmTable for this instr type
*
*   Output:
*	*outstring - update input position
*
*   Returns:
*	the instruction.
*
*   Format:
*	op Fa,disp
*
*************************************************************************/
ULONG ParseFltBranch(PUCHAR inString,
                     PUCHAR *outString,
                     POPTBLENTRY pEntry,
                     PULONG poffset)
{
    ULONG instruction;
    ULONG Ra;
    LONG disp;

    Ra = GetFltReg(inString, &inString);

    if (!TestCharacter(inString, &inString, ','))
	error(OPERAND);

    //
    // the user gives an absolute address; we convert
    // that to a displacement, which is computed as a
    // difference off of (pc+1)
    // GetValue handles both numerics and symbolics
    //
    disp = GetValue(inString, &inString, TRUE, 32);

    // get the relative displacement from the updated pc
    disp = disp - (LONG)((*poffset)+4);

    // divide by four
    disp = disp >> 2;

    if (!TestCharacter(inString, &inString, '\0'))
	error(EXTRACHARS);

    instruction = OPCODE(pEntry->opCode) +
		  REG_A(Ra) +
		  BR_DISP(disp);

    return(instruction);
}
Example #6
0
ULONG
ParseFltMemory(PUCHAR inString,
               PUCHAR *outString,
               POPTBLENTRY pEntry,
               PULONG poffset)
{
    ULONG instruction;
    ULONG Fa;
    ULONG Rb;
    ULONG disp;

    Fa = GetFltReg(inString, &inString);

    if (!TestCharacter(inString, &inString, ','))
	error(OPERAND);

    disp = GetValue(inString, &inString, TRUE, WIDTH_MEM_DISP);

    if (!TestCharacter(inString, &inString, '('))
	error(OPERAND);

    Rb = GetIntReg(inString, &inString);

    if (!TestCharacter(inString, &inString, ')'))
	error(OPERAND);

    if (!TestCharacter(inString, &inString, '\0'))
	error(EXTRACHARS);

    instruction = OPCODE(pEntry->opCode) +
		  REG_A(Fa) +
		  REG_B(Rb) +
		  MEM_DISP(disp);

    return(instruction);
}