Question: Program this C + + assignment, it focuses on reading and parsing the SIC / XE object code and printing out the details of each
Program this C assignment, it focuses on reading and parsing the SICXE object code and printing out the details of each instruction in the text records of the object code in the order of how they appear in the object code. Each instruction has its opcode mnemonic operands and addressing modes The composition of the object code structure includes the header record, the text records where each text record contains a series of instructions, modification records if there are any and the end record. In this assignment, you would ONLY need to focus on the text records.
Input and Output Files
Input File:
Object Code file: test.obj
This file name would be passed as a command line argument to your project.
Output File:
Object code structure in text form: objstruct.txt
Note:
Your program should produce the output file with the exact name objstruct.txt to work.
The objstruct.txt file should follow exactly what appears in the sample exampleobjstruct.txt using the exact format.
The output file will have the following columns in that order: Instruction, Format, Operand Addressing Type, Target Address Addressing Mode, and Object Code.
Instruction print the mnemonic big case of the instruction: LDA, ADD,
Format print the format number: or Do NOT need to consider format in this assignment.
Operand Addressing Type print the addressing mode for computing the operand: simple, immediate, indirect
Target Address Addressing Mode print the addressing mode for computing the target address: pc base, or absolute equivalent to direct
If indexed addressing mode is used, then print pcindexed, baseindexed, or directindexed.
Object Code print Object code for each instruction
The output file should print the first line with the column header acronyms exactly as below:
INSTR FORMAT OAT TAAM OBJ
There need to be some spaces separating columns in the objstruct.txt The number of spaces for the separation is flexible. It is recommended to set the columns with a consistent width of characters so the output format looks consistent with autograder output.
Some columns might be blank, such as format addressing modes, if that is the case, leave the addressing mode columns blank. It would be good to still add spaces to keep columns lined up for easier reading.
Required Features
Your program MUST support format instructions and does NOT need to support format instructions.
Your program shall support the parsing of all instructions except format instructions and their corresponding mnemonics in the SICXE architecture, for example, the mapping between the following two arrays. Note: you do NOT have to use the following data structures in your assignment implementation.
const static string ops
B
ACC
CFC
CD
CDACC
AAFECC
DCE
CCB
EFCBDC
;
const static string mnemonics
"ADD", "ADDF", "ADDR", "AND", "CLEAR", "COMP",
"COMPF", "COMPR", "DIV", "DIVF", "DIVR", "FIX",
"FLOAT", "HIO", J "JEQ", JGTJLT
"JSUB", "LDA", LDBLDCHLDFLDL
LDSLDTLDXLPS "MUL", "MULF",
"MULR", "NORM", ORRD "RMO", "RSUB",
"SHIFTL", "SHIFTR", "SIO", SSK "STA", STB
STCHSTF "STI", STLSTSSTSW
STTSTX "SUB", "SUBF", "SUBR", SVC
TD "TIO", "TIX", "TIXR", WD
;
const static bool format
false,false,true,false,true,false,
false,true,false,false,true,false,
false,false,false,false,false,false,
false,false,false,false,false,false,
false,false,false,false,false,false,
true,false,false,false,true,false,
true,true,false,false,false,false,
false,false,false,false,false,false,
false,false,false,false,true,true,
false,false,false,true,false
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
