SlideShare a Scribd company logo
System Software –Module 1 second
half
MODULE 1-CST 305 SYSTEM
SOFTWARE
TARGET ADDRESS CALCULATION
Textbook
System software: an
introduction to
systems
programming,
Leland L. Beck, 3rd
Edition, Addison
Wesley, Longman
Inc., 1997.
Fall 2014 CC 215 Data Structures 2
5
1.3.3 SIC Programming Examples
• Sample data movement operations
– No memory-to-memory move instructions
6
1.3.3 SIC/XE Programming Examples
7
1.3.3 SIC Programming Examples
• Sample arithmetic operations
– (ALPHA+INCR-1) assign to BETA (Fig. 1.3)
– (GAMMA+INCR-1) assign to DELTA
8
1.3.3 SIC/XE Programming Examples
9
1.3.3 SIC Programming Examples
• String copy Initialise the loop before entering
Index in the string
Increment by one index register
X, compare with operand (11)
and update condition code (CC)
Jump to beginning of loop, if CC
is LT (Less Than)
10
1.3.3 SIC/XE Programming Examples
11
1.3.3 SIC Programming Examples
12
1.3.3 SIC/XE Programming Examples
13
1.3.3 SIC Programming Examples
14
1.3.3 SIC Programming Examples
15
1.3.3 SICXE Programming Examples
• 1. Write a sequence of instructions for SIC to
compute ALPHA equal to the product of BETA
and GAMMA.
LDA BETA
MUL GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
• 2. Write a sequence of instructions for SIC/XE to
set ALPHA equal to 4 * BETA-9
• Use immediate addressing for the constants.
LDA BETA
LDS #4
MULR S,A
SUB #9
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
• 3. Write SIC instructions to swap the values of ALPHA
and BETA.
LDA ALPHA
STA GAMMA
LDA BETA
STA ALPHA
LDA GAMMA
STA BETA
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
• 4. Write a sequence of instructions for SIC to set
ALPHA equal to the integer portion of BETA ÷
GAMMA.
LDA BETA
DIV GAMMA
STA ALPHA
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
• 5. Write a sequence of instructions for SIC/XE to divide
BETA by GAMMA, setting ALPHA to the integer portion
of the quotient and DELTA to the remainder. Use
register-to-register instructions to make the calculation
as efficient as possible.
LDA BETA
LDS GAMMA
DIVR S, A
STA ALPHA
MULR S, A
LDS BETA
SUBR A, S
STS DELTA
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
DELTA RESW 1
• 6. Write a sequence of instructions for SIC/XE to divide
BETA by GAMMA, setting ALPHA to the value of the
quotient, rounded to the nearest integer. Use register-to-
register instructions to make the calculation as efficient
as possible.
LDF BETA
DIVF GAMMA
FIX
STA ALPHA
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
• 7. Write a sequence of instructions for SIC to clear a 20-
byte string to all blanks.
LDX ZERO
LOOP LDCH BLANK
STCH STR1,X
TIX TWENTY
JLT LOOP
:
STR1 RESW 20
BLANK BYTE C “ “
ZERO WORD 0
TWENTY WORD 20
• 8. Write a sequence of instructions for SIC/XE to
clear a 20-byte string to all blanks. Use
immediate addressing and register-to-register
instructions to make the process as efficient as
possible.
LDT #20
LDX #0
LOOP LDCH #0
STCH STR1,X
TIXR T
JLT LOOP
:
STR1 RESW 20
•
• 9. Suppose that ALPHA is an array of 100 words. Write
a sequence of instructions for SIC to set all 100
elements of the array to 0.
LDA ZERO
STA INDEX
LOOP LDX INDEX
LDA ZERO
STA ALPHA, X
LDA INDEX
ADD THREE
STA INDEX
COMP K300
TIX TWENTY
JLT LOOP
:
INDEX RESW 1
ALPHA RESW 100
ZERO WORD 0
K300 WORD 100
THREE WORD 3
• 10. Suppose that ALPHA is an array of 100 words.Write
a sequence of instructions for SIC/XE to set all 100
elements of the array to 0. Use immediate addressing
and register-to-register instructions to make the process
as efficient as possible.
LDS #3
LDT #300
LDX #0
LOOP LDA #0
STA ALPHA, X
ADDR S, X
COMPR X, T
JLT LOOP
:
ALPHA RESW 100
• 12. Suppose that ALPHA and BETA are the two arrays of 100
words. Another array of GAMMA elements are obtained by
multiplying the corresponding ALPHA element by 4 and adding the
corresponding BETA elements.
LDS #3
LDT #300
LDX #0
ADDLOOP LDA ALPHA, X
MUL #4
ADD BETA, X
STA GAMMA, X
ADDR S, X
COMPR X, T
JLT ADDLOOP
:
ALPHA RESW 100
BETA RESW 100
GAMMA RESW 100
• 13. Suppose that ALPHA is an array of 100 words. Write a
sequence of instructions for SIC/XE to find the maximum element in
the array and store results in MAX.
LDS #3
LDT #300
LDX #0
CLOOP LDA ALPHA, X
COMP MAX
JLT NOCH
STA MAX
NOCH ADDR S, X
COMPR X, T
JLT CLOOP
:
ALPHA RESW 100
MAX WORD -32768
• 14. Suppose that RECORD contains a 100-byte record. Write a
subroutine for SIC that will write this record on to device 05.
JSUB WRREC
:
WRREC LDX ZERO
WLOOP TD OUTPUT
JEQ WLOOP
LDCH RECORD, X
WD OUTPUT
TIX LENGTH
JLT WLOOP
RSUB
:
ZERO WORD 0
LENGTH WORD 1
OUTPUT BYTE X “05‟
RECORD RESB 100
/
• 15. Suppose that RECORD contains a 100-byte record,.
Write a subroutine for SIC/XE that will write this record
on to device 05.
JSUB WRREC
:
WRREC LDX #0
LDT #100
WLOOP TD OUTPUT
JEQ WLOOP
LDCH RECORD, X
WD OUTPUT
TIXR T
JLT WLOOP
RSUB
:
OUTPUT BYTE X ’05’
RECORD RESB 100
• 16. Write a subroutine for SIC that will read a record into a buffer. The record may be any length
from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The
subroutine should place the length of the record read into a variable named LENGTH.
JSUB RDREC
:
RDREC LDX ZERO
RLOOP TD INDEV
JEQ RLOOP
RD INDEV
COMP NULL
JEQ EXIT
STCH BUFFER, X
TIX K100
JLT RLOOP
EXIT STX LENGTH
RSUB
:
ZERO WORD 0
NULL WORD 0
K100 WORD 1INDEV
BYTE X ‘F1’
LENGTH RESW 1
BUFFER RESB 100
• 17. Write a subroutine for SIC/XE that will read a record into a buffer. The record may
be any length from 1 to 100 bytes. The end of record is marked with a “null” character
(ASCII code 00). The subroutine should place the length of the record read into a
variable named LENGTH. Use immediate addressing and register-to-register
instructions to make the process as efficient as possible.
JSUB RDREC
:
RDREC LDX #0
LDT #100
LDS #0
RLOOP TD INDEV
JEQ RLOOP
RD INDEV
COMPR A, S
JEQ EXIT
STCH BUFFER, X
TIXR T
JLT RLOOP
EXIR STX LENGTH
RSUB
:
INDEV BYTE X ‘F1’
LENGTH RESW 1
BUFFER RESB 100
•
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx

More Related Content

Similar to Module 1-System Software PROGRAMS.pptx

Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Mahalakshmiv11
 
Computer Architecture Assignment Help
Computer Architecture Assignment HelpComputer Architecture Assignment Help
Computer Architecture Assignment Help
Architecture Assignment Help
 
lec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdflec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdf
hasan58964
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
inian2
 
8086 alp
8086 alp8086 alp
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
techbed
 
Assembly language programs
Assembly language programsAssembly language programs
Assembly language programs
HarshitParkar6677
 
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docxCSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
faithxdunce63732
 
8086 arch instns
8086 arch instns8086 arch instns
8086 arch instnsRam Babu
 
Computer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesComputer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notes
Lakshmi Sarvani Videla
 
Assembly Complete 8086 Instruction Set
Assembly Complete 8086 Instruction SetAssembly Complete 8086 Instruction Set
Assembly Complete 8086 Instruction Set
Darian Pruitt
 
Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptx
HebaEng
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Vijay Kumar
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
AmitPaliwal20
 

Similar to Module 1-System Software PROGRAMS.pptx (20)

Csd01
Csd01Csd01
Csd01
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Computer Architecture Assignment Help
Computer Architecture Assignment HelpComputer Architecture Assignment Help
Computer Architecture Assignment Help
 
lec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdflec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdf
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
 
Wk1to4
Wk1to4Wk1to4
Wk1to4
 
8086 alp
8086 alp8086 alp
8086 alp
 
Lecture5
Lecture5Lecture5
Lecture5
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
 
Exp 03
Exp 03Exp 03
Exp 03
 
Assembly language programs
Assembly language programsAssembly language programs
Assembly language programs
 
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docxCSC8503 Principles of Programming Languages Semester 1, 2015.docx
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
 
