0% found this document useful (0 votes)
24 views

1 Introduction

Uploaded by

hsmzem123
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

1 Introduction

Uploaded by

hsmzem123
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Introduction to

Operating systems
2
BEKKOUCHE Mohammed
[email protected]

1
MODULE PROGRAM

I- PRESENTATION OF THE MACHINE


• Functional description of the machine
• Internal code and internal format of an instruction
• Internal structure of a program
• Description of the symbolic language (general syntax of the language)
II- PRESENTATION OF THE ASSEMBLY LANGUAGE
• General structure of a source program (symbolic)
• Guidelines
• Transfer Instructions
• Arithmetic instructions
• Instructions for comparison, loops (repetitions) and branches
• Bit manipulation instructions (logics and shifts)
• Stack Statements
• Procedure instructions and interruptions
• String and prefix processing instructions
III- MACROS INSTRUCTIONS

IV- EXTENDED INSTRUCTIONS (multi media instructions ,…) 2


Sources and Recommendations
• A. Rahmoun , “Operating system course 2”, ESI-SBA, 2017 .
• H. Badsi , “Course Introduction to Operating Systems 2”, ESI-SBA, 2018
.
• MICROPROCESSOR 8086 ARCHITECTURE AND PROGRAMMING :
https://www.technologuepro.com/cours-genie-electrique/cours-2-mi
croprocesseur-8086-architecture-programmation/
• Emu8086 documentation: https://yassinebridi.github.io/asm-docs/
• P. Preux, “i8086 assembler” Littoral IT IUT, 1995 .
• A. Oumnad , “Microprocessors of the 8086 family”, Mohamadia
School of Engineers , 2007
3
Calculation of the mark of the Operating Systems 2 Module

30 % …… Intermediate Exam Score


30% … Final Semester Exam Score
40% ………..… TP score

4
Positioning an operating system

5
Module prerequisites

Algorithmic

Intro. Op. Sys. 1

Computer Architecture 1

Module prerequisites (in red)


NB: This module is parallel and not a continuation of the previous one 6
Module Positioning Introduction to
Operating System 1
Linux distro

Apps Shell, GUI, Other Apps….

operating system _ Linux Kernel (Kernel)

Material or Hardware CPU, Memory, Peripherals

ISE1 7
Module Positioning Introduction to
Operating System 2

Apps Shell, GUI, Other Apps….

operating system _ Linux Kernel (Kernel)

Material or Hardware CPU, Memory, Peripherals

ISE1

ISE2 8
Introduction

9
Introduction to Microprocessors
The appearance of microprocessors dates from the early 1970s. At that
time, two favorable events appeared:
• the concept of " LSI ( Large Scale Integration )" allowing the integration
of several thousand gates on the same substrate.
• MOS technology characterized by its low power consumption.
The combination of these events made it possible to group together a
central computer unit in a single integrated circuit called a
"microprocessor". Since then, a multitude of components of this type
have appeared within families mainly from major American
manufacturers: Intel , Motorola , Advanced Micro Devices (AMD) , Texas
Instruments ,... and Japanese: NEC , Mitsubishi ,...
10
Introduction to Microprocessors
Thanks to progress in integration, the increase in performance has focused
on:
• the operating speed.
• the width of the processed words (8, 16, 32, 64 bits).
• the number and complexity of the operations that can be carried out .
The objective of this module is twofold:
1. present the basic notions necessary to understand systems using
microprocessors,
2. and carry out practical work to program in machine language
(assembler).
11
A processor, in two words
• A processor is the heart of any computer: it executes the instructions
that make up the programs we ask it to execute . Instructions are
stored in memory (outside the processor).
• These instructions (which together make up assembly language , or
assembler ) are very simple but nevertheless allow, by combining
them, to perform any programmable operation .
• To execute a program, the processor reads instructions into memory ,
one by one. It knows at all times the address (the place in the
memory ) to which is the next instruction to be executed because it
stores this address in its ordinal counter .

12
A processor, in two words
• Instructions act on data that is located either in memory or in
processor registers . A register is a memory element internal to the
processor and containing a value
• The number of registers is very limited , 14 in this case for the 8086 .
 To access data in memory, you must specify its address .
 To access data in a register , you must specify its name ( each
register has a name which is a string of characters ).

13
A processor, in two words
The 8086 is a 16-bit processor , that is, it processes 16-bit encoded
data .
A few definitions :
– a bit is a binary value which, by convention, can take the value 0 or 1;
– a byte is data coded on 8 bits ;
– a word is data coded on 16 bits ;
– one Kbyte is a set of 1024 bytes .

