SlideShare a Scribd company logo
1 of 28
Assembly Language - Lab (2)
1
Agenda
What is Assembly Language?
Computer Organization
Main memory
Memory Modes:
 Real Mode (8086)
 Protected Mode (80386)
What is Assembly Language?
 Assembly Language is a low-level (machine‐level) programming
language that uses mnemonics instead of numeric codes (0’s, 1’s) to
simplify programming.
 For example, the instruction in machine language which means copy
the content from AX register to BX register is:
8B D8
While same instruction written in assembly is:
mov BX, AX
 Each statement in assembly code has a one-to-one relationship
with machine language instructions, in other words each statement
corresponds to a single machine code instruction.
3
 To run a program written in assembly language, we should have a
converter (or translator) which converts these labels and mnemonics
to their corresponding machine codes in 0’s and 1’s. This converter
is called an assembler.
4
Machine CodeAssemblerAssembly Code
To run a program
written in a high level
language we should
have a converter
called …..?
What is Assembly Language?
Computer Organization
Main
Memory
CPU
R2 R3R1
ALU
Control
unit
R4
Main Memory
 It is the place to store data (and instructions) temporarily.
 Each location (byte) in memory has content (value) and a unique
label (address).
 Often, memory is used in larger chunks than single bytes. As shown
below:
Main
Memory
Byte
Memory Modes:
Real Mode (8086) – 16 Bit Registers
CPU 8086
Register Size 16 bits
Main Memory 1 MByte
Program Segment 64 k
(220 𝑏𝑦𝑡𝑒)
Memory Modes:
Real Mode (8086) – 16 Bit Registers
4 General Purpose
 AX : Accumulator
 BX : Base
 CX: Count
 DX: Data
4 Index and Pointers
 DI: Destination Index
 SI : Source Index
 BP: Base Pointer
 SP : Stack pointer
 4 Segments registers
 DS: Data Segment.
 CS: Code Segment
 SS: Stack Segment
 ES: Extra Segment
 Instruction Pointers
 IP: Instruction Pointer
 Flags
 ZF , SF, OF, CF...
Memory Modes:
Real Mode (8086) – 16 Bit Registers
4 General Purpose
Each of these registers could be decomposed into two 8‐bit
registers.
AH and AL are dependent on AX. Changing AX’s value will change
AH and AL values and vice versa.
Memory Modes:
Real Mode (8086) – 16 Bit Registers
Index and Pointers (SI, DI)
They are often used as pointers to memory items, but can be used
for other purposes as the general‐purpose registers. They cannot be
decomposed into 8‐bit registers.
Memory Modes:
Real Mode (8086) – 16 Bit Registers
Index and Pointers (BP, SP)
They are used to point to data in the stack and are called the Base
Pointer and Stack Pointer, respectively.
Stack
BP
SP
Memory Modes:
Real Mode (8086) – 16 Bit Registers
 4 Segments registers (CS, DS, SS, ES)
They keep the starting address of memory chunk used for different
parts of a program.
CS stands for Code Segment,
DS for Data Segment,
SS for Stack Segment, and
ES for Extra Segment. ES is used as a temporary segment register.
Memory Modes:
Real Mode (8086) – 16 Bit Registers
 Instruction Pointers (IP)
This register is used with the CS register to keep track of the
address of the next instruction to be executed by the CPU.
 Flags (ZF , SF, OF, CF...)
The FLAGS register stores important information about the results of
the last executed operation. This information is stored as individual
bits in this register. For example, there is a specific bit called the Zero
flag (Z flag). This Z flag is 1 if the result of the last operation was zero
otherwise Z flag is set to zero. Not all instructions modify the bits
in FLAGS.
Memory Modes:
Real Mode (8086) – 16 Bit Registers
 As shown before, memory in real mode (8086) is limited to only one
megabyte (220 bytes).
 Valid address range is from (in hex) 00000 to FFFFF. These addresses
