IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.
|
|
- Lydia Blankenship
- 6 years ago
- Views:
Transcription
1 IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers CU (Control Unit) IP Memory ROM BIOS I/O RAM OS Programs Video memory BIOS data Interrupt Vectors Memory Address The Fetch-Execute Cycle While True Fetch instruction Update IP Execute fetched instruction Assembly Language Computers speak machine language (in binary code) CPU MEMORY Register AX x a In C++ x += a; Compiler translates C++ program to.obj file (binary code) In machine (binary) code Move x to ax In Assembly mov ax, x ( ) Page 1 of 18
2 Add a to ax ( ) Move ax to x add ax, a mov x, ax ( ) For each machine instruction, there is an assembly statement Machine language is rarely used Assembly language is used sometimes Assembler translates assembly program to machine code To understand To improve performance CISC vs RISC Instruction Set All a computer can do CISC RISC Complex Instruction Set Computing Reduced Instruction Set Computing All IBM PCs use CISC Lecture 2 DOS Different from Windows Application under Windows Commands Help /? Change Drive A: Change directory Cd.. cd masm615 List all files/directories dir Edit files Use PWB Path = c:\masm615\bin Up-Down arrows Display the last or previous command Page 2 of 18
3 Steps in Assembly Programming a. Create source program (First.asm) using any text editor b. MASM First (to produce object file First.obj) c. LINK First (to produce executable file First.exe) d. First to run the program) e. CV First (to debug the program) In CV run program step over break point watch registers and others look at user screen [Alt]+F5 cannot edit Basic Concepts MASM also generates other files: First.lst, First.map Assembly is case insensitive Assembly Program has three segments Stack, data, and code Pseudo Operations Not machine instructions Give information to Assembler.MODEL SMALL.STACK 256.DATA.CODE ;specify the structure of segments ;small model is enough in our class ;stack size: 100H ;declare variables or constants ;instructions Data segment Labels: symbolic names Key Words: Name, Title, Page,... Pseudo operations: DB and DW Define variables with or without initial values Data types: byte and word Registers AX, BX, CX, DX, DS Each one is a word, and has a high byte and a low byte AX: AH AL Standard Boilerplate mov ;Cannot use: mov mov ds, ax Macros and Sub-procedures Like high-level languages, Assembly provides macros and subprocedures The difference between macros and sub-procedures Macro: Large instruction Page 3 of 18
4 The assembler expands macros and we get the same.obj file as without macros. We ask the assembler to write code for us, and use macros to tell assembler what to write Macros Sub-procedures are like C++ functions Function calls transfer control IP does not go to the next instruction It is set to the address of the function called Save registers Execute slowly More manageably at a high level pcmac.inc _PutStr label ;Macro to display a string Be Careful! These macros will use the registers The values stored in the registers will be destroyed. Mov ax, 1024 _PutStr MyName ;what is in ax? Mov ax, 1024 ;ax: Mov dx, OFFSET MyName Mov ah, 9h ;ax: Int 21h sputstr label ;Safe version ;Use this one! sputch '$', 13, 10 ;Macro to display a chars ;up to 10 chars Equivalent code mov al, '$' mov ah, 2h int 21h sexit 0 ;Macro to exit with 0 sgetdate ;after the call ;al = weekday (0-6) ;dh = month (1-12) ;dl = day (1-31) ;cx = year (4 digits) The assembly program begins with the line INCLUDE PCMAC.INC.MODEL SMALL ;before.model SMALL Sub-Procedures util.lib PutDec PutHex GetDec Page 4 of 18
5 PutDec Display a number (word) The number is in ax mov ax, 1024 call PutDec To use the sub-procedure: mov ax, cx ;display number in cx call PutDec mov ah, 0 ;display number in al call PutDec Add the line at the beginning of code segment.code EXTRN PutDec : NEAR EXTRN GetDec : NEAR EXTRN PutDec : NEAR, PutHex : NEAR, GetDec : NEAR PutHex GetDec Display hex number (signed or unsigned) The number is in ax Input a signed number The number is returned in ax No prompt Files Created by Assembler Lab1.lst List program with machine code Lab1.map Memory map Instruction MOV MOV dest, source Copy source to dest From right to left Same as in C++: x = y; Must be the same type Binary Numbers Decimal Numbers Binary Numbers Base 10 with ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, = = 3 * * * 1 = 3 * (10 **2) + 2 * (10 **1) + 3 * (10 ** 0) Computers use binary numbers: base 2 Bit: Two stable states Two digits: 0 & 1 Page 5 of 18
6 IBM PCs Byte: Word: Double Word: 8 Bits 2 bytes (16 Bits) 4 Bytes (32 Bits) Binary to Decimal Conversion * (2**7) + 1 * (2**4) + 1 * (2**1) + 1 * (2**0) = = 147 Decimal to Binary Division (divisor: 2) Quotient Remainder The first remainder is the lowest bit: B Other ways Addition in Binary Binary numbers 1B + 1B = 10B carry B (235D) B (166D) B (401D) Overflow on one byte Flag register and Overflow flag (bit) Subtraction in Binary borrows B (235) B (166) B ( 69) borrows B (166) B (235) B (-69) Wrong! Should be a negative number! Page 6 of 18
7 Signed Numbers How to represent negative numbers in Binary system? Sign-Magnitude Representation One bit for Sign: the left most digit Two different bytes for one number: zero 's Complement Representation -x = B - x Reverse every bit Still two different bytes for one number: zero 's Complement Representation IBM PC and most modern computers 2 s Complement Signed Binary Integers For any number x (one byte) -x = B - x + 1 = ( B + 1) - x = 2**8 - x 2's Complement Representation: IBM PC and most modern computers x : signed byte -x = B - x + 1 = ( B + 1) - x = 2**8 - x 51: B 2's Complement operation on B B B B B 2's complement representation on -51: 2's complement operation Apply to x ==> -x Apply to -x ==> -(-x) = x -(-51) = 51 x : signed word -x = 2**16 - x B Page 7 of 18
8 Quick 2's Complement Keep all bits from right upto the first 1 Reverse all remaining bits B B -(-51) B Sign and Magnitude B B -(-74) B Use 2's complement representation Positive numbers: Left-most bit is 0 Negative numbers: Left-most bit is 1 Magnitude (absolute value) of 2's Complement 51 = B Count ONEs Same as Unsigned Integers -51 = B Count ZEROs and plus one Operations using 2's Complement Signed and Unsigned are treated the same way B B B 51 + (-51) = 0 when the carry is discarded! Ex (-51) = B B B B B B Overflow Signed Unsigned Left most bit Page 8 of 18
9 Value Ranges Byte Unsigned: 0 to Signed : -128 to Word Unsigned: 0 to Signed : to Signed Byte and Word Convert Byte to Word B = B B = B Convert Word to Byte B = B B = B How to do it? B HEXADECIMAL NUMBERS Hexadecimal Integers (Hex) Shorthand representation for binary numbers Binary numbers are too long to write 1000 (D) = B Group 4 binary digits together into one Hex digit Used in Assembly Language (not in computer) Binary Decimal Hex A B C D E F Page 9 of 18
10 Binary to Hex Group from right B = 19CBH B = 0EB52H Hex to Binary 8EH 19CBH = B = B Hex Numbers and Labels What about EACH? Hex number or Identifier? Numbers always begin with (decimal) digits! EACH: Identifier (Identifier never begins with digits) 0EACH: Hex Addition and Subtraction carry A B C D H H B E 0 1 H borrow H - 0 A B C D H H What are the values in decimal? Hex to Decimal To Binary first Unsigned 8EH = 8 * (16 ** 1) + 14 * (16 ** 0) = = 142 ** 0) 19CBH = 1 * (16 ** 3) + 9 * (16**2) + 12 * (16 **1) + 11 * (16 = * * = 6603 Signed 2's Complement -x = ( B) - x + 1 = 0FFH - x + 1 8EH = 72H 19CBH = 0E635H Positive or Negative? 19CBH 79CBH 89CBH 0FBCDH Page 10 of 18
11 Decimal to Hex Binary first Unsigned Similar to Decimal to Binary: Division by 16 Quotient Remainder (B) (C) First remainder is the lowest digit: 19CBH Signed 2's Complement CBH 0E635H Multiplication and Division Much higher cost Decimal Binary Hex Addition and Subtraction Instructions add dest, source ;dest := dest + source sub dest, source ;dest := dest - source Similar to mov same size at least one operand is not in memory EX A := B - C + 3 (All byte) A DB? B DB 87 C DB -42 mov al, B sub al, C add al, 3 mov A, al The usual way: move to register do it move back to memory Register ax: Accumulator Could use AH or any other byte register EX A := A + B (All word) Page 11 of 18
12 A DW? B DW 87 C DW add A, B ;Wrong! mov add mov ax, A ax, B A, ax Can we use only two instructions? More Instructions: dec A ;A := A - 1 inc ax ;ax := ax + 1 neg B ;B := -B ;2's complement Possible Overflow EX A := B - C + 3 (All byte, Signed) A DB? B DB 87 C DB -42 Mov AL, B Sub AL, C Overflow? Convert Byte to Word H - (-42) D6 H H Unsiged Mov AH, 0 Sub AH, AH Signed AH AL???????? ???????? Instruction Cbw ; Convert AL to AX ; AX has the same value as AL ; as signed integer Reverse conversion Page 12 of 18
13 Example EX A := B - C + 3 (B and C are byte) (A is word) (All signed) (The value of AX is the same as AL) (The value of AX is NOT the same as AL) NO! A DW? B DB 127 C DB -128 mov al, C cbw mov bx, ax ; C in BX mov cbw al, B ; B in AX sub ax, bx add ax, 3 mov A, ax As unsigned numbers A := B - C + 3 Multiplication Unsigned Mul Multiplier Signed imul Multiplier AX = AL * Multiplier (DX)(AX) = AX * Multiplier Operand Size Multiplicand Multiplier Product Byte al reg/mem ax Word ax reg/mem (dx)(ax) Range of the product No overflow 20 * > 2000 byte * byte ----> word word * word ----> double word Page 13 of 18
14 Examples Ex 1 W := A * B both A and B are signed bytes W should be word A DB? B DB? W DW? Call Mov Call Mov GetDec A, AL GetDec B, AL mov al, A ;al := A imul B ;al is assumed ;ax := al * B mov W, ax Ex 2 product product W := A * B both A and B are unsigned words W must be double word mov ax, A ;ax := A mul B ;ax is assumed mov W1, ax ;ax is the low word of mov W2, dx ;dx is the high word of That is or (dx)(ax) := ax * B (W2)(W1) := A * B and W = (W2)(W1) Ex 3 W := A * (-15) mov al, A ;al := A imul -15 ;NO ;cannot use a constant * bl mov al, A mov bl, -15 mul bl ;al is assumed, and ax := al mov W, ax Division Instructions unsigned numbers div divisor signed numbers idiv divisor Integer Division Quotient Remainder Page 14 of 18
15 W B Q R Signed Unsigned Multiplication W := A * B word byte byte Division A := W / B byte word byte Operand Size Dividend Divisor Quotient Remainder Byte ax reg/mem (byte) al ah Word (dx)(ax) reg/mem (word) ax dx Examples Q := W / B R := W % B a) W: word, others: byte, signed mov ax, W idiv B mov Q, al mov R, ah b) all are byte, signed mov al, W cbw idiv B mov Q, al mov R, ah ;convert al to ax Overflow c) all are byte, unsigned mov al, W mov ah, 0 ;convert (extend) al to ax ;or sub ah, ah div B mov Q, al mov R, ah Multiplication: NO Division : Possible! EX. 10,000 / > 5,000 word byte more than a byte! COMPARING and BRANCHING Comparison Instruction cmp reg/mem, reg/mem/const Flags Register Same type: byte or word Subtract the numbers Set flags (Values are not modified) Page 15 of 18
16 16 bits Z: zero flag O: overflow flag C: carry flag S: sign flag Bit Number b15... b11.. b8 b7 b6... b1 b0 O S C Z Other operations may also change Flag Register Jumping Conditional Jump Signed Numbers jg, jl, jge, jle Unsigned Numbers ja jump if above jae jump if above or equal jb jump if below jnb jump if NOT below Both Signed and Unsigned je, jne jz, jnz Unconditional Jump jmp Example if ax <> 0 then Q = X / Y R = X % Y else Display Message //Next We have two blocks of statements Determine the Entrance and Exit for each block X DW? Y DB? Q DB? R DB? ;Input Signed numbers X and Y mov ax, X cmp ax, 0 ;compare ax and 0 je IsZero ;jump to MinusOne if ax >= bx idiv mov mov jmp Y Q, AL R, AH Next IsZero: sputstr Zero Next: ;instruction after the IF Page 16 of 18
17 IF Statements Jumping All values are signed If AX < BX X = 1 Else X = -1 Val ++ cmp AX, BX jnl Minus Mov X, 1 Jmp Next Minus: Next: Mov X, -1 Inc Val Examples Jump instructions modifies IP (The Fetch-and-Execute Loop) Displacement: Lable will be replaced with numbers Jump only when necessary! EX 1 All variables are signed word (Short Circuit Evaluation) if (A < B) and (A >= 0) then X := A else X := B X := X + 1 // next statement mov ax, A cmp ax, B ;compare A and B jge XisB ;jump to XisB if A >= B cmp ax, 0 jl XisB ;jump if A < 0 mov X, A ;X := A jmp Next XisB: Next: mov X, B ;X := B ;instruction after the IF inc X ;X := X + 1 EX 2 All variables are Unsigned byte if (A < B) or (A >= 10) then Page 17 of 18
18 X := A elseif A = B then X := 0 else X := B X := X + 1 // next statement mov al, A mov bl, B cmp al, bl jb XisA cmp al, 10 jb SecondIF XisA: mov jmp X, al Next SecondIf: cmp al, bl jne XisB mov X, 0 jmp Next XisB: Next: mov inc X, bl X Page 18 of 18
EC 333 Microprocessor and Interfacing Techniques (3+1)
EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC
More informationBasic Assembly Instructions
Basic Assembly Instructions Ned Nedialkov McMaster University Canada SE 3F03 January 2013 Outline Multiplication Division FLAGS register Branch Instructions If statements Loop instructions 2/21 Multiplication
More informationLecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide
Lecture 9 INC and DEC Arithmetic Operations Overflow Multiply and Divide INC adds one to a single operand DEC decrements one from a single operand INC destination DEC destination where destination can
More informationLecture 8: Control Structures. Comparing Values. Flags Set by CMP. Example. What can we compare? CMP Examples
Lecture 8: Control Structures CMP Instruction Conditional High Level Logic Structures Comparing Values The CMP instruction performs a comparison between two numbers using an implied subtraction. This means
More informationWe will first study the basic instructions for doing multiplications and divisions
MULTIPLICATION, DIVISION AND NUMERICAL CONVERSIONS We will first study the basic instructions for doing multiplications and divisions We then use these instructions to 1. Convert a string of ASCII digits
More informationEXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
EXPERIMENT WRITE UP AIM: Assembly language program to search a number in given array. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
More informationBAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ
LAB4 RELATED INSTRUCTIONS: Compare, division and jump instructions CMP REG, memory memory, REG REG, REG memory, immediate REG, immediate operand1 - operand2 Result is not stored anywhere, flags are set
More informationArithmetic Instructions
Segment 3C Arithmetic Instructions This topic covers the following instructions: Addition (ADD, INC, ADC) Subtraction (SUB, DEC, SBB,CMP) Multiplication (MUL, IMUL) Division (DIV, IDIV) BCD Arithmetic
More informationCS-202 Microprocessor and Assembly Language
CS-202 Microprocessor and Assembly Language Lecture 2 Introduction to 8086 Assembly Language Dr Hashim Ali Spring - 2019 Department of Computer Science and Engineering HITEC University Taxila!1 Lecture
More informationLABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS
LABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS 1. Object of laboratory The x86 microprocessor family has a large variety of instructions that allow instruction flow control. We have 4 categories: jump,
More informationEx: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.
INSTRUCTOR: ABDULMUTTALIB A H ALDOURI Conditional Jump Cond Unsigned Signed = JE : Jump Equal JE : Jump Equal ZF = 1 JZ : Jump Zero JZ : Jump Zero ZF = 1 JNZ : Jump Not Zero JNZ : Jump Not Zero ZF = 0
More informationThe statement above assumes that the PCMAC.INC file is in the current directory. The full path of the file can also be given:
MACROS for I/O As you have probably noticed, writing DOS calls can become tedious. Much of the code is repetitive, and each call has its own function code and register usage. You are probably used to dealing
More informationBasic Assembly SYSC-3006
Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming
More informationIntel 8086: Instruction Set
IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction
More informationUNIT 4. Modular Programming
1 UNIT 4. Modular Programming Program is composed from several smaller modules. Modules could be developed by separate teams concurrently. The modules are only assembled producing.obj modules (Object modules).
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 9 Integer Arithmetic and Bit Manipulation April, 2014 1 Assembly Language LAB Bitwise
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One
More informationSelection and Iteration. Chapter 7 S. Dandamudi
Selection and Iteration Chapter 7 S. Dandamudi Outline Unconditional jump Compare instruction Conditional jumps Single flags Unsigned comparisons Signed comparisons Loop instructions Implementing high-level
More informationLecture (08) x86 programming 7
Lecture (08) x86 programming 7 By: Dr. Ahmed ElShafee 1 Conditional jump: Conditional jumps are executed only if the specified conditions are true. Usually the condition specified by a conditional jump
More informationDefining and Using Simple Data Types
85 CHAPTER 4 Defining and Using Simple Data Types This chapter covers the concepts essential for working with simple data types in assembly-language programs The first section shows how to declare integer
More informationSigned number Arithmetic. Negative number is represented as
Signed number Arithmetic Signed and Unsigned Numbers An 8 bit number system can be used to create 256 combinations (from 0 to 255), and the first 128 combinations (0 to 127) represent positive numbers
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More informationCSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs
CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)
More informationCSC 8400: Computer Systems. Machine-Level Representation of Programs
CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages
More informationMnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C
ARITHMETIC AND LOGICAL GROUPS 6-1 Arithmetic and logical groups: The arithmetic group includes instructions for the addition, subtraction, multiplication, and division operations. The state that results
More informationLecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET
Lecture 1: Passing Parameters on the Stack Push Examples Quick Stack Review Passing Parameters on the Stack Binary/ASCII conversion ;assume SP = 0202 mov ax, 124h push ax push 0af8h push 0eeeh EE 0E F8
More informationdb "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'
PA4 Sample Solution.model large.stack 100h.data msg1 db "This programs scans a string of up to 256 bytes and counts the repetitions of the number 4206 and sums them.",0dh,0ah,'$' msg2 db "Please enter
More informationINSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
8 Unsigned and Signed Integer Numbers 1. Unsigned integer numbers: each type of integer can be either byte-wide or word-wide. This data type can be used to represent decimal numbers in the range 0 through
More informationArithmetic and Logic Instructions And Programs
Dec Hex Bin 3 3 00000011 ORG ; FOUR Arithmetic and Logic Instructions And Programs OBJECTIVES this chapter enables the student to: Demonstrate how 8-bit and 16-bit unsigned numbers are added in the x86.
More information8086 INSTRUCTION SET
8086 INSTRUCTION SET Complete 8086 instruction set Quick reference: AAA AAD AAM AAS ADC ADD AND CALL CBW CLC CLD CLI CMC CMP CMPSB CMPSW CWD DAA DAS DEC DIV HLT IDIV IMUL IN INC INT INTO I JA JAE JB JBE
More informationWeek /8086 Microprocessor Programming
Week 5 8088/8086 Microprocessor Programming Multiplication and Division Multiplication Multiplicant Operand Result (MUL or IMUL) (Multiplier) Byte * Byte AL Register or memory Word * Word AX Register or
More informationWeek /8086 Microprocessor Programming I
Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 7 Multiplication and Division Multiplication commands: mul and imul mul source (source: register/memory) Unsigned Integer Multiplication (mul) mul src (src: register/memory)
More informationSummer 2003 Lecture 4 06/14/03
Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General
More informationAssembly Language: IA-32 Instructions
Assembly Language: IA-32 Instructions 1 Goals of this Lecture Help you learn how to: Manipulate data of various sizes Leverage more sophisticated addressing modes Use condition codes and jumps to change
More informationIt is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.
1 od 5 17. 12. 2017 23:53 (https://github.com/schweigi/assembler-simulator) Introduction This simulator provides a simplified assembler syntax (based on NASM (http://www.nasm.us)) and is simulating a x86
More informationECOM Computer Organization and Assembly Language. Computer Engineering Department CHAPTER 7. Integer Arithmetic
ECOM 2325 Computer Organization and Assembly Language Computer Engineering Department CHAPTER 7 Integer Arithmetic Presentation Outline Shift and Rotate Instructions Shift and Rotate Applications Multiplication
More informationADVANCE MICROPROCESSOR & INTERFACING
VENUS INTERNATIONAL COLLEGE OF TECHNOLOGY Gandhinagar Department of Computer Enggineering ADVANCE MICROPROCESSOR & INTERFACING Name : Enroll no. : Class Year : 2014-15 : 5 th SEM C.E. VENUS INTERNATIONAL
More information8086 Programming. Multiplication Instructions. Multiplication can be performed on signed and unsigned numbers.
Multiplication Instructions 8086 Programming Multiplication can be performed on signed and unsigned numbers. MUL IMUL source source x AL source x AX source AX DX AX The source operand can be a memory location
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationComputer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly
Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly Instructor: Rob Bergen Applied Computer Science University of Winnipeg Decimal Addition Review decimal addition
More informationComputer Architecture..Second Year (Sem.2).Lecture(4) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات
مدرس المادة : م. سندس العزاوي... قسم / الحاسبات... - 26 27 Assembly Level Machine Organization Usage of AND, OR, XOR, NOT AND : X Y X AND Y USE : to chick any bit by change ( to ) or ( to ) EX : AX = FF5
More informationInteger Arithmetic Part2
Islamic University Of Gaza Assembly Language Faculty of Engineering Discussion Computer Department Chapter 7 Eng. Ahmed M. Ayash Date: 21/04/2013 Chapter 7 Integer Arithmetic Part2 7.4: Multiplication
More informationVARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad
Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory
More informationJones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION 80x86 Instructions
80x86 Instructions Chapter 4 In the following sections, we review some basic instructions used by the 80x86 architecture. This Jones is by & no Bartlett means a Learning, complete list LLC of the Intel
More informationLab 6: Conditional Processing
COE 205 Lab Manual Lab 6: Conditional Processing Page 56 Lab 6: Conditional Processing Contents 6.1. Unconditional Jump 6.2. The Compare Instruction 6.3. Conditional Jump Instructions 6.4. Finding the
More informationReal instruction set architectures. Part 2: a representative sample
Real instruction set architectures Part 2: a representative sample Some historical architectures VAX: Digital s line of midsize computers, dominant in academia in the 70s and 80s Characteristics: Variable-length
More informationLAB 5 Arithmetic Operations Simple Calculator
LAB 5 Arithmetic Operations Simple Calculator Objective: Practice arithmetic operation for the 80x86, such as add, subtract, multiple, divide, and mod. When dealing with the multiply, divide, and mod instructions
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College February 9, 2016 Reading Quiz Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College September 25, 2018 Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between programmer
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST 2 Date : 02/04/2018 Max Marks: 40 Subject & Code : Microprocessor (15CS44) Section : IV A and B Name of faculty: Deepti.C Time : 8:30 am-10:00 am Note: Note: Answer any five complete
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND Segment The "SEGMENT" and "ENDS" directives indicate to the assembler the beginning and ending of a segment and have the following format label SEGMENT [options] ;place the statements belonging
More informationAPPENDIX C INSTRUCTION SET DESCRIPTIONS
APPENDIX C INSTRUCTION SET DESCRIPTIONS This appendix provides reference information for the 80C186 Modular Core family instruction set. Tables C-1 through C-3 define the variables used in Table C-4, which
More informationCPU. IBM PC and compatible Memory Structure
CPU The CPU is usually organised in three parts: The Arithmetic and Logic Unit or ALU (which performs computations and comparisons) and the Control Unit which fetches information from and stores information
More informationInstructions moving data
do not affect flags. Instructions moving data mov register/mem, register/mem/number (move data) The difference between the value and the address of a variable mov al,sum; value 56h al mov ebx,offset Sum;
More informationSection 001. Read this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 3 for Fall Semester,
More informationExperiment 3 3 Basic Input Output
Experiment 3 3 Basic Input Output Introduction The aim of this experiment is to introduce the use of input/output through the DOS interrupt. Objectives: INT Instruction Keyboard access using DOS function
More informationBLDEA S V.P. DR. P.G. HALAKATTI COLLEGE OF ENGINEERING & TECHNOLOGY, VIJAYAPURA
EXPERIMENT NO.:- 1. BINARY SEARCH Work Space: Register Used Memory Address Data DI 10000H 11H 10001H 11H 10002H 22H 10003H 22H BX 10004H 33H 10005H 33H 10006H 44H 10007H 44H CX 10008H 55H 10009H 55H 24
More informationmith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut dthiebaut@smith.edu 2 Videos to Watch at a Later Time https://www.youtube.com/watch?v=fdmzngwchdk https://www.youtube.com/watch?v=k2iz1qsx4cm
More informationIFE: Course in Low Level Programing. Lecture 6
IFE: Course in Low Level Programing Lecture 6 Instruction Set of Intel x86 Microprocessors Conditional jumps Jcc jump on condition cc, JMP jump always, CALL call a procedure, RET return from procedure,
More informationMr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU
5 Years Integrated M.Sc.(IT) Semester 4 060010402 System Programming Question Bank Unit 1: Introduction 1. Write the decimal equivalent for each integral power of 2 from 2! to 2!". 2. Convert the following
More informationAssembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice
Assembler lecture 4 S.Šimoňák, DCI FEEI TU of Košice Addressing data access specification arrays - specification and manipulation impacts of addressing to performance Processor architecture CISC (more
More information1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M
Increment R16 1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M 4 x (16+48) = 256 opcodes 2 PUSH/ POP R16/M16/SR/F 2 x (8+24+4+1) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M 4 x (16+48) = 256 opcodes INC
More informationMicroprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)
Microprocessor and Assembly Language Week-5 System Programming, BCS 6th, IBMS (2017) High Speed Memory Registers CPU store data temporarily in these location CPU process, store and transfer data from one
More informationCONTENTS. 1. Display a Message Display a one Digit Number Accept a Character from keyboard and display the character 4
University of Kashmir, North Campus Course Code Course Name Course Instructor MCA-104-DCE Assembly Language Programming Bilal Ahmad Dar CONTENTS 1. Display a Message 2 2. Display a one Digit Number 3 3.
More informationEEM336 Microprocessors I. Arithmetic and Logic Instructions
EEM336 Microprocessors I Arithmetic and Logic Instructions Introduction We examine the arithmetic and logic instructions. The arithmetic instructions include addition, subtraction, multiplication, division,
More informationLesson 1. Fundamentals of assembly language
Lesson 1. Fundamentals of assembly language Computer Structure and Organization Graduate in Computer Sciences Graduate in Computer Engineering Graduate in Computer Sciences Graduate in Computer Engineering
More informationEthical Hacking. Assembly Language Tutorial
Ethical Hacking Assembly Language Tutorial Number Systems Memory in a computer consists of numbers Computer memory does not store these numbers in decimal (base 10) Because it greatly simplifies the hardware,
More informationSOEN228, Winter Revision 1.2 Date: October 25,
SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain
More informationORG ; TWO. Assembly Language Programming
Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify
More informationProgram Control Instructions
Program Control Instructions Introduction This chapter explains the program control instructions, including the jumps, calls, returns, interrupts, and machine control instructions. This chapter also presents
More informationContents 8051 Instruction Set BY D. BALAKRISHNA, Research Assistant, IIIT-H Chapter I : Control Transfer Instructions Lesson (a): Loop Lesson (b): Jump (i) Conditional Lesson (c): Lesson (d): Lesson (e):
More informationEx : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.
Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H. MOV AX, 5000H MOV DS, AX MOV AL, 20H MOV CL, 30H ADD AL, CL MOV CL, 10H MUL CL
More informationComputer Organisation CS303
Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with
More informationIntel x86 Jump Instructions. Part 5. JMP address. Operations: Program Flow Control. Operations: Program Flow Control.
Part 5 Intel x86 Jump Instructions Control Logic Fly over code Operations: Program Flow Control Operations: Program Flow Control Unlike high-level languages, processors don't have fancy expressions or
More informationAdding Binary Integers. Part 5. Adding Base 10 Numbers. Adding 2's Complement. Adding Binary Example = 10. Arithmetic Logic Unit
Part 5 Adding Binary Integers Arithmetic Logic Unit = Adding Binary Integers Adding Base Numbers Computer's add binary numbers the same way that we do with decimal Columns are aligned, added, and "'s"
More informationIntel x86 Jump Instructions. Part 5. JMP address. Operations: Program Flow Control. Operations: Program Flow Control.
Part 5 Intel x86 Jump Instructions Control Logic Fly over code Operations: Program Flow Control Operations: Program Flow Control Unlike high-level languages, processors don't have fancy expressions or
More informationAdding Binary Integers. Part 4. Negative Binary. Integers. Adding Base 10 Numbers. Adding Binary Example = 10. Arithmetic Logic Unit
Part 4 Adding Binary Integers Arithmetic Logic Unit = Adding Binary Integers Adding Base Numbers Computer's add binary numbers the same way that we do with decimal Columns are aligned, added, and "'s"
More informationModule 3 Instruction Set Architecture (ISA)
Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O
More informationMicrocomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات
1) Input/output In computing, input/output or I/O, is the communication between an information processing system (such as a computer) and the outside world, possibly a human or another information processing
More informationCC411: Introduction To Microprocessors
CC411: Introduction To Microprocessors OBJECTIVES this chapter enables the student to: Describe the Intel family of microprocessors from 8085 to Pentium. In terms of bus size, physical memory & special
More information8088/8086 Programming Integer Instructions and Computations
Unit3 reference 2 8088/8086 Programming Integer Instructions and Computations Introduction Up to this point we have studied the software architecture of the 8088 and 8086 microprocessors, their instruction
More informationCHAPTER SEVENTEEN Assemblers versus Compilers. Intel 80x86 Assembly Language
CHAPTER SEVENTEEN Intel 80x86 Assembly Language In Chapter 15, we developed a generic assembly language and its associated machine code. This language was presented to create a few simple programs and
More informationELEC 242 Time Delay Procedure
There are many occasions where we wish to time events. If we are using a personal computer, we have a number of ways to do this. The 8088/8086 computer had a Programmable Interval Timer like the 8253/54
More informationSection 002. Read this before starting!
Points missed: Student's Name: _ Total score: /100 points East Tennessee State University -- Department of Computer and Information Sciences CSCI 2150 Computer Organization Final Exam for Fall Semester,
More informationMarking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of
More informationComputer Science Final Examination Wednesday December 13 th 2006
Computer Science 03-60-266 Final Examination Wednesday December 13 th 2006 Dr. Alioune Ngom Last Name: First Name: Student Number: INSTRUCTIONS EXAM DURATION IS 3 hours. OPEN NOTES EXAM: lecture notes,
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 5 Jump, Conditional Jump, Looping, Compare instructions Labels and jumping (the jmp instruction) mov eax, 1 add eax, eax jmp label1 xor eax, eax label1: sub eax, 303
More informationfrom WRITE GREAT CODE Volume 2: Thinking Low-Level, Writing High-Level ONLINE APPENDIX A The Minimal 80x86 Instruction Set by Randall Hyde
from WRITE GREAT CODE Volume 2: Thinking Low-Level, Writing High-Level ONLINE APPENDIX A The Minimal 80x86 Set by Randall Hyde San Francisco WRITE GREAT CODE, Volume 2. Copyright 2006 by Randall Hyde.
More informationUS06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 3: Assembly Language Instructions II
Unconditional & Conditional JUMP instructions: Conditional JUMP instructions: JA/JNBE Jump if above / Jump if not Below or Equal These two mnemonics represent the same instruction. The term above and below
More informationKinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other
Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers
More informationExperiment N o 1. 1 Introduction to Assembly Language Programming
Experiment N o 1 1 Introduction to Assembly Language Programming Introduction: This experiment introduces the student to assembly language programming. In order to illustrate the basic concepts of assembly
More information3.1 DATA MOVEMENT INSTRUCTIONS 45
3.1.1 General-Purpose Data Movement s 45 3.1.2 Stack Manipulation... 46 3.1.3 Type Conversion... 48 3.2.1 Addition and Subtraction... 51 3.1 DATA MOVEMENT INSTRUCTIONS 45 MOV (Move) transfers a byte, word,
More informationBranching and Looping
Branching and Looping EECE416 uc Fall 2011 Unconditional Jumps jmp Like a goto in a high-level language Format: jmp StatementLabel The next statement executed will be the one at StatementLabel: jmp Encoding
More informationChapter 6 (Part a) Conditional Processing
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2025: Assembly Language Discussion Chapter 6 (Part a) Conditional Processing Eng. Eman R. Habib April, 2014 2 Assembly
More informationLecture (07) x86 programming 6
Lecture (07) x86 programming 6 By: Dr. Ahmed ElShafee 1 The Flag Register 31 21 20 19 18 17 16 14 13 12 11 10 9 8 7 6 4 2 0 ID VIP VIF AC VM RF NT IOP 1 IOP 0 O D I T S Z A P C 8088/8086 80286 80386 80486
More information9/25/ Software & Hardware Architecture
8086 Software & Hardware Architecture 1 INTRODUCTION It is a multipurpose programmable clock drive register based integrated electronic device, that reads binary instructions from a storage device called
More informationCNIT 127: Exploit Development. Ch 1: Before you begin. Updated
CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial
More informationLogic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A
Segment 4A Logic Instructions Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Course Instructor Mohammed Abdul kader Lecturer, EEE, IIUC Basic
More informationL1 Remember, L2 Understand, L3 - Apply, L4 Analyze, L5 Evaluate, L6 Create
Sample µp questions Syllabus: Microprocessors And Microcontrollers - 15CS44: Modules 1, 2, 3, 4, 5 Text book: Muhammad Ali Mazidi, Janice GillispieMazidi, Danny Causey, The x86 PC Assembly Language Design
More information