14
memory
• Memory is a sequence of bytes , all uniquely
numbered by an integer between 0 and N −1
. We then say that the capacity of memory is
N bytes . We always have N which is a power
of 2 ( N = ).
• The effective address (AE) of a byte in
memory is the number associated with it .

15
Memory
• For the 8086, and therefore for us 8086 programmers, a byte is designated by
a couple:
( segment number, displacement in the segment)
which constitute a segmented address (SA)
• A segment is a set of 64 Kbytes consecutive . The displacement (or offset)
specifies a particular byte in a segment (cf. fig of the next slide).
• Segment and displacement are coded on 16 bits and can therefore take a
value between 0 and 65535 . There is a relation between effective addresses
and couple ( segment, displacement ) in the form of the equation :
effective address = 16 × segment + displacement

16
Memory
Segmented addressing. In bold
lines, the segment starting at
the effective address s has been
represented, and its number is
therefore N = . s must be a
multiple of 16 to be the 1st byte
of a segment .

17
Memory
• Exercise :
Give the effective ( physical ) addresses from the segmented addresses
(all in hexadecimal):
Segmented address Actual address
06D1:000D
059E:0000
0700:00FB
FFFF:0005

Where does each segment start and end?


18
Memory
• Solution :
Give the effective ( physical ) addresses from the segmented addresses
(all in hexadecimal):
Segmented Effective Segment start address Segment end address
address address Seg Addr Eff Addr Seg Addr Eff addr

06D1:000D 06D1D 06D1:0000 06D10 06D1:FFFF 16D0F


059E:0000 059E0 059E:0000 059E0 059E:FFFF 159DF
0700:00FB 070FB 0700:0000 07000 0700:FFFF 16FFF
FFFF:0005 FFFF5 FFFF:0000 FFFF0 FFFF:FFFF ✘ 10FFEF ✘
FFFF:000F ✔ FFFFF ✔
19
Memory
• A consequence of the relationship stated above between effective
address and segmented address is that a given effective address byte
can be accessed in several ways .
• More specifically , to each EA corresponds = 4096 different SAes .

20
Memory
• The segments: we have represented
a few segments to show their overlap
and the fact that a memory byte has
several segmented addresses .
• For example, the effective address
byte α can be addressed in multiple
ways , depending on whether it is
considered to be in segment s , s+1 ,
s+2 , ...
• In each of these cases, the
segmented address of byte α is (s, d) ,
(s + 1, d − 16) , (s + 2, d − 32) , ...
• Note that each memory byte belongs
to = 4096 different segments .
21
Memory
• Exercise :
Give two segmented addresses for each real (effective) address
(everything is in hexadecimal ):
Effective address Segmented address 1 Segmented Address 2
FFFFF
08A9F

22
Memory
• Exercise :
Give two segmented addresses for each real (effective) address
(everything is in hexadecimal ):
Effective address Segmented address 1 Segmented Address 2
FFFFF FFFF:000F FFFE:001F
08A9F 0700:1A9F 0800:0A9F

23
Memory
During its execution , a program uses several memory segments. (see
fig. of the next slide) :
– a segment contains the program instructions ( the code segment );
– a segment contains the program data (the data segment );
– a segment contains the program stack ( the stack segment ). This very
important segment
These three segments can be anywhere in memory and even partially
or totally overlap .

24
Memory
• Structure of memory . We have
represented in bold lines the
segments of code , data and
stack that are created when a
program is triggered to run (from
top to bottom – in reality , of
course , they can be located
anywhere in memory ).
• Each segment is referenced by a
segment register . The different
segments can partially or
completely overlap .
25
The registers of the 8086
• The 8086 has 14 16-bit registers