require a 20‐bit number.
Will it fit in the
segment registers?
Memory Modes:
Real Mode (8086) – 16 Bit Registers
 A program is often divided into 3 segments, which are Code, Data,
and Stack segments where its starting address is stored in segment
registers. And each of these segments must begins on a paragraph
boundary (i.e. its address is divisible by 16). Therefore, the starting
address of any segment always begins with four 0‐bits.
 In addition, an offset register is used to address memory locations
within each segment. The size of each segment is 64KB (𝟐 𝟏𝟔 𝒃𝒚𝒕𝒆) at
most.
Why?
Memory Modes:
Real Mode (8086) – 16 Bit Registers
 To find the physical address (20‐bit) from segment‐offset pair, use the
following relation:
16 * segment register + offset register
 Multiplying by 16 is equivalent to left shifting the binary value 4 times. This
done to return the four 0 bits which not stored physically in the segment
register.
Why do we
multiply by
16?
Memory Modes:
Real Mode (8086) – 16 Bit Registers
 Examples:
1. Segment Register: 047C
Offset Register: 0048
Physical address: 047C0 + 0048 = 04808
2. Segment Register: 047D
Offset Register: 0038
Physical address: 047D0 + 0038 = 04808
And we can also get the same address when we add 047E0 with
0028.
Same
address!
Memory Modes:
Real Mode (8086) – 16 Bit Registers
Disadvantages:
1. A single segment can only contain 64K of memory (the upper
limit of the 16‐bit offset register).
2. Each byte in memory does not have a unique segmented
address.
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
CPU 80386
Register Size 32 bits
Main Memory 4 Gbyte
Program Segment 4 Gbyte
(232 𝑏𝑦𝑡𝑒)
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
 In 386 CPU, registers become 32‐bit wide except segment
registers (selectors) remain 16‐bits as they are.
 Two new 16‐bit segment registers are also added, FS and GS.
 This extension made the single segment size up to 4GB.
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
So how does a segment register store the 32‐bit
address of memory?
 Segment register is interpreted differently in protected mode. It is
interpreted as an index into a descriptor table than a register
stores the starting address of the segment.
 Descriptor table: is a table containing physical addresses of all
segments beside some other information about these segments. It
is stored in memory and its location is stored in a special register.
(local or global)
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
.
.
.
16 bits CS Register
32 bits Address of the CS in
Memory
Main
Memory
Descriptor Table
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
 As explained before, this mode allows the program segment to be
of size 4GB, so only one segment of only one program can take the
whole memory size to its own?
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
 For that problem protected mode uses a technique called virtual
memory.
 The basic idea of virtual memory system is to only keep the data and
code in physical memory that programs are currently using.
 Other data and code are stored temporarily on disk until they are
needed again.
Memory Modes:
Protected Mode (80386) – 32 Bit Registers
 Furthermore, segments can be divided into smaller 4K‐sized units
called pages, so each segment can be divided to 220 pages.
 The virtual memory system works with pages now instead of
segments.
Questions?
27
Thank you 
28

More Related Content

What's hot

The Intel 8086 microprocessor
The Intel 8086 microprocessorThe Intel 8086 microprocessor
The Intel 8086 microprocessorGeorge Thomas
 
Chapter 6 hardware structure of 8086
Chapter 6  hardware structure of 8086Chapter 6  hardware structure of 8086
Chapter 6 hardware structure of 8086SHREEHARI WADAWADAGI
 
26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architecture26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architectureSaurabh Jain
 
Intel 8086 microprocessor
Intel 8086 microprocessorIntel 8086 microprocessor
Intel 8086 microprocessorRavi Yasas
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorRegister Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorNikhil Kumar
 
INTERNAL STRUCTURE OF 8086 MICROPROCESSOR
INTERNAL STRUCTURE OF  8086 MICROPROCESSORINTERNAL STRUCTURE OF  8086 MICROPROCESSOR
INTERNAL STRUCTURE OF 8086 MICROPROCESSORMd. Hasnat Shoheb
 
