SlideShare a Scribd company logo
3
Most read
4
Most read
GANDHINAGAR INSTITUTE OF TECHNOLOGY
Computer Engineering Department
Computer Organization(2140707)
Programming the basic computer :
Machine language, Assembly language, Assembler
and passes of assembler.
PREPARED BY:
Maitri Thakkar9150120107064)
GUIDED BY:
Prof. Raxit Jani
INTRODUCTION
 A computer system includes both hardware
and software. The designer should be
familiar with both of them.
 This chapter introduces some basic
programming concepts and shows their
relation to the hardware representation of
instructions.
 A program may be : dependent or
independent on the computer that runs it.
MACHINE LANGUAGE
 Program: A list of instructions that direct the
computer to perform a data processing task.
 There are many programming languages (C++,
JAVA). However, the computer executes programs
when they are represented internally in binary form.
 Categories of Programs:
 Machine Language:
• Binary Code
• Octal or hexadecimal code
 Assembly Language:
• Symbolic code
 High level programming languages
INSTRUCTION SET OF THE BASIC COMPUTER:
Symbol Hex code Description
 AND 0 or 8 AND M to AC
 ADD 1 or 9 Add M to AC, carry to E
 LDA 2 or A Load AC from M
 STA 3 or B Store AC in M
 BUN 4 or C Branch unconditionally to m
 BSA 5 or D Save return address in m and
branch to m+1
 ISZ 6 or E Increment M and skip if zero
 CLA 7800 Clear AC
 CLE 7400 Clear E
 CMA 7200 Complement AC
 CME 7100 Complement E
 CIR 7080 Circulate right E and AC
 CIL 7040 Circulate left E and AC
 INC 7020 Increment AC, carry to E
 SPA 7010 Skip if AC is positive
 SNA 7008 Skip if AC is negative
 SZA 7004 Skip if AC is zero
 SZE 7002 Skip if E is zero
 HLT 7001 Halt computer
 INP F800 Input information and clear
flag
 OUT F400 Output information and clear
flag
 SKI F200 Skip if input flag is on
 SKO F100 Skip if output flag is on
 ION F080 Turn interrupt on
 IOF F040 Turn interrupt off
Here,
m: effective address
M: memory word
(operand) found at
m.
BINARY PROGRAM TO ADD
TWO NUMBERS:
Location Instruction Code
0 0010 0000 0000 0100
1 0001 0000 0000 0101
10 0011 0000 0000 0110
11 0111 0000 0000 0001
100 0000 0000 0101 0011
101 1111 1111 1110 1001
110 0000 0000 0000 0000
HEXADECIMAL PROGRAM
TO ADD TWO NUMBERS:
Location Instruction
000 2004
001 1005
002 3006
003 7001
004 0053
005 FFE9
006 0000
PROGRAM WITH
SYMBOLIC OPCODE:
Location Instruction Comments
000 LDA 004 Load 1st operand into
001 ADD 005 Add 2nd operand to AC
002 STA 006 Store sum in location 0
003 HLT Halt computer
004 0053 1st operand
005 FFE9 2nd operand (negative)
006 0000 Store sum here
FORTRAN PROGRAM:
INTEGER A, B, C
DATA A,83 / B,-23
C = A + B
END
ASSEMBLY LEVEL LANGUAGE
 The symbolic program(contains letters, numerals or
special characters) is referred to as an assembly
language program.
 The basic unit of an assembly language program is
a line of code.
 Each line of assembly language program is
arranged in three columns called fields:
 The label field may be empty or it may contain a
symbolic address of up to 3 characters.
 The instruction field specifies a machine instruction or a
pseudo instruction.
 The comment field may be empty or it may include a
comment.
INSTRUCTION FIELD:
 Instruction field in an assembly level language may
specify one of the following three items:
 A memory-reference instruction(MRI) : MRI consist of
two or three symbols separated by spaces.
 ADD OPR (direct address MRI)
 ADD PTR I (indirect address MRI)
 A register-reference or input-output instruction(Non-
MRI) : Non MRI instructions do not have an address
part.
 Pseudo instruction with or without operand : Symbolic
address used in the instruction field must be defined
somewhere as a label.
PSEUDO INSTRUCTION:
 Pseudo instruction is not a machine instruction but
rather an instruction to the assembler giving
information about some phase of translation.
 Four pseudo instructions that are recognized by an