8086 arch instns
8086 arch instns8086 arch instns
8086 arch instns
 
Computer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesComputer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notes
 
Assembly Complete 8086 Instruction Set
Assembly Complete 8086 Instruction SetAssembly Complete 8086 Instruction Set
Assembly Complete 8086 Instruction Set
 
Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptx
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
 

More from ssuser47f7f2

rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
ssuser47f7f2
 
Lecture7x.ppt
Lecture7x.pptLecture7x.ppt
Lecture7x.ppt
ssuser47f7f2
 
NORMAL-FORMS.ppt
NORMAL-FORMS.pptNORMAL-FORMS.ppt
NORMAL-FORMS.ppt
ssuser47f7f2
 
functions (1).pptx
functions (1).pptxfunctions (1).pptx
functions (1).pptx
ssuser47f7f2
 
09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf
ssuser47f7f2
 
Module 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptxModule 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptx
ssuser47f7f2
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
ssuser47f7f2
 
15159222.ppt
15159222.ppt15159222.ppt
15159222.ppt
ssuser47f7f2
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
ssuser47f7f2
 
module1 network security.pdf
module1 network security.pdfmodule1 network security.pdf
module1 network security.pdf
ssuser47f7f2
 

More from ssuser47f7f2 (10)

rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
 
Lecture7x.ppt
Lecture7x.pptLecture7x.ppt
Lecture7x.ppt
 
NORMAL-FORMS.ppt
NORMAL-FORMS.pptNORMAL-FORMS.ppt
NORMAL-FORMS.ppt
 
functions (1).pptx
functions (1).pptxfunctions (1).pptx
functions (1).pptx
 
09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf
 
Module 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptxModule 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptx
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
 
15159222.ppt
15159222.ppt15159222.ppt
15159222.ppt
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
module1 network security.pdf
module1 network security.pdfmodule1 network security.pdf
module1 network security.pdf
 

Recently uploaded

Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 

Recently uploaded (20)

Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 