Basics of 8086
Basics of 8086Basics of 8086
Basics of 8086PDFSHARE
 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086Estiak Khan
 
8086 handout for chapter one and two
8086 handout for chapter one and two8086 handout for chapter one and two
8086 handout for chapter one and twohaymanotyehuala
 
Architecture of 8086
Architecture of 8086Architecture of 8086
Architecture of 8086MOHAN MOHAN
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 

What's hot (19)

The Intel 8086 microprocessor
The Intel 8086 microprocessorThe Intel 8086 microprocessor
The Intel 8086 microprocessor
 
Chapter 6 hardware structure of 8086
Chapter 6  hardware structure of 8086Chapter 6  hardware structure of 8086
Chapter 6 hardware structure of 8086
 
8086 architecture By Er. Swapnil Kaware
8086 architecture By Er. Swapnil Kaware8086 architecture By Er. Swapnil Kaware
8086 architecture By Er. Swapnil Kaware
 
26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architecture26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architecture
 
Intel 8086 microprocessor
Intel 8086 microprocessorIntel 8086 microprocessor
Intel 8086 microprocessor
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorRegister Organisation of 8086 Microprocessor
Register Organisation of 8086 Microprocessor
 
Intel 8086
Intel 8086Intel 8086
Intel 8086
 
INTERNAL STRUCTURE OF 8086 MICROPROCESSOR
INTERNAL STRUCTURE OF  8086 MICROPROCESSORINTERNAL STRUCTURE OF  8086 MICROPROCESSOR
INTERNAL STRUCTURE OF 8086 MICROPROCESSOR
 
Lecture2
Lecture2Lecture2
Lecture2
 
Amp
AmpAmp
Amp
 
Basics of 8086
Basics of 8086Basics of 8086
Basics of 8086
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
Intel 8086
Intel 8086Intel 8086
Intel 8086
 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086
 
8086 handout for chapter one and two
8086 handout for chapter one and two8086 handout for chapter one and two
8086 handout for chapter one and two
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 
Architecture of 8086
Architecture of 8086Architecture of 8086
Architecture of 8086
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 

Viewers also liked

Assembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI HiroakiAssembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI Hiroakiasmtanka
 
Affective computing
Affective computingAffective computing
Affective computingAnkit Moonka
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4Motaz Saad
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly languageAhmed M. Abed
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Shehrevar Davierwala
 
Assembly Language Lecture 1
Assembly Language Lecture 1Assembly Language Lecture 1
Assembly Language Lecture 1Motaz Saad
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGFrankie Jones
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)Ashim Saha
 

Viewers also liked (16)

[ASM]Lab5
[ASM]Lab5[ASM]Lab5
[ASM]Lab5
 
[ASM]Lab3
[ASM]Lab3[ASM]Lab3
[ASM]Lab3
 
Assembly fundamentals
Assembly fundamentalsAssembly fundamentals
Assembly fundamentals
 
Assembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI HiroakiAssembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI Hiroaki
 
Affective computing
Affective computingAffective computing
Affective computing
 
[ASM]Lab4
[ASM]Lab4[ASM]Lab4
[ASM]Lab4
 
[ASM] Lab1
[ASM] Lab1[ASM] Lab1
[ASM] Lab1
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
8086 microprocessor lab manual
8086 microprocessor lab manual8086 microprocessor lab manual
8086 microprocessor lab manual
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
 
Programming with 8085
Programming with 8085Programming with 8085
Programming with 8085
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
 
Assembly Language Lecture 1
Assembly Language Lecture 1Assembly Language Lecture 1
Assembly Language Lecture 1
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 

Similar to [ASM] Lab2

Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)muneer.k
 
Microprocessor 80386
Microprocessor 80386Microprocessor 80386
Microprocessor 80386yash sawarkar
 
microprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdfmicroprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdfssuserd21262
 
physical_address segmentation.pdf
physical_address segmentation.pdfphysical_address segmentation.pdf
physical_address segmentation.pdfSwapnil511014
 