assembler are:
 ORG N : Hexadecimal number N is the memory loc. for
the instruction or operand listed in the following line.
 END : Denotes the end of symbolic program.
 DEC N : Signed decimal number N to be converted to
binary.
 HEX N : Hexadecimal number N to be converted to
binary.
ASSEMBLER:
 An assembler is a program that accepts a symbolic
language program and produces its binary machine
language equivalent.
 The input symbolic program is called the source
program and the output binary program is called the
output program.
 The assembler is a program that operates on
character strings and produces an equivalent binary
interpretation.
FIRST PASS OF AN ASSEMBLER:
 During the first pass, the assembler
generates a table that corelates all user-
defined address symbols with their binary
equivalent value.
LC := 0
Scan next line of code Set LC
Label
no
yes
yes
no
ORG
Store symbol
in address-
symbol table
together with
value of LC
END
Increment LC
Go to
second
pass
no
yes
SECOND PASS :
Second pass
LC <- 0
Scan next line of code
Set LC
yes
yes
ORGPseudo
instr.
yes
END
no
Done
yes
MRI
no
Valid
non-MRI
instr.
no
Convert
operand
to binary
and store
in location
given by LC
no
DEC or
HEX
Error in
line of
code
Store binary
equivalent of
instruction
in location
given by LC
yes
no
Get operation code
and set bits 2-4
Search address-
symbol table for
binary equivalent
of symbol address
and set bits 5-16
I
Set
first
bit to 0
Set
first
bit to 1
yes no
Assemble all parts of
binary instruction and
store in location given by LC
Increment LC
The binary
Translation is
done during the
second pass.
Computer Organization - Programming the basic computer : Machine Language, Assembly Language and Assembler
Ad

Recommended

Assembly Language Programming
Assembly Language Programming
Niropam Das
 
Basic Synthesis Flow and Commands, Logic Synthesis
Basic Synthesis Flow and Commands, Logic Synthesis
Jason J Pulikkottil
 
8085 full discription
8085 full discription
Kartik Kalpande Patil
 
Mvs commands
Mvs commands
Maintec Technologies Inc.
 
Contamination delay
Contamination delay
Nima Afraz
 
Unit ii.arc of tms320 c5 xx
Unit ii.arc of tms320 c5 xx
Principal,Guru Nanak Institute of Technology, Nagpur
 
Ipl process
Ipl process
Thousif "[email protected]"
 
Fox pro 2.6
Fox pro 2.6
SRI SAIRAM INSTITUTE OF TECHNOLOGY, CHENNAI
 
Computer Oragnization Flipflops
Computer Oragnization Flipflops
Vanitha Chandru
 
Instruction codes and computer registers
Instruction codes and computer registers
Sanjeev Patel
 
100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPS
Nirmal Pati
 
Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
Ece formula sheet
Ece formula sheet
Manasa Mona
 
Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
Mohammad Bashartullah
 
optimazation of standard cell layout
optimazation of standard cell layout
E ER Yash nagaria
 
ARM architcture
ARM architcture
Hossam Adel
 
digital computers
digital computers
HumaKhan156
 
Assembly Language
Assembly Language
Ibrahimcommunication Al Ani
 
Design and Implementation of GCC Register Allocation
Design and Implementation of GCC Register Allocation
Kito Cheng
 
Unsigned and Signed fixed point Addition and subtraction
Unsigned and Signed fixed point Addition and subtraction
ciyamala kushbu
 
Subtractor
Subtractor
Syed Saeed
 
z/OS Communications Server: z/OS Resolver
z/OS Communications Server: z/OS Resolver
zOSCommserver
 
Basic_Layout_Techniques.pdf
Basic_Layout_Techniques.pdf
Seenivasanphd
 
Operating system 03 handling of interrupts
Operating system 03 handling of interrupts
Vaibhav Khanna
 
Assembly language
Assembly language
shashank puthran
 
Floating point arithmetic
Floating point arithmetic
vishal choudhary
 
Von-Neumann machine and IAS architecture
Von-Neumann machine and IAS architecture
Shishir Aryal
 
Computer Aided Design: Global Routing
Computer Aided Design: Global Routing
Team-VLSI-ITMU
 
Computer Organization
Computer Organization
Radhika Talaviya
 
