Skip to content

Latest commit

 

History

History

Assignment 02

Assembly Program given as input to program.cpp

LOAD A
STORE B
MACRO ABC
    LOAD p
    SUB q
MEND
MACRO ADD1 ARG
    LOAD X
    STORE ARG
MEND
MACRO ADD5 A1, A2, A3
    STORE A2
    ADD1 5
    ADD1 10
    LOAD A1
    LOAD A3
MEND
ABC
ADD5 D1, D2, D3
END

Output Generated

Intermediate File

LOAD A
STORE B
ABC
ADD5 D1, D2, D3
END

MNT Table

ABC 0 1
ADD1 1 4
ADD5 3 7

MDT Table

LOAD p 
SUB q 
MEND
LOAD X 
STORE #1 
MEND
STORE #2 
LOAD X 
STORE 5 
LOAD X 
STORE 10 
LOAD #1 
LOAD #3 
MEND

Actual vs Positional Parameter

....ADD1....
5 #1
....ADD1....
10 #1
....ABC....
....ADD5....
D1 #1
D2 #2
D3 #3

Formal vs Positional Parameter

  .....ADD1.....
ARG #1
.....ADD5.....
A1 #1
A2 #2
A3 #3

Expanded Code

LOAD A
STORE B
LOAD p 
SUB q 
STORE D2 
LOAD X 
STORE 5 
LOAD X 
STORE 10 
LOAD D1 
LOAD D3 
END