Presentation on 8086 microprocessor
Presentation on 8086 microprocessorPresentation on 8086 microprocessor
Presentation on 8086 microprocessorDiponkor Bala
 
digital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsdigital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsManasa Mona
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Siraj Ahmed
 
introduction to Architecture of 8086 and it's application
introduction to Architecture of 8086 and it's applicationintroduction to Architecture of 8086 and it's application
introduction to Architecture of 8086 and it's applicationDrVikasMahor
 

Similar to [ASM] Lab2 (20)

110 ec0644
110 ec0644110 ec0644
110 ec0644
 
80386.pptx
80386.pptx80386.pptx
80386.pptx
 
Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)
 
Microprocessor 80386
Microprocessor 80386Microprocessor 80386
Microprocessor 80386
 
80386
8038680386
80386
 
Internal microprocessor architecture
Internal microprocessor architectureInternal microprocessor architecture
Internal microprocessor architecture
 
8051 microcontroller
 8051 microcontroller 8051 microcontroller
8051 microcontroller
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
 
microprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdfmicroprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdf
 
physical_address segmentation.pdf
physical_address segmentation.pdfphysical_address segmentation.pdf
physical_address segmentation.pdf
 
8086
80868086
8086
 
Presentation on 8086 microprocessor
Presentation on 8086 microprocessorPresentation on 8086 microprocessor
Presentation on 8086 microprocessor
 
Lect 8 updated (1)
Lect 8 updated (1)Lect 8 updated (1)
Lect 8 updated (1)
 
Chapter2d
Chapter2dChapter2d
Chapter2d
 
digital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsdigital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuits
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .Introduction of 8086 micro processor .
Introduction of 8086 micro processor .
 
introduction to Architecture of 8086 and it's application
introduction to Architecture of 8086 and it's applicationintroduction to Architecture of 8086 and it's application
introduction to Architecture of 8086 and it's application
 
lec 2.pptx
lec 2.pptxlec 2.pptx
lec 2.pptx
 
8086 PPt-2021.pptx
8086 PPt-2021.pptx8086 PPt-2021.pptx
8086 PPt-2021.pptx
 

More from Nora Youssef

More from Nora Youssef (13)

Welcome to dragons’ land
Welcome to dragons’ landWelcome to dragons’ land
Welcome to dragons’ land
 
[SpLab1]Review
[SpLab1]Review[SpLab1]Review
[SpLab1]Review
 
[SpLab2]Arrays
[SpLab2]Arrays[SpLab2]Arrays
[SpLab2]Arrays
 
[SpLab3]Structures
[SpLab3]Structures[SpLab3]Structures
[SpLab3]Structures
 
[SpLab5] Pointers II
[SpLab5] Pointers II[SpLab5] Pointers II
[SpLab5] Pointers II
 
[SpLab4]Pointers I
[SpLab4]Pointers I[SpLab4]Pointers I
[SpLab4]Pointers I
 
[SpLab7]Functions I
[SpLab7]Functions I[SpLab7]Functions I
[SpLab7]Functions I
 
[Splab8]Functions II
[Splab8]Functions II[Splab8]Functions II
[Splab8]Functions II
 
[SpLab9]Functions III
[SpLab9]Functions III[SpLab9]Functions III
[SpLab9]Functions III
 
[ASM]Lab8
[ASM]Lab8[ASM]Lab8
[ASM]Lab8
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
[ASM]Lab6
[ASM]Lab6[ASM]Lab6
[ASM]Lab6
 
Abstract
AbstractAbstract
Abstract
 

Recently uploaded

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 

Recently uploaded (20)

ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 

