1 fundamental of computer suthida chaichomchuen : scc [email protected]

49
1 Fundamental of Computer Suthida Chaichomchuen : SCC [email protected]

Upload: cassandra-austin

Post on 12-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

1

Fundamental of Computer

Suthida Chaichomchuen : SCC

[email protected]

Page 2: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

2

Computer Components

Hardware (architecture) Software (instruction set)

Page 3: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

3

Basic Hardware

Bits Bytes Registers Memory Processor Data Bus

Page 4: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

4

Hardware Components

Internal hardware– Microprocessor– Memory– Registers

External hardware– Input/Output Devices

Page 5: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

5

Software Organization

Programs Data files Operating System

Page 6: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

6

Computer storage

Bit– On : 1– Off : 0

Byte– data : 8 bits– parity : 1 bit (automatically setting)

Page 7: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

7

Related bytes

Word Doubleword Quadword Paragraph Kilobyte Megabyte

Page 8: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

8

Binary numbers

Bit value : 1 1 1 1 1 1 1 1Position value : 128 64 32 16 8 4 2 1Bit number : 7 6 5 4 3 2 1 0

Page 9: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

9

Binary arithmetic

Decimal Binary 65 01000001 +42 +00101010 107 01101011

Decimal Binary 60 00111100 +53 +00110101 113 01110001

Page 10: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

10

Negative Binary Numbers

Number +65 : 01000001Reverse the bits : 10111110Add 1 : 1Number -65 : 10111111

Reverse the bit value and add 1

Page 11: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

11

Hexadecimal Representation

Binary : 1011 1001 1100 1110Decimal : 11 9 12 14Hexadecimal : B 9 C E

Page 12: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

12

System Unit

A system board

– Microprocessor

– ROM

– RAM Power supply Expansion slots

Page 13: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

13

Processors (Intel family)

8088/80188 8086/80186 80286 80386 80486 Pentium (or 80586) PentiumPro (or 6x86)

Page 14: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

14

Processors : 8088/80188

16-bit registers 8-bit data bus address up to 1 million bytes of memory registers process 2 bytes/time data bus transfer 1 byte/time operate in real mode

Page 15: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

15

Processors : 8086/80186

16-bit registers 16-bit data bus & run faster address up to 1 million bytes of memory registers process 2 bytes/time data bus transfer 2 bytes/time operate in real mode

Page 16: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

16

Processors : 80286

16-bit registers 16-bit data bus & run faster address up to 16 million bytes of memory operate in real mode or protected mode

Page 17: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

17

Processors : 80386

32-bit registers 32-bit data bus address up to 4 billion bytes of memory operate in real mode or protected mode

Page 18: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

18

Processors : 80486

32-bit registers 32-bit data bus address up to 4 billion bytes of memory operate in real mode or protected mode processor is designed for enhanced

performance

Page 19: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

19

Processors : Pentium (or 80586)

32-bit registers 64-bit data bus execute more than one instruction/clock

cycle

Page 20: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

20

Processors : PentiumPro (or 80686)

advances the capacity of registers and the data bus

– connected to a build-in storage cache by a 64-bit wide bus

Page 21: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

21

Logical Units in Processor

Bus Interface Unit <BIU>

– Manage the bus control unit, segment registers and instruction queue.

– Provide access to instructions. Execution Unit <EU>

– Execute instructions and get data that the BIU delivered.

Page 22: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

22

Internal Memory

ROM (Read Only Memory) RAM (Random Access Memory)

Page 23: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

23

Map of Base Memory

64K base system ROM

192K memory expansionarea (ROM)

640K memory (RAM) conventional memory

upper memory

128K video display area (RAM)

Start Address

Dec Hex960K F0000

768K C0000

640K A0000

zero 00000

Purpose

Page 24: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

24

Addressing data in memory

System stores the data in memory in reverse-byte sequence :

– low-order byte : low memory address

– high-order byte : high memory address

Page 25: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

25

memory

Address 7613most significant byte

register 05 29

29 05

Address 7612least significant byte

Addressing data in memory

Page 26: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

26

Segments

A segment is a special area defined in a program that begins on a paragraph boundary, that is, at a location evenly divisible by 16, or hex 10.

Page 27: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

27

Main Segments

