SlideShare a Scribd company logo
3
Most read
5
Most read
7
Most read
Topic: Assembler Numerical in System Programming
Author Name: Pratibha Paras waghale
(Assistant Professor-CSE)
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.
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. 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
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
-
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
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
5. MACHINE CODE:
LC Instruction
0 BALR 15,0
2 LR 5,15
4 LH 1,14(0,15)
8 ACR 15,14
12 11
16 22
20 23
24 -
28 BALR 2,0
30 LA 7,17(0,23)
34 BCR 15,6
36 64
38 L 9,21(0,23)
42 A 9,20
48 24
52 16
56 100
60 ST Q,25(0,23)
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
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:
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
-
-
References:
1.https://www.youtube.com/watch?v=gN4ZZ3SE2T8

More Related Content

What's hot (20)

PPTX
Assembler numericals by aniket bhute
Aniket Bhute
 
PPTX
File Handling and Command Line Arguments in C
Mahendra Yadav
 
PPTX
Linker and Loader
sonalikharade3
 
PDF
Examinable Question and answer system programming
Makerere university
 
PPTX
MACRO PROCESSOR
Bhavik Vashi
 
PDF
Linux Porting
Champ Yen
 
PPT
Query optimization and processing for advanced database systems
meharikiros2
 
PPT
Class and object in C++
rprajat007
 
PPT
Linux SD/MMC Driver Stack
Champ Yen
 
PPTX
Assembler1
jayashri kolekar
 
PPTX
THREADS IN OPERATING SYSTEM BIKASH.pptx
DevishreeRout
 
PPTX
Unit 2.2. Buffer Cache.pptx (Introduction to Buffer Chache)
AnilkumarBrahmane2
 
PPTX
Unit 3 sp assembler
Deepmala Sharma
 
PDF
Macro-processor
Temesgen Molla
 
PPTX
Macro Processor
Saranya1702
 
PDF
Pci express modi
proma_goswami
 
PPTX
Bus aribration
Saiyam Agrawal
 
PPTX
Sql fundamentals
Ravinder Kamboj
 
PPTX
Abstract method
Yaswanth Babu Gummadivelli
 
Assembler numericals by aniket bhute
Aniket Bhute
 
File Handling and Command Line Arguments in C
Mahendra Yadav
 
Linker and Loader
sonalikharade3
 
Examinable Question and answer system programming
Makerere university
 
MACRO PROCESSOR
Bhavik Vashi
 
Linux Porting
Champ Yen
 
Query optimization and processing for advanced database systems
meharikiros2
 
Class and object in C++
rprajat007
 
Linux SD/MMC Driver Stack
Champ Yen
 
Assembler1
jayashri kolekar
 
THREADS IN OPERATING SYSTEM BIKASH.pptx
DevishreeRout
 
Unit 2.2. Buffer Cache.pptx (Introduction to Buffer Chache)
AnilkumarBrahmane2
 
Unit 3 sp assembler
Deepmala Sharma
 
Macro-processor
Temesgen Molla
 
Macro Processor
Saranya1702
 
Pci express modi
proma_goswami
 
Bus aribration
Saiyam Agrawal
 
Sql fundamentals
Ravinder Kamboj
 

Similar to Assembler Numerical in system programming (20)

PPTX
3.ASSEMBLERS.pptx
GaganaP13
 
PDF
SOLUTION MANUAL OF COMPUTER ORGANIZATION BY CARL HAMACHER, ZVONKO VRANESIC & ...
vtunotesbysree
 
PDF
Eee316: Logical Instructions, Jump Commands, LOOPs and Arrays in Assembly Lan...
Musbiha Binte Wali
 
DOC
35787646 system-software-lab-manual
Naveen Kumar
 
PPTX
Assemblers
Dattatray Gandhmal
 
PPTX
UNit-4.pptx programming the basic computer
desaihardee24
 
PPT
Assemblers: Ch03
desta_gebre
 
PDF
8085 Assembly language programs.pdf
RahulMishra122561
 
PPTX
Assembler - System Programming
Radhika Talaviya
 
PPTX
Micro task1
ChetanShahukari
 
PDF
Unit01_Session_07.pdf
Sanjay Gunjal
 
PDF
Introduction to ibm pc assembly language
warda aziz
 
PDF
Programming the Basic Computer and Assembler
Mitul Patel
 
PDF
Mpmc lab
anveshthatikonda
 
DOCX
IMP questions for System programming for GTU
Paras Patel
 
PDF
Handout#06
Sunita Milind Dol
 
PPTX
SPOS UNIT1 PPTS (1).pptx
RavishankarBhaganaga
 
PDF
Presentation1.pdf
GauravChaudhary531452
 
3.ASSEMBLERS.pptx
GaganaP13
 
SOLUTION MANUAL OF COMPUTER ORGANIZATION BY CARL HAMACHER, ZVONKO VRANESIC & ...
vtunotesbysree
 
Eee316: Logical Instructions, Jump Commands, LOOPs and Arrays in Assembly Lan...
Musbiha Binte Wali
 
35787646 system-software-lab-manual
Naveen Kumar
 
Assemblers
Dattatray Gandhmal
 
UNit-4.pptx programming the basic computer
desaihardee24
 
Assemblers: Ch03
desta_gebre
 
8085 Assembly language programs.pdf
RahulMishra122561
 
Assembler - System Programming
Radhika Talaviya
 
Micro task1
ChetanShahukari
 
Unit01_Session_07.pdf
Sanjay Gunjal
 
Introduction to ibm pc assembly language
warda aziz
 
Programming the Basic Computer and Assembler
Mitul Patel
 
IMP questions for System programming for GTU
Paras Patel
 
Handout#06
Sunita Milind Dol
 
SPOS UNIT1 PPTS (1).pptx
RavishankarBhaganaga
 
Presentation1.pdf
GauravChaudhary531452
 
Ad

Recently uploaded (20)

PDF
UNIT-4-FEEDBACK AMPLIFIERS AND OSCILLATORS (1).pdf
Sridhar191373
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PDF
BioSensors glucose monitoring, cholestrol
nabeehasahar1
 
PPTX
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PDF
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PDF
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
Electron Beam Machining for Production Process
Rajshahi University of Engineering & Technology(RUET), Bangladesh
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
drones for disaster prevention response.pptx
NawrasShatnawi1
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PPT
inherently safer design for engineering.ppt
DhavalShah616893
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
UNIT-4-FEEDBACK AMPLIFIERS AND OSCILLATORS (1).pdf
Sridhar191373
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
BioSensors glucose monitoring, cholestrol
nabeehasahar1
 
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
Thermal runway and thermal stability.pptx
godow93766
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Electron Beam Machining for Production Process
Rajshahi University of Engineering & Technology(RUET), Bangladesh
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
drones for disaster prevention response.pptx
NawrasShatnawi1
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
inherently safer design for engineering.ppt
DhavalShah616893
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
Ad

Assembler Numerical in system programming

  • 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
  • 8. 5. MACHINE CODE: LC Instruction 0 BALR 15,0 2 LR 5,15 4 LH 1,14(0,15) 8 ACR 15,14 12 11 16 22 20 23 24 - 28 BALR 2,0 30 LA 7,17(0,23) 34 BCR 15,6 36 64 38 L 9,21(0,23) 42 A 9,20 48 24 52 16 56 100 60 ST Q,25(0,23)
  • 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 - -