Module 1-System Software PROGRAMS.pptx

  • 1. System Software –Module 1 second half MODULE 1-CST 305 SYSTEM SOFTWARE TARGET ADDRESS CALCULATION
  • 2. Textbook System software: an introduction to systems programming, Leland L. Beck, 3rd Edition, Addison Wesley, Longman Inc., 1997. Fall 2014 CC 215 Data Structures 2
  • 3.
  • 4.
  • 5. 5 1.3.3 SIC Programming Examples • Sample data movement operations – No memory-to-memory move instructions
  • 7. 7 1.3.3 SIC Programming Examples • Sample arithmetic operations – (ALPHA+INCR-1) assign to BETA (Fig. 1.3) – (GAMMA+INCR-1) assign to DELTA
  • 9. 9 1.3.3 SIC Programming Examples • String copy Initialise the loop before entering Index in the string Increment by one index register X, compare with operand (11) and update condition code (CC) Jump to beginning of loop, if CC is LT (Less Than)
  • 16. • 1. Write a sequence of instructions for SIC to compute ALPHA equal to the product of BETA and GAMMA. LDA BETA MUL GAMMA STA ALPHA : : ALPHA RESW 1 BETA RESW 1 GAMMA RESW 1
  • 17. • 2. Write a sequence of instructions for SIC/XE to set ALPHA equal to 4 * BETA-9 • Use immediate addressing for the constants. LDA BETA LDS #4 MULR S,A SUB #9 STA ALPHA : : ALPHA RESW 1 BETA RESW 1
  • 18. • 3. Write SIC instructions to swap the values of ALPHA and BETA. LDA ALPHA STA GAMMA LDA BETA STA ALPHA LDA GAMMA STA BETA : ALPHA RESW 1 BETA RESW 1 GAMMA RESW 1
  • 19. • 4. Write a sequence of instructions for SIC to set ALPHA equal to the integer portion of BETA ÷ GAMMA. LDA BETA DIV GAMMA STA ALPHA : ALPHA RESW 1 BETA RESW 1 GAMMA RESW 1
  • 20. • 5. Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting ALPHA to the integer portion of the quotient and DELTA to the remainder. Use register-to-register instructions to make the calculation as efficient as possible. LDA BETA LDS GAMMA DIVR S, A STA ALPHA MULR S, A LDS BETA SUBR A, S STS DELTA : ALPHA RESW 1 BETA RESW 1 GAMMA RESW 1 DELTA RESW 1
  • 21. • 6. Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting ALPHA to the value of the quotient, rounded to the nearest integer. Use register-to- register instructions to make the calculation as efficient as possible. LDF BETA DIVF GAMMA FIX STA ALPHA : ALPHA RESW 1 BETA RESW 1 GAMMA RESW 1
  • 22. • 7. Write a sequence of instructions for SIC to clear a 20- byte string to all blanks. LDX ZERO LOOP LDCH BLANK STCH STR1,X TIX TWENTY JLT LOOP : STR1 RESW 20 BLANK BYTE C “ “ ZERO WORD 0 TWENTY WORD 20
  • 23. • 8. Write a sequence of instructions for SIC/XE to clear a 20-byte string to all blanks. Use immediate addressing and register-to-register instructions to make the process as efficient as possible. LDT #20 LDX #0 LOOP LDCH #0 STCH STR1,X TIXR T JLT LOOP : STR1 RESW 20 •
  • 24. • 9. Suppose that ALPHA is an array of 100 words. Write a sequence of instructions for SIC to set all 100 elements of the array to 0. LDA ZERO STA INDEX LOOP LDX INDEX LDA ZERO STA ALPHA, X LDA INDEX ADD THREE STA INDEX COMP K300 TIX TWENTY JLT LOOP : INDEX RESW 1 ALPHA RESW 100 ZERO WORD 0 K300 WORD 100 THREE WORD 3
  • 25. • 10. Suppose that ALPHA is an array of 100 words.Write a sequence of instructions for SIC/XE to set all 100 elements of the array to 0. Use immediate addressing and register-to-register instructions to make the process as efficient as possible. LDS #3 LDT #300 LDX #0 LOOP LDA #0 STA ALPHA, X ADDR S, X COMPR X, T JLT LOOP : ALPHA RESW 100
  • 26. • 12. Suppose that ALPHA and BETA are the two arrays of 100 words. Another array of GAMMA elements are obtained by multiplying the corresponding ALPHA element by 4 and adding the corresponding BETA elements. LDS #3 LDT #300 LDX #0 ADDLOOP LDA ALPHA, X MUL #4 ADD BETA, X STA GAMMA, X ADDR S, X COMPR X, T JLT ADDLOOP : ALPHA RESW 100 BETA RESW 100 GAMMA RESW 100
  • 27. • 13. Suppose that ALPHA is an array of 100 words. Write a sequence of instructions for SIC/XE to find the maximum element in the array and store results in MAX. LDS #3 LDT #300 LDX #0 CLOOP LDA ALPHA, X COMP MAX JLT NOCH STA MAX NOCH ADDR S, X COMPR X, T JLT CLOOP : ALPHA RESW 100 MAX WORD -32768
  • 28. • 14. Suppose that RECORD contains a 100-byte record. Write a subroutine for SIC that will write this record on to device 05. JSUB WRREC : WRREC LDX ZERO WLOOP TD OUTPUT JEQ WLOOP LDCH RECORD, X WD OUTPUT TIX LENGTH JLT WLOOP RSUB : ZERO WORD 0 LENGTH WORD 1 OUTPUT BYTE X “05‟ RECORD RESB 100
  • 29. / • 15. Suppose that RECORD contains a 100-byte record,. Write a subroutine for SIC/XE that will write this record on to device 05. JSUB WRREC : WRREC LDX #0 LDT #100 WLOOP TD OUTPUT JEQ WLOOP LDCH RECORD, X WD OUTPUT TIXR T JLT WLOOP RSUB : OUTPUT BYTE X ’05’ RECORD RESB 100
  • 30. • 16. Write a subroutine for SIC that will read a record into a buffer. The record may be any length from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The subroutine should place the length of the record read into a variable named LENGTH. JSUB RDREC : RDREC LDX ZERO RLOOP TD INDEV JEQ RLOOP RD INDEV COMP NULL JEQ EXIT STCH BUFFER, X TIX K100 JLT RLOOP EXIT STX LENGTH RSUB : ZERO WORD 0 NULL WORD 0 K100 WORD 1INDEV BYTE X ‘F1’ LENGTH RESW 1 BUFFER RESB 100
  • 31. • 17. Write a subroutine for SIC/XE that will read a record into a buffer. The record may be any length from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The subroutine should place the length of the record read into a variable named LENGTH. Use immediate addressing and register-to-register instructions to make the process as efficient as possible. JSUB RDREC : RDREC LDX #0 LDT #100 LDS #0 RLOOP TD INDEV JEQ RLOOP RD INDEV COMPR A, S JEQ EXIT STCH BUFFER, X TIXR T JLT RLOOP EXIR STX LENGTH RSUB : INDEV BYTE X ‘F1’ LENGTH RESW 1 BUFFER RESB 100 •