Programming the basic computer
Programming the basic computer
Kamal Acharya
 

More Related Content

What's hot (20)

Computer Oragnization Flipflops
Computer Oragnization Flipflops
Vanitha Chandru
 
Instruction codes and computer registers
Instruction codes and computer registers
Sanjeev Patel
 
100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPS
Nirmal Pati
 
Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
Ece formula sheet
Ece formula sheet
Manasa Mona
 
Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
Mohammad Bashartullah
 
optimazation of standard cell layout
optimazation of standard cell layout
E ER Yash nagaria
 
ARM architcture
ARM architcture
Hossam Adel
 
digital computers
digital computers
HumaKhan156
 
Assembly Language
Assembly Language
Ibrahimcommunication Al Ani
 
Design and Implementation of GCC Register Allocation
Design and Implementation of GCC Register Allocation
Kito Cheng
 
Unsigned and Signed fixed point Addition and subtraction
Unsigned and Signed fixed point Addition and subtraction
ciyamala kushbu
 
Subtractor
Subtractor
Syed Saeed
 
z/OS Communications Server: z/OS Resolver
z/OS Communications Server: z/OS Resolver
zOSCommserver
 
Basic_Layout_Techniques.pdf
Basic_Layout_Techniques.pdf
Seenivasanphd
 
Operating system 03 handling of interrupts
Operating system 03 handling of interrupts
Vaibhav Khanna
 
Assembly language
Assembly language
shashank puthran
 
Floating point arithmetic
Floating point arithmetic
vishal choudhary
 
Von-Neumann machine and IAS architecture
Von-Neumann machine and IAS architecture
Shishir Aryal
 
Computer Aided Design: Global Routing
Computer Aided Design: Global Routing
Team-VLSI-ITMU
 
Computer Oragnization Flipflops
Computer Oragnization Flipflops
Vanitha Chandru
 
Instruction codes and computer registers
Instruction codes and computer registers
Sanjeev Patel
 
100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPS
Nirmal Pati
 
Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
Ece formula sheet
Ece formula sheet
Manasa Mona
 
Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
Mohammad Bashartullah
 
optimazation of standard cell layout
optimazation of standard cell layout
E ER Yash nagaria
 
ARM architcture
ARM architcture
Hossam Adel
 
digital computers
digital computers
HumaKhan156
 
Design and Implementation of GCC Register Allocation
Design and Implementation of GCC Register Allocation
Kito Cheng
 
Unsigned and Signed fixed point Addition and subtraction
Unsigned and Signed fixed point Addition and subtraction
ciyamala kushbu
 
z/OS Communications Server: z/OS Resolver
z/OS Communications Server: z/OS Resolver
zOSCommserver
 
Basic_Layout_Techniques.pdf
Basic_Layout_Techniques.pdf
Seenivasanphd
 
Operating system 03 handling of interrupts
Operating system 03 handling of interrupts
Vaibhav Khanna
 
Von-Neumann machine and IAS architecture
Von-Neumann machine and IAS architecture
Shishir Aryal
 
Computer Aided Design: Global Routing
Computer Aided Design: Global Routing
Team-VLSI-ITMU
 

Similar to Computer Organization - Programming the basic computer : Machine Language, Assembly Language and Assembler (20)

Computer Organization
Computer Organization
Radhika Talaviya
 
Programming the basic computer
Programming the basic computer
Kamal Acharya
 
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Rai University
 
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
Rai University
 
Mca i-u-3-basic computer programming and micro programmed control
Mca i-u-3-basic computer programming and micro programmed control
Rai University
 
basic computer programming and micro programmed control
basic computer programming and micro programmed control
Rai University
 
Programming the Basic Computer and Assembler
Programming the Basic Computer and Assembler
Mitul Patel
 
EC8691-MPMC-PPT.pptx
EC8691-MPMC-PPT.pptx
Manikandan813397
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
ishitasabrincse
 
CH-3 CO-all-about-operating-system(Update).pptx
CH-3 CO-all-about-operating-system(Update).pptx
XyzXyz338506
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
CH06 (1).PPT
CH06 (1).PPT
RaghadAbuJelban
 
Unit 3 assembler and processor
Unit 3 assembler and processor
Abha Damani
 
Assembly Language Basics
Assembly Language Basics
Education Front
 