Code Segment <CS>

– contains the machine instructions that are to execute

Data Segment <DS>

– contains a program’s defined data, constants, and work areas.

Page 28: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

28

Main Segments . . .

Stack Segment <SS>

– contains any data and addresses that you need to save temporarily or for use by your own “called” subroutines.

Page 29: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

29

Segment Boundaries

Stack Segment

Data Segment

Code Segment

Memory

Relocatable in memory

Address

Address

Address

SS

DS

CS

SegmentRegisters

Page 30: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

30

Segment Offsets

Offset is the distance in bytes from the segment address to another location within the segment.

A 2-byte offset can range from 0000H - FFFFH (0-65,535).

Memory location = segment address + offset value

Page 31: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

31

Offset 32H

X

Segment address 038E0H

X. . .

DS segment address : 038E0HOffset : +0032HActual address : 03912H

Segment Offsets

Page 32: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

32

Addressing Capacity

8086/8088 Addressing

– 16 bits for addressing 80286 Addressing

– 24 bits for addressing 80386/486/Pentium Addressing

– In protected mode use 48 bits for addressing

Page 33: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

33

Registers

The processor’s registers are used to control instructions being executed, to handle addressing of memory, and to provide arithmetic capability.

Page 34: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

34

Registers

Segment Registers Pointer Registers General-Purpose Registers Index Registers Flags Register

Page 35: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

35

Segment Registers

CS register

– Contains the starting address of a program’s code segment.

DS register

– Contains the starting address of a program’s data segment.

Page 36: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

36

Segment Registers . . .

SS register

– The system stores the starting address of a program’s stack segment in the SS register.

ES register

– Used by some string operations to handle memory addressing.

Page 37: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

37

Segment Registers . . .

FS and GS register

– Additional extra segment registers on the 80386 and later processors.

Page 38: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

38

Pointer Registers

Instruction Pointer (IP) register

– Contains the offset address of the next instruction that is to execute.

– IP indicates the current instruction within the currently executing code segment.

Page 39: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

39

Pointer Registers . . .

Stack Pointer (SP) register

– Refers to the current word being processed in the stack.

Base Pointer (BP) register

– Facilitates referencing parameters.

Page 40: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

40

General-Purpose Registers

AX register : Accumulator

– Used for operations involving input/output and most arithmetic.

EAX:

AX: AH AL

Page 41: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

41

General-Purpose Registers

BX register : Base register

– Used as an index to extend addressing.

EBX:

BX: BH BL

Page 42: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

42

General-Purpose Registers . . .

CX register : Count register

– Contains a value to control the number of times a loop is repeated.

– Contains a value to shift bits left or right.

ECX:

CX: CH CL

Page 43: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

43

General-Purpose Registers . . .

EDX:

DX: DH DL

DX register : Data register

– Used for input/output operations

– Used for multiply and divide operations that involve large values.

Page 44: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

44

Index Registers

SI register

– source index register is required for some string operations

– SI is associates with DS register DI register

– destination index register is required for some string operations

– DI is associates with ES register

Page 45: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

45

Flags Register

Flag: O D I T S Z A P C

Bit no.: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Page 46: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

46

Flags Register

OF (overflow)

– Indicates overflow of a high-order bit following arithmetic.

DF (direction)

– Determines left or right direction for moving or comparing string data.

IF (interrupt)

– Indicates that all external interrupts are to be processed or ignored.

Page 47: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

47

Flags Register . . .

TF (trap)

– Permits operation of the processor in single-step mode.

SF (sign)

– Contains the resulting sign of an arithmetic operation.

– 0 : positive / 1 : negative

Page 48: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

48

Flags Register . . .

ZF (zero)

– Indicates the result of an arithmetic or comparison operation.

– 0 : nonzero / 1 : zero AF (auxiliary carry)

– Contains a carry out of bit 3 on 8-bit data, for specialized arithmetic.

Page 49: 1 Fundamental of Computer Suthida Chaichomchuen : SCC std@kmitnb.ac.th

49

Flags Register . . .

PF (parity)

– Indicates even or odd parity of a low-order 8-bit data operation.

CF (carry)

– Contains carries from a high-order bit following an arithmetic operation.

– Contains the contents of the last bit of a shift or rotate operation.