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

More Related Content

What's hot (20)

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

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

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

Recently uploaded (20)

PPTX
Numerical-Solutions-of-Ordinary-Differential-Equations.pptx
SAMUKTHAARM
Ā 
PPTX
Final Major project a b c d e f g h i j k l m
bharathpsnab
Ā 
PDF
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
Ā 
PPTX
darshai cross section and river section analysis
muk7971
Ā 
PDF
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
Ā 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
Ā 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
Ā 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
Ā 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
Ā 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
Ā 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
Ā 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
Ā 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
Ā 
PPTX
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
Ā 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
Ā 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
Ā 
PPTX
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
Ā 
PDF
NTPC PATRATU Summer internship report.pdf
hemant03701
Ā 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
Ā 
PPTX
Alan Turing - life and importance for all of us now
Pedro Concejero
Ā 
Numerical-Solutions-of-Ordinary-Differential-Equations.pptx
SAMUKTHAARM
Ā 
Final Major project a b c d e f g h i j k l m
bharathpsnab
Ā 
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
Ā 
darshai cross section and river section analysis
muk7971
Ā 
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
Ā 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
Ā 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
Ā 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
Ā 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
Ā 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
Ā 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
Ā 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
Ā 
Knowledge Representation : Semantic Networks
Amity University, Patna
Ā 
MODULE 05 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
Ā 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
Ā 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
Ā 
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
Ā 
NTPC PATRATU Summer internship report.pdf
hemant03701
Ā 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
Ā 
Alan Turing - life and importance for all of us now
Pedro Concejero
Ā 
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.