SPOS UNIT1 PPTS (1).pptx
SPOS UNIT1 PPTS (1).pptx
RavishankarBhaganaga
 
Instruction Set Architecture
Instruction Set Architecture
Dilum Bandara
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
Programming basic computer
Programming basic computer
Martial Kouadio
 
microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
PriyankaRana171346
 
8051assembly language
8051assembly language
Hisham Mat Hussin
 
Programming the basic computer
Programming the basic computer
Kamal Acharya
 
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Bca 2nd sem-u-3.1-basic computer programming and micro programmed control
Rai University
 
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
B.sc cs-ii-u-3.1-basic computer programming and micro programmed control
Rai University
 
Mca i-u-3-basic computer programming and micro programmed control
Mca i-u-3-basic computer programming and micro programmed control
Rai University
 
basic computer programming and micro programmed control
basic computer programming and micro programmed control
Rai University
 
Programming the Basic Computer and Assembler
Programming the Basic Computer and Assembler
Mitul Patel
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
ishitasabrincse
 
CH-3 CO-all-about-operating-system(Update).pptx
CH-3 CO-all-about-operating-system(Update).pptx
XyzXyz338506
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Bilal Amjad
 
Unit 3 assembler and processor
Unit 3 assembler and processor
Abha Damani
 
Assembly Language Basics
Assembly Language Basics
Education Front
 
Instruction Set Architecture
Instruction Set Architecture
Dilum Bandara
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
Programming basic computer
Programming basic computer
Martial Kouadio
 
microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
PriyankaRana171346
 
Ad

Recently uploaded (20)

Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
retina_biometrics ruet rajshahi bangdesh.pptx
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Mark Billinghurst
 
Machine Learning - Classification Algorithms
Machine Learning - Classification Algorithms
resming1
 
Complete University of Calculus :: 2nd edition
Complete University of Calculus :: 2nd edition
Shabista Imam
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
23Q95A6706
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
Mechanical Vibration_MIC 202_iit roorkee.pdf
Mechanical Vibration_MIC 202_iit roorkee.pdf
isahiliitr
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
resming1
 
Unit III_One Dimensional Consolidation theory
Unit III_One Dimensional Consolidation theory
saravananr808639
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
retina_biometrics ruet rajshahi bangdesh.pptx
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Mark Billinghurst
 
Machine Learning - Classification Algorithms
Machine Learning - Classification Algorithms
resming1
 
Complete University of Calculus :: 2nd edition
Complete University of Calculus :: 2nd edition
Shabista Imam
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
LECTURE 7 COMPUTATIONS OF LEVELING DATA APRIL 2025.pptx
rr22001247
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
Learning – Types of Machine Learning – Supervised Learning – Unsupervised UNI...
23Q95A6706
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
Mechanical Vibration_MIC 202_iit roorkee.pdf
Mechanical Vibration_MIC 202_iit roorkee.pdf
isahiliitr
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptx
resming1
 
Unit III_One Dimensional Consolidation theory
Unit III_One Dimensional Consolidation theory
saravananr808639
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
 
Ad

