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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!