Experiment 0 COE 205 Computer Organization & Assembly Language Programming Term 052.

Slides:



Advertisements
Similar presentations
RAM (cont.) 220 bytes of RAM (1 Mega-byte) 20 bits of address Address
Advertisements

Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled.
Chapter 8: Central Processing Unit
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
Lab6 – Debug Assembly Language Lab
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Introduction to Computer Systems
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Vacuum tubes Transistor 1948 –Smaller, Cheaper, Less heat dissipation, Made from Silicon (Sand) –Invented at Bell Labs –Shockley, Brittain, Bardeen ICs.
1 Experiment 0 COE 205 Computer Organization & Assembly Language Programming Term 043.
Topic 1: Introduction to Computers and Programming
Computer Systems CS208. Major Components of a Computer System Processor (CPU) Runs program instructions Main Memory Storage for running programs and current.
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
บทนำสู่คอมพิวเตอร์. Outline Computer Concepts Computer Components Software OS How to write a program? Program development.
Computer Organization & Assembly Language
Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI CSCI.
Computer Organization
C.S. Choy95 COMPUTER ORGANIZATION Logic Design Skill to design digital components JAVA Language Skill to program a computer Computer Organization Skill.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Introduction Chapter 1 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer, 2005.
Basic Microcomputer Design. Inside the CPU Registers – storage locations Control Unit (CU) – coordinates the sequencing of steps involved in executing.
Natawut NupairojAssembly Language1 Introduction to Assembly Programming.
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
What is a Computer ? Computers are Electronic Machines that process (performs calculation and manipulation) Data under the control of Set of Instructions.
1 CS503: Operating Systems Spring 2014 Dongyan Xu Department of Computer Science Purdue University.
Hardware & Software The CPU & Memory.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
1 4.2 MARIE This is the MARIE architecture shown graphically.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Computer Parts. Two Basic Parts Hardware & Software.
Computers organization & Assembly Language Chapter 0 INTRODUCTION TO COMPUTING Basic Concepts.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Introduction Chapter 1 S. Dandamudi. Outline A user’s view of computer systems What is assembly language? – Relationship to machine language Advantages.
Von Neumann Machine Objectives: Explain Von Neumann architecture:  Memory –Organization –Decoding memory addresses, MAR & MDR  ALU and Control Unit –Executing.
Computer Organization & Assembly Language © by DR. M. Amer.
Introduction to Microprocessors
Beginning Snapshots Chapter 0. C++ An Introduction to Computing, 3rd ed. 2 Objectives Give an overview of computer science Show its breadth Provide context.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Lecture on Central Process Unit (CPU)
Chapter 2 Turning Data into Something You Can Use
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Basic Concepts Computer Organization & Assembly Language Programming Instructor: Maram Alsahafi [Some of the contents Adapted from slides Dr Adnan Gutub,
CISC. What is it?  CISC - Complex Instruction Set Computer  CISC is a design philosophy that:  1) uses microcode instruction sets  2) uses larger.
CS 1410 Intro to Computer Tecnology Computer Hardware1.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
CPIT Program Execution. Today, general-purpose computers use a set of instructions called a program to process data. A computer executes the.
Information Technology (IT). Information Technology – technology used to create, store, exchange, and use information in its various forms (business data,
Introduction to Computers - Hardware
PROGRAMMABLE LOGIC CONTROLLERS SINGLE CHIP COMPUTER
Assembly language.
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Computer Hardware and Software
Microprocessor and Assembly Language
Computer System and Programming
Computer Organization & Assembly Language Chapter 3
Introduction of microprocessor
Overview Introduction General Register Organization Stack Organization
IB Computer Science Topic 2.1.1
Computer Science I CSC 135.
Central Processing Unit
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Today’s agenda Hardware architecture and runtime system
Introduction Chapter 1 S. Dandamudi. Outline  A user’s view of computer systems  What is assembly language?  Relationship to machine language  Advantages.
Introduction to Microprocessor Programming
Presentation transcript:

Experiment 0 COE 205 Computer Organization & Assembly Language Programming Term 052

Outline Definition of a program. Instruction atomicity. Assembly language. Tools. Setting up the environment. Policy.

Definition of a Program A sequence of instructions and data that causes a machine to perform a given task. An Instruction has two fields: ▪Operation (Opcode) ▪Operands: Data ADDITION A B Y AdditionOperation A & BData Y ← ADD A, BInstruction

An instruction is atomic. ▪Indivisible ▪Non-interruptible operation Hardware ensures the non-interruptible execution of an instruction. A complex operation is made of simple instructions. Example: ▪Multiplication - SHIFT - ADD Instruction Atomicity

A User’s View of Computer Systems Depends on the degree of abstraction provided by the underlying software We consider a hierarchy of five levels –Moving to the top of hierarchy shields the user from the lower-level details –The top two levels are system independent

A User’s View of Computer Systems (cont.) –The other lower four levels are system dependent Assembly and machine languages are specific to a particular processor One-to-one correspondence between assembly language and machine language

A User’s View of Computer Systems (cont.)

General Properties of a Personal Computer I/O devices – keyboard, scanner, monitor, printer, projector, light pen, etc. Memory unit – where program is kept (debug, d100 lets look at memory) (u 100 unpack memory, see what is there) CPU – registers, ALU and stack pointer, control unit and IP (instruction pointer)

RAM Random Access Memory This is where our program stays when we run it. 1600:0100 is an example of a RAM address.

ROM–read only memory ROM is read only memory and cannot be changed. ROM has a program burned in the chip. EPROM is erasable programmable read only memory and is expensive and is done with very special equipment.

BOOTUP- FIRMWARE Firmware lies between hardware and software. Firmware is the software that is burned into the chip. When you turn on the PC. An address is loaded into the CPU’s IP. The address is of the ROM’s firmware. This firmware program is called the BOOTSTRAP program. Then the program runs and loads the operating system. The computer is ready to be used !

ROM BIOS Address 0 – 1024 interrupt vectors – (2028 – 4096) BIOS Data (about ) – 640 KB (about 640,000) RAM for your program Above 640KB < 1 MB Video Memory MB – 1.5 MB ROM BIOS – this is basic input output system.

Real Mode / PROTECTED MODE All PCs even the real old ones start in REAL MODE where the first 1 MB is usable. All modern operating systems such as LINUX, Widows 95/98/2000/Millennium/ NT immediately switch to PROTECTED MODE letting us use all the memory (except ROM BIOS and where the OS is located and memory where other’s programs run )

CPU Contained in one IC – integrated circuit 8080, 80x86 = 80286, 80386, 80486, etc.. Pentium, Pentium 2, Celeron (similar) ALU – arithmetic logical unit CU – control unit Fetch, decode, execute

Show a small program in debug C:\windows> debug - a :0100 mov ax,5 1600:0102 INC AX Hit Enter -r -t Watch IP and current instruction

Business Executives for example Discuss Machine Cycles when they say their PC is 900 MHZ or 1 Ghz Each command such as MOV AX, 5 (move 5 to AX register) takes a few computer cycles to execute. The faster your computer, the more cycles per second it performs. Cycles per second.

Advantages of High-Level Languages Program development is faster –Higher level instructions = less coding –Some simple high-level language instructions can be expressed by a single assembly instruction –But most high-level language instructions need more than one assembly instruction Programs maintenance is easier –For the same reason as above Programs are portable –Contain few machine-dependent details – Can be used with little or no modifications on different types of machines –Compiler translates to the target machine language

Why Assembly? Program speed Compact executable Common in embedded systems Games, games, games!!!

Why Program in Assembly Language? Two main reasons: –Efficiency Space-efficiency Time-efficiency –Accessibility to system hardware Assembly language can be used as a tool to learn computer organization –You will know more about the organization and internal workings of a computer system

Space-efficiency Assembly code tends to be compact Not a big plus point for most applications Code compactness is important in some cases –Portable and hand-held device software –Spacecraft control software

Time-efficiency Assembly language programs tend to run faster –Only a well-written assembly language program runs faster –Easy to write an assembly program that runs slower than its high-level language equivalent Time Convenience – (Graphics, hardware drivers) Time Critical – (Aircraft navigational systems, Process control systems, Robot control software, Missile control software)

Accessibility to system hardware System software typically requires direct control of the system hardware devices –Assemblers, linkers, compilers –Network interfaces and other device drivers –Video games

Bits and Bytes 1 or 0 is a bit 4 bits = a nibble (1/4 of a register) 8 bits = 1 byte 2 bytes = 1 word = register size 1024 bytes = 1 KB = 1kilobyte 1,048,576 bytes = 1 MB = 1 megabyte 1,073,741,824 bytes = 1 GB = 1 gigabyte

BITS, decimal, hexadecimal 0 off, 1 on 1001 = 9 01 = = 10 or A 10 = = 11 or B 011 = = 12 or C 100 = = 13 or D 101 = = 14 or E 110 = = 15 or F 111 = = 8

Bits, Bytes,OpCode Viewing machine code equivalent of instruction set C:\WINDOWS>debug -a C:0100 mov ax,5 106C:0103 -d 100 B8 05 in memory means MOV AX, 05

Memory location 106C:0100 This is a memory location. It is actually 106C ====== 107C0 B8 05 is what is there. The opcode is B8

16 Bit Addressing The IBM uses 16 bit addressing which lets us use only 65,536 bytes. How do we address up to 1 MB ? 1600: is really 16000, we add a zero. Then 0100 is the other part added on to give the exact location !

MNEMONIC MOV, INC, are examples of mnemonics MOV – move INC – increment (example int I++;)

CISC architecture Complex Instruction Set Computing – this is what we do on the INTEL 80X86 chips. It is pronounced SISK. CISC architecture uses very few registers so the instructions take many cycles and run slower.

RISC Architecture This is used by APPLE 680X0 family chips and one instruction takes 1 machine cycle. Very fast, very efficient, but many registers and more difficult to program since there are more registers and mnemonics to use. SPARC stations use RISC

DMA The control from high speed I/O devices with the CPU is minimal (not synchronous like keyboard and mouse and display) Memory to and from the device is done via a DMA controller (8237 chips used for 8088/8086)

PROGRAMS Programs are basically a set of instructions to do some task. Here is a simple assembler program. MOV AH,02 // get display ready MOV DL,41 // Capital A INT 21h // Interrupt 21 INT 20h //interrupt 20, quit

NEW Tools ASCII Chart What is an A (41 hex) MOV AH,02h - monitor MOV DL,41 – 41 is an A INT 21h - interrupt 21 to execute I/O (cout << “A”)

Exiting a program INT 21h This is like EXIT_SUCCESS