Computer Organization - Programming the basic computer : Machine Language, Assembly Language and Assembler

  • 1. GANDHINAGAR INSTITUTE OF TECHNOLOGY Computer Engineering Department Computer Organization(2140707) Programming the basic computer : Machine language, Assembly language, Assembler and passes of assembler. PREPARED BY: Maitri Thakkar9150120107064) GUIDED BY: Prof. Raxit Jani
  • 2. INTRODUCTION  A computer system includes both hardware and software. The designer should be familiar with both of them.  This chapter introduces some basic programming concepts and shows their relation to the hardware representation of instructions.  A program may be : dependent or independent on the computer that runs it.
  • 3. MACHINE LANGUAGE  Program: A list of instructions that direct the computer to perform a data processing task.  There are many programming languages (C++, JAVA). However, the computer executes programs when they are represented internally in binary form.  Categories of Programs:  Machine Language: • Binary Code • Octal or hexadecimal code  Assembly Language: • Symbolic code  High level programming languages
  • 4. INSTRUCTION SET OF THE BASIC COMPUTER: Symbol Hex code Description  AND 0 or 8 AND M to AC  ADD 1 or 9 Add M to AC, carry to E  LDA 2 or A Load AC from M  STA 3 or B Store AC in M  BUN 4 or C Branch unconditionally to m  BSA 5 or D Save return address in m and branch to m+1  ISZ 6 or E Increment M and skip if zero  CLA 7800 Clear AC  CLE 7400 Clear E  CMA 7200 Complement AC  CME 7100 Complement E  CIR 7080 Circulate right E and AC  CIL 7040 Circulate left E and AC  INC 7020 Increment AC, carry to E  SPA 7010 Skip if AC is positive  SNA 7008 Skip if AC is negative  SZA 7004 Skip if AC is zero  SZE 7002 Skip if E is zero  HLT 7001 Halt computer  INP F800 Input information and clear flag  OUT F400 Output information and clear flag  SKI F200 Skip if input flag is on  SKO F100 Skip if output flag is on  ION F080 Turn interrupt on  IOF F040 Turn interrupt off Here, m: effective address M: memory word (operand) found at m.
  • 5. BINARY PROGRAM TO ADD TWO NUMBERS: Location Instruction Code 0 0010 0000 0000 0100 1 0001 0000 0000 0101 10 0011 0000 0000 0110 11 0111 0000 0000 0001 100 0000 0000 0101 0011 101 1111 1111 1110 1001 110 0000 0000 0000 0000 HEXADECIMAL PROGRAM TO ADD TWO NUMBERS: Location Instruction 000 2004 001 1005 002 3006 003 7001 004 0053 005 FFE9 006 0000 PROGRAM WITH SYMBOLIC OPCODE: Location Instruction Comments 000 LDA 004 Load 1st operand into 001 ADD 005 Add 2nd operand to AC 002 STA 006 Store sum in location 0 003 HLT Halt computer 004 0053 1st operand 005 FFE9 2nd operand (negative) 006 0000 Store sum here FORTRAN PROGRAM: INTEGER A, B, C DATA A,83 / B,-23 C = A + B END
  • 6. ASSEMBLY LEVEL LANGUAGE  The symbolic program(contains letters, numerals or special characters) is referred to as an assembly language program.  The basic unit of an assembly language program is a line of code.  Each line of assembly language program is arranged in three columns called fields:  The label field may be empty or it may contain a symbolic address of up to 3 characters.  The instruction field specifies a machine instruction or a pseudo instruction.  The comment field may be empty or it may include a comment.
  • 7. INSTRUCTION FIELD:  Instruction field in an assembly level language may specify one of the following three items:  A memory-reference instruction(MRI) : MRI consist of two or three symbols separated by spaces.  ADD OPR (direct address MRI)  ADD PTR I (indirect address MRI)  A register-reference or input-output instruction(Non- MRI) : Non MRI instructions do not have an address part.  Pseudo instruction with or without operand : Symbolic address used in the instruction field must be defined somewhere as a label.
  • 8. PSEUDO INSTRUCTION:  Pseudo instruction is not a machine instruction but rather an instruction to the assembler giving information about some phase of translation.  Four pseudo instructions that are recognized by an assembler are:  ORG N : Hexadecimal number N is the memory loc. for the instruction or operand listed in the following line.  END : Denotes the end of symbolic program.  DEC N : Signed decimal number N to be converted to binary.  HEX N : Hexadecimal number N to be converted to binary.
  • 9. ASSEMBLER:  An assembler is a program that accepts a symbolic language program and produces its binary machine language equivalent.  The input symbolic program is called the source program and the output binary program is called the output program.  The assembler is a program that operates on character strings and produces an equivalent binary interpretation.
  • 10. FIRST PASS OF AN ASSEMBLER:  During the first pass, the assembler generates a table that corelates all user- defined address symbols with their binary equivalent value. LC := 0 Scan next line of code Set LC Label no yes yes no ORG Store symbol in address- symbol table together with value of LC END Increment LC Go to second pass no yes
  • 11. SECOND PASS : Second pass LC <- 0 Scan next line of code Set LC yes yes ORGPseudo instr. yes END no Done yes MRI no Valid non-MRI instr. no Convert operand to binary and store in location given by LC no DEC or HEX Error in line of code Store binary equivalent of instruction in location given by LC yes no Get operation code and set bits 2-4 Search address- symbol table for binary equivalent of symbol address and set bits 5-16 I Set first bit to 0 Set first bit to 1 yes no Assemble all parts of binary instruction and store in location given by LC Increment LC The binary Translation is done during the second pass.