26
The registers of the 8086
• ax general -purpose register containing data . The least significant 8 bits are called al and
the most significant 8 bits are called ah .
• bx general purpose register containing data . Like ax , bx decomposes into bl and bh .
• cx general purpose register containing data . Like ax , cx decomposes into cl and ch .
• dx general purpose register containing data . Like ax , dx decomposes into dl and dh .
• si general-purpose register generally containing the displacement in a segment of a data.
• di general-purpose register generally containing the displacement in a segment of a
data.
• bp register used to address data in the stack.
• sp stack pointer register.
• ip instruction pointer register ( ordinal counter ). This register indicates the next
instruction to be executed.
27
The 8086
flags processor state flag register . Some bits of this register have
names. These are all binary indicators :
• O the overflow bit is set by most arithmetic instructions to indicate
whether there has been an overflow when calculating (a number too
large or too small)
• D direction bit . It will be described later .
• S the sign bit is set by most arithmetic instructions to indicate the sign
of the result ( positive Or negative )
• Z the zero bit is set by most arithmetic instructions to indicate that
the result of the calculation is 0
28
The 8086
• C the carry bit is set by most arithmetic instructions to indicate
whether the calculation resulted in a carry that needs to be carried
over to subsequent calculations
• A the so-called auxiliary carry bit is set to 1 by most arithmetic
instructions to indicate whether the last operation generated a carry
from bit number 3 to bit number 4, it is set to 0 otherwise .
• P the parity bit is set by most arithmetic instructions. It indicates
whether the 8 least significant bits of the result contain an even
number of 1 .

29
The registers of the 8086
The 8086 also includes 16-bit registers to hold segment numbers:
• cs code segment segment containing the running program
• ds data segment segment containing the data
• es auxiliary segment register for addressing data
• ss stack- segment segment containing the stack
The values of the cs, ds, and ss registers are automatically initialized by
the operating system at the program's launch. Consequently, these
segments are implicit, meaning that if you want to access a piece of data
in memory, you only need to specify its offset without worrying about the
segment.
30
The coding of numbers
• The 8086 instructions manipulate integer numeric values encoded on 1 or 2
bytes .
• We describe here the coding of integers. We distinguish four types of coding:
– unsigned for necessarily positive integers ;
– signed for positive or negative integers .
– compacted decimal, or binary-coded decimal (BCD)
– non-compacted decimal
• It's up to the programmer to decide what coding he uses and write his program
accordingly .
• The computer does not know which coding is used . It just executes instructions.

31
Unsigned representation of integers
• With l bits, it is possible to encode different values . If l = 8 , we can
code 256 different values . We can establish the following coding, on
8 bits:

• This encoding allows representing any integer between 0 and 255 (0


and − 1) with 8 bits (l bits) . Since only positive numbers are
represented , this coding is qualified as unsigned .
32
Signed representation of integers
• If we want to be able to represent positive and negative numbers , the
natural idea is, rather than coding numbers between 0 and 255 , to
represent numbers between -128 and +127 , which always represents 256
different values to encode with 8 bits .

33
Signed representation of integers
• This coding is called two's complement coding .
• In the signed coding , we see that the most significant bit is 1 for all
negative numbers , 0 for all positive numbers. This bit therefore
indicates the sign of the coded number . Also, this bit is called the sign
bit .
• Care must be taken that if the sign bit is 0 , the value represented is
the same in signed or unsigned coding . On the other hand, if the sign
bit is equal to 1 , the coded value is greater than 127 in unsigned
coding , less than 0 in signed coding .

34
Coding decimal
• In decimal coding , a decimal digit (thus between 0 and 9 ) is coded on 4 bits
. 4 bits coding in principle 16 different values , only 10 of these 16
combinations are actually used in decimal coding , the others then having no
meaning. The coding is as follows:

35
Coding decimal
• There are two types of representation , compacted or not. A digit
requiring 4 bits for its coding , two digits can be represented per byte.
This encoding is called compacted decimal encoding .
• It is also possible to put only one digit per byte, the 4 most significant
bits of the byte being unused . This encoding is called non-compacted
decimal.
• For example, 19 is coded:
o compacted decimal : 00011001
o non-compacted decimal : 00000001 00001001
• Two bytes are required in the non-compacted representation .
36
Two's complement of a number
• Here we show how to get the two 's complement of a number. This
method gives the signed binary representation of a negative number .
The algorithm is simple. Let's calculate the representation of the
number −n ( where n is a positive number). The following operations
are carried out :
o write n in binary form
o complement all the bits ( 0  1 , 1  0 )
o add the value 1 to this binary number

37
Two's complement of a number
We present this algorithm on an example. Let's calculate the two 's
complement of -23 :
• 8-bit binary representation of 23 is 00010111
• by complementing the bits, we obtain: 11101000
• by adding 1 , we obtain: 11101001
The two 's complement of 00010111 is therefore 11101001 . The
signed binary representation of -23 is therefore 11101001

38
Extension of the sign
• Extending the sign of a data consists, during the transfer of the value
of a byte in a word , in copying the sign bit of the byte over all the
bits of the most significant byte of the word.
• For example, extending the sign of 10011110 into a word gives
1111111110011110

39

You might also like