Question
In this program, you are to simulate a 2-pass assembler in C++. The input to this program is an assembly language program and the output
In this program, you are to simulate a 2-pass assembler in C++. The input to this program is an assembly language program and the output should include a symbol table and the machine code version of the input. You have to echo the input. Do file I/O.
You are implementing two classical algorithms (Fig. 6.1 & Fig 6.2).
INPUT
ORG $00000500
MOVE #79, $00002000
TRAP #1 ;READLN (Y), INPUT INTO DO
LOOP1 MOVE DO, $00020004 ;STORE DO IN LOCATION Y
MOVE $00002000, DO ;FETCH VARIABLE I FOR THE AD
ADD $00002004, DO ;ADD Y+1
MOVE DO, $00002002 ; STORE THE SUM IN X
LOOP2 ADDI #18, $00002002 ;ADD 18 TO X
TRAP #2 ; PRINT X
TRAP #0 ; STOP
END
OUTPUT
Address Machine code Operands Instructions
00000500 33FC 4F MOVE #79, $00002000
----- ----- -- -- -- --
----- ----- -- -- -- --
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started