(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
Assembler Numerical in System Programming: Symbol Tables, Literal Tables, Base Tables and Machine Code Generation
1. Topic: Assembler Numerical in System Programming
Author Name: Pratibha Paras waghale
(Assistant Professor-CSE)
2. System Software and Assembler
1. System Software: The System Software is a collection of program that
bridges the gap between the level at which interact with the computer and level
at which the computer is capable of operating.
2. Components of system software
¾ Assembler: Assembler to convert assembler language program using
of system program database and produce machine language program.
¾ Complier: A Complier is a system program that accepts the program in
high level language program and produces object program in machine
language program.
¾ Interpreter: Interpreter translates the high level program into the
machine language program. It translates the program line by line and
requires less space or main memory.
¾ Microprocessor: Microprocessor is a system program required to
execute macros. Macro is a line abbreviation for the group of program.
¾ Loader: Loader is a system program that places a program into
memory and prepares them for execution.
¾ Formal System: Formal System are used to specify the syntax and
semantic of programming language.
¾ Operating System: Operating system is a collection of system
program that controls overall operation of computer systems.
3. Question 1:For the followig AL code,geerate the Symbol table,literal table,base table and machine
code using the 2 pass assembler algorithm.(Ref-1)
START 0
BEGIN BALR 15,0
USING *,15
L 3,OLDOH
A 3,RECPT
S 3,ISSUE
ST 3, NEWOH
OLDOH DC F’9’
RECPT DC F’4’
ISSUE DC F’6’
NEWOH DS F
END
Solution:
1. Assign Location Counter
Sr. No. INSTRUCTIONS LC
1 START 0 0
2 BEGIN BALR 15,0 0
3 USING *,15 2
4 L 3,OLDOH 2
5 A 3,RECPT 6
6 S 3,ISSUE 10
7 ST 3, NEWOH 14
8 OLDOH DC F’9’ 18
9 RECPT DC F’4’ 20
10 ISSUE DC F’6’ 24
11 NEWOH DS F 28
12 END 32
2. Symbol Table:
SR. NO. LEBEL Value R/A
1 BEGIN 0 R
2 OLDOH 18 R
3 RECPT 20 R
4 ISSUE 24 R
5 NEWOH 30 R
3. No Literal Table
4. 4. Base Table
Sr. No. BASE VALUE CONTEXT
1 15 2
5. MACHINE CODE:
LC Instruction
0 BALR 15,0
2 L 3,16(0,15)
6 A 3,18(0,15)
10 S 3,22(0,15)
14 ST 3,28(0,15)
18 9
20 4
24 6
28 -
Question 2: For the followig AL code,geerate the Symbol table,literal table,base table and machine
code using the 2 pass assembler algorithm.(Ref-1)
TEST START
BEGIN BALR 15,0
USING BEGIN+2,15
SR 4,4
L ,3=F=’10’
LOOP L, 2,DATA(4)
A 2,=F’49’
ST 2,DATA(4)
A 4,=F’4’
BCT 3,*-16
BR 14
DATA DC F’1,2,3,4’
END
Solution:
1.Assign Location Counter
Sr. No. INSTRUCTIONS LC
1 TEST START 0
2 BEGIN BALR 15,0 0
3 USING BEGIN+2,15 2
4 SR 4,4 2
5 L ,3=F=’10’ 4
6 LOOP L, 2,DATA(4) 8
7 A 2,=F’49’ 12
8 ST 2,DATA(4) 16
5. 9 A 4,=F’4’ 20
10 BCT 3,*-16 24
11 BR 14 28
12 DATA DC F’1,2,3,4’ 30
13 END 44
2.Symbol Table:
SR. NO. LEBEL Value R/A
1 TEST 0 R
2 BEGIN 0 R
3 LOOP 8 R
4 DATA 30 R
3. Literal Table
SR.NO. LITERAL VALUE R/A
1 =F’10’ 32 R
2 =F’49’ 36 R
3 =F’4’ 40 R
4. Base Table
Sr. No. BASE VALUE CONTEXT
1 15 2
5. MACHINE CODE:
LC Instruction
0 BALR 15,0
2 SR 4,4
4 L 3,30(0,15)
8 L 2,28(4,15)
12 A 2,34(0,15)
16 ST 2,28(4,15)
20 A 4,38(0,15)
24 BCT 3,22(0,15)
28 BCR 15,14
32 10
36 49
40 4
44 1
48 2
52 3
-
6. Question 3: For the followig AL code,geerate the Symbol table,literal table,base table and machine
code using the 2 pass assembler algorithm.(Ref-1)
PROG START 0
BALR 15,0
USING *,15
LR 5,15
LH 1 DATA1
USING *,10
BR 14
DATA2 DC F’11’
DATA1 DC H’22’
TRS DC H’23’
BCK DS F
AA EQU 1
DP EQU 2
BALR 2,0
USING * + AA,TRS
LA 7,=A(BCK)
BR 6
DC H ‘64’
DROP DP
L 9=A(DATA1)
A 9 TRS
LTROG
ST Q=F’100
END
Solution:
1.Assign Location Counter
SR. NO. INSTRUCTIONS LC
1 PROG START 0 0
2 BALR 15,0 0
3 USING *,15 2
4 LR 5,15 2
5 LH 1 DATA1 4
6 USING *,10 8
7 BR 14 8
8 DATA2 DC F’11’ 12
9 DATA1 DC H’22’ 16
10 TRS DC H’23’ 20
11 BCK DS F 24
12 AA EQU 1 28
7. 13 DP EQU 2 28
14 BALR 2,0 28
15 USING * + AA,TRS 30
16 LA 7,=A(BCK) 30
17 BR 6 34
18 DC H ‘64’ 36
19 DROP DP 38
20 L 9=A(DATA1) 38
21 A 9 TRS 42
22 LTROG 48
23 ST Q=F’100 56
24 END 60
2.Symbol Table:
SR. NO. LEBEL Value R/A
1 PROG 0 R
2 DATA2 12 A
3 DATA1 16 A
4 TRS 20 A
5 BCK 24 A
6 AA 1 A
7 DP 2 R
3. Literal Table
SR.NO. LITERAL VALUE R/A
1 =A(BCK) 48 R
2 =A(DATA1) 52 R
3 =F’100’ 56 R
4. Base Table
Sr. No. BASE VALUE CONTEXT
1 15 2
2 10 8
3 23 30
9. Question 5: For the followig AL code,geerate the Symbol table,literal table,base table and machine
code using the 2 pass assembler algorithm.
Program START 0
USING *15
LA,15,SETUP
SR TOTAL ,TOTAL
AC EQU 2
INDEX EQU 3
TOTAL EQU 4
DATABASE EQU 13
SETUP EQU *
USING SETUP 15
L,DATABASE,=A(DATA1)
USING DATAAREA, DATABASE
SR INDEX,INDEX
LOOP L, AC DATA1(INDEX)
AR TOTAL AC
A,AC , F=’5’
ST AC SAVE(INDEX)
A INDEX=F’4’
C INDEX=F’8000’
BNE LOOP
LR 1,TOTAL
BR,14
LTROG
SAVE DS 2000F
DATAAREA EQA *
DATA1 DC F ‘25’,’26’,’97’,’101’...
[2000 numbers]
END
Solution:
1. Assign Location Counter (LC)
SR. NO. INSTRUCTION LC
1 Program START 0 0
2 USING *15 0
3 LA,15,SETUP 0
4 SR TOTAL ,TOTAL 4
5 AC EQU 2 6
6 INDEX EQU 3 6
7 TOTAL EQU 4 6
8 DATABASE EQU 13 6
9 SETUP EQU * 6
10 USING SETUP 15 6
11 L,DATABASE,=A(DATA1) 6
12 USING DATAAREA, DATABASE 10
13 SR INDEX,INDEX 10
10. 14 LOOP L, AC DATA1(INDEX) 12
15 AR TOTAL AC 16
16 A,AC , F=’5’ 18
17 ST AC SAVE(INDEX) 22
18 A INDEX=F’4’ 26
19 C INDEX=F’8000’ 30
20 BNE LOOP 34
21 LR 1,TOTAL 38
22 BR,14 40
23 LTROG 42
24 SAVE DS 2000F 64
25 DATAAREA EQA * 8064
26 DATA1 DC F ‘25’,’26’,’97’,’101’... 8064
27 [2000 numbers] 8068
28 END
2. SYMBOL TABLE
SR. NO. LEBEL Value R/A
1 PROGRAM 0 R
2 AC 2 A
3 INDEX 3 A
4 TOTAL 4 A
5 DATABASE 13 A
6 SETUP 6 A
7 LOOP 12 R
8 SAVE 64 R
9 DTA AREA 8064 A
10 DATA1 8064 R
3. LITERAL TABLE
SR.NO. LITERAL VALUE R/A
1 =A(DATA1) 48 R
2 =F ‘5’ 52 R
3 =F’4’ 56 R
4 =F ‘8000’ 16064 R
4.BASE TABLE
Sr. No. BASE VALUE CONTEXT
1 15 0
2 15 6
3 13 8064
5.MACHINE CODE:
11. LC Instruction
0 LA 15,6(0,15)
4 SR 4,4
6 L 13,42(0,15)
10 SR 3,3
12 L,2,0(3,13)
16 AR 4,2
18 A 2,8012(0,13)
22 ST 2,8000(3,13)
26 A 3,8000(0,13)
30 C 3,8004(0,13)
34 BC 7
38 LR 1,4
40 BCR 15,14
48 8064
52 5
56 6
60 8000
64 25
8064 26
8068 97
-
-