Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Case 2.4 : I = DS
LC := LC+X;
Step 3.3 : if (X is a literal ) then
Begin
LC := LC +1,
Insert X in LT if it is new
end;
Step 4 :goto Step 2
Step 5 : Set the address of the literal in LT (i>0) to LC
+i
Pass 2:
Step 1 : LC := 0;
Step 2 : Read a line from the input file
Step 3 :analyze the statement
Step 3.1 :
Case 1 : I is found in MOT,
Write a line in the output file containing the current
value
of LC, the machine code of I, character a (the last
character signifies that the content is absolute which
will
be needed by loader)
case 2 : I is found in POT
Case 2.1 : I = ORG no action
Case 2.2 : I = END
goto step 5;
Case 2.3 : I = DB
Write a line in the output file containing the current
value of LC, X, the character a.
Step 3.2 :
Case 1 : X is a literal
Write a line in the output file containing the current
value
of LC, the address of X ( as found from LC ) and
character
r ( for relative ).
Case 2 : X is a symbol
Write a line in the output file containing the current
value
of LC, The address of X ( as found from ST ) and the
letter r.
Step 4 :goto Step 2
Step 5 : for i = 0 to total number of literals 1 do
Write a line containing LC+I, the i
th
literal in LT and the letter a
Step 6 : stop.
MAIN FUNCTIONS USED IN TWO PASSES
We developed some functions that are used for the
8085 assembler.
READ1
1:symbol
To
read
assembly
not
present
in ST).
operation
field.
LTSTO
Store
a the
literal
into LT. source file.
PASS
specific
2
copy.
LTGEN Generate
codeobject
for literals.
pseudo-op
RESULTS
to generate
code
1)INPUT FILE
LXIH, 0000
MVIC, 00
MOVA, M
INXH
ADDM
JNC
LAB1
INRC
LAB1:INX H
MOV M, A
INX H
MOV M, C
HLT
20
2 PASS ASSEMBLER FOR 8085
2)SYMBOL TABLE
Index-symbol name-value
-----------------------------------------------------------------------
s1-LAB1-000C
3)INTERMEDIATE FILE
m80-r6-C-A16-0000
m23-r3-C-A8-00
m22-r1-C-r9
m20-r6
m3-r9
m70-l-s1
m19-r3
l-s1-cn-m20-r6
m22-r9-C-r1
m20-r6
m22-r9-C-r3
m17
4)OUTPUT FILE
PCOpcodeOBJCODE
________________________________________
0000 LXI H , 0000
210000
0003 MVI C , 00
0E00
0005 MOV A , M7E
0006 INX H23
0007
0008
000B
000C
000D
000E
000F
0010
ADD M86
JNC LAB1D20C00
INR C0C
LAB1 : INX H23
MOV M , A
INX H23
MOV M , C
HLT
77
71
76