[ASM] Lab2

  • 2. Agenda What is Assembly Language? Computer Organization Main memory Memory Modes:  Real Mode (8086)  Protected Mode (80386)
  • 3. What is Assembly Language?  Assembly Language is a low-level (machine‐level) programming language that uses mnemonics instead of numeric codes (0’s, 1’s) to simplify programming.  For example, the instruction in machine language which means copy the content from AX register to BX register is: 8B D8 While same instruction written in assembly is: mov BX, AX  Each statement in assembly code has a one-to-one relationship with machine language instructions, in other words each statement corresponds to a single machine code instruction. 3
  • 4.  To run a program written in assembly language, we should have a converter (or translator) which converts these labels and mnemonics to their corresponding machine codes in 0’s and 1’s. This converter is called an assembler. 4 Machine CodeAssemblerAssembly Code To run a program written in a high level language we should have a converter called …..? What is Assembly Language?
  • 6. Main Memory  It is the place to store data (and instructions) temporarily.  Each location (byte) in memory has content (value) and a unique label (address).  Often, memory is used in larger chunks than single bytes. As shown below: Main Memory Byte
  • 7. Memory Modes: Real Mode (8086) – 16 Bit Registers CPU 8086 Register Size 16 bits Main Memory 1 MByte Program Segment 64 k (220 𝑏𝑦𝑡𝑒)
  • 8. Memory Modes: Real Mode (8086) – 16 Bit Registers 4 General Purpose  AX : Accumulator  BX : Base  CX: Count  DX: Data 4 Index and Pointers  DI: Destination Index  SI : Source Index  BP: Base Pointer  SP : Stack pointer  4 Segments registers  DS: Data Segment.  CS: Code Segment  SS: Stack Segment  ES: Extra Segment  Instruction Pointers  IP: Instruction Pointer  Flags  ZF , SF, OF, CF...
  • 9. Memory Modes: Real Mode (8086) – 16 Bit Registers 4 General Purpose Each of these registers could be decomposed into two 8‐bit registers. AH and AL are dependent on AX. Changing AX’s value will change AH and AL values and vice versa.
  • 10. Memory Modes: Real Mode (8086) – 16 Bit Registers Index and Pointers (SI, DI) They are often used as pointers to memory items, but can be used for other purposes as the general‐purpose registers. They cannot be decomposed into 8‐bit registers.
  • 11. Memory Modes: Real Mode (8086) – 16 Bit Registers Index and Pointers (BP, SP) They are used to point to data in the stack and are called the Base Pointer and Stack Pointer, respectively. Stack BP SP
  • 12. Memory Modes: Real Mode (8086) – 16 Bit Registers  4 Segments registers (CS, DS, SS, ES) They keep the starting address of memory chunk used for different parts of a program. CS stands for Code Segment, DS for Data Segment, SS for Stack Segment, and ES for Extra Segment. ES is used as a temporary segment register.
  • 13. Memory Modes: Real Mode (8086) – 16 Bit Registers  Instruction Pointers (IP) This register is used with the CS register to keep track of the address of the next instruction to be executed by the CPU.  Flags (ZF , SF, OF, CF...) The FLAGS register stores important information about the results of the last executed operation. This information is stored as individual bits in this register. For example, there is a specific bit called the Zero flag (Z flag). This Z flag is 1 if the result of the last operation was zero otherwise Z flag is set to zero. Not all instructions modify the bits in FLAGS.
  • 14. Memory Modes: Real Mode (8086) – 16 Bit Registers  As shown before, memory in real mode (8086) is limited to only one megabyte (220 bytes).  Valid address range is from (in hex) 00000 to FFFFF. These addresses require a 20‐bit number. Will it fit in the segment registers?
  • 15. Memory Modes: Real Mode (8086) – 16 Bit Registers  A program is often divided into 3 segments, which are Code, Data, and Stack segments where its starting address is stored in segment registers. And each of these segments must begins on a paragraph boundary (i.e. its address is divisible by 16). Therefore, the starting address of any segment always begins with four 0‐bits.  In addition, an offset register is used to address memory locations within each segment. The size of each segment is 64KB (𝟐 𝟏𝟔 𝒃𝒚𝒕𝒆) at most. Why?
  • 16. Memory Modes: Real Mode (8086) – 16 Bit Registers  To find the physical address (20‐bit) from segment‐offset pair, use the following relation: 16 * segment register + offset register  Multiplying by 16 is equivalent to left shifting the binary value 4 times. This done to return the four 0 bits which not stored physically in the segment register. Why do we multiply by 16?
  • 17. Memory Modes: Real Mode (8086) – 16 Bit Registers  Examples: 1. Segment Register: 047C Offset Register: 0048 Physical address: 047C0 + 0048 = 04808 2. Segment Register: 047D Offset Register: 0038 Physical address: 047D0 + 0038 = 04808 And we can also get the same address when we add 047E0 with 0028. Same address!
  • 18. Memory Modes: Real Mode (8086) – 16 Bit Registers Disadvantages: 1. A single segment can only contain 64K of memory (the upper limit of the 16‐bit offset register). 2. Each byte in memory does not have a unique segmented address.
  • 19. Memory Modes: Protected Mode (80386) – 32 Bit Registers CPU 80386 Register Size 32 bits Main Memory 4 Gbyte Program Segment 4 Gbyte (232 𝑏𝑦𝑡𝑒)
  • 20. Memory Modes: Protected Mode (80386) – 32 Bit Registers  In 386 CPU, registers become 32‐bit wide except segment registers (selectors) remain 16‐bits as they are.  Two new 16‐bit segment registers are also added, FS and GS.  This extension made the single segment size up to 4GB.
  • 21. Memory Modes: Protected Mode (80386) – 32 Bit Registers So how does a segment register store the 32‐bit address of memory?  Segment register is interpreted differently in protected mode. It is interpreted as an index into a descriptor table than a register stores the starting address of the segment.  Descriptor table: is a table containing physical addresses of all segments beside some other information about these segments. It is stored in memory and its location is stored in a special register. (local or global)
  • 22. Memory Modes: Protected Mode (80386) – 32 Bit Registers . . . 16 bits CS Register 32 bits Address of the CS in Memory Main Memory Descriptor Table
  • 23. Memory Modes: Protected Mode (80386) – 32 Bit Registers  As explained before, this mode allows the program segment to be of size 4GB, so only one segment of only one program can take the whole memory size to its own?
  • 24. Memory Modes: Protected Mode (80386) – 32 Bit Registers  For that problem protected mode uses a technique called virtual memory.  The basic idea of virtual memory system is to only keep the data and code in physical memory that programs are currently using.  Other data and code are stored temporarily on disk until they are needed again.
  • 25. Memory Modes: Protected Mode (80386) – 32 Bit Registers  Furthermore, segments can be divided into smaller 4K‐sized units called pages, so each segment can be divided to 220 pages.  The virtual memory system works with pages now instead of segments.
  • 26.

Editor's Notes

  1. Compiler
  2. Four-bit computer architectures use groups of four bits as their fundamental unit. Such architectures were used in early microprocessors and pocket calculators and continue to be used in some microcontrollers
  3. 2^16 at most so as to be able to use a 16-bit register for representing this amount of bytes (Locations)
  4.  FS and GS have no hardware-assigned uses but they can be used like the ES register
  5. 1. 4 GByte ( 0 to FFFFFFFFh). 2. 1 MByte (0 to FFFFFh). 3. Linear (absolute). 4. 09600h. 5. 0CFF0h. 6. 32 bits. 7. SS register. 8. Local descriptor table. 9. Global descriptor table. 10. The total size of all programs loaded into memory can exceed the amount of physical memory installed in the computer. 11. This is an open-ended question, of course. It is a fact that MS-DOS first had to run on the 8086/8088 processors, which only supported Real-address mode. When later processors came out that supported Protected mode, my guess is that Microsoft wanted MS-DOS to continue to run on the older processors. Otherwise, customers with older computers would refuse to upgrade to new versions of MS-DOS. 12. The following segment-offset addresses point to the same linear address: 0640:0100 and 0630:0200.