Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CS-401 Quiz 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 47

CS-401

Computer Architecture and Assembly Language


Programming
Lecture-1
Course Introduction

This course is design to understand the basics organization of computers


Basic Computer Organization

Processor Memory

I/O
Basic Computer Organization

Processor Memory Data


Operation
Basic Computer Organization

Processor Memory Data


Operation
Basic Computer Organization

Address Bus

Data Bus
Processor Memory
Control Bus
Dimensions of Memory
Horizontal Dimensions = Width of Memory Cell

00000000
Binary 00000001
Vertical
Addresses Dimensions

Of
=
Memory
Cells Size of
00100011 Memory

00100100
00100101
Basic Computer Organization

Processor Memory
Control Bus
CS-401
Assembly Language Programming
Lecture-2
Introduction to Assembly Language
Basic Computer Organization

REGISTERS
Registers

Accumulator Register

Function:
Mathematical and Logical Operations
Registers
Pointer / Index / Base

Function:
Holds the Address of Operands
Registers
General Purpose

Function:
Temporary Storage
of
Intermediate Results
Registers
Flag / Program Status Word

Function:
Collection of different boolean
information each bit has an
independent meaning
Registers
Flag / Program Status Word

C O P D Z I A S

A sample 8 – bit flag register

C = Carry Flag
Z = Zero Flag
Registers
Carry Flag

1111111111111111
+1111111111111111
0000000000000001
0000000000000000

16 – bit Accumulator
Carry Flag = CF
Registers
Program Counter
Instruction Pointer

Function:
Address of next instruction to be executed
• MNEMONIC
Instruction Groups

Data Movement Instructions


Arithmetic / Logic Instructions
Program Control Instructions
Special Instructions
Data Movement

mov ax,bx ; move data from bx to ax

lda 0234 ; load 0234 into


; accumulator
Arithmetic and Logic Instructions

and ax,1234 ; AND 1234 with ax

add bx,0534 ; ADD 0534 to bx

add bx,[1200] ; ADD data at address 1200 to


bx

add ax,[1234] ; ADD data from address 1234


to ax
Program Control Instructions

cmp ax,0 ; Compare ax with 0

jne 1234 ; Jump if not equal to the


instruction
; at address 1234
Special Instructions

cli ; Clear the interrupt flag

sti ; Set the interrupt flag


CS-401
Computer Architecture & Assembly
Language Programming
Lecture-3
Introduction to Assembly Language
• Lets revise the last lecture
Basic Computer Organization

iAPX 88 Registers (16-bit)


iAPX 88 Registers (16-bit)
General Purpose

AX
BX
CX
DX
iAPX 88 Registers (16-bit)
General Purpose
16-bit

AX

AH AL
8-bit 8-bit
iAPX 88 Registers (16-bit)
General Purpose
16-bit

BX

BH BL
8-bit 8-bit
iAPX 88 Registers (16-bit)
General Purpose

• AX A Accumulator Register
• BX B Base Register
• CX C Counter Register
• DX D Destination Register
iAPX 88 Registers (16-bit)
Pointer / Index / Base

SI
DI
iAPX 88 Registers (16-bit)
Pointer / Index / Base
• SI SI Source Index
• DI DI Destination Index
• IP IP Instruction Pointer
• SP SP Stack Pointer
• BP BP Base Pointer
iAPX 88 Registers (16-bit)
Flag Register

- - - - O D I T S Z - A - P - C

C = Carry S = Sign Bit


P = Parity T = Trap Flag
A= Auxiliary Carry I = Interrupt Flag
Z= Zero Bit D = Direction Flag
O = Overflow
Registers
Program Counter
Instruction Pointer

Function:
Address of next instruction to be executed
Instruction Groups

Data Movement Instructions


Arithmetic / Logic Instructions
Program Control Instructions
Special Instructions
Data Movement

mov ax,bx ; move data from bx to ax

lda 0234 ; load 0234 into


; accumulator
Arithmetic and Logic Instructions

and ax,1234 ; AND 1234 with ax

add bx,0534 ; ADD 0534 to bx

add bx,[1200] ; ADD data at address 1200 to


bx

add ax,[1234] ; ADD data from address 1234


to ax
iAPX 88 Registers (16-bit)
Segment

• CS CS Code Segment


• DS DS Data Segment
• SS SS Stack Segment
• ES ES Extra Segment
iAPX 88 Registers (16-bit)
General Purpose

• AX AH,AL
• BX BH,BL
• CX CH,CL
• DX DH,DL
A Simple Program

Move 5 to AX mov ax,5


Move 10 to BX mov bx,10
ADD BX to AX add ax,bx
Move 15 to BX mov bx,15
ADD BX to AX add ax,bx
General Instruction Format

• instruction dest, src


• instruction dest
• instruction src
Assembler

NASM

The Netwide Assembler


Linker

ALINK
Debugger

AFD

Advanced Full Screen Debug


EX01.ASM
[ORG 0X100]

mov ax,5
mov bx,10
Add ax,bx
Mov bx,15
Add ax,bx

Mov ax,0x4c00
Int 0x21
EX01.LST
Word Representation
• 4 Byte Word

MSB LSB

• Representation in Memory
Representation 1

Little Endian Notation MSB LSB


0 1 2 3
Representation 2

Big Endian Notation LSB MSB

0 1 